@roomle/web-sdk 3.4.0 → 3.5.0-alpha.2
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/lib/{BufferGeometry-Br8QIDeK.mjs → BufferGeometry-zhwL66xZ.mjs} +170 -178
- package/lib/BufferGeometry-zhwL66xZ.mjs.map +1 -0
- package/lib/ConfiguratorKernel.wasm +0 -0
- package/lib/{GLTFExporter-DUjuGznV.mjs → GLTFExporter-DmFnAzRr.mjs} +24 -24
- package/lib/GLTFExporter-DmFnAzRr.mjs.map +1 -0
- package/lib/{PointLightHelper-_pWwb-rd.mjs → PointLightHelper-SLT01bR2.mjs} +19 -19
- package/lib/PointLightHelper-SLT01bR2.mjs.map +1 -0
- package/lib/RoomleCore.wasm +0 -0
- package/lib/RoomleToolsCore.wasm +0 -0
- package/lib/{SpotLightHelper-DiuKfHVi.mjs → SpotLightHelper-CC4_xqY4.mjs} +24 -24
- package/lib/SpotLightHelper-CC4_xqY4.mjs.map +1 -0
- package/lib/USDZExporter-Cpnpkq95.mjs +545 -0
- package/lib/USDZExporter-Cpnpkq95.mjs.map +1 -0
- package/lib/{banana-for-scale-Bio4mpMQ.mjs → banana-for-scale-evc4Yb9f.mjs} +2 -2
- package/lib/{banana-for-scale-Bio4mpMQ.mjs.map → banana-for-scale-evc4Yb9f.mjs.map} +1 -1
- package/lib/component-dimensioning-Dvorqw_7.mjs +229 -0
- package/lib/component-dimensioning-Dvorqw_7.mjs.map +1 -0
- package/lib/{continuous-drawing-helper-BYjzGaWD.mjs → continuous-drawing-helper-BfZl8h5N.mjs} +2 -2
- package/lib/{continuous-drawing-helper-BYjzGaWD.mjs.map → continuous-drawing-helper-BfZl8h5N.mjs.map} +1 -1
- package/lib/homag-intelligence-CJgnNjgW.mjs +547 -0
- package/lib/homag-intelligence-CJgnNjgW.mjs.map +1 -0
- package/lib/{imos-ix-poc-export-helper-Bl13RKd1.mjs → imos-ix-poc-export-helper--y8HNzbW.mjs} +2 -2
- package/lib/{imos-ix-poc-export-helper-Bl13RKd1.mjs.map → imos-ix-poc-export-helper--y8HNzbW.mjs.map} +1 -1
- package/lib/{index-DYoZpNEJ.mjs → index-E00NytVZ.mjs} +18423 -15546
- package/lib/index-E00NytVZ.mjs.map +1 -0
- package/lib/{material-viewer-DqZ9kv7j.mjs → material-viewer-DdvFNwKG.mjs} +2 -2
- package/lib/{material-viewer-DqZ9kv7j.mjs.map → material-viewer-DdvFNwKG.mjs.map} +1 -1
- package/lib/roomle-sdk.d.ts +46 -14
- package/lib/roomle-sdk.js +22 -22
- package/lib/static/roomle-core-hsc/ConfiguratorKernel.wasm +0 -0
- package/lib/static/roomle-core-hsc/RoomleCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/RoomleServiceCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/RoomleToolsCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.d.ts +8 -4
- package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.js +6 -2
- package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.js.map +1 -1
- package/lib/static/roomle-core-hsc/package.json +1 -1
- package/lib/static/roomle-core-hsc/plannerCoreInterface.d.ts +8 -4
- package/lib/static/roomle-core-hsc/plannerCoreInterface.js +6 -2
- package/lib/static/roomle-core-hsc/plannerCoreInterface.js.map +1 -1
- package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.d.ts +8 -4
- package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.js +6 -2
- package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.js.map +1 -1
- package/lib/static/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
- package/lib/static/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/wasm_modern/RoomleServiceCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
- package/lib/{stats-helper-BedaceYL.mjs → stats-helper-NaTxB7Fu.mjs} +2 -2
- package/lib/{stats-helper-BedaceYL.mjs.map → stats-helper-NaTxB7Fu.mjs.map} +1 -1
- package/lib/{three.webgpu-Bk8XgilA.mjs → three.webgpu-DN1k7B0u.mjs} +7222 -4815
- package/lib/three.webgpu-DN1k7B0u.mjs.map +1 -0
- package/lib/{tools-core-D1vOTlAR.mjs → tools-core-By95pE-u.mjs} +2 -2
- package/lib/{tools-core-D1vOTlAR.mjs.map → tools-core-By95pE-u.mjs.map} +1 -1
- package/package.json +3 -3
- package/lib/BufferGeometry-Br8QIDeK.mjs.map +0 -1
- package/lib/GLTFExporter-DUjuGznV.mjs.map +0 -1
- package/lib/PointLightHelper-_pWwb-rd.mjs.map +0 -1
- package/lib/SpotLightHelper-DiuKfHVi.mjs.map +0 -1
- package/lib/USDZExporter-B9ygWQMw.mjs +0 -545
- package/lib/USDZExporter-B9ygWQMw.mjs.map +0 -1
- package/lib/component-dimensioning-Bar2YYNs.mjs +0 -148
- package/lib/component-dimensioning-Bar2YYNs.mjs.map +0 -1
- package/lib/homag-intelligence-Bb8gfi80.mjs +0 -1626
- package/lib/homag-intelligence-Bb8gfi80.mjs.map +0 -1
- package/lib/index-DYoZpNEJ.mjs.map +0 -1
- package/lib/three.webgpu-Bk8XgilA.mjs.map +0 -1
|
@@ -1,1626 +0,0 @@
|
|
|
1
|
-
import { A as _, J as g, K as R, N as w, O as I, Q as M, V as P } from "./index-DYoZpNEJ.mjs";
|
|
2
|
-
class O {
|
|
3
|
-
}
|
|
4
|
-
const f = {
|
|
5
|
-
HIDE: "hide",
|
|
6
|
-
SHOW_ATTRIBUTES: "attributes",
|
|
7
|
-
SHOW_ARTICLES: "articles"
|
|
8
|
-
}, b = {
|
|
9
|
-
NONE: "none",
|
|
10
|
-
GROUP: "group",
|
|
11
|
-
ROOT_MODULE: "rootModule",
|
|
12
|
-
SUB_MODULE: "subModule"
|
|
13
|
-
}, y = {
|
|
14
|
-
MULTI_SELECT: "multiselect",
|
|
15
|
-
TC_CONFIG: "tc-config",
|
|
16
|
-
RML_OBJECT: "rml-object"
|
|
17
|
-
};
|
|
18
|
-
class C {
|
|
19
|
-
constructor(t) {
|
|
20
|
-
this._callbacks = null, this._contextType = _.PLANNER, this._selectionMode = null, this._hiSelection = {
|
|
21
|
-
type: b.NONE,
|
|
22
|
-
groupId: null,
|
|
23
|
-
rootModuleId: null,
|
|
24
|
-
subModuleId: null
|
|
25
|
-
}, this._emittedSelection = {
|
|
26
|
-
panel: null,
|
|
27
|
-
groupId: null,
|
|
28
|
-
rootModuleId: null,
|
|
29
|
-
subModuleId: null
|
|
30
|
-
}, this._callbacks = t;
|
|
31
|
-
}
|
|
32
|
-
setSidebar(t) {
|
|
33
|
-
if (t !== "productSettings") {
|
|
34
|
-
if (t === "catalog") {
|
|
35
|
-
this._emitSelectionChange(f.SHOW_ARTICLES);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
this._emitSelectionChange(f.HIDE);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
contextChanged(t) {
|
|
42
|
-
this._contextType = t, t === _.PLANNER && this._resetSelection(), this._handleViewTypeChange();
|
|
43
|
-
}
|
|
44
|
-
groupOrModuleSelected(t, e, o) {
|
|
45
|
-
this._selectionMode = y.TC_CONFIG, this._hiSelection.groupId = t, this._hiSelection.rootModuleId = e ?? null, this._hiSelection.subModuleId = o ?? null, this._hiSelection.rootModuleId && this._hiSelection.subModuleId ? this._hiSelection.type = b.SUB_MODULE : this._hiSelection.rootModuleId ? this._hiSelection.type = b.ROOT_MODULE : this._hiSelection.type = b.GROUP, this._handleViewTypeChange();
|
|
46
|
-
}
|
|
47
|
-
componentSelectionCancel(t) {
|
|
48
|
-
this._contextType === _.CONFIGURATOR && (t === "click_outside" || t === "dock_preview" || t === "isolation_mode_cancelled" || t === "select_other" || (this._resetSelection(), this._handleViewTypeChange()));
|
|
49
|
-
}
|
|
50
|
-
selectionCancel(t) {
|
|
51
|
-
t !== "select_other" && (this._resetSelection(), this._handleViewTypeChange());
|
|
52
|
-
}
|
|
53
|
-
selectionChanged(t, e, o, r, s) {
|
|
54
|
-
this._selectionHandler(
|
|
55
|
-
_.PLANNER,
|
|
56
|
-
t,
|
|
57
|
-
e,
|
|
58
|
-
o
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
_resetSelection() {
|
|
62
|
-
this._selectionMode = null;
|
|
63
|
-
}
|
|
64
|
-
_selectionHandler(t, e, o, r) {
|
|
65
|
-
if (t !== _.CONFIGURATOR) {
|
|
66
|
-
if (e === y.MULTI_SELECT) {
|
|
67
|
-
this._selectionMode = e, this._handleViewTypeChange();
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
o === "external-configuration" && r.externalConfigurationType === y.TC_CONFIG ? this._selectionMode = y.TC_CONFIG : this._selectionMode = y.RML_OBJECT, this._handleViewTypeChange();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
_handleViewTypeChange() {
|
|
74
|
-
let t = f.SHOW_ARTICLES;
|
|
75
|
-
this._selectionMode === y.TC_CONFIG && (this._contextType === _.CONFIGURATOR || this._hiSelection.type !== b.GROUP) && (t = f.SHOW_ATTRIBUTES), this._emitSelectionChange(t);
|
|
76
|
-
}
|
|
77
|
-
_emitSelectionChange(t) {
|
|
78
|
-
if (this._emittedSelection.panel !== t) {
|
|
79
|
-
this._emittedSelection.panel = t;
|
|
80
|
-
const e = t === f.SHOW_ATTRIBUTES;
|
|
81
|
-
this._emittedSelection.groupId = e ? this._hiSelection.groupId : null, this._emittedSelection.rootModuleId = e ? this._hiSelection.rootModuleId : null, this._emittedSelection.subModuleId = e ? this._hiSelection.subModuleId : null, this._callbacks?.onShowHidePanel(
|
|
82
|
-
t,
|
|
83
|
-
this._emittedSelection.groupId,
|
|
84
|
-
this._emittedSelection.rootModuleId,
|
|
85
|
-
this._emittedSelection.subModuleId
|
|
86
|
-
);
|
|
87
|
-
} else this._emittedSelection.panel === f.SHOW_ATTRIBUTES && (this._emittedSelection.groupId !== this._hiSelection.groupId || this._emittedSelection.rootModuleId !== this._hiSelection.rootModuleId || this._emittedSelection.subModuleId !== this._hiSelection.subModuleId) && (this._emittedSelection.groupId = this._hiSelection.groupId ?? null, this._emittedSelection.rootModuleId = this._hiSelection.rootModuleId ?? null, this._emittedSelection.subModuleId = this._hiSelection.subModuleId ?? null, this._callbacks?.onSelectModule(
|
|
88
|
-
this._emittedSelection.groupId,
|
|
89
|
-
this._emittedSelection.rootModuleId,
|
|
90
|
-
this._emittedSelection.subModuleId
|
|
91
|
-
));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const S = class S {
|
|
95
|
-
constructor(t, e = null) {
|
|
96
|
-
this._libraryData = /* @__PURE__ */ new Map(), this._posDataForLoading = null, this._posArticleMap = /* @__PURE__ */ new Map(), this._posSubArticleMap = /* @__PURE__ */ new Map(), this._groupMap = /* @__PURE__ */ new Map(), this._nextPosDataId = 1, this._hiCallbacks = null, this._pendingGroupsToBeLoaded = [], this._planCompletelyLoaded = !1, this._validSubArticles = [], this._designerRequests = t, this._hiCallbacks = e, this._hiObjectSelection = new C(e);
|
|
97
|
-
}
|
|
98
|
-
get hiCallbacks() {
|
|
99
|
-
return this._hiCallbacks;
|
|
100
|
-
}
|
|
101
|
-
get hiObjectSelection() {
|
|
102
|
-
return this._hiObjectSelection;
|
|
103
|
-
}
|
|
104
|
-
_getGroup(t) {
|
|
105
|
-
return this._groupMap.get(t);
|
|
106
|
-
}
|
|
107
|
-
getLibraryData(t) {
|
|
108
|
-
if (this._libraryData.size === 1)
|
|
109
|
-
return Array.from(this._libraryData.values())[0];
|
|
110
|
-
let e;
|
|
111
|
-
return typeof t == "string" ? e = t : e = this._getLibraryIdForPosData(t), this._libraryData.has(e) ? this._libraryData.get(e) ?? null : (console.error(`Library data for libraryId '${e}' not found`), null);
|
|
112
|
-
}
|
|
113
|
-
isLibraryLoaded(t) {
|
|
114
|
-
return this._libraryData.has(t);
|
|
115
|
-
}
|
|
116
|
-
async addLibrary(t) {
|
|
117
|
-
this._libraryData.has(t.libraryId) || (this._libraryData.set(t.libraryId, t), await this._loadPendingGroup(t.libraryId));
|
|
118
|
-
}
|
|
119
|
-
loadPosData(t, e) {
|
|
120
|
-
t?.articles && (t = t.articles), t.forEach((o) => {
|
|
121
|
-
const r = o.id || o.articleId, s = g(o);
|
|
122
|
-
s.libraryId = e, s.isConfigDummy ? this._posSubArticleMap.set(r, s) : this._posArticleMap.set(r, s);
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
async setPosDataForLoading(t) {
|
|
126
|
-
this._posDataForLoading = t;
|
|
127
|
-
const e = Array.from(this._groupMap.values()).map(
|
|
128
|
-
(o) => o.posDataJson
|
|
129
|
-
);
|
|
130
|
-
this._groupMap.clear();
|
|
131
|
-
for (const o of e)
|
|
132
|
-
await this.loadedGroup(o);
|
|
133
|
-
}
|
|
134
|
-
async getSaveDataGroups() {
|
|
135
|
-
return this._posDataForLoading?.groups ?? null;
|
|
136
|
-
}
|
|
137
|
-
async newPosDataFromId(t) {
|
|
138
|
-
R(t) && (t = w(t));
|
|
139
|
-
let e = !1, o;
|
|
140
|
-
if (this._posArticleMap.has(t) ? o = g(this._posArticleMap.get(t)) : this._posSubArticleMap.has(t) && (e = !0, o = g(this._posSubArticleMap.get(t))), !o)
|
|
141
|
-
return;
|
|
142
|
-
const r = o;
|
|
143
|
-
r.ver = this.getLibraryData(
|
|
144
|
-
r.libraryId
|
|
145
|
-
)?.posGroupVersion, r.logMessages = [], r.roots.forEach((i) => {
|
|
146
|
-
i.libraryId = o.libraryId, i.catalog = o.catalog, i.logMessages = [], i.isGenerated || (i.articleName = o.articleName, i.articleId = o.articleId, i.desc = o.desc, i.imageUrl = o.imageUrl, i.category = o.category);
|
|
147
|
-
});
|
|
148
|
-
let s;
|
|
149
|
-
return e ? s = this._calculateNewGroup(r, !1) : (s = this._addNewGroup(r, !1).posDataJson, this._groupsModified(s, [], [])), s;
|
|
150
|
-
}
|
|
151
|
-
async newPosDataFromGroup(t) {
|
|
152
|
-
const e = this._addNewGroup(t, !1);
|
|
153
|
-
return this._groupsModified(e.posDataJson, [], []), e.posDataJson;
|
|
154
|
-
}
|
|
155
|
-
async selectGroup(t) {
|
|
156
|
-
try {
|
|
157
|
-
await this._designerRequests.selectGroup(t);
|
|
158
|
-
} catch (e) {
|
|
159
|
-
console.error(e);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
async selectRoot(t, e) {
|
|
163
|
-
try {
|
|
164
|
-
await this._designerRequests.selectRoot(e);
|
|
165
|
-
} catch (o) {
|
|
166
|
-
console.error(o);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
async deleteRoot(t, e) {
|
|
170
|
-
try {
|
|
171
|
-
await this._designerRequests.deleteRootModule(e);
|
|
172
|
-
} catch (o) {
|
|
173
|
-
console.error(o);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
async selectSubModule(t, e, o) {
|
|
177
|
-
try {
|
|
178
|
-
await this._designerRequests.selectModule(e, o);
|
|
179
|
-
} catch (r) {
|
|
180
|
-
console.error(r);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
async openCloseGroup(t) {
|
|
184
|
-
try {
|
|
185
|
-
const e = this._getGroup(t);
|
|
186
|
-
if (e) {
|
|
187
|
-
const o = !e.opened;
|
|
188
|
-
await this._designerRequests.openCloseGroup(t, null, o, !1), e.opened = o;
|
|
189
|
-
}
|
|
190
|
-
} catch (e) {
|
|
191
|
-
console.error(e);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
async deleteRootModule(t, e, o) {
|
|
195
|
-
try {
|
|
196
|
-
const r = this._getGroup(t.groupId);
|
|
197
|
-
if (r) {
|
|
198
|
-
this._setGroupPosition(r, t), this._setGroupContour(r, t), this._setRootModulesPosition(r, t);
|
|
199
|
-
const s = r.posDataJson;
|
|
200
|
-
s.roots = s.roots.filter(
|
|
201
|
-
(a) => a.id !== e
|
|
202
|
-
);
|
|
203
|
-
const i = this._splitOffGroupsFromGroups(
|
|
204
|
-
r,
|
|
205
|
-
o
|
|
206
|
-
);
|
|
207
|
-
await this._calculateAndUpdateGroupMap(r), this._loadPosData(r, i), this._groupsModified(
|
|
208
|
-
i.map((a) => a.posDataJson),
|
|
209
|
-
r.posDataJson,
|
|
210
|
-
[]
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
} catch (r) {
|
|
214
|
-
console.error(r);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
async duplicateGroup(t) {
|
|
218
|
-
try {
|
|
219
|
-
const e = this._getGroup(t?.groupId);
|
|
220
|
-
if (e) {
|
|
221
|
-
const o = g(e.posDataJson);
|
|
222
|
-
if (o.roots = o.roots.filter(
|
|
223
|
-
(s) => t.rootModules.find(
|
|
224
|
-
(i) => i.moduleId === s.id
|
|
225
|
-
) !== void 0
|
|
226
|
-
), o.roots.length === 0)
|
|
227
|
-
return;
|
|
228
|
-
o.roots.length === 1 && (o.roots[0].articlePos = [0, 0, 0], o.roots[0].rotationY = 0);
|
|
229
|
-
const r = this._addNewGroup(o, !1);
|
|
230
|
-
this._setGroupPosition(r, t), await this._designerRequests.loadPosGroups(r.posDataJson, {
|
|
231
|
-
findFreeSpaceInPlan: !0
|
|
232
|
-
}), this._groupsModified(r.posDataJson, [], []);
|
|
233
|
-
}
|
|
234
|
-
} catch (e) {
|
|
235
|
-
console.error(e);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
async mergeGroups(t, e, o) {
|
|
239
|
-
try {
|
|
240
|
-
const r = Array.isArray(e) ? e : [e];
|
|
241
|
-
if (this._groupMap.has(t.groupId) && r.length > 0) {
|
|
242
|
-
const s = [];
|
|
243
|
-
for (const n of r) {
|
|
244
|
-
const l = this._getGroup(n);
|
|
245
|
-
l && s.push(...l.posDataJson.roots);
|
|
246
|
-
}
|
|
247
|
-
const i = s.filter(
|
|
248
|
-
(n) => !n.isGenerated
|
|
249
|
-
), a = this._getGroup(t.groupId);
|
|
250
|
-
if (a) {
|
|
251
|
-
const n = a.posDataJson.roots.find(
|
|
252
|
-
(c) => c.id === o
|
|
253
|
-
);
|
|
254
|
-
n && this._applyImplicitRelevantAttributes(
|
|
255
|
-
this._getLibraryIdForPosData(a.posDataJson),
|
|
256
|
-
n,
|
|
257
|
-
i
|
|
258
|
-
), a.posDataJson.roots.push(...i), this._setGroupPosition(a, t), this._setGroupContour(a, t), this._setRootModulesPosition(a, t), await this._calculateAndUpdateGroupMap(a), this._designerRequests.loadPosGroups(a.posDataJson, {
|
|
259
|
-
mergedGroups: r
|
|
260
|
-
});
|
|
261
|
-
const l = [];
|
|
262
|
-
for (const c of r)
|
|
263
|
-
this._groupMap.has(c) && (this._groupMap.delete(c), l.push(c));
|
|
264
|
-
this._groupsModified([], a.posDataJson, l);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
} catch (r) {
|
|
268
|
-
console.error(r);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
_applyImplicitRelevantAttributes(t, e, o) {
|
|
272
|
-
const r = this.getLibraryData(t)?.masterData;
|
|
273
|
-
if (!r || !e || o.length === 0)
|
|
274
|
-
return;
|
|
275
|
-
const i = r.modules.find(
|
|
276
|
-
(a) => a.id === e.name
|
|
277
|
-
)?.assignedAttributes.filter(
|
|
278
|
-
(a) => r.attributes.find((n) => n.id === a)?.implicitRelevant === !0
|
|
279
|
-
) ?? [];
|
|
280
|
-
for (const a of o) {
|
|
281
|
-
const n = r.modules.find(
|
|
282
|
-
(l) => l.id === a.name
|
|
283
|
-
);
|
|
284
|
-
for (const l of i) {
|
|
285
|
-
const c = e.attributes?.find(
|
|
286
|
-
(m) => m.id === l
|
|
287
|
-
);
|
|
288
|
-
if (!n?.assignedAttributes.find(
|
|
289
|
-
(m) => m === l
|
|
290
|
-
))
|
|
291
|
-
continue;
|
|
292
|
-
const p = a.attributes?.find(
|
|
293
|
-
(m) => m.id === l
|
|
294
|
-
);
|
|
295
|
-
p ? (p.isInput = c?.isInput ?? !1, p.isInput === !0 && (p.value = c?.value)) : (c?.isInput ?? !1) && a.attributes?.push({
|
|
296
|
-
id: l,
|
|
297
|
-
value: c?.value,
|
|
298
|
-
isInput: !0
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
async splitRootModuleFromGroup(t, e) {
|
|
304
|
-
try {
|
|
305
|
-
const o = this._getGroup(t.groupId);
|
|
306
|
-
if (o) {
|
|
307
|
-
this._setGroupPosition(o, t), this._setGroupContour(o, t), this._setRootModulesPosition(o, t);
|
|
308
|
-
const r = Array.isArray(e) ? e : [e], s = this._splitOffGroupsFromGroups(
|
|
309
|
-
o,
|
|
310
|
-
r
|
|
311
|
-
);
|
|
312
|
-
await this._calculateAndUpdateGroupMap(o), this._loadPosData(o, s), this._groupsModified(
|
|
313
|
-
s.map((i) => i.posDataJson),
|
|
314
|
-
o.posDataJson,
|
|
315
|
-
[]
|
|
316
|
-
);
|
|
317
|
-
}
|
|
318
|
-
} catch (o) {
|
|
319
|
-
console.error(o);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
async arrangeRootModulesOfGroup(t) {
|
|
323
|
-
try {
|
|
324
|
-
const e = this._getGroup(t.groupId);
|
|
325
|
-
if (e) {
|
|
326
|
-
for (const r of e.posDataJson.roots)
|
|
327
|
-
t.rootModules.filter(
|
|
328
|
-
(s) => s.moduleId === r.id
|
|
329
|
-
).forEach((s) => {
|
|
330
|
-
r.articlePos = s.pos, r.rotationY = s.rotationY;
|
|
331
|
-
});
|
|
332
|
-
const o = await this._calculateAndUpdateGroupMap(e);
|
|
333
|
-
this._designerRequests.loadPosGroups(o, {}), this._groupsModified([], o, []);
|
|
334
|
-
}
|
|
335
|
-
} catch (e) {
|
|
336
|
-
console.error(e);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
removedGroup(t) {
|
|
340
|
-
try {
|
|
341
|
-
this._groupMap.has(t) && (this._groupMap.delete(t), this._groupsModified([], [], t));
|
|
342
|
-
} catch (e) {
|
|
343
|
-
console.error(e);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
changedGroupFromHistory(t, e) {
|
|
347
|
-
try {
|
|
348
|
-
const o = this._calculate(t), r = o.id, s = this._getGroup(r);
|
|
349
|
-
s ? s.posDataJson = o : this._addGroupToMap(r, o), e && this._designerRequests.loadPosGroups(t, {}), this._groupsModified(
|
|
350
|
-
s ? [] : [o],
|
|
351
|
-
s ? [o] : [],
|
|
352
|
-
[]
|
|
353
|
-
);
|
|
354
|
-
} catch (o) {
|
|
355
|
-
console.error(o);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
async changedGroupPlanningSituation(t) {
|
|
359
|
-
try {
|
|
360
|
-
const e = this._getGroup(t.groupId);
|
|
361
|
-
if (e) {
|
|
362
|
-
this._setGroupPosition(e, t), this._setGroupContour(e, t);
|
|
363
|
-
const o = await this._calculateAndUpdateGroupMap(e);
|
|
364
|
-
this._designerRequests.loadPosGroups(o, {}), this._groupsModified([], o, []);
|
|
365
|
-
}
|
|
366
|
-
} catch (e) {
|
|
367
|
-
console.error(e);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
async loadedGroup(t) {
|
|
371
|
-
const e = this._getLibraryIdForPosData(t);
|
|
372
|
-
if (!this._libraryData.has(e)) {
|
|
373
|
-
this._pendingGroupsToBeLoaded.push(t);
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
await this._loadedGroup(t);
|
|
377
|
-
}
|
|
378
|
-
async _loadPendingGroup(t) {
|
|
379
|
-
const e = this._pendingGroupsToBeLoaded.filter(
|
|
380
|
-
(o) => this._getLibraryIdForPosData(o) === t
|
|
381
|
-
);
|
|
382
|
-
this._pendingGroupsToBeLoaded = this._pendingGroupsToBeLoaded.filter(
|
|
383
|
-
(o) => this._getLibraryIdForPosData(o) !== t
|
|
384
|
-
);
|
|
385
|
-
for (const o of e)
|
|
386
|
-
await this._loadedGroup(o);
|
|
387
|
-
this._pendingGroupsToBeLoaded.length === 0 && this._groupsCompletelyLoaded();
|
|
388
|
-
}
|
|
389
|
-
async _loadedGroup(t) {
|
|
390
|
-
if (!this._posDataForLoading) {
|
|
391
|
-
await this._recalculateLoadedGroup(t);
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
const e = this._posDataForLoading.groups.find(
|
|
395
|
-
(r) => r.id === t.id
|
|
396
|
-
);
|
|
397
|
-
if (!e) {
|
|
398
|
-
this.removedGroup(t.id), this._designerRequests.deleteGroup(t.id);
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
const o = g(e);
|
|
402
|
-
o.ver = this.getLibraryData(t)?.posGroupVersion, t.pos !== void 0 && (o.pos = t.pos), t.rotationY !== void 0 && (o.rotationY = t.rotationY), await this._recalculateLoadedGroup(o);
|
|
403
|
-
}
|
|
404
|
-
async _recalculateLoadedGroup(t) {
|
|
405
|
-
try {
|
|
406
|
-
const e = t.id, o = !this._groupMap.has(e);
|
|
407
|
-
o && this._addGroupToMap(e, t);
|
|
408
|
-
const r = this._getGroup(e);
|
|
409
|
-
if (r) {
|
|
410
|
-
const s = await this._calculateAndUpdateGroupMap(r);
|
|
411
|
-
this._designerRequests.loadPosGroups(s, {
|
|
412
|
-
respondWithPositionInPlan: !0
|
|
413
|
-
}), this._groupsModified(
|
|
414
|
-
o ? s : [],
|
|
415
|
-
o ? [] : s,
|
|
416
|
-
[]
|
|
417
|
-
);
|
|
418
|
-
}
|
|
419
|
-
} catch (e) {
|
|
420
|
-
console.error(e);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
groupsCompletelyLoaded() {
|
|
424
|
-
this._planCompletelyLoaded = !0, this._groupsCompletelyLoaded();
|
|
425
|
-
}
|
|
426
|
-
_groupsCompletelyLoaded() {
|
|
427
|
-
this._planCompletelyLoaded && this._libraryData.size > 0 && this._pendingGroupsToBeLoaded.length === 0 && (this._designerRequests.completelyLoaded(), this._hiCallbacks?.onPosGroupsCompletelyLoaded());
|
|
428
|
-
}
|
|
429
|
-
async getGroupDataForOrder(t) {
|
|
430
|
-
try {
|
|
431
|
-
const e = Array.from(this._groupMap.values()).map(
|
|
432
|
-
(i) => i.posDataJson
|
|
433
|
-
);
|
|
434
|
-
let o = 1;
|
|
435
|
-
e.forEach((i) => {
|
|
436
|
-
i.roots.forEach((a) => {
|
|
437
|
-
a.additionalText = "Additional Text " + o++;
|
|
438
|
-
});
|
|
439
|
-
});
|
|
440
|
-
const r = await this._designerRequests.getRoomInformation(), s = this.getLibraryData(t)?.getOrderData(
|
|
441
|
-
e,
|
|
442
|
-
t,
|
|
443
|
-
r?.rooms ?? []
|
|
444
|
-
);
|
|
445
|
-
return s || null;
|
|
446
|
-
} catch (e) {
|
|
447
|
-
return console.error(e), null;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
_setGroupContour(t, e) {
|
|
451
|
-
e.contours && (t.posDataJson.contours = e.contours);
|
|
452
|
-
}
|
|
453
|
-
_setGroupPosition(t, e) {
|
|
454
|
-
const o = t.posDataJson;
|
|
455
|
-
e.pos !== void 0 && (o.pos = e.pos), e.rotationY !== void 0 && (o.rotationY = e.rotationY);
|
|
456
|
-
}
|
|
457
|
-
_setRootModulesPosition(t, e) {
|
|
458
|
-
for (const o of t.posDataJson.roots)
|
|
459
|
-
e.rootModules.filter(
|
|
460
|
-
(r) => r.moduleId === o.id
|
|
461
|
-
).forEach((r) => {
|
|
462
|
-
o.articlePos = r.pos, o.rotationY = r.rotationY;
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
_loadPosData(t, e) {
|
|
466
|
-
const o = g(t.posDataJson), r = Array.isArray(o) ? o : [o];
|
|
467
|
-
for (const s of e ?? [])
|
|
468
|
-
r.push(g(s.posDataJson));
|
|
469
|
-
this._designerRequests.loadPosGroups(r, {});
|
|
470
|
-
}
|
|
471
|
-
_splitOffGroupsFromGroups(t, e) {
|
|
472
|
-
const o = [];
|
|
473
|
-
for (const r of e ?? []) {
|
|
474
|
-
const s = this._splitOffRootModulesFromGroup(
|
|
475
|
-
t,
|
|
476
|
-
r
|
|
477
|
-
), i = this._addNewGroup(s, !0);
|
|
478
|
-
o.push(i);
|
|
479
|
-
}
|
|
480
|
-
return o;
|
|
481
|
-
}
|
|
482
|
-
_splitOffRootModulesFromGroup(t, e) {
|
|
483
|
-
const o = e.rootModules.map(
|
|
484
|
-
(a) => a.moduleId
|
|
485
|
-
), r = t.posDataJson, s = r.roots.filter(
|
|
486
|
-
(a) => o.includes(a.id)
|
|
487
|
-
);
|
|
488
|
-
r.roots = r.roots.filter(
|
|
489
|
-
(a) => !o.includes(a.id)
|
|
490
|
-
);
|
|
491
|
-
for (const a of s)
|
|
492
|
-
e.rootModules.filter(
|
|
493
|
-
(n) => n.moduleId === a.id
|
|
494
|
-
).forEach((n) => {
|
|
495
|
-
a.articlePos = n.pos, a.rotationY = n.rotationY;
|
|
496
|
-
});
|
|
497
|
-
for (const a of r.roots)
|
|
498
|
-
a.isGenerated && s.push(g(a));
|
|
499
|
-
return {
|
|
500
|
-
id: void 0,
|
|
501
|
-
libraryId: r.libraryId,
|
|
502
|
-
pos: e.pos,
|
|
503
|
-
rotationY: e.rotationY,
|
|
504
|
-
roots: s,
|
|
505
|
-
ver: r.ver,
|
|
506
|
-
logMessages: []
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
_calculateNewGroup(t, e) {
|
|
510
|
-
return this._replacesIDs(t, e), this._calculate(t);
|
|
511
|
-
}
|
|
512
|
-
_getLibraryIdForPosData(t) {
|
|
513
|
-
return t.libraryId ? t.libraryId : t.roots.find((e) => e.libraryId)?.libraryId;
|
|
514
|
-
}
|
|
515
|
-
_setSubmoduleImages(t, e) {
|
|
516
|
-
e && t.modules?.length && t.modules.forEach((o) => {
|
|
517
|
-
const r = e.modules.find(
|
|
518
|
-
(s) => s.id === o.name
|
|
519
|
-
);
|
|
520
|
-
r && (o.imageUrl = r.imageUrl), this._setSubmoduleImages(o, e);
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
async _calculateAndUpdateGroupMap(t) {
|
|
524
|
-
if (t.calculationInProgress)
|
|
525
|
-
return console.error(
|
|
526
|
-
"Calculation already in progress for group:",
|
|
527
|
-
t.posDataJson.id
|
|
528
|
-
), t.posDataJson;
|
|
529
|
-
t.calculationInProgress = !0, await I(0);
|
|
530
|
-
try {
|
|
531
|
-
const e = this._calculate(t.posDataJson);
|
|
532
|
-
return e ? (t.posDataJson = e, this._groupMap.set(t.posDataJson.id, t), e) : t.posDataJson;
|
|
533
|
-
} finally {
|
|
534
|
-
t.calculationInProgress = !1;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
_addNewGroup(t, e) {
|
|
538
|
-
const o = this._calculateNewGroup(
|
|
539
|
-
t,
|
|
540
|
-
e
|
|
541
|
-
);
|
|
542
|
-
return this._addGroupToMap(o.id, o);
|
|
543
|
-
}
|
|
544
|
-
_addGroupToMap(t, e) {
|
|
545
|
-
const o = {
|
|
546
|
-
posDataJson: e,
|
|
547
|
-
opened: !1,
|
|
548
|
-
calculationInProgress: !1
|
|
549
|
-
};
|
|
550
|
-
return this._groupMap.set(t, o), o;
|
|
551
|
-
}
|
|
552
|
-
async updateAttribute(t, e, o, r) {
|
|
553
|
-
if (!t)
|
|
554
|
-
return;
|
|
555
|
-
const s = Array.from(this._groupMap.entries()).find(
|
|
556
|
-
([, a]) => a.posDataJson.roots.some((n) => n.id === t)
|
|
557
|
-
);
|
|
558
|
-
if (!s)
|
|
559
|
-
throw new Error("PosGroup not found inside the calculated articles list");
|
|
560
|
-
const [, i] = s;
|
|
561
|
-
if (i) {
|
|
562
|
-
const a = await this._modifyAttributeOfModules(
|
|
563
|
-
i,
|
|
564
|
-
e ?? t,
|
|
565
|
-
o,
|
|
566
|
-
r
|
|
567
|
-
);
|
|
568
|
-
this._designerRequests.loadPosGroups(a, {
|
|
569
|
-
correctArrangement: !0
|
|
570
|
-
}), this._groupsModified([], a, []);
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
async modifyAttribute(t, e, o, r) {
|
|
574
|
-
const s = this._getGroup(t);
|
|
575
|
-
if (s) {
|
|
576
|
-
const i = e.map(
|
|
577
|
-
(n) => n.subModuleId ?? n.rootModuleId
|
|
578
|
-
), a = await this._modifyAttributeOfModules(
|
|
579
|
-
s,
|
|
580
|
-
i,
|
|
581
|
-
o,
|
|
582
|
-
r
|
|
583
|
-
);
|
|
584
|
-
this._designerRequests.loadPosGroups(a, {
|
|
585
|
-
correctArrangement: !0
|
|
586
|
-
}), this._groupsModified([], a, []);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
async getVerifiedAttributeOptions(t, e) {
|
|
590
|
-
const o = this._findModuleInAllGroups(t);
|
|
591
|
-
if (!o) {
|
|
592
|
-
console.error("Module not found inside the calculated articles list");
|
|
593
|
-
return;
|
|
594
|
-
}
|
|
595
|
-
if (!o.module.checkAttributes)
|
|
596
|
-
return;
|
|
597
|
-
let r;
|
|
598
|
-
try {
|
|
599
|
-
r = await this.getLibraryData(
|
|
600
|
-
o.group
|
|
601
|
-
)?.getAttributesDropDownValues(o.module, e);
|
|
602
|
-
} catch (i) {
|
|
603
|
-
console.error(i);
|
|
604
|
-
}
|
|
605
|
-
if (!r)
|
|
606
|
-
return;
|
|
607
|
-
const s = {};
|
|
608
|
-
for (const [i, a] of Object.entries(r))
|
|
609
|
-
a && a.length > 0 && (s[i] = {
|
|
610
|
-
calcResult: a.map((n) => ({
|
|
611
|
-
value: n.value,
|
|
612
|
-
kind: n.kind
|
|
613
|
-
}))
|
|
614
|
-
});
|
|
615
|
-
return s;
|
|
616
|
-
}
|
|
617
|
-
async getVerifiedGroupAttributeOptions(t, e) {
|
|
618
|
-
const o = this._getGroup(t);
|
|
619
|
-
if (!o) {
|
|
620
|
-
console.error("Group not found");
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
const r = this.getLibraryData(o.posDataJson);
|
|
624
|
-
if (!r || !r.masterData)
|
|
625
|
-
return;
|
|
626
|
-
const s = e ? Array.isArray(e) ? e : [e] : [], i = this._groupAttributesByModule(
|
|
627
|
-
o,
|
|
628
|
-
r,
|
|
629
|
-
s
|
|
630
|
-
);
|
|
631
|
-
if (i.size === 0)
|
|
632
|
-
return;
|
|
633
|
-
const a = await this._collectAllOptionsPerAttribute(
|
|
634
|
-
i,
|
|
635
|
-
r
|
|
636
|
-
);
|
|
637
|
-
return this._calculateCombinedResults(a);
|
|
638
|
-
}
|
|
639
|
-
_groupAttributesByModule(t, e, o) {
|
|
640
|
-
const r = /* @__PURE__ */ new Map();
|
|
641
|
-
for (const s of o) {
|
|
642
|
-
const i = [];
|
|
643
|
-
for (const a of t.posDataJson.roots)
|
|
644
|
-
this._collectModulesWithAttribute(
|
|
645
|
-
a,
|
|
646
|
-
s,
|
|
647
|
-
e.masterData,
|
|
648
|
-
i
|
|
649
|
-
);
|
|
650
|
-
for (const a of i) {
|
|
651
|
-
const n = r.get(a.id);
|
|
652
|
-
n ? n.attributeIds.push(s) : r.set(a.id, {
|
|
653
|
-
module: a,
|
|
654
|
-
attributeIds: [s]
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
return r;
|
|
659
|
-
}
|
|
660
|
-
async _collectAllOptionsPerAttribute(t, e) {
|
|
661
|
-
const o = /* @__PURE__ */ new Map();
|
|
662
|
-
for (const { module: r, attributeIds: s } of t.values())
|
|
663
|
-
if (r.checkAttributes)
|
|
664
|
-
try {
|
|
665
|
-
const i = await e.getAttributesDropDownValues(
|
|
666
|
-
r,
|
|
667
|
-
s
|
|
668
|
-
);
|
|
669
|
-
if (!i)
|
|
670
|
-
continue;
|
|
671
|
-
for (const a of s) {
|
|
672
|
-
const n = i[a];
|
|
673
|
-
if (n && n.length > 0) {
|
|
674
|
-
let l = o.get(a);
|
|
675
|
-
l || (l = /* @__PURE__ */ new Map(), o.set(a, l));
|
|
676
|
-
for (const c of n) {
|
|
677
|
-
const h = l.get(c.value);
|
|
678
|
-
h ? l.set(
|
|
679
|
-
c.value,
|
|
680
|
-
this._getMoreRestrictedKind(h, c.kind)
|
|
681
|
-
) : l.set(c.value, c.kind);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
} catch (i) {
|
|
686
|
-
console.error(i);
|
|
687
|
-
}
|
|
688
|
-
return o;
|
|
689
|
-
}
|
|
690
|
-
_calculateCombinedResults(t) {
|
|
691
|
-
const e = {};
|
|
692
|
-
for (const [o, r] of t.entries()) {
|
|
693
|
-
const s = [];
|
|
694
|
-
for (const [i, a] of r.entries())
|
|
695
|
-
s.push({ value: i, kind: a });
|
|
696
|
-
s.sort(
|
|
697
|
-
(i, a) => this._getKindRank(i.kind) - this._getKindRank(a.kind)
|
|
698
|
-
), s.length > 0 && (e[o] = { calcResult: s });
|
|
699
|
-
}
|
|
700
|
-
return Object.keys(e).length > 0 ? e : void 0;
|
|
701
|
-
}
|
|
702
|
-
_getKindRank(t) {
|
|
703
|
-
switch (t) {
|
|
704
|
-
case M.Normal:
|
|
705
|
-
return 0;
|
|
706
|
-
case M.Conflicting:
|
|
707
|
-
return 1;
|
|
708
|
-
case M.Invalid:
|
|
709
|
-
return 2;
|
|
710
|
-
default:
|
|
711
|
-
return 3;
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
_getMoreRestrictedKind(t, e) {
|
|
715
|
-
return this._getKindRank(t) > this._getKindRank(e) ? t : e;
|
|
716
|
-
}
|
|
717
|
-
_collectModulesWithAttribute(t, e, o, r) {
|
|
718
|
-
if (o.modules.find((i) => i.id === t.name)?.assignedAttributes.includes(e) && r.push(t), t.modules)
|
|
719
|
-
for (const i of t.modules)
|
|
720
|
-
this._collectModulesWithAttribute(
|
|
721
|
-
i,
|
|
722
|
-
e,
|
|
723
|
-
o,
|
|
724
|
-
r
|
|
725
|
-
);
|
|
726
|
-
}
|
|
727
|
-
updateProperty(t, e, o) {
|
|
728
|
-
if (!t || !e || o === void 0)
|
|
729
|
-
return;
|
|
730
|
-
if (S.CHANGEABLE_PROPERTIES.indexOf(e) === -1) {
|
|
731
|
-
console.error(
|
|
732
|
-
`Unsupported property name '${e}'. Supported property names: ${S.CHANGEABLE_PROPERTIES.join(", ")}`
|
|
733
|
-
);
|
|
734
|
-
return;
|
|
735
|
-
}
|
|
736
|
-
const r = this._findRootModuleInAllGroups(t);
|
|
737
|
-
if (!r) {
|
|
738
|
-
console.error(
|
|
739
|
-
"Root module not found inside the calculated articles list"
|
|
740
|
-
);
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
r.rootModule[e] = o, this._designerRequests.loadPosGroups(r.group, {}), this._groupsModified([], r.group, []);
|
|
744
|
-
}
|
|
745
|
-
async swapRootModule(t, e, o) {
|
|
746
|
-
const r = this._getGroup(t);
|
|
747
|
-
if (!r)
|
|
748
|
-
return;
|
|
749
|
-
const s = r.posDataJson, i = s.roots.find(
|
|
750
|
-
(p) => p.id === e
|
|
751
|
-
);
|
|
752
|
-
if (!i)
|
|
753
|
-
return;
|
|
754
|
-
const a = await this.newPosDataFromId(o), n = a.roots.filter(
|
|
755
|
-
(p) => !p.isGenerated
|
|
756
|
-
);
|
|
757
|
-
if (!a || n.length !== 1)
|
|
758
|
-
return;
|
|
759
|
-
const l = n[0];
|
|
760
|
-
i && this._applyImplicitRelevantAttributes(
|
|
761
|
-
this._getLibraryIdForPosData(s),
|
|
762
|
-
i,
|
|
763
|
-
[l]
|
|
764
|
-
), l.articlePos = i.articlePos, l.rotationY = i.rotationY, s.roots = s.roots.filter(
|
|
765
|
-
(p) => p.id !== e
|
|
766
|
-
), s.roots.push(l);
|
|
767
|
-
const c = await this._calculateAndUpdateGroupMap(r), h = {
|
|
768
|
-
originalModuleId: e,
|
|
769
|
-
newModuleId: l.id
|
|
770
|
-
};
|
|
771
|
-
this._designerRequests.loadPosGroups(c, {
|
|
772
|
-
newAction: !0,
|
|
773
|
-
correctArrangement: !0,
|
|
774
|
-
moduleIdMap: [h]
|
|
775
|
-
}), this._groupsModified([], c, []);
|
|
776
|
-
}
|
|
777
|
-
async _modifyAttributeOfModules(t, e, o, r) {
|
|
778
|
-
const s = Array.isArray(e) ? e : [e], i = this.getLibraryData(t.posDataJson);
|
|
779
|
-
for (const n of s) {
|
|
780
|
-
const l = this._findModule(
|
|
781
|
-
t.posDataJson.roots,
|
|
782
|
-
n
|
|
783
|
-
);
|
|
784
|
-
if (l && i) {
|
|
785
|
-
const c = i.solveModuleAttributeConflict(
|
|
786
|
-
l,
|
|
787
|
-
o,
|
|
788
|
-
r
|
|
789
|
-
);
|
|
790
|
-
this._setAttribute(l, o, r), c && c.length > 0 && c.forEach((h) => {
|
|
791
|
-
h.value !== void 0 && this._setAttribute(
|
|
792
|
-
l,
|
|
793
|
-
h.id,
|
|
794
|
-
h.value
|
|
795
|
-
);
|
|
796
|
-
});
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
return await this._calculateAndUpdateGroupMap(t);
|
|
800
|
-
}
|
|
801
|
-
_setAttribute(t, e, o) {
|
|
802
|
-
if (t.attributes && t.attributes.length > 0) {
|
|
803
|
-
const s = t.attributes.find((i) => i.id === e);
|
|
804
|
-
if (s) {
|
|
805
|
-
s.value = o, s.isInput = !0;
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
const r = {
|
|
810
|
-
id: e,
|
|
811
|
-
value: o,
|
|
812
|
-
isInput: !0
|
|
813
|
-
};
|
|
814
|
-
t.attributes ? t.attributes.push(r) : t.attributes = [r];
|
|
815
|
-
}
|
|
816
|
-
findValidSubArticles(t) {
|
|
817
|
-
this._validSubArticles = [];
|
|
818
|
-
const e = Array.isArray(t) ? t : [t];
|
|
819
|
-
for (const o of e) {
|
|
820
|
-
const r = this._getGroup(o);
|
|
821
|
-
if (!r)
|
|
822
|
-
continue;
|
|
823
|
-
const s = r.posDataJson, { libraryId: i, libraryData: a } = this._getLibrary(s);
|
|
824
|
-
if (!a)
|
|
825
|
-
continue;
|
|
826
|
-
const n = Array.from(
|
|
827
|
-
this._posSubArticleMap.values()
|
|
828
|
-
).filter((l) => l.libraryId === i);
|
|
829
|
-
try {
|
|
830
|
-
const l = a.getValidSubArticles(
|
|
831
|
-
s,
|
|
832
|
-
n,
|
|
833
|
-
a.masterData
|
|
834
|
-
);
|
|
835
|
-
this._validSubArticles.push(...Array.from(l));
|
|
836
|
-
} catch (l) {
|
|
837
|
-
console.error(l);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
return this._validSubArticles;
|
|
841
|
-
}
|
|
842
|
-
_getValidSubArticle(t) {
|
|
843
|
-
return this._validSubArticles.find(
|
|
844
|
-
(o) => o.articleId === t
|
|
845
|
-
) ?? null;
|
|
846
|
-
}
|
|
847
|
-
getValidContainerModulesForSubArticle(t, e) {
|
|
848
|
-
const o = this._getValidSubArticle(e);
|
|
849
|
-
if (!o)
|
|
850
|
-
return [];
|
|
851
|
-
const r = Array.isArray(t) ? t : [t], s = [];
|
|
852
|
-
for (const i of r) {
|
|
853
|
-
const a = this._getGroup(i);
|
|
854
|
-
if (!a)
|
|
855
|
-
continue;
|
|
856
|
-
const n = a.posDataJson, { libraryData: l } = this._getLibrary(n);
|
|
857
|
-
if (l)
|
|
858
|
-
try {
|
|
859
|
-
const c = l.getValidContainerModulesForSubArticle(
|
|
860
|
-
n,
|
|
861
|
-
o,
|
|
862
|
-
l.masterData
|
|
863
|
-
);
|
|
864
|
-
s.push(...Array.from(c));
|
|
865
|
-
} catch (c) {
|
|
866
|
-
console.error(c);
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
return s;
|
|
870
|
-
}
|
|
871
|
-
addSubArticle(t, e, o) {
|
|
872
|
-
const r = this._getValidSubArticle(t);
|
|
873
|
-
if (!r)
|
|
874
|
-
return;
|
|
875
|
-
const { group: s } = this._findRootModuleInAllGroups(e);
|
|
876
|
-
if (!s)
|
|
877
|
-
return;
|
|
878
|
-
const i = this._getGroup(s.id);
|
|
879
|
-
if (!i)
|
|
880
|
-
return;
|
|
881
|
-
if (i.calculationInProgress) {
|
|
882
|
-
console.error("Calculation already in progress for group:", s.id);
|
|
883
|
-
return;
|
|
884
|
-
}
|
|
885
|
-
i.calculationInProgress = !0;
|
|
886
|
-
let a;
|
|
887
|
-
try {
|
|
888
|
-
if (a = this._addSubArticle(
|
|
889
|
-
s,
|
|
890
|
-
r,
|
|
891
|
-
e,
|
|
892
|
-
o
|
|
893
|
-
), !a)
|
|
894
|
-
return;
|
|
895
|
-
} finally {
|
|
896
|
-
i.calculationInProgress = !1;
|
|
897
|
-
}
|
|
898
|
-
this._designerRequests.loadPosGroups(a, {}), this._groupsModified([], a, []);
|
|
899
|
-
}
|
|
900
|
-
async deleteSubArticles(t, e) {
|
|
901
|
-
const o = this._getGroup(t);
|
|
902
|
-
if (!o)
|
|
903
|
-
return;
|
|
904
|
-
const r = o.posDataJson, s = Array.isArray(e) ? e : [e];
|
|
905
|
-
let i = r;
|
|
906
|
-
if (o.calculationInProgress) {
|
|
907
|
-
console.error("Calculation already in progress for group:", r.id);
|
|
908
|
-
return;
|
|
909
|
-
}
|
|
910
|
-
o.calculationInProgress = !0, await I(0);
|
|
911
|
-
try {
|
|
912
|
-
for (const a of s) {
|
|
913
|
-
const n = this._findSubModule(
|
|
914
|
-
i.roots,
|
|
915
|
-
a
|
|
916
|
-
);
|
|
917
|
-
if (n && (i = this._deleteSubArticle(
|
|
918
|
-
i,
|
|
919
|
-
n.rootModule.id,
|
|
920
|
-
n.module.id
|
|
921
|
-
), !i))
|
|
922
|
-
break;
|
|
923
|
-
}
|
|
924
|
-
if (!i)
|
|
925
|
-
return;
|
|
926
|
-
} finally {
|
|
927
|
-
o.calculationInProgress = !1;
|
|
928
|
-
}
|
|
929
|
-
this._designerRequests.loadPosGroups(i, {}), this._groupsModified([], i, []);
|
|
930
|
-
}
|
|
931
|
-
_findRootModuleInAllGroups(t) {
|
|
932
|
-
for (const e of this._groupMap.values()) {
|
|
933
|
-
const o = e.posDataJson, r = o.roots.find(
|
|
934
|
-
(s) => s.id === t
|
|
935
|
-
);
|
|
936
|
-
if (r !== void 0)
|
|
937
|
-
return { group: o, rootModule: r };
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
_findModuleInAllGroups(t) {
|
|
941
|
-
for (const e of this._groupMap.values()) {
|
|
942
|
-
const o = e.posDataJson, r = this._findModule(o.roots, t);
|
|
943
|
-
if (r !== void 0)
|
|
944
|
-
return { group: o, module: r };
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
_findModule(t, e) {
|
|
948
|
-
for (const o of t) {
|
|
949
|
-
if (o.id === e)
|
|
950
|
-
return o;
|
|
951
|
-
if (o.modules && o.modules.length > 0) {
|
|
952
|
-
const r = this._findModule(o.modules, e);
|
|
953
|
-
if (r !== void 0)
|
|
954
|
-
return r;
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
_findSubModule(t, e) {
|
|
959
|
-
for (const o of t) {
|
|
960
|
-
if (o.id === e)
|
|
961
|
-
return { rootModule: o, module: o };
|
|
962
|
-
if (o.modules && o.modules.length > 0) {
|
|
963
|
-
const r = this._findSubModule(o.modules, e);
|
|
964
|
-
if (r !== void 0)
|
|
965
|
-
return { rootModule: o, module: r.module };
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
_replacesIDs(t, e) {
|
|
970
|
-
if (t.id = this._getNextID(), !e)
|
|
971
|
-
for (const o of t.roots)
|
|
972
|
-
this._replacesModuleIDs(o);
|
|
973
|
-
}
|
|
974
|
-
_replacesModuleIDs(t) {
|
|
975
|
-
if (t.id = this._getNextID(), t.modules)
|
|
976
|
-
for (const e of t.modules)
|
|
977
|
-
this._replacesModuleIDs(e);
|
|
978
|
-
}
|
|
979
|
-
_getNextID() {
|
|
980
|
-
if (window.uuidv4)
|
|
981
|
-
return window.uuidv4();
|
|
982
|
-
let t = (this._nextPosDataId++).toString();
|
|
983
|
-
return t.length < 4 && (t = "0".repeat(4 - t.length) + t), "id" + t;
|
|
984
|
-
}
|
|
985
|
-
async _groupsModified(t, e, o) {
|
|
986
|
-
const r = Array.isArray(t) ? t : [t];
|
|
987
|
-
r.length > 0 && await this._hiCallbacks?.onPosGroupAdded(r);
|
|
988
|
-
const s = Array.isArray(e) ? e : [e];
|
|
989
|
-
s.length > 0 && await this._hiCallbacks?.onPosGroupChanged(s);
|
|
990
|
-
const i = Array.isArray(o) ? o : [o];
|
|
991
|
-
i.length > 0 && await this._hiCallbacks?.onPosGroupDeleted(i), this._calculatePrice();
|
|
992
|
-
}
|
|
993
|
-
_calculatePrice() {
|
|
994
|
-
const t = Array.from(this._groupMap.values()).map(
|
|
995
|
-
(e) => e.posDataJson
|
|
996
|
-
);
|
|
997
|
-
this._hiCallbacks?.onPriceCalc(t);
|
|
998
|
-
}
|
|
999
|
-
_calculate(t) {
|
|
1000
|
-
const e = this._updatePosData(
|
|
1001
|
-
t,
|
|
1002
|
-
(o, r) => {
|
|
1003
|
-
try {
|
|
1004
|
-
return r.calculateGroup(o);
|
|
1005
|
-
} catch (s) {
|
|
1006
|
-
console.error("Error adding sub article to group:", s);
|
|
1007
|
-
}
|
|
1008
|
-
return o;
|
|
1009
|
-
}
|
|
1010
|
-
);
|
|
1011
|
-
return e || null;
|
|
1012
|
-
}
|
|
1013
|
-
_addSubArticle(t, e, o, r) {
|
|
1014
|
-
const s = this._updatePosData(
|
|
1015
|
-
t,
|
|
1016
|
-
(i, a) => {
|
|
1017
|
-
try {
|
|
1018
|
-
const n = a.addSubArticle(
|
|
1019
|
-
i,
|
|
1020
|
-
e,
|
|
1021
|
-
o,
|
|
1022
|
-
r
|
|
1023
|
-
);
|
|
1024
|
-
return a.calculateGroup(n);
|
|
1025
|
-
} catch (n) {
|
|
1026
|
-
console.error("Error adding sub article to group:", n);
|
|
1027
|
-
}
|
|
1028
|
-
return i;
|
|
1029
|
-
}
|
|
1030
|
-
);
|
|
1031
|
-
return s ? (this._addGroupToMap(s.id, s), s) : null;
|
|
1032
|
-
}
|
|
1033
|
-
_deleteSubArticle(t, e, o) {
|
|
1034
|
-
const r = this._updatePosData(
|
|
1035
|
-
t,
|
|
1036
|
-
(s, i) => {
|
|
1037
|
-
try {
|
|
1038
|
-
const a = i.deleteSubArticle(
|
|
1039
|
-
s,
|
|
1040
|
-
e,
|
|
1041
|
-
o
|
|
1042
|
-
);
|
|
1043
|
-
return i.calculateGroup(a);
|
|
1044
|
-
} catch (a) {
|
|
1045
|
-
console.error("Error adding sub article to group:", a);
|
|
1046
|
-
}
|
|
1047
|
-
return s;
|
|
1048
|
-
}
|
|
1049
|
-
);
|
|
1050
|
-
return r ? (this._addGroupToMap(r.id, r), r) : null;
|
|
1051
|
-
}
|
|
1052
|
-
_updatePosData(t, e) {
|
|
1053
|
-
const { libraryId: o, libraryData: r } = this._getLibrary(t);
|
|
1054
|
-
if (!r)
|
|
1055
|
-
return null;
|
|
1056
|
-
const s = g(t);
|
|
1057
|
-
s.libraryId = o, s.logMessages && (s.logMessages = []);
|
|
1058
|
-
const i = e(s, r);
|
|
1059
|
-
return this._takeOverPropertiesFromOriginalGroup(
|
|
1060
|
-
o,
|
|
1061
|
-
r,
|
|
1062
|
-
t,
|
|
1063
|
-
i
|
|
1064
|
-
), i;
|
|
1065
|
-
}
|
|
1066
|
-
_getLibrary(t) {
|
|
1067
|
-
const e = this._getLibraryIdForPosData(t), o = this.getLibraryData(e);
|
|
1068
|
-
return { libraryId: e, libraryData: o };
|
|
1069
|
-
}
|
|
1070
|
-
_takeOverPropertiesFromOriginalGroup(t, e, o, r) {
|
|
1071
|
-
o.pos !== void 0 && (r.pos = o.pos), o.rotationY !== void 0 && (r.rotationY = o.rotationY);
|
|
1072
|
-
const s = e.masterData;
|
|
1073
|
-
r.roots.forEach((i) => {
|
|
1074
|
-
const a = o.roots.find(
|
|
1075
|
-
(l) => l.id === i.id
|
|
1076
|
-
), n = s?.modules.find((l) => l.id === i.name);
|
|
1077
|
-
i.libraryId = a?.libraryId ?? t, i.articleName = a?.articleName ?? a?.articleId ?? n?.name ?? n?.id, i.articleId = a?.articleId ?? a?.articleName ?? n?.id ?? n?.name, i.imageUrl = a?.imageUrl ?? n?.imageUrl, i.desc = a?.desc ?? n?.desc, i.category = a?.category, i.additionalText = a?.additionalText, i.canBeDeleted === void 0 && (i.canBeDeleted = !i.isGenerated), this._setSubmoduleImages(i, s);
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
|
-
};
|
|
1081
|
-
S.CHANGEABLE_PROPERTIES = [
|
|
1082
|
-
"additionalText",
|
|
1083
|
-
"quantity"
|
|
1084
|
-
];
|
|
1085
|
-
let D = S;
|
|
1086
|
-
const d = [];
|
|
1087
|
-
for (let u = 0; u < 256; ++u)
|
|
1088
|
-
d.push((u + 256).toString(16).slice(1));
|
|
1089
|
-
function v(u, t = 0) {
|
|
1090
|
-
return (d[u[t + 0]] + d[u[t + 1]] + d[u[t + 2]] + d[u[t + 3]] + "-" + d[u[t + 4]] + d[u[t + 5]] + "-" + d[u[t + 6]] + d[u[t + 7]] + "-" + d[u[t + 8]] + d[u[t + 9]] + "-" + d[u[t + 10]] + d[u[t + 11]] + d[u[t + 12]] + d[u[t + 13]] + d[u[t + 14]] + d[u[t + 15]]).toLowerCase();
|
|
1091
|
-
}
|
|
1092
|
-
let G;
|
|
1093
|
-
const E = new Uint8Array(16);
|
|
1094
|
-
function T() {
|
|
1095
|
-
if (!G) {
|
|
1096
|
-
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1097
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1098
|
-
G = crypto.getRandomValues.bind(crypto);
|
|
1099
|
-
}
|
|
1100
|
-
return G(E);
|
|
1101
|
-
}
|
|
1102
|
-
const q = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), L = { randomUUID: q };
|
|
1103
|
-
function F(u, t, e) {
|
|
1104
|
-
if (L.randomUUID && !t && !u)
|
|
1105
|
-
return L.randomUUID();
|
|
1106
|
-
u = u || {};
|
|
1107
|
-
const o = u.random || (u.rng || T)();
|
|
1108
|
-
if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, t) {
|
|
1109
|
-
e = e || 0;
|
|
1110
|
-
for (let r = 0; r < 16; ++r)
|
|
1111
|
-
t[e + r] = o[r];
|
|
1112
|
-
return t;
|
|
1113
|
-
}
|
|
1114
|
-
return v(o);
|
|
1115
|
-
}
|
|
1116
|
-
const N = (u, t) => {
|
|
1117
|
-
u.callbacks.onCompletelyLoaded = () => {
|
|
1118
|
-
t.groupsCompletelyLoaded();
|
|
1119
|
-
}, u.callbacks.onExternalObjectModuleSelected = (e, o, r) => {
|
|
1120
|
-
t.hiObjectSelection.groupOrModuleSelected(
|
|
1121
|
-
e,
|
|
1122
|
-
o,
|
|
1123
|
-
r
|
|
1124
|
-
);
|
|
1125
|
-
}, u.callbacks.onContextChanged = (e) => {
|
|
1126
|
-
t.hiObjectSelection.contextChanged(e);
|
|
1127
|
-
}, u.callbacks.onSelectionChange = (e, o, r, s, i) => {
|
|
1128
|
-
t.hiObjectSelection.selectionChanged(
|
|
1129
|
-
e,
|
|
1130
|
-
o,
|
|
1131
|
-
r,
|
|
1132
|
-
s,
|
|
1133
|
-
i
|
|
1134
|
-
);
|
|
1135
|
-
}, u.callbacks.onSelectionCancel = (e) => {
|
|
1136
|
-
t.hiObjectSelection.selectionCancel(e);
|
|
1137
|
-
};
|
|
1138
|
-
}, A = (u = /* @__PURE__ */ new Date()) => {
|
|
1139
|
-
let t = u.toISOString();
|
|
1140
|
-
t = t.slice(0, -1);
|
|
1141
|
-
const e = t.lastIndexOf(".");
|
|
1142
|
-
let o = t;
|
|
1143
|
-
e !== -1 && (o = t.substring(0, e + 4) + "0000");
|
|
1144
|
-
const r = u.getTimezoneOffset(), s = Math.abs(Math.floor(r / 60)), i = Math.abs(r % 60), n = `${r <= 0 ? "+" : "-"}${String(s).padStart(
|
|
1145
|
-
2,
|
|
1146
|
-
"0"
|
|
1147
|
-
)}:${String(i).padStart(2, "0")}`;
|
|
1148
|
-
return o + n;
|
|
1149
|
-
}, U = () => ({
|
|
1150
|
-
id: window.uuidv4 ? window.uuidv4() : "00000000-0000-0000-0000-000000000000",
|
|
1151
|
-
state: "New",
|
|
1152
|
-
orderNumber: "736362",
|
|
1153
|
-
orderName: "Bedroom & bathroom 01",
|
|
1154
|
-
orderDescription: "Lorem ipsum dolor sit amet...",
|
|
1155
|
-
project: "Single family house Müller John",
|
|
1156
|
-
personInCharge: "Joe",
|
|
1157
|
-
orderDate: A(),
|
|
1158
|
-
deliveryDatePlanned: A(
|
|
1159
|
-
new Date(Date.now() + 336 * 60 * 60 * 1e3)
|
|
1160
|
-
),
|
|
1161
|
-
addresses: [
|
|
1162
|
-
{
|
|
1163
|
-
type: "Delivery, Billing",
|
|
1164
|
-
street: "Musterstraße",
|
|
1165
|
-
houseNumber: "1",
|
|
1166
|
-
postalCode: "12345",
|
|
1167
|
-
city: "Musterstadt",
|
|
1168
|
-
country: "Deutschland"
|
|
1169
|
-
}
|
|
1170
|
-
],
|
|
1171
|
-
customerName: "Müller & Co.",
|
|
1172
|
-
customerNumber: "462642",
|
|
1173
|
-
createdAt: A(),
|
|
1174
|
-
changedAt: A(),
|
|
1175
|
-
changedBy: "Selfish",
|
|
1176
|
-
items: []
|
|
1177
|
-
}), k = async (u, t) => {
|
|
1178
|
-
const e = await u.getPlanOverview(), o = {}, r = e.objects.reduce((a, n) => (n.catalogItemId && (o[n.catalogItemId] || (o[n.catalogItemId] = 0, a.push(n.catalogItemId)), o[n.catalogItemId]++), a), []), i = (Array.isArray(r) && r.length > 0 ? await u.getRapiAccess().getItems(r) : []).filter((a) => a.manufacturerSKU !== void 0 ? (a.count = o[a.id], !0) : !1);
|
|
1179
|
-
if (Array.isArray(i) && i.length > 0) {
|
|
1180
|
-
t.items || (t.items = []);
|
|
1181
|
-
let a = t.items.reduce((n, l) => l.items?.length ? n + l.items.length : n, 0);
|
|
1182
|
-
i.forEach((n) => {
|
|
1183
|
-
const l = {};
|
|
1184
|
-
l.type = "Position", l.name = (++a).toString(), l.articleNumber = n.manufacturerSKU, l.articleName = n.label, l.catalog = n.catalog, l.quantity = n.count, l.height = n.displayedHeight, l.width = n.displayedWidth, l.depth = n.displayedDepth, l.color = n.basecolor, l.procurementType = "PTO", l.additionalData = [], n.perspectiveImage && l.additionalData.push({
|
|
1185
|
-
category: "ArticleImage",
|
|
1186
|
-
downloadUri: n.perspectiveImage,
|
|
1187
|
-
type: "Image"
|
|
1188
|
-
}), t.items.push(l);
|
|
1189
|
-
});
|
|
1190
|
-
}
|
|
1191
|
-
};
|
|
1192
|
-
class J {
|
|
1193
|
-
constructor(t, e) {
|
|
1194
|
-
this._roomlePlanner = t, this._glueLogic = e;
|
|
1195
|
-
}
|
|
1196
|
-
async fetchPrice(t, e) {
|
|
1197
|
-
let o = await this._glueLogic.getGroupDataForOrder(t);
|
|
1198
|
-
return await this._fetchOrderDataWithPrice(o, e);
|
|
1199
|
-
}
|
|
1200
|
-
async placeOrder(t = !0, e) {
|
|
1201
|
-
const o = await this._roomlePlanner.saveExternalObjectSnapshot();
|
|
1202
|
-
if (!o) {
|
|
1203
|
-
console.error("Could not save plan snapshot before placing order");
|
|
1204
|
-
return;
|
|
1205
|
-
}
|
|
1206
|
-
let r = t ? await this._fetchOrderDataWithPrice(o.orderData, e) : null, s;
|
|
1207
|
-
r ? s = r.orderData : (s = this._createOrder(e), s.items.push(o.orderData), await k(this._roomlePlanner, o.orderData)), this._addAdditionalDataToOrder(s.items[0], o), await this._glueLogic.hiCallbacks?.onPlaceOrder(s);
|
|
1208
|
-
}
|
|
1209
|
-
_addAdditionalDataToOrder(t, e) {
|
|
1210
|
-
Array.isArray(t.additionalData) || (t.additionalData = []), e.perspectiveImageLink && t.additionalData.push({
|
|
1211
|
-
type: "Image",
|
|
1212
|
-
category: "OverviewImage",
|
|
1213
|
-
downloadUri: e.perspectiveImageLink
|
|
1214
|
-
}), e.topImageLink && t.additionalData.push({
|
|
1215
|
-
type: "Image",
|
|
1216
|
-
category: "AboveImage",
|
|
1217
|
-
downloadUri: e.topImageLink
|
|
1218
|
-
}), e.objectGlbLink && t.additionalData.push({
|
|
1219
|
-
type: "ThreeD",
|
|
1220
|
-
category: "ThreeDModel",
|
|
1221
|
-
downloadUri: e.objectGlbLink
|
|
1222
|
-
});
|
|
1223
|
-
}
|
|
1224
|
-
async _fetchOrderDataWithPrice(t, e) {
|
|
1225
|
-
let o = this._createOrder(e);
|
|
1226
|
-
return o.items.push(t), this._glueLogic.hiCallbacks?.onFetchPrice(o);
|
|
1227
|
-
}
|
|
1228
|
-
_createOrder(t) {
|
|
1229
|
-
return t ? {
|
|
1230
|
-
...t,
|
|
1231
|
-
items: []
|
|
1232
|
-
} : U();
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
class x {
|
|
1236
|
-
constructor(t, e) {
|
|
1237
|
-
this._glueLogic = t, this._hiCallbacks = e;
|
|
1238
|
-
}
|
|
1239
|
-
get hiCallbacks() {
|
|
1240
|
-
return this._hiCallbacks;
|
|
1241
|
-
}
|
|
1242
|
-
get hiObjectSelection() {
|
|
1243
|
-
return this._glueLogic.hiObjectSelection;
|
|
1244
|
-
}
|
|
1245
|
-
_logRequest(t, ...e) {
|
|
1246
|
-
let o = t;
|
|
1247
|
-
e && e.forEach((r) => {
|
|
1248
|
-
o += " " + r;
|
|
1249
|
-
}), this._hiCallbacks.onLogMessage?.("HI REQUEST", o);
|
|
1250
|
-
}
|
|
1251
|
-
isLibraryLoaded(t) {
|
|
1252
|
-
return this._glueLogic.isLibraryLoaded(t);
|
|
1253
|
-
}
|
|
1254
|
-
getLibraryData(t) {
|
|
1255
|
-
return this._glueLogic.getLibraryData(t);
|
|
1256
|
-
}
|
|
1257
|
-
addLibrary(t) {
|
|
1258
|
-
return this._logRequest("addLibrary", t.libraryId), this._glueLogic.addLibrary(t);
|
|
1259
|
-
}
|
|
1260
|
-
setPosDataForLoading(t) {
|
|
1261
|
-
return this._logRequest("setPosDataForLoading", t ? "set" : "null"), this._glueLogic.setPosDataForLoading(t);
|
|
1262
|
-
}
|
|
1263
|
-
loadPosData(t, e) {
|
|
1264
|
-
this._logRequest("loadPosData", e), this._glueLogic.loadPosData(t, e);
|
|
1265
|
-
}
|
|
1266
|
-
async mergeGroups(t, e, o) {
|
|
1267
|
-
return this._logRequest(
|
|
1268
|
-
"mergeGroups",
|
|
1269
|
-
t.groupId,
|
|
1270
|
-
JSON.stringify(e),
|
|
1271
|
-
o
|
|
1272
|
-
), this._glueLogic.mergeGroups(
|
|
1273
|
-
t,
|
|
1274
|
-
e,
|
|
1275
|
-
o
|
|
1276
|
-
);
|
|
1277
|
-
}
|
|
1278
|
-
deleteRootModule(t, e, o) {
|
|
1279
|
-
return this._logRequest(
|
|
1280
|
-
"deleteRootModule",
|
|
1281
|
-
JSON.stringify(t),
|
|
1282
|
-
e,
|
|
1283
|
-
JSON.stringify(o)
|
|
1284
|
-
), this._glueLogic.deleteRootModule(
|
|
1285
|
-
t,
|
|
1286
|
-
e,
|
|
1287
|
-
o
|
|
1288
|
-
);
|
|
1289
|
-
}
|
|
1290
|
-
splitRootModuleFromGroup(t, e) {
|
|
1291
|
-
return this._logRequest(
|
|
1292
|
-
"splitRootModuleFromGroup",
|
|
1293
|
-
JSON.stringify(t),
|
|
1294
|
-
JSON.stringify(e)
|
|
1295
|
-
), this._glueLogic.splitRootModuleFromGroup(
|
|
1296
|
-
t,
|
|
1297
|
-
e
|
|
1298
|
-
);
|
|
1299
|
-
}
|
|
1300
|
-
async duplicateGroup(t) {
|
|
1301
|
-
return this._logRequest("duplicateGroup", t.groupId), this._glueLogic.duplicateGroup(t);
|
|
1302
|
-
}
|
|
1303
|
-
modifyAttribute(t, e, o, r) {
|
|
1304
|
-
return this._logRequest(
|
|
1305
|
-
"modifyAttribute",
|
|
1306
|
-
t,
|
|
1307
|
-
JSON.stringify(e),
|
|
1308
|
-
o,
|
|
1309
|
-
r
|
|
1310
|
-
), this._glueLogic.modifyAttribute(
|
|
1311
|
-
t,
|
|
1312
|
-
e,
|
|
1313
|
-
o,
|
|
1314
|
-
r
|
|
1315
|
-
);
|
|
1316
|
-
}
|
|
1317
|
-
updateAttribute(t, e, o, r) {
|
|
1318
|
-
return this._logRequest(
|
|
1319
|
-
"updateAttribute",
|
|
1320
|
-
t,
|
|
1321
|
-
e,
|
|
1322
|
-
o,
|
|
1323
|
-
r.toString()
|
|
1324
|
-
), this._glueLogic.updateAttribute(
|
|
1325
|
-
t,
|
|
1326
|
-
e,
|
|
1327
|
-
o,
|
|
1328
|
-
r
|
|
1329
|
-
);
|
|
1330
|
-
}
|
|
1331
|
-
getVerifiedAttributeOptions(t, e) {
|
|
1332
|
-
return this._logRequest(
|
|
1333
|
-
"getVerifiedAttributeOptions",
|
|
1334
|
-
t,
|
|
1335
|
-
e ? JSON.stringify(e) : "[]"
|
|
1336
|
-
), this._glueLogic.getVerifiedAttributeOptions(t, e);
|
|
1337
|
-
}
|
|
1338
|
-
getVerifiedGroupAttributeOptions(t, e) {
|
|
1339
|
-
return this._logRequest(
|
|
1340
|
-
"getVerifiedGroupAttributeOptions",
|
|
1341
|
-
t,
|
|
1342
|
-
e ? JSON.stringify(e) : "[]"
|
|
1343
|
-
), this._glueLogic.getVerifiedGroupAttributeOptions(
|
|
1344
|
-
t,
|
|
1345
|
-
e
|
|
1346
|
-
);
|
|
1347
|
-
}
|
|
1348
|
-
updateProperty(t, e, o) {
|
|
1349
|
-
this._logRequest(
|
|
1350
|
-
"updateProperty",
|
|
1351
|
-
t ?? "undefined",
|
|
1352
|
-
e ?? "undefined",
|
|
1353
|
-
o?.toString() ?? "undefined"
|
|
1354
|
-
), this._glueLogic.updateProperty(t, e, o);
|
|
1355
|
-
}
|
|
1356
|
-
findValidSubArticles(t) {
|
|
1357
|
-
return this._logRequest(
|
|
1358
|
-
"findValidSubArticles",
|
|
1359
|
-
Array.isArray(t) ? JSON.stringify(t) : t
|
|
1360
|
-
), this._glueLogic.findValidSubArticles(t);
|
|
1361
|
-
}
|
|
1362
|
-
getValidContainerModulesForSubArticle(t, e) {
|
|
1363
|
-
return this._logRequest(
|
|
1364
|
-
"getValidContainerModulesForSubArticle",
|
|
1365
|
-
Array.isArray(t) ? JSON.stringify(t) : t,
|
|
1366
|
-
e
|
|
1367
|
-
), this._glueLogic.getValidContainerModulesForSubArticle(
|
|
1368
|
-
t,
|
|
1369
|
-
e
|
|
1370
|
-
);
|
|
1371
|
-
}
|
|
1372
|
-
addSubArticle(t, e, o) {
|
|
1373
|
-
return this._logRequest("addSubArticle", t, e, o), this._glueLogic.addSubArticle(
|
|
1374
|
-
t,
|
|
1375
|
-
e,
|
|
1376
|
-
o
|
|
1377
|
-
);
|
|
1378
|
-
}
|
|
1379
|
-
deleteSubArticles(t, e) {
|
|
1380
|
-
return this._logRequest(
|
|
1381
|
-
"deleteSubArticles",
|
|
1382
|
-
t,
|
|
1383
|
-
Array.isArray(e) ? JSON.stringify(e) : e
|
|
1384
|
-
), this._glueLogic.deleteSubArticles(t, e);
|
|
1385
|
-
}
|
|
1386
|
-
swapRootModule(t, e, o) {
|
|
1387
|
-
return this._logRequest("swapRootModule", t, e, o), this._glueLogic.swapRootModule(t, e, o);
|
|
1388
|
-
}
|
|
1389
|
-
arrangeRootModulesOfGroup(t) {
|
|
1390
|
-
return this._logRequest("arrangeRootModulesOfGroup", JSON.stringify(t)), this._glueLogic.arrangeRootModulesOfGroup(t);
|
|
1391
|
-
}
|
|
1392
|
-
changedGroupPlanningSituation(t) {
|
|
1393
|
-
return this._logRequest("changedGroupPlanningSituation", t.groupId), this._glueLogic.changedGroupPlanningSituation(t);
|
|
1394
|
-
}
|
|
1395
|
-
changedGroupFromHistory(t, e) {
|
|
1396
|
-
this._logRequest(
|
|
1397
|
-
"changedGroupFromHistory",
|
|
1398
|
-
t.id,
|
|
1399
|
-
e.toString()
|
|
1400
|
-
), this._glueLogic.changedGroupFromHistory(t, e);
|
|
1401
|
-
}
|
|
1402
|
-
loadedGroup(t) {
|
|
1403
|
-
return this._logRequest("loadedGroup", t.id), this._glueLogic.loadedGroup(t);
|
|
1404
|
-
}
|
|
1405
|
-
groupsCompletelyLoaded() {
|
|
1406
|
-
this._logRequest("groupsCompletelyLoaded"), this._glueLogic.groupsCompletelyLoaded();
|
|
1407
|
-
}
|
|
1408
|
-
removedGroup(t) {
|
|
1409
|
-
this._logRequest("removedGroup", t), this._glueLogic.removedGroup(t);
|
|
1410
|
-
}
|
|
1411
|
-
openCloseGroup(t) {
|
|
1412
|
-
this._logRequest("openCloseGroup", t), this._glueLogic.openCloseGroup(t);
|
|
1413
|
-
}
|
|
1414
|
-
getSaveDataGroups() {
|
|
1415
|
-
return this._logRequest("getSaveDataGroups"), this._glueLogic.getSaveDataGroups();
|
|
1416
|
-
}
|
|
1417
|
-
async newPosDataFromId(t) {
|
|
1418
|
-
return this._logRequest("newPosDataFromId", t), this._glueLogic.newPosDataFromId(t);
|
|
1419
|
-
}
|
|
1420
|
-
async newPosDataFromGroup(t) {
|
|
1421
|
-
return this._logRequest("newPosDataFromId", JSON.stringify(t)), this._glueLogic.newPosDataFromGroup(t);
|
|
1422
|
-
}
|
|
1423
|
-
getGroupDataForOrder(t) {
|
|
1424
|
-
return this._logRequest("getGroupDataForOrder", t), this._glueLogic.getGroupDataForOrder(t);
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
class V {
|
|
1428
|
-
constructor(t, e) {
|
|
1429
|
-
this._roomDesignerRequests = t, this._hiCallbacks = e;
|
|
1430
|
-
}
|
|
1431
|
-
_logResponse(t, ...e) {
|
|
1432
|
-
let o = t;
|
|
1433
|
-
e && e.forEach((r) => {
|
|
1434
|
-
o += " " + r;
|
|
1435
|
-
}), this._hiCallbacks.onLogMessage?.("HI RESPONSE", o);
|
|
1436
|
-
}
|
|
1437
|
-
loadMasterData(t) {
|
|
1438
|
-
this._logResponse("loadMasterData"), this._roomDesignerRequests.loadMasterData(t);
|
|
1439
|
-
}
|
|
1440
|
-
async loadPosGroups(t, e) {
|
|
1441
|
-
const o = Array.isArray(t) ? t.map((r) => r.id).join(",") : t.id;
|
|
1442
|
-
return this._logResponse(
|
|
1443
|
-
"loadPosGroups",
|
|
1444
|
-
o,
|
|
1445
|
-
e.newAction?.toString() ?? "false",
|
|
1446
|
-
e.findFreeSpaceInPlan?.toString() ?? "false",
|
|
1447
|
-
e.correctArrangement?.toString() ?? "false",
|
|
1448
|
-
e.moduleIdMap ? JSON.stringify(e.moduleIdMap) : "[]",
|
|
1449
|
-
e.mergedGroups ? JSON.stringify(e.mergedGroups) : "[]",
|
|
1450
|
-
e.respondWithPositionInPlan?.toString() ?? "false"
|
|
1451
|
-
), this._roomDesignerRequests.loadPosGroups(t, e);
|
|
1452
|
-
}
|
|
1453
|
-
completelyLoaded() {
|
|
1454
|
-
this._logResponse("completelyLoaded"), this._roomDesignerRequests.completelyLoaded();
|
|
1455
|
-
}
|
|
1456
|
-
async selectGroup(t) {
|
|
1457
|
-
return this._logResponse("selectGroup", t), this._roomDesignerRequests.selectGroup(t);
|
|
1458
|
-
}
|
|
1459
|
-
async selectRoot(t) {
|
|
1460
|
-
return this._logResponse("selectRoot", t), this._roomDesignerRequests.selectRoot(t);
|
|
1461
|
-
}
|
|
1462
|
-
async selectModule(t, e) {
|
|
1463
|
-
return this._logResponse("selectModule", t, e), this._roomDesignerRequests.selectModule(t, e);
|
|
1464
|
-
}
|
|
1465
|
-
openCloseGroup(t, e, o, r) {
|
|
1466
|
-
return this._logResponse(
|
|
1467
|
-
"openCloseGroup",
|
|
1468
|
-
t,
|
|
1469
|
-
e,
|
|
1470
|
-
o.toString(),
|
|
1471
|
-
r.toString()
|
|
1472
|
-
), this._roomDesignerRequests.openCloseGroup(
|
|
1473
|
-
t,
|
|
1474
|
-
e,
|
|
1475
|
-
o,
|
|
1476
|
-
r
|
|
1477
|
-
), Promise.resolve();
|
|
1478
|
-
}
|
|
1479
|
-
deleteGroup(t) {
|
|
1480
|
-
return this._logResponse("deleteGroup", t), this._roomDesignerRequests.deleteGroup(t);
|
|
1481
|
-
}
|
|
1482
|
-
deleteRootModule(t) {
|
|
1483
|
-
return this._logResponse("deleteRootModule", t), this._roomDesignerRequests.deleteRootModule(t);
|
|
1484
|
-
}
|
|
1485
|
-
getPosDataOfAllGroups() {
|
|
1486
|
-
return this._logResponse("getPosDataOfAllGroups"), this._roomDesignerRequests.getPosDataOfAllGroups();
|
|
1487
|
-
}
|
|
1488
|
-
getRoomInformation() {
|
|
1489
|
-
return this._logResponse("getRoomInformation"), this._roomDesignerRequests.getRoomInformation();
|
|
1490
|
-
}
|
|
1491
|
-
saveExternalObjectSnapshot() {
|
|
1492
|
-
return this._logResponse("saveExternalObjectSnapshot"), this._roomDesignerRequests.saveExternalObjectSnapshot();
|
|
1493
|
-
}
|
|
1494
|
-
}
|
|
1495
|
-
console.warn("Homag Intelligence plugin is loaded.");
|
|
1496
|
-
class B extends O {
|
|
1497
|
-
constructor() {
|
|
1498
|
-
super(), this._roomlePlanner = null, this._api = null, this._glueLogic = null, this._orders = null, window.uuidv4 || (window.uuidv4 = F);
|
|
1499
|
-
}
|
|
1500
|
-
async init(t, e, o) {
|
|
1501
|
-
if (this._roomlePlanner = t, this._roomlePlanner.setHomagIntelligence(this), this._api = new P(this._roomlePlanner), e?.debugLogging) {
|
|
1502
|
-
const s = new V(this._api, o), i = new D(s, o);
|
|
1503
|
-
this._glueLogic = new x(
|
|
1504
|
-
i,
|
|
1505
|
-
o
|
|
1506
|
-
);
|
|
1507
|
-
} else
|
|
1508
|
-
this._glueLogic = new D(this._api, o);
|
|
1509
|
-
N(this._roomlePlanner, this._glueLogic);
|
|
1510
|
-
const r = await o.onGetSavedPosGroupData() ?? null;
|
|
1511
|
-
return await this._glueLogic.setPosDataForLoading(r), this._orders = new J(t, this._glueLogic), this;
|
|
1512
|
-
}
|
|
1513
|
-
async loadLibrary(t) {
|
|
1514
|
-
if (!this._glueLogic)
|
|
1515
|
-
throw new Error("GlueLogic not initialized");
|
|
1516
|
-
const e = await this._loadLibraryData(t);
|
|
1517
|
-
this._glueLogic.addLibrary(e);
|
|
1518
|
-
}
|
|
1519
|
-
async loadCatalog(t, e, o) {
|
|
1520
|
-
if (!this._glueLogic)
|
|
1521
|
-
throw new Error("GlueLogic not initialized");
|
|
1522
|
-
o?.setEmulator(this._glueLogic), this._glueLogic.loadPosData(await e, t);
|
|
1523
|
-
}
|
|
1524
|
-
async _loadLibraryData(t) {
|
|
1525
|
-
if (this._glueLogic.isLibraryLoaded(t))
|
|
1526
|
-
return this._glueLogic.getLibraryData(t);
|
|
1527
|
-
const e = this._glueLogic.hiCallbacks, { masterData: o, libraryExports: r } = await this._requestHiLibrary(
|
|
1528
|
-
t,
|
|
1529
|
-
e
|
|
1530
|
-
);
|
|
1531
|
-
return this._loadMasterData(o), {
|
|
1532
|
-
libraryId: t,
|
|
1533
|
-
masterData: o,
|
|
1534
|
-
posGroupVersion: 1,
|
|
1535
|
-
calculateGroup: (i) => r.calc(i),
|
|
1536
|
-
getOrderData: (i, a, n) => r.getOrderData(i, a, n),
|
|
1537
|
-
getAttributesDropDownValues: async (i, a) => {
|
|
1538
|
-
const n = a ? Array.isArray(a) ? a : [a] : i.attributes.map((c) => c.id), l = {};
|
|
1539
|
-
for (const c of n)
|
|
1540
|
-
try {
|
|
1541
|
-
const h = r.getAttributesDropDownValues(
|
|
1542
|
-
i,
|
|
1543
|
-
c
|
|
1544
|
-
);
|
|
1545
|
-
l[c] = h;
|
|
1546
|
-
} catch (h) {
|
|
1547
|
-
console.error(h), l[c] = [];
|
|
1548
|
-
}
|
|
1549
|
-
return l;
|
|
1550
|
-
},
|
|
1551
|
-
solveModuleAttributeConflict: (i, a, n) => r.solveModuleAttributeConflict ? r.solveModuleAttributeConflict(
|
|
1552
|
-
i,
|
|
1553
|
-
a,
|
|
1554
|
-
n
|
|
1555
|
-
) : void 0,
|
|
1556
|
-
getValidSubArticles(i, a, n) {
|
|
1557
|
-
return r.getValidSubArticles ? r.getValidSubArticles(
|
|
1558
|
-
i,
|
|
1559
|
-
a,
|
|
1560
|
-
n
|
|
1561
|
-
) : [];
|
|
1562
|
-
},
|
|
1563
|
-
getValidContainerModulesForSubArticle(i, a, n) {
|
|
1564
|
-
return r.getValidContainerModulesForSubArticle ? r.getValidContainerModulesForSubArticle(
|
|
1565
|
-
i,
|
|
1566
|
-
a,
|
|
1567
|
-
n
|
|
1568
|
-
) : [];
|
|
1569
|
-
},
|
|
1570
|
-
addSubArticle(i, a, n, l) {
|
|
1571
|
-
return r.addSubArticle ? r.addSubArticle(
|
|
1572
|
-
i,
|
|
1573
|
-
a,
|
|
1574
|
-
n,
|
|
1575
|
-
l
|
|
1576
|
-
) : i;
|
|
1577
|
-
},
|
|
1578
|
-
deleteSubArticle(i, a, n) {
|
|
1579
|
-
return r.deleteSubArticle ? r.deleteSubArticle(
|
|
1580
|
-
i,
|
|
1581
|
-
a,
|
|
1582
|
-
n
|
|
1583
|
-
) : i;
|
|
1584
|
-
}
|
|
1585
|
-
};
|
|
1586
|
-
}
|
|
1587
|
-
async _requestHiLibrary(t, e) {
|
|
1588
|
-
if (!this._glueLogic)
|
|
1589
|
-
throw new Error("GlueLogic not initialized");
|
|
1590
|
-
const [o, r] = await Promise.all([
|
|
1591
|
-
e.onLoadMasterData(t),
|
|
1592
|
-
e.onLoadJavascript(t)
|
|
1593
|
-
]), s = await this._initCalcScript(r);
|
|
1594
|
-
return {
|
|
1595
|
-
masterData: o,
|
|
1596
|
-
libraryExports: s
|
|
1597
|
-
};
|
|
1598
|
-
}
|
|
1599
|
-
_loadMasterData(t) {
|
|
1600
|
-
if (!this._api)
|
|
1601
|
-
throw new Error("API not initialized");
|
|
1602
|
-
return this._api.loadMasterData(t);
|
|
1603
|
-
}
|
|
1604
|
-
async _initCalcScript(t) {
|
|
1605
|
-
try {
|
|
1606
|
-
window.exports = {};
|
|
1607
|
-
const e = new Blob([t], { type: "text/javascript" }), o = URL.createObjectURL(e);
|
|
1608
|
-
return await import(o), URL.revokeObjectURL(o), window.exports;
|
|
1609
|
-
} catch (e) {
|
|
1610
|
-
throw console.error(e), new Error("Failed to load calc.js!");
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
getGlueLogic() {
|
|
1614
|
-
return this._glueLogic;
|
|
1615
|
-
}
|
|
1616
|
-
async placeOrder(t = !0, e) {
|
|
1617
|
-
await this._orders.placeOrder(t, e);
|
|
1618
|
-
}
|
|
1619
|
-
async fetchPrice(t, e) {
|
|
1620
|
-
return this._orders.fetchPrice(t, e);
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
export {
|
|
1624
|
-
B as HomagIntelligence
|
|
1625
|
-
};
|
|
1626
|
-
//# sourceMappingURL=homag-intelligence-Bb8gfi80.mjs.map
|