kitchen-simulator 4.4.1 → 4.4.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.
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  import { Map } from 'immutable';
9
- import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, MODE_DRAWING_LINE, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT, EXTERNAL_EVENT_UNDO, EXTERNAL_EVENT_REDO, EXTERNAL_EVENT_SET_MOLDING, EXTERNAL_EVENT_PROJECT_SETTING, PROJECT_SETTING_OPTION, EXTERNAL_EVENT_SYNC_SCENE, INTERNAL_EVENT_SYNC_SCENE, EXTERNAL_EVENT_UPDATE_ATTRIBUTE, ATT_ITEM_POS, ATT_LINE_LENGTH, ATT_VERTEXT_ONE, ATT_VERTEXT_TWO, ATT_HOLE_OFFSET_A, ATT_HOLE_OFFSET_B, UNIT_CENTIMETER, UNIT_INCH, EXTERNAL_EVENT_UPDATE_PROPERTY, PROP_FLIP_DOOR_HANDLE, PROP_OPEN_DOORS, EXTERNAL_EVENT_LOAD_PROJECT, INTERNAL_EVENT_ITEMS_CATALOG, EXTERNAL_EVENT_ADD_HOLE, EXTERNAL_EVENT_CENTERING_2D, EXTERNAL_EVENT_DUPLICATE_ELEMENT, EXTERNAL_EVENT_DELETE_ELEMENT, ELEMENT_HOLE, ELEMENT_ITEM, ELEMENT_LINE, EXTERNAL_EVENT_REPLACE_CABINET, FINISHING_TYPE, EXTERNAL_EVENT_SET_FINISHING, EXTERNAL_EVENT_ROTATE_PAN, DOORSTYLE_SCOPE_SINGLE, DOORSTYLE_SCOPE_ALL, DOORSTYLE_SCOPE_MULTIPLE } from "../constants";
9
+ import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, MODE_DRAWING_LINE, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT, EXTERNAL_EVENT_UNDO, EXTERNAL_EVENT_REDO, EXTERNAL_EVENT_SET_MOLDING, EXTERNAL_EVENT_PROJECT_SETTING, PROJECT_SETTING_OPTION, EXTERNAL_EVENT_SYNC_SCENE, INTERNAL_EVENT_SYNC_SCENE, EXTERNAL_EVENT_UPDATE_ATTRIBUTE, ATT_ITEM_POS, ATT_LINE_LENGTH, ATT_VERTEXT_ONE, ATT_VERTEXT_TWO, ATT_HOLE_OFFSET_A, ATT_HOLE_OFFSET_B, UNIT_CENTIMETER, UNIT_INCH, EXTERNAL_EVENT_UPDATE_PROPERTY, PROP_FLIP_DOOR_HANDLE, PROP_OPEN_DOORS, EXTERNAL_EVENT_LOAD_PROJECT, INTERNAL_EVENT_ITEMS_CATALOG, EXTERNAL_EVENT_ADD_HOLE, EXTERNAL_EVENT_CENTERING_2D, EXTERNAL_EVENT_DUPLICATE_ELEMENT, EXTERNAL_EVENT_DELETE_ELEMENT, ELEMENT_HOLE, ELEMENT_ITEM, ELEMENT_LINE, EXTERNAL_EVENT_REPLACE_CABINET, FINISHING_TYPE, EXTERNAL_EVENT_SET_FINISHING, EXTERNAL_EVENT_ROTATE_PAN, DOORSTYLE_SCOPE_SINGLE, DOORSTYLE_SCOPE_ALL, DOORSTYLE_SCOPE_MULTIPLE, DEFAULT_MOLDING_PIECE_LENGTH } from "../constants";
10
10
  import { isEmpty, updateViwer2D, centering2D } from "./helper";
11
11
  import exporter from "../catalog/utils/exporter";
12
12
  import { render2DItem, render3DItem, render3DApplianceItem, render3DLightingItem } from "../catalog/utils/item-loader";
@@ -40,7 +40,7 @@ var __svgCache = new Map(); // url -> Promise<svgData|null>
40
40
  function loadJSON(_x) {
41
41
  return _loadJSON.apply(this, arguments);
42
42
  }
43
- /***** Update cabinetPayloadData with updatedTempPlaceholders *****/
43
+ /********Parse TempPlaceholder from cabinetPayloadData **************/
44
44
  function _loadJSON() {
45
45
  _loadJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(path) {
46
46
  var p;
@@ -79,27 +79,407 @@ function _loadJSON() {
79
79
  }));
80
80
  return _loadJSON.apply(this, arguments);
81
81
  }
