diff --git a/apps/sunboard/sunboard.go b/apps/sunboard/sunboard.go index ade7b99..55474ef 100644 --- a/apps/sunboard/sunboard.go +++ b/apps/sunboard/sunboard.go @@ -2,20 +2,23 @@ package sunboard import ( "net/http" + "personalwebsite/apps" "personalwebsite/webfilesystem" "github.com/gin-gonic/gin" ) type SunboardApp struct { - fs *webfilesystem.WebFileSystem - appID string + fs *webfilesystem.WebFileSystem + appID string + appStorage *apps.ApplicationsStorage } -func NewSunboardApp(webFs *webfilesystem.WebFileSystem) *SunboardApp { +func NewSunboardApp(webFs *webfilesystem.WebFileSystem, appStorage *apps.ApplicationsStorage) *SunboardApp { newApp := SunboardApp{ - fs: webFs, - appID: "Sunboard", + fs: webFs, + appID: "Sunboard", + appStorage: appStorage, } return &newApp } @@ -30,6 +33,28 @@ func (a *SunboardApp) PublicRoutes(route *gin.RouterGroup) { func (a *SunboardApp) PrivateRoutes(router *gin.RouterGroup) { router.POST("render", func(ctx *gin.Context) { - ctx.HTML(http.StatusOK, "sunboard/sunboard.html", gin.H{}) + appIcons := []appIcon{} + for _, app := range a.appStorage.Apps { + if app.GetAppID() == "Sunboard" { + continue + } + + appIcons = append(appIcons, appIcon{ + Type: "Icon", + Icon: "", + Lable: app.GetAppID(), + AppId: app.GetAppID(), + }) + } + ctx.HTML(http.StatusOK, "sunboard/sunboard.html", gin.H{ + "AppsIcons": appIcons, + }) }) } + +type appIcon struct { + AppId string + Type string + Icon string + Lable string +} diff --git a/front/src/apps/finder/finder-window.js b/front/src/apps/finder/finder-window.js index bcf4665..3fda119 100644 --- a/front/src/apps/finder/finder-window.js +++ b/front/src/apps/finder/finder-window.js @@ -22,6 +22,10 @@ export default class FinderWindow{ async Init(finder, args, runContext){ this.#finder = finder this.#wde = runContext.WDE + if (runContext.isMobile){ + this.CreateMobileView(args, runContext) + return + } if (args[1] == "--desktop"){ let desktopNode = document.body.querySelector(`#${args[2]}`) if (desktopNode == null){ @@ -98,6 +102,33 @@ export default class FinderWindow{ this.RenderDir(args[0]) } + CreateDesktopWindow(){ + + } + + /** + * @param {*} args + * @param {import("../../wde/wde-desktop").runContext} runContext + * @returns + */ + async CreateMobileView(args, runContext){ + + const params = new URLSearchParams({isMobile: false}) //FIXME + const response = await fetch(`/app/${this.#appId}/render?` + params, + { + method: "POST", + body: JSON.stringify(runContext) + }) + if (response.status != 200){ + const error = await response.json() + this.#wde.Alert(error.message) + return + } + const html = await response.text() + console.log(this.#wde) + let newView = this.#wde.Decorat.CreateNewView(this.#appId,) + newView.innerHTML = html + } /** * @param {string} path */ diff --git a/front/src/apps/finder/finder.js b/front/src/apps/finder/finder.js index 8881b93..9bdf194 100644 --- a/front/src/apps/finder/finder.js +++ b/front/src/apps/finder/finder.js @@ -18,12 +18,21 @@ export default class Finder extends WDEApplication{ /** * @param {string[]} args - * @param {import("../../wde/wde-desktop.js").runContext} + * @param {import("../../wde/wde-desktop.js").runContext} runContext */ async NewWindow(args, runContext){ let newFinder = new FinderWindow() await newFinder.Init(this, args, runContext) + } + + /** + * @param {string[]} args + * @param {import("../../wde/wde-desktop.js").runContext} runContext + */ + async NewView(args, runContext){ + let newFinderView = new FinderWindow(this, args, runContext) + await newFinderView.Init(this, args, runContext) } /** diff --git a/front/src/mobile.less b/front/src/mobile.less index a702f08..c3470f9 100644 --- a/front/src/mobile.less +++ b/front/src/mobile.less @@ -16,4 +16,36 @@ body{ user-select: none; /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */ touch-action: manipulation; + + /* Auto layout */ + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: flex-start; } + +#mobile-app-views{ + width: 100%; + height: 100%; + // background-color: @col-ceil; +} + +#controls-bar{ + &:extend(.WdePrimitives.AdjectiveElement); + width: 100%; + height: 150px; + background-color: @col-argent; + + /* Auto layout */ + display: flex; + flex-direction: row; + align-items: flex-start; + justify-content: flex-start; +} + +.mobile-app-view{ + // background-color: burlywood; + width: 100%; + height: 100%; + // position: absolute; +} \ No newline at end of file diff --git a/front/src/wde/decorat/mobile-decorat.js b/front/src/wde/decorat/mobile-decorat.js index e73acf7..a9cddd1 100644 --- a/front/src/wde/decorat/mobile-decorat.js +++ b/front/src/wde/decorat/mobile-decorat.js @@ -1,3 +1,27 @@ export default class MobileDecorat { - + /** @type {Element} */ + #applicationsNode + constructor(){ + this.#applicationsNode = document.body.querySelector("#mobile-app-views") //TODO validate + } + + /** + * @param {string} appId + * @returns {Element} + */ + CreateNewView(appId){ + let newView = document.createElement("div") + newView.setAttribute("class", "mobile-app-view") + newView.setAttribute("appId", appId) + this.#applicationsNode.appendChild(newView) + return newView + } + Open(){ + + } + BackAction(){ + // console.log(this.#applicationsNode.childNodes.length) + if (this.#applicationsNode.childNodes.length <= 1) return + this.#applicationsNode.lastChild.remove() + } } \ No newline at end of file diff --git a/front/src/wde/sunboard/sunboard-mobile.js b/front/src/wde/sunboard/sunboard-mobile.js index 0a43488..d7d525e 100644 --- a/front/src/wde/sunboard/sunboard-mobile.js +++ b/front/src/wde/sunboard/sunboard-mobile.js @@ -11,19 +11,15 @@ export default class MobileDesktop{ } async load(){ - this.createMainDivs() + let view = this.#createDesktopView() } - async createMainDivs(){ - let sunboardNode = document.body.querySelector("#mobile-sunboard") - if (sunboardNode == null){ - // this.#wde.Alert("Desktop node not found") - return - } + async #createDesktopView(){ + let view = await this.#wde.Decorat.CreateNewView("Sunboard") //FIXME const params = new URLSearchParams({ // path: args[0] //FIXME - path: "/" + path: "/" //FIXME }) const response = await fetch(`/app/Sunboard/render?` + params, { @@ -36,21 +32,17 @@ export default class MobileDesktop{ return } const html = await response.text() - sunboardNode.innerHTML = html + view.innerHTML = html - console.log(this.#wde.FileView) - - let iconsNode = document.body.querySelector("#icons") - - this.fileView = new this.#wde.FileView( - iconsNode, - (event) =>{}, - (event) => { }, - (event, draggedElem) => {}, - () => { } - ) - // this.RenderDir(args[0]) - return + let iconsList = view.querySelectorAll(".app-icon") + iconsList.forEach(element => { + let appId = element.getAttribute('appId') + element.addEventListener('click', () => { + // console.log(appId) + // this.#wde.Decorat.CreateNewView(appId) + this.#wde.Open("/Applications/Finder.app", [""], "") + }) + }); } async createFileView(){ diff --git a/front/src/wde/sunboard/sunboard-mobile.less b/front/src/wde/sunboard/sunboard-mobile.less index c6ca4ff..1ff6e34 100644 --- a/front/src/wde/sunboard/sunboard-mobile.less +++ b/front/src/wde/sunboard/sunboard-mobile.less @@ -18,10 +18,44 @@ background-color: @col-ceil; } -#down-bar{ - &:extend(.WdePrimitives.AdjectiveElement); - width: 100%; - height: 150px; - background-color: @col-argent; +// #down-bar{ +// &:extend(.WdePrimitives.AdjectiveElement); +// width: 100%; +// height: 150px; +// background-color: @col-argent; +// } + +.apps-list{ + /* Auto layout */ + display: flex; + padding: 64px 32px; + align-items: flex-start; + align-content: flex-start; + gap: 103px 18px; + flex: 1 0 0; + align-self: stretch; + flex-wrap: wrap; +} + +.app-icon{ + width: 100px; + height: 100px; + + /* Auto layout */ + display: flex; + padding: 4px 8px; + flex-direction: column; + align-items: center; + gap: 10px; +} + +.app-icon .icon{ + width: 64px; + height: 64px; + background-color: beige; +} + +.app-icon .lable{ + } diff --git a/front/src/wde/wde-desktop.js b/front/src/wde/wde-desktop.js index 031e0a9..a1e40c9 100644 --- a/front/src/wde/wde-desktop.js +++ b/front/src/wde/wde-desktop.js @@ -83,8 +83,6 @@ export default class WebDesktopEnvironment{ } else { WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext) } - - } /** diff --git a/front/src/wde/wde-mobile.js b/front/src/wde/wde-mobile.js index 1d42c15..3a23337 100644 --- a/front/src/wde/wde-mobile.js +++ b/front/src/wde/wde-mobile.js @@ -1,7 +1,8 @@ import MobileDecorat from "./decorat/mobile-decorat.js" import MobileSunboard from "./sunboard/sunboard-mobile.js" +import AbstractWebDesktopEnvironment from "./wde.js" import WDEFileView from "./widgets/file-view/file-view.js" -export default class MobileWebDesktopEnvironment{ +export default class MobileWebDesktopEnvironment extends AbstractWebDesktopEnvironment{ /** @type {MobileDecorat} */ Decorat /** @type {WDEFileView} */ @@ -9,14 +10,41 @@ export default class MobileWebDesktopEnvironment{ /** @type {MobileSunboard} */ #sunBoard constructor(){ + + super() document.body.style.setProperty('--zoom', 3) this.Decorat = new MobileDecorat() this.FileView = WDEFileView this.#sunBoard = new MobileSunboard(this) - this.#sunBoard + this.loadWDE() } loadWDE(){ - + this.#initControlsBar() + } + + /** + * @param {string} appPath + * @param {string[]} args + * @param {string} runPath + */ + async Open(appPath, args, runPath){ + super._Open(appPath, args, runPath, async (appManifest, runContext) => { + console.log(super._GetApp(appManifest.appId)) + // console.log(super()) + let contentView = await super._GetApp(appManifest.appId).NewWindow(args, runContext) + let view = this.Decorat.CreateNewView() + console.log(view) + view.appendChild(contentView) + // super._GetApp + }) + + } + #initControlsBar(){ + let barNode = document.body.querySelector("#controls-bar")//TODO Validate + + barNode.querySelector("#back").addEventListener('click', () => { + this.Decorat.BackAction() + }) } } \ No newline at end of file diff --git a/front/src/wde/wde.js b/front/src/wde/wde.js new file mode 100644 index 0000000..c822f5d --- /dev/null +++ b/front/src/wde/wde.js @@ -0,0 +1,78 @@ +import WDEApplication from "./application.js" + +export default class AbstractWebDesktopEnvironment{ + /** @type {Object} */ + _applications = {} + constructor(){ + + } + + /** + * @param {string} path + * @returns {Object | undefined} //FIXME + */ + async _FetchAppManifest(path){ + console.log("path: " + path ) + const params = new URLSearchParams({path: path, mode: "json"}) + const response = await fetch(`/system/loadApp?` + params) + if (response.status != 200){ + const error = await response.json() + // WebDesktopEnvironment.Alert(error.message) //FIXME + return undefined + } + //TODO Validate manifest + const appManifest = response.json() + return appManifest + } + + /** + * @param {string} appPath + * @param {string[]} args + * @param {string} runPath + * @param {callback} function + */ + async _Open(appPath, args, runPath, callback){ + const appManifest = await this._FetchAppManifest(appPath) + + if (appManifest === undefined) return //TODO return err + /**@type {runContext} */ + const runContext = { + WDE: this, + isMobile: true, + bundlePath: appPath, + runPath: runPath + } + + if (this._applications[appManifest.appId] === undefined){ + this.#loadApp(appManifest, () => { + callback(appManifest, runContext) + }) + } else { + callback(appManifest, runContext) + } + } + + /** + * @param {*} appManifest + * @param {function} onload callback after script loading + */ + async #loadApp(appManifest, onload){ + // console.log(appManifest) + // import(window.location.origin + appManifest.js[0]).then((app) => { + // console.log(window.location.origin + appManifest.js[0] == 'http://localhost:8080/res/dev-fs/wde/dist/finder.js') + // let kek = 'http://localhost:8080/res/dev-fs/wde/dist/finder.js' + import('http://localhost:8080/res/dev-fs/dist/finder.js').then((app) => { + let newApp = new app.default() + // if newApp //TODO Validate + this._applications[appManifest.appId] = newApp; + onload() + }) + + return //TODO return result + } + + _GetApp(appId){ + console.log(appId) + return this._applications[appId] + } +} \ No newline at end of file diff --git a/main.go b/main.go index fcd9efd..73a1dae 100644 --- a/main.go +++ b/main.go @@ -73,7 +73,7 @@ func main() { imgViewerApp := imgviewer.NewImgViewerApp(webfs) blogViewerApp := blogviewer.NewBlogViewerApp(webfs) blogWriterApp := blogwriter.NewBlogWriterApp(webfs) - sunBoardApp := sunboard.NewSunboardApp(webfs) + sunBoardApp := sunboard.NewSunboardApp(webfs, appsStorage) appsStorage.Apps["personal-properties"] = persPropsApp appsStorage.Apps["finder"] = finderApp appsStorage.Apps["img-viewer"] = imgViewerApp diff --git a/res/dev-fs/dist/desktop.js b/res/dev-fs/dist/desktop.js index e590b13..7b1978d 100644 --- a/res/dev-fs/dist/desktop.js +++ b/res/dev-fs/dist/desktop.js @@ -27,7 +27,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_http_localhost_8080_res_dev_fs_dist_f \********************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEApplication)\n/* harmony export */ });\n/* harmony import */ var _wde_desktop_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wde-desktop.js */ \"./src/wde/wde-desktop.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\nvar _wde = /*#__PURE__*/new WeakMap();\nvar WDEApplication = /*#__PURE__*/function () {\n /** @type {WebDesktopEnvironment} */\n\n /**\n * @constructor\n * @param {WebDesktopEnvironment} wde \n */\n function WDEApplication(wde) {\n _classCallCheck(this, WDEApplication);\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _wde, wde);\n }\n _createClass(WDEApplication, [{\n key: \"getWde\",\n value: function getWde() {\n return _classPrivateFieldGet(this, _wde);\n }\n }]);\n return WDEApplication;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/application.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEApplication)\n/* harmony export */ });\n/* harmony import */ var _wde_desktop_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wde-desktop.js */ \"./src/wde/wde-desktop.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\nvar _wde = /*#__PURE__*/new WeakMap();\nvar WDEApplication = /*#__PURE__*/function () {\n /** @type {WebDesktopEnvironment} */\n\n /**\r\n * @constructor\r\n * @param {WebDesktopEnvironment} wde \r\n */\n function WDEApplication(wde) {\n _classCallCheck(this, WDEApplication);\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _wde, wde);\n }\n _createClass(WDEApplication, [{\n key: \"getWde\",\n value: function getWde() {\n return _classPrivateFieldGet(this, _wde);\n }\n }]);\n return WDEApplication;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/application.js?"); /***/ }), @@ -37,7 +37,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \********************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ DesktopDecorat)\n/* harmony export */ });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _windowsLayer = /*#__PURE__*/new WeakMap();\nvar _makeid = /*#__PURE__*/new WeakSet();\nvar DesktopDecorat = /*#__PURE__*/function () {\n /** @type {Element} */\n\n function DesktopDecorat() {\n var _this = this;\n _classCallCheck(this, DesktopDecorat);\n _classPrivateMethodInitSpec(this, _makeid);\n _classPrivateFieldInitSpec(this, _windowsLayer, {\n writable: true,\n value: void 0\n });\n this.windowLayer = document.body.querySelector('#windows-layer');\n // this.#windowsLayer = document.body.querySelector('#windows-layer')\n _classPrivateFieldSet(this, _windowsLayer, document.body.querySelector('#windows-layer'));\n var startDrag = function startDrag(event) {\n var window = event.target.closest('.WindowFrame');\n _this.bringWindowToFront(window);\n if (event.target.classList.contains(\"DragArea\")) {\n var xPosInit = event.offsetX;\n var yPosInit = event.offsetY;\n var dragWindow = function dragWindow(event) {\n window.style.left = \"\".concat(event.clientX - xPosInit, \"px\");\n window.style.top = \"\".concat(event.clientY - yPosInit, \"px\");\n };\n var stopDrag = function stopDrag() {\n removeEventListener('mousemove', dragWindow);\n removeEventListener('mouseup', stopDrag);\n };\n addEventListener('mousemove', dragWindow);\n addEventListener('mouseup', stopDrag);\n }\n };\n _classPrivateFieldGet(this, _windowsLayer).addEventListener('mousedown', startDrag);\n }\n\n /**\n * @param {HTMLElement} window\n */\n _createClass(DesktopDecorat, [{\n key: \"bringWindowToFront\",\n value: function bringWindowToFront(window) {\n //FIXME\n var previousWindow = _classPrivateFieldGet(this, _windowsLayer).lastChild;\n if (window == null || window == undefined) {\n return;\n }\n if (window != previousWindow) {\n _classPrivateFieldGet(this, _windowsLayer).insertBefore(window, previousWindow.nextSibling);\n previousWindow.classList.remove(\"Focused\");\n window.classList.add(\"Focused\");\n } else {\n window.classList.add(\"Focused\");\n }\n return;\n }\n\n /**\n * @param {string} appId\n * @param {number} width\n * @param {number} height\n * @returns {HTMLElement}\n */\n }, {\n key: \"CreateNewWindow\",\n value: function CreateNewWindow(appId, width, height) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute('appid', appId);\n newWindow.setAttribute(\"class\", \"WindowFrame ConvexElement\");\n newWindow.setAttribute(\"windowId\", _classPrivateMethodGet(this, _makeid, _makeid2).call(this, 4)); //TODO:\n\n newWindow.style.width = width.toString() + \"px\";\n newWindow.style.height = height.toString() + \"px\";\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n return newWindow;\n }\n\n /**\n * @param {HTMLElement} window\n */\n }, {\n key: \"CloseWindow\",\n value: function CloseWindow(window) {\n window.remove();\n }\n }, {\n key: \"CloseFocusedWindow\",\n value: function CloseFocusedWindow() {\n if (document.body.querySelector('#windows-layer').childElementCount > 1) {\n document.body.querySelector('#windows-layer').lastElementChild.remove();\n }\n }\n }], [{\n key: \"ChangeURL\",\n value: function ChangeURL(appWindow) {\n var appId = appWindow.getAttribute('appid');\n window.history.replaceState(null, \"\", \"/\".concat(appId, \"/\"));\n }\n\n /**\n * @param {num} length\n */\n }]);\n return DesktopDecorat;\n}();\nfunction _makeid2(length) {\n var result = '';\n var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var charactersLength = characters.length;\n var counter = 0;\n while (counter < length) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n counter += 1;\n }\n return result;\n}\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/decorat/desktop-decorat.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ DesktopDecorat)\n/* harmony export */ });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _windowsLayer = /*#__PURE__*/new WeakMap();\nvar _makeid = /*#__PURE__*/new WeakSet();\nvar DesktopDecorat = /*#__PURE__*/function () {\n /** @type {Element} */\n\n function DesktopDecorat() {\n var _this = this;\n _classCallCheck(this, DesktopDecorat);\n _classPrivateMethodInitSpec(this, _makeid);\n _classPrivateFieldInitSpec(this, _windowsLayer, {\n writable: true,\n value: void 0\n });\n this.windowLayer = document.body.querySelector('#windows-layer');\n // this.#windowsLayer = document.body.querySelector('#windows-layer')\n _classPrivateFieldSet(this, _windowsLayer, document.body.querySelector('#windows-layer'));\n var startDrag = function startDrag(event) {\n var window = event.target.closest('.WindowFrame');\n _this.bringWindowToFront(window);\n if (event.target.classList.contains(\"DragArea\")) {\n var xPosInit = event.offsetX;\n var yPosInit = event.offsetY;\n var dragWindow = function dragWindow(event) {\n window.style.left = \"\".concat(event.clientX - xPosInit, \"px\");\n window.style.top = \"\".concat(event.clientY - yPosInit, \"px\");\n };\n var stopDrag = function stopDrag() {\n removeEventListener('mousemove', dragWindow);\n removeEventListener('mouseup', stopDrag);\n };\n addEventListener('mousemove', dragWindow);\n addEventListener('mouseup', stopDrag);\n }\n };\n _classPrivateFieldGet(this, _windowsLayer).addEventListener('mousedown', startDrag);\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n _createClass(DesktopDecorat, [{\n key: \"bringWindowToFront\",\n value: function bringWindowToFront(window) {\n //FIXME\n var previousWindow = _classPrivateFieldGet(this, _windowsLayer).lastChild;\n if (window == null || window == undefined) {\n return;\n }\n if (window != previousWindow) {\n _classPrivateFieldGet(this, _windowsLayer).insertBefore(window, previousWindow.nextSibling);\n previousWindow.classList.remove(\"Focused\");\n window.classList.add(\"Focused\");\n } else {\n window.classList.add(\"Focused\");\n }\n return;\n }\n\n /**\r\n * @param {string} appId\r\n * @param {number} width\r\n * @param {number} height\r\n * @returns {HTMLElement}\r\n */\n }, {\n key: \"CreateNewWindow\",\n value: function CreateNewWindow(appId, width, height) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute('appid', appId);\n newWindow.setAttribute(\"class\", \"WindowFrame ConvexElement\");\n newWindow.setAttribute(\"windowId\", _classPrivateMethodGet(this, _makeid, _makeid2).call(this, 4)); //TODO:\n\n newWindow.style.width = width.toString() + \"px\";\n newWindow.style.height = height.toString() + \"px\";\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n return newWindow;\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n }, {\n key: \"CloseWindow\",\n value: function CloseWindow(window) {\n window.remove();\n }\n }, {\n key: \"CloseFocusedWindow\",\n value: function CloseFocusedWindow() {\n if (document.body.querySelector('#windows-layer').childElementCount > 1) {\n document.body.querySelector('#windows-layer').lastElementChild.remove();\n }\n }\n }], [{\n key: \"ChangeURL\",\n value: function ChangeURL(appWindow) {\n var appId = appWindow.getAttribute('appid');\n window.history.replaceState(null, \"\", \"/\".concat(appId, \"/\"));\n }\n\n /**\r\n * @param {num} length\r\n */\n }]);\n return DesktopDecorat;\n}();\nfunction _makeid2(length) {\n var result = '';\n var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var charactersLength = characters.length;\n var counter = 0;\n while (counter < length) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n counter += 1;\n }\n return result;\n}\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/decorat/desktop-decorat.js?"); /***/ }), @@ -47,7 +47,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \****************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WdeScrollBar)\n/* harmony export */ });\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nvar WdeScrollBar = /*#__PURE__*/_createClass(\n/**\n* @param {HTMLElement} scrollBarContainer\n* @param {HTMLElement} content\n*/\nfunction WdeScrollBar(scrollBarContainer, content) {\n var _this = this;\n _classCallCheck(this, WdeScrollBar);\n var nonNativeScroll = false;\n // console.log(scrollBarContainer, content)\n // let handler = scrollBarContainer.children[0]\n //TODO On scroll move focus on window?\n var handler = scrollBarContainer.querySelector(\".ScrollBarScrollElement\"); //TODO Refactor classes\n // console.log(handler)\n\n handler.style.height = content.clientHeight / content.scrollHeight * handler.parentElement.clientHeight + 'px';\n var max = handler.parentElement.clientHeight - handler.clientHeight;\n var yPosInit = 0;\n handler.addEventListener('mousedown', function (event) {\n nonNativeScroll = true;\n yPosInit = event.clientY - Number(handler.style.top.replace('px', ''));\n document.addEventListener('mousemove', drag);\n document.addEventListener('mouseup', stop);\n });\n content.addEventListener('scroll', function (event) {\n if (!_this.nonNativeScroll) {\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n handler.style.top = content.scrollTop / coefficient + 'px';\n }\n });\n function drag() {\n // console.log(event.clientY - yPosInit, Number(handler.style.top.replace('px','' )))\n var pos = event.clientY - yPosInit;\n var clampPos = Math.min(Math.max(pos, 0), max);\n handler.style.top = clampPos + \"px\";\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n // console.log(clampPos, coefficient, content.clientHeight, clampPos* coefficient)\n\n content.scrollTop = clampPos * coefficient;\n }\n function stop() {\n // console.log(\"stop\")\n document.removeEventListener('mousemove', drag);\n document.removeEventListener('mouseup', stop);\n nonNativeScroll = false;\n }\n});\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/scrollbar/scrollbar.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WdeScrollBar)\n/* harmony export */ });\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nvar WdeScrollBar = /*#__PURE__*/_createClass(\n/**\r\n* @param {HTMLElement} scrollBarContainer\r\n* @param {HTMLElement} content\r\n*/\nfunction WdeScrollBar(scrollBarContainer, content) {\n var _this = this;\n _classCallCheck(this, WdeScrollBar);\n var nonNativeScroll = false;\n // console.log(scrollBarContainer, content)\n // let handler = scrollBarContainer.children[0]\n //TODO On scroll move focus on window?\n var handler = scrollBarContainer.querySelector(\".ScrollBarScrollElement\"); //TODO Refactor classes\n // console.log(handler)\n\n handler.style.height = content.clientHeight / content.scrollHeight * handler.parentElement.clientHeight + 'px';\n var max = handler.parentElement.clientHeight - handler.clientHeight;\n var yPosInit = 0;\n handler.addEventListener('mousedown', function (event) {\n nonNativeScroll = true;\n yPosInit = event.clientY - Number(handler.style.top.replace('px', ''));\n document.addEventListener('mousemove', drag);\n document.addEventListener('mouseup', stop);\n });\n content.addEventListener('scroll', function (event) {\n if (!_this.nonNativeScroll) {\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n handler.style.top = content.scrollTop / coefficient + 'px';\n }\n });\n function drag() {\n // console.log(event.clientY - yPosInit, Number(handler.style.top.replace('px','' )))\n var pos = event.clientY - yPosInit;\n var clampPos = Math.min(Math.max(pos, 0), max);\n handler.style.top = clampPos + \"px\";\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n // console.log(clampPos, coefficient, content.clientHeight, clampPos* coefficient)\n\n content.scrollTop = clampPos * coefficient;\n }\n function stop() {\n // console.log(\"stop\")\n document.removeEventListener('mousemove', drag);\n document.removeEventListener('mouseup', stop);\n nonNativeScroll = false;\n }\n});\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/scrollbar/scrollbar.js?"); /***/ }), @@ -57,7 +57,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \********************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decorat/desktop-decorat.js */ \"./src/wde/decorat/desktop-decorat.js\");\n/* harmony import */ var _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scrollbar/scrollbar.js */ \"./src/wde/scrollbar/scrollbar.js\");\n/* harmony import */ var _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../web-fs/web-fs.js */ \"./src/web-fs/web-fs.js\");\n/* harmony import */ var _application_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./application.js */ \"./src/wde/application.js\");\n/* harmony import */ var _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./widgets/file-view/file-view.js */ \"./src/wde/widgets/file-view/file-view.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\n// import DesktopSunBoard from \"./sunboard/sunboard-desktop.js\";\nvar WebDesktopEnvironment = /*#__PURE__*/function () {\n /** @type {string} */\n\n /** @type {WDEFileView} */\n\n /** @type {WDEScrollBar} */\n\n /**@type {DesktopDecorat} */\n\n /** @type {Object} */\n\n /** Deprecated */\n\n // static decorat\n\n function WebDesktopEnvironment() {\n _classCallCheck(this, WebDesktopEnvironment);\n _defineProperty(this, \"test\", \"\");\n _defineProperty(this, \"FileView\", _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]);\n _defineProperty(this, \"ScrollBar\", _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n _defineProperty(this, \"Decorat\", void 0);\n document.body.style.setProperty('--zoom', 1);\n this.Decorat = new _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n WebDesktopEnvironment.webFs = new _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this.FileView = _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"];\n this.loadWDE();\n // this.#devLoadSunboard()\n }\n _createClass(WebDesktopEnvironment, [{\n key: \"loadWDE\",\n value: function () {\n var _loadWDE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var autoStart, _iterator, _step, child, appPath, args, argsRaw, _iterator2, _step2, argRaw, arg;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n autoStart = document.body.querySelector(\"wde-autostart\");\n if (!(autoStart == null)) {\n _context.next = 4;\n break;\n }\n WebDesktopEnvironment.Alert(\"Error in loading DE\");\n return _context.abrupt(\"return\");\n case 4:\n _iterator = _createForOfIteratorHelper(autoStart.children);\n _context.prev = 5;\n _iterator.s();\n case 7:\n if ((_step = _iterator.n()).done) {\n _context.next = 41;\n break;\n }\n child = _step.value;\n if (!(child.nodeName != \"APP\")) {\n _context.next = 11;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 11:\n appPath = child.getAttribute(\"app-path\");\n if (!(appPath == null)) {\n _context.next = 14;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 14:\n args = [];\n argsRaw = child.querySelector(\"args\");\n if (!(argsRaw == null)) {\n _context.next = 18;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 18:\n _iterator2 = _createForOfIteratorHelper(argsRaw.children);\n _context.prev = 19;\n _iterator2.s();\n case 21:\n if ((_step2 = _iterator2.n()).done) {\n _context.next = 29;\n break;\n }\n argRaw = _step2.value;\n arg = argRaw.getAttribute(\"string\");\n if (!(arg == null)) {\n _context.next = 26;\n break;\n }\n return _context.abrupt(\"continue\", 27);\n case 26:\n args.push(arg);\n case 27:\n _context.next = 21;\n break;\n case 29:\n _context.next = 34;\n break;\n case 31:\n _context.prev = 31;\n _context.t0 = _context[\"catch\"](19);\n _iterator2.e(_context.t0);\n case 34:\n _context.prev = 34;\n _iterator2.f();\n return _context.finish(34);\n case 37:\n _context.next = 39;\n return this.Open(appPath, args);\n case 39:\n _context.next = 7;\n break;\n case 41:\n _context.next = 46;\n break;\n case 43:\n _context.prev = 43;\n _context.t1 = _context[\"catch\"](5);\n _iterator.e(_context.t1);\n case 46:\n _context.prev = 46;\n _iterator.f();\n return _context.finish(46);\n case 49:\n autoStart.remove();\n case 50:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this, [[5, 43, 46, 49], [19, 31, 34, 37]]);\n }));\n function loadWDE() {\n return _loadWDE.apply(this, arguments);\n }\n return loadWDE;\n }()\n /**\n * @param {string} appPath\n * @param {string[]} args\n * @param {string} runPath\n */\n }, {\n key: \"Open\",\n value: function () {\n var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appPath, args, runPath) {\n var appManifest, runContext;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return WebDesktopEnvironment.fetchApp(appPath);\n case 2:\n appManifest = _context2.sent;\n if (!(appManifest === undefined)) {\n _context2.next = 5;\n break;\n }\n return _context2.abrupt(\"return\");\n case 5:\n //TODO return err\n /**@type {runContext} */\n runContext = {\n WDE: this,\n isMobile: false,\n bundlePath: appPath,\n runPath: runPath\n };\n if (WebDesktopEnvironment.Applications[appManifest.appId] === undefined) {\n WebDesktopEnvironment.load2(appManifest, function () {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n });\n } else {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n }\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function Open(_x, _x2, _x3) {\n return _Open.apply(this, arguments);\n }\n return Open;\n }()\n /**\n * @param {string} appManifest\n * @param {function} onload callback after script loading\n */\n }], [{\n key: \"load2\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(appManifest, onload) {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n // import(window.location.origin + appManifest.js[0]).then((app) => {\n // console.log(window.location.origin + appManifest.js[0] == 'http://localhost:8080/res/dev-fs/wde/dist/finder.js')\n // let kek = 'http://localhost:8080/res/dev-fs/wde/dist/finder.js'\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! http://localhost:8080/res/dev-fs/dist/finder.js */ \"http://localhost:8080/res/dev-fs/dist/finder.js\")).then(function (app) {\n var newApp = new app[\"default\"]();\n // if newApp //TODO Validate\n WebDesktopEnvironment.Applications[appManifest.appId] = newApp;\n onload();\n });\n return _context3.abrupt(\"return\");\n case 2:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function load2(_x4, _x5) {\n return _load.apply(this, arguments);\n }\n return load2;\n }()\n /**\n * @param {string} path\n * @returns {Object | undefined} //FIXME\n */\n }, {\n key: \"fetchApp\",\n value: function () {\n var _fetchApp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(path) {\n var params, response, error, appManifest;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n // console.log(\"path: \" + path )\n params = new URLSearchParams({\n path: path,\n mode: \"json\"\n });\n _context4.next = 3;\n return fetch(\"/system/loadApp?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 10;\n break;\n }\n _context4.next = 7;\n return response.json();\n case 7:\n error = _context4.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context4.abrupt(\"return\", undefined);\n case 10:\n //TODO Validate manifest\n appManifest = response.json();\n return _context4.abrupt(\"return\", appManifest);\n case 12:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function fetchApp(_x6) {\n return _fetchApp.apply(this, arguments);\n }\n return fetchApp;\n }()\n /**\n * @param {string} html\n */\n }, {\n key: \"SetBasicWindow\",\n value: function SetBasicWindow(html) {\n this.basicWindow = html;\n }\n\n /**\n * @returns {string}\n */\n }, {\n key: \"GetBasicWindow\",\n value: function GetBasicWindow() {\n return this.basicWindow;\n }\n\n /**\n * @param {string} alertText\n */\n }, {\n key: \"Alert\",\n value: function Alert(alertText) {\n WebDesktopEnvironment.CreateAlertWindow(alertText);\n console.log(alertText);\n }\n\n /**\n * @param {string} alertText\n */\n }, {\n key: \"CreateAlertWindow\",\n value: function CreateAlertWindow(alertText) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute(\"class\", \"WindowFrameless\");\n newWindow.setAttribute(\"windowId\", \"SuperUniqUUID\"); //TODO:\n newWindow.style.cssText = \"position:absolute;width:450px;height:116px; margin-left: -225px; margin-top:-58px;left: 50%;top: 50%;background-color:#FFFFFF;border: 1px solid #000000;box-shadow: 2px 2px 0px #000000;\";\n var alertImage = document.createElement(\"img\");\n alertImage.setAttribute(\"src\", \"/res/sys/wde/icons/ohno.png\");\n alertImage.style.cssText = \"position:absolute; width:64px;height:64px;top:15px;left:25px\";\n newWindow.appendChild(alertImage);\n var errorText = document.createElement(\"div\");\n errorText.style.cssText = \"position:absolute; width: 300px; left:128px; top:30px;font-family: 'Virtue';\";\n errorText.innerHTML = alertText;\n newWindow.appendChild(errorText);\n var closeButton = document.createElement(\"button\");\n closeButton.style.cssText = \"position:absolute; left: 382px; bottom: 10px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;\";\n closeButton.innerHTML = \"Close\";\n closeButton.addEventListener('click', function () {\n newWindow.remove();\n });\n newWindow.appendChild(closeButton);\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n }\n }]);\n return WebDesktopEnvironment;\n}();\n/**\n * @typedef {Object} runContext\n * @property {WebDesktopEnvironment} WDE \n * @property {boolean} isMobile\n * @property {string} appPath \n * @property {string} runPath //TODO\n*/\n_defineProperty(WebDesktopEnvironment, \"Applications\", {});\n_defineProperty(WebDesktopEnvironment, \"isMobile\", false);\n_defineProperty(WebDesktopEnvironment, \"webFs\", void 0);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde-desktop.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decorat/desktop-decorat.js */ \"./src/wde/decorat/desktop-decorat.js\");\n/* harmony import */ var _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scrollbar/scrollbar.js */ \"./src/wde/scrollbar/scrollbar.js\");\n/* harmony import */ var _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../web-fs/web-fs.js */ \"./src/web-fs/web-fs.js\");\n/* harmony import */ var _application_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./application.js */ \"./src/wde/application.js\");\n/* harmony import */ var _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./widgets/file-view/file-view.js */ \"./src/wde/widgets/file-view/file-view.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\n// import DesktopSunBoard from \"./sunboard/sunboard-desktop.js\";\nvar WebDesktopEnvironment = /*#__PURE__*/function () {\n /** @type {string} */\n\n /** @type {WDEFileView} */\n\n /** @type {WDEScrollBar} */\n\n /**@type {DesktopDecorat} */\n\n /** @type {Object} */\n\n /** Deprecated */\n\n // static decorat\n\n function WebDesktopEnvironment() {\n _classCallCheck(this, WebDesktopEnvironment);\n _defineProperty(this, \"test\", \"\");\n _defineProperty(this, \"FileView\", _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]);\n _defineProperty(this, \"ScrollBar\", _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n _defineProperty(this, \"Decorat\", void 0);\n document.body.style.setProperty('--zoom', 1);\n this.Decorat = new _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n WebDesktopEnvironment.webFs = new _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this.FileView = _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"];\n this.loadWDE();\n // this.#devLoadSunboard()\n }\n _createClass(WebDesktopEnvironment, [{\n key: \"loadWDE\",\n value: function () {\n var _loadWDE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var autoStart, _iterator, _step, child, appPath, args, argsRaw, _iterator2, _step2, argRaw, arg;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n autoStart = document.body.querySelector(\"wde-autostart\");\n if (!(autoStart == null)) {\n _context.next = 4;\n break;\n }\n WebDesktopEnvironment.Alert(\"Error in loading DE\");\n return _context.abrupt(\"return\");\n case 4:\n _iterator = _createForOfIteratorHelper(autoStart.children);\n _context.prev = 5;\n _iterator.s();\n case 7:\n if ((_step = _iterator.n()).done) {\n _context.next = 41;\n break;\n }\n child = _step.value;\n if (!(child.nodeName != \"APP\")) {\n _context.next = 11;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 11:\n appPath = child.getAttribute(\"app-path\");\n if (!(appPath == null)) {\n _context.next = 14;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 14:\n args = [];\n argsRaw = child.querySelector(\"args\");\n if (!(argsRaw == null)) {\n _context.next = 18;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 18:\n _iterator2 = _createForOfIteratorHelper(argsRaw.children);\n _context.prev = 19;\n _iterator2.s();\n case 21:\n if ((_step2 = _iterator2.n()).done) {\n _context.next = 29;\n break;\n }\n argRaw = _step2.value;\n arg = argRaw.getAttribute(\"string\");\n if (!(arg == null)) {\n _context.next = 26;\n break;\n }\n return _context.abrupt(\"continue\", 27);\n case 26:\n args.push(arg);\n case 27:\n _context.next = 21;\n break;\n case 29:\n _context.next = 34;\n break;\n case 31:\n _context.prev = 31;\n _context.t0 = _context[\"catch\"](19);\n _iterator2.e(_context.t0);\n case 34:\n _context.prev = 34;\n _iterator2.f();\n return _context.finish(34);\n case 37:\n _context.next = 39;\n return this.Open(appPath, args);\n case 39:\n _context.next = 7;\n break;\n case 41:\n _context.next = 46;\n break;\n case 43:\n _context.prev = 43;\n _context.t1 = _context[\"catch\"](5);\n _iterator.e(_context.t1);\n case 46:\n _context.prev = 46;\n _iterator.f();\n return _context.finish(46);\n case 49:\n autoStart.remove();\n case 50:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this, [[5, 43, 46, 49], [19, 31, 34, 37]]);\n }));\n function loadWDE() {\n return _loadWDE.apply(this, arguments);\n }\n return loadWDE;\n }()\n /**\r\n * @param {string} appPath\r\n * @param {string[]} args\r\n * @param {string} runPath\r\n */\n }, {\n key: \"Open\",\n value: function () {\n var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appPath, args, runPath) {\n var appManifest, runContext;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return WebDesktopEnvironment.fetchApp(appPath);\n case 2:\n appManifest = _context2.sent;\n if (!(appManifest === undefined)) {\n _context2.next = 5;\n break;\n }\n return _context2.abrupt(\"return\");\n case 5:\n //TODO return err\n /**@type {runContext} */\n runContext = {\n WDE: this,\n isMobile: false,\n bundlePath: appPath,\n runPath: runPath\n };\n if (WebDesktopEnvironment.Applications[appManifest.appId] === undefined) {\n WebDesktopEnvironment.load2(appManifest, function () {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n });\n } else {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n }\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function Open(_x, _x2, _x3) {\n return _Open.apply(this, arguments);\n }\n return Open;\n }()\n /**\r\n * @param {string} appManifest\r\n * @param {function} onload callback after script loading\r\n */\n }], [{\n key: \"load2\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(appManifest, onload) {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n // import(window.location.origin + appManifest.js[0]).then((app) => {\n // console.log(window.location.origin + appManifest.js[0] == 'http://localhost:8080/res/dev-fs/wde/dist/finder.js')\n // let kek = 'http://localhost:8080/res/dev-fs/wde/dist/finder.js'\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! http://localhost:8080/res/dev-fs/dist/finder.js */ \"http://localhost:8080/res/dev-fs/dist/finder.js\")).then(function (app) {\n var newApp = new app[\"default\"]();\n // if newApp //TODO Validate\n WebDesktopEnvironment.Applications[appManifest.appId] = newApp;\n onload();\n });\n return _context3.abrupt(\"return\");\n case 2:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function load2(_x4, _x5) {\n return _load.apply(this, arguments);\n }\n return load2;\n }()\n /**\r\n * @param {string} path\r\n * @returns {Object | undefined} //FIXME\r\n */\n }, {\n key: \"fetchApp\",\n value: function () {\n var _fetchApp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(path) {\n var params, response, error, appManifest;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n // console.log(\"path: \" + path )\n params = new URLSearchParams({\n path: path,\n mode: \"json\"\n });\n _context4.next = 3;\n return fetch(\"/system/loadApp?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 10;\n break;\n }\n _context4.next = 7;\n return response.json();\n case 7:\n error = _context4.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context4.abrupt(\"return\", undefined);\n case 10:\n //TODO Validate manifest\n appManifest = response.json();\n return _context4.abrupt(\"return\", appManifest);\n case 12:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function fetchApp(_x6) {\n return _fetchApp.apply(this, arguments);\n }\n return fetchApp;\n }()\n /**\r\n * @param {string} html\r\n */\n }, {\n key: \"SetBasicWindow\",\n value: function SetBasicWindow(html) {\n this.basicWindow = html;\n }\n\n /**\r\n * @returns {string}\r\n */\n }, {\n key: \"GetBasicWindow\",\n value: function GetBasicWindow() {\n return this.basicWindow;\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"Alert\",\n value: function Alert(alertText) {\n WebDesktopEnvironment.CreateAlertWindow(alertText);\n console.log(alertText);\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"CreateAlertWindow\",\n value: function CreateAlertWindow(alertText) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute(\"class\", \"WindowFrameless\");\n newWindow.setAttribute(\"windowId\", \"SuperUniqUUID\"); //TODO:\n newWindow.style.cssText = \"position:absolute;width:450px;height:116px; margin-left: -225px; margin-top:-58px;left: 50%;top: 50%;background-color:#FFFFFF;border: 1px solid #000000;box-shadow: 2px 2px 0px #000000;\";\n var alertImage = document.createElement(\"img\");\n alertImage.setAttribute(\"src\", \"/res/sys/wde/icons/ohno.png\");\n alertImage.style.cssText = \"position:absolute; width:64px;height:64px;top:15px;left:25px\";\n newWindow.appendChild(alertImage);\n var errorText = document.createElement(\"div\");\n errorText.style.cssText = \"position:absolute; width: 300px; left:128px; top:30px;font-family: 'Virtue';\";\n errorText.innerHTML = alertText;\n newWindow.appendChild(errorText);\n var closeButton = document.createElement(\"button\");\n closeButton.style.cssText = \"position:absolute; left: 382px; bottom: 10px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;\";\n closeButton.innerHTML = \"Close\";\n closeButton.addEventListener('click', function () {\n newWindow.remove();\n });\n newWindow.appendChild(closeButton);\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n }\n }]);\n return WebDesktopEnvironment;\n}();\n/**\r\n * @typedef {Object} runContext\r\n * @property {WebDesktopEnvironment} WDE \r\n * @property {boolean} isMobile\r\n * @property {string} appPath \r\n * @property {string} runPath //TODO\r\n*/\n_defineProperty(WebDesktopEnvironment, \"Applications\", {});\n_defineProperty(WebDesktopEnvironment, \"isMobile\", false);\n_defineProperty(WebDesktopEnvironment, \"webFs\", void 0);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde-desktop.js?"); /***/ }), @@ -67,7 +67,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEFileView)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar WDEFileView = /*#__PURE__*/function () {\n /**\n * @param {HTMLElement} fileViewElem\n * @param {Function} doubleClickCallback\n * @param {Function} rightClickCallback\n * @param {Function} updateFileViewCallback\n */\n function WDEFileView(fileViewElem, doubleClickCallback, rightClickCallback, fileUploadCallback, updateFileViewCallback) {\n var _this = this;\n _classCallCheck(this, WDEFileView);\n _defineProperty(this, \"path\", \"\");\n _defineProperty(this, \"parentElem\", undefined);\n _defineProperty(this, \"selected\", []);\n //TODO check all params\n this.parentElem = fileViewElem;\n fileViewElem.addEventListener('click', function (event) {\n if (event.target.classList[0] == 'FileTileView') {\n _this.DeselectAll();\n return;\n }\n if (event.detail === 1) {\n _this.DeselectAll();\n _this.Select([event.target]);\n } else if (event.detail === 2) {\n doubleClickCallback(event);\n }\n });\n fileViewElem.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n if (event.target.classList.contains(\"Tile\")) {\n _this.DeselectAll();\n _this.Select([event.target]);\n }\n _this.Select([event.target]);\n rightClickCallback(event);\n });\n if (fileUploadCallback !== undefined) {\n var counter = 0;\n var draggedElem = undefined;\n fileViewElem.addEventListener('dragstart', function (event) {\n // console.log(event.target)\n // console.log(this.path)\n // draggedElem = event.target\n event.dataTransfer.setData(\"fileName\", event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"filePath\", _this.path + \"/\" + event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"dropType\", \"move\");\n // console.log(updateFileViewCallback)\n // event.dataTransfer.setData(\"updateCallback\", updateFileViewCallback)\n // event.dataTransfer.setData(\"fileName\", )\n // console.log(draggedElem)\n });\n\n fileViewElem.addEventListener('dragenter', function (event) {\n event.preventDefault();\n counter++;\n fileViewElem.classList.add(\"DragDropBorder\");\n });\n fileViewElem.addEventListener('dragend', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // updateFileViewCallback()\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragleave', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragover', function (event) {\n event.preventDefault();\n });\n fileViewElem.addEventListener(\"drop\", function (event) {\n event.preventDefault();\n fileUploadCallback(event);\n fileViewElem.classList.remove(\"DragDropBorder\");\n // updateFileViewCallback()\n // this.OpenFolder(this.path)\n // draggedElem = undefined\n });\n }\n }\n\n /** \n * @param {[]Element} elements\n */\n _createClass(WDEFileView, [{\n key: \"Select\",\n value: function Select(elements) {\n var _this2 = this;\n elements.forEach(function (element) {\n _this2.selected.push(element);\n element.classList.add(\"Selected\");\n });\n }\n }, {\n key: \"DeselectAll\",\n value: function DeselectAll() {\n this.selected.forEach(function (element) {\n element.classList.remove(\"Selected\");\n });\n this.selected = [];\n }\n\n /** Get html of folder by path\n * @param {string} path\n */\n }, {\n key: \"OpenFolder\",\n value: function () {\n var _OpenFolder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response, html;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.path = path;\n params = new URLSearchParams({\n path: path\n });\n _context.next = 4;\n return fetch(\"/system/wde/widgets/file-tile-view?\" + params);\n case 4:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 8;\n break;\n }\n //TODO Error text message\n WebDesktopEnvironment.Alert(\"TODO\");\n return _context.abrupt(\"return\");\n case 8:\n _context.next = 10;\n return response.text();\n case 10:\n html = _context.sent;\n this.parentElem.innerHTML = html;\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function OpenFolder(_x) {\n return _OpenFolder.apply(this, arguments);\n }\n return OpenFolder;\n }()\n }]);\n return WDEFileView;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/widgets/file-view/file-view.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEFileView)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar WDEFileView = /*#__PURE__*/function () {\n /**\r\n * @param {HTMLElement} fileViewElem\r\n * @param {Function} doubleClickCallback\r\n * @param {Function} rightClickCallback\r\n * @param {Function} updateFileViewCallback\r\n */\n function WDEFileView(fileViewElem, doubleClickCallback, rightClickCallback, fileUploadCallback, updateFileViewCallback) {\n var _this = this;\n _classCallCheck(this, WDEFileView);\n _defineProperty(this, \"path\", \"\");\n _defineProperty(this, \"parentElem\", undefined);\n _defineProperty(this, \"selected\", []);\n //TODO check all params\n this.parentElem = fileViewElem;\n fileViewElem.addEventListener('click', function (event) {\n if (event.target.classList[0] == 'FileTileView') {\n _this.DeselectAll();\n return;\n }\n if (event.detail === 1) {\n _this.DeselectAll();\n _this.Select([event.target]);\n } else if (event.detail === 2) {\n doubleClickCallback(event);\n }\n });\n fileViewElem.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n if (event.target.classList.contains(\"Tile\")) {\n _this.DeselectAll();\n _this.Select([event.target]);\n }\n _this.Select([event.target]);\n rightClickCallback(event);\n });\n if (fileUploadCallback !== undefined) {\n var counter = 0;\n var draggedElem = undefined;\n fileViewElem.addEventListener('dragstart', function (event) {\n // console.log(event.target)\n // console.log(this.path)\n // draggedElem = event.target\n event.dataTransfer.setData(\"fileName\", event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"filePath\", _this.path + \"/\" + event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"dropType\", \"move\");\n // console.log(updateFileViewCallback)\n // event.dataTransfer.setData(\"updateCallback\", updateFileViewCallback)\n // event.dataTransfer.setData(\"fileName\", )\n // console.log(draggedElem)\n });\n\n fileViewElem.addEventListener('dragenter', function (event) {\n event.preventDefault();\n counter++;\n fileViewElem.classList.add(\"DragDropBorder\");\n });\n fileViewElem.addEventListener('dragend', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // updateFileViewCallback()\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragleave', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragover', function (event) {\n event.preventDefault();\n });\n fileViewElem.addEventListener(\"drop\", function (event) {\n event.preventDefault();\n fileUploadCallback(event);\n fileViewElem.classList.remove(\"DragDropBorder\");\n // updateFileViewCallback()\n // this.OpenFolder(this.path)\n // draggedElem = undefined\n });\n }\n }\n\n /** \r\n * @param {[]Element} elements\r\n */\n _createClass(WDEFileView, [{\n key: \"Select\",\n value: function Select(elements) {\n var _this2 = this;\n elements.forEach(function (element) {\n _this2.selected.push(element);\n element.classList.add(\"Selected\");\n });\n }\n }, {\n key: \"DeselectAll\",\n value: function DeselectAll() {\n this.selected.forEach(function (element) {\n element.classList.remove(\"Selected\");\n });\n this.selected = [];\n }\n\n /** Get html of folder by path\r\n * @param {string} path\r\n */\n }, {\n key: \"OpenFolder\",\n value: function () {\n var _OpenFolder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response, html;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.path = path;\n params = new URLSearchParams({\n path: path\n });\n _context.next = 4;\n return fetch(\"/system/wde/widgets/file-tile-view?\" + params);\n case 4:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 8;\n break;\n }\n //TODO Error text message\n WebDesktopEnvironment.Alert(\"TODO\");\n return _context.abrupt(\"return\");\n case 8:\n _context.next = 10;\n return response.text();\n case 10:\n html = _context.sent;\n this.parentElem.innerHTML = html;\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function OpenFolder(_x) {\n return _OpenFolder.apply(this, arguments);\n }\n return OpenFolder;\n }()\n }]);\n return WDEFileView;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/widgets/file-view/file-view.js?"); /***/ }), @@ -77,7 +77,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \******************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebFS)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nvar WebFS = /*#__PURE__*/function () {\n function WebFS() {\n _classCallCheck(this, WebFS);\n }\n _createClass(WebFS, null, [{\n key: \"CreateDirectory\",\n value:\n /**\n * @param {string} path\n * @returns {boolean}\n */\n function () {\n var _CreateDirectory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(path == undefined)) {\n _context.next = 3;\n break;\n }\n WebDesktopEnvironment.Alert(\"Path is undefined\");\n return _context.abrupt(\"return\", false);\n case 3:\n params = new URLSearchParams({\n path: \"\".concat(path, \"/New Directory\")\n });\n _context.next = 6;\n return fetch(\"/system/fs/createDir?\" + params);\n case 6:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 10;\n break;\n }\n WebDesktopEnvironment.Alert(\"DIRCTORY CREATION ERROR\"); //TODO\n return _context.abrupt(\"return\", false);\n case 10:\n return _context.abrupt(\"return\", true);\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n function CreateDirectory(_x) {\n return _CreateDirectory.apply(this, arguments);\n }\n return CreateDirectory;\n }()\n /**\n * @param {string} path\n * @returns {boolean}\n */\n }, {\n key: \"DeleteFile\",\n value: function () {\n var _DeleteFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n params = new URLSearchParams({\n path: path\n });\n _context2.next = 3;\n return fetch(\"/system/fs/delete?\" + params);\n case 3:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"DELETE ERROR\"); //TODO\n return _context2.abrupt(\"return\", false);\n case 7:\n return _context2.abrupt(\"return\", true);\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n function DeleteFile(_x2) {\n return _DeleteFile.apply(this, arguments);\n }\n return DeleteFile;\n }()\n /**\n * @param {string} path\n * @returns {boolean}\n */\n }, {\n key: \"MoveFile\",\n value: function () {\n var _MoveFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sourcePath, targetPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n targetPath: targetPath\n });\n _context3.next = 3;\n return fetch(\"/system/fs/move?\" + params);\n case 3:\n response = _context3.sent;\n if (!(response.status != 200)) {\n _context3.next = 6;\n break;\n }\n return _context3.abrupt(\"return\", false);\n case 6:\n return _context3.abrupt(\"return\", true);\n case 7:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function MoveFile(_x3, _x4) {\n return _MoveFile.apply(this, arguments);\n }\n return MoveFile;\n }()\n /**\n * @param {string} linkPath\n * @returns {string}\n */\n }, {\n key: \"ReadObjectLink\",\n value: function () {\n var _ReadObjectLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(linkPath) {\n var params, response, path;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context4.next = 3;\n return fetch(\"/system/fs/readObjectLink?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context4.abrupt(\"return\", \"\");\n case 7:\n _context4.next = 9;\n return response.text();\n case 9:\n path = _context4.sent;\n return _context4.abrupt(\"return\", path);\n case 11:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function ReadObjectLink(_x5) {\n return _ReadObjectLink.apply(this, arguments);\n }\n return ReadObjectLink;\n }()\n /**\n * @param {string} sourcePath\n * @param {string} linkPath\n * @returns {string}\n */\n }, {\n key: \"CreatePathLink\",\n value: function () {\n var _CreatePathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sourcePath, linkPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n linkPath: linkPath\n });\n _context5.next = 3;\n return fetch(\"/system/fs/createPathLink?\" + params);\n case 3:\n response = _context5.sent;\n return _context5.abrupt(\"return\", response.status == 200);\n case 5:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5);\n }));\n function CreatePathLink(_x6, _x7) {\n return _CreatePathLink.apply(this, arguments);\n }\n return CreatePathLink;\n }()\n /**\n * @param {string} linkPath\n * @returns {string}\n */\n }, {\n key: \"ReadPathLink\",\n value: function () {\n var _ReadPathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(linkPath) {\n var params, response, file;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context6.next = 3;\n return fetch(\"/system/fs/readPathLink?\" + params);\n case 3:\n response = _context6.sent;\n if (!(response.status != 200)) {\n _context6.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context6.abrupt(\"return\", \"\");\n case 7:\n _context6.next = 9;\n return response.json();\n case 9:\n file = _context6.sent;\n return _context6.abrupt(\"return\", file);\n case 11:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6);\n }));\n function ReadPathLink(_x8) {\n return _ReadPathLink.apply(this, arguments);\n }\n return ReadPathLink;\n }()\n /**\n * @param {File} file\n * @param {string} parentPath\n * @returns {boolean}\n */\n }, {\n key: \"UploadFile\",\n value: function () {\n var _UploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(file, parentPath) {\n var formData, params, response, error;\n return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n console.log('here');\n formData = new FormData();\n formData.append(\"file\", file); //FIXME Conn reset\n params = new URLSearchParams({\n parentPath: parentPath\n });\n _context7.next = 6;\n return fetch(\"/system/fs/upload?\" + params, {\n method: \"POST\",\n //TODO Change to PUT?\n body: formData\n });\n case 6:\n response = _context7.sent;\n console.log(response.status);\n if (!(response.status != 201)) {\n _context7.next = 14;\n break;\n }\n _context7.next = 11;\n return response.json();\n case 11:\n error = _context7.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context7.abrupt(\"return\", false);\n case 14:\n return _context7.abrupt(\"return\", true);\n case 15:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7);\n }));\n function UploadFile(_x9, _x10) {\n return _UploadFile.apply(this, arguments);\n }\n return UploadFile;\n }()\n }]);\n return WebFS;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/web-fs/web-fs.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebFS)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nvar WebFS = /*#__PURE__*/function () {\n function WebFS() {\n _classCallCheck(this, WebFS);\n }\n _createClass(WebFS, null, [{\n key: \"CreateDirectory\",\n value:\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n function () {\n var _CreateDirectory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(path == undefined)) {\n _context.next = 3;\n break;\n }\n WebDesktopEnvironment.Alert(\"Path is undefined\");\n return _context.abrupt(\"return\", false);\n case 3:\n params = new URLSearchParams({\n path: \"\".concat(path, \"/New Directory\")\n });\n _context.next = 6;\n return fetch(\"/system/fs/createDir?\" + params);\n case 6:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 10;\n break;\n }\n WebDesktopEnvironment.Alert(\"DIRCTORY CREATION ERROR\"); //TODO\n return _context.abrupt(\"return\", false);\n case 10:\n return _context.abrupt(\"return\", true);\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n function CreateDirectory(_x) {\n return _CreateDirectory.apply(this, arguments);\n }\n return CreateDirectory;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"DeleteFile\",\n value: function () {\n var _DeleteFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n params = new URLSearchParams({\n path: path\n });\n _context2.next = 3;\n return fetch(\"/system/fs/delete?\" + params);\n case 3:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"DELETE ERROR\"); //TODO\n return _context2.abrupt(\"return\", false);\n case 7:\n return _context2.abrupt(\"return\", true);\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n function DeleteFile(_x2) {\n return _DeleteFile.apply(this, arguments);\n }\n return DeleteFile;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"MoveFile\",\n value: function () {\n var _MoveFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sourcePath, targetPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n targetPath: targetPath\n });\n _context3.next = 3;\n return fetch(\"/system/fs/move?\" + params);\n case 3:\n response = _context3.sent;\n if (!(response.status != 200)) {\n _context3.next = 6;\n break;\n }\n return _context3.abrupt(\"return\", false);\n case 6:\n return _context3.abrupt(\"return\", true);\n case 7:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function MoveFile(_x3, _x4) {\n return _MoveFile.apply(this, arguments);\n }\n return MoveFile;\n }()\n /**\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"ReadObjectLink\",\n value: function () {\n var _ReadObjectLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(linkPath) {\n var params, response, path;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context4.next = 3;\n return fetch(\"/system/fs/readObjectLink?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context4.abrupt(\"return\", \"\");\n case 7:\n _context4.next = 9;\n return response.text();\n case 9:\n path = _context4.sent;\n return _context4.abrupt(\"return\", path);\n case 11:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function ReadObjectLink(_x5) {\n return _ReadObjectLink.apply(this, arguments);\n }\n return ReadObjectLink;\n }()\n /**\r\n * @param {string} sourcePath\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"CreatePathLink\",\n value: function () {\n var _CreatePathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sourcePath, linkPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n linkPath: linkPath\n });\n _context5.next = 3;\n return fetch(\"/system/fs/createPathLink?\" + params);\n case 3:\n response = _context5.sent;\n return _context5.abrupt(\"return\", response.status == 200);\n case 5:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5);\n }));\n function CreatePathLink(_x6, _x7) {\n return _CreatePathLink.apply(this, arguments);\n }\n return CreatePathLink;\n }()\n /**\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"ReadPathLink\",\n value: function () {\n var _ReadPathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(linkPath) {\n var params, response, file;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context6.next = 3;\n return fetch(\"/system/fs/readPathLink?\" + params);\n case 3:\n response = _context6.sent;\n if (!(response.status != 200)) {\n _context6.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context6.abrupt(\"return\", \"\");\n case 7:\n _context6.next = 9;\n return response.json();\n case 9:\n file = _context6.sent;\n return _context6.abrupt(\"return\", file);\n case 11:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6);\n }));\n function ReadPathLink(_x8) {\n return _ReadPathLink.apply(this, arguments);\n }\n return ReadPathLink;\n }()\n /**\r\n * @param {File} file\r\n * @param {string} parentPath\r\n * @returns {boolean}\r\n */\n }, {\n key: \"UploadFile\",\n value: function () {\n var _UploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(file, parentPath) {\n var formData, params, response, error;\n return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n console.log('here');\n formData = new FormData();\n formData.append(\"file\", file); //FIXME Conn reset\n params = new URLSearchParams({\n parentPath: parentPath\n });\n _context7.next = 6;\n return fetch(\"/system/fs/upload?\" + params, {\n method: \"POST\",\n //TODO Change to PUT?\n body: formData\n });\n case 6:\n response = _context7.sent;\n console.log(response.status);\n if (!(response.status != 201)) {\n _context7.next = 14;\n break;\n }\n _context7.next = 11;\n return response.json();\n case 11:\n error = _context7.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context7.abrupt(\"return\", false);\n case 14:\n return _context7.abrupt(\"return\", true);\n case 15:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7);\n }));\n function UploadFile(_x9, _x10) {\n return _UploadFile.apply(this, arguments);\n }\n return UploadFile;\n }()\n }]);\n return WebFS;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/web-fs/web-fs.js?"); /***/ }) diff --git a/res/dev-fs/dist/finder.js b/res/dev-fs/dist/finder.js index 5012f1f..741bc23 100644 --- a/res/dev-fs/dist/finder.js +++ b/res/dev-fs/dist/finder.js @@ -27,7 +27,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_http_localhost_8080_res_dev_fs_dist_f \******************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ FinderWindow)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _appId = /*#__PURE__*/new WeakMap();\nvar _wde = /*#__PURE__*/new WeakMap();\nvar _finder = /*#__PURE__*/new WeakMap();\n// import WebDesktopEnvironment from \"../../wde/wde-desktop\"\n// import Finder from \"./finder\"\n// import WebDesktopEnvironment from \"../../wde/wde-desktop\"\nvar FinderWindow = /*#__PURE__*/function () {\n function FinderWindow() {\n _classCallCheck(this, FinderWindow);\n _classPrivateFieldInitSpec(this, _appId, {\n writable: true,\n value: \"Finder\"\n });\n _defineProperty(this, \"curPath\", \"\");\n _defineProperty(this, \"fileView\", undefined);\n _defineProperty(this, \"windowElem\", undefined);\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldInitSpec(this, _finder, {\n writable: true,\n value: void 0\n });\n }\n _createClass(FinderWindow, [{\n key: \"Init\",\n value:\n /**\n * @param {Finder} finder\n * @param {*} args \n * @param {import(\"../../wde/wde-desktop\").runContext} runContext \n * @returns \n */\n function () {\n var _Init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(finder, args, runContext) {\n var _this = this;\n var desktopNode, _params, _response, _html, params, response, error, html, newWindow, scrollBar;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _classPrivateFieldSet(this, _finder, finder);\n _classPrivateFieldSet(this, _wde, runContext.WDE);\n if (!(args[1] == \"--desktop\")) {\n _context.next = 22;\n break;\n }\n desktopNode = document.body.querySelector(\"#\".concat(args[2]));\n if (!(desktopNode == null)) {\n _context.next = 7;\n break;\n }\n _classPrivateFieldGet(this, _wde).Alert(\"Desktop node not found\");\n return _context.abrupt(\"return\");\n case 7:\n _params = new URLSearchParams({\n path: args[0]\n });\n _context.next = 10;\n return fetch(\"/app/\".concat(_classPrivateFieldGet(this, _appId), \"/renderDesktop?\") + _params, {\n method: \"POST\",\n body: JSON.stringify(runContext)\n });\n case 10:\n _response = _context.sent;\n if (!(_response.status != 200)) {\n _context.next = 15;\n break;\n }\n console.log(_response.status);\n _classPrivateFieldGet(this, _wde).Alert(\"Error in render desktop\"); //TODO\n return _context.abrupt(\"return\");\n case 15:\n _context.next = 17;\n return _response.text();\n case 17:\n _html = _context.sent;\n desktopNode.innerHTML = _html;\n this.fileView = new runContext.WDE.FileView(desktopNode.querySelector(\".FileTileView\"), function (event) {\n _this.Click(event);\n }, function (event) {\n _this.RightClick(event);\n }, function (event, draggedElem) {\n _this.DropEvent(event, draggedElem);\n }, function () {\n _this.ReRenderDir();\n });\n this.RenderDir(args[0]);\n return _context.abrupt(\"return\");\n case 22:\n params = new URLSearchParams({\n isMobile: false\n }); //FIXME\n _context.next = 25;\n return fetch(\"/app/\".concat(_classPrivateFieldGet(this, _appId), \"/render?\") + params, {\n method: \"POST\",\n body: JSON.stringify(runContext)\n });\n case 25:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 32;\n break;\n }\n _context.next = 29;\n return response.json();\n case 29:\n error = _context.sent;\n _classPrivateFieldGet(this, _wde).Alert(error.message);\n return _context.abrupt(\"return\");\n case 32:\n _context.next = 34;\n return response.text();\n case 34:\n html = _context.sent;\n newWindow = _classPrivateFieldGet(this, _wde).Decorat.CreateNewWindow(_classPrivateFieldGet(this, _appId), 500, 350);\n newWindow.innerHTML = html;\n\n // console.log(this.#wde)\n\n this.fileView = new runContext.WDE.FileView(newWindow.querySelector(\".FileTileView\"), function (event) {\n _this.Click(event);\n }, function (event) {\n _this.RightClick(event);\n }, function (event, draggedElem) {\n _this.DropEvent(event, draggedElem);\n }, function () {\n _this.ReRenderDir();\n });\n newWindow.querySelector(\"#closeWindowButton\").addEventListener('click', function () {\n _classPrivateFieldGet(_this, _wde).Decorat.CloseWindow(newWindow);\n });\n newWindow.querySelector(\"#RootButton\").addEventListener('click', function () {\n _this.RenderDir('/');\n });\n newWindow.querySelector(\"#HomeButton\").addEventListener('click', function () {\n _this.RenderDir('/home/user');\n });\n scrollBar = new (_classPrivateFieldGet(this, _wde).ScrollBar)(newWindow.querySelector(\".ScrollbarPlace\"), newWindow.querySelector(\".FileTileView\"));\n this.windowElem = newWindow;\n this.RenderDir(args[0]);\n case 44:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function Init(_x, _x2, _x3) {\n return _Init.apply(this, arguments);\n }\n return Init;\n }()\n /**\n * @param {string} path\n */\n }, {\n key: \"RenderDir\",\n value: function RenderDir(path) {\n this.curPath = path;\n this.fileView.OpenFolder(path);\n }\n }, {\n key: \"ReRenderDir\",\n value: function ReRenderDir() {\n this.RenderDir(this.curPath);\n }\n\n /**\n * @param {DragEvent} event\n * @param {HTMLElement} draggedElem\n */\n }, {\n key: \"DropEvent\",\n value: function () {\n var _DropEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {\n var sourcePath, targetPath, res, files, i, file, _res, params, response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n if (!(event.dataTransfer.getData(\"dropType\") == \"move\")) {\n _context2.next = 9;\n break;\n }\n sourcePath = event.dataTransfer.getData(\"filePath\");\n targetPath = this.curPath + \"/\" + event.dataTransfer.getData(\"fileName\");\n _context2.next = 5;\n return WebFS.MoveFile(sourcePath, targetPath);\n case 5:\n res = _context2.sent;\n if (res) {\n this.ReRenderDir();\n } else {\n _classPrivateFieldGet(this, _wde).Alert(\"UWAGA TODO MOVE FILE ERROR\"); //TODO\n }\n _context2.next = 27;\n break;\n case 9:\n console.log(event, this.curPath);\n files = event.dataTransfer.files;\n i = 0;\n case 12:\n if (!(i < files.length)) {\n _context2.next = 22;\n break;\n }\n file = files[i];\n console.log(\"file:\" + file.name);\n _context2.next = 17;\n return WebFS.UploadFile(file, this.curPath);\n case 17:\n _res = _context2.sent;\n if (_res) {\n this.ReRenderDir();\n }\n case 19:\n i++;\n _context2.next = 12;\n break;\n case 22:\n params = new URLSearchParams({\n parentPath: this.curPath\n });\n _context2.next = 25;\n return fetch('/fs/upload/?' + params, {\n method: \"POST\",\n //TODO Change to PUT?\n body: formData\n });\n case 25:\n response = _context2.sent;\n if (response.status != 200) {\n _classPrivateFieldGet(this, _wde).Alert(\"ERROR IN UPLOADING FILE\"); //TODO\n } else {\n this.ReRenderDir();\n }\n case 27:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function DropEvent(_x4) {\n return _DropEvent.apply(this, arguments);\n }\n return DropEvent;\n }()\n /**\n * @param {MouseEvent} event\n */\n }, {\n key: \"Click\",\n value: function Click(event) {\n this.OpenFile(this.curPath, event.target.getAttribute(\"name\"), event.target.getAttribute(\"filetype\"));\n }\n\n /**\n * @param {string} filePath\n */\n }, {\n key: \"OpenFile\",\n value: function () {\n var _OpenFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(parentPath, fileName, fileType) {\n var fileExtension, res;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n // console.log(parentPath, fileName, fileType)\n // const splittedPath = filePath.split(\"/\")\n // const fileName = splittedPath[splittedPath.length - 1]\n fileExtension = fileName.split(\".\")[fileName.split(\".\").length - 1]; //FIXME\n _context3.t0 = true;\n _context3.next = _context3.t0 === (fileType == \"objectlink\") ? 4 : _context3.t0 === (fileType == \"pathlink\") ? 6 : _context3.t0 === (fileExtension == \"app\") ? 12 : _context3.t0 === (fileExtension == \"blog\") ? 14 : _context3.t0 === (fileType == \"directory\") ? 16 : _context3.t0 === (fileExtension == \"blog\") ? 18 : _context3.t0 === (fileExtension == \"jpeg\" | fileExtension == \"png\") ? 20 : 22;\n break;\n case 4:\n _classPrivateFieldGet(this, _wde).Alert(\"Links not supported yet\");\n return _context3.abrupt(\"break\", 24);\n case 6:\n _context3.next = 8;\n return WebFS.ReadPathLink(\"\".concat(parentPath, \"/\").concat(fileName));\n case 8:\n res = _context3.sent;\n console.log(res);\n this.OpenFile(res.parentPath, res.name, res.filetype);\n return _context3.abrupt(\"break\", 24);\n case 12:\n _classPrivateFieldGet(this, _wde).Open(\"\".concat(parentPath, \"/\").concat(fileName), []);\n return _context3.abrupt(\"break\", 24);\n case 14:\n _classPrivateFieldGet(this, _wde).Open(\"/Applications/BlogViewer.app\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context3.abrupt(\"break\", 24);\n case 16:\n _classPrivateFieldGet(this, _wde).Open(\"/Applications/Finder.app\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context3.abrupt(\"break\", 24);\n case 18:\n _classPrivateFieldGet(this, _wde).Open(\"/Applications/BlogViewer.app\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context3.abrupt(\"break\", 24);\n case 20:\n _classPrivateFieldGet(this, _wde).Open(\"img-viewer\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context3.abrupt(\"break\", 24);\n case 22:\n _classPrivateFieldGet(this, _wde).Alert(\"Unsupported file type\");\n return _context3.abrupt(\"break\", 24);\n case 24:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n function OpenFile(_x5, _x6, _x7) {\n return _OpenFile.apply(this, arguments);\n }\n return OpenFile;\n }()\n /**\n * @param {MouseEvent} event\n */\n }, {\n key: \"RightClick\",\n value: function RightClick(event) {\n this.CreateContextMenu(event.target, [event.clientY, event.clientX]);\n }\n\n /**\n * @param {HTMLElement} target\n * @param {string[]} pos\n */\n }, {\n key: \"CreateContextMenu\",\n value: function () {\n var _CreateContextMenu = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(target, pos) {\n var _this2 = this;\n var context, fileName, fileType, path, params, response, html, overlay, menu;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n context = \"\";\n fileName = target.getAttribute(\"name\"); //TODO check for null\n fileType = target.getAttribute(\"fileType\");\n if (target.classList.contains(\"FileTileView\")) {\n context = \"FileTileView\";\n } else {\n context = fileType;\n }\n path = \"\";\n if (fileName === null) {\n path = this.curPath;\n } else {\n path = \"\".concat(this.curPath, \"/\").concat(fileName);\n }\n params = new URLSearchParams({\n context: context,\n path: path\n });\n _context5.next = 9;\n return fetch(\"/app/\".concat(_classPrivateFieldGet(this, _appId), \"/contextMenu?\") + params);\n case 9:\n response = _context5.sent;\n if (!(response.status != 200)) {\n _context5.next = 13;\n break;\n }\n _classPrivateFieldGet(this, _wde).Alert(\"ERROR in Context menu TODO\"); //TODO\n return _context5.abrupt(\"return\");\n case 13:\n _context5.next = 15;\n return response.text();\n case 15:\n html = _context5.sent;\n overlay = document.createElement(\"div\"); //TODO Move to WDE.CreateOverlay()\n overlay.setAttribute('id', 'finder-context-menu-overlay');\n overlay.style.position = 'absolute';\n overlay.style.width = \"100%\";\n overlay.style.height = \"100%\";\n menu = document.createElement(\"div\");\n menu.setAttribute('class', 'ContextMenu WindowFrameShadow');\n menu.style.position = 'absolute';\n menu.style.top = pos[0] + \"px\";\n menu.style.left = pos[1] + \"px\";\n menu.innerHTML = html;\n // menu.children[0].firstElementChild.remove()\n menu.children[0].lastElementChild.remove(); //FIXME Can't ommit rendering of horLine in end of menu on backend\n\n overlay.appendChild(menu);\n document.body.appendChild(overlay);\n overlay.addEventListener('click', /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(event) {\n var res;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n if (!event.target.classList.contains(\"Row\")) {\n _context4.next = 27;\n break;\n }\n //TODO add uuid id to rows to more accurate checks??\n res = false;\n _context4.t0 = event.target.children[0].getAttribute(\"action\");\n _context4.next = _context4.t0 === \"createPathLink\" ? 5 : _context4.t0 === \"createDir\" ? 10 : _context4.t0 === \"deleteFile\" ? 16 : _context4.t0 === \"getInfo\" ? 22 : _context4.t0 === \"openAsDir\" ? 24 : 26;\n break;\n case 5:\n _context4.next = 7;\n return WebFS.CreatePathLink(\"\".concat(_this2.curPath, \"/\").concat(fileName), \"\".concat(_this2.curPath, \"/Link to \").concat(fileName));\n case 7:\n res = _context4.sent;\n if (res) {\n _this2.ReRenderDir();\n }\n return _context4.abrupt(\"break\", 27);\n case 10:\n _context4.next = 12;\n return WebFS.CreateDirectory(\"\".concat(_this2.curPath));\n case 12:\n res = _context4.sent;\n console.log(res);\n if (res) {\n _this2.ReRenderDir();\n }\n return _context4.abrupt(\"break\", 27);\n case 16:\n _context4.next = 18;\n return WebFS.DeleteFile(\"\".concat(_this2.curPath, \"/\").concat(fileName));\n case 18:\n res = _context4.sent;\n console.log(res);\n if (res) {\n _this2.ReRenderDir();\n }\n return _context4.abrupt(\"break\", 27);\n case 22:\n Finder.RenderProperites(path);\n return _context4.abrupt(\"break\", 27);\n case 24:\n _classPrivateFieldGet(_this2, _wde).Open(\"/Applications/\".concat(_classPrivateFieldGet(_this2, _appId), \".app\"), [\"\".concat(_this2.curPath, \"/\").concat(fileName)]);\n return _context4.abrupt(\"break\", 27);\n case 26:\n return _context4.abrupt(\"break\", 27);\n case 27:\n overlay.remove();\n case 28:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n return function (_x10) {\n return _ref.apply(this, arguments);\n };\n }());\n overlay.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n overlay.remove();\n });\n case 32:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5, this);\n }));\n function CreateContextMenu(_x8, _x9) {\n return _CreateContextMenu.apply(this, arguments);\n }\n return CreateContextMenu;\n }()\n }]);\n return FinderWindow;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/apps/finder/finder-window.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ FinderWindow)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _appId = /*#__PURE__*/new WeakMap();\nvar _wde = /*#__PURE__*/new WeakMap();\nvar _finder = /*#__PURE__*/new WeakMap();\n// import WebDesktopEnvironment from \"../../wde/wde-desktop\"\n// import Finder from \"./finder\"\n// import WebDesktopEnvironment from \"../../wde/wde-desktop\"\nvar FinderWindow = /*#__PURE__*/function () {\n function FinderWindow() {\n _classCallCheck(this, FinderWindow);\n _classPrivateFieldInitSpec(this, _appId, {\n writable: true,\n value: \"Finder\"\n });\n _defineProperty(this, \"curPath\", \"\");\n _defineProperty(this, \"fileView\", undefined);\n _defineProperty(this, \"windowElem\", undefined);\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldInitSpec(this, _finder, {\n writable: true,\n value: void 0\n });\n }\n _createClass(FinderWindow, [{\n key: \"Init\",\n value:\n /**\r\n * @param {Finder} finder\r\n * @param {*} args \r\n * @param {import(\"../../wde/wde-desktop\").runContext} runContext \r\n * @returns \r\n */\n function () {\n var _Init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(finder, args, runContext) {\n var _this = this;\n var desktopNode, _params, _response, _html, params, response, error, html, newWindow, scrollBar;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _classPrivateFieldSet(this, _finder, finder);\n _classPrivateFieldSet(this, _wde, runContext.WDE);\n if (!runContext.isMobile) {\n _context.next = 5;\n break;\n }\n this.CreateMobileView(args, runContext);\n return _context.abrupt(\"return\");\n case 5:\n if (!(args[1] == \"--desktop\")) {\n _context.next = 25;\n break;\n }\n desktopNode = document.body.querySelector(\"#\".concat(args[2]));\n if (!(desktopNode == null)) {\n _context.next = 10;\n break;\n }\n _classPrivateFieldGet(this, _wde).Alert(\"Desktop node not found\");\n return _context.abrupt(\"return\");\n case 10:\n _params = new URLSearchParams({\n path: args[0]\n });\n _context.next = 13;\n return fetch(\"/app/\".concat(_classPrivateFieldGet(this, _appId), \"/renderDesktop?\") + _params, {\n method: \"POST\",\n body: JSON.stringify(runContext)\n });\n case 13:\n _response = _context.sent;\n if (!(_response.status != 200)) {\n _context.next = 18;\n break;\n }\n console.log(_response.status);\n _classPrivateFieldGet(this, _wde).Alert(\"Error in render desktop\"); //TODO\n return _context.abrupt(\"return\");\n case 18:\n _context.next = 20;\n return _response.text();\n case 20:\n _html = _context.sent;\n desktopNode.innerHTML = _html;\n this.fileView = new runContext.WDE.FileView(desktopNode.querySelector(\".FileTileView\"), function (event) {\n _this.Click(event);\n }, function (event) {\n _this.RightClick(event);\n }, function (event, draggedElem) {\n _this.DropEvent(event, draggedElem);\n }, function () {\n _this.ReRenderDir();\n });\n this.RenderDir(args[0]);\n return _context.abrupt(\"return\");\n case 25:\n params = new URLSearchParams({\n isMobile: false\n }); //FIXME\n _context.next = 28;\n return fetch(\"/app/\".concat(_classPrivateFieldGet(this, _appId), \"/render?\") + params, {\n method: \"POST\",\n body: JSON.stringify(runContext)\n });\n case 28:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 35;\n break;\n }\n _context.next = 32;\n return response.json();\n case 32:\n error = _context.sent;\n _classPrivateFieldGet(this, _wde).Alert(error.message);\n return _context.abrupt(\"return\");\n case 35:\n _context.next = 37;\n return response.text();\n case 37:\n html = _context.sent;\n newWindow = _classPrivateFieldGet(this, _wde).Decorat.CreateNewWindow(_classPrivateFieldGet(this, _appId), 500, 350);\n newWindow.innerHTML = html;\n\n // console.log(this.#wde)\n\n this.fileView = new runContext.WDE.FileView(newWindow.querySelector(\".FileTileView\"), function (event) {\n _this.Click(event);\n }, function (event) {\n _this.RightClick(event);\n }, function (event, draggedElem) {\n _this.DropEvent(event, draggedElem);\n }, function () {\n _this.ReRenderDir();\n });\n newWindow.querySelector(\"#closeWindowButton\").addEventListener('click', function () {\n _classPrivateFieldGet(_this, _wde).Decorat.CloseWindow(newWindow);\n });\n newWindow.querySelector(\"#RootButton\").addEventListener('click', function () {\n _this.RenderDir('/');\n });\n newWindow.querySelector(\"#HomeButton\").addEventListener('click', function () {\n _this.RenderDir('/home/user');\n });\n scrollBar = new (_classPrivateFieldGet(this, _wde).ScrollBar)(newWindow.querySelector(\".ScrollbarPlace\"), newWindow.querySelector(\".FileTileView\"));\n this.windowElem = newWindow;\n this.RenderDir(args[0]);\n case 47:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function Init(_x, _x2, _x3) {\n return _Init.apply(this, arguments);\n }\n return Init;\n }()\n }, {\n key: \"CreateDesktopWindow\",\n value: function CreateDesktopWindow() {}\n\n /**\r\n * @param {*} args \r\n * @param {import(\"../../wde/wde-desktop\").runContext} runContext \r\n * @returns \r\n */\n }, {\n key: \"CreateMobileView\",\n value: function () {\n var _CreateMobileView = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(args, runContext) {\n var params, response, error, html, newView;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n params = new URLSearchParams({\n isMobile: false\n }); //FIXME\n _context2.next = 3;\n return fetch(\"/app/\".concat(_classPrivateFieldGet(this, _appId), \"/render?\") + params, {\n method: \"POST\",\n body: JSON.stringify(runContext)\n });\n case 3:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 10;\n break;\n }\n _context2.next = 7;\n return response.json();\n case 7:\n error = _context2.sent;\n _classPrivateFieldGet(this, _wde).Alert(error.message);\n return _context2.abrupt(\"return\");\n case 10:\n _context2.next = 12;\n return response.text();\n case 12:\n html = _context2.sent;\n console.log(_classPrivateFieldGet(this, _wde));\n newView = _classPrivateFieldGet(this, _wde).Decorat.CreateNewView(_classPrivateFieldGet(this, _appId));\n newView.innerHTML = html;\n case 16:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function CreateMobileView(_x4, _x5) {\n return _CreateMobileView.apply(this, arguments);\n }\n return CreateMobileView;\n }()\n /**\r\n * @param {string} path\r\n */\n }, {\n key: \"RenderDir\",\n value: function RenderDir(path) {\n this.curPath = path;\n this.fileView.OpenFolder(path);\n }\n }, {\n key: \"ReRenderDir\",\n value: function ReRenderDir() {\n this.RenderDir(this.curPath);\n }\n\n /**\r\n * @param {DragEvent} event\r\n * @param {HTMLElement} draggedElem\r\n */\n }, {\n key: \"DropEvent\",\n value: function () {\n var _DropEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(event) {\n var sourcePath, targetPath, res, files, i, file, _res, params, response;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n if (!(event.dataTransfer.getData(\"dropType\") == \"move\")) {\n _context3.next = 9;\n break;\n }\n sourcePath = event.dataTransfer.getData(\"filePath\");\n targetPath = this.curPath + \"/\" + event.dataTransfer.getData(\"fileName\");\n _context3.next = 5;\n return WebFS.MoveFile(sourcePath, targetPath);\n case 5:\n res = _context3.sent;\n if (res) {\n this.ReRenderDir();\n } else {\n _classPrivateFieldGet(this, _wde).Alert(\"UWAGA TODO MOVE FILE ERROR\"); //TODO\n }\n _context3.next = 27;\n break;\n case 9:\n console.log(event, this.curPath);\n files = event.dataTransfer.files;\n i = 0;\n case 12:\n if (!(i < files.length)) {\n _context3.next = 22;\n break;\n }\n file = files[i];\n console.log(\"file:\" + file.name);\n _context3.next = 17;\n return WebFS.UploadFile(file, this.curPath);\n case 17:\n _res = _context3.sent;\n if (_res) {\n this.ReRenderDir();\n }\n case 19:\n i++;\n _context3.next = 12;\n break;\n case 22:\n params = new URLSearchParams({\n parentPath: this.curPath\n });\n _context3.next = 25;\n return fetch('/fs/upload/?' + params, {\n method: \"POST\",\n //TODO Change to PUT?\n body: formData\n });\n case 25:\n response = _context3.sent;\n if (response.status != 200) {\n _classPrivateFieldGet(this, _wde).Alert(\"ERROR IN UPLOADING FILE\"); //TODO\n } else {\n this.ReRenderDir();\n }\n case 27:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n function DropEvent(_x6) {\n return _DropEvent.apply(this, arguments);\n }\n return DropEvent;\n }()\n /**\r\n * @param {MouseEvent} event\r\n */\n }, {\n key: \"Click\",\n value: function Click(event) {\n this.OpenFile(this.curPath, event.target.getAttribute(\"name\"), event.target.getAttribute(\"filetype\"));\n }\n\n /**\r\n * @param {string} filePath\r\n */\n }, {\n key: \"OpenFile\",\n value: function () {\n var _OpenFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(parentPath, fileName, fileType) {\n var fileExtension, res;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n // console.log(parentPath, fileName, fileType)\n // const splittedPath = filePath.split(\"/\")\n // const fileName = splittedPath[splittedPath.length - 1]\n fileExtension = fileName.split(\".\")[fileName.split(\".\").length - 1]; //FIXME\n _context4.t0 = true;\n _context4.next = _context4.t0 === (fileType == \"objectlink\") ? 4 : _context4.t0 === (fileType == \"pathlink\") ? 6 : _context4.t0 === (fileExtension == \"app\") ? 12 : _context4.t0 === (fileExtension == \"blog\") ? 14 : _context4.t0 === (fileType == \"directory\") ? 16 : _context4.t0 === (fileExtension == \"blog\") ? 18 : _context4.t0 === (fileExtension == \"jpeg\" | fileExtension == \"png\") ? 20 : 22;\n break;\n case 4:\n _classPrivateFieldGet(this, _wde).Alert(\"Links not supported yet\");\n return _context4.abrupt(\"break\", 24);\n case 6:\n _context4.next = 8;\n return WebFS.ReadPathLink(\"\".concat(parentPath, \"/\").concat(fileName));\n case 8:\n res = _context4.sent;\n console.log(res);\n this.OpenFile(res.parentPath, res.name, res.filetype);\n return _context4.abrupt(\"break\", 24);\n case 12:\n _classPrivateFieldGet(this, _wde).Open(\"\".concat(parentPath, \"/\").concat(fileName), []);\n return _context4.abrupt(\"break\", 24);\n case 14:\n _classPrivateFieldGet(this, _wde).Open(\"/Applications/BlogViewer.app\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context4.abrupt(\"break\", 24);\n case 16:\n _classPrivateFieldGet(this, _wde).Open(\"/Applications/Finder.app\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context4.abrupt(\"break\", 24);\n case 18:\n _classPrivateFieldGet(this, _wde).Open(\"/Applications/BlogViewer.app\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context4.abrupt(\"break\", 24);\n case 20:\n _classPrivateFieldGet(this, _wde).Open(\"img-viewer\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context4.abrupt(\"break\", 24);\n case 22:\n _classPrivateFieldGet(this, _wde).Alert(\"Unsupported file type\");\n return _context4.abrupt(\"break\", 24);\n case 24:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4, this);\n }));\n function OpenFile(_x7, _x8, _x9) {\n return _OpenFile.apply(this, arguments);\n }\n return OpenFile;\n }()\n /**\r\n * @param {MouseEvent} event\r\n */\n }, {\n key: \"RightClick\",\n value: function RightClick(event) {\n this.CreateContextMenu(event.target, [event.clientY, event.clientX]);\n }\n\n /**\r\n * @param {HTMLElement} target\r\n * @param {string[]} pos\r\n */\n }, {\n key: \"CreateContextMenu\",\n value: function () {\n var _CreateContextMenu = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(target, pos) {\n var _this2 = this;\n var context, fileName, fileType, path, params, response, html, overlay, menu;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n context = \"\";\n fileName = target.getAttribute(\"name\"); //TODO check for null\n fileType = target.getAttribute(\"fileType\");\n if (target.classList.contains(\"FileTileView\")) {\n context = \"FileTileView\";\n } else {\n context = fileType;\n }\n path = \"\";\n if (fileName === null) {\n path = this.curPath;\n } else {\n path = \"\".concat(this.curPath, \"/\").concat(fileName);\n }\n params = new URLSearchParams({\n context: context,\n path: path\n });\n _context6.next = 9;\n return fetch(\"/app/\".concat(_classPrivateFieldGet(this, _appId), \"/contextMenu?\") + params);\n case 9:\n response = _context6.sent;\n if (!(response.status != 200)) {\n _context6.next = 13;\n break;\n }\n _classPrivateFieldGet(this, _wde).Alert(\"ERROR in Context menu TODO\"); //TODO\n return _context6.abrupt(\"return\");\n case 13:\n _context6.next = 15;\n return response.text();\n case 15:\n html = _context6.sent;\n overlay = document.createElement(\"div\"); //TODO Move to WDE.CreateOverlay()\n overlay.setAttribute('id', 'finder-context-menu-overlay');\n overlay.style.position = 'absolute';\n overlay.style.width = \"100%\";\n overlay.style.height = \"100%\";\n menu = document.createElement(\"div\");\n menu.setAttribute('class', 'ContextMenu WindowFrameShadow');\n menu.style.position = 'absolute';\n menu.style.top = pos[0] + \"px\";\n menu.style.left = pos[1] + \"px\";\n menu.innerHTML = html;\n // menu.children[0].firstElementChild.remove()\n menu.children[0].lastElementChild.remove(); //FIXME Can't ommit rendering of horLine in end of menu on backend\n\n overlay.appendChild(menu);\n document.body.appendChild(overlay);\n overlay.addEventListener('click', /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(event) {\n var res;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n if (!event.target.classList.contains(\"Row\")) {\n _context5.next = 27;\n break;\n }\n //TODO add uuid id to rows to more accurate checks??\n res = false;\n _context5.t0 = event.target.children[0].getAttribute(\"action\");\n _context5.next = _context5.t0 === \"createPathLink\" ? 5 : _context5.t0 === \"createDir\" ? 10 : _context5.t0 === \"deleteFile\" ? 16 : _context5.t0 === \"getInfo\" ? 22 : _context5.t0 === \"openAsDir\" ? 24 : 26;\n break;\n case 5:\n _context5.next = 7;\n return WebFS.CreatePathLink(\"\".concat(_this2.curPath, \"/\").concat(fileName), \"\".concat(_this2.curPath, \"/Link to \").concat(fileName));\n case 7:\n res = _context5.sent;\n if (res) {\n _this2.ReRenderDir();\n }\n return _context5.abrupt(\"break\", 27);\n case 10:\n _context5.next = 12;\n return WebFS.CreateDirectory(\"\".concat(_this2.curPath));\n case 12:\n res = _context5.sent;\n console.log(res);\n if (res) {\n _this2.ReRenderDir();\n }\n return _context5.abrupt(\"break\", 27);\n case 16:\n _context5.next = 18;\n return WebFS.DeleteFile(\"\".concat(_this2.curPath, \"/\").concat(fileName));\n case 18:\n res = _context5.sent;\n console.log(res);\n if (res) {\n _this2.ReRenderDir();\n }\n return _context5.abrupt(\"break\", 27);\n case 22:\n Finder.RenderProperites(path);\n return _context5.abrupt(\"break\", 27);\n case 24:\n _classPrivateFieldGet(_this2, _wde).Open(\"/Applications/\".concat(_classPrivateFieldGet(_this2, _appId), \".app\"), [\"\".concat(_this2.curPath, \"/\").concat(fileName)]);\n return _context5.abrupt(\"break\", 27);\n case 26:\n return _context5.abrupt(\"break\", 27);\n case 27:\n overlay.remove();\n case 28:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5);\n }));\n return function (_x12) {\n return _ref.apply(this, arguments);\n };\n }());\n overlay.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n overlay.remove();\n });\n case 32:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6, this);\n }));\n function CreateContextMenu(_x10, _x11) {\n return _CreateContextMenu.apply(this, arguments);\n }\n return CreateContextMenu;\n }()\n }]);\n return FinderWindow;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/apps/finder/finder-window.js?"); /***/ }), @@ -37,7 +37,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \***********************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Finder)\n/* harmony export */ });\n/* harmony import */ var _wde_application_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../wde/application.js */ \"./src/wde/application.js\");\n/* harmony import */ var _wde_wde_desktop_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../wde/wde-desktop.js */ \"./src/wde/wde-desktop.js\");\n/* harmony import */ var _finder_window_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./finder-window.js */ \"./src/apps/finder/finder-window.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n// require(\"./finder.less\")\n\n\n\n\nvar Finder = /*#__PURE__*/function (_WDEApplication) {\n _inherits(Finder, _WDEApplication);\n var _super = _createSuper(Finder);\n /**\n * @constructor\n * @param {WebDesktopEnvironment} wde \n */\n function Finder(wde) {\n _classCallCheck(this, Finder);\n /** @type {WDEApplication} */\n return _super.call(this, wde);\n }\n\n /**\n * @param {string[]} args\n * @param {import(\"../../wde/wde-desktop.js\").runContext}\n */\n _createClass(Finder, [{\n key: \"NewWindow\",\n value: function () {\n var _NewWindow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(args, runContext) {\n var newFinder;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n newFinder = new _finder_window_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n _context.next = 3;\n return newFinder.Init(this, args, runContext);\n case 3:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function NewWindow(_x, _x2) {\n return _NewWindow.apply(this, arguments);\n }\n return NewWindow;\n }()\n /**\n * @param {string} path\n * @returns {boolean}\n */\n }, {\n key: \"RenderProperites\",\n value: function () {\n var _RenderProperites = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path) {\n var params, response, html, newWindow;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n if (!(path == null || path == \"\")) {\n _context2.next = 2;\n break;\n }\n return _context2.abrupt(\"return\");\n case 2:\n params = new URLSearchParams({\n path: path\n });\n _context2.next = 5;\n return fetch(\"/app/\".concat(Finder.AppId, \"/renderProps?\") + params);\n case 5:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 8;\n break;\n }\n return _context2.abrupt(\"return\", false);\n case 8:\n _context2.next = 10;\n return response.text();\n case 10:\n html = _context2.sent;\n newWindow = _get(_getPrototypeOf(Finder.prototype), \"getWde\", this).call(this).Decorat.CreateNewWindow(Finder.AppId, 350, 500);\n newWindow.innerHTML = html;\n newWindow.querySelector(\"#closeWindowButton\").addEventListener('click', function (params) {\n // WebDesktopEnvironment.CloseWindow(newWindow)\n });\n case 14:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function RenderProperites(_x3) {\n return _RenderProperites.apply(this, arguments);\n }\n return RenderProperites;\n }()\n }]);\n return Finder;\n}(_wde_application_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n_defineProperty(Finder, \"AppId\", \"Finder\");\n\n\n//# sourceURL=webpack://my-webpack-project/./src/apps/finder/finder.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Finder)\n/* harmony export */ });\n/* harmony import */ var _wde_application_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../wde/application.js */ \"./src/wde/application.js\");\n/* harmony import */ var _wde_wde_desktop_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../wde/wde-desktop.js */ \"./src/wde/wde-desktop.js\");\n/* harmony import */ var _finder_window_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./finder-window.js */ \"./src/apps/finder/finder-window.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n// require(\"./finder.less\")\n\n\n\n\nvar Finder = /*#__PURE__*/function (_WDEApplication) {\n _inherits(Finder, _WDEApplication);\n var _super = _createSuper(Finder);\n /**\r\n * @constructor\r\n * @param {WebDesktopEnvironment} wde \r\n */\n function Finder(wde) {\n _classCallCheck(this, Finder);\n /** @type {WDEApplication} */\n return _super.call(this, wde);\n }\n\n /**\r\n * @param {string[]} args\r\n * @param {import(\"../../wde/wde-desktop.js\").runContext} runContext\r\n */\n _createClass(Finder, [{\n key: \"NewWindow\",\n value: function () {\n var _NewWindow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(args, runContext) {\n var newFinder;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n newFinder = new _finder_window_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n _context.next = 3;\n return newFinder.Init(this, args, runContext);\n case 3:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function NewWindow(_x, _x2) {\n return _NewWindow.apply(this, arguments);\n }\n return NewWindow;\n }()\n /**\r\n * @param {string[]} args\r\n * @param {import(\"../../wde/wde-desktop.js\").runContext} runContext\r\n */\n }, {\n key: \"NewView\",\n value: function () {\n var _NewView = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(args, runContext) {\n var newFinderView;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n newFinderView = new _finder_window_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](this, args, runContext);\n _context2.next = 3;\n return newFinderView.Init(this, args, runContext);\n case 3:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function NewView(_x3, _x4) {\n return _NewView.apply(this, arguments);\n }\n return NewView;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"RenderProperites\",\n value: function () {\n var _RenderProperites = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(path) {\n var params, response, html, newWindow;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n if (!(path == null || path == \"\")) {\n _context3.next = 2;\n break;\n }\n return _context3.abrupt(\"return\");\n case 2:\n params = new URLSearchParams({\n path: path\n });\n _context3.next = 5;\n return fetch(\"/app/\".concat(Finder.AppId, \"/renderProps?\") + params);\n case 5:\n response = _context3.sent;\n if (!(response.status != 200)) {\n _context3.next = 8;\n break;\n }\n return _context3.abrupt(\"return\", false);\n case 8:\n _context3.next = 10;\n return response.text();\n case 10:\n html = _context3.sent;\n newWindow = _get(_getPrototypeOf(Finder.prototype), \"getWde\", this).call(this).Decorat.CreateNewWindow(Finder.AppId, 350, 500);\n newWindow.innerHTML = html;\n newWindow.querySelector(\"#closeWindowButton\").addEventListener('click', function (params) {\n // WebDesktopEnvironment.CloseWindow(newWindow)\n });\n case 14:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n function RenderProperites(_x5) {\n return _RenderProperites.apply(this, arguments);\n }\n return RenderProperites;\n }()\n }]);\n return Finder;\n}(_wde_application_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n_defineProperty(Finder, \"AppId\", \"Finder\");\n\n\n//# sourceURL=webpack://my-webpack-project/./src/apps/finder/finder.js?"); /***/ }), @@ -47,7 +47,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \********************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEApplication)\n/* harmony export */ });\n/* harmony import */ var _wde_desktop_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wde-desktop.js */ \"./src/wde/wde-desktop.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\nvar _wde = /*#__PURE__*/new WeakMap();\nvar WDEApplication = /*#__PURE__*/function () {\n /** @type {WebDesktopEnvironment} */\n\n /**\n * @constructor\n * @param {WebDesktopEnvironment} wde \n */\n function WDEApplication(wde) {\n _classCallCheck(this, WDEApplication);\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _wde, wde);\n }\n _createClass(WDEApplication, [{\n key: \"getWde\",\n value: function getWde() {\n return _classPrivateFieldGet(this, _wde);\n }\n }]);\n return WDEApplication;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/application.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEApplication)\n/* harmony export */ });\n/* harmony import */ var _wde_desktop_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wde-desktop.js */ \"./src/wde/wde-desktop.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\nvar _wde = /*#__PURE__*/new WeakMap();\nvar WDEApplication = /*#__PURE__*/function () {\n /** @type {WebDesktopEnvironment} */\n\n /**\r\n * @constructor\r\n * @param {WebDesktopEnvironment} wde \r\n */\n function WDEApplication(wde) {\n _classCallCheck(this, WDEApplication);\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _wde, wde);\n }\n _createClass(WDEApplication, [{\n key: \"getWde\",\n value: function getWde() {\n return _classPrivateFieldGet(this, _wde);\n }\n }]);\n return WDEApplication;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/application.js?"); /***/ }), @@ -57,7 +57,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \********************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ DesktopDecorat)\n/* harmony export */ });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _windowsLayer = /*#__PURE__*/new WeakMap();\nvar _makeid = /*#__PURE__*/new WeakSet();\nvar DesktopDecorat = /*#__PURE__*/function () {\n /** @type {Element} */\n\n function DesktopDecorat() {\n var _this = this;\n _classCallCheck(this, DesktopDecorat);\n _classPrivateMethodInitSpec(this, _makeid);\n _classPrivateFieldInitSpec(this, _windowsLayer, {\n writable: true,\n value: void 0\n });\n this.windowLayer = document.body.querySelector('#windows-layer');\n // this.#windowsLayer = document.body.querySelector('#windows-layer')\n _classPrivateFieldSet(this, _windowsLayer, document.body.querySelector('#windows-layer'));\n var startDrag = function startDrag(event) {\n var window = event.target.closest('.WindowFrame');\n _this.bringWindowToFront(window);\n if (event.target.classList.contains(\"DragArea\")) {\n var xPosInit = event.offsetX;\n var yPosInit = event.offsetY;\n var dragWindow = function dragWindow(event) {\n window.style.left = \"\".concat(event.clientX - xPosInit, \"px\");\n window.style.top = \"\".concat(event.clientY - yPosInit, \"px\");\n };\n var stopDrag = function stopDrag() {\n removeEventListener('mousemove', dragWindow);\n removeEventListener('mouseup', stopDrag);\n };\n addEventListener('mousemove', dragWindow);\n addEventListener('mouseup', stopDrag);\n }\n };\n _classPrivateFieldGet(this, _windowsLayer).addEventListener('mousedown', startDrag);\n }\n\n /**\n * @param {HTMLElement} window\n */\n _createClass(DesktopDecorat, [{\n key: \"bringWindowToFront\",\n value: function bringWindowToFront(window) {\n //FIXME\n var previousWindow = _classPrivateFieldGet(this, _windowsLayer).lastChild;\n if (window == null || window == undefined) {\n return;\n }\n if (window != previousWindow) {\n _classPrivateFieldGet(this, _windowsLayer).insertBefore(window, previousWindow.nextSibling);\n previousWindow.classList.remove(\"Focused\");\n window.classList.add(\"Focused\");\n } else {\n window.classList.add(\"Focused\");\n }\n return;\n }\n\n /**\n * @param {string} appId\n * @param {number} width\n * @param {number} height\n * @returns {HTMLElement}\n */\n }, {\n key: \"CreateNewWindow\",\n value: function CreateNewWindow(appId, width, height) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute('appid', appId);\n newWindow.setAttribute(\"class\", \"WindowFrame ConvexElement\");\n newWindow.setAttribute(\"windowId\", _classPrivateMethodGet(this, _makeid, _makeid2).call(this, 4)); //TODO:\n\n newWindow.style.width = width.toString() + \"px\";\n newWindow.style.height = height.toString() + \"px\";\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n return newWindow;\n }\n\n /**\n * @param {HTMLElement} window\n */\n }, {\n key: \"CloseWindow\",\n value: function CloseWindow(window) {\n window.remove();\n }\n }, {\n key: \"CloseFocusedWindow\",\n value: function CloseFocusedWindow() {\n if (document.body.querySelector('#windows-layer').childElementCount > 1) {\n document.body.querySelector('#windows-layer').lastElementChild.remove();\n }\n }\n }], [{\n key: \"ChangeURL\",\n value: function ChangeURL(appWindow) {\n var appId = appWindow.getAttribute('appid');\n window.history.replaceState(null, \"\", \"/\".concat(appId, \"/\"));\n }\n\n /**\n * @param {num} length\n */\n }]);\n return DesktopDecorat;\n}();\nfunction _makeid2(length) {\n var result = '';\n var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var charactersLength = characters.length;\n var counter = 0;\n while (counter < length) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n counter += 1;\n }\n return result;\n}\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/decorat/desktop-decorat.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ DesktopDecorat)\n/* harmony export */ });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _windowsLayer = /*#__PURE__*/new WeakMap();\nvar _makeid = /*#__PURE__*/new WeakSet();\nvar DesktopDecorat = /*#__PURE__*/function () {\n /** @type {Element} */\n\n function DesktopDecorat() {\n var _this = this;\n _classCallCheck(this, DesktopDecorat);\n _classPrivateMethodInitSpec(this, _makeid);\n _classPrivateFieldInitSpec(this, _windowsLayer, {\n writable: true,\n value: void 0\n });\n this.windowLayer = document.body.querySelector('#windows-layer');\n // this.#windowsLayer = document.body.querySelector('#windows-layer')\n _classPrivateFieldSet(this, _windowsLayer, document.body.querySelector('#windows-layer'));\n var startDrag = function startDrag(event) {\n var window = event.target.closest('.WindowFrame');\n _this.bringWindowToFront(window);\n if (event.target.classList.contains(\"DragArea\")) {\n var xPosInit = event.offsetX;\n var yPosInit = event.offsetY;\n var dragWindow = function dragWindow(event) {\n window.style.left = \"\".concat(event.clientX - xPosInit, \"px\");\n window.style.top = \"\".concat(event.clientY - yPosInit, \"px\");\n };\n var stopDrag = function stopDrag() {\n removeEventListener('mousemove', dragWindow);\n removeEventListener('mouseup', stopDrag);\n };\n addEventListener('mousemove', dragWindow);\n addEventListener('mouseup', stopDrag);\n }\n };\n _classPrivateFieldGet(this, _windowsLayer).addEventListener('mousedown', startDrag);\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n _createClass(DesktopDecorat, [{\n key: \"bringWindowToFront\",\n value: function bringWindowToFront(window) {\n //FIXME\n var previousWindow = _classPrivateFieldGet(this, _windowsLayer).lastChild;\n if (window == null || window == undefined) {\n return;\n }\n if (window != previousWindow) {\n _classPrivateFieldGet(this, _windowsLayer).insertBefore(window, previousWindow.nextSibling);\n previousWindow.classList.remove(\"Focused\");\n window.classList.add(\"Focused\");\n } else {\n window.classList.add(\"Focused\");\n }\n return;\n }\n\n /**\r\n * @param {string} appId\r\n * @param {number} width\r\n * @param {number} height\r\n * @returns {HTMLElement}\r\n */\n }, {\n key: \"CreateNewWindow\",\n value: function CreateNewWindow(appId, width, height) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute('appid', appId);\n newWindow.setAttribute(\"class\", \"WindowFrame ConvexElement\");\n newWindow.setAttribute(\"windowId\", _classPrivateMethodGet(this, _makeid, _makeid2).call(this, 4)); //TODO:\n\n newWindow.style.width = width.toString() + \"px\";\n newWindow.style.height = height.toString() + \"px\";\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n return newWindow;\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n }, {\n key: \"CloseWindow\",\n value: function CloseWindow(window) {\n window.remove();\n }\n }, {\n key: \"CloseFocusedWindow\",\n value: function CloseFocusedWindow() {\n if (document.body.querySelector('#windows-layer').childElementCount > 1) {\n document.body.querySelector('#windows-layer').lastElementChild.remove();\n }\n }\n }], [{\n key: \"ChangeURL\",\n value: function ChangeURL(appWindow) {\n var appId = appWindow.getAttribute('appid');\n window.history.replaceState(null, \"\", \"/\".concat(appId, \"/\"));\n }\n\n /**\r\n * @param {num} length\r\n */\n }]);\n return DesktopDecorat;\n}();\nfunction _makeid2(length) {\n var result = '';\n var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var charactersLength = characters.length;\n var counter = 0;\n while (counter < length) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n counter += 1;\n }\n return result;\n}\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/decorat/desktop-decorat.js?"); /***/ }), @@ -67,7 +67,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \****************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WdeScrollBar)\n/* harmony export */ });\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nvar WdeScrollBar = /*#__PURE__*/_createClass(\n/**\n* @param {HTMLElement} scrollBarContainer\n* @param {HTMLElement} content\n*/\nfunction WdeScrollBar(scrollBarContainer, content) {\n var _this = this;\n _classCallCheck(this, WdeScrollBar);\n var nonNativeScroll = false;\n // console.log(scrollBarContainer, content)\n // let handler = scrollBarContainer.children[0]\n //TODO On scroll move focus on window?\n var handler = scrollBarContainer.querySelector(\".ScrollBarScrollElement\"); //TODO Refactor classes\n // console.log(handler)\n\n handler.style.height = content.clientHeight / content.scrollHeight * handler.parentElement.clientHeight + 'px';\n var max = handler.parentElement.clientHeight - handler.clientHeight;\n var yPosInit = 0;\n handler.addEventListener('mousedown', function (event) {\n nonNativeScroll = true;\n yPosInit = event.clientY - Number(handler.style.top.replace('px', ''));\n document.addEventListener('mousemove', drag);\n document.addEventListener('mouseup', stop);\n });\n content.addEventListener('scroll', function (event) {\n if (!_this.nonNativeScroll) {\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n handler.style.top = content.scrollTop / coefficient + 'px';\n }\n });\n function drag() {\n // console.log(event.clientY - yPosInit, Number(handler.style.top.replace('px','' )))\n var pos = event.clientY - yPosInit;\n var clampPos = Math.min(Math.max(pos, 0), max);\n handler.style.top = clampPos + \"px\";\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n // console.log(clampPos, coefficient, content.clientHeight, clampPos* coefficient)\n\n content.scrollTop = clampPos * coefficient;\n }\n function stop() {\n // console.log(\"stop\")\n document.removeEventListener('mousemove', drag);\n document.removeEventListener('mouseup', stop);\n nonNativeScroll = false;\n }\n});\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/scrollbar/scrollbar.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WdeScrollBar)\n/* harmony export */ });\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nvar WdeScrollBar = /*#__PURE__*/_createClass(\n/**\r\n* @param {HTMLElement} scrollBarContainer\r\n* @param {HTMLElement} content\r\n*/\nfunction WdeScrollBar(scrollBarContainer, content) {\n var _this = this;\n _classCallCheck(this, WdeScrollBar);\n var nonNativeScroll = false;\n // console.log(scrollBarContainer, content)\n // let handler = scrollBarContainer.children[0]\n //TODO On scroll move focus on window?\n var handler = scrollBarContainer.querySelector(\".ScrollBarScrollElement\"); //TODO Refactor classes\n // console.log(handler)\n\n handler.style.height = content.clientHeight / content.scrollHeight * handler.parentElement.clientHeight + 'px';\n var max = handler.parentElement.clientHeight - handler.clientHeight;\n var yPosInit = 0;\n handler.addEventListener('mousedown', function (event) {\n nonNativeScroll = true;\n yPosInit = event.clientY - Number(handler.style.top.replace('px', ''));\n document.addEventListener('mousemove', drag);\n document.addEventListener('mouseup', stop);\n });\n content.addEventListener('scroll', function (event) {\n if (!_this.nonNativeScroll) {\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n handler.style.top = content.scrollTop / coefficient + 'px';\n }\n });\n function drag() {\n // console.log(event.clientY - yPosInit, Number(handler.style.top.replace('px','' )))\n var pos = event.clientY - yPosInit;\n var clampPos = Math.min(Math.max(pos, 0), max);\n handler.style.top = clampPos + \"px\";\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n // console.log(clampPos, coefficient, content.clientHeight, clampPos* coefficient)\n\n content.scrollTop = clampPos * coefficient;\n }\n function stop() {\n // console.log(\"stop\")\n document.removeEventListener('mousemove', drag);\n document.removeEventListener('mouseup', stop);\n nonNativeScroll = false;\n }\n});\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/scrollbar/scrollbar.js?"); /***/ }), @@ -77,7 +77,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \********************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decorat/desktop-decorat.js */ \"./src/wde/decorat/desktop-decorat.js\");\n/* harmony import */ var _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scrollbar/scrollbar.js */ \"./src/wde/scrollbar/scrollbar.js\");\n/* harmony import */ var _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../web-fs/web-fs.js */ \"./src/web-fs/web-fs.js\");\n/* harmony import */ var _application_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./application.js */ \"./src/wde/application.js\");\n/* harmony import */ var _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./widgets/file-view/file-view.js */ \"./src/wde/widgets/file-view/file-view.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\n// import DesktopSunBoard from \"./sunboard/sunboard-desktop.js\";\nvar WebDesktopEnvironment = /*#__PURE__*/function () {\n /** @type {string} */\n\n /** @type {WDEFileView} */\n\n /** @type {WDEScrollBar} */\n\n /**@type {DesktopDecorat} */\n\n /** @type {Object} */\n\n /** Deprecated */\n\n // static decorat\n\n function WebDesktopEnvironment() {\n _classCallCheck(this, WebDesktopEnvironment);\n _defineProperty(this, \"test\", \"\");\n _defineProperty(this, \"FileView\", _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]);\n _defineProperty(this, \"ScrollBar\", _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n _defineProperty(this, \"Decorat\", void 0);\n document.body.style.setProperty('--zoom', 1);\n this.Decorat = new _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n WebDesktopEnvironment.webFs = new _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this.FileView = _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"];\n this.loadWDE();\n // this.#devLoadSunboard()\n }\n _createClass(WebDesktopEnvironment, [{\n key: \"loadWDE\",\n value: function () {\n var _loadWDE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var autoStart, _iterator, _step, child, appPath, args, argsRaw, _iterator2, _step2, argRaw, arg;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n autoStart = document.body.querySelector(\"wde-autostart\");\n if (!(autoStart == null)) {\n _context.next = 4;\n break;\n }\n WebDesktopEnvironment.Alert(\"Error in loading DE\");\n return _context.abrupt(\"return\");\n case 4:\n _iterator = _createForOfIteratorHelper(autoStart.children);\n _context.prev = 5;\n _iterator.s();\n case 7:\n if ((_step = _iterator.n()).done) {\n _context.next = 41;\n break;\n }\n child = _step.value;\n if (!(child.nodeName != \"APP\")) {\n _context.next = 11;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 11:\n appPath = child.getAttribute(\"app-path\");\n if (!(appPath == null)) {\n _context.next = 14;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 14:\n args = [];\n argsRaw = child.querySelector(\"args\");\n if (!(argsRaw == null)) {\n _context.next = 18;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 18:\n _iterator2 = _createForOfIteratorHelper(argsRaw.children);\n _context.prev = 19;\n _iterator2.s();\n case 21:\n if ((_step2 = _iterator2.n()).done) {\n _context.next = 29;\n break;\n }\n argRaw = _step2.value;\n arg = argRaw.getAttribute(\"string\");\n if (!(arg == null)) {\n _context.next = 26;\n break;\n }\n return _context.abrupt(\"continue\", 27);\n case 26:\n args.push(arg);\n case 27:\n _context.next = 21;\n break;\n case 29:\n _context.next = 34;\n break;\n case 31:\n _context.prev = 31;\n _context.t0 = _context[\"catch\"](19);\n _iterator2.e(_context.t0);\n case 34:\n _context.prev = 34;\n _iterator2.f();\n return _context.finish(34);\n case 37:\n _context.next = 39;\n return this.Open(appPath, args);\n case 39:\n _context.next = 7;\n break;\n case 41:\n _context.next = 46;\n break;\n case 43:\n _context.prev = 43;\n _context.t1 = _context[\"catch\"](5);\n _iterator.e(_context.t1);\n case 46:\n _context.prev = 46;\n _iterator.f();\n return _context.finish(46);\n case 49:\n autoStart.remove();\n case 50:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this, [[5, 43, 46, 49], [19, 31, 34, 37]]);\n }));\n function loadWDE() {\n return _loadWDE.apply(this, arguments);\n }\n return loadWDE;\n }()\n /**\n * @param {string} appPath\n * @param {string[]} args\n * @param {string} runPath\n */\n }, {\n key: \"Open\",\n value: function () {\n var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appPath, args, runPath) {\n var appManifest, runContext;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return WebDesktopEnvironment.fetchApp(appPath);\n case 2:\n appManifest = _context2.sent;\n if (!(appManifest === undefined)) {\n _context2.next = 5;\n break;\n }\n return _context2.abrupt(\"return\");\n case 5:\n //TODO return err\n /**@type {runContext} */\n runContext = {\n WDE: this,\n isMobile: false,\n bundlePath: appPath,\n runPath: runPath\n };\n if (WebDesktopEnvironment.Applications[appManifest.appId] === undefined) {\n WebDesktopEnvironment.load2(appManifest, function () {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n });\n } else {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n }\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function Open(_x, _x2, _x3) {\n return _Open.apply(this, arguments);\n }\n return Open;\n }()\n /**\n * @param {string} appManifest\n * @param {function} onload callback after script loading\n */\n }], [{\n key: \"load2\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(appManifest, onload) {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n // import(window.location.origin + appManifest.js[0]).then((app) => {\n // console.log(window.location.origin + appManifest.js[0] == 'http://localhost:8080/res/dev-fs/wde/dist/finder.js')\n // let kek = 'http://localhost:8080/res/dev-fs/wde/dist/finder.js'\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! http://localhost:8080/res/dev-fs/dist/finder.js */ \"http://localhost:8080/res/dev-fs/dist/finder.js\")).then(function (app) {\n var newApp = new app[\"default\"]();\n // if newApp //TODO Validate\n WebDesktopEnvironment.Applications[appManifest.appId] = newApp;\n onload();\n });\n return _context3.abrupt(\"return\");\n case 2:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function load2(_x4, _x5) {\n return _load.apply(this, arguments);\n }\n return load2;\n }()\n /**\n * @param {string} path\n * @returns {Object | undefined} //FIXME\n */\n }, {\n key: \"fetchApp\",\n value: function () {\n var _fetchApp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(path) {\n var params, response, error, appManifest;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n // console.log(\"path: \" + path )\n params = new URLSearchParams({\n path: path,\n mode: \"json\"\n });\n _context4.next = 3;\n return fetch(\"/system/loadApp?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 10;\n break;\n }\n _context4.next = 7;\n return response.json();\n case 7:\n error = _context4.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context4.abrupt(\"return\", undefined);\n case 10:\n //TODO Validate manifest\n appManifest = response.json();\n return _context4.abrupt(\"return\", appManifest);\n case 12:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function fetchApp(_x6) {\n return _fetchApp.apply(this, arguments);\n }\n return fetchApp;\n }()\n /**\n * @param {string} html\n */\n }, {\n key: \"SetBasicWindow\",\n value: function SetBasicWindow(html) {\n this.basicWindow = html;\n }\n\n /**\n * @returns {string}\n */\n }, {\n key: \"GetBasicWindow\",\n value: function GetBasicWindow() {\n return this.basicWindow;\n }\n\n /**\n * @param {string} alertText\n */\n }, {\n key: \"Alert\",\n value: function Alert(alertText) {\n WebDesktopEnvironment.CreateAlertWindow(alertText);\n console.log(alertText);\n }\n\n /**\n * @param {string} alertText\n */\n }, {\n key: \"CreateAlertWindow\",\n value: function CreateAlertWindow(alertText) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute(\"class\", \"WindowFrameless\");\n newWindow.setAttribute(\"windowId\", \"SuperUniqUUID\"); //TODO:\n newWindow.style.cssText = \"position:absolute;width:450px;height:116px; margin-left: -225px; margin-top:-58px;left: 50%;top: 50%;background-color:#FFFFFF;border: 1px solid #000000;box-shadow: 2px 2px 0px #000000;\";\n var alertImage = document.createElement(\"img\");\n alertImage.setAttribute(\"src\", \"/res/sys/wde/icons/ohno.png\");\n alertImage.style.cssText = \"position:absolute; width:64px;height:64px;top:15px;left:25px\";\n newWindow.appendChild(alertImage);\n var errorText = document.createElement(\"div\");\n errorText.style.cssText = \"position:absolute; width: 300px; left:128px; top:30px;font-family: 'Virtue';\";\n errorText.innerHTML = alertText;\n newWindow.appendChild(errorText);\n var closeButton = document.createElement(\"button\");\n closeButton.style.cssText = \"position:absolute; left: 382px; bottom: 10px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;\";\n closeButton.innerHTML = \"Close\";\n closeButton.addEventListener('click', function () {\n newWindow.remove();\n });\n newWindow.appendChild(closeButton);\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n }\n }]);\n return WebDesktopEnvironment;\n}();\n/**\n * @typedef {Object} runContext\n * @property {WebDesktopEnvironment} WDE \n * @property {boolean} isMobile\n * @property {string} appPath \n * @property {string} runPath //TODO\n*/\n_defineProperty(WebDesktopEnvironment, \"Applications\", {});\n_defineProperty(WebDesktopEnvironment, \"isMobile\", false);\n_defineProperty(WebDesktopEnvironment, \"webFs\", void 0);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde-desktop.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decorat/desktop-decorat.js */ \"./src/wde/decorat/desktop-decorat.js\");\n/* harmony import */ var _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scrollbar/scrollbar.js */ \"./src/wde/scrollbar/scrollbar.js\");\n/* harmony import */ var _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../web-fs/web-fs.js */ \"./src/web-fs/web-fs.js\");\n/* harmony import */ var _application_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./application.js */ \"./src/wde/application.js\");\n/* harmony import */ var _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./widgets/file-view/file-view.js */ \"./src/wde/widgets/file-view/file-view.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\n// import DesktopSunBoard from \"./sunboard/sunboard-desktop.js\";\nvar WebDesktopEnvironment = /*#__PURE__*/function () {\n /** @type {string} */\n\n /** @type {WDEFileView} */\n\n /** @type {WDEScrollBar} */\n\n /**@type {DesktopDecorat} */\n\n /** @type {Object} */\n\n /** Deprecated */\n\n // static decorat\n\n function WebDesktopEnvironment() {\n _classCallCheck(this, WebDesktopEnvironment);\n _defineProperty(this, \"test\", \"\");\n _defineProperty(this, \"FileView\", _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]);\n _defineProperty(this, \"ScrollBar\", _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n _defineProperty(this, \"Decorat\", void 0);\n document.body.style.setProperty('--zoom', 1);\n this.Decorat = new _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n WebDesktopEnvironment.webFs = new _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this.FileView = _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"];\n this.loadWDE();\n // this.#devLoadSunboard()\n }\n _createClass(WebDesktopEnvironment, [{\n key: \"loadWDE\",\n value: function () {\n var _loadWDE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var autoStart, _iterator, _step, child, appPath, args, argsRaw, _iterator2, _step2, argRaw, arg;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n autoStart = document.body.querySelector(\"wde-autostart\");\n if (!(autoStart == null)) {\n _context.next = 4;\n break;\n }\n WebDesktopEnvironment.Alert(\"Error in loading DE\");\n return _context.abrupt(\"return\");\n case 4:\n _iterator = _createForOfIteratorHelper(autoStart.children);\n _context.prev = 5;\n _iterator.s();\n case 7:\n if ((_step = _iterator.n()).done) {\n _context.next = 41;\n break;\n }\n child = _step.value;\n if (!(child.nodeName != \"APP\")) {\n _context.next = 11;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 11:\n appPath = child.getAttribute(\"app-path\");\n if (!(appPath == null)) {\n _context.next = 14;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 14:\n args = [];\n argsRaw = child.querySelector(\"args\");\n if (!(argsRaw == null)) {\n _context.next = 18;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 18:\n _iterator2 = _createForOfIteratorHelper(argsRaw.children);\n _context.prev = 19;\n _iterator2.s();\n case 21:\n if ((_step2 = _iterator2.n()).done) {\n _context.next = 29;\n break;\n }\n argRaw = _step2.value;\n arg = argRaw.getAttribute(\"string\");\n if (!(arg == null)) {\n _context.next = 26;\n break;\n }\n return _context.abrupt(\"continue\", 27);\n case 26:\n args.push(arg);\n case 27:\n _context.next = 21;\n break;\n case 29:\n _context.next = 34;\n break;\n case 31:\n _context.prev = 31;\n _context.t0 = _context[\"catch\"](19);\n _iterator2.e(_context.t0);\n case 34:\n _context.prev = 34;\n _iterator2.f();\n return _context.finish(34);\n case 37:\n _context.next = 39;\n return this.Open(appPath, args);\n case 39:\n _context.next = 7;\n break;\n case 41:\n _context.next = 46;\n break;\n case 43:\n _context.prev = 43;\n _context.t1 = _context[\"catch\"](5);\n _iterator.e(_context.t1);\n case 46:\n _context.prev = 46;\n _iterator.f();\n return _context.finish(46);\n case 49:\n autoStart.remove();\n case 50:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this, [[5, 43, 46, 49], [19, 31, 34, 37]]);\n }));\n function loadWDE() {\n return _loadWDE.apply(this, arguments);\n }\n return loadWDE;\n }()\n /**\r\n * @param {string} appPath\r\n * @param {string[]} args\r\n * @param {string} runPath\r\n */\n }, {\n key: \"Open\",\n value: function () {\n var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appPath, args, runPath) {\n var appManifest, runContext;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return WebDesktopEnvironment.fetchApp(appPath);\n case 2:\n appManifest = _context2.sent;\n if (!(appManifest === undefined)) {\n _context2.next = 5;\n break;\n }\n return _context2.abrupt(\"return\");\n case 5:\n //TODO return err\n /**@type {runContext} */\n runContext = {\n WDE: this,\n isMobile: false,\n bundlePath: appPath,\n runPath: runPath\n };\n if (WebDesktopEnvironment.Applications[appManifest.appId] === undefined) {\n WebDesktopEnvironment.load2(appManifest, function () {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n });\n } else {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n }\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function Open(_x, _x2, _x3) {\n return _Open.apply(this, arguments);\n }\n return Open;\n }()\n /**\r\n * @param {string} appManifest\r\n * @param {function} onload callback after script loading\r\n */\n }], [{\n key: \"load2\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(appManifest, onload) {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n // import(window.location.origin + appManifest.js[0]).then((app) => {\n // console.log(window.location.origin + appManifest.js[0] == 'http://localhost:8080/res/dev-fs/wde/dist/finder.js')\n // let kek = 'http://localhost:8080/res/dev-fs/wde/dist/finder.js'\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! http://localhost:8080/res/dev-fs/dist/finder.js */ \"http://localhost:8080/res/dev-fs/dist/finder.js\")).then(function (app) {\n var newApp = new app[\"default\"]();\n // if newApp //TODO Validate\n WebDesktopEnvironment.Applications[appManifest.appId] = newApp;\n onload();\n });\n return _context3.abrupt(\"return\");\n case 2:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function load2(_x4, _x5) {\n return _load.apply(this, arguments);\n }\n return load2;\n }()\n /**\r\n * @param {string} path\r\n * @returns {Object | undefined} //FIXME\r\n */\n }, {\n key: \"fetchApp\",\n value: function () {\n var _fetchApp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(path) {\n var params, response, error, appManifest;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n // console.log(\"path: \" + path )\n params = new URLSearchParams({\n path: path,\n mode: \"json\"\n });\n _context4.next = 3;\n return fetch(\"/system/loadApp?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 10;\n break;\n }\n _context4.next = 7;\n return response.json();\n case 7:\n error = _context4.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context4.abrupt(\"return\", undefined);\n case 10:\n //TODO Validate manifest\n appManifest = response.json();\n return _context4.abrupt(\"return\", appManifest);\n case 12:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function fetchApp(_x6) {\n return _fetchApp.apply(this, arguments);\n }\n return fetchApp;\n }()\n /**\r\n * @param {string} html\r\n */\n }, {\n key: \"SetBasicWindow\",\n value: function SetBasicWindow(html) {\n this.basicWindow = html;\n }\n\n /**\r\n * @returns {string}\r\n */\n }, {\n key: \"GetBasicWindow\",\n value: function GetBasicWindow() {\n return this.basicWindow;\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"Alert\",\n value: function Alert(alertText) {\n WebDesktopEnvironment.CreateAlertWindow(alertText);\n console.log(alertText);\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"CreateAlertWindow\",\n value: function CreateAlertWindow(alertText) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute(\"class\", \"WindowFrameless\");\n newWindow.setAttribute(\"windowId\", \"SuperUniqUUID\"); //TODO:\n newWindow.style.cssText = \"position:absolute;width:450px;height:116px; margin-left: -225px; margin-top:-58px;left: 50%;top: 50%;background-color:#FFFFFF;border: 1px solid #000000;box-shadow: 2px 2px 0px #000000;\";\n var alertImage = document.createElement(\"img\");\n alertImage.setAttribute(\"src\", \"/res/sys/wde/icons/ohno.png\");\n alertImage.style.cssText = \"position:absolute; width:64px;height:64px;top:15px;left:25px\";\n newWindow.appendChild(alertImage);\n var errorText = document.createElement(\"div\");\n errorText.style.cssText = \"position:absolute; width: 300px; left:128px; top:30px;font-family: 'Virtue';\";\n errorText.innerHTML = alertText;\n newWindow.appendChild(errorText);\n var closeButton = document.createElement(\"button\");\n closeButton.style.cssText = \"position:absolute; left: 382px; bottom: 10px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;\";\n closeButton.innerHTML = \"Close\";\n closeButton.addEventListener('click', function () {\n newWindow.remove();\n });\n newWindow.appendChild(closeButton);\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n }\n }]);\n return WebDesktopEnvironment;\n}();\n/**\r\n * @typedef {Object} runContext\r\n * @property {WebDesktopEnvironment} WDE \r\n * @property {boolean} isMobile\r\n * @property {string} appPath \r\n * @property {string} runPath //TODO\r\n*/\n_defineProperty(WebDesktopEnvironment, \"Applications\", {});\n_defineProperty(WebDesktopEnvironment, \"isMobile\", false);\n_defineProperty(WebDesktopEnvironment, \"webFs\", void 0);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde-desktop.js?"); /***/ }), @@ -87,7 +87,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEFileView)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar WDEFileView = /*#__PURE__*/function () {\n /**\n * @param {HTMLElement} fileViewElem\n * @param {Function} doubleClickCallback\n * @param {Function} rightClickCallback\n * @param {Function} updateFileViewCallback\n */\n function WDEFileView(fileViewElem, doubleClickCallback, rightClickCallback, fileUploadCallback, updateFileViewCallback) {\n var _this = this;\n _classCallCheck(this, WDEFileView);\n _defineProperty(this, \"path\", \"\");\n _defineProperty(this, \"parentElem\", undefined);\n _defineProperty(this, \"selected\", []);\n //TODO check all params\n this.parentElem = fileViewElem;\n fileViewElem.addEventListener('click', function (event) {\n if (event.target.classList[0] == 'FileTileView') {\n _this.DeselectAll();\n return;\n }\n if (event.detail === 1) {\n _this.DeselectAll();\n _this.Select([event.target]);\n } else if (event.detail === 2) {\n doubleClickCallback(event);\n }\n });\n fileViewElem.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n if (event.target.classList.contains(\"Tile\")) {\n _this.DeselectAll();\n _this.Select([event.target]);\n }\n _this.Select([event.target]);\n rightClickCallback(event);\n });\n if (fileUploadCallback !== undefined) {\n var counter = 0;\n var draggedElem = undefined;\n fileViewElem.addEventListener('dragstart', function (event) {\n // console.log(event.target)\n // console.log(this.path)\n // draggedElem = event.target\n event.dataTransfer.setData(\"fileName\", event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"filePath\", _this.path + \"/\" + event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"dropType\", \"move\");\n // console.log(updateFileViewCallback)\n // event.dataTransfer.setData(\"updateCallback\", updateFileViewCallback)\n // event.dataTransfer.setData(\"fileName\", )\n // console.log(draggedElem)\n });\n\n fileViewElem.addEventListener('dragenter', function (event) {\n event.preventDefault();\n counter++;\n fileViewElem.classList.add(\"DragDropBorder\");\n });\n fileViewElem.addEventListener('dragend', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // updateFileViewCallback()\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragleave', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragover', function (event) {\n event.preventDefault();\n });\n fileViewElem.addEventListener(\"drop\", function (event) {\n event.preventDefault();\n fileUploadCallback(event);\n fileViewElem.classList.remove(\"DragDropBorder\");\n // updateFileViewCallback()\n // this.OpenFolder(this.path)\n // draggedElem = undefined\n });\n }\n }\n\n /** \n * @param {[]Element} elements\n */\n _createClass(WDEFileView, [{\n key: \"Select\",\n value: function Select(elements) {\n var _this2 = this;\n elements.forEach(function (element) {\n _this2.selected.push(element);\n element.classList.add(\"Selected\");\n });\n }\n }, {\n key: \"DeselectAll\",\n value: function DeselectAll() {\n this.selected.forEach(function (element) {\n element.classList.remove(\"Selected\");\n });\n this.selected = [];\n }\n\n /** Get html of folder by path\n * @param {string} path\n */\n }, {\n key: \"OpenFolder\",\n value: function () {\n var _OpenFolder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response, html;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.path = path;\n params = new URLSearchParams({\n path: path\n });\n _context.next = 4;\n return fetch(\"/system/wde/widgets/file-tile-view?\" + params);\n case 4:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 8;\n break;\n }\n //TODO Error text message\n WebDesktopEnvironment.Alert(\"TODO\");\n return _context.abrupt(\"return\");\n case 8:\n _context.next = 10;\n return response.text();\n case 10:\n html = _context.sent;\n this.parentElem.innerHTML = html;\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function OpenFolder(_x) {\n return _OpenFolder.apply(this, arguments);\n }\n return OpenFolder;\n }()\n }]);\n return WDEFileView;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/widgets/file-view/file-view.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEFileView)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar WDEFileView = /*#__PURE__*/function () {\n /**\r\n * @param {HTMLElement} fileViewElem\r\n * @param {Function} doubleClickCallback\r\n * @param {Function} rightClickCallback\r\n * @param {Function} updateFileViewCallback\r\n */\n function WDEFileView(fileViewElem, doubleClickCallback, rightClickCallback, fileUploadCallback, updateFileViewCallback) {\n var _this = this;\n _classCallCheck(this, WDEFileView);\n _defineProperty(this, \"path\", \"\");\n _defineProperty(this, \"parentElem\", undefined);\n _defineProperty(this, \"selected\", []);\n //TODO check all params\n this.parentElem = fileViewElem;\n fileViewElem.addEventListener('click', function (event) {\n if (event.target.classList[0] == 'FileTileView') {\n _this.DeselectAll();\n return;\n }\n if (event.detail === 1) {\n _this.DeselectAll();\n _this.Select([event.target]);\n } else if (event.detail === 2) {\n doubleClickCallback(event);\n }\n });\n fileViewElem.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n if (event.target.classList.contains(\"Tile\")) {\n _this.DeselectAll();\n _this.Select([event.target]);\n }\n _this.Select([event.target]);\n rightClickCallback(event);\n });\n if (fileUploadCallback !== undefined) {\n var counter = 0;\n var draggedElem = undefined;\n fileViewElem.addEventListener('dragstart', function (event) {\n // console.log(event.target)\n // console.log(this.path)\n // draggedElem = event.target\n event.dataTransfer.setData(\"fileName\", event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"filePath\", _this.path + \"/\" + event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"dropType\", \"move\");\n // console.log(updateFileViewCallback)\n // event.dataTransfer.setData(\"updateCallback\", updateFileViewCallback)\n // event.dataTransfer.setData(\"fileName\", )\n // console.log(draggedElem)\n });\n\n fileViewElem.addEventListener('dragenter', function (event) {\n event.preventDefault();\n counter++;\n fileViewElem.classList.add(\"DragDropBorder\");\n });\n fileViewElem.addEventListener('dragend', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // updateFileViewCallback()\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragleave', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragover', function (event) {\n event.preventDefault();\n });\n fileViewElem.addEventListener(\"drop\", function (event) {\n event.preventDefault();\n fileUploadCallback(event);\n fileViewElem.classList.remove(\"DragDropBorder\");\n // updateFileViewCallback()\n // this.OpenFolder(this.path)\n // draggedElem = undefined\n });\n }\n }\n\n /** \r\n * @param {[]Element} elements\r\n */\n _createClass(WDEFileView, [{\n key: \"Select\",\n value: function Select(elements) {\n var _this2 = this;\n elements.forEach(function (element) {\n _this2.selected.push(element);\n element.classList.add(\"Selected\");\n });\n }\n }, {\n key: \"DeselectAll\",\n value: function DeselectAll() {\n this.selected.forEach(function (element) {\n element.classList.remove(\"Selected\");\n });\n this.selected = [];\n }\n\n /** Get html of folder by path\r\n * @param {string} path\r\n */\n }, {\n key: \"OpenFolder\",\n value: function () {\n var _OpenFolder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response, html;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.path = path;\n params = new URLSearchParams({\n path: path\n });\n _context.next = 4;\n return fetch(\"/system/wde/widgets/file-tile-view?\" + params);\n case 4:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 8;\n break;\n }\n //TODO Error text message\n WebDesktopEnvironment.Alert(\"TODO\");\n return _context.abrupt(\"return\");\n case 8:\n _context.next = 10;\n return response.text();\n case 10:\n html = _context.sent;\n this.parentElem.innerHTML = html;\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function OpenFolder(_x) {\n return _OpenFolder.apply(this, arguments);\n }\n return OpenFolder;\n }()\n }]);\n return WDEFileView;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/widgets/file-view/file-view.js?"); /***/ }), @@ -97,7 +97,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \******************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebFS)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nvar WebFS = /*#__PURE__*/function () {\n function WebFS() {\n _classCallCheck(this, WebFS);\n }\n _createClass(WebFS, null, [{\n key: \"CreateDirectory\",\n value:\n /**\n * @param {string} path\n * @returns {boolean}\n */\n function () {\n var _CreateDirectory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(path == undefined)) {\n _context.next = 3;\n break;\n }\n WebDesktopEnvironment.Alert(\"Path is undefined\");\n return _context.abrupt(\"return\", false);\n case 3:\n params = new URLSearchParams({\n path: \"\".concat(path, \"/New Directory\")\n });\n _context.next = 6;\n return fetch(\"/system/fs/createDir?\" + params);\n case 6:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 10;\n break;\n }\n WebDesktopEnvironment.Alert(\"DIRCTORY CREATION ERROR\"); //TODO\n return _context.abrupt(\"return\", false);\n case 10:\n return _context.abrupt(\"return\", true);\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n function CreateDirectory(_x) {\n return _CreateDirectory.apply(this, arguments);\n }\n return CreateDirectory;\n }()\n /**\n * @param {string} path\n * @returns {boolean}\n */\n }, {\n key: \"DeleteFile\",\n value: function () {\n var _DeleteFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n params = new URLSearchParams({\n path: path\n });\n _context2.next = 3;\n return fetch(\"/system/fs/delete?\" + params);\n case 3:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"DELETE ERROR\"); //TODO\n return _context2.abrupt(\"return\", false);\n case 7:\n return _context2.abrupt(\"return\", true);\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n function DeleteFile(_x2) {\n return _DeleteFile.apply(this, arguments);\n }\n return DeleteFile;\n }()\n /**\n * @param {string} path\n * @returns {boolean}\n */\n }, {\n key: \"MoveFile\",\n value: function () {\n var _MoveFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sourcePath, targetPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n targetPath: targetPath\n });\n _context3.next = 3;\n return fetch(\"/system/fs/move?\" + params);\n case 3:\n response = _context3.sent;\n if (!(response.status != 200)) {\n _context3.next = 6;\n break;\n }\n return _context3.abrupt(\"return\", false);\n case 6:\n return _context3.abrupt(\"return\", true);\n case 7:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function MoveFile(_x3, _x4) {\n return _MoveFile.apply(this, arguments);\n }\n return MoveFile;\n }()\n /**\n * @param {string} linkPath\n * @returns {string}\n */\n }, {\n key: \"ReadObjectLink\",\n value: function () {\n var _ReadObjectLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(linkPath) {\n var params, response, path;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context4.next = 3;\n return fetch(\"/system/fs/readObjectLink?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context4.abrupt(\"return\", \"\");\n case 7:\n _context4.next = 9;\n return response.text();\n case 9:\n path = _context4.sent;\n return _context4.abrupt(\"return\", path);\n case 11:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function ReadObjectLink(_x5) {\n return _ReadObjectLink.apply(this, arguments);\n }\n return ReadObjectLink;\n }()\n /**\n * @param {string} sourcePath\n * @param {string} linkPath\n * @returns {string}\n */\n }, {\n key: \"CreatePathLink\",\n value: function () {\n var _CreatePathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sourcePath, linkPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n linkPath: linkPath\n });\n _context5.next = 3;\n return fetch(\"/system/fs/createPathLink?\" + params);\n case 3:\n response = _context5.sent;\n return _context5.abrupt(\"return\", response.status == 200);\n case 5:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5);\n }));\n function CreatePathLink(_x6, _x7) {\n return _CreatePathLink.apply(this, arguments);\n }\n return CreatePathLink;\n }()\n /**\n * @param {string} linkPath\n * @returns {string}\n */\n }, {\n key: \"ReadPathLink\",\n value: function () {\n var _ReadPathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(linkPath) {\n var params, response, file;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context6.next = 3;\n return fetch(\"/system/fs/readPathLink?\" + params);\n case 3:\n response = _context6.sent;\n if (!(response.status != 200)) {\n _context6.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context6.abrupt(\"return\", \"\");\n case 7:\n _context6.next = 9;\n return response.json();\n case 9:\n file = _context6.sent;\n return _context6.abrupt(\"return\", file);\n case 11:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6);\n }));\n function ReadPathLink(_x8) {\n return _ReadPathLink.apply(this, arguments);\n }\n return ReadPathLink;\n }()\n /**\n * @param {File} file\n * @param {string} parentPath\n * @returns {boolean}\n */\n }, {\n key: \"UploadFile\",\n value: function () {\n var _UploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(file, parentPath) {\n var formData, params, response, error;\n return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n console.log('here');\n formData = new FormData();\n formData.append(\"file\", file); //FIXME Conn reset\n params = new URLSearchParams({\n parentPath: parentPath\n });\n _context7.next = 6;\n return fetch(\"/system/fs/upload?\" + params, {\n method: \"POST\",\n //TODO Change to PUT?\n body: formData\n });\n case 6:\n response = _context7.sent;\n console.log(response.status);\n if (!(response.status != 201)) {\n _context7.next = 14;\n break;\n }\n _context7.next = 11;\n return response.json();\n case 11:\n error = _context7.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context7.abrupt(\"return\", false);\n case 14:\n return _context7.abrupt(\"return\", true);\n case 15:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7);\n }));\n function UploadFile(_x9, _x10) {\n return _UploadFile.apply(this, arguments);\n }\n return UploadFile;\n }()\n }]);\n return WebFS;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/web-fs/web-fs.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebFS)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nvar WebFS = /*#__PURE__*/function () {\n function WebFS() {\n _classCallCheck(this, WebFS);\n }\n _createClass(WebFS, null, [{\n key: \"CreateDirectory\",\n value:\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n function () {\n var _CreateDirectory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(path == undefined)) {\n _context.next = 3;\n break;\n }\n WebDesktopEnvironment.Alert(\"Path is undefined\");\n return _context.abrupt(\"return\", false);\n case 3:\n params = new URLSearchParams({\n path: \"\".concat(path, \"/New Directory\")\n });\n _context.next = 6;\n return fetch(\"/system/fs/createDir?\" + params);\n case 6:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 10;\n break;\n }\n WebDesktopEnvironment.Alert(\"DIRCTORY CREATION ERROR\"); //TODO\n return _context.abrupt(\"return\", false);\n case 10:\n return _context.abrupt(\"return\", true);\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n function CreateDirectory(_x) {\n return _CreateDirectory.apply(this, arguments);\n }\n return CreateDirectory;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"DeleteFile\",\n value: function () {\n var _DeleteFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n params = new URLSearchParams({\n path: path\n });\n _context2.next = 3;\n return fetch(\"/system/fs/delete?\" + params);\n case 3:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"DELETE ERROR\"); //TODO\n return _context2.abrupt(\"return\", false);\n case 7:\n return _context2.abrupt(\"return\", true);\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n function DeleteFile(_x2) {\n return _DeleteFile.apply(this, arguments);\n }\n return DeleteFile;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"MoveFile\",\n value: function () {\n var _MoveFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sourcePath, targetPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n targetPath: targetPath\n });\n _context3.next = 3;\n return fetch(\"/system/fs/move?\" + params);\n case 3:\n response = _context3.sent;\n if (!(response.status != 200)) {\n _context3.next = 6;\n break;\n }\n return _context3.abrupt(\"return\", false);\n case 6:\n return _context3.abrupt(\"return\", true);\n case 7:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function MoveFile(_x3, _x4) {\n return _MoveFile.apply(this, arguments);\n }\n return MoveFile;\n }()\n /**\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"ReadObjectLink\",\n value: function () {\n var _ReadObjectLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(linkPath) {\n var params, response, path;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context4.next = 3;\n return fetch(\"/system/fs/readObjectLink?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context4.abrupt(\"return\", \"\");\n case 7:\n _context4.next = 9;\n return response.text();\n case 9:\n path = _context4.sent;\n return _context4.abrupt(\"return\", path);\n case 11:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function ReadObjectLink(_x5) {\n return _ReadObjectLink.apply(this, arguments);\n }\n return ReadObjectLink;\n }()\n /**\r\n * @param {string} sourcePath\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"CreatePathLink\",\n value: function () {\n var _CreatePathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sourcePath, linkPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n linkPath: linkPath\n });\n _context5.next = 3;\n return fetch(\"/system/fs/createPathLink?\" + params);\n case 3:\n response = _context5.sent;\n return _context5.abrupt(\"return\", response.status == 200);\n case 5:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5);\n }));\n function CreatePathLink(_x6, _x7) {\n return _CreatePathLink.apply(this, arguments);\n }\n return CreatePathLink;\n }()\n /**\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"ReadPathLink\",\n value: function () {\n var _ReadPathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(linkPath) {\n var params, response, file;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context6.next = 3;\n return fetch(\"/system/fs/readPathLink?\" + params);\n case 3:\n response = _context6.sent;\n if (!(response.status != 200)) {\n _context6.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context6.abrupt(\"return\", \"\");\n case 7:\n _context6.next = 9;\n return response.json();\n case 9:\n file = _context6.sent;\n return _context6.abrupt(\"return\", file);\n case 11:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6);\n }));\n function ReadPathLink(_x8) {\n return _ReadPathLink.apply(this, arguments);\n }\n return ReadPathLink;\n }()\n /**\r\n * @param {File} file\r\n * @param {string} parentPath\r\n * @returns {boolean}\r\n */\n }, {\n key: \"UploadFile\",\n value: function () {\n var _UploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(file, parentPath) {\n var formData, params, response, error;\n return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n console.log('here');\n formData = new FormData();\n formData.append(\"file\", file); //FIXME Conn reset\n params = new URLSearchParams({\n parentPath: parentPath\n });\n _context7.next = 6;\n return fetch(\"/system/fs/upload?\" + params, {\n method: \"POST\",\n //TODO Change to PUT?\n body: formData\n });\n case 6:\n response = _context7.sent;\n console.log(response.status);\n if (!(response.status != 201)) {\n _context7.next = 14;\n break;\n }\n _context7.next = 11;\n return response.json();\n case 11:\n error = _context7.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context7.abrupt(\"return\", false);\n case 14:\n return _context7.abrupt(\"return\", true);\n case 15:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7);\n }));\n function UploadFile(_x9, _x10) {\n return _UploadFile.apply(this, arguments);\n }\n return UploadFile;\n }()\n }]);\n return WebFS;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/web-fs/web-fs.js?"); /***/ }) diff --git a/res/dev-fs/dist/mobile.js b/res/dev-fs/dist/mobile.js index 9a913ab..d7afdea 100644 --- a/res/dev-fs/dist/mobile.js +++ b/res/dev-fs/dist/mobile.js @@ -6,15 +6,58 @@ * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ +import * as __WEBPACK_EXTERNAL_MODULE_http_localhost_8080_res_dev_fs_dist_finder_js_acc14960__ from "http://localhost:8080/res/dev-fs/dist/finder.js"; /******/ var __webpack_modules__ = ({ +/***/ "http://localhost:8080/res/dev-fs/dist/finder.js": +/*!******************************************************************!*\ + !*** external "http://localhost:8080/res/dev-fs/dist/finder.js" ***! + \******************************************************************/ +/***/ ((module) => { + +var x = y => { var x = {}; __webpack_require__.d(x, y); return x; } +var y = x => () => x +module.exports = __WEBPACK_EXTERNAL_MODULE_http_localhost_8080_res_dev_fs_dist_finder_js_acc14960__; + +/***/ }), + +/***/ "./src/wde/application.js": +/*!********************************!*\ + !*** ./src/wde/application.js ***! + \********************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEApplication)\n/* harmony export */ });\n/* harmony import */ var _wde_desktop_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wde-desktop.js */ \"./src/wde/wde-desktop.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\nvar _wde = /*#__PURE__*/new WeakMap();\nvar WDEApplication = /*#__PURE__*/function () {\n /** @type {WebDesktopEnvironment} */\n\n /**\r\n * @constructor\r\n * @param {WebDesktopEnvironment} wde \r\n */\n function WDEApplication(wde) {\n _classCallCheck(this, WDEApplication);\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _wde, wde);\n }\n _createClass(WDEApplication, [{\n key: \"getWde\",\n value: function getWde() {\n return _classPrivateFieldGet(this, _wde);\n }\n }]);\n return WDEApplication;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/application.js?"); + +/***/ }), + +/***/ "./src/wde/decorat/desktop-decorat.js": +/*!********************************************!*\ + !*** ./src/wde/decorat/desktop-decorat.js ***! + \********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ DesktopDecorat)\n/* harmony export */ });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _windowsLayer = /*#__PURE__*/new WeakMap();\nvar _makeid = /*#__PURE__*/new WeakSet();\nvar DesktopDecorat = /*#__PURE__*/function () {\n /** @type {Element} */\n\n function DesktopDecorat() {\n var _this = this;\n _classCallCheck(this, DesktopDecorat);\n _classPrivateMethodInitSpec(this, _makeid);\n _classPrivateFieldInitSpec(this, _windowsLayer, {\n writable: true,\n value: void 0\n });\n this.windowLayer = document.body.querySelector('#windows-layer');\n // this.#windowsLayer = document.body.querySelector('#windows-layer')\n _classPrivateFieldSet(this, _windowsLayer, document.body.querySelector('#windows-layer'));\n var startDrag = function startDrag(event) {\n var window = event.target.closest('.WindowFrame');\n _this.bringWindowToFront(window);\n if (event.target.classList.contains(\"DragArea\")) {\n var xPosInit = event.offsetX;\n var yPosInit = event.offsetY;\n var dragWindow = function dragWindow(event) {\n window.style.left = \"\".concat(event.clientX - xPosInit, \"px\");\n window.style.top = \"\".concat(event.clientY - yPosInit, \"px\");\n };\n var stopDrag = function stopDrag() {\n removeEventListener('mousemove', dragWindow);\n removeEventListener('mouseup', stopDrag);\n };\n addEventListener('mousemove', dragWindow);\n addEventListener('mouseup', stopDrag);\n }\n };\n _classPrivateFieldGet(this, _windowsLayer).addEventListener('mousedown', startDrag);\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n _createClass(DesktopDecorat, [{\n key: \"bringWindowToFront\",\n value: function bringWindowToFront(window) {\n //FIXME\n var previousWindow = _classPrivateFieldGet(this, _windowsLayer).lastChild;\n if (window == null || window == undefined) {\n return;\n }\n if (window != previousWindow) {\n _classPrivateFieldGet(this, _windowsLayer).insertBefore(window, previousWindow.nextSibling);\n previousWindow.classList.remove(\"Focused\");\n window.classList.add(\"Focused\");\n } else {\n window.classList.add(\"Focused\");\n }\n return;\n }\n\n /**\r\n * @param {string} appId\r\n * @param {number} width\r\n * @param {number} height\r\n * @returns {HTMLElement}\r\n */\n }, {\n key: \"CreateNewWindow\",\n value: function CreateNewWindow(appId, width, height) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute('appid', appId);\n newWindow.setAttribute(\"class\", \"WindowFrame ConvexElement\");\n newWindow.setAttribute(\"windowId\", _classPrivateMethodGet(this, _makeid, _makeid2).call(this, 4)); //TODO:\n\n newWindow.style.width = width.toString() + \"px\";\n newWindow.style.height = height.toString() + \"px\";\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n return newWindow;\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n }, {\n key: \"CloseWindow\",\n value: function CloseWindow(window) {\n window.remove();\n }\n }, {\n key: \"CloseFocusedWindow\",\n value: function CloseFocusedWindow() {\n if (document.body.querySelector('#windows-layer').childElementCount > 1) {\n document.body.querySelector('#windows-layer').lastElementChild.remove();\n }\n }\n }], [{\n key: \"ChangeURL\",\n value: function ChangeURL(appWindow) {\n var appId = appWindow.getAttribute('appid');\n window.history.replaceState(null, \"\", \"/\".concat(appId, \"/\"));\n }\n\n /**\r\n * @param {num} length\r\n */\n }]);\n return DesktopDecorat;\n}();\nfunction _makeid2(length) {\n var result = '';\n var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var charactersLength = characters.length;\n var counter = 0;\n while (counter < length) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n counter += 1;\n }\n return result;\n}\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/decorat/desktop-decorat.js?"); + +/***/ }), + /***/ "./src/wde/decorat/mobile-decorat.js": /*!*******************************************!*\ !*** ./src/wde/decorat/mobile-decorat.js ***! \*******************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ MobileDecorat)\n/* harmony export */ });\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nvar MobileDecorat = /*#__PURE__*/_createClass(function MobileDecorat() {\n _classCallCheck(this, MobileDecorat);\n});\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/decorat/mobile-decorat.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ MobileDecorat)\n/* harmony export */ });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _applicationsNode = /*#__PURE__*/new WeakMap();\nvar MobileDecorat = /*#__PURE__*/function () {\n /** @type {Element} */\n\n function MobileDecorat() {\n _classCallCheck(this, MobileDecorat);\n _classPrivateFieldInitSpec(this, _applicationsNode, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _applicationsNode, document.body.querySelector(\"#mobile-app-views\")); //TODO validate\n }\n\n /**\r\n * @param {string} appId\r\n * @returns {Element}\r\n */\n _createClass(MobileDecorat, [{\n key: \"CreateNewView\",\n value: function CreateNewView(appId) {\n var newView = document.createElement(\"div\");\n newView.setAttribute(\"class\", \"mobile-app-view\");\n newView.setAttribute(\"appId\", appId);\n _classPrivateFieldGet(this, _applicationsNode).appendChild(newView);\n return newView;\n }\n }, {\n key: \"Open\",\n value: function Open() {}\n }, {\n key: \"BackAction\",\n value: function BackAction() {\n // console.log(this.#applicationsNode.childNodes.length)\n if (_classPrivateFieldGet(this, _applicationsNode).childNodes.length <= 1) return;\n _classPrivateFieldGet(this, _applicationsNode).lastChild.remove();\n }\n }]);\n return MobileDecorat;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/decorat/mobile-decorat.js?"); + +/***/ }), + +/***/ "./src/wde/scrollbar/scrollbar.js": +/*!****************************************!*\ + !*** ./src/wde/scrollbar/scrollbar.js ***! + \****************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WdeScrollBar)\n/* harmony export */ });\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nvar WdeScrollBar = /*#__PURE__*/_createClass(\n/**\r\n* @param {HTMLElement} scrollBarContainer\r\n* @param {HTMLElement} content\r\n*/\nfunction WdeScrollBar(scrollBarContainer, content) {\n var _this = this;\n _classCallCheck(this, WdeScrollBar);\n var nonNativeScroll = false;\n // console.log(scrollBarContainer, content)\n // let handler = scrollBarContainer.children[0]\n //TODO On scroll move focus on window?\n var handler = scrollBarContainer.querySelector(\".ScrollBarScrollElement\"); //TODO Refactor classes\n // console.log(handler)\n\n handler.style.height = content.clientHeight / content.scrollHeight * handler.parentElement.clientHeight + 'px';\n var max = handler.parentElement.clientHeight - handler.clientHeight;\n var yPosInit = 0;\n handler.addEventListener('mousedown', function (event) {\n nonNativeScroll = true;\n yPosInit = event.clientY - Number(handler.style.top.replace('px', ''));\n document.addEventListener('mousemove', drag);\n document.addEventListener('mouseup', stop);\n });\n content.addEventListener('scroll', function (event) {\n if (!_this.nonNativeScroll) {\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n handler.style.top = content.scrollTop / coefficient + 'px';\n }\n });\n function drag() {\n // console.log(event.clientY - yPosInit, Number(handler.style.top.replace('px','' )))\n var pos = event.clientY - yPosInit;\n var clampPos = Math.min(Math.max(pos, 0), max);\n handler.style.top = clampPos + \"px\";\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n // console.log(clampPos, coefficient, content.clientHeight, clampPos* coefficient)\n\n content.scrollTop = clampPos * coefficient;\n }\n function stop() {\n // console.log(\"stop\")\n document.removeEventListener('mousemove', drag);\n document.removeEventListener('mouseup', stop);\n nonNativeScroll = false;\n }\n});\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/scrollbar/scrollbar.js?"); /***/ }), @@ -24,7 +67,17 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \*********************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ MobileDesktop)\n/* harmony export */ });\n/* harmony import */ var _wde_mobile_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wde-mobile.js */ \"./src/wde/wde-mobile.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\nvar _icons = /*#__PURE__*/new WeakMap();\nvar _wde = /*#__PURE__*/new WeakMap();\nvar MobileDesktop = /*#__PURE__*/function () {\n /**@type {Element} */\n\n /** @type {MobileWebDesktopEnvironment} */\n\n function MobileDesktop(wde) {\n _classCallCheck(this, MobileDesktop);\n _classPrivateFieldInitSpec(this, _icons, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _wde, wde);\n this.load();\n }\n _createClass(MobileDesktop, [{\n key: \"load\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.createMainDivs();\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function load() {\n return _load.apply(this, arguments);\n }\n return load;\n }()\n }, {\n key: \"createMainDivs\",\n value: function () {\n var _createMainDivs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n var sunboardNode, params, response, html, iconsNode;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n sunboardNode = document.body.querySelector(\"#mobile-sunboard\");\n if (!(sunboardNode == null)) {\n _context2.next = 3;\n break;\n }\n return _context2.abrupt(\"return\");\n case 3:\n params = new URLSearchParams({\n // path: args[0] //FIXME\n path: \"/\"\n });\n _context2.next = 6;\n return fetch(\"/app/Sunboard/render?\" + params, {\n method: \"POST\"\n // body: JSON.stringify(runContext)\n });\n case 6:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 10;\n break;\n }\n console.log(response.status);\n // this.#wde.Alert(\"Error in render desktop\") //TODO\n return _context2.abrupt(\"return\");\n case 10:\n _context2.next = 12;\n return response.text();\n case 12:\n html = _context2.sent;\n sunboardNode.innerHTML = html;\n console.log(_classPrivateFieldGet(this, _wde).FileView);\n iconsNode = document.body.querySelector(\"#icons\");\n this.fileView = new (_classPrivateFieldGet(this, _wde).FileView)(iconsNode, function (event) {}, function (event) {}, function (event, draggedElem) {}, function () {});\n // this.RenderDir(args[0])\n return _context2.abrupt(\"return\");\n case 18:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function createMainDivs() {\n return _createMainDivs.apply(this, arguments);\n }\n return createMainDivs;\n }()\n }, {\n key: \"createFileView\",\n value: function () {\n var _createFileView = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function createFileView() {\n return _createFileView.apply(this, arguments);\n }\n return createFileView;\n }()\n }]);\n return MobileDesktop;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/sunboard/sunboard-mobile.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ MobileDesktop)\n/* harmony export */ });\n/* harmony import */ var _wde_mobile_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wde-mobile.js */ \"./src/wde/wde-mobile.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\nvar _icons = /*#__PURE__*/new WeakMap();\nvar _wde = /*#__PURE__*/new WeakMap();\nvar _createDesktopView = /*#__PURE__*/new WeakSet();\nvar MobileDesktop = /*#__PURE__*/function () {\n /**@type {Element} */\n\n /** @type {MobileWebDesktopEnvironment} */\n\n function MobileDesktop(wde) {\n _classCallCheck(this, MobileDesktop);\n _classPrivateMethodInitSpec(this, _createDesktopView);\n _classPrivateFieldInitSpec(this, _icons, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _wde, wde);\n this.load();\n }\n _createClass(MobileDesktop, [{\n key: \"load\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var view;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n view = _classPrivateMethodGet(this, _createDesktopView, _createDesktopView2).call(this);\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function load() {\n return _load.apply(this, arguments);\n }\n return load;\n }()\n }, {\n key: \"createFileView\",\n value: function () {\n var _createFileView = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n function createFileView() {\n return _createFileView.apply(this, arguments);\n }\n return createFileView;\n }()\n }]);\n return MobileDesktop;\n}();\nfunction _createDesktopView2() {\n return _createDesktopView3.apply(this, arguments);\n}\nfunction _createDesktopView3() {\n _createDesktopView3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n var _this = this;\n var view, params, response, html, iconsList;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n _context3.next = 2;\n return _classPrivateFieldGet(this, _wde).Decorat.CreateNewView(\"Sunboard\");\n case 2:\n view = _context3.sent;\n //FIXME\n params = new URLSearchParams({\n // path: args[0] //FIXME\n path: \"/\" //FIXME\n });\n _context3.next = 6;\n return fetch(\"/app/Sunboard/render?\" + params, {\n method: \"POST\"\n // body: JSON.stringify(runContext)\n });\n case 6:\n response = _context3.sent;\n if (!(response.status != 200)) {\n _context3.next = 10;\n break;\n }\n console.log(response.status);\n // this.#wde.Alert(\"Error in render desktop\") //TODO\n return _context3.abrupt(\"return\");\n case 10:\n _context3.next = 12;\n return response.text();\n case 12:\n html = _context3.sent;\n view.innerHTML = html;\n iconsList = view.querySelectorAll(\".app-icon\");\n iconsList.forEach(function (element) {\n var appId = element.getAttribute('appId');\n element.addEventListener('click', function () {\n // console.log(appId)\n // this.#wde.Decorat.CreateNewView(appId)\n _classPrivateFieldGet(_this, _wde).Open(\"/Applications/Finder.app\", [\"\"], \"\");\n });\n });\n case 16:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n return _createDesktopView3.apply(this, arguments);\n}\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/sunboard/sunboard-mobile.js?"); + +/***/ }), + +/***/ "./src/wde/wde-desktop.js": +/*!********************************!*\ + !*** ./src/wde/wde-desktop.js ***! + \********************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decorat/desktop-decorat.js */ \"./src/wde/decorat/desktop-decorat.js\");\n/* harmony import */ var _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scrollbar/scrollbar.js */ \"./src/wde/scrollbar/scrollbar.js\");\n/* harmony import */ var _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../web-fs/web-fs.js */ \"./src/web-fs/web-fs.js\");\n/* harmony import */ var _application_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./application.js */ \"./src/wde/application.js\");\n/* harmony import */ var _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./widgets/file-view/file-view.js */ \"./src/wde/widgets/file-view/file-view.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\n// import DesktopSunBoard from \"./sunboard/sunboard-desktop.js\";\nvar WebDesktopEnvironment = /*#__PURE__*/function () {\n /** @type {string} */\n\n /** @type {WDEFileView} */\n\n /** @type {WDEScrollBar} */\n\n /**@type {DesktopDecorat} */\n\n /** @type {Object} */\n\n /** Deprecated */\n\n // static decorat\n\n function WebDesktopEnvironment() {\n _classCallCheck(this, WebDesktopEnvironment);\n _defineProperty(this, \"test\", \"\");\n _defineProperty(this, \"FileView\", _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]);\n _defineProperty(this, \"ScrollBar\", _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n _defineProperty(this, \"Decorat\", void 0);\n document.body.style.setProperty('--zoom', 1);\n this.Decorat = new _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n WebDesktopEnvironment.webFs = new _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this.FileView = _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"];\n this.loadWDE();\n // this.#devLoadSunboard()\n }\n _createClass(WebDesktopEnvironment, [{\n key: \"loadWDE\",\n value: function () {\n var _loadWDE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var autoStart, _iterator, _step, child, appPath, args, argsRaw, _iterator2, _step2, argRaw, arg;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n autoStart = document.body.querySelector(\"wde-autostart\");\n if (!(autoStart == null)) {\n _context.next = 4;\n break;\n }\n WebDesktopEnvironment.Alert(\"Error in loading DE\");\n return _context.abrupt(\"return\");\n case 4:\n _iterator = _createForOfIteratorHelper(autoStart.children);\n _context.prev = 5;\n _iterator.s();\n case 7:\n if ((_step = _iterator.n()).done) {\n _context.next = 41;\n break;\n }\n child = _step.value;\n if (!(child.nodeName != \"APP\")) {\n _context.next = 11;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 11:\n appPath = child.getAttribute(\"app-path\");\n if (!(appPath == null)) {\n _context.next = 14;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 14:\n args = [];\n argsRaw = child.querySelector(\"args\");\n if (!(argsRaw == null)) {\n _context.next = 18;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 18:\n _iterator2 = _createForOfIteratorHelper(argsRaw.children);\n _context.prev = 19;\n _iterator2.s();\n case 21:\n if ((_step2 = _iterator2.n()).done) {\n _context.next = 29;\n break;\n }\n argRaw = _step2.value;\n arg = argRaw.getAttribute(\"string\");\n if (!(arg == null)) {\n _context.next = 26;\n break;\n }\n return _context.abrupt(\"continue\", 27);\n case 26:\n args.push(arg);\n case 27:\n _context.next = 21;\n break;\n case 29:\n _context.next = 34;\n break;\n case 31:\n _context.prev = 31;\n _context.t0 = _context[\"catch\"](19);\n _iterator2.e(_context.t0);\n case 34:\n _context.prev = 34;\n _iterator2.f();\n return _context.finish(34);\n case 37:\n _context.next = 39;\n return this.Open(appPath, args);\n case 39:\n _context.next = 7;\n break;\n case 41:\n _context.next = 46;\n break;\n case 43:\n _context.prev = 43;\n _context.t1 = _context[\"catch\"](5);\n _iterator.e(_context.t1);\n case 46:\n _context.prev = 46;\n _iterator.f();\n return _context.finish(46);\n case 49:\n autoStart.remove();\n case 50:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this, [[5, 43, 46, 49], [19, 31, 34, 37]]);\n }));\n function loadWDE() {\n return _loadWDE.apply(this, arguments);\n }\n return loadWDE;\n }()\n /**\r\n * @param {string} appPath\r\n * @param {string[]} args\r\n * @param {string} runPath\r\n */\n }, {\n key: \"Open\",\n value: function () {\n var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appPath, args, runPath) {\n var appManifest, runContext;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return WebDesktopEnvironment.fetchApp(appPath);\n case 2:\n appManifest = _context2.sent;\n if (!(appManifest === undefined)) {\n _context2.next = 5;\n break;\n }\n return _context2.abrupt(\"return\");\n case 5:\n //TODO return err\n /**@type {runContext} */\n runContext = {\n WDE: this,\n isMobile: false,\n bundlePath: appPath,\n runPath: runPath\n };\n if (WebDesktopEnvironment.Applications[appManifest.appId] === undefined) {\n WebDesktopEnvironment.load2(appManifest, function () {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n });\n } else {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n }\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function Open(_x, _x2, _x3) {\n return _Open.apply(this, arguments);\n }\n return Open;\n }()\n /**\r\n * @param {string} appManifest\r\n * @param {function} onload callback after script loading\r\n */\n }], [{\n key: \"load2\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(appManifest, onload) {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n // import(window.location.origin + appManifest.js[0]).then((app) => {\n // console.log(window.location.origin + appManifest.js[0] == 'http://localhost:8080/res/dev-fs/wde/dist/finder.js')\n // let kek = 'http://localhost:8080/res/dev-fs/wde/dist/finder.js'\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! http://localhost:8080/res/dev-fs/dist/finder.js */ \"http://localhost:8080/res/dev-fs/dist/finder.js\")).then(function (app) {\n var newApp = new app[\"default\"]();\n // if newApp //TODO Validate\n WebDesktopEnvironment.Applications[appManifest.appId] = newApp;\n onload();\n });\n return _context3.abrupt(\"return\");\n case 2:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function load2(_x4, _x5) {\n return _load.apply(this, arguments);\n }\n return load2;\n }()\n /**\r\n * @param {string} path\r\n * @returns {Object | undefined} //FIXME\r\n */\n }, {\n key: \"fetchApp\",\n value: function () {\n var _fetchApp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(path) {\n var params, response, error, appManifest;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n // console.log(\"path: \" + path )\n params = new URLSearchParams({\n path: path,\n mode: \"json\"\n });\n _context4.next = 3;\n return fetch(\"/system/loadApp?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 10;\n break;\n }\n _context4.next = 7;\n return response.json();\n case 7:\n error = _context4.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context4.abrupt(\"return\", undefined);\n case 10:\n //TODO Validate manifest\n appManifest = response.json();\n return _context4.abrupt(\"return\", appManifest);\n case 12:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function fetchApp(_x6) {\n return _fetchApp.apply(this, arguments);\n }\n return fetchApp;\n }()\n /**\r\n * @param {string} html\r\n */\n }, {\n key: \"SetBasicWindow\",\n value: function SetBasicWindow(html) {\n this.basicWindow = html;\n }\n\n /**\r\n * @returns {string}\r\n */\n }, {\n key: \"GetBasicWindow\",\n value: function GetBasicWindow() {\n return this.basicWindow;\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"Alert\",\n value: function Alert(alertText) {\n WebDesktopEnvironment.CreateAlertWindow(alertText);\n console.log(alertText);\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"CreateAlertWindow\",\n value: function CreateAlertWindow(alertText) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute(\"class\", \"WindowFrameless\");\n newWindow.setAttribute(\"windowId\", \"SuperUniqUUID\"); //TODO:\n newWindow.style.cssText = \"position:absolute;width:450px;height:116px; margin-left: -225px; margin-top:-58px;left: 50%;top: 50%;background-color:#FFFFFF;border: 1px solid #000000;box-shadow: 2px 2px 0px #000000;\";\n var alertImage = document.createElement(\"img\");\n alertImage.setAttribute(\"src\", \"/res/sys/wde/icons/ohno.png\");\n alertImage.style.cssText = \"position:absolute; width:64px;height:64px;top:15px;left:25px\";\n newWindow.appendChild(alertImage);\n var errorText = document.createElement(\"div\");\n errorText.style.cssText = \"position:absolute; width: 300px; left:128px; top:30px;font-family: 'Virtue';\";\n errorText.innerHTML = alertText;\n newWindow.appendChild(errorText);\n var closeButton = document.createElement(\"button\");\n closeButton.style.cssText = \"position:absolute; left: 382px; bottom: 10px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;\";\n closeButton.innerHTML = \"Close\";\n closeButton.addEventListener('click', function () {\n newWindow.remove();\n });\n newWindow.appendChild(closeButton);\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n }\n }]);\n return WebDesktopEnvironment;\n}();\n/**\r\n * @typedef {Object} runContext\r\n * @property {WebDesktopEnvironment} WDE \r\n * @property {boolean} isMobile\r\n * @property {string} appPath \r\n * @property {string} runPath //TODO\r\n*/\n_defineProperty(WebDesktopEnvironment, \"Applications\", {});\n_defineProperty(WebDesktopEnvironment, \"isMobile\", false);\n_defineProperty(WebDesktopEnvironment, \"webFs\", void 0);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde-desktop.js?"); /***/ }), @@ -34,7 +87,17 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \*******************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ MobileWebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _decorat_mobile_decorat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decorat/mobile-decorat.js */ \"./src/wde/decorat/mobile-decorat.js\");\n/* harmony import */ var _sunboard_sunboard_mobile_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sunboard/sunboard-mobile.js */ \"./src/wde/sunboard/sunboard-mobile.js\");\n/* harmony import */ var _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./widgets/file-view/file-view.js */ \"./src/wde/widgets/file-view/file-view.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\n\n\nvar _sunBoard = /*#__PURE__*/new WeakMap();\nvar MobileWebDesktopEnvironment = /*#__PURE__*/function () {\n /** @type {MobileDecorat} */\n\n /** @type {WDEFileView} */\n\n /** @type {MobileSunboard} */\n\n function MobileWebDesktopEnvironment() {\n _classCallCheck(this, MobileWebDesktopEnvironment);\n _defineProperty(this, \"Decorat\", void 0);\n _defineProperty(this, \"FileView\", void 0);\n _classPrivateFieldInitSpec(this, _sunBoard, {\n writable: true,\n value: void 0\n });\n document.body.style.setProperty('--zoom', 3);\n this.Decorat = new _decorat_mobile_decorat_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n this.FileView = _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"];\n _classPrivateFieldSet(this, _sunBoard, new _sunboard_sunboard_mobile_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](this));\n _classPrivateFieldGet(this, _sunBoard);\n }\n _createClass(MobileWebDesktopEnvironment, [{\n key: \"loadWDE\",\n value: function loadWDE() {}\n }]);\n return MobileWebDesktopEnvironment;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde-mobile.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ MobileWebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _decorat_mobile_decorat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decorat/mobile-decorat.js */ \"./src/wde/decorat/mobile-decorat.js\");\n/* harmony import */ var _sunboard_sunboard_mobile_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sunboard/sunboard-mobile.js */ \"./src/wde/sunboard/sunboard-mobile.js\");\n/* harmony import */ var _wde_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./wde.js */ \"./src/wde/wde.js\");\n/* harmony import */ var _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./widgets/file-view/file-view.js */ \"./src/wde/widgets/file-view/file-view.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\n\n\n\nvar _sunBoard = /*#__PURE__*/new WeakMap();\nvar _initControlsBar = /*#__PURE__*/new WeakSet();\nvar MobileWebDesktopEnvironment = /*#__PURE__*/function (_AbstractWebDesktopEn) {\n _inherits(MobileWebDesktopEnvironment, _AbstractWebDesktopEn);\n var _super = _createSuper(MobileWebDesktopEnvironment);\n /** @type {MobileDecorat} */\n\n /** @type {WDEFileView} */\n\n /** @type {MobileSunboard} */\n\n function MobileWebDesktopEnvironment() {\n var _this;\n _classCallCheck(this, MobileWebDesktopEnvironment);\n _this = _super.call(this);\n _classPrivateMethodInitSpec(_assertThisInitialized(_this), _initControlsBar);\n _defineProperty(_assertThisInitialized(_this), \"Decorat\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"FileView\", void 0);\n _classPrivateFieldInitSpec(_assertThisInitialized(_this), _sunBoard, {\n writable: true,\n value: void 0\n });\n document.body.style.setProperty('--zoom', 3);\n _this.Decorat = new _decorat_mobile_decorat_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n _this.FileView = _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"];\n _classPrivateFieldSet(_assertThisInitialized(_this), _sunBoard, new _sunboard_sunboard_mobile_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](_assertThisInitialized(_this)));\n _this.loadWDE();\n return _this;\n }\n _createClass(MobileWebDesktopEnvironment, [{\n key: \"loadWDE\",\n value: function loadWDE() {\n _classPrivateMethodGet(this, _initControlsBar, _initControlsBar2).call(this);\n }\n\n /**\r\n * @param {string} appPath\r\n * @param {string[]} args\r\n * @param {string} runPath\r\n */\n }, {\n key: \"Open\",\n value: function () {\n var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appPath, args, runPath) {\n var _this2 = this;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _get(_getPrototypeOf(MobileWebDesktopEnvironment.prototype), \"_Open\", this).call(this, appPath, args, runPath, /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(appManifest, runContext) {\n var contentView, view;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n console.log(_get(_getPrototypeOf(MobileWebDesktopEnvironment.prototype), \"_GetApp\", _this2).call(_this2, appManifest.appId));\n // console.log(super())\n _context.next = 3;\n return _get(_getPrototypeOf(MobileWebDesktopEnvironment.prototype), \"_GetApp\", _this2).call(_this2, appManifest.appId).NewWindow(args, runContext);\n case 3:\n contentView = _context.sent;\n view = _this2.Decorat.CreateNewView();\n console.log(view);\n view.appendChild(contentView);\n // super._GetApp\n case 7:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return function (_x4, _x5) {\n return _ref.apply(this, arguments);\n };\n }());\n case 1:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function Open(_x, _x2, _x3) {\n return _Open.apply(this, arguments);\n }\n return Open;\n }()\n }]);\n return MobileWebDesktopEnvironment;\n}(_wde_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\nfunction _initControlsBar2() {\n var _this3 = this;\n var barNode = document.body.querySelector(\"#controls-bar\"); //TODO Validate\n\n barNode.querySelector(\"#back\").addEventListener('click', function () {\n _this3.Decorat.BackAction();\n });\n}\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde-mobile.js?"); + +/***/ }), + +/***/ "./src/wde/wde.js": +/*!************************!*\ + !*** ./src/wde/wde.js ***! + \************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ AbstractWebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _application_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./application.js */ \"./src/wde/application.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\n\nvar _loadApp = /*#__PURE__*/new WeakSet();\nvar AbstractWebDesktopEnvironment = /*#__PURE__*/function () {\n /** @type {Object} */\n\n function AbstractWebDesktopEnvironment() {\n _classCallCheck(this, AbstractWebDesktopEnvironment);\n _classPrivateMethodInitSpec(this, _loadApp);\n _defineProperty(this, \"_applications\", {});\n }\n\n /**\r\n * @param {string} path\r\n * @returns {Object | undefined} //FIXME\r\n */\n _createClass(AbstractWebDesktopEnvironment, [{\n key: \"_FetchAppManifest\",\n value: function () {\n var _FetchAppManifest2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response, error, appManifest;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n console.log(\"path: \" + path);\n params = new URLSearchParams({\n path: path,\n mode: \"json\"\n });\n _context.next = 4;\n return fetch(\"/system/loadApp?\" + params);\n case 4:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 10;\n break;\n }\n _context.next = 8;\n return response.json();\n case 8:\n error = _context.sent;\n return _context.abrupt(\"return\", undefined);\n case 10:\n //TODO Validate manifest\n appManifest = response.json();\n return _context.abrupt(\"return\", appManifest);\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n function _FetchAppManifest(_x) {\n return _FetchAppManifest2.apply(this, arguments);\n }\n return _FetchAppManifest;\n }()\n /**\r\n * @param {string} appPath\r\n * @param {string[]} args\r\n * @param {string} runPath\r\n * @param {callback} function\r\n */\n }, {\n key: \"_Open\",\n value: function () {\n var _Open2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appPath, args, runPath, callback) {\n var appManifest, runContext;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return this._FetchAppManifest(appPath);\n case 2:\n appManifest = _context2.sent;\n if (!(appManifest === undefined)) {\n _context2.next = 5;\n break;\n }\n return _context2.abrupt(\"return\");\n case 5:\n //TODO return err\n /**@type {runContext} */\n runContext = {\n WDE: this,\n isMobile: true,\n bundlePath: appPath,\n runPath: runPath\n };\n if (this._applications[appManifest.appId] === undefined) {\n _classPrivateMethodGet(this, _loadApp, _loadApp2).call(this, appManifest, function () {\n callback(appManifest, runContext);\n });\n } else {\n callback(appManifest, runContext);\n }\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function _Open(_x2, _x3, _x4, _x5) {\n return _Open2.apply(this, arguments);\n }\n return _Open;\n }()\n /**\r\n * @param {*} appManifest\r\n * @param {function} onload callback after script loading\r\n */\n }, {\n key: \"_GetApp\",\n value: function _GetApp(appId) {\n console.log(appId);\n return this._applications[appId];\n }\n }]);\n return AbstractWebDesktopEnvironment;\n}();\nfunction _loadApp2(_x6, _x7) {\n return _loadApp3.apply(this, arguments);\n}\nfunction _loadApp3() {\n _loadApp3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(appManifest, onload) {\n var _this = this;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n // console.log(appManifest)\n // import(window.location.origin + appManifest.js[0]).then((app) => {\n // console.log(window.location.origin + appManifest.js[0] == 'http://localhost:8080/res/dev-fs/wde/dist/finder.js')\n // let kek = 'http://localhost:8080/res/dev-fs/wde/dist/finder.js'\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! http://localhost:8080/res/dev-fs/dist/finder.js */ \"http://localhost:8080/res/dev-fs/dist/finder.js\")).then(function (app) {\n var newApp = new app[\"default\"]();\n // if newApp //TODO Validate\n _this._applications[appManifest.appId] = newApp;\n onload();\n });\n return _context3.abrupt(\"return\");\n case 2:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n return _loadApp3.apply(this, arguments);\n}\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde.js?"); /***/ }), @@ -44,7 +107,17 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEFileView)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar WDEFileView = /*#__PURE__*/function () {\n /**\n * @param {HTMLElement} fileViewElem\n * @param {Function} doubleClickCallback\n * @param {Function} rightClickCallback\n * @param {Function} updateFileViewCallback\n */\n function WDEFileView(fileViewElem, doubleClickCallback, rightClickCallback, fileUploadCallback, updateFileViewCallback) {\n var _this = this;\n _classCallCheck(this, WDEFileView);\n _defineProperty(this, \"path\", \"\");\n _defineProperty(this, \"parentElem\", undefined);\n _defineProperty(this, \"selected\", []);\n //TODO check all params\n this.parentElem = fileViewElem;\n fileViewElem.addEventListener('click', function (event) {\n if (event.target.classList[0] == 'FileTileView') {\n _this.DeselectAll();\n return;\n }\n if (event.detail === 1) {\n _this.DeselectAll();\n _this.Select([event.target]);\n } else if (event.detail === 2) {\n doubleClickCallback(event);\n }\n });\n fileViewElem.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n if (event.target.classList.contains(\"Tile\")) {\n _this.DeselectAll();\n _this.Select([event.target]);\n }\n _this.Select([event.target]);\n rightClickCallback(event);\n });\n if (fileUploadCallback !== undefined) {\n var counter = 0;\n var draggedElem = undefined;\n fileViewElem.addEventListener('dragstart', function (event) {\n // console.log(event.target)\n // console.log(this.path)\n // draggedElem = event.target\n event.dataTransfer.setData(\"fileName\", event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"filePath\", _this.path + \"/\" + event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"dropType\", \"move\");\n // console.log(updateFileViewCallback)\n // event.dataTransfer.setData(\"updateCallback\", updateFileViewCallback)\n // event.dataTransfer.setData(\"fileName\", )\n // console.log(draggedElem)\n });\n\n fileViewElem.addEventListener('dragenter', function (event) {\n event.preventDefault();\n counter++;\n fileViewElem.classList.add(\"DragDropBorder\");\n });\n fileViewElem.addEventListener('dragend', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // updateFileViewCallback()\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragleave', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragover', function (event) {\n event.preventDefault();\n });\n fileViewElem.addEventListener(\"drop\", function (event) {\n event.preventDefault();\n fileUploadCallback(event);\n fileViewElem.classList.remove(\"DragDropBorder\");\n // updateFileViewCallback()\n // this.OpenFolder(this.path)\n // draggedElem = undefined\n });\n }\n }\n\n /** \n * @param {[]Element} elements\n */\n _createClass(WDEFileView, [{\n key: \"Select\",\n value: function Select(elements) {\n var _this2 = this;\n elements.forEach(function (element) {\n _this2.selected.push(element);\n element.classList.add(\"Selected\");\n });\n }\n }, {\n key: \"DeselectAll\",\n value: function DeselectAll() {\n this.selected.forEach(function (element) {\n element.classList.remove(\"Selected\");\n });\n this.selected = [];\n }\n\n /** Get html of folder by path\n * @param {string} path\n */\n }, {\n key: \"OpenFolder\",\n value: function () {\n var _OpenFolder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response, html;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.path = path;\n params = new URLSearchParams({\n path: path\n });\n _context.next = 4;\n return fetch(\"/system/wde/widgets/file-tile-view?\" + params);\n case 4:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 8;\n break;\n }\n //TODO Error text message\n WebDesktopEnvironment.Alert(\"TODO\");\n return _context.abrupt(\"return\");\n case 8:\n _context.next = 10;\n return response.text();\n case 10:\n html = _context.sent;\n this.parentElem.innerHTML = html;\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function OpenFolder(_x) {\n return _OpenFolder.apply(this, arguments);\n }\n return OpenFolder;\n }()\n }]);\n return WDEFileView;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/widgets/file-view/file-view.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEFileView)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar WDEFileView = /*#__PURE__*/function () {\n /**\r\n * @param {HTMLElement} fileViewElem\r\n * @param {Function} doubleClickCallback\r\n * @param {Function} rightClickCallback\r\n * @param {Function} updateFileViewCallback\r\n */\n function WDEFileView(fileViewElem, doubleClickCallback, rightClickCallback, fileUploadCallback, updateFileViewCallback) {\n var _this = this;\n _classCallCheck(this, WDEFileView);\n _defineProperty(this, \"path\", \"\");\n _defineProperty(this, \"parentElem\", undefined);\n _defineProperty(this, \"selected\", []);\n //TODO check all params\n this.parentElem = fileViewElem;\n fileViewElem.addEventListener('click', function (event) {\n if (event.target.classList[0] == 'FileTileView') {\n _this.DeselectAll();\n return;\n }\n if (event.detail === 1) {\n _this.DeselectAll();\n _this.Select([event.target]);\n } else if (event.detail === 2) {\n doubleClickCallback(event);\n }\n });\n fileViewElem.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n if (event.target.classList.contains(\"Tile\")) {\n _this.DeselectAll();\n _this.Select([event.target]);\n }\n _this.Select([event.target]);\n rightClickCallback(event);\n });\n if (fileUploadCallback !== undefined) {\n var counter = 0;\n var draggedElem = undefined;\n fileViewElem.addEventListener('dragstart', function (event) {\n // console.log(event.target)\n // console.log(this.path)\n // draggedElem = event.target\n event.dataTransfer.setData(\"fileName\", event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"filePath\", _this.path + \"/\" + event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"dropType\", \"move\");\n // console.log(updateFileViewCallback)\n // event.dataTransfer.setData(\"updateCallback\", updateFileViewCallback)\n // event.dataTransfer.setData(\"fileName\", )\n // console.log(draggedElem)\n });\n\n fileViewElem.addEventListener('dragenter', function (event) {\n event.preventDefault();\n counter++;\n fileViewElem.classList.add(\"DragDropBorder\");\n });\n fileViewElem.addEventListener('dragend', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // updateFileViewCallback()\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragleave', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragover', function (event) {\n event.preventDefault();\n });\n fileViewElem.addEventListener(\"drop\", function (event) {\n event.preventDefault();\n fileUploadCallback(event);\n fileViewElem.classList.remove(\"DragDropBorder\");\n // updateFileViewCallback()\n // this.OpenFolder(this.path)\n // draggedElem = undefined\n });\n }\n }\n\n /** \r\n * @param {[]Element} elements\r\n */\n _createClass(WDEFileView, [{\n key: \"Select\",\n value: function Select(elements) {\n var _this2 = this;\n elements.forEach(function (element) {\n _this2.selected.push(element);\n element.classList.add(\"Selected\");\n });\n }\n }, {\n key: \"DeselectAll\",\n value: function DeselectAll() {\n this.selected.forEach(function (element) {\n element.classList.remove(\"Selected\");\n });\n this.selected = [];\n }\n\n /** Get html of folder by path\r\n * @param {string} path\r\n */\n }, {\n key: \"OpenFolder\",\n value: function () {\n var _OpenFolder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response, html;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.path = path;\n params = new URLSearchParams({\n path: path\n });\n _context.next = 4;\n return fetch(\"/system/wde/widgets/file-tile-view?\" + params);\n case 4:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 8;\n break;\n }\n //TODO Error text message\n WebDesktopEnvironment.Alert(\"TODO\");\n return _context.abrupt(\"return\");\n case 8:\n _context.next = 10;\n return response.text();\n case 10:\n html = _context.sent;\n this.parentElem.innerHTML = html;\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function OpenFolder(_x) {\n return _OpenFolder.apply(this, arguments);\n }\n return OpenFolder;\n }()\n }]);\n return WDEFileView;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/widgets/file-view/file-view.js?"); + +/***/ }), + +/***/ "./src/web-fs/web-fs.js": +/*!******************************!*\ + !*** ./src/web-fs/web-fs.js ***! + \******************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebFS)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nvar WebFS = /*#__PURE__*/function () {\n function WebFS() {\n _classCallCheck(this, WebFS);\n }\n _createClass(WebFS, null, [{\n key: \"CreateDirectory\",\n value:\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n function () {\n var _CreateDirectory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(path == undefined)) {\n _context.next = 3;\n break;\n }\n WebDesktopEnvironment.Alert(\"Path is undefined\");\n return _context.abrupt(\"return\", false);\n case 3:\n params = new URLSearchParams({\n path: \"\".concat(path, \"/New Directory\")\n });\n _context.next = 6;\n return fetch(\"/system/fs/createDir?\" + params);\n case 6:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 10;\n break;\n }\n WebDesktopEnvironment.Alert(\"DIRCTORY CREATION ERROR\"); //TODO\n return _context.abrupt(\"return\", false);\n case 10:\n return _context.abrupt(\"return\", true);\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n function CreateDirectory(_x) {\n return _CreateDirectory.apply(this, arguments);\n }\n return CreateDirectory;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"DeleteFile\",\n value: function () {\n var _DeleteFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n params = new URLSearchParams({\n path: path\n });\n _context2.next = 3;\n return fetch(\"/system/fs/delete?\" + params);\n case 3:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"DELETE ERROR\"); //TODO\n return _context2.abrupt(\"return\", false);\n case 7:\n return _context2.abrupt(\"return\", true);\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n function DeleteFile(_x2) {\n return _DeleteFile.apply(this, arguments);\n }\n return DeleteFile;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"MoveFile\",\n value: function () {\n var _MoveFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sourcePath, targetPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n targetPath: targetPath\n });\n _context3.next = 3;\n return fetch(\"/system/fs/move?\" + params);\n case 3:\n response = _context3.sent;\n if (!(response.status != 200)) {\n _context3.next = 6;\n break;\n }\n return _context3.abrupt(\"return\", false);\n case 6:\n return _context3.abrupt(\"return\", true);\n case 7:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function MoveFile(_x3, _x4) {\n return _MoveFile.apply(this, arguments);\n }\n return MoveFile;\n }()\n /**\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"ReadObjectLink\",\n value: function () {\n var _ReadObjectLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(linkPath) {\n var params, response, path;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context4.next = 3;\n return fetch(\"/system/fs/readObjectLink?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context4.abrupt(\"return\", \"\");\n case 7:\n _context4.next = 9;\n return response.text();\n case 9:\n path = _context4.sent;\n return _context4.abrupt(\"return\", path);\n case 11:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function ReadObjectLink(_x5) {\n return _ReadObjectLink.apply(this, arguments);\n }\n return ReadObjectLink;\n }()\n /**\r\n * @param {string} sourcePath\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"CreatePathLink\",\n value: function () {\n var _CreatePathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sourcePath, linkPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n linkPath: linkPath\n });\n _context5.next = 3;\n return fetch(\"/system/fs/createPathLink?\" + params);\n case 3:\n response = _context5.sent;\n return _context5.abrupt(\"return\", response.status == 200);\n case 5:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5);\n }));\n function CreatePathLink(_x6, _x7) {\n return _CreatePathLink.apply(this, arguments);\n }\n return CreatePathLink;\n }()\n /**\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"ReadPathLink\",\n value: function () {\n var _ReadPathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(linkPath) {\n var params, response, file;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context6.next = 3;\n return fetch(\"/system/fs/readPathLink?\" + params);\n case 3:\n response = _context6.sent;\n if (!(response.status != 200)) {\n _context6.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context6.abrupt(\"return\", \"\");\n case 7:\n _context6.next = 9;\n return response.json();\n case 9:\n file = _context6.sent;\n return _context6.abrupt(\"return\", file);\n case 11:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6);\n }));\n function ReadPathLink(_x8) {\n return _ReadPathLink.apply(this, arguments);\n }\n return ReadPathLink;\n }()\n /**\r\n * @param {File} file\r\n * @param {string} parentPath\r\n * @returns {boolean}\r\n */\n }, {\n key: \"UploadFile\",\n value: function () {\n var _UploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(file, parentPath) {\n var formData, params, response, error;\n return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n console.log('here');\n formData = new FormData();\n formData.append(\"file\", file); //FIXME Conn reset\n params = new URLSearchParams({\n parentPath: parentPath\n });\n _context7.next = 6;\n return fetch(\"/system/fs/upload?\" + params, {\n method: \"POST\",\n //TODO Change to PUT?\n body: formData\n });\n case 6:\n response = _context7.sent;\n console.log(response.status);\n if (!(response.status != 201)) {\n _context7.next = 14;\n break;\n }\n _context7.next = 11;\n return response.json();\n case 11:\n error = _context7.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context7.abrupt(\"return\", false);\n case 14:\n return _context7.abrupt(\"return\", true);\n case 15:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7);\n }));\n function UploadFile(_x9, _x10) {\n return _UploadFile.apply(this, arguments);\n }\n return UploadFile;\n }()\n }]);\n return WebFS;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/web-fs/web-fs.js?"); /***/ }) diff --git a/res/dev-fs/dist/mobile_style.css b/res/dev-fs/dist/mobile_style.css index 1bc992f..eac70e4 100644 --- a/res/dev-fs/dist/mobile_style.css +++ b/res/dev-fs/dist/mobile_style.css @@ -2,7 +2,7 @@ !*** css ./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js!./src/mobile.less ***! \**********************************************************************************************************/ .WdePrimitives.AdjectiveElement, -#down-bar { +#controls-bar { border: 1px solid #555555; } #mobile-sunboard { @@ -19,10 +19,31 @@ height: 100%; background-color: #9999CC; } -#down-bar { - width: 100%; - height: 150px; - background-color: #C0C0C0; +.apps-list { + /* Auto layout */ + display: flex; + padding: 64px 32px; + align-items: flex-start; + align-content: flex-start; + gap: 103px 18px; + flex: 1 0 0; + align-self: stretch; + flex-wrap: wrap; +} +.app-icon { + width: 100px; + height: 100px; + /* Auto layout */ + display: flex; + padding: 4px 8px; + flex-direction: column; + align-items: center; + gap: 10px; +} +.app-icon .icon { + width: 64px; + height: 64px; + background-color: beige; } body { zoom: var(--zoom); @@ -45,5 +66,28 @@ body { /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */ touch-action: manipulation; + /* Auto layout */ + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: flex-start; +} +#mobile-app-views { + width: 100%; + height: 100%; +} +#controls-bar { + width: 100%; + height: 150px; + background-color: #C0C0C0; + /* Auto layout */ + display: flex; + flex-direction: row; + align-items: flex-start; + justify-content: flex-start; +} +.mobile-app-view { + width: 100%; + height: 100%; } diff --git a/res/dev-fs/wde/dist/desktop.js b/res/dev-fs/wde/dist/desktop.js new file mode 100644 index 0000000..7838b56 --- /dev/null +++ b/res/dev-fs/wde/dist/desktop.js @@ -0,0 +1,149 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "http://localhost:8080/res/dev-fs/dist/finder.js": +false, + +/***/ "./src/desktop.js": +/*!************************!*\ + !*** ./src/desktop.js ***! + \************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wde_wde_desktop_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wde/wde-desktop.js */ \"./src/wde/wde-desktop.js\");\n\ndocument.addEventListener('DOMContentLoaded', function () {\n var wde = new _wde_wde_desktop_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n}, false);\n\n//# sourceURL=webpack://my-webpack-project/./src/desktop.js?"); + +/***/ }), + +/***/ "./src/wde/application.js": +/*!********************************!*\ + !*** ./src/wde/application.js ***! + \********************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEApplication)\n/* harmony export */ });\n/* harmony import */ var _wde_desktop_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wde-desktop.js */ \"./src/wde/wde-desktop.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\nvar _wde = /*#__PURE__*/new WeakMap();\nvar WDEApplication = /*#__PURE__*/function () {\n /** @type {WebDesktopEnvironment} */\n\n /**\r\n * @constructor\r\n * @param {WebDesktopEnvironment} wde \r\n */\n function WDEApplication(wde) {\n _classCallCheck(this, WDEApplication);\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _wde, wde);\n }\n _createClass(WDEApplication, [{\n key: \"getWde\",\n value: function getWde() {\n return _classPrivateFieldGet(this, _wde);\n }\n }]);\n return WDEApplication;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/application.js?"); + +/***/ }), + +/***/ "./src/wde/decorat/desktop-decorat.js": +/*!********************************************!*\ + !*** ./src/wde/decorat/desktop-decorat.js ***! + \********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ DesktopDecorat)\n/* harmony export */ });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _windowsLayer = /*#__PURE__*/new WeakMap();\nvar _makeid = /*#__PURE__*/new WeakSet();\nvar DesktopDecorat = /*#__PURE__*/function () {\n /** @type {Element} */\n\n function DesktopDecorat() {\n var _this = this;\n _classCallCheck(this, DesktopDecorat);\n _classPrivateMethodInitSpec(this, _makeid);\n _classPrivateFieldInitSpec(this, _windowsLayer, {\n writable: true,\n value: void 0\n });\n this.windowLayer = document.body.querySelector('#windows-layer');\n // this.#windowsLayer = document.body.querySelector('#windows-layer')\n _classPrivateFieldSet(this, _windowsLayer, document.body.querySelector('#windows-layer'));\n var startDrag = function startDrag(event) {\n var window = event.target.closest('.WindowFrame');\n _this.bringWindowToFront(window);\n if (event.target.classList.contains(\"DragArea\")) {\n var xPosInit = event.offsetX;\n var yPosInit = event.offsetY;\n var dragWindow = function dragWindow(event) {\n window.style.left = \"\".concat(event.clientX - xPosInit, \"px\");\n window.style.top = \"\".concat(event.clientY - yPosInit, \"px\");\n };\n var stopDrag = function stopDrag() {\n removeEventListener('mousemove', dragWindow);\n removeEventListener('mouseup', stopDrag);\n };\n addEventListener('mousemove', dragWindow);\n addEventListener('mouseup', stopDrag);\n }\n };\n _classPrivateFieldGet(this, _windowsLayer).addEventListener('mousedown', startDrag);\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n _createClass(DesktopDecorat, [{\n key: \"bringWindowToFront\",\n value: function bringWindowToFront(window) {\n //FIXME\n var previousWindow = _classPrivateFieldGet(this, _windowsLayer).lastChild;\n if (window == null || window == undefined) {\n return;\n }\n if (window != previousWindow) {\n _classPrivateFieldGet(this, _windowsLayer).insertBefore(window, previousWindow.nextSibling);\n previousWindow.classList.remove(\"Focused\");\n window.classList.add(\"Focused\");\n } else {\n window.classList.add(\"Focused\");\n }\n return;\n }\n\n /**\r\n * @param {string} appId\r\n * @param {number} width\r\n * @param {number} height\r\n * @returns {HTMLElement}\r\n */\n }, {\n key: \"CreateNewWindow\",\n value: function CreateNewWindow(appId, width, height) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute('appid', appId);\n newWindow.setAttribute(\"class\", \"WindowFrame ConvexElement\");\n newWindow.setAttribute(\"windowId\", _classPrivateMethodGet(this, _makeid, _makeid2).call(this, 4)); //TODO:\n\n newWindow.style.width = width.toString() + \"px\";\n newWindow.style.height = height.toString() + \"px\";\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n return newWindow;\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n }, {\n key: \"CloseWindow\",\n value: function CloseWindow(window) {\n window.remove();\n }\n }, {\n key: \"CloseFocusedWindow\",\n value: function CloseFocusedWindow() {\n if (document.body.querySelector('#windows-layer').childElementCount > 1) {\n document.body.querySelector('#windows-layer').lastElementChild.remove();\n }\n }\n }], [{\n key: \"ChangeURL\",\n value: function ChangeURL(appWindow) {\n var appId = appWindow.getAttribute('appid');\n window.history.replaceState(null, \"\", \"/\".concat(appId, \"/\"));\n }\n\n /**\r\n * @param {num} length\r\n */\n }]);\n return DesktopDecorat;\n}();\nfunction _makeid2(length) {\n var result = '';\n var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var charactersLength = characters.length;\n var counter = 0;\n while (counter < length) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n counter += 1;\n }\n return result;\n}\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/decorat/desktop-decorat.js?"); + +/***/ }), + +/***/ "./src/wde/scrollbar/scrollbar.js": +/*!****************************************!*\ + !*** ./src/wde/scrollbar/scrollbar.js ***! + \****************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WdeScrollBar)\n/* harmony export */ });\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nvar WdeScrollBar = /*#__PURE__*/_createClass(\n/**\r\n* @param {HTMLElement} scrollBarContainer\r\n* @param {HTMLElement} content\r\n*/\nfunction WdeScrollBar(scrollBarContainer, content) {\n var _this = this;\n _classCallCheck(this, WdeScrollBar);\n var nonNativeScroll = false;\n // console.log(scrollBarContainer, content)\n // let handler = scrollBarContainer.children[0]\n //TODO On scroll move focus on window?\n var handler = scrollBarContainer.querySelector(\".ScrollBarScrollElement\"); //TODO Refactor classes\n // console.log(handler)\n\n handler.style.height = content.clientHeight / content.scrollHeight * handler.parentElement.clientHeight + 'px';\n var max = handler.parentElement.clientHeight - handler.clientHeight;\n var yPosInit = 0;\n handler.addEventListener('mousedown', function (event) {\n nonNativeScroll = true;\n yPosInit = event.clientY - Number(handler.style.top.replace('px', ''));\n document.addEventListener('mousemove', drag);\n document.addEventListener('mouseup', stop);\n });\n content.addEventListener('scroll', function (event) {\n if (!_this.nonNativeScroll) {\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n handler.style.top = content.scrollTop / coefficient + 'px';\n }\n });\n function drag() {\n // console.log(event.clientY - yPosInit, Number(handler.style.top.replace('px','' )))\n var pos = event.clientY - yPosInit;\n var clampPos = Math.min(Math.max(pos, 0), max);\n handler.style.top = clampPos + \"px\";\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n // console.log(clampPos, coefficient, content.clientHeight, clampPos* coefficient)\n\n content.scrollTop = clampPos * coefficient;\n }\n function stop() {\n // console.log(\"stop\")\n document.removeEventListener('mousemove', drag);\n document.removeEventListener('mouseup', stop);\n nonNativeScroll = false;\n }\n});\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/scrollbar/scrollbar.js?"); + +/***/ }), + +/***/ "./src/wde/wde-desktop.js": +/*!********************************!*\ + !*** ./src/wde/wde-desktop.js ***! + \********************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decorat/desktop-decorat.js */ \"./src/wde/decorat/desktop-decorat.js\");\n/* harmony import */ var _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scrollbar/scrollbar.js */ \"./src/wde/scrollbar/scrollbar.js\");\n/* harmony import */ var _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../web-fs/web-fs.js */ \"./src/web-fs/web-fs.js\");\n/* harmony import */ var _application_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./application.js */ \"./src/wde/application.js\");\n/* harmony import */ var _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./widgets/file-view/file-view.js */ \"./src/wde/widgets/file-view/file-view.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\n// import DesktopSunBoard from \"./sunboard/sunboard-desktop.js\";\nvar WebDesktopEnvironment = /*#__PURE__*/function () {\n /** @type {string} */\n\n /** @type {WDEFileView} */\n\n /** @type {WDEScrollBar} */\n\n /**@type {DesktopDecorat} */\n\n /** @type {Object} */\n\n /** Deprecated */\n\n // static decorat\n\n function WebDesktopEnvironment() {\n _classCallCheck(this, WebDesktopEnvironment);\n _defineProperty(this, \"test\", \"\");\n _defineProperty(this, \"FileView\", _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]);\n _defineProperty(this, \"ScrollBar\", _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n _defineProperty(this, \"Decorat\", void 0);\n document.body.style.setProperty('--zoom', 1);\n this.Decorat = new _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n WebDesktopEnvironment.webFs = new _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this.FileView = _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"];\n this.loadWDE();\n // this.#devLoadSunboard()\n }\n _createClass(WebDesktopEnvironment, [{\n key: \"loadWDE\",\n value: function () {\n var _loadWDE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var autoStart, _iterator, _step, child, appPath, args, argsRaw, _iterator2, _step2, argRaw, arg;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n autoStart = document.body.querySelector(\"wde-autostart\");\n if (!(autoStart == null)) {\n _context.next = 4;\n break;\n }\n WebDesktopEnvironment.Alert(\"Error in loading DE\");\n return _context.abrupt(\"return\");\n case 4:\n _iterator = _createForOfIteratorHelper(autoStart.children);\n _context.prev = 5;\n _iterator.s();\n case 7:\n if ((_step = _iterator.n()).done) {\n _context.next = 41;\n break;\n }\n child = _step.value;\n if (!(child.nodeName != \"APP\")) {\n _context.next = 11;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 11:\n appPath = child.getAttribute(\"app-path\");\n if (!(appPath == null)) {\n _context.next = 14;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 14:\n args = [];\n argsRaw = child.querySelector(\"args\");\n if (!(argsRaw == null)) {\n _context.next = 18;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 18:\n _iterator2 = _createForOfIteratorHelper(argsRaw.children);\n _context.prev = 19;\n _iterator2.s();\n case 21:\n if ((_step2 = _iterator2.n()).done) {\n _context.next = 29;\n break;\n }\n argRaw = _step2.value;\n arg = argRaw.getAttribute(\"string\");\n if (!(arg == null)) {\n _context.next = 26;\n break;\n }\n return _context.abrupt(\"continue\", 27);\n case 26:\n args.push(arg);\n case 27:\n _context.next = 21;\n break;\n case 29:\n _context.next = 34;\n break;\n case 31:\n _context.prev = 31;\n _context.t0 = _context[\"catch\"](19);\n _iterator2.e(_context.t0);\n case 34:\n _context.prev = 34;\n _iterator2.f();\n return _context.finish(34);\n case 37:\n _context.next = 39;\n return this.Open(appPath, args);\n case 39:\n _context.next = 7;\n break;\n case 41:\n _context.next = 46;\n break;\n case 43:\n _context.prev = 43;\n _context.t1 = _context[\"catch\"](5);\n _iterator.e(_context.t1);\n case 46:\n _context.prev = 46;\n _iterator.f();\n return _context.finish(46);\n case 49:\n autoStart.remove();\n case 50:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this, [[5, 43, 46, 49], [19, 31, 34, 37]]);\n }));\n function loadWDE() {\n return _loadWDE.apply(this, arguments);\n }\n return loadWDE;\n }()\n /**\r\n * @param {string} appPath\r\n * @param {string[]} args\r\n * @param {string} runPath\r\n */\n }, {\n key: \"Open\",\n value: function () {\n var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appPath, args, runPath) {\n var appManifest, runContext;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return WebDesktopEnvironment.fetchApp(appPath);\n case 2:\n appManifest = _context2.sent;\n if (!(appManifest === undefined)) {\n _context2.next = 5;\n break;\n }\n return _context2.abrupt(\"return\");\n case 5:\n //TODO return err\n /**@type {runContext} */\n runContext = {\n WDE: this,\n isMobile: false,\n bundlePath: appPath,\n runPath: runPath\n };\n if (WebDesktopEnvironment.Applications[appManifest.appId] === undefined) {\n WebDesktopEnvironment.load2(appManifest, function () {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n });\n } else {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n }\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function Open(_x, _x2, _x3) {\n return _Open.apply(this, arguments);\n }\n return Open;\n }()\n /**\r\n * @param {string} appManifest\r\n * @param {function} onload callback after script loading\r\n */\n }], [{\n key: \"load2\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(appManifest, onload) {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n // import(window.location.origin + appManifest.js[0]).then((app) => {\n // console.log(window.location.origin + appManifest.js[0] == 'http://localhost:8080/res/dev-fs/wde/dist/finder.js')\n // let kek = 'http://localhost:8080/res/dev-fs/wde/dist/finder.js'\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! http://localhost:8080/res/dev-fs/dist/finder.js */ \"http://localhost:8080/res/dev-fs/dist/finder.js\")).then(function (app) {\n var newApp = new app[\"default\"]();\n // if newApp //TODO Validate\n WebDesktopEnvironment.Applications[appManifest.appId] = newApp;\n onload();\n });\n return _context3.abrupt(\"return\");\n case 2:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function load2(_x4, _x5) {\n return _load.apply(this, arguments);\n }\n return load2;\n }()\n /**\r\n * @param {string} path\r\n * @returns {Object | undefined} //FIXME\r\n */\n }, {\n key: \"fetchApp\",\n value: function () {\n var _fetchApp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(path) {\n var params, response, error, appManifest;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n // console.log(\"path: \" + path )\n params = new URLSearchParams({\n path: path,\n mode: \"json\"\n });\n _context4.next = 3;\n return fetch(\"/system/loadApp?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 10;\n break;\n }\n _context4.next = 7;\n return response.json();\n case 7:\n error = _context4.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context4.abrupt(\"return\", undefined);\n case 10:\n //TODO Validate manifest\n appManifest = response.json();\n return _context4.abrupt(\"return\", appManifest);\n case 12:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function fetchApp(_x6) {\n return _fetchApp.apply(this, arguments);\n }\n return fetchApp;\n }()\n /**\r\n * @param {string} html\r\n */\n }, {\n key: \"SetBasicWindow\",\n value: function SetBasicWindow(html) {\n this.basicWindow = html;\n }\n\n /**\r\n * @returns {string}\r\n */\n }, {\n key: \"GetBasicWindow\",\n value: function GetBasicWindow() {\n return this.basicWindow;\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"Alert\",\n value: function Alert(alertText) {\n WebDesktopEnvironment.CreateAlertWindow(alertText);\n console.log(alertText);\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"CreateAlertWindow\",\n value: function CreateAlertWindow(alertText) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute(\"class\", \"WindowFrameless\");\n newWindow.setAttribute(\"windowId\", \"SuperUniqUUID\"); //TODO:\n newWindow.style.cssText = \"position:absolute;width:450px;height:116px; margin-left: -225px; margin-top:-58px;left: 50%;top: 50%;background-color:#FFFFFF;border: 1px solid #000000;box-shadow: 2px 2px 0px #000000;\";\n var alertImage = document.createElement(\"img\");\n alertImage.setAttribute(\"src\", \"/res/sys/wde/icons/ohno.png\");\n alertImage.style.cssText = \"position:absolute; width:64px;height:64px;top:15px;left:25px\";\n newWindow.appendChild(alertImage);\n var errorText = document.createElement(\"div\");\n errorText.style.cssText = \"position:absolute; width: 300px; left:128px; top:30px;font-family: 'Virtue';\";\n errorText.innerHTML = alertText;\n newWindow.appendChild(errorText);\n var closeButton = document.createElement(\"button\");\n closeButton.style.cssText = \"position:absolute; left: 382px; bottom: 10px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;\";\n closeButton.innerHTML = \"Close\";\n closeButton.addEventListener('click', function () {\n newWindow.remove();\n });\n newWindow.appendChild(closeButton);\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n }\n }]);\n return WebDesktopEnvironment;\n}();\n/**\r\n * @typedef {Object} runContext\r\n * @property {WebDesktopEnvironment} WDE \r\n * @property {boolean} isMobile\r\n * @property {string} appPath \r\n * @property {string} runPath //TODO\r\n*/\n_defineProperty(WebDesktopEnvironment, \"Applications\", {});\n_defineProperty(WebDesktopEnvironment, \"isMobile\", false);\n_defineProperty(WebDesktopEnvironment, \"webFs\", void 0);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde-desktop.js?"); + +/***/ }), + +/***/ "./src/wde/widgets/file-view/file-view.js": +/*!************************************************!*\ + !*** ./src/wde/widgets/file-view/file-view.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEFileView)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar WDEFileView = /*#__PURE__*/function () {\n /**\r\n * @param {HTMLElement} fileViewElem\r\n * @param {Function} doubleClickCallback\r\n * @param {Function} rightClickCallback\r\n * @param {Function} updateFileViewCallback\r\n */\n function WDEFileView(fileViewElem, doubleClickCallback, rightClickCallback, fileUploadCallback, updateFileViewCallback) {\n var _this = this;\n _classCallCheck(this, WDEFileView);\n _defineProperty(this, \"path\", \"\");\n _defineProperty(this, \"parentElem\", undefined);\n _defineProperty(this, \"selected\", []);\n //TODO check all params\n this.parentElem = fileViewElem;\n fileViewElem.addEventListener('click', function (event) {\n if (event.target.classList[0] == 'FileTileView') {\n _this.DeselectAll();\n return;\n }\n if (event.detail === 1) {\n _this.DeselectAll();\n _this.Select([event.target]);\n } else if (event.detail === 2) {\n doubleClickCallback(event);\n }\n });\n fileViewElem.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n if (event.target.classList.contains(\"Tile\")) {\n _this.DeselectAll();\n _this.Select([event.target]);\n }\n _this.Select([event.target]);\n rightClickCallback(event);\n });\n if (fileUploadCallback !== undefined) {\n var counter = 0;\n var draggedElem = undefined;\n fileViewElem.addEventListener('dragstart', function (event) {\n // console.log(event.target)\n // console.log(this.path)\n // draggedElem = event.target\n event.dataTransfer.setData(\"fileName\", event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"filePath\", _this.path + \"/\" + event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"dropType\", \"move\");\n // console.log(updateFileViewCallback)\n // event.dataTransfer.setData(\"updateCallback\", updateFileViewCallback)\n // event.dataTransfer.setData(\"fileName\", )\n // console.log(draggedElem)\n });\n\n fileViewElem.addEventListener('dragenter', function (event) {\n event.preventDefault();\n counter++;\n fileViewElem.classList.add(\"DragDropBorder\");\n });\n fileViewElem.addEventListener('dragend', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // updateFileViewCallback()\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragleave', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragover', function (event) {\n event.preventDefault();\n });\n fileViewElem.addEventListener(\"drop\", function (event) {\n event.preventDefault();\n fileUploadCallback(event);\n fileViewElem.classList.remove(\"DragDropBorder\");\n // updateFileViewCallback()\n // this.OpenFolder(this.path)\n // draggedElem = undefined\n });\n }\n }\n\n /** \r\n * @param {[]Element} elements\r\n */\n _createClass(WDEFileView, [{\n key: \"Select\",\n value: function Select(elements) {\n var _this2 = this;\n elements.forEach(function (element) {\n _this2.selected.push(element);\n element.classList.add(\"Selected\");\n });\n }\n }, {\n key: \"DeselectAll\",\n value: function DeselectAll() {\n this.selected.forEach(function (element) {\n element.classList.remove(\"Selected\");\n });\n this.selected = [];\n }\n\n /** Get html of folder by path\r\n * @param {string} path\r\n */\n }, {\n key: \"OpenFolder\",\n value: function () {\n var _OpenFolder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response, html;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.path = path;\n params = new URLSearchParams({\n path: path\n });\n _context.next = 4;\n return fetch(\"/system/wde/widgets/file-tile-view?\" + params);\n case 4:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 8;\n break;\n }\n //TODO Error text message\n WebDesktopEnvironment.Alert(\"TODO\");\n return _context.abrupt(\"return\");\n case 8:\n _context.next = 10;\n return response.text();\n case 10:\n html = _context.sent;\n this.parentElem.innerHTML = html;\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function OpenFolder(_x) {\n return _OpenFolder.apply(this, arguments);\n }\n return OpenFolder;\n }()\n }]);\n return WDEFileView;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/widgets/file-view/file-view.js?"); + +/***/ }), + +/***/ "./src/web-fs/web-fs.js": +/*!******************************!*\ + !*** ./src/web-fs/web-fs.js ***! + \******************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebFS)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nvar WebFS = /*#__PURE__*/function () {\n function WebFS() {\n _classCallCheck(this, WebFS);\n }\n _createClass(WebFS, null, [{\n key: \"CreateDirectory\",\n value:\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n function () {\n var _CreateDirectory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(path == undefined)) {\n _context.next = 3;\n break;\n }\n WebDesktopEnvironment.Alert(\"Path is undefined\");\n return _context.abrupt(\"return\", false);\n case 3:\n params = new URLSearchParams({\n path: \"\".concat(path, \"/New Directory\")\n });\n _context.next = 6;\n return fetch(\"/system/fs/createDir?\" + params);\n case 6:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 10;\n break;\n }\n WebDesktopEnvironment.Alert(\"DIRCTORY CREATION ERROR\"); //TODO\n return _context.abrupt(\"return\", false);\n case 10:\n return _context.abrupt(\"return\", true);\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n function CreateDirectory(_x) {\n return _CreateDirectory.apply(this, arguments);\n }\n return CreateDirectory;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"DeleteFile\",\n value: function () {\n var _DeleteFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n params = new URLSearchParams({\n path: path\n });\n _context2.next = 3;\n return fetch(\"/system/fs/delete?\" + params);\n case 3:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"DELETE ERROR\"); //TODO\n return _context2.abrupt(\"return\", false);\n case 7:\n return _context2.abrupt(\"return\", true);\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n function DeleteFile(_x2) {\n return _DeleteFile.apply(this, arguments);\n }\n return DeleteFile;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"MoveFile\",\n value: function () {\n var _MoveFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sourcePath, targetPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n targetPath: targetPath\n });\n _context3.next = 3;\n return fetch(\"/system/fs/move?\" + params);\n case 3:\n response = _context3.sent;\n if (!(response.status != 200)) {\n _context3.next = 6;\n break;\n }\n return _context3.abrupt(\"return\", false);\n case 6:\n return _context3.abrupt(\"return\", true);\n case 7:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function MoveFile(_x3, _x4) {\n return _MoveFile.apply(this, arguments);\n }\n return MoveFile;\n }()\n /**\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"ReadObjectLink\",\n value: function () {\n var _ReadObjectLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(linkPath) {\n var params, response, path;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context4.next = 3;\n return fetch(\"/system/fs/readObjectLink?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context4.abrupt(\"return\", \"\");\n case 7:\n _context4.next = 9;\n return response.text();\n case 9:\n path = _context4.sent;\n return _context4.abrupt(\"return\", path);\n case 11:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function ReadObjectLink(_x5) {\n return _ReadObjectLink.apply(this, arguments);\n }\n return ReadObjectLink;\n }()\n /**\r\n * @param {string} sourcePath\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"CreatePathLink\",\n value: function () {\n var _CreatePathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sourcePath, linkPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n linkPath: linkPath\n });\n _context5.next = 3;\n return fetch(\"/system/fs/createPathLink?\" + params);\n case 3:\n response = _context5.sent;\n return _context5.abrupt(\"return\", response.status == 200);\n case 5:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5);\n }));\n function CreatePathLink(_x6, _x7) {\n return _CreatePathLink.apply(this, arguments);\n }\n return CreatePathLink;\n }()\n /**\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"ReadPathLink\",\n value: function () {\n var _ReadPathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(linkPath) {\n var params, response, file;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context6.next = 3;\n return fetch(\"/system/fs/readPathLink?\" + params);\n case 3:\n response = _context6.sent;\n if (!(response.status != 200)) {\n _context6.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context6.abrupt(\"return\", \"\");\n case 7:\n _context6.next = 9;\n return response.json();\n case 9:\n file = _context6.sent;\n return _context6.abrupt(\"return\", file);\n case 11:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6);\n }));\n function ReadPathLink(_x8) {\n return _ReadPathLink.apply(this, arguments);\n }\n return ReadPathLink;\n }()\n /**\r\n * @param {File} file\r\n * @param {string} parentPath\r\n * @returns {boolean}\r\n */\n }, {\n key: \"UploadFile\",\n value: function () {\n var _UploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(file, parentPath) {\n var formData, params, response, error;\n return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n console.log('here');\n formData = new FormData();\n formData.append(\"file\", file); //FIXME Conn reset\n params = new URLSearchParams({\n parentPath: parentPath\n });\n _context7.next = 6;\n return fetch(\"/system/fs/upload?\" + params, {\n method: \"POST\",\n //TODO Change to PUT?\n body: formData\n });\n case 6:\n response = _context7.sent;\n console.log(response.status);\n if (!(response.status != 201)) {\n _context7.next = 14;\n break;\n }\n _context7.next = 11;\n return response.json();\n case 11:\n error = _context7.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context7.abrupt(\"return\", false);\n case 14:\n return _context7.abrupt(\"return\", true);\n case 15:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7);\n }));\n function UploadFile(_x9, _x10) {\n return _UploadFile.apply(this, arguments);\n }\n return UploadFile;\n }()\n }]);\n return WebFS;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/web-fs/web-fs.js?"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval devtool is used. +/******/ var __webpack_exports__ = __webpack_require__("./src/desktop.js"); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/res/dev-fs/wde/dist/finder.js b/res/dev-fs/wde/dist/finder.js new file mode 100644 index 0000000..7045258 --- /dev/null +++ b/res/dev-fs/wde/dist/finder.js @@ -0,0 +1,159 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "http://localhost:8080/res/dev-fs/dist/finder.js": +false, + +/***/ "./src/apps/finder/finder-window.js": +/*!******************************************!*\ + !*** ./src/apps/finder/finder-window.js ***! + \******************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ FinderWindow)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _appId = /*#__PURE__*/new WeakMap();\nvar _wde = /*#__PURE__*/new WeakMap();\nvar _finder = /*#__PURE__*/new WeakMap();\n// import WebDesktopEnvironment from \"../../wde/wde-desktop\"\n// import Finder from \"./finder\"\n// import WebDesktopEnvironment from \"../../wde/wde-desktop\"\nvar FinderWindow = /*#__PURE__*/function () {\n function FinderWindow() {\n _classCallCheck(this, FinderWindow);\n _classPrivateFieldInitSpec(this, _appId, {\n writable: true,\n value: \"Finder\"\n });\n _defineProperty(this, \"curPath\", \"\");\n _defineProperty(this, \"fileView\", undefined);\n _defineProperty(this, \"windowElem\", undefined);\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldInitSpec(this, _finder, {\n writable: true,\n value: void 0\n });\n }\n _createClass(FinderWindow, [{\n key: \"Init\",\n value:\n /**\r\n * @param {Finder} finder\r\n * @param {*} args \r\n * @param {import(\"../../wde/wde-desktop\").runContext} runContext \r\n * @returns \r\n */\n function () {\n var _Init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(finder, args, runContext) {\n var _this = this;\n var desktopNode, _params, _response, _html, params, response, error, html, newWindow, scrollBar;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _classPrivateFieldSet(this, _finder, finder);\n _classPrivateFieldSet(this, _wde, runContext.WDE);\n if (!(args[1] == \"--desktop\")) {\n _context.next = 22;\n break;\n }\n desktopNode = document.body.querySelector(\"#\".concat(args[2]));\n if (!(desktopNode == null)) {\n _context.next = 7;\n break;\n }\n _classPrivateFieldGet(this, _wde).Alert(\"Desktop node not found\");\n return _context.abrupt(\"return\");\n case 7:\n _params = new URLSearchParams({\n path: args[0]\n });\n _context.next = 10;\n return fetch(\"/app/\".concat(_classPrivateFieldGet(this, _appId), \"/renderDesktop?\") + _params, {\n method: \"POST\",\n body: JSON.stringify(runContext)\n });\n case 10:\n _response = _context.sent;\n if (!(_response.status != 200)) {\n _context.next = 15;\n break;\n }\n console.log(_response.status);\n _classPrivateFieldGet(this, _wde).Alert(\"Error in render desktop\"); //TODO\n return _context.abrupt(\"return\");\n case 15:\n _context.next = 17;\n return _response.text();\n case 17:\n _html = _context.sent;\n desktopNode.innerHTML = _html;\n this.fileView = new runContext.WDE.FileView(desktopNode.querySelector(\".FileTileView\"), function (event) {\n _this.Click(event);\n }, function (event) {\n _this.RightClick(event);\n }, function (event, draggedElem) {\n _this.DropEvent(event, draggedElem);\n }, function () {\n _this.ReRenderDir();\n });\n this.RenderDir(args[0]);\n return _context.abrupt(\"return\");\n case 22:\n params = new URLSearchParams({\n isMobile: false\n }); //FIXME\n _context.next = 25;\n return fetch(\"/app/\".concat(_classPrivateFieldGet(this, _appId), \"/render?\") + params, {\n method: \"POST\",\n body: JSON.stringify(runContext)\n });\n case 25:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 32;\n break;\n }\n _context.next = 29;\n return response.json();\n case 29:\n error = _context.sent;\n _classPrivateFieldGet(this, _wde).Alert(error.message);\n return _context.abrupt(\"return\");\n case 32:\n _context.next = 34;\n return response.text();\n case 34:\n html = _context.sent;\n newWindow = _classPrivateFieldGet(this, _wde).Decorat.CreateNewWindow(_classPrivateFieldGet(this, _appId), 500, 350);\n newWindow.innerHTML = html;\n\n // console.log(this.#wde)\n\n this.fileView = new runContext.WDE.FileView(newWindow.querySelector(\".FileTileView\"), function (event) {\n _this.Click(event);\n }, function (event) {\n _this.RightClick(event);\n }, function (event, draggedElem) {\n _this.DropEvent(event, draggedElem);\n }, function () {\n _this.ReRenderDir();\n });\n newWindow.querySelector(\"#closeWindowButton\").addEventListener('click', function () {\n _classPrivateFieldGet(_this, _wde).Decorat.CloseWindow(newWindow);\n });\n newWindow.querySelector(\"#RootButton\").addEventListener('click', function () {\n _this.RenderDir('/');\n });\n newWindow.querySelector(\"#HomeButton\").addEventListener('click', function () {\n _this.RenderDir('/home/user');\n });\n scrollBar = new (_classPrivateFieldGet(this, _wde).ScrollBar)(newWindow.querySelector(\".ScrollbarPlace\"), newWindow.querySelector(\".FileTileView\"));\n this.windowElem = newWindow;\n this.RenderDir(args[0]);\n case 44:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function Init(_x, _x2, _x3) {\n return _Init.apply(this, arguments);\n }\n return Init;\n }()\n /**\r\n * @param {string} path\r\n */\n }, {\n key: \"RenderDir\",\n value: function RenderDir(path) {\n this.curPath = path;\n this.fileView.OpenFolder(path);\n }\n }, {\n key: \"ReRenderDir\",\n value: function ReRenderDir() {\n this.RenderDir(this.curPath);\n }\n\n /**\r\n * @param {DragEvent} event\r\n * @param {HTMLElement} draggedElem\r\n */\n }, {\n key: \"DropEvent\",\n value: function () {\n var _DropEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {\n var sourcePath, targetPath, res, files, i, file, _res, params, response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n if (!(event.dataTransfer.getData(\"dropType\") == \"move\")) {\n _context2.next = 9;\n break;\n }\n sourcePath = event.dataTransfer.getData(\"filePath\");\n targetPath = this.curPath + \"/\" + event.dataTransfer.getData(\"fileName\");\n _context2.next = 5;\n return WebFS.MoveFile(sourcePath, targetPath);\n case 5:\n res = _context2.sent;\n if (res) {\n this.ReRenderDir();\n } else {\n _classPrivateFieldGet(this, _wde).Alert(\"UWAGA TODO MOVE FILE ERROR\"); //TODO\n }\n _context2.next = 27;\n break;\n case 9:\n console.log(event, this.curPath);\n files = event.dataTransfer.files;\n i = 0;\n case 12:\n if (!(i < files.length)) {\n _context2.next = 22;\n break;\n }\n file = files[i];\n console.log(\"file:\" + file.name);\n _context2.next = 17;\n return WebFS.UploadFile(file, this.curPath);\n case 17:\n _res = _context2.sent;\n if (_res) {\n this.ReRenderDir();\n }\n case 19:\n i++;\n _context2.next = 12;\n break;\n case 22:\n params = new URLSearchParams({\n parentPath: this.curPath\n });\n _context2.next = 25;\n return fetch('/fs/upload/?' + params, {\n method: \"POST\",\n //TODO Change to PUT?\n body: formData\n });\n case 25:\n response = _context2.sent;\n if (response.status != 200) {\n _classPrivateFieldGet(this, _wde).Alert(\"ERROR IN UPLOADING FILE\"); //TODO\n } else {\n this.ReRenderDir();\n }\n case 27:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function DropEvent(_x4) {\n return _DropEvent.apply(this, arguments);\n }\n return DropEvent;\n }()\n /**\r\n * @param {MouseEvent} event\r\n */\n }, {\n key: \"Click\",\n value: function Click(event) {\n this.OpenFile(this.curPath, event.target.getAttribute(\"name\"), event.target.getAttribute(\"filetype\"));\n }\n\n /**\r\n * @param {string} filePath\r\n */\n }, {\n key: \"OpenFile\",\n value: function () {\n var _OpenFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(parentPath, fileName, fileType) {\n var fileExtension, res;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n // console.log(parentPath, fileName, fileType)\n // const splittedPath = filePath.split(\"/\")\n // const fileName = splittedPath[splittedPath.length - 1]\n fileExtension = fileName.split(\".\")[fileName.split(\".\").length - 1]; //FIXME\n _context3.t0 = true;\n _context3.next = _context3.t0 === (fileType == \"objectlink\") ? 4 : _context3.t0 === (fileType == \"pathlink\") ? 6 : _context3.t0 === (fileExtension == \"app\") ? 12 : _context3.t0 === (fileExtension == \"blog\") ? 14 : _context3.t0 === (fileType == \"directory\") ? 16 : _context3.t0 === (fileExtension == \"blog\") ? 18 : _context3.t0 === (fileExtension == \"jpeg\" | fileExtension == \"png\") ? 20 : 22;\n break;\n case 4:\n _classPrivateFieldGet(this, _wde).Alert(\"Links not supported yet\");\n return _context3.abrupt(\"break\", 24);\n case 6:\n _context3.next = 8;\n return WebFS.ReadPathLink(\"\".concat(parentPath, \"/\").concat(fileName));\n case 8:\n res = _context3.sent;\n console.log(res);\n this.OpenFile(res.parentPath, res.name, res.filetype);\n return _context3.abrupt(\"break\", 24);\n case 12:\n _classPrivateFieldGet(this, _wde).Open(\"\".concat(parentPath, \"/\").concat(fileName), []);\n return _context3.abrupt(\"break\", 24);\n case 14:\n _classPrivateFieldGet(this, _wde).Open(\"/Applications/BlogViewer.app\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context3.abrupt(\"break\", 24);\n case 16:\n _classPrivateFieldGet(this, _wde).Open(\"/Applications/Finder.app\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context3.abrupt(\"break\", 24);\n case 18:\n _classPrivateFieldGet(this, _wde).Open(\"/Applications/BlogViewer.app\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context3.abrupt(\"break\", 24);\n case 20:\n _classPrivateFieldGet(this, _wde).Open(\"img-viewer\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context3.abrupt(\"break\", 24);\n case 22:\n _classPrivateFieldGet(this, _wde).Alert(\"Unsupported file type\");\n return _context3.abrupt(\"break\", 24);\n case 24:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n function OpenFile(_x5, _x6, _x7) {\n return _OpenFile.apply(this, arguments);\n }\n return OpenFile;\n }()\n /**\r\n * @param {MouseEvent} event\r\n */\n }, {\n key: \"RightClick\",\n value: function RightClick(event) {\n this.CreateContextMenu(event.target, [event.clientY, event.clientX]);\n }\n\n /**\r\n * @param {HTMLElement} target\r\n * @param {string[]} pos\r\n */\n }, {\n key: \"CreateContextMenu\",\n value: function () {\n var _CreateContextMenu = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(target, pos) {\n var _this2 = this;\n var context, fileName, fileType, path, params, response, html, overlay, menu;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n context = \"\";\n fileName = target.getAttribute(\"name\"); //TODO check for null\n fileType = target.getAttribute(\"fileType\");\n if (target.classList.contains(\"FileTileView\")) {\n context = \"FileTileView\";\n } else {\n context = fileType;\n }\n path = \"\";\n if (fileName === null) {\n path = this.curPath;\n } else {\n path = \"\".concat(this.curPath, \"/\").concat(fileName);\n }\n params = new URLSearchParams({\n context: context,\n path: path\n });\n _context5.next = 9;\n return fetch(\"/app/\".concat(_classPrivateFieldGet(this, _appId), \"/contextMenu?\") + params);\n case 9:\n response = _context5.sent;\n if (!(response.status != 200)) {\n _context5.next = 13;\n break;\n }\n _classPrivateFieldGet(this, _wde).Alert(\"ERROR in Context menu TODO\"); //TODO\n return _context5.abrupt(\"return\");\n case 13:\n _context5.next = 15;\n return response.text();\n case 15:\n html = _context5.sent;\n overlay = document.createElement(\"div\"); //TODO Move to WDE.CreateOverlay()\n overlay.setAttribute('id', 'finder-context-menu-overlay');\n overlay.style.position = 'absolute';\n overlay.style.width = \"100%\";\n overlay.style.height = \"100%\";\n menu = document.createElement(\"div\");\n menu.setAttribute('class', 'ContextMenu WindowFrameShadow');\n menu.style.position = 'absolute';\n menu.style.top = pos[0] + \"px\";\n menu.style.left = pos[1] + \"px\";\n menu.innerHTML = html;\n // menu.children[0].firstElementChild.remove()\n menu.children[0].lastElementChild.remove(); //FIXME Can't ommit rendering of horLine in end of menu on backend\n\n overlay.appendChild(menu);\n document.body.appendChild(overlay);\n overlay.addEventListener('click', /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(event) {\n var res;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n if (!event.target.classList.contains(\"Row\")) {\n _context4.next = 27;\n break;\n }\n //TODO add uuid id to rows to more accurate checks??\n res = false;\n _context4.t0 = event.target.children[0].getAttribute(\"action\");\n _context4.next = _context4.t0 === \"createPathLink\" ? 5 : _context4.t0 === \"createDir\" ? 10 : _context4.t0 === \"deleteFile\" ? 16 : _context4.t0 === \"getInfo\" ? 22 : _context4.t0 === \"openAsDir\" ? 24 : 26;\n break;\n case 5:\n _context4.next = 7;\n return WebFS.CreatePathLink(\"\".concat(_this2.curPath, \"/\").concat(fileName), \"\".concat(_this2.curPath, \"/Link to \").concat(fileName));\n case 7:\n res = _context4.sent;\n if (res) {\n _this2.ReRenderDir();\n }\n return _context4.abrupt(\"break\", 27);\n case 10:\n _context4.next = 12;\n return WebFS.CreateDirectory(\"\".concat(_this2.curPath));\n case 12:\n res = _context4.sent;\n console.log(res);\n if (res) {\n _this2.ReRenderDir();\n }\n return _context4.abrupt(\"break\", 27);\n case 16:\n _context4.next = 18;\n return WebFS.DeleteFile(\"\".concat(_this2.curPath, \"/\").concat(fileName));\n case 18:\n res = _context4.sent;\n console.log(res);\n if (res) {\n _this2.ReRenderDir();\n }\n return _context4.abrupt(\"break\", 27);\n case 22:\n Finder.RenderProperites(path);\n return _context4.abrupt(\"break\", 27);\n case 24:\n _classPrivateFieldGet(_this2, _wde).Open(\"/Applications/\".concat(_classPrivateFieldGet(_this2, _appId), \".app\"), [\"\".concat(_this2.curPath, \"/\").concat(fileName)]);\n return _context4.abrupt(\"break\", 27);\n case 26:\n return _context4.abrupt(\"break\", 27);\n case 27:\n overlay.remove();\n case 28:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n return function (_x10) {\n return _ref.apply(this, arguments);\n };\n }());\n overlay.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n overlay.remove();\n });\n case 32:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5, this);\n }));\n function CreateContextMenu(_x8, _x9) {\n return _CreateContextMenu.apply(this, arguments);\n }\n return CreateContextMenu;\n }()\n }]);\n return FinderWindow;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/apps/finder/finder-window.js?"); + +/***/ }), + +/***/ "./src/apps/finder/finder.js": +/*!***********************************!*\ + !*** ./src/apps/finder/finder.js ***! + \***********************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Finder)\n/* harmony export */ });\n/* harmony import */ var _wde_application_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../wde/application.js */ \"./src/wde/application.js\");\n/* harmony import */ var _wde_wde_desktop_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../wde/wde-desktop.js */ \"./src/wde/wde-desktop.js\");\n/* harmony import */ var _finder_window_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./finder-window.js */ \"./src/apps/finder/finder-window.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n// require(\"./finder.less\")\n\n\n\n\nvar Finder = /*#__PURE__*/function (_WDEApplication) {\n _inherits(Finder, _WDEApplication);\n var _super = _createSuper(Finder);\n /**\r\n * @constructor\r\n * @param {WebDesktopEnvironment} wde \r\n */\n function Finder(wde) {\n _classCallCheck(this, Finder);\n /** @type {WDEApplication} */\n return _super.call(this, wde);\n }\n\n /**\r\n * @param {string[]} args\r\n * @param {import(\"../../wde/wde-desktop.js\").runContext}\r\n */\n _createClass(Finder, [{\n key: \"NewWindow\",\n value: function () {\n var _NewWindow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(args, runContext) {\n var newFinder;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n newFinder = new _finder_window_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n _context.next = 3;\n return newFinder.Init(this, args, runContext);\n case 3:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function NewWindow(_x, _x2) {\n return _NewWindow.apply(this, arguments);\n }\n return NewWindow;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"RenderProperites\",\n value: function () {\n var _RenderProperites = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path) {\n var params, response, html, newWindow;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n if (!(path == null || path == \"\")) {\n _context2.next = 2;\n break;\n }\n return _context2.abrupt(\"return\");\n case 2:\n params = new URLSearchParams({\n path: path\n });\n _context2.next = 5;\n return fetch(\"/app/\".concat(Finder.AppId, \"/renderProps?\") + params);\n case 5:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 8;\n break;\n }\n return _context2.abrupt(\"return\", false);\n case 8:\n _context2.next = 10;\n return response.text();\n case 10:\n html = _context2.sent;\n newWindow = _get(_getPrototypeOf(Finder.prototype), \"getWde\", this).call(this).Decorat.CreateNewWindow(Finder.AppId, 350, 500);\n newWindow.innerHTML = html;\n newWindow.querySelector(\"#closeWindowButton\").addEventListener('click', function (params) {\n // WebDesktopEnvironment.CloseWindow(newWindow)\n });\n case 14:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function RenderProperites(_x3) {\n return _RenderProperites.apply(this, arguments);\n }\n return RenderProperites;\n }()\n }]);\n return Finder;\n}(_wde_application_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n_defineProperty(Finder, \"AppId\", \"Finder\");\n\n\n//# sourceURL=webpack://my-webpack-project/./src/apps/finder/finder.js?"); + +/***/ }), + +/***/ "./src/wde/application.js": +/*!********************************!*\ + !*** ./src/wde/application.js ***! + \********************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEApplication)\n/* harmony export */ });\n/* harmony import */ var _wde_desktop_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wde-desktop.js */ \"./src/wde/wde-desktop.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\nvar _wde = /*#__PURE__*/new WeakMap();\nvar WDEApplication = /*#__PURE__*/function () {\n /** @type {WebDesktopEnvironment} */\n\n /**\r\n * @constructor\r\n * @param {WebDesktopEnvironment} wde \r\n */\n function WDEApplication(wde) {\n _classCallCheck(this, WDEApplication);\n _classPrivateFieldInitSpec(this, _wde, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _wde, wde);\n }\n _createClass(WDEApplication, [{\n key: \"getWde\",\n value: function getWde() {\n return _classPrivateFieldGet(this, _wde);\n }\n }]);\n return WDEApplication;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/application.js?"); + +/***/ }), + +/***/ "./src/wde/decorat/desktop-decorat.js": +/*!********************************************!*\ + !*** ./src/wde/decorat/desktop-decorat.js ***! + \********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ DesktopDecorat)\n/* harmony export */ });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _windowsLayer = /*#__PURE__*/new WeakMap();\nvar _makeid = /*#__PURE__*/new WeakSet();\nvar DesktopDecorat = /*#__PURE__*/function () {\n /** @type {Element} */\n\n function DesktopDecorat() {\n var _this = this;\n _classCallCheck(this, DesktopDecorat);\n _classPrivateMethodInitSpec(this, _makeid);\n _classPrivateFieldInitSpec(this, _windowsLayer, {\n writable: true,\n value: void 0\n });\n this.windowLayer = document.body.querySelector('#windows-layer');\n // this.#windowsLayer = document.body.querySelector('#windows-layer')\n _classPrivateFieldSet(this, _windowsLayer, document.body.querySelector('#windows-layer'));\n var startDrag = function startDrag(event) {\n var window = event.target.closest('.WindowFrame');\n _this.bringWindowToFront(window);\n if (event.target.classList.contains(\"DragArea\")) {\n var xPosInit = event.offsetX;\n var yPosInit = event.offsetY;\n var dragWindow = function dragWindow(event) {\n window.style.left = \"\".concat(event.clientX - xPosInit, \"px\");\n window.style.top = \"\".concat(event.clientY - yPosInit, \"px\");\n };\n var stopDrag = function stopDrag() {\n removeEventListener('mousemove', dragWindow);\n removeEventListener('mouseup', stopDrag);\n };\n addEventListener('mousemove', dragWindow);\n addEventListener('mouseup', stopDrag);\n }\n };\n _classPrivateFieldGet(this, _windowsLayer).addEventListener('mousedown', startDrag);\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n _createClass(DesktopDecorat, [{\n key: \"bringWindowToFront\",\n value: function bringWindowToFront(window) {\n //FIXME\n var previousWindow = _classPrivateFieldGet(this, _windowsLayer).lastChild;\n if (window == null || window == undefined) {\n return;\n }\n if (window != previousWindow) {\n _classPrivateFieldGet(this, _windowsLayer).insertBefore(window, previousWindow.nextSibling);\n previousWindow.classList.remove(\"Focused\");\n window.classList.add(\"Focused\");\n } else {\n window.classList.add(\"Focused\");\n }\n return;\n }\n\n /**\r\n * @param {string} appId\r\n * @param {number} width\r\n * @param {number} height\r\n * @returns {HTMLElement}\r\n */\n }, {\n key: \"CreateNewWindow\",\n value: function CreateNewWindow(appId, width, height) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute('appid', appId);\n newWindow.setAttribute(\"class\", \"WindowFrame ConvexElement\");\n newWindow.setAttribute(\"windowId\", _classPrivateMethodGet(this, _makeid, _makeid2).call(this, 4)); //TODO:\n\n newWindow.style.width = width.toString() + \"px\";\n newWindow.style.height = height.toString() + \"px\";\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n return newWindow;\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n }, {\n key: \"CloseWindow\",\n value: function CloseWindow(window) {\n window.remove();\n }\n }, {\n key: \"CloseFocusedWindow\",\n value: function CloseFocusedWindow() {\n if (document.body.querySelector('#windows-layer').childElementCount > 1) {\n document.body.querySelector('#windows-layer').lastElementChild.remove();\n }\n }\n }], [{\n key: \"ChangeURL\",\n value: function ChangeURL(appWindow) {\n var appId = appWindow.getAttribute('appid');\n window.history.replaceState(null, \"\", \"/\".concat(appId, \"/\"));\n }\n\n /**\r\n * @param {num} length\r\n */\n }]);\n return DesktopDecorat;\n}();\nfunction _makeid2(length) {\n var result = '';\n var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var charactersLength = characters.length;\n var counter = 0;\n while (counter < length) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n counter += 1;\n }\n return result;\n}\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/decorat/desktop-decorat.js?"); + +/***/ }), + +/***/ "./src/wde/scrollbar/scrollbar.js": +/*!****************************************!*\ + !*** ./src/wde/scrollbar/scrollbar.js ***! + \****************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WdeScrollBar)\n/* harmony export */ });\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nvar WdeScrollBar = /*#__PURE__*/_createClass(\n/**\r\n* @param {HTMLElement} scrollBarContainer\r\n* @param {HTMLElement} content\r\n*/\nfunction WdeScrollBar(scrollBarContainer, content) {\n var _this = this;\n _classCallCheck(this, WdeScrollBar);\n var nonNativeScroll = false;\n // console.log(scrollBarContainer, content)\n // let handler = scrollBarContainer.children[0]\n //TODO On scroll move focus on window?\n var handler = scrollBarContainer.querySelector(\".ScrollBarScrollElement\"); //TODO Refactor classes\n // console.log(handler)\n\n handler.style.height = content.clientHeight / content.scrollHeight * handler.parentElement.clientHeight + 'px';\n var max = handler.parentElement.clientHeight - handler.clientHeight;\n var yPosInit = 0;\n handler.addEventListener('mousedown', function (event) {\n nonNativeScroll = true;\n yPosInit = event.clientY - Number(handler.style.top.replace('px', ''));\n document.addEventListener('mousemove', drag);\n document.addEventListener('mouseup', stop);\n });\n content.addEventListener('scroll', function (event) {\n if (!_this.nonNativeScroll) {\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n handler.style.top = content.scrollTop / coefficient + 'px';\n }\n });\n function drag() {\n // console.log(event.clientY - yPosInit, Number(handler.style.top.replace('px','' )))\n var pos = event.clientY - yPosInit;\n var clampPos = Math.min(Math.max(pos, 0), max);\n handler.style.top = clampPos + \"px\";\n var handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight; //TODO recalculate only on resize event\n var coefficient = (content.scrollHeight - content.clientHeight) / handlerPathLength;\n // console.log(clampPos, coefficient, content.clientHeight, clampPos* coefficient)\n\n content.scrollTop = clampPos * coefficient;\n }\n function stop() {\n // console.log(\"stop\")\n document.removeEventListener('mousemove', drag);\n document.removeEventListener('mouseup', stop);\n nonNativeScroll = false;\n }\n});\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/scrollbar/scrollbar.js?"); + +/***/ }), + +/***/ "./src/wde/wde-desktop.js": +/*!********************************!*\ + !*** ./src/wde/wde-desktop.js ***! + \********************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decorat/desktop-decorat.js */ \"./src/wde/decorat/desktop-decorat.js\");\n/* harmony import */ var _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scrollbar/scrollbar.js */ \"./src/wde/scrollbar/scrollbar.js\");\n/* harmony import */ var _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../web-fs/web-fs.js */ \"./src/web-fs/web-fs.js\");\n/* harmony import */ var _application_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./application.js */ \"./src/wde/application.js\");\n/* harmony import */ var _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./widgets/file-view/file-view.js */ \"./src/wde/widgets/file-view/file-view.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\n// import DesktopSunBoard from \"./sunboard/sunboard-desktop.js\";\nvar WebDesktopEnvironment = /*#__PURE__*/function () {\n /** @type {string} */\n\n /** @type {WDEFileView} */\n\n /** @type {WDEScrollBar} */\n\n /**@type {DesktopDecorat} */\n\n /** @type {Object} */\n\n /** Deprecated */\n\n // static decorat\n\n function WebDesktopEnvironment() {\n _classCallCheck(this, WebDesktopEnvironment);\n _defineProperty(this, \"test\", \"\");\n _defineProperty(this, \"FileView\", _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]);\n _defineProperty(this, \"ScrollBar\", _scrollbar_scrollbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n _defineProperty(this, \"Decorat\", void 0);\n document.body.style.setProperty('--zoom', 1);\n this.Decorat = new _decorat_desktop_decorat_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n WebDesktopEnvironment.webFs = new _web_fs_web_fs_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this.FileView = _widgets_file_view_file_view_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"];\n this.loadWDE();\n // this.#devLoadSunboard()\n }\n _createClass(WebDesktopEnvironment, [{\n key: \"loadWDE\",\n value: function () {\n var _loadWDE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var autoStart, _iterator, _step, child, appPath, args, argsRaw, _iterator2, _step2, argRaw, arg;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n autoStart = document.body.querySelector(\"wde-autostart\");\n if (!(autoStart == null)) {\n _context.next = 4;\n break;\n }\n WebDesktopEnvironment.Alert(\"Error in loading DE\");\n return _context.abrupt(\"return\");\n case 4:\n _iterator = _createForOfIteratorHelper(autoStart.children);\n _context.prev = 5;\n _iterator.s();\n case 7:\n if ((_step = _iterator.n()).done) {\n _context.next = 41;\n break;\n }\n child = _step.value;\n if (!(child.nodeName != \"APP\")) {\n _context.next = 11;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 11:\n appPath = child.getAttribute(\"app-path\");\n if (!(appPath == null)) {\n _context.next = 14;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 14:\n args = [];\n argsRaw = child.querySelector(\"args\");\n if (!(argsRaw == null)) {\n _context.next = 18;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 18:\n _iterator2 = _createForOfIteratorHelper(argsRaw.children);\n _context.prev = 19;\n _iterator2.s();\n case 21:\n if ((_step2 = _iterator2.n()).done) {\n _context.next = 29;\n break;\n }\n argRaw = _step2.value;\n arg = argRaw.getAttribute(\"string\");\n if (!(arg == null)) {\n _context.next = 26;\n break;\n }\n return _context.abrupt(\"continue\", 27);\n case 26:\n args.push(arg);\n case 27:\n _context.next = 21;\n break;\n case 29:\n _context.next = 34;\n break;\n case 31:\n _context.prev = 31;\n _context.t0 = _context[\"catch\"](19);\n _iterator2.e(_context.t0);\n case 34:\n _context.prev = 34;\n _iterator2.f();\n return _context.finish(34);\n case 37:\n _context.next = 39;\n return this.Open(appPath, args);\n case 39:\n _context.next = 7;\n break;\n case 41:\n _context.next = 46;\n break;\n case 43:\n _context.prev = 43;\n _context.t1 = _context[\"catch\"](5);\n _iterator.e(_context.t1);\n case 46:\n _context.prev = 46;\n _iterator.f();\n return _context.finish(46);\n case 49:\n autoStart.remove();\n case 50:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this, [[5, 43, 46, 49], [19, 31, 34, 37]]);\n }));\n function loadWDE() {\n return _loadWDE.apply(this, arguments);\n }\n return loadWDE;\n }()\n /**\r\n * @param {string} appPath\r\n * @param {string[]} args\r\n * @param {string} runPath\r\n */\n }, {\n key: \"Open\",\n value: function () {\n var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appPath, args, runPath) {\n var appManifest, runContext;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return WebDesktopEnvironment.fetchApp(appPath);\n case 2:\n appManifest = _context2.sent;\n if (!(appManifest === undefined)) {\n _context2.next = 5;\n break;\n }\n return _context2.abrupt(\"return\");\n case 5:\n //TODO return err\n /**@type {runContext} */\n runContext = {\n WDE: this,\n isMobile: false,\n bundlePath: appPath,\n runPath: runPath\n };\n if (WebDesktopEnvironment.Applications[appManifest.appId] === undefined) {\n WebDesktopEnvironment.load2(appManifest, function () {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n });\n } else {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n }\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function Open(_x, _x2, _x3) {\n return _Open.apply(this, arguments);\n }\n return Open;\n }()\n /**\r\n * @param {string} appManifest\r\n * @param {function} onload callback after script loading\r\n */\n }], [{\n key: \"load2\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(appManifest, onload) {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n // import(window.location.origin + appManifest.js[0]).then((app) => {\n // console.log(window.location.origin + appManifest.js[0] == 'http://localhost:8080/res/dev-fs/wde/dist/finder.js')\n // let kek = 'http://localhost:8080/res/dev-fs/wde/dist/finder.js'\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! http://localhost:8080/res/dev-fs/dist/finder.js */ \"http://localhost:8080/res/dev-fs/dist/finder.js\")).then(function (app) {\n var newApp = new app[\"default\"]();\n // if newApp //TODO Validate\n WebDesktopEnvironment.Applications[appManifest.appId] = newApp;\n onload();\n });\n return _context3.abrupt(\"return\");\n case 2:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function load2(_x4, _x5) {\n return _load.apply(this, arguments);\n }\n return load2;\n }()\n /**\r\n * @param {string} path\r\n * @returns {Object | undefined} //FIXME\r\n */\n }, {\n key: \"fetchApp\",\n value: function () {\n var _fetchApp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(path) {\n var params, response, error, appManifest;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n // console.log(\"path: \" + path )\n params = new URLSearchParams({\n path: path,\n mode: \"json\"\n });\n _context4.next = 3;\n return fetch(\"/system/loadApp?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 10;\n break;\n }\n _context4.next = 7;\n return response.json();\n case 7:\n error = _context4.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context4.abrupt(\"return\", undefined);\n case 10:\n //TODO Validate manifest\n appManifest = response.json();\n return _context4.abrupt(\"return\", appManifest);\n case 12:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function fetchApp(_x6) {\n return _fetchApp.apply(this, arguments);\n }\n return fetchApp;\n }()\n /**\r\n * @param {string} html\r\n */\n }, {\n key: \"SetBasicWindow\",\n value: function SetBasicWindow(html) {\n this.basicWindow = html;\n }\n\n /**\r\n * @returns {string}\r\n */\n }, {\n key: \"GetBasicWindow\",\n value: function GetBasicWindow() {\n return this.basicWindow;\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"Alert\",\n value: function Alert(alertText) {\n WebDesktopEnvironment.CreateAlertWindow(alertText);\n console.log(alertText);\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"CreateAlertWindow\",\n value: function CreateAlertWindow(alertText) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute(\"class\", \"WindowFrameless\");\n newWindow.setAttribute(\"windowId\", \"SuperUniqUUID\"); //TODO:\n newWindow.style.cssText = \"position:absolute;width:450px;height:116px; margin-left: -225px; margin-top:-58px;left: 50%;top: 50%;background-color:#FFFFFF;border: 1px solid #000000;box-shadow: 2px 2px 0px #000000;\";\n var alertImage = document.createElement(\"img\");\n alertImage.setAttribute(\"src\", \"/res/sys/wde/icons/ohno.png\");\n alertImage.style.cssText = \"position:absolute; width:64px;height:64px;top:15px;left:25px\";\n newWindow.appendChild(alertImage);\n var errorText = document.createElement(\"div\");\n errorText.style.cssText = \"position:absolute; width: 300px; left:128px; top:30px;font-family: 'Virtue';\";\n errorText.innerHTML = alertText;\n newWindow.appendChild(errorText);\n var closeButton = document.createElement(\"button\");\n closeButton.style.cssText = \"position:absolute; left: 382px; bottom: 10px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;\";\n closeButton.innerHTML = \"Close\";\n closeButton.addEventListener('click', function () {\n newWindow.remove();\n });\n newWindow.appendChild(closeButton);\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n }\n }]);\n return WebDesktopEnvironment;\n}();\n/**\r\n * @typedef {Object} runContext\r\n * @property {WebDesktopEnvironment} WDE \r\n * @property {boolean} isMobile\r\n * @property {string} appPath \r\n * @property {string} runPath //TODO\r\n*/\n_defineProperty(WebDesktopEnvironment, \"Applications\", {});\n_defineProperty(WebDesktopEnvironment, \"isMobile\", false);\n_defineProperty(WebDesktopEnvironment, \"webFs\", void 0);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde-desktop.js?"); + +/***/ }), + +/***/ "./src/wde/widgets/file-view/file-view.js": +/*!************************************************!*\ + !*** ./src/wde/widgets/file-view/file-view.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WDEFileView)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar WDEFileView = /*#__PURE__*/function () {\n /**\r\n * @param {HTMLElement} fileViewElem\r\n * @param {Function} doubleClickCallback\r\n * @param {Function} rightClickCallback\r\n * @param {Function} updateFileViewCallback\r\n */\n function WDEFileView(fileViewElem, doubleClickCallback, rightClickCallback, fileUploadCallback, updateFileViewCallback) {\n var _this = this;\n _classCallCheck(this, WDEFileView);\n _defineProperty(this, \"path\", \"\");\n _defineProperty(this, \"parentElem\", undefined);\n _defineProperty(this, \"selected\", []);\n //TODO check all params\n this.parentElem = fileViewElem;\n fileViewElem.addEventListener('click', function (event) {\n if (event.target.classList[0] == 'FileTileView') {\n _this.DeselectAll();\n return;\n }\n if (event.detail === 1) {\n _this.DeselectAll();\n _this.Select([event.target]);\n } else if (event.detail === 2) {\n doubleClickCallback(event);\n }\n });\n fileViewElem.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n if (event.target.classList.contains(\"Tile\")) {\n _this.DeselectAll();\n _this.Select([event.target]);\n }\n _this.Select([event.target]);\n rightClickCallback(event);\n });\n if (fileUploadCallback !== undefined) {\n var counter = 0;\n var draggedElem = undefined;\n fileViewElem.addEventListener('dragstart', function (event) {\n // console.log(event.target)\n // console.log(this.path)\n // draggedElem = event.target\n event.dataTransfer.setData(\"fileName\", event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"filePath\", _this.path + \"/\" + event.target.getAttribute(\"name\"));\n event.dataTransfer.setData(\"dropType\", \"move\");\n // console.log(updateFileViewCallback)\n // event.dataTransfer.setData(\"updateCallback\", updateFileViewCallback)\n // event.dataTransfer.setData(\"fileName\", )\n // console.log(draggedElem)\n });\n\n fileViewElem.addEventListener('dragenter', function (event) {\n event.preventDefault();\n counter++;\n fileViewElem.classList.add(\"DragDropBorder\");\n });\n fileViewElem.addEventListener('dragend', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // updateFileViewCallback()\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragleave', function (event) {\n // console.log(fileViewElem)\n event.preventDefault();\n counter--;\n if (counter === 0) {\n fileViewElem.classList.remove(\"DragDropBorder\");\n }\n // draggedElem = undefined\n });\n\n fileViewElem.addEventListener('dragover', function (event) {\n event.preventDefault();\n });\n fileViewElem.addEventListener(\"drop\", function (event) {\n event.preventDefault();\n fileUploadCallback(event);\n fileViewElem.classList.remove(\"DragDropBorder\");\n // updateFileViewCallback()\n // this.OpenFolder(this.path)\n // draggedElem = undefined\n });\n }\n }\n\n /** \r\n * @param {[]Element} elements\r\n */\n _createClass(WDEFileView, [{\n key: \"Select\",\n value: function Select(elements) {\n var _this2 = this;\n elements.forEach(function (element) {\n _this2.selected.push(element);\n element.classList.add(\"Selected\");\n });\n }\n }, {\n key: \"DeselectAll\",\n value: function DeselectAll() {\n this.selected.forEach(function (element) {\n element.classList.remove(\"Selected\");\n });\n this.selected = [];\n }\n\n /** Get html of folder by path\r\n * @param {string} path\r\n */\n }, {\n key: \"OpenFolder\",\n value: function () {\n var _OpenFolder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response, html;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.path = path;\n params = new URLSearchParams({\n path: path\n });\n _context.next = 4;\n return fetch(\"/system/wde/widgets/file-tile-view?\" + params);\n case 4:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 8;\n break;\n }\n //TODO Error text message\n WebDesktopEnvironment.Alert(\"TODO\");\n return _context.abrupt(\"return\");\n case 8:\n _context.next = 10;\n return response.text();\n case 10:\n html = _context.sent;\n this.parentElem.innerHTML = html;\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function OpenFolder(_x) {\n return _OpenFolder.apply(this, arguments);\n }\n return OpenFolder;\n }()\n }]);\n return WDEFileView;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/widgets/file-view/file-view.js?"); + +/***/ }), + +/***/ "./src/web-fs/web-fs.js": +/*!******************************!*\ + !*** ./src/web-fs/web-fs.js ***! + \******************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebFS)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nvar WebFS = /*#__PURE__*/function () {\n function WebFS() {\n _classCallCheck(this, WebFS);\n }\n _createClass(WebFS, null, [{\n key: \"CreateDirectory\",\n value:\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n function () {\n var _CreateDirectory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(path == undefined)) {\n _context.next = 3;\n break;\n }\n WebDesktopEnvironment.Alert(\"Path is undefined\");\n return _context.abrupt(\"return\", false);\n case 3:\n params = new URLSearchParams({\n path: \"\".concat(path, \"/New Directory\")\n });\n _context.next = 6;\n return fetch(\"/system/fs/createDir?\" + params);\n case 6:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 10;\n break;\n }\n WebDesktopEnvironment.Alert(\"DIRCTORY CREATION ERROR\"); //TODO\n return _context.abrupt(\"return\", false);\n case 10:\n return _context.abrupt(\"return\", true);\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n function CreateDirectory(_x) {\n return _CreateDirectory.apply(this, arguments);\n }\n return CreateDirectory;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"DeleteFile\",\n value: function () {\n var _DeleteFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n params = new URLSearchParams({\n path: path\n });\n _context2.next = 3;\n return fetch(\"/system/fs/delete?\" + params);\n case 3:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"DELETE ERROR\"); //TODO\n return _context2.abrupt(\"return\", false);\n case 7:\n return _context2.abrupt(\"return\", true);\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n function DeleteFile(_x2) {\n return _DeleteFile.apply(this, arguments);\n }\n return DeleteFile;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }, {\n key: \"MoveFile\",\n value: function () {\n var _MoveFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sourcePath, targetPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n targetPath: targetPath\n });\n _context3.next = 3;\n return fetch(\"/system/fs/move?\" + params);\n case 3:\n response = _context3.sent;\n if (!(response.status != 200)) {\n _context3.next = 6;\n break;\n }\n return _context3.abrupt(\"return\", false);\n case 6:\n return _context3.abrupt(\"return\", true);\n case 7:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function MoveFile(_x3, _x4) {\n return _MoveFile.apply(this, arguments);\n }\n return MoveFile;\n }()\n /**\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"ReadObjectLink\",\n value: function () {\n var _ReadObjectLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(linkPath) {\n var params, response, path;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context4.next = 3;\n return fetch(\"/system/fs/readObjectLink?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context4.abrupt(\"return\", \"\");\n case 7:\n _context4.next = 9;\n return response.text();\n case 9:\n path = _context4.sent;\n return _context4.abrupt(\"return\", path);\n case 11:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function ReadObjectLink(_x5) {\n return _ReadObjectLink.apply(this, arguments);\n }\n return ReadObjectLink;\n }()\n /**\r\n * @param {string} sourcePath\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"CreatePathLink\",\n value: function () {\n var _CreatePathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sourcePath, linkPath) {\n var params, response;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n params = new URLSearchParams({\n sourcePath: sourcePath,\n linkPath: linkPath\n });\n _context5.next = 3;\n return fetch(\"/system/fs/createPathLink?\" + params);\n case 3:\n response = _context5.sent;\n return _context5.abrupt(\"return\", response.status == 200);\n case 5:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5);\n }));\n function CreatePathLink(_x6, _x7) {\n return _CreatePathLink.apply(this, arguments);\n }\n return CreatePathLink;\n }()\n /**\r\n * @param {string} linkPath\r\n * @returns {string}\r\n */\n }, {\n key: \"ReadPathLink\",\n value: function () {\n var _ReadPathLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(linkPath) {\n var params, response, file;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n params = new URLSearchParams({\n linkPath: linkPath\n });\n _context6.next = 3;\n return fetch(\"/system/fs/readPathLink?\" + params);\n case 3:\n response = _context6.sent;\n if (!(response.status != 200)) {\n _context6.next = 7;\n break;\n }\n WebDesktopEnvironment.Alert(\"TODO\"); //TODO\n return _context6.abrupt(\"return\", \"\");\n case 7:\n _context6.next = 9;\n return response.json();\n case 9:\n file = _context6.sent;\n return _context6.abrupt(\"return\", file);\n case 11:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6);\n }));\n function ReadPathLink(_x8) {\n return _ReadPathLink.apply(this, arguments);\n }\n return ReadPathLink;\n }()\n /**\r\n * @param {File} file\r\n * @param {string} parentPath\r\n * @returns {boolean}\r\n */\n }, {\n key: \"UploadFile\",\n value: function () {\n var _UploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(file, parentPath) {\n var formData, params, response, error;\n return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n console.log('here');\n formData = new FormData();\n formData.append(\"file\", file); //FIXME Conn reset\n params = new URLSearchParams({\n parentPath: parentPath\n });\n _context7.next = 6;\n return fetch(\"/system/fs/upload?\" + params, {\n method: \"POST\",\n //TODO Change to PUT?\n body: formData\n });\n case 6:\n response = _context7.sent;\n console.log(response.status);\n if (!(response.status != 201)) {\n _context7.next = 14;\n break;\n }\n _context7.next = 11;\n return response.json();\n case 11:\n error = _context7.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context7.abrupt(\"return\", false);\n case 14:\n return _context7.abrupt(\"return\", true);\n case 15:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7);\n }));\n function UploadFile(_x9, _x10) {\n return _UploadFile.apply(this, arguments);\n }\n return UploadFile;\n }()\n }]);\n return WebFS;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/web-fs/web-fs.js?"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval devtool is used. +/******/ var __webpack_exports__ = __webpack_require__("./src/apps/finder/finder.js"); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/res/dev-fs/wde/dist/init.js b/res/dev-fs/wde/dist/init.js new file mode 100644 index 0000000..41de9bf --- /dev/null +++ b/res/dev-fs/wde/dist/init.js @@ -0,0 +1,14 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ +/******/ +/******/ })() +; \ No newline at end of file diff --git a/res/dev-fs/wde/dist/mobile.js b/res/dev-fs/wde/dist/mobile.js new file mode 100644 index 0000000..d78d6c0 --- /dev/null +++ b/res/dev-fs/wde/dist/mobile.js @@ -0,0 +1,49 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/mobile.js": +/*!***********************!*\ + !*** ./src/mobile.js ***! + \***********************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\nObject(function webpackMissingModule() { var e = new Error(\"Cannot find module './wde/wde-mobile'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }());\n\nrequire(\"./mobile.less\");\ndocument.addEventListener('DOMContentLoaded', function () {\n var wde = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module './wde/wde-mobile'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\n}, false);\n\n//# sourceURL=webpack://my-webpack-project/./src/mobile.js?"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The require scope +/******/ var __webpack_require__ = {}; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval devtool is used. +/******/ var __webpack_exports__ = {}; +/******/ __webpack_modules__["./src/mobile.js"](0, __webpack_exports__, __webpack_require__); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/templates/base/mobile-desktop.html b/templates/base/mobile-desktop.html index 7228ca9..0ae905d 100644 --- a/templates/base/mobile-desktop.html +++ b/templates/base/mobile-desktop.html @@ -11,8 +11,22 @@ // console.log(WebDesktopEnvironment) let kek = new WebDesktopEnvironment.default() -
+ +
+
+
+ +
Test
+
+
+ +
Test
+
+
+ +
Test
+
-
diff --git a/templates/sunboard/sunboard.html b/templates/sunboard/sunboard.html index f5da345..d11d860 100644 --- a/templates/sunboard/sunboard.html +++ b/templates/sunboard/sunboard.html @@ -1,6 +1,15 @@ {{ define "sunboard/sunboard.html" }} -
-
+
+
+ {{ range $appIcon := .AppsIcons }} +
+ + +
{{ $appIcon.Lable }}
+
+ {{ end }} +
+
{{ end }}