@intuitionrobotics/thunderstorm 0.41.67 → 0.41.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app-backend/api/v1/utils/version/_assert.js +1 -1
- package/app-backend/api/v1/utils/version/_assert.js.map +1 -1
- package/app-backend/api/v1/utils/version/assert.js +13 -58
- package/app-backend/api/v1/utils/version/assert.js.map +1 -1
- package/app-backend/core/BaseStorm.js +34 -87
- package/app-backend/core/BaseStorm.js.map +1 -1
- package/app-backend/core/Storm.js +42 -112
- package/app-backend/core/Storm.js.map +1 -1
- package/app-backend/exceptions.js +11 -27
- package/app-backend/exceptions.js.map +1 -1
- package/app-backend/modules/CleanupScheduler.js +24 -92
- package/app-backend/modules/CleanupScheduler.js.map +1 -1
- package/app-backend/modules/FirestoreBackupScheduler.js +47 -138
- package/app-backend/modules/FirestoreBackupScheduler.js.map +1 -1
- package/app-backend/modules/ForceUpgrade.js +31 -82
- package/app-backend/modules/ForceUpgrade.js.map +1 -1
- package/app-backend/modules/http/AxiosHttpModule.js +116 -184
- package/app-backend/modules/http/AxiosHttpModule.js.map +1 -1
- package/app-backend/modules/proxy/RemoteProxy.js +40 -90
- package/app-backend/modules/proxy/RemoteProxy.js.map +1 -1
- package/app-backend/modules/proxy/RemoteProxyCaller.js +49 -122
- package/app-backend/modules/proxy/RemoteProxyCaller.js.map +1 -1
- package/app-backend/modules/server/HttpServer.js +153 -216
- package/app-backend/modules/server/HttpServer.js.map +1 -1
- package/app-backend/modules/server/server-api.js +236 -361
- package/app-backend/modules/server/server-api.js.map +1 -1
- package/app-backend/modules/server/server-errors.js +51 -91
- package/app-backend/modules/server/server-errors.js.map +1 -1
- package/app-backend/utils/LogClient_File.js +23 -42
- package/app-backend/utils/LogClient_File.js.map +1 -1
- package/app-backend/utils/file.js +7 -50
- package/app-backend/utils/file.js.map +1 -1
- package/app-backend/utils/promisify-request.js +13 -43
- package/app-backend/utils/promisify-request.js.map +1 -1
- package/app-backend/utils/to-be-removed.js +7 -8
- package/app-backend/utils/to-be-removed.js.map +1 -1
- package/app-backend/utils/types.js +1 -1
- package/app-backend/utils/types.js.map +1 -1
- package/app-frontend/components/ActionButton.js +5 -5
- package/app-frontend/components/ActionButton.js.map +1 -1
- package/app-frontend/components/DropDown.js +91 -119
- package/app-frontend/components/DropDown.js.map +1 -1
- package/app-frontend/components/FilterInput.js +31 -48
- package/app-frontend/components/FilterInput.js.map +1 -1
- package/app-frontend/components/GenericSelect.js +30 -59
- package/app-frontend/components/GenericSelect.js.map +1 -1
- package/app-frontend/components/GenericTabs.js +5 -23
- package/app-frontend/components/GenericTabs.js.map +1 -1
- package/app-frontend/components/Overlay.js +15 -34
- package/app-frontend/components/Overlay.js.map +1 -1
- package/app-frontend/components/TS_Input.js +43 -60
- package/app-frontend/components/TS_Input.js.map +1 -1
- package/app-frontend/components/TS_Table.js +31 -48
- package/app-frontend/components/TS_Table.js.map +1 -1
- package/app-frontend/components/TS_TextArea.js +21 -48
- package/app-frontend/components/TS_TextArea.js.map +1 -1
- package/app-frontend/components/Tabs.js +16 -33
- package/app-frontend/components/Tabs.js.map +1 -1
- package/app-frontend/components/adapter/Adapter.js +103 -154
- package/app-frontend/components/adapter/Adapter.js.map +1 -1
- package/app-frontend/components/adapter/BaseRenderer.js +9 -32
- package/app-frontend/components/adapter/BaseRenderer.js.map +1 -1
- package/app-frontend/components/checkbox/TS_Checkbox.js +12 -29
- package/app-frontend/components/checkbox/TS_Checkbox.js.map +1 -1
- package/app-frontend/components/checkbox/TS_CheckboxField.js +16 -34
- package/app-frontend/components/checkbox/TS_CheckboxField.js.map +1 -1
- package/app-frontend/components/form/Form.js +21 -39
- package/app-frontend/components/form/Form.js.map +1 -1
- package/app-frontend/components/playground/Example_NewProps.js +25 -53
- package/app-frontend/components/playground/Example_NewProps.js.map +1 -1
- package/app-frontend/components/playground/Playground.js +21 -49
- package/app-frontend/components/playground/Playground.js.map +1 -1
- package/app-frontend/components/tree/MenuComponent.js +11 -27
- package/app-frontend/components/tree/MenuComponent.js.map +1 -1
- package/app-frontend/components/tree/MultiTypeAdaptor.js +16 -32
- package/app-frontend/components/tree/MultiTypeAdaptor.js.map +1 -1
- package/app-frontend/components/tree/SimpleTreeNodeRenderer.js +18 -52
- package/app-frontend/components/tree/SimpleTreeNodeRenderer.js.map +1 -1
- package/app-frontend/components/tree/Tree.js +142 -178
- package/app-frontend/components/tree/Tree.js.map +1 -1
- package/app-frontend/components/treeicons.js +5 -5
- package/app-frontend/components/treeicons.js.map +1 -1
- package/app-frontend/core/AbstractThunder.js +27 -43
- package/app-frontend/core/AbstractThunder.js.map +1 -1
- package/app-frontend/core/AppPage.js +16 -32
- package/app-frontend/core/AppPage.js.map +1 -1
- package/app-frontend/core/AppWrapper.js +9 -10
- package/app-frontend/core/AppWrapper.js.map +1 -1
- package/app-frontend/core/BaseComponent.js +62 -106
- package/app-frontend/core/BaseComponent.js.map +1 -1
- package/app-frontend/core/SimpleScriptInjector.js +12 -31
- package/app-frontend/core/SimpleScriptInjector.js.map +1 -1
- package/app-frontend/core/Thunder.js +32 -48
- package/app-frontend/core/Thunder.js.map +1 -1
- package/app-frontend/core/thunder-dispatcher.js +18 -67
- package/app-frontend/core/thunder-dispatcher.js.map +1 -1
- package/app-frontend/modules/ConnectivityModule.js +16 -32
- package/app-frontend/modules/ConnectivityModule.js.map +1 -1
- package/app-frontend/modules/ForceUpgrade.js +17 -33
- package/app-frontend/modules/ForceUpgrade.js.map +1 -1
- package/app-frontend/modules/HistoryModule.js +51 -79
- package/app-frontend/modules/HistoryModule.js.map +1 -1
- package/app-frontend/modules/ResourcesModule.js +12 -28
- package/app-frontend/modules/ResourcesModule.js.map +1 -1
- package/app-frontend/modules/StorageModule.js +47 -68
- package/app-frontend/modules/StorageModule.js.map +1 -1
- package/app-frontend/modules/ThunderstormModule.js +15 -31
- package/app-frontend/modules/ThunderstormModule.js.map +1 -1
- package/app-frontend/modules/component-loader/ReactEntryComponentInjector.js +24 -41
- package/app-frontend/modules/component-loader/ReactEntryComponentInjector.js.map +1 -1
- package/app-frontend/modules/component-loader/entry-component-loading-module.js +19 -36
- package/app-frontend/modules/component-loader/entry-component-loading-module.js.map +1 -1
- package/app-frontend/modules/dialog/Dialog.js +55 -96
- package/app-frontend/modules/dialog/Dialog.js.map +1 -1
- package/app-frontend/modules/dialog/DialogModule.js +48 -84
- package/app-frontend/modules/dialog/DialogModule.js.map +1 -1
- package/app-frontend/modules/http/HttpClient.js +46 -93
- package/app-frontend/modules/http/HttpClient.js.map +1 -1
- package/app-frontend/modules/http/XhrHttpModule.js +66 -88
- package/app-frontend/modules/http/XhrHttpModule.js.map +1 -1
- package/app-frontend/modules/locale/LocaleModule.js +23 -50
- package/app-frontend/modules/locale/LocaleModule.js.map +1 -1
- package/app-frontend/modules/menu/MenuAndButton.js +23 -40
- package/app-frontend/modules/menu/MenuAndButton.js.map +1 -1
- package/app-frontend/modules/menu/MenuModule.js +25 -42
- package/app-frontend/modules/menu/MenuModule.js.map +1 -1
- package/app-frontend/modules/menu/PopupMenu.js +37 -64
- package/app-frontend/modules/menu/PopupMenu.js.map +1 -1
- package/app-frontend/modules/routing/RoutingModule.js +47 -66
- package/app-frontend/modules/routing/RoutingModule.js.map +1 -1
- package/app-frontend/modules/routing/route.js +31 -33
- package/app-frontend/modules/routing/route.js.map +1 -1
- package/app-frontend/modules/toaster/BaseToaster.js +18 -36
- package/app-frontend/modules/toaster/BaseToaster.js.map +1 -1
- package/app-frontend/modules/toaster/Toaster.js +12 -38
- package/app-frontend/modules/toaster/Toaster.js.map +1 -1
- package/app-frontend/modules/toaster/ToasterModule.js +61 -88
- package/app-frontend/modules/toaster/ToasterModule.js.map +1 -1
- package/app-frontend/modules/tooltip/Tooltip.js +25 -52
- package/app-frontend/modules/tooltip/Tooltip.js.map +1 -1
- package/app-frontend/modules/tooltip/TooltipModule.js +32 -51
- package/app-frontend/modules/tooltip/TooltipModule.js.map +1 -1
- package/app-frontend/tools/KeyboardListener.js +24 -41
- package/app-frontend/tools/KeyboardListener.js.map +1 -1
- package/app-frontend/tools/Stylable.js +14 -28
- package/app-frontend/tools/Stylable.js.map +1 -1
- package/app-frontend/utils/tools.js +8 -8
- package/app-frontend/utils/tools.js.map +1 -1
- package/app-frontend/widgets/FieldEditor.js +16 -32
- package/app-frontend/widgets/FieldEditor.js.map +1 -1
- package/app-frontend/widgets/FieldEditorClick.js +32 -49
- package/app-frontend/widgets/FieldEditorClick.js.map +1 -1
- package/app-frontend/widgets/FieldEditorWithButtons.js +33 -49
- package/app-frontend/widgets/FieldEditorWithButtons.js.map +1 -1
- package/app-frontend/widgets/click-to-drag/ClickToDrag.js +25 -41
- package/app-frontend/widgets/click-to-drag/ClickToDrag.js.map +1 -1
- package/app-frontend/widgets/click-to-drag/OverlayWithDocumentListener.js +22 -38
- package/app-frontend/widgets/click-to-drag/OverlayWithDocumentListener.js.map +1 -1
- package/package.json +4 -4
- package/shared/BaseHttpModule.js +44 -64
- package/shared/BaseHttpModule.js.map +1 -1
- package/shared/BaseHttpRequest.js +122 -176
- package/shared/BaseHttpRequest.js.map +1 -1
- package/shared/request-types.js +4 -19
- package/shared/request-types.js.map +1 -1
- package/test-backend/StormTester.js +37 -90
- package/test-backend/StormTester.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClient.js","sourceRoot":"","sources":["../../../../src/main/app-frontend/modules/http/HttpClient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG
|
|
1
|
+
{"version":3,"file":"HttpClient.js","sourceRoot":"","sources":["../../../../src/main/app-frontend/modules/http/HttpClient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;AAEH,4DAGsC;AACtC,gCAGkB;AAClB,8CAI0B;AAEnB,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,MAAc,EAAE,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,EAAC,KAAK,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ACV,CAAC;QACF,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAErC,CAAC;IAED,GAAG,CAAC,IAAY,EAAE,IAAS,EAAE,OAAiB;QAC7C,MAAM,OAAO,GAAmB;YAC/B,OAAO,kCAAM,IAAI,CAAC,cAAc,KAAE,OAAO,GAAC;YAC1C,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE;YAC7B,IAAI;YACJ,MAAM,EAAE,cAAU,CAAC,GAAG;YACtB,IAAI,EAAE,IAAI;SACV,CAAC;QACF,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CAcD;AArFD,gCAqFC"}
|
|
@@ -1,39 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.XhrHttpModule = exports.XhrHttpModule_Class = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
5
|
+
const zlib_1 = require("zlib");
|
|
19
6
|
// noinspection TypeScriptPreferShortImport
|
|
20
|
-
|
|
7
|
+
const request_types_1 = require("../../../shared/request-types");
|
|
21
8
|
// noinspection TypeScriptPreferShortImport
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
XhrHttpModule_Class.prototype.init = function () {
|
|
30
|
-
_super.prototype.init.call(this);
|
|
31
|
-
var origin = this.config.origin;
|
|
9
|
+
const BaseHttpRequest_1 = require("../../../shared/BaseHttpRequest");
|
|
10
|
+
const BaseHttpModule_1 = require("../../../shared/BaseHttpModule");
|
|
11
|
+
class XhrHttpModule_Class extends BaseHttpModule_1.BaseHttpModule_Class {
|
|
12
|
+
init() {
|
|
13
|
+
super.init();
|
|
14
|
+
const origin = this.config.origin;
|
|
32
15
|
if (!origin)
|
|
33
16
|
throw new ts_common_1.BadImplementationException("Did you forget to set the origin config key for the HttpModule?");
|
|
34
17
|
this.origin = origin;
|
|
35
|
-
}
|
|
36
|
-
|
|
18
|
+
}
|
|
19
|
+
createRequest(method, key, data) {
|
|
37
20
|
return new XhrHttpRequest(key, data, this.shouldCompress())
|
|
38
21
|
.setOrigin(this.origin)
|
|
39
22
|
.setMethod(method)
|
|
@@ -42,37 +25,34 @@ var XhrHttpModule_Class = /** @class */ (function (_super) {
|
|
|
42
25
|
.setHandleRequestSuccess(this.handleRequestSuccess)
|
|
43
26
|
.setHandleRequestFailure(this.handleRequestFailure)
|
|
44
27
|
.setDefaultRequestHandler(this.processDefaultResponseHandlers);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
}(BaseHttpModule_1.BaseHttpModule_Class));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
48
30
|
exports.XhrHttpModule_Class = XhrHttpModule_Class;
|
|
49
31
|
exports.XhrHttpModule = new XhrHttpModule_Class();
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
_this.compress = shouldCompress === undefined ? true : shouldCompress;
|
|
55
|
-
return _this;
|
|
32
|
+
class XhrHttpRequest extends BaseHttpRequest_1.BaseHttpRequest {
|
|
33
|
+
constructor(requestKey, requestData, shouldCompress) {
|
|
34
|
+
super(requestKey, requestData);
|
|
35
|
+
this.compress = shouldCompress === undefined ? true : shouldCompress;
|
|
56
36
|
}
|
|
57
|
-
|
|
58
|
-
|
|
37
|
+
getStatus() {
|
|
38
|
+
const xhr = this.xhr;
|
|
59
39
|
if (!xhr)
|
|
60
40
|
throw new ts_common_1.BadImplementationException("No xhr object!");
|
|
61
41
|
return xhr.status;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
42
|
+
}
|
|
43
|
+
getResponse() {
|
|
44
|
+
const xhr = this.xhr;
|
|
65
45
|
if (!xhr)
|
|
66
46
|
throw new ts_common_1.BadImplementationException("No xhr object!");
|
|
67
47
|
return xhr.response;
|
|
68
|
-
}
|
|
69
|
-
|
|
48
|
+
}
|
|
49
|
+
abortImpl() {
|
|
70
50
|
var _a;
|
|
71
51
|
(_a = this.xhr) === null || _a === void 0 ? void 0 : _a.abort();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
52
|
+
}
|
|
53
|
+
getErrorResponse() {
|
|
54
|
+
const rawResponse = this.getResponse();
|
|
55
|
+
let response = undefined;
|
|
76
56
|
if (rawResponse) {
|
|
77
57
|
try {
|
|
78
58
|
response = rawResponse && this.asJson();
|
|
@@ -82,92 +62,90 @@ var XhrHttpRequest = /** @class */ (function (_super) {
|
|
|
82
62
|
}
|
|
83
63
|
}
|
|
84
64
|
return response;
|
|
85
|
-
}
|
|
86
|
-
|
|
65
|
+
}
|
|
66
|
+
prepareJsonBody(bodyObject) {
|
|
87
67
|
return JSON.stringify(bodyObject);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
var _this = this;
|
|
68
|
+
}
|
|
69
|
+
executeImpl() {
|
|
91
70
|
//loop through whatever preprocessor
|
|
92
|
-
return new Promise(
|
|
93
|
-
if (
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
if (this.aborted)
|
|
94
73
|
return resolve();
|
|
95
|
-
|
|
74
|
+
const xhr = new XMLHttpRequest();
|
|
96
75
|
// @ts-ignore
|
|
97
76
|
// noinspection JSConstantReassignment
|
|
98
|
-
|
|
99
|
-
|
|
77
|
+
this.xhr = xhr;
|
|
78
|
+
this.xhr.onreadystatechange = () => {
|
|
100
79
|
if (xhr.readyState !== 4)
|
|
101
80
|
return;
|
|
102
81
|
resolve();
|
|
103
82
|
};
|
|
104
|
-
|
|
83
|
+
this.xhr.onerror = (err) => {
|
|
105
84
|
if (xhr.readyState === 4 && xhr.status === 0) {
|
|
106
|
-
reject(new request_types_1.HttpException(404,
|
|
85
|
+
reject(new request_types_1.HttpException(404, this.url));
|
|
107
86
|
return;
|
|
108
87
|
}
|
|
109
88
|
reject(err);
|
|
110
89
|
};
|
|
111
|
-
|
|
90
|
+
this.xhr.ontimeout = (err) => {
|
|
112
91
|
reject(err);
|
|
113
92
|
};
|
|
114
|
-
|
|
93
|
+
this.xhr.onload = (err) => {
|
|
115
94
|
// HttpModule.logVerbose("onload");
|
|
116
95
|
};
|
|
117
|
-
|
|
96
|
+
this.xhr.onloadstart = (err) => {
|
|
118
97
|
// HttpModule.logVerbose("onloadstart");
|
|
119
98
|
};
|
|
120
|
-
|
|
99
|
+
this.xhr.onloadend = (err) => {
|
|
121
100
|
// HttpModule.logVerbose("onloadend");
|
|
122
101
|
};
|
|
123
|
-
|
|
102
|
+
this.xhr.onabort = (err) => {
|
|
124
103
|
// HttpModule.logVerbose("onabort");
|
|
125
104
|
};
|
|
126
|
-
|
|
127
|
-
if (
|
|
105
|
+
let nextOperator = "?";
|
|
106
|
+
if (this.url.indexOf("?") !== -1) {
|
|
128
107
|
nextOperator = "&";
|
|
129
108
|
}
|
|
130
|
-
|
|
131
|
-
|
|
109
|
+
const fullUrl = Object.keys(this.params).reduce((url, paramKey) => {
|
|
110
|
+
const param = this.params[paramKey];
|
|
132
111
|
if (!param)
|
|
133
112
|
return url;
|
|
134
|
-
|
|
113
|
+
const toRet = `${url}${nextOperator}${paramKey}=${encodeURIComponent(param)}`;
|
|
135
114
|
nextOperator = "&";
|
|
136
115
|
return toRet;
|
|
137
|
-
},
|
|
116
|
+
}, this.url);
|
|
138
117
|
// TODO: investigate which one should work
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
Object.keys(
|
|
144
|
-
xhr.setRequestHeader(key,
|
|
118
|
+
this.xhr.onprogress = this.onProgressListener;
|
|
119
|
+
this.xhr.upload.onprogress = this.onProgressListener;
|
|
120
|
+
this.xhr.open(this.method, fullUrl);
|
|
121
|
+
this.xhr.timeout = this.timeout;
|
|
122
|
+
Object.keys(this.headers).forEach((key) => {
|
|
123
|
+
xhr.setRequestHeader(key, this.headers[key].join("; "));
|
|
145
124
|
});
|
|
146
|
-
|
|
147
|
-
if (typeof body === 'string' &&
|
|
125
|
+
let body = this.body;
|
|
126
|
+
if (typeof body === 'string' && this.compress)
|
|
148
127
|
try {
|
|
149
|
-
body = zlib_1.gzipSync(
|
|
128
|
+
body = zlib_1.gzipSync(this.body);
|
|
150
129
|
}
|
|
151
130
|
catch (error) {
|
|
152
131
|
return reject(error);
|
|
153
132
|
}
|
|
154
|
-
return
|
|
133
|
+
return this.xhr.send(body);
|
|
155
134
|
});
|
|
156
|
-
}
|
|
157
|
-
|
|
135
|
+
}
|
|
136
|
+
getResponseHeader(headerKey) {
|
|
158
137
|
if (!this.xhr)
|
|
159
138
|
throw new ts_common_1.BadImplementationException("No xhr object!");
|
|
160
139
|
if (!this.xhr.response)
|
|
161
|
-
throw new ts_common_1.BadImplementationException(
|
|
140
|
+
throw new ts_common_1.BadImplementationException(`xhr didn't return yet`);
|
|
162
141
|
// Chrome bug, if the response header is not present then it throws an error (not really problematic but just annoying)
|
|
163
142
|
// https://trackjs.com/blog/refused-unsafe-header/
|
|
164
143
|
if (this.xhr.getAllResponseHeaders().indexOf(headerKey) < 0)
|
|
165
144
|
return undefined;
|
|
166
|
-
|
|
145
|
+
const header = this.xhr.getResponseHeader(headerKey);
|
|
167
146
|
if (!header)
|
|
168
147
|
return undefined;
|
|
169
148
|
return header;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
}(BaseHttpRequest_1.BaseHttpRequest));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
173
151
|
//# sourceMappingURL=XhrHttpModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XhrHttpModule.js","sourceRoot":"","sources":["../../../../src/main/app-frontend/modules/http/XhrHttpModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"XhrHttpModule.js","sourceRoot":"","sources":["../../../../src/main/app-frontend/modules/http/XhrHttpModule.ts"],"names":[],"mappings":";;;AA4BA,4DAAwE;AACxE,+BAA8B;AAC9B,2CAA2C;AAC3C,iEAA4D;AAC5D,2CAA2C;AAC3C,qEAAgE;AAChE,mEAGwC;AAExC,MAAa,mBACZ,SAAQ,qCAAoB;IAE5B,IAAI;QACH,KAAK,CAAC,IAAI,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAClC,IAAI,CAAC,MAAM;YACV,MAAM,IAAI,sCAA0B,CAAC,iEAAiE,CAAC,CAAC;QAEzG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED,aAAa,CAAmD,MAAkB,EAAE,GAAW,EAAE,IAAa;QAC7G,OAAO,IAAI,cAAc,CAA2B,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC;aACnF,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;aACtB,SAAS,CAAC,MAAM,CAAC;aACjB,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;aACxB,UAAU,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;aACpC,uBAAuB,CAAC,IAAI,CAAC,oBAAoB,CAAC;aAClD,uBAAuB,CAAC,IAAI,CAAC,oBAAoB,CAAC;aAClD,wBAAwB,CAAC,IAAI,C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AAI,CAAC;YAC1B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ;gBAC5C,IAAI;oBACH,IAAI,GAAG,eAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBAC3B;gBAAC,OAAO,KAAK,EAAE;oBACf,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;iBACrB;YAEF,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,SAAiB;QAClC,IAAI,CAAC,IAAI,CAAC,GAAG;YACZ,MAAM,IAAI,sCAA0B,CAAC,gBAAgB,CAAC,CAAC;QAExD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ;YACrB,MAAM,IAAI,sCAA0B,CAAC,uBAAuB,CAAC,CAAC;QAE/D,uHAAuH;QACvH,kDAAkD;QAClD,IAAI,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC;YAC1D,OAAO,SAAS,CAAC;QAElB,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QACrD,IAAI,CAAC,MAAM;YACV,OAAO,SAAS,CAAC;QAElB,OAAO,MAAM,CAAC;IACf,CAAC;CACD"}
|
|
@@ -19,72 +19,45 @@
|
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
|
-
var __extends = (this && this.__extends) || (function () {
|
|
23
|
-
var extendStatics = function (d, b) {
|
|
24
|
-
extendStatics = Object.setPrototypeOf ||
|
|
25
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
26
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
27
|
-
return extendStatics(d, b);
|
|
28
|
-
};
|
|
29
|
-
return function (d, b) {
|
|
30
|
-
extendStatics(d, b);
|
|
31
|
-
function __() { this.constructor = d; }
|
|
32
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
36
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
37
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
38
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
39
|
-
r[k] = a[j];
|
|
40
|
-
return r;
|
|
41
|
-
};
|
|
42
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
23
|
exports.LocaleModule = exports.LocaleModule_Class = void 0;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
_this.selectedLanguage = new StorageModule_1.StorageKey("locale--selected-language");
|
|
54
|
-
return _this;
|
|
24
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
25
|
+
const util_1 = require("util");
|
|
26
|
+
const thunder_dispatcher_1 = require("../../core/thunder-dispatcher");
|
|
27
|
+
const StorageModule_1 = require("../StorageModule");
|
|
28
|
+
const dispatch_onLanguageChanged = new thunder_dispatcher_1.ThunderDispatcher("__onLanguageChanged");
|
|
29
|
+
class LocaleModule_Class extends ts_common_1.Module {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.selectedLanguage = new StorageModule_1.StorageKey("locale--selected-language");
|
|
55
33
|
}
|
|
56
|
-
|
|
57
|
-
|
|
34
|
+
init() {
|
|
35
|
+
const defaultLocale = this.selectedLanguage.get() || this.config.defaultLocale;
|
|
58
36
|
if (!defaultLocale)
|
|
59
37
|
throw new ts_common_1.ImplementationMissingException("MUST set defaultLocale in the config data");
|
|
60
38
|
this.defaultLocale = this.setLanguage(defaultLocale);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
39
|
+
}
|
|
40
|
+
setLanguage(locale) {
|
|
41
|
+
const localeDef = this.config.locales.find(_locale => _locale.locale === locale);
|
|
64
42
|
if (!localeDef)
|
|
65
|
-
throw new ts_common_1.ImplementationMissingException(
|
|
43
|
+
throw new ts_common_1.ImplementationMissingException(`Unsupported language: ${locale}`);
|
|
66
44
|
this.activeLocale = localeDef;
|
|
67
45
|
dispatch_onLanguageChanged.dispatchUI([]);
|
|
68
46
|
this.selectedLanguage.set(localeDef.locale);
|
|
69
47
|
return localeDef;
|
|
70
|
-
}
|
|
71
|
-
|
|
48
|
+
}
|
|
49
|
+
getAvailableLanguages() {
|
|
72
50
|
return this.config.locales;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
77
|
-
params[_i - 1] = arguments[_i];
|
|
78
|
-
}
|
|
79
|
-
var text = this.activeLocale.texts[key];
|
|
51
|
+
}
|
|
52
|
+
get(key, ...params) {
|
|
53
|
+
let text = this.activeLocale.texts[key];
|
|
80
54
|
if (!text)
|
|
81
55
|
text = this.defaultLocale.texts[key];
|
|
82
56
|
if (!text)
|
|
83
57
|
return key;
|
|
84
|
-
return util_1.format
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
}(ts_common_1.Module));
|
|
58
|
+
return util_1.format(text, ...params);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
88
61
|
exports.LocaleModule_Class = LocaleModule_Class;
|
|
89
62
|
exports.LocaleModule = new LocaleModule_Class();
|
|
90
63
|
//# sourceMappingURL=LocaleModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocaleModule.js","sourceRoot":"","sources":["../../../../src/main/app-frontend/modules/locale/LocaleModule.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;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Ac,EAAE,GAAG,MAAa;QAC1C,IAAI,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAExC,IAAI,CAAC,IAAI;YACR,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEtC,IAAI,CAAC,IAAI;YACR,OAAO,GAAG,CAAC;QAEZ,OAAO,aAAM,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,CAAC;IAChC,CAAC;CACD;AAzCD,gDAyCC;AAEY,QAAA,YAAY,GAAG,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,57 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.MenuAndButton = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_this.state = {
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const BaseComponent_1 = require("../../core/BaseComponent");
|
|
6
|
+
const MenuModule_1 = require("./MenuModule");
|
|
7
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
8
|
+
class MenuAndButton extends BaseComponent_1.BaseComponent {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.ref = React.createRef();
|
|
12
|
+
this.state = {
|
|
27
13
|
isOpen: false,
|
|
28
14
|
over: false
|
|
29
15
|
};
|
|
30
|
-
|
|
31
|
-
if (
|
|
16
|
+
this.__onMenuHide = (id) => {
|
|
17
|
+
if (this.props.id !== id)
|
|
32
18
|
return;
|
|
33
|
-
|
|
19
|
+
this.setState({ isOpen: false });
|
|
34
20
|
};
|
|
35
|
-
|
|
36
|
-
if (
|
|
21
|
+
this.__onMenuDisplay = (menu) => {
|
|
22
|
+
if (this.props.id !== menu.id)
|
|
37
23
|
return;
|
|
38
|
-
|
|
24
|
+
this.setState({ isOpen: true });
|
|
39
25
|
};
|
|
40
|
-
|
|
41
|
-
if (!
|
|
26
|
+
this.open = () => {
|
|
27
|
+
if (!this.ref.current)
|
|
42
28
|
throw new ts_common_1.BadImplementationException("Could not find image reference");
|
|
43
|
-
new MenuModule_1.MenuBuilder(
|
|
44
|
-
.setId(
|
|
29
|
+
new MenuModule_1.MenuBuilder(this.props.adapter, this.props.resolvePosition ? this.props.resolvePosition(this.ref.current) : MenuModule_1.resolveRealPosition(this.ref.current), this.props.css && this.props.css)
|
|
30
|
+
.setId(this.props.id)
|
|
45
31
|
.show();
|
|
46
32
|
};
|
|
47
|
-
return _this;
|
|
48
33
|
}
|
|
49
|
-
|
|
50
|
-
var _this = this;
|
|
34
|
+
render() {
|
|
51
35
|
return React.createElement("div", { className: 'clickable', onClick: this.open, style: { position: "relative" } },
|
|
52
|
-
React.createElement("div", { ref: this.ref, onMouseOver:
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}(BaseComponent_1.BaseComponent));
|
|
36
|
+
React.createElement("div", { ref: this.ref, onMouseOver: e => this.setState({ over: true }), onMouseOut: e => this.setState({ over: false }) }, this.state.isOpen || this.state.over ? this.props.iconClosed : this.props.iconOpen));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
56
39
|
exports.MenuAndButton = MenuAndButton;
|
|
57
40
|
//# sourceMappingURL=MenuAndButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuAndButton.js","sourceRoot":"","sources":["../../../../src/main/app-frontend/modules/menu/MenuAndButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MenuAndButton.js","sourceRoot":"","sources":["../../../../src/main/app-frontend/modules/menu/MenuAndButton.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAK/B,4DAAuD;AACvD,6CAMsB;AACtB,4DAAwE;AAaxE,MAAa,aACZ,SAAQ,6BAAwD;IADjE;;QAIC,QAAG,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAE1C,UAAK,GAAG;YACP,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,KAAK;SACX,CAAC;QAEF,iBAAY,GAAG,CAAC,EAAU,EAAE,EAAE;YAC7B,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE;gBACvB,OAAO;YAER,IAAI,CAAC,QAAQ,CAAC,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC;QAChC,CAAC,CAAC;QAEF,oBAAe,GAAG,CAAC,IAAgB,EAAE,EAAE;YACtC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE;gBAC5B,OAAO;YAER,IAAI,CAAC,QAAQ,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;QAC/B,CAAC,CAAC;QAiBF,SAAI,GAAG,GAAG,EAAE;YACX,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO;gBACpB,MAAM,IAAI,sCAA0B,CAAC,gCAAgC,CAAC,CAAC;YAExE,IAAI,wBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,gCAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;iBACtL,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;iBACpB,IAAI,EAAE,CAAA;QACT,CAAC,CAAA;IACF,CAAC;IAvBA,MAAM;QACL,OAAO,6BACN,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,IAAI,CAAC,IAAI,EAClB,KAAK,EAAE,EAAC,QAAQ,EAAE,UAAU,EAAC;YAC7B,6BAAK,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC,EAC7C,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC,IAChD,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAC9E,CACD,CAAA;IACP,CAAC;CAYD;AAhDD,sCAgDC"}
|
|
@@ -1,51 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.MenuBuilder = exports.MenuModule = exports.MenuModule_Class = exports.resolveRealPosition = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
5
|
+
const thunder_dispatcher_1 = require("../../core/thunder-dispatcher");
|
|
6
|
+
const resolveRealPosition = (button) => {
|
|
7
|
+
const pos = button.getBoundingClientRect();
|
|
21
8
|
return { top: pos.top + button.offsetHeight, left: pos.left };
|
|
22
9
|
};
|
|
23
10
|
exports.resolveRealPosition = resolveRealPosition;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
_this.showMenu.dispatchUI([model]);
|
|
11
|
+
class MenuModule_Class extends ts_common_1.Module {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.showMenu = new thunder_dispatcher_1.ThunderDispatcher("__onMenuDisplay");
|
|
15
|
+
this.hideMenu = new thunder_dispatcher_1.ThunderDispatcher("__onMenuHide");
|
|
16
|
+
this.show = (model) => {
|
|
17
|
+
this.showMenu.dispatchUI([model]);
|
|
32
18
|
};
|
|
33
|
-
|
|
34
|
-
return _this;
|
|
19
|
+
this.hide = (id) => this.hideMenu.dispatchUI([id]);
|
|
35
20
|
}
|
|
36
|
-
|
|
37
|
-
}(ts_common_1.Module));
|
|
21
|
+
}
|
|
38
22
|
exports.MenuModule_Class = MenuModule_Class;
|
|
39
23
|
exports.MenuModule = new MenuModule_Class();
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
class MenuBuilder {
|
|
25
|
+
constructor(menu, position, cssContainer) {
|
|
42
26
|
this.id = ts_common_1.generateHex(8);
|
|
43
27
|
this.adapter = menu;
|
|
44
28
|
this.position = position;
|
|
45
29
|
this.cssContainer = cssContainer;
|
|
46
30
|
}
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
show() {
|
|
32
|
+
const model = {
|
|
49
33
|
id: this.id,
|
|
50
34
|
adapter: this.adapter,
|
|
51
35
|
pos: this.position,
|
|
@@ -54,21 +38,20 @@ var MenuBuilder = /** @class */ (function () {
|
|
|
54
38
|
css: this.cssContainer
|
|
55
39
|
};
|
|
56
40
|
exports.MenuModule.show(model);
|
|
57
|
-
}
|
|
41
|
+
}
|
|
58
42
|
;
|
|
59
|
-
|
|
43
|
+
setId(id) {
|
|
60
44
|
this.id = id;
|
|
61
45
|
return this;
|
|
62
|
-
}
|
|
63
|
-
|
|
46
|
+
}
|
|
47
|
+
setOnClick(func) {
|
|
64
48
|
this.onNodeClicked = func;
|
|
65
49
|
return this;
|
|
66
|
-
}
|
|
67
|
-
|
|
50
|
+
}
|
|
51
|
+
setOnDoubleClick(func) {
|
|
68
52
|
this.onNodeDoubleClicked = func;
|
|
69
53
|
return this;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
}());
|
|
54
|
+
}
|
|
55
|
+
}
|
|
73
56
|
exports.MenuBuilder = MenuBuilder;
|
|
74
57
|
//# sourceMappingURL=MenuModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuModule.js","sourceRoot":"","sources":["../../../../src/main/app-frontend/modules/menu/MenuModule.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MenuModule.js","sourceRoot":"","sources":["../../../../src/main/app-frontend/modules/menu/MenuModule.tsx"],"names":[],"mappings":";;;AAAA,4DAGsC;AAItC,sEAAgE;AAQzD,MAAM,mBAAmB,GAAG,CAAC,MAAwB,EAAgB,EAAE;IAC7E,MAAM,GAAG,GAAG,MAAM,C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