82
- function updateCabinetPayload(_x2) {
82
+ function parseTempPlaceholdersFromCabinetPayload(_x2) {
83
+ return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
84
+ }
85
+ /***** Update cabinetPayloadData with updatedTempPlaceholders *****/
86
+ function _parseTempPlaceholdersFromCabinetPayload() {
87
+ _parseTempPlaceholdersFromCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(cabinetPayload) {
88
+ var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2, tempPlaceholdersData, _loop3, tempData, doorKey, drawerKey, fixedKey, doorPHs, drawerPHs, has_single_door, fixedPHs, k, _cabinetPayload$struc3, _t2, _t3, _t4;
89
+ return _regeneratorRuntime.wrap(function (_context5) {
90
+ while (1) switch (_context5.prev = _context5.next) {
91
+ case 0:
92
+ link = '';
93
+ keys = Object.keys(cabinetPayload.structure_json);
94
+ temp = [];
95
+ i = 0;
96
+ case 1:
97
+ if (!(i < keys.length)) {
98
+ _context5.next = 4;
99
+ break;
100
+ }
101
+ if (!((_cabinetPayload$struc = cabinetPayload.structure_json[keys[i]]) !== null && _cabinetPayload$struc !== void 0 && (_cabinetPayload$struc = _cabinetPayload$struc.toString()) !== null && _cabinetPayload$struc !== void 0 && _cabinetPayload$struc.includes('.gltf') && (_cabinetPayload$struc2 = cabinetPayload.structure_json[keys[i]]) !== null && _cabinetPayload$struc2 !== void 0 && (_cabinetPayload$struc2 = _cabinetPayload$struc2.toString()) !== null && _cabinetPayload$struc2 !== void 0 && _cabinetPayload$struc2.startsWith('http'))) {
102
+ _context5.next = 3;
103
+ break;
104
+ }
105
+ link = cabinetPayload.structure_json[keys[i]];
106
+ _t2 = temp;
107
+ _t3 = keys[i];
108
+ _context5.next = 2;
109
+ return loadJSON(link);
110
+ case 2:
111
+ _t4 = _context5.sent;
112
+ _t2.push.call(_t2, {
113
+ name: _t3,
114
+ data: _t4
115
+ });
116
+ case 3:
117
+ i++;
118
+ _context5.next = 1;
119
+ break;
120
+ case 4:
121
+ tempPlaceholdersData = [];
122
+ _loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3(k) {
123
+ var el;
124
+ return _regeneratorRuntime.wrap(function (_context4) {
125
+ while (1) switch (_context4.prev = _context4.next) {
126
+ case 0:
127
+ el = cabinetPayload.structure_json.tempPlaceholders[k].id;
128
+ tempData = {};
129
+ doorKey = 0;
130
+ drawerKey = 0;
131
+ fixedKey = 0;
132
+ doorPHs = 0;
133
+ drawerPHs = 0;
134
+ has_single_door = false;
135
+ fixedPHs = 0;
136
+ temp.forEach(function (t, index) {
137
+ var nodes = t.data.nodes;
138
+ if (nodes === undefined) {
139
+ nodes = [];
140
+ }
141
+ var tempPlaceholders = nodes.filter(function (element) {
142
+ return element.name.startsWith('ph_');
143
+ });
144
+ tempPlaceholders.sort(function (a, b) {
145
+ return a.name > b.name ? 1 : -1;
146
+ });
147
+ if (tempPlaceholders.length > 0) {
148
+ if (t.name === 'base') {
149
+ tempPlaceholders.map(function (element) {
150
+ var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
151
+ if (sink_match && sink_match.length >= 2) {
152
+ var _process$env$API_URL, _cabinetPayload$struc4;
153
+ tempData['sink'] = tempData['sink'] || [];
154
+ tempData['sink'].push(element.name);
155
+ var sink_url = (_process$env$API_URL = process.env.API_URL) !== null && _process$env$API_URL !== void 0 ? _process$env$API_URL :
156
+ // server url from 3DTool env
157
+ import.meta.env.VITE_APP_API_URL + // server url from Host env
158
+ "/uploads/assets/default/".concat(sink_match[1], ".gltf");
159
+ if (cabinetPayload !== null && cabinetPayload !== void 0 && (_cabinetPayload$struc4 = cabinetPayload.structure_json) !== null && _cabinetPayload$struc4 !== void 0 && (_cabinetPayload$struc4 = _cabinetPayload$struc4.tempPlaceholders[k]) !== null && _cabinetPayload$struc4 !== void 0 && _cabinetPayload$struc4.structure) cabinetPayload.structure_json.tempPlaceholders[k].structure.sink = sink_url;
160
+ } else if (temp.some(function (felement) {
161
+ return felement.name.includes('base_drawer');
162
+ }) && element.name.includes('interior_drawer')) {
163
+ var objCnt = temp.filter(function (felement) {
164
+ return felement.name.includes('base_drawer') && !felement.name.includes('_door');
165
+ }).length;
166
+ var phCnt = tempPlaceholders.filter(function (felement) {
167
+ return felement.name.includes('interior');
168
+ }).length;
169
+ drawerPHs = phCnt;
170
+ if (objCnt === 1 || phCnt % objCnt !== 0) {
171
+ if (tempData['base_drawer_1'] === undefined) {
172
+ tempData['base_drawer_1'] = [];
173
+ }
174
+ tempData['base_drawer_1'].push(element.name);
175
+ drawerKey++;
176
+ } else if (objCnt > 1 && phCnt % objCnt === 0) {
177
+ if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
178
+ tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
179
+ }
180
+ tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
181
+ drawerKey++;
182
+ }
183
+ } else if (temp.some(function (felement) {
184
+ return felement.name.includes('base_door');
185
+ }) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
186
+ var _objCnt = temp.filter(function (felement) {
187
+ return felement.name.includes('base_door');
188
+ }).length;
189
+ var _phCnt = tempPlaceholders.filter(function (felement) {
190
+ return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
191
+ }).length;
192
+ doorPHs = _phCnt;
193
+ if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
194
+ if (tempData['base_door_1'] === undefined) {
195
+ tempData['base_door_1'] = [];
196
+ }
197
+ tempData['base_door_1'].push(element.name);
198
+ doorKey++;
199
+ } else if (_objCnt > 1) {
200
+ if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
201
+ tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
202
+ }
203
+ tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
204
+ doorKey++;
205
+ }
206
+ } else if (temp.some(function (felement) {
207
+ return felement.name.includes('base_fixed_drawer_door');
208
+ }) && element.name.includes('_drawer_door_fixed')) {
209
+ var _objCnt2 = temp.filter(function (felement) {
210
+ return felement.name.includes('base_fixed_drawer_door');
211
+ }).length;
212
+ var _phCnt2 = tempPlaceholders.filter(function (felement) {
213
+ return felement.name.includes('_drawer_door_fixed');
214
+ }).length;
215
+ fixedPHs = _phCnt2;
216
+ if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
217
+ if (tempData['base_fixed_drawer_door_1'] === undefined) {
218
+ tempData['base_fixed_drawer_door_1'] = [];
219
+ }
220
+ tempData['base_fixed_drawer_door_1'].push(element.name);
221
+ fixedKey++;
222
+ } else if (_objCnt2 > 1) {
223
+ if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
224
+ tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
225
+ }
226
+ tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
227
+ fixedKey++;
228
+ }
229
+ }
230
+ });
231
+ } else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
232
+ var objCnt = temp.filter(function (felement) {
233
+ return felement.name.includes('base_drawer') && !felement.name.includes('_door');
234
+ }).length;
235
+ if (objCnt === 1 || drawerPHs % objCnt !== 0) {
236
+ if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
237
+ //get drawer door handle placeholders
238
+ var ph_temp = temp.find(function (felement) {
239
+ return felement.name === 'base_drawer_door_1';
240
+ });
241
+ if (ph_temp != undefined) {
242
+ var ph_drawer_door_handle = ph_temp.data.nodes;
243
+ ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
244
+ return element.name.startsWith('ph_') && element.name.includes('handle');
245
+ });
246
+ for (var w = 0; w < drawerPHs; w++) {
247
+ if (!tempData['base_drawer_door_1'].some(function (el) {
248
+ return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
249
+ })) {
250
+ tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
251
+ //add drawer door handle placeholders
252
+ if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
253
+ if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
254
+ }
255
+ }
256
+ }
257
+ } else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
258
+ if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
259
+ //get drawer door handle placeholders
260
+ var ph_temp = temp.find(function (felement) {
261
+ return felement.name === 'base_drawer_door' + t.name.slice(-2);
262
+ });
263
+ if (ph_temp != undefined) {
264
+ var ph_drawer_door_handle = ph_temp.data.nodes;
265
+ ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
266
+ return element.name.startsWith('ph_') && element.name.includes('handle');
267
+ });
268
+ tempPlaceholders.forEach(function (element) {
269
+ if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
270
+ return el === t.name + '/' + element.name;
271
+ })) {
272
+ tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
273
+ //add drawer door handle placeholders
274
+ if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
275
+ if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle' + t.name.slice(-2)].push('base_drawer_door' + t.name.slice(-2) + '/' + ph_drawer_door_handle[0].name);
276
+ }
277
+ });
278
+ }
279
+ }
280
+ } else if (t.name.includes('base_door')) {
281
+ var _objCnt3 = temp.filter(function (felement) {
282
+ return felement.name.includes('base_door');
283
+ }).length;
284
+ tempPlaceholders = tempPlaceholders.filter(function (el) {
285
+ return el.name.includes('handle');
286
+ });
287
+ if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
288
+ if (tempData['door_handle_1'] === undefined) {
289
+ tempData['door_handle_1'] = [];
290
+ }
291
+ var _loop4 = function _loop4() {
292
+ var phname = tempPlaceholders[0].name;
293
+ var newph = undefined;
294
+ if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
295
+ newph = tempPlaceholders.find(function (el) {
296
+ return el.name.isRightPlaceholder();
297
+ });
298
+ }
299
+ if (tempData['base_door_1'][_w].isRightPlaceholder()) {
300
+ newph = tempPlaceholders.find(function (el) {
301
+ return el.name.isLeftPlaceholder();
302
+ });
303
+ }
304
+ if (newph != undefined) {
305
+ phname = newph.name;
306
+ }
307
+ if (doorPHs === 1 && tempPlaceholders.find(function (el) {
308
+ return el.name.isLeftPlaceholder();
309
+ }) != undefined && tempPlaceholders.find(function (el) {
310
+ return el.name.isRightPlaceholder();
311
+ }) != undefined) {
312
+ has_single_door = true;
313
+ }
314
+ if (!tempData['door_handle_1'].some(function (el) {
315
+ return el === 'door_handle_1/' + phname;
316
+ })) {
317
+ tempData['door_handle_1'].push('base_door_1/' + phname);
318
+ }
319
+ };
320
+ for (var _w = 0; _w < doorPHs; _w++) {
321
+ _loop4();
322
+ }
323
+ } else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
324
+ if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
325
+ var phname = tempPlaceholders[0].name;
326
+ var newph = undefined;
327
+ var blAdd = true;
328
+ if (cabinetPayload.is_corner) {
329
+ if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
330
+ newph = tempPlaceholders.find(function (el) {
331
+ return el.name.isLeftPlaceholder();
332
+ });
333
+ } else {
334
+ blAdd = false;
335
+ }
336
+ } else {
337
+ if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
338
+ newph = tempPlaceholders.find(function (el) {
339
+ return el.name.isRightPlaceholder();
340
+ });
341
+ }
342
+ if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
343
+ newph = tempPlaceholders.find(function (el) {
344
+ return el.name.isLeftPlaceholder();
345
+ });
346
+ }
347
+ }
348
+ if (blAdd) {
349
+ if (newph != undefined) {
350
+ phname = newph.name;
351
+ }
352
+ if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
353
+ return el === t.name + '/' + phname;
354
+ })) {
355
+ tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
356
+ }
357
+ }
358
+ }
359
+ } else if (t.name.includes('base_fixed_drawer_door')) {
360
+ var _objCnt4 = temp.filter(function (felement) {
361
+ return felement.name.includes('base_fixed_drawer_door');
362
+ }).length;
363
+ tempPlaceholders = tempPlaceholders.filter(function (el) {
364
+ return el.name.includes('handle');
365
+ });
366
+ if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
367
+ if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
368
+ var _loop5 = function _loop5() {
369
+ var phname = tempPlaceholders[0].name;
370
+ var newph = undefined;
371
+ if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
372
+ newph = tempPlaceholders.find(function (el) {
373
+ return el.name.isRightPlaceholder();
374
+ });
375
+ }
376
+ if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
377
+ newph = tempPlaceholders.find(function (el) {
378
+ return el.name.isLeftPlaceholder();
379
+ });
380
+ }
381
+ if (newph != undefined) {
382
+ phname = newph.name;
383
+ }
384
+ if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
385
+ return el === 'fixed_drawer_door_handle_1/' + phname;
386
+ })) {
387
+ tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
388
+ }
389
+ };
390
+ for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
391
+ _loop5();
392
+ }
393
+ } else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
394
+ if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
395
+ tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
396
+ }
397
+ var _phname = tempPlaceholders[0].name;
398
+ var _newph = undefined;
399
+ if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
400
+ _newph = tempPlaceholders.find(function (el) {
401
+ return el.name.isRightPlaceholder();
402
+ });
403
+ }
404
+ if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
405
+ _newph = tempPlaceholders.find(function (el) {
406
+ return el.name.isLeftPlaceholder();
407
+ });
408
+ }
409
+ if (_newph != undefined) {
410
+ _phname = _newph.name;
411
+ }
412
+ if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
413
+ return el === t.name + '/' + _phname;
414
+ })) {
415
+ tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
416
+ }
417
+ }
418
+ }
419
+ }
420
+ });
421
+ tempPlaceholdersData.push({
422
+ id: parseInt(el, 10),
423
+ placeholders: tempData,
424
+ structure: cabinetPayload.structure_json.tempPlaceholders[k].structure
425
+ });
426
+ case 1:
427
+ case "end":
428
+ return _context4.stop();
429
+ }
430
+ }, _loop3);
431
+ });
432
+ k = 0;
433
+ case 5:
434
+ if (!(k < (cabinetPayload === null || cabinetPayload === void 0 || (_cabinetPayload$struc3 = cabinetPayload.structure_json) === null || _cabinetPayload$struc3 === void 0 || (_cabinetPayload$struc3 = _cabinetPayload$struc3.tempPlaceholders) === null || _cabinetPayload$struc3 === void 0 ? void 0 : _cabinetPayload$struc3.length))) {
435
+ _context5.next = 7;
436
+ break;
437
+ }
438
+ return _context5.delegateYield(_loop3(k), "t0", 6);
439
+ case 6:
440
+ k++;
441
+ _context5.next = 5;
442
+ break;
443
+ case 7:
444
+ return _context5.abrupt("return", tempPlaceholdersData);
445
+ case 8:
446
+ case "end":
447
+ return _context5.stop();
448
+ }
449
+ }, _callee4);
450
+ }));
451
+ return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
452
+ }
453
+ function updateCabinetPayload(_x3) {
83
454
  return _updateCabinetPayload.apply(this, arguments);
84
455
  }
85
456
  function _updateCabinetPayload() {
86
- _updateCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(cabinetPayload) {
457
+ _updateCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(cabinetPayload) {
87
458
  var cabinetPayloadKeys, i, _cabinetPayload$cabin, _cabinetPayload$cabin2;
88
- return _regeneratorRuntime.wrap(function (_context4) {
89
- while (1) switch (_context4.prev = _context4.next) {
459
+ return _regeneratorRuntime.wrap(function (_context6) {
460
+ while (1) switch (_context6.prev = _context6.next) {
90
461
  case 0:
462
+ // let tempPlaceholders = [];
463
+ // tempPlaceholders = await parseTempPlaceholdersFromCabinetPayload(
464
+ // cabinetPayload
465
+ // );
91
466
  cabinetPayloadKeys = Object.keys(cabinetPayload);
92
467
  for (i = 0; i < cabinetPayloadKeys.length; i++) {
93
468
  if (cabinetPayloadKeys[i] === 'structure_json') {
94
469
  cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] = (_cabinetPayload$cabin = (_cabinetPayload$cabin2 = cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'][0]) === null || _cabinetPayload$cabin2 === void 0 ? void 0 : _cabinetPayload$cabin2.placeholders) !== null && _cabinetPayload$cabin !== void 0 ? _cabinetPayload$cabin : [];
470
+
471
+ // cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] =
472
+ // tempPlaceholders[0].placeholders;
473
+ // cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'] =
474
+ // tempPlaceholders;
95
475
  }
96
476
  }
97
- return _context4.abrupt("return", cabinetPayload);
477
+ return _context6.abrupt("return", cabinetPayload);
98
478
  case 1:
99
479
  case "end":
100
- return _context4.stop();
480
+ return _context6.stop();
101
481
  }
102
- }, _callee4);
482
+ }, _callee5);
103
483
  }));
104
484
  return _updateCabinetPayload.apply(this, arguments);
105
485
  }
@@ -171,34 +551,34 @@ var loadSVGsByItem = /*#__PURE__*/function () {
171
551
  }
172
552
  }, _callee2);
173
553
  }));
174
- return function loadSVGsByItem(_x3) {
554
+ return function loadSVGsByItem(_x4) {
175
555
  return _ref.apply(this, arguments);
176
556
  };
177
557
  }();
178
- function addItemToCatalog(_x4, _x5, _x6, _x7) {
558
+ function addItemToCatalog(_x5, _x6, _x7, _x8) {
179
559
  return _addItemToCatalog.apply(this, arguments);
180
560
  } // Get attributs of current selected element
181
561
  function _addItemToCatalog() {
182
- _addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(element, state, catalogInstance, projectActions) {
562
+ _addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(element, state, catalogInstance, projectActions) {
183
563
  var _elementJs, _elementJs3;
184
564
  var elementJs, outlineSVGData, _state$getIn, _elementJs$structure_, _elementJs$structure_2, _elementJs$structure_3, cds, _cds$find, _elementJs2, currentCdsId, cdsIdx, ttph, updatedStructureJson, catalogElements, catalogElementKeys, catalogItem, k, _catalogElements$cata, tempPlaceholderArray, _catalogItem$structur, newTempPlaceholderArray, mergedTempPlaceholder;
185
- return _regeneratorRuntime.wrap(function (_context5) {
186
- while (1) switch (_context5.prev = _context5.next) {
565
+ return _regeneratorRuntime.wrap(function (_context7) {
566
+ while (1) switch (_context7.prev = _context7.next) {
187
567
  case 0:
188
568
  if (!isEmpty(element === null || element === void 0 ? void 0 : element.name)) {
189
- _context5.next = 1;
569
+ _context7.next = 1;
190
570
  break;
191
571
  }
192
- return _context5.abrupt("return");
572
+ return _context7.abrupt("return");
193
573
  case 1:
194
574
  // clone element
195
575
  elementJs = Object.assign({}, element); // if (isEmpty(catalog?.elements[element.name])) {
196
- _context5.next = 2;
576
+ _context7.next = 2;
197
577
  return loadSVGsByItem(elementJs);
198
578
  case 2:
199
- outlineSVGData = _context5.sent;
579
+ outlineSVGData = _context7.sent;
200
580
  if (!(((_elementJs = elementJs) === null || _elementJs === void 0 ? void 0 : _elementJs.type) === 'cabinet')) {
201
- _context5.next = 4;
581
+ _context7.next = 4;
202
582
  break;
203
583
  }
204
584
  // move the tempPlaceholder of current door style to first of tempPlaceholders array
@@ -226,13 +606,13 @@ function _addItemToCatalog() {
226
606
  }
227
607
  });
228
608
  if (isEmpty((_elementJs$structure_3 = elementJs.structure_json) === null || _elementJs$structure_3 === void 0 ? void 0 : _elementJs$structure_3.tempPlaceholders)) {
229
- _context5.next = 4;
609
+ _context7.next = 4;
230
610
  break;
231
611
  }
232
- _context5.next = 3;
612
+ _context7.next = 3;
233
613
  return updateCabinetPayload(elementJs);
234
614
  case 3:
235
- elementJs = _context5.sent;
615
+ elementJs = _context7.sent;
236
616
  case 4:
237
617
  elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
238
618
  outlineSVGData: outlineSVGData,
@@ -249,18 +629,18 @@ function _addItemToCatalog() {
249
629
  k = 0;
250
630
  case 5:
251
631
  if (!(k < catalogElementKeys.length)) {
252
- _context5.next = 7;
632
+ _context7.next = 7;
253
633
  break;
254
634
  }
255
635
  if (!(((_catalogElements$cata = catalogElements[catalogElementKeys[k]]) === null || _catalogElements$cata === void 0 ? void 0 : _catalogElements$cata.itemID) === elementJs.itemID)) {
256
- _context5.next = 6;
636
+ _context7.next = 6;
257
637
  break;
258
638
  }
259
639
  catalogItem = catalogElements[catalogElementKeys[k]];
260
- return _context5.abrupt("continue", 7);
640
+ return _context7.abrupt("continue", 7);
261
641
  case 6:
262
642
  k++;
263
- _context5.next = 5;
643
+ _context7.next = 5;
264
644
  break;
265
645
  case 7:
266
646
  // get old tempPlaceholder array from catalog item
@@ -291,9 +671,9 @@ function _addItemToCatalog() {
291
671
  }
292
672
  case 8:
293
673
  case "end":
294
- return _context5.stop();
674
+ return _context7.stop();
295
675
  }
296
- }, _callee5);
676
+ }, _callee6);
297
677
  }));
298
678
  return _addItemToCatalog.apply(this, arguments);
299
679
  }
@@ -653,15 +1033,15 @@ function getElement(objProps, state) {
653
1033
  }
654
1034
  return curObject;
655
1035
  }
656
- function loadMoldingSvg(_x8) {
1036
+ function loadMoldingSvg(_x9) {
657
1037
  return _loadMoldingSvg.apply(this, arguments);
658
1038
  }
659
1039
  function _loadMoldingSvg() {
660
- _loadMoldingSvg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(molding) {
661
- return _regeneratorRuntime.wrap(function (_context6) {
662
- while (1) switch (_context6.prev = _context6.next) {
1040
+ _loadMoldingSvg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(molding) {
1041
+ return _regeneratorRuntime.wrap(function (_context8) {
1042
+ while (1) switch (_context8.prev = _context8.next) {
663
1043
  case 0:
664
- return _context6.abrupt("return", new Promise(function (resolve, reject) {
1044
+ return _context8.abrupt("return", new Promise(function (resolve, reject) {
665
1045
  var url = molding === null || molding === void 0 ? void 0 : molding.shape_svg;
666
1046
  if (!url) {
667
1047
  // Skip if no SVG URL available
@@ -683,9 +1063,9 @@ function _loadMoldingSvg() {
683
1063
  }));
684
1064
  case 1:
685
1065
  case "end":
686
- return _context6.stop();
1066
+ return _context8.stop();
687
1067
  }
688
- }, _callee6);
1068
+ }, _callee7);
689
1069
  }));
690
1070
  return _loadMoldingSvg.apply(this, arguments);
691
1071
  }
@@ -826,43 +1206,43 @@ function mergeSameElements(projectItemsCatalog) {
826
1206
  }
827
1207
  return result;
828
1208
  }
829
- export function handleExternalEvent(_x9) {
1209
+ export function handleExternalEvent(_x0) {
830
1210
  return _handleExternalEvent.apply(this, arguments);
831
1211
  }
832
1212
  function _handleExternalEvent() {
833
- _handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(props) {
1213
+ _handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(props) {
834
1214
  var _evt$payload3, _evt$payload4;
835
- var evt, state, layerId, layer, _evt$payload, _state$catalog, cdsItems, itemKeys, _loop3, i, newScene, tempState, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _evt$payload5, doorStyle, itemCDS, applyScope, _evt$payload5$itemIds, itemIds, _layerId, allItems, targetItems, idSet, selectedItemIds, _cdsItems, _loop4, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, measurementUnit, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId2, _layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer2, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$onInternalEven3, sceneData, currentTexture, _t2, _t3, _t4;
836
- return _regeneratorRuntime.wrap(function (_context1) {
837
- while (1) switch (_context1.prev = _context1.next) {
1215
+ var evt, state, layerId, layer, _evt$payload, _state$catalog, cdsItems, itemKeys, _loop6, i, newScene, tempState, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _evt$payload5, doorStyle, itemCDS, applyScope, _evt$payload5$itemIds, itemIds, _layerId, allItems, targetItems, idSet, selectedItemIds, _cdsItems, _loop7, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, measurementUnit, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId2, _layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer2, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$configData$mol, _props$configData, _props$configData$ski, _props$configData2, _props$onInternalEven3, sceneData, currentTexture, moldingPieceLength, skinPanelExclusionSKUs, _t5, _t6, _t7;
1216
+ return _regeneratorRuntime.wrap(function (_context11) {
1217
+ while (1) switch (_context11.prev = _context11.next) {
838
1218
  case 0:
839
1219
  // console.log('***external event****', props.externalEvent);
840
1220
  evt = props.externalEvent;
841
1221
  state = getPlannerStateFromProps(props);
842
1222
  if (state) {
843
- _context1.next = 1;
1223
+ _context11.next = 1;
844
1224
  break;
845
1225
  }
846
- return _context1.abrupt("return");
1226
+ return _context11.abrupt("return");
847
1227
  case 1:
848
1228
  layerId = state.getIn(['scene', 'selectedLayer']);
849
1229
  layer = state.getIn(['scene', 'layers', layerId]);
850
- _t2 = evt === null || evt === void 0 ? void 0 : evt.type;
851
- _context1.next = _t2 === EXTERNAL_EVENT_LOAD_PROJECT ? 2 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 7 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 8 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 9 : _t2 === EXTERNAL_EVENT_ADD_WALL ? 10 : _t2 === EXTERNAL_EVENT_ADD_ITEM ? 11 : _t2 === EXTERNAL_EVENT_ADD_HOLE ? 14 : _t2 === EXTERNAL_EVENT_ROTATE_PAN ? 15 : _t2 === EXTERNAL_EVENT_MOVE_PAN ? 15 : _t2 === EXTERNAL_EVENT_NEW_PROJECT ? 16 : _t2 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 17 : _t2 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 25 : _t2 === EXTERNAL_EVENT_ZOOM_IN ? 26 : _t2 === EXTERNAL_EVENT_ZOOM_OUT ? 27 : _t2 === EXTERNAL_EVENT_CENTERING_2D ? 28 : _t2 === EXTERNAL_EVENT_UNDO ? 29 : _t2 === EXTERNAL_EVENT_REDO ? 30 : _t2 === EXTERNAL_EVENT_SET_MOLDING ? 31 : _t2 === EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 33 : _t2 === EXTERNAL_EVENT_DELETE_ELEMENT ? 34 : _t2 === EXTERNAL_EVENT_PROJECT_SETTING ? 35 : _t2 === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 44 : _t2 === EXTERNAL_EVENT_UPDATE_PROPERTY ? 44 : _t2 === EXTERNAL_EVENT_REPLACE_CABINET ? 45 : _t2 === EXTERNAL_EVENT_SET_FINISHING ? 47 : _t2 === EXTERNAL_EVENT_SYNC_SCENE ? 48 : 49;
1230
+ _t5 = evt === null || evt === void 0 ? void 0 : evt.type;
1231
+ _context11.next = _t5 === EXTERNAL_EVENT_LOAD_PROJECT ? 2 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 7 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 8 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 9 : _t5 === EXTERNAL_EVENT_ADD_WALL ? 10 : _t5 === EXTERNAL_EVENT_ADD_ITEM ? 11 : _t5 === EXTERNAL_EVENT_ADD_HOLE ? 14 : _t5 === EXTERNAL_EVENT_ROTATE_PAN ? 15 : _t5 === EXTERNAL_EVENT_MOVE_PAN ? 15 : _t5 === EXTERNAL_EVENT_NEW_PROJECT ? 16 : _t5 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 17 : _t5 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 25 : _t5 === EXTERNAL_EVENT_ZOOM_IN ? 26 : _t5 === EXTERNAL_EVENT_ZOOM_OUT ? 27 : _t5 === EXTERNAL_EVENT_CENTERING_2D ? 28 : _t5 === EXTERNAL_EVENT_UNDO ? 29 : _t5 === EXTERNAL_EVENT_REDO ? 30 : _t5 === EXTERNAL_EVENT_SET_MOLDING ? 31 : _t5 === EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 33 : _t5 === EXTERNAL_EVENT_DELETE_ELEMENT ? 34 : _t5 === EXTERNAL_EVENT_PROJECT_SETTING ? 35 : _t5 === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 44 : _t5 === EXTERNAL_EVENT_UPDATE_PROPERTY ? 44 : _t5 === EXTERNAL_EVENT_REPLACE_CABINET ? 45 : _t5 === EXTERNAL_EVENT_SET_FINISHING ? 47 : _t5 === EXTERNAL_EVENT_SYNC_SCENE ? 48 : 49;
852
1232
  break;
853
1233
  case 2:
854
1234
  if (!(evt !== null && evt !== void 0 && evt.payload)) {
855
- _context1.next = 6;
1235
+ _context11.next = 6;
856
1236
  break;
857
1237
  }
858
1238
  // prepare item data request
859
1239
  cdsItems = [];
860
1240
  itemKeys = evt !== null && evt !== void 0 && (_evt$payload = evt.payload) !== null && _evt$payload !== void 0 && (_evt$payload = _evt$payload.layers['layer-1']) !== null && _evt$payload !== void 0 && _evt$payload.items ? Object.keys(evt.payload.layers['layer-1'].items) : [];
861
- _loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3() {
1241
+ _loop6 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop6() {
862
1242
  var _evt$payload2, _it$properties, _it$properties2, _it$properties3, _it$doorStyle2;
863
1243
  var it;
864
- return _regeneratorRuntime.wrap(function (_context8) {
865
- while (1) switch (_context8.prev = _context8.next) {
1244
+ return _regeneratorRuntime.wrap(function (_context0) {
1245
+ while (1) switch (_context0.prev = _context0.next) {
866
1246
  case 0:
867
1247
  it = evt === null || evt === void 0 || (_evt$payload2 = evt.payload) === null || _evt$payload2 === void 0 || (_evt$payload2 = _evt$payload2.layers['layer-1']) === null || _evt$payload2 === void 0 ? void 0 : _evt$payload2.items[itemKeys[i]]; //////// check altitude of item property and change length from _length (convert length from 'in' fo 'cm')
868
1248
  if (it !== null && it !== void 0 && (_it$properties = it.properties) !== null && _it$properties !== void 0 && (_it$properties = _it$properties.altitude) !== null && _it$properties !== void 0 && _it$properties.length && it !== null && it !== void 0 && (_it$properties2 = it.properties) !== null && _it$properties2 !== void 0 && (_it$properties2 = _it$properties2.altitude) !== null && _it$properties2 !== void 0 && _it$properties2._unit && it !== null && it !== void 0 && (_it$properties3 = it.properties) !== null && _it$properties3 !== void 0 && (_it$properties3 = _it$properties3.altitude) !== null && _it$properties3 !== void 0 && _it$properties3._length && it.properties.altitude.length !== convert(it.properties.altitude._length).from(it.properties.altitude._unit).to('cm')) {
@@ -883,20 +1263,20 @@ function _handleExternalEvent() {
883
1263
  });
884
1264
  case 1:
885
1265
  case "end":
886
- return _context8.stop();
1266
+ return _context0.stop();
887
1267
  }
888
- }, _loop3);
1268
+ }, _loop6);
889
1269
  });
890
1270
  i = 0;
891
1271
  case 3:
892
1272
  if (!(i < itemKeys.length)) {
893
- _context1.next = 5;
1273
+ _context11.next = 5;
894
1274
  break;
895
1275
  }
896
- return _context1.delegateYield(_loop3(), "t0", 4);
1276
+ return _context11.delegateYield(_loop6(), "t0", 4);
897
1277
  case 4:
898
1278
  i++;
899
- _context1.next = 3;
1279
+ _context11.next = 3;
900
1280
  break;
901
1281
  case 5:
902
1282
  newScene = new Scene(evt === null || evt === void 0 ? void 0 : evt.payload);
@@ -911,63 +1291,63 @@ function _handleExternalEvent() {
911
1291
  cdsItems: cdsItems
912
1292
  }
913
1293
  }, /*#__PURE__*/function () {
914
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(result) {
1294
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(result) {
915
1295
  var rt, _i;
916
- return _regeneratorRuntime.wrap(function (_context7) {
917
- while (1) switch (_context7.prev = _context7.next) {
1296
+ return _regeneratorRuntime.wrap(function (_context9) {
1297
+ while (1) switch (_context9.prev = _context9.next) {
918
1298
  case 0:
919
1299
  rt = mergeSameElements(result === null || result === void 0 ? void 0 : result.elements);
920
1300
  _i = 0;
921
1301
  case 1:
922
1302
  if (!(_i < (rt === null || rt === void 0 ? void 0 : rt.length))) {
923
- _context7.next = 3;
1303
+ _context9.next = 3;
924
1304
  break;
925
1305
  }
926
- _context7.next = 2;
1306
+ _context9.next = 2;
927
1307
  return addItemToCatalog(rt[_i], tempState, props.catalog, props.projectActions);
928
1308
  case 2:
929
1309
  _i++;
930
- _context7.next = 1;
1310
+ _context9.next = 1;
931
1311
  break;
932
1312
  case 3:
933
1313
  props.projectActions.loadProject(evt.payload);
934
1314
  case 4:
935
1315
  case "end":
936
- return _context7.stop();
1316
+ return _context9.stop();
937
1317
  }
938
- }, _callee7);
1318
+ }, _callee8);
939
1319
  }));
940
- return function (_x0) {
1320
+ return function (_x1) {
941
1321
  return _ref3.apply(this, arguments);
942
1322
  };
943
1323
  }());
944
1324
  } else props.projectActions.loadProject(evt.payload);
945
1325
  case 6:
946
- return _context1.abrupt("continue", 49);
1326
+ return _context11.abrupt("continue", 49);
947
1327
  case 7:
948
1328
  props.projectActions.unselectAll();
949
1329
  props.projectActions.setMode(MODE_IDLE_3D);
950
- return _context1.abrupt("continue", 49);
1330
+ return _context11.abrupt("continue", 49);
951
1331
  case 8:
952
1332
  props.projectActions.setMode(MODE_IDLE);
953
- return _context1.abrupt("continue", 49);
1333
+ return _context11.abrupt("continue", 49);
954
1334
  case 9:
955
1335
  sLineCnt = layer.selected.lines.size;
956
1336
  if (sLineCnt > 0) props.projectActions.setMode(MODE_ELEVATION_VIEW);
957
- return _context1.abrupt("continue", 49);
1337
+ return _context11.abrupt("continue", 49);
958
1338
  case 10:
959
1339
  if (state.mode === MODE_IDLE || state.mode === MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
960
1340
  props.projectActions.setMode(MODE_IDLE);
961
1341
  props.linesActions.selectToolDrawingLine('wall');
962
1342
  }
963
- return _context1.abrupt("continue", 49);
1343
+ return _context11.abrupt("continue", 49);
964
1344
  case 11:
965
1345
  if (isEmpty(evt === null || evt === void 0 ? void 0 : evt.payload)) {
966
- _context1.next = 13;
1346
+ _context11.next = 13;
967
1347
  break;
968
1348
  }
969
1349
  element = evt.payload;
970
- _context1.next = 12;
1350
+ _context11.next = 12;
971
1351
  return addItemToCatalog(element, state, props.catalog, props.projectActions);
972
1352
  case 12:
973
1353
  // start drawing item
@@ -991,18 +1371,18 @@ function _handleExternalEvent() {
991
1371
  props.projectActions.pushLastSelectedCatalogElementToHistory(element);
992
1372
  props.projectActions.setIsCabinetDrawing(true);
993
1373
  case 13:
994
- return _context1.abrupt("continue", 49);
1374
+ return _context11.abrupt("continue", 49);
995
1375
  case 14:
996
1376
  ARRAY_3D_MODES.includes(state.mode) ? props.holesActions.selectToolDrawingHole3D(evt === null || evt === void 0 || (_evt$payload3 = evt.payload) === null || _evt$payload3 === void 0 ? void 0 : _evt$payload3.holeName) : props.holesActions.selectToolDrawingHole(evt === null || evt === void 0 || (_evt$payload4 = evt.payload) === null || _evt$payload4 === void 0 ? void 0 : _evt$payload4.holeName);
997
- return _context1.abrupt("continue", 49);
1377
+ return _context11.abrupt("continue", 49);
998
1378
  case 15:
999
1379
  moveAndRotatePan2D3D(evt.type, props, evt.payload, state);
1000
- return _context1.abrupt("continue", 49);
1380
+ return _context11.abrupt("continue", 49);
1001
1381
  case 16:
1002
1382
  defaulTitle = 'Untitle';
1003
1383
  props.projectActions.newProject();
1004
1384
  props.projectActions.rename(defaulTitle);
1005
- return _context1.abrupt("continue", 49);
1385
+ return _context11.abrupt("continue", 49);
1006
1386
  case 17:
1007
1387
  _evt$payload5 = evt.payload, doorStyle = _evt$payload5.doorStyle, itemCDS = _evt$payload5.itemCDS, applyScope = _evt$payload5.applyScope, _evt$payload5$itemIds = _evt$payload5.itemIds, itemIds = _evt$payload5$itemIds === void 0 ? [] : _evt$payload5$itemIds;
1008
1388
  _layerId = state.getIn(['scene', 'selectedLayer']);
@@ -1017,27 +1397,27 @@ function _handleExternalEvent() {
1017
1397
  // itemIds contains item.id (instance IDs)
1018
1398
  idSet = new Set(itemIds);
1019
1399
  }
1020
- _t3 = applyScope;
1021
- _context1.next = _t3 === DOORSTYLE_SCOPE_ALL ? 18 : _t3 === DOORSTYLE_SCOPE_SINGLE ? 19 : _t3 === DOORSTYLE_SCOPE_MULTIPLE ? 19 : 20;
1400
+ _t6 = applyScope;
1401
+ _context11.next = _t6 === DOORSTYLE_SCOPE_ALL ? 18 : _t6 === DOORSTYLE_SCOPE_SINGLE ? 19 : _t6 === DOORSTYLE_SCOPE_MULTIPLE ? 19 : 20;
1022
1402
  break;
1023
1403
  case 18:
1024
1404
  targetItems = Object.values(allItems);
1025
- return _context1.abrupt("continue", 21);
1405
+ return _context11.abrupt("continue", 21);
1026
1406
  case 19:
1027
1407
  targetItems = Object.values(allItems).filter(function (item) {
1028
1408
  var _idSet;
1029
1409
  return (_idSet = idSet) === null || _idSet === void 0 ? void 0 : _idSet.has(item.id);
1030
1410
  });
1031
- return _context1.abrupt("continue", 21);
1411
+ return _context11.abrupt("continue", 21);
1032
1412
  case 20:
1033
- return _context1.abrupt("continue", 21);
1413
+ return _context11.abrupt("continue", 21);
1034
1414
  case 21:
1035
1415
  _cdsItems = [];
1036
- _loop4 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop4() {
1416
+ _loop7 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop7() {
1037
1417
  var _itemCDS$find;
1038
1418
  var item, cdsId;
1039
- return _regeneratorRuntime.wrap(function (_context0) {
1040
- while (1) switch (_context0.prev = _context0.next) {
1419
+ return _regeneratorRuntime.wrap(function (_context10) {
1420
+ while (1) switch (_context10.prev = _context10.next) {
1041
1421
  case 0:
1042
1422
  item = targetItems[_i2];
1043
1423
  cdsId = (_itemCDS$find = itemCDS.find(function (itCDS) {
@@ -1058,20 +1438,20 @@ function _handleExternalEvent() {
1058
1438
  }
1059
1439
  case 1:
1060
1440
  case "end":
1061
- return _context0.stop();
1441
+ return _context10.stop();
1062
1442
  }
1063
- }, _loop4);
1443
+ }, _loop7);
1064
1444
  });
1065
1445
  _i2 = 0;
1066
1446
  case 22:
1067
1447
  if (!(_i2 < targetItems.length)) {
1068
- _context1.next = 24;
1448
+ _context11.next = 24;
1069
1449
  break;
1070
1450
  }
1071
- return _context1.delegateYield(_loop4(), "t1", 23);
1451
+ return _context11.delegateYield(_loop7(), "t1", 23);
1072
1452
  case 23:
1073
1453
  _i2++;
1074
- _context1.next = 22;
1454
+ _context11.next = 22;
1075
1455
  break;
1076
1456
  case 24:
1077
1457
  if (_cdsItems.length > 0) {
@@ -1081,44 +1461,44 @@ function _handleExternalEvent() {
1081
1461
  cdsItems: _cdsItems
1082
1462
  }
1083
1463
  }, /*#__PURE__*/function () {
1084
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(result) {
1464
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(result) {
1085
1465
  var rt, _i3;
1086
- return _regeneratorRuntime.wrap(function (_context9) {
1087
- while (1) switch (_context9.prev = _context9.next) {
1466
+ return _regeneratorRuntime.wrap(function (_context1) {
1467
+ while (1) switch (_context1.prev = _context1.next) {
1088
1468
  case 0:
1089
1469
  rt = mergeSameElements(result === null || result === void 0 ? void 0 : result.elements);
1090
1470
  _i3 = 0;
1091
1471
  case 1:
1092
1472
  if (!(_i3 < (rt === null || rt === void 0 ? void 0 : rt.length))) {
1093
- _context9.next = 3;
1473
+ _context1.next = 3;
1094
1474
  break;
1095
1475
  }
1096
- _context9.next = 2;
1476
+ _context1.next = 2;
1097
1477
  return addItemToCatalog(rt[_i3], state, props.catalog, props.projectActions);
1098
1478
  case 2:
1099
1479
  _i3++;
1100
- _context9.next = 1;
1480
+ _context1.next = 1;
1101
1481
  break;
1102
1482
  case 3:
1103
1483
  props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
1104
1484
  case 4:
1105
1485
  case "end":
1106
- return _context9.stop();
1486
+ return _context1.stop();
1107
1487
  }
1108
- }, _callee8);
1488
+ }, _callee9);
1109
1489
  }));
1110
- return function (_x1) {
1490
+ return function (_x10) {
1111
1491
  return _ref4.apply(this, arguments);
1112
1492
  };
1113
1493
  }());
1114
1494
  } else {
1115
1495
  props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
1116
1496
  }
1117
- return _context1.abrupt("continue", 49);
1497
+ return _context11.abrupt("continue", 49);
1118
1498
  case 25:
1119
1499
  _evt$payload6 = evt.payload, roomShapeType = _evt$payload6.roomShapeType, width = _evt$payload6.width, height = _evt$payload6.height, measurementUnit = _evt$payload6.measurementUnit, _doorStyle = _evt$payload6.doorStyle;
1120
1500
  props.projectActions.createRoomWithShape(roomShapeType, width, height, measurementUnit, _doorStyle);
1121
- return _context1.abrupt("continue", 49);
1501
+ return _context11.abrupt("continue", 49);
1122
1502
  case 26:
1123
1503
  value = state.getIn(['viewer2D']).toJS();
1124
1504
  value.a += 0.1;
@@ -1126,7 +1506,7 @@ function _handleExternalEvent() {
1126
1506
  value.e -= value.SVGWidth * 0.1 / 2;
1127
1507
  value.f -= value.SVGHeight * 0.1 / 2;
1128
1508
  updateViwer2D(value, props.viewer2DActions);
1129
- return _context1.abrupt("continue", 49);
1509
+ return _context11.abrupt("continue", 49);
1130
1510
  case 27:
1131
1511
  _value = state.getIn(['viewer2D']).toJS();
1132
1512
  _value.a -= 0.1;
@@ -1134,62 +1514,62 @@ function _handleExternalEvent() {
1134
1514
  _value.e += _value.SVGWidth * 0.1 / 2;
1135
1515
  _value.f += _value.SVGHeight * 0.1 / 2;
1136
1516
  updateViwer2D(_value, props.viewer2DActions);
1137
- return _context1.abrupt("continue", 49);
1517
+ return _context11.abrupt("continue", 49);
1138
1518
  case 28:
1139
1519
  centering2D(state, props.viewer2DActions);
1140
- return _context1.abrupt("continue", 49);
1520
+ return _context11.abrupt("continue", 49);
1141
1521
  case 29:
1142
1522
  props.projectActions.undo();
1143
- return _context1.abrupt("continue", 49);
1523
+ return _context11.abrupt("continue", 49);
1144
1524
  case 30:
1145
1525
  props.projectActions.redo();
1146
- return _context1.abrupt("continue", 49);
1526
+ return _context11.abrupt("continue", 49);
1147
1527
  case 31:
1148
1528
  _evt$payload7 = evt.payload, moldingInfo = _evt$payload7.moldingInfo, isGlobal = _evt$payload7.isGlobal;
1149
- _context1.next = 32;
1529
+ _context11.next = 32;
1150
1530
  return loadMoldingSvg(moldingInfo);
1151
1531
  case 32:
1152
1532
  props.itemsActions.setMolding(moldingInfo, isGlobal);
1153
- return _context1.abrupt("continue", 49);
1533
+ return _context11.abrupt("continue", 49);
1154
1534
  case 33:
1155
1535
  distElement = getElement(evt.payload, state);
1156
1536
  if (distElement) props.itemsActions.duplicateSelected(distElement, props.onInternalEvent);
1157
- return _context1.abrupt("continue", 49);
1537
+ return _context11.abrupt("continue", 49);
1158
1538
  case 34:
1159
1539
  _distElement = getElement(evt.payload, state);
1160
1540
  if (_distElement) props.projectActions.remove(_distElement);
1161
- return _context1.abrupt("continue", 49);
1541
+ return _context11.abrupt("continue", 49);
1162
1542
  case 35:
1163
1543
  _evt$payload8 = evt.payload, option = _evt$payload8.option, _value2 = _evt$payload8.value;
1164
- _t4 = option;
1165
- _context1.next = _t4 === PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 36 : _t4 === PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 37 : _t4 === PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 38 : _t4 === PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 39 : _t4 === PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 40 : _t4 === PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 41 : 42;
1544
+ _t7 = option;
1545
+ _context11.next = _t7 === PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 36 : _t7 === PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 37 : _t7 === PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 38 : _t7 === PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 39 : _t7 === PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 40 : _t7 === PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 41 : 42;
1166
1546
  break;
1167
1547
  case 36:
1168
1548
  props.viewer2DActions.updateCeilHeight(convert(layer.ceilHeight).from(layer.unit).to(_value2));
1169
1549
  props.viewer2DActions.updateCeilHeightUnit(_value2);
1170
1550
  props.viewer3DActions.update3DCeilHeightUnit(_value2);
1171
1551
  props.viewer3DActions.update3DCeilHeight(convert(layer.ceilHeight).from(layer.unit).to(_value2));
1172
- return _context1.abrupt("continue", 43);
1552
+ return _context11.abrupt("continue", 43);
1173
1553
  case 37:
1174
1554
  props.viewer2DActions.updateCeilHeight(_value2);
1175
1555
  props.viewer3DActions.update3DCeilHeight(_value2);
1176
- return _context1.abrupt("continue", 43);
1556
+ return _context11.abrupt("continue", 43);
1177
1557
  case 38:
1178
1558
  props.viewer2DActions.changeWallLengthMeasure(_value2);
1179
- return _context1.abrupt("continue", 43);
1559
+ return _context11.abrupt("continue", 43);
1180
1560
  case 39:
1181
1561
  props.viewer2DActions.changeBaseCabinetMeasure(_value2);
1182
- return _context1.abrupt("continue", 43);
1562
+ return _context11.abrupt("continue", 43);
1183
1563
  case 40:
1184
1564
  props.viewer2DActions.changeWallCabinetMeasure(_value2);
1185
- return _context1.abrupt("continue", 43);
1565
+ return _context11.abrupt("continue", 43);
1186
1566
  case 41:
1187
1567
  props.viewer2DActions.changeWindowDoorMeasure(_value2);
1188
- return _context1.abrupt("continue", 43);
1568
+ return _context11.abrupt("continue", 43);
1189
1569
  case 42:
1190
- return _context1.abrupt("continue", 43);
1570
+ return _context11.abrupt("continue", 43);
1191
1571
  case 43:
1192
- return _context1.abrupt("continue", 49);
1572
+ return _context11.abrupt("continue", 49);
1193
1573
  case 44:
1194
1574
  _layerId2 = state.getIn(['scene', 'selectedLayer']);
1195
1575
  _layer = state.getIn(['scene', 'layers', _layerId2]);
@@ -1197,13 +1577,13 @@ function _handleExternalEvent() {
1197
1577
  for (_i4 = 0; _i4 < selectedLines.size; _i4++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1198
1578
  for (_i5 = 0; _i5 < selectedHoles.size; _i5++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1199
1579
  for (_i6 = 0; _i6 < selectedItems.size; _i6++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1200
- return _context1.abrupt("continue", 49);
1580
+ return _context11.abrupt("continue", 49);
1201
1581
  case 45:
1202
1582
  _layerID = state.scene.selectedLayer;
1203
1583
  _layer2 = state.scene.getIn(['layers', _layerID]).toJS();
1204
1584
  orginalItemInfo = evt === null || evt === void 0 || (_evt$payload9 = evt.payload) === null || _evt$payload9 === void 0 ? void 0 : _evt$payload9.orginalItemInfo;
1205
1585
  originalItem = _layer2 === null || _layer2 === void 0 ? void 0 : _layer2.items[orginalItemInfo.id];
1206
- _context1.next = 46;
1586
+ _context11.next = 46;
1207
1587
  return addItemToCatalog(evt.payload.replaceItemInfo, state, props.catalog, props.projectActions);
1208
1588
  case 46:
1209
1589
  originalItemPos = {
@@ -1220,17 +1600,19 @@ function _handleExternalEvent() {
1220
1600
  }
1221
1601
  };
1222
1602
  props.itemsActions.replaceItem(originalItemPos, originalItem, replaceItem);
1223
- return _context1.abrupt("continue", 49);
1603
+ return _context11.abrupt("continue", 49);
1224
1604
  case 47:
1225
1605
  setFinishing(props, state, evt.payload);
1226
- return _context1.abrupt("continue", 49);
1606
+ return _context11.abrupt("continue", 49);
1227
1607
  case 48:
1228
1608
  sceneData = state.scene.toJS(); // get molding data for "ReviewForQuote"
1229
1609
  currentTexture = layer.doorStyle !== null || layer.doorStyle !== undefined ? layer.doorStyle : props.state.doorStyle.toJS();
1230
- sceneData.layers[layerId].moldingData = getMoldingDataOfScene2(layer, props.catalog, currentTexture);
1610
+ moldingPieceLength = (_props$configData$mol = props === null || props === void 0 || (_props$configData = props.configData) === null || _props$configData === void 0 ? void 0 : _props$configData.moldingPieceLength) !== null && _props$configData$mol !== void 0 ? _props$configData$mol : DEFAULT_MOLDING_PIECE_LENGTH;
1611
+ sceneData.layers[layerId].moldingData = getMoldingDataOfScene2(layer, props.catalog, currentTexture, moldingPieceLength);
1231
1612
 
1232
1613
  // get skin panel data
1233
- sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer);
1614
+ skinPanelExclusionSKUs = (_props$configData$ski = props === null || props === void 0 || (_props$configData2 = props.configData) === null || _props$configData2 === void 0 ? void 0 : _props$configData2.skinPanelExclusionSKUs) !== null && _props$configData$ski !== void 0 ? _props$configData$ski : [];
1615
+ sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer, skinPanelExclusionSKUs);
1234
1616
 
1235
1617
  // send scene object from 3DTool to HostApp using internalEvent
1236
1618
  (_props$onInternalEven3 = props.onInternalEvent) === null || _props$onInternalEven3 === void 0 || _props$onInternalEven3.call(props, {
@@ -1239,12 +1621,12 @@ function _handleExternalEvent() {
1239
1621
  scene: sceneData
1240
1622
  }
1241
1623
  });
1242
- return _context1.abrupt("continue", 49);
1624
+ return _context11.abrupt("continue", 49);
1243
1625
  case 49:
1244
1626
  case "end":
1245
- return _context1.stop();
1627
+ return _context11.stop();
1246
1628
  }
1247
- }, _callee9);
1629
+ }, _callee0);
1248
1630
  }));
1249
1631
  return _handleExternalEvent.apply(this, arguments);
1250
1632
  }