kitchen-simulator 10.16.0 → 10.18.0

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.
@@ -97,9 +97,9 @@ function parseTempPlaceholdersFromCabinetPayload(_x2) {
97
97
  /***** Update cabinetPayloadData with updatedTempPlaceholders *****/
98
98
  function _parseTempPlaceholdersFromCabinetPayload() {
99
99
  _parseTempPlaceholdersFromCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(cabinetPayload) {
100
- 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;
101
- return _regenerator["default"].wrap(function (_context5) {
102
- while (1) switch (_context5.prev = _context5.next) {
100
+ var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2, tempPlaceholdersData, k, _cabinetPayload$struc3, el, tempData, doorKey, drawerKey, fixedKey, doorPHs, drawerPHs, has_single_door, fixedPHs, _t2, _t3, _t4;
101
+ return _regenerator["default"].wrap(function (_context4) {
102
+ while (1) switch (_context4.prev = _context4.next) {
103
103
  case 0:
104
104
  link = '';
105
105
  keys = Object.keys(cabinetPayload.structure_json);
@@ -107,356 +107,339 @@ function _parseTempPlaceholdersFromCabinetPayload() {
107
107
  i = 0;
108
108
  case 1:
109
109
  if (!(i < keys.length)) {
110
- _context5.next = 4;
110
+ _context4.next = 4;
111
111
  break;
112
112
  }
113
113
  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'))) {
114
- _context5.next = 3;
114
+ _context4.next = 3;
115
115
  break;
116
116
  }
117
117
  link = cabinetPayload.structure_json[keys[i]];
118
118
  _t2 = temp;
119
119
  _t3 = keys[i];
120
- _context5.next = 2;
120
+ _context4.next = 2;
121
121
  return loadJSON(link);
122
122
  case 2:
123
- _t4 = _context5.sent;
123
+ _t4 = _context4.sent;
124
124
  _t2.push.call(_t2, {
125
125
  name: _t3,
126
126
  data: _t4
127
127
  });
128
128
  case 3:
129
129
  i++;
130
- _context5.next = 1;
130
+ _context4.next = 1;
131
131
  break;
132
132
  case 4:
133
133
  tempPlaceholdersData = [];
134
- _loop3 = /*#__PURE__*/_regenerator["default"].mark(function _loop3(k) {
135
- var el;
136
- return _regenerator["default"].wrap(function (_context4) {
137
- while (1) switch (_context4.prev = _context4.next) {
138
- case 0:
139
- el = cabinetPayload.structure_json.tempPlaceholders[k].id;
140
- tempData = {};
141
- doorKey = 0;
142
- drawerKey = 0;
143
- fixedKey = 0;
144
- doorPHs = 0;
145
- drawerPHs = 0;
146
- has_single_door = false;
147
- fixedPHs = 0;
148
- temp.forEach(function (t, index) {
149
- var nodes = t.data.nodes;
150
- if (nodes === undefined) {
151
- nodes = [];
134
+ for (k = 0; 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); k++) {
135
+ el = cabinetPayload.structure_json.tempPlaceholders[k].id;
136
+ tempData = {};
137
+ doorKey = 0;
138
+ drawerKey = 0;
139
+ fixedKey = 0;
140
+ doorPHs = 0;
141
+ drawerPHs = 0;
142
+ has_single_door = false;
143
+ fixedPHs = 0;
144
+ temp.forEach(function (t, index) {
145
+ var nodes = t.data.nodes;
146
+ if (nodes === undefined) {
147
+ nodes = [];
148
+ }
149
+ var tempPlaceholders = nodes.filter(function (element) {
150
+ return element.name.startsWith('ph_');
151
+ });
152
+ tempPlaceholders.sort(function (a, b) {
153
+ return a.name > b.name ? 1 : -1;
154
+ });
155
+ if (tempPlaceholders.length > 0) {
156
+ if (t.name === 'base') {
157
+ tempPlaceholders.map(function (element) {
158
+ var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
159
+ if (sink_match && sink_match.length >= 2) {
160
+ var _cabinetPayload$ccdf_;
161
+ tempData['sink'] = tempData['sink'] || [];
162
+ tempData['sink'].push(element.name);
163
+ // Resolve sink asset via ccdf.assets3d based on placeholder_name
164
+ var sinkPlaceholderName = sink_match[1]; // e.g. sink_farm_large
165
+ var assets3d = cabinetPayload === null || cabinetPayload === void 0 || (_cabinetPayload$ccdf_ = cabinetPayload.ccdf_list) === null || _cabinetPayload$ccdf_ === void 0 ? void 0 : _cabinetPayload$ccdf_.find(function (ccdf) {
166
+ return ccdf.cabinet_id === cabinetPayload.itemID;
167
+ }).assets3d;
168
+ var sinkAsset = Array.isArray(assets3d) && assets3d.find(function (a) {
169
+ return a && a.placeholder_name === sinkPlaceholderName && a.gltf;
170
+ });
171
+ if (sinkAsset !== null && sinkAsset !== void 0 && sinkAsset.gltf && cabinetPayload !== null && cabinetPayload !== void 0 && cabinetPayload.structure_json) cabinetPayload.structure_json.sink = sinkAsset.gltf;
172
+ } else if (temp.some(function (felement) {
173
+ return felement.name.includes('base_drawer');
174
+ }) && element.name.includes('interior_drawer')) {
175
+ var objCnt = temp.filter(function (felement) {
176
+ return felement.name.includes('base_drawer') && !felement.name.includes('_door');
177
+ }).length;
178
+ var phCnt = tempPlaceholders.filter(function (felement) {
179
+ return felement.name.includes('interior');
180
+ }).length;
181
+ drawerPHs = phCnt;
182
+ if (objCnt === 1 || phCnt % objCnt !== 0) {
183
+ if (tempData['base_drawer_1'] === undefined) {
184
+ tempData['base_drawer_1'] = [];
185
+ }
186
+ tempData['base_drawer_1'].push(element.name);
187
+ drawerKey++;
188
+ } else if (objCnt > 1 && phCnt % objCnt === 0) {
189
+ if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
190
+ tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
191
+ }
192
+ tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
193
+ drawerKey++;
194
+ }
195
+ } else if (temp.some(function (felement) {
196
+ return felement.name.includes('base_door');
197
+ }) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
198
+ var _objCnt = temp.filter(function (felement) {
199
+ return felement.name.includes('base_door');
200
+ }).length;
201
+ var _phCnt = tempPlaceholders.filter(function (felement) {
202
+ return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
203
+ }).length;
204
+ doorPHs = _phCnt;
205
+ if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
206
+ if (tempData['base_door_1'] === undefined) {
207
+ tempData['base_door_1'] = [];
208
+ }
209
+ tempData['base_door_1'].push(element.name);
210
+ doorKey++;
211
+ } else if (_objCnt > 1) {
212
+ if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
213
+ tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
214
+ }
215
+ tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
216
+ doorKey++;
217
+ }
218
+ } else if (temp.some(function (felement) {
219
+ return felement.name.includes('base_fixed_drawer_door');
220
+ }) && element.name.includes('_drawer_door_fixed')) {
221
+ var _objCnt2 = temp.filter(function (felement) {
222
+ return felement.name.includes('base_fixed_drawer_door');
223
+ }).length;
224
+ var _phCnt2 = tempPlaceholders.filter(function (felement) {
225
+ return felement.name.includes('_drawer_door_fixed');
226
+ }).length;
227
+ fixedPHs = _phCnt2;
228
+ if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
229
+ if (tempData['base_fixed_drawer_door_1'] === undefined) {
230
+ tempData['base_fixed_drawer_door_1'] = [];
231
+ }
232
+ tempData['base_fixed_drawer_door_1'].push(element.name);
233
+ fixedKey++;
234
+ } else if (_objCnt2 > 1) {
235
+ if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
236
+ tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
237
+ }
238
+ tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
239
+ fixedKey++;
240
+ }
152
241
  }
153
- var tempPlaceholders = nodes.filter(function (element) {
154
- return element.name.startsWith('ph_');
242
+ });
243
+ } else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
244
+ var objCnt = temp.filter(function (felement) {
245
+ return felement.name.includes('base_drawer') && !felement.name.includes('_door');
246
+ }).length;
247
+ if (objCnt === 1 || drawerPHs % objCnt !== 0) {
248
+ if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
249
+ //get drawer door handle placeholders
250
+ var ph_temp = temp.find(function (felement) {
251
+ return felement.name === 'base_drawer_door_1';
155
252
  });
156
- tempPlaceholders.sort(function (a, b) {
157
- return a.name > b.name ? 1 : -1;
253
+ if (ph_temp != undefined) {
254
+ var ph_drawer_door_handle = ph_temp.data.nodes;
255
+ ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
256
+ return element.name.startsWith('ph_') && element.name.includes('handle');
257
+ });
258
+ for (var w = 0; w < drawerPHs; w++) {
259
+ if (!tempData['base_drawer_door_1'].some(function (el) {
260
+ return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
261
+ })) {
262
+ tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
263
+ //add drawer door handle placeholders
264
+ if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
265
+ if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
266
+ }
267
+ }
268
+ }
269
+ } else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
270
+ if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
271
+ //get drawer door handle placeholders
272
+ var ph_temp = temp.find(function (felement) {
273
+ return felement.name === 'base_drawer_door' + t.name.slice(-2);
158
274
  });
159
- if (tempPlaceholders.length > 0) {
160
- if (t.name === 'base') {
161
- tempPlaceholders.map(function (element) {
162
- var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
163
- if (sink_match && sink_match.length >= 2) {
164
- var _process$env$API_URL, _cabinetPayload$struc4;
165
- tempData['sink'] = tempData['sink'] || [];
166
- tempData['sink'].push(element.name);
167
- var sink_url = (_process$env$API_URL = process.env.API_URL) !== null && _process$env$API_URL !== void 0 ? _process$env$API_URL :
168
- // server url from 3DTool env
169
- import.meta.env.VITE_APP_API_URL + // server url from Host env
170
- "/uploads/assets/default/".concat(sink_match[1], ".gltf");
171
- 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;
172
- } else if (temp.some(function (felement) {
173
- return felement.name.includes('base_drawer');
174
- }) && element.name.includes('interior_drawer')) {
175
- var objCnt = temp.filter(function (felement) {
176
- return felement.name.includes('base_drawer') && !felement.name.includes('_door');
177
- }).length;
178
- var phCnt = tempPlaceholders.filter(function (felement) {
179
- return felement.name.includes('interior');
180
- }).length;
181
- drawerPHs = phCnt;
182
- if (objCnt === 1 || phCnt % objCnt !== 0) {
183
- if (tempData['base_drawer_1'] === undefined) {
184
- tempData['base_drawer_1'] = [];
185
- }
186
- tempData['base_drawer_1'].push(element.name);
187
- drawerKey++;
188
- } else if (objCnt > 1 && phCnt % objCnt === 0) {
189
- if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
190
- tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
191
- }
192
- tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
193
- drawerKey++;
194
- }
195
- } else if (temp.some(function (felement) {
196
- return felement.name.includes('base_door');
197
- }) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
198
- var _objCnt = temp.filter(function (felement) {
199
- return felement.name.includes('base_door');
200
- }).length;
201
- var _phCnt = tempPlaceholders.filter(function (felement) {
202
- return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
203
- }).length;
204
- doorPHs = _phCnt;
205
- if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
206
- if (tempData['base_door_1'] === undefined) {
207
- tempData['base_door_1'] = [];
208
- }
209
- tempData['base_door_1'].push(element.name);
210
- doorKey++;
211
- } else if (_objCnt > 1) {
212
- if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
213
- tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
214
- }
215
- tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
216
- doorKey++;
217
- }
218
- } else if (temp.some(function (felement) {
219
- return felement.name.includes('base_fixed_drawer_door');
220
- }) && element.name.includes('_drawer_door_fixed')) {
221
- var _objCnt2 = temp.filter(function (felement) {
222
- return felement.name.includes('base_fixed_drawer_door');
223
- }).length;
224
- var _phCnt2 = tempPlaceholders.filter(function (felement) {
225
- return felement.name.includes('_drawer_door_fixed');
226
- }).length;
227
- fixedPHs = _phCnt2;
228
- if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
229
- if (tempData['base_fixed_drawer_door_1'] === undefined) {
230
- tempData['base_fixed_drawer_door_1'] = [];
231
- }
232
- tempData['base_fixed_drawer_door_1'].push(element.name);
233
- fixedKey++;
234
- } else if (_objCnt2 > 1) {
235
- if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
236
- tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
237
- }
238
- tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
239
- fixedKey++;
240
- }
241
- }
242
- });
243
- } else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
244
- var objCnt = temp.filter(function (felement) {
245
- return felement.name.includes('base_drawer') && !felement.name.includes('_door');
246
- }).length;
247
- if (objCnt === 1 || drawerPHs % objCnt !== 0) {
248
- if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
249
- //get drawer door handle placeholders
250
- var ph_temp = temp.find(function (felement) {
251
- return felement.name === 'base_drawer_door_1';
252
- });
253
- if (ph_temp != undefined) {
254
- var ph_drawer_door_handle = ph_temp.data.nodes;
255
- ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
256
- return element.name.startsWith('ph_') && element.name.includes('handle');
257
- });
258
- for (var w = 0; w < drawerPHs; w++) {
259
- if (!tempData['base_drawer_door_1'].some(function (el) {
260
- return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
261
- })) {
262
- tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
263
- //add drawer door handle placeholders
264
- if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
265
- if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
266
- }
267
- }
268
- }
269
- } else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
270
- if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
271
- //get drawer door handle placeholders
272
- var ph_temp = temp.find(function (felement) {
273
- return felement.name === 'base_drawer_door' + t.name.slice(-2);
274
- });
275
- if (ph_temp != undefined) {
276
- var ph_drawer_door_handle = ph_temp.data.nodes;
277
- ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
278
- return element.name.startsWith('ph_') && element.name.includes('handle');
279
- });
280
- tempPlaceholders.forEach(function (element) {
281
- if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
282
- return el === t.name + '/' + element.name;
283
- })) {
284
- tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
285
- //add drawer door handle placeholders
286
- if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
287
- 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);
288
- }
289
- });
290
- }
275
+ if (ph_temp != undefined) {
276
+ var ph_drawer_door_handle = ph_temp.data.nodes;
277
+ ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
278
+ return element.name.startsWith('ph_') && element.name.includes('handle');
279
+ });
280
+ tempPlaceholders.forEach(function (element) {
281
+ if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
282
+ return el === t.name + '/' + element.name;
283
+ })) {
284
+ tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
285
+ //add drawer door handle placeholders
286
+ if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
287
+ 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);
291
288
  }
292
- } else if (t.name.includes('base_door')) {
293
- var _objCnt3 = temp.filter(function (felement) {
294
- return felement.name.includes('base_door');
295
- }).length;
296
- tempPlaceholders = tempPlaceholders.filter(function (el) {
297
- return el.name.includes('handle');
289
+ });
290
+ }
291
+ }
292
+ } else if (t.name.includes('base_door')) {
293
+ var _objCnt3 = temp.filter(function (felement) {
294
+ return felement.name.includes('base_door');
295
+ }).length;
296
+ tempPlaceholders = tempPlaceholders.filter(function (el) {
297
+ return el.name.includes('handle');
298
+ });
299
+ if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
300
+ if (tempData['door_handle_1'] === undefined) {
301
+ tempData['door_handle_1'] = [];
302
+ }
303
+ var _loop3 = function _loop3() {
304
+ var phname = tempPlaceholders[0].name;
305
+ var newph = undefined;
306
+ if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
307
+ newph = tempPlaceholders.find(function (el) {
308
+ return el.name.isRightPlaceholder();
298
309
  });
299
- if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
300
- if (tempData['door_handle_1'] === undefined) {
301
- tempData['door_handle_1'] = [];
302
- }
303
- var _loop4 = function _loop4() {
304
- var phname = tempPlaceholders[0].name;
305
- var newph = undefined;
306
- if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
307
- newph = tempPlaceholders.find(function (el) {
308
- return el.name.isRightPlaceholder();
309
- });
310
- }
311
- if (tempData['base_door_1'][_w].isRightPlaceholder()) {
312
- newph = tempPlaceholders.find(function (el) {
313
- return el.name.isLeftPlaceholder();
314
- });
315
- }
316
- if (newph != undefined) {
317
- phname = newph.name;
318
- }
319
- if (doorPHs === 1 && tempPlaceholders.find(function (el) {
320
- return el.name.isLeftPlaceholder();
321
- }) != undefined && tempPlaceholders.find(function (el) {
322
- return el.name.isRightPlaceholder();
323
- }) != undefined) {
324
- has_single_door = true;
325
- }
326
- if (!tempData['door_handle_1'].some(function (el) {
327
- return el === 'door_handle_1/' + phname;
328
- })) {
329
- tempData['door_handle_1'].push('base_door_1/' + phname);
330
- }
331
- };
332
- for (var _w = 0; _w < doorPHs; _w++) {
333
- _loop4();
334
- }
335
- } else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
336
- if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
337
- var phname = tempPlaceholders[0].name;
338
- var newph = undefined;
339
- var blAdd = true;
340
- if (cabinetPayload.is_corner) {
341
- if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
342
- newph = tempPlaceholders.find(function (el) {
343
- return el.name.isLeftPlaceholder();
344
- });
345
- } else {
346
- blAdd = false;
347
- }
348
- } else {
349
- if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
350
- newph = tempPlaceholders.find(function (el) {
351
- return el.name.isRightPlaceholder();
352
- });
353
- }
354
- if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
355
- newph = tempPlaceholders.find(function (el) {
356
- return el.name.isLeftPlaceholder();
357
- });
358
- }
359
- }
360
- if (blAdd) {
361
- if (newph != undefined) {
362
- phname = newph.name;
363
- }
364
- if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
365
- return el === t.name + '/' + phname;
366
- })) {
367
- tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
368
- }
369
- }
370
- }
371
- } else if (t.name.includes('base_fixed_drawer_door')) {
372
- var _objCnt4 = temp.filter(function (felement) {
373
- return felement.name.includes('base_fixed_drawer_door');
374
- }).length;
375
- tempPlaceholders = tempPlaceholders.filter(function (el) {
376
- return el.name.includes('handle');
310
+ }
311
+ if (tempData['base_door_1'][_w].isRightPlaceholder()) {
312
+ newph = tempPlaceholders.find(function (el) {
313
+ return el.name.isLeftPlaceholder();
377
314
  });
378
- if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
379
- if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
380
- var _loop5 = function _loop5() {
381
- var phname = tempPlaceholders[0].name;
382
- var newph = undefined;
383
- if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
384
- newph = tempPlaceholders.find(function (el) {
385
- return el.name.isRightPlaceholder();
386
- });
387
- }
388
- if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
389
- newph = tempPlaceholders.find(function (el) {
390
- return el.name.isLeftPlaceholder();
391
- });
392
- }
393
- if (newph != undefined) {
394
- phname = newph.name;
395
- }
396
- if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
397
- return el === 'fixed_drawer_door_handle_1/' + phname;
398
- })) {
399
- tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
400
- }
401
- };
402
- for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
403
- _loop5();
404
- }
405
- } else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
406
- if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
407
- tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
408
- }
409
- var _phname = tempPlaceholders[0].name;
410
- var _newph = undefined;
411
- if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
412
- _newph = tempPlaceholders.find(function (el) {
413
- return el.name.isRightPlaceholder();
414
- });
415
- }
416
- if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
417
- _newph = tempPlaceholders.find(function (el) {
418
- return el.name.isLeftPlaceholder();
419
- });
420
- }
421
- if (_newph != undefined) {
422
- _phname = _newph.name;
423
- }
424
- if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
425
- return el === t.name + '/' + _phname;
426
- })) {
427
- tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
428
- }
429
- }
430
315
  }
316
+ if (newph != undefined) {
317
+ phname = newph.name;
318
+ }
319
+ if (doorPHs === 1 && tempPlaceholders.find(function (el) {
320
+ return el.name.isLeftPlaceholder();
321
+ }) != undefined && tempPlaceholders.find(function (el) {
322
+ return el.name.isRightPlaceholder();
323
+ }) != undefined) {
324
+ has_single_door = true;
325
+ }
326
+ if (!tempData['door_handle_1'].some(function (el) {
327
+ return el === 'door_handle_1/' + phname;
328
+ })) {
329
+ tempData['door_handle_1'].push('base_door_1/' + phname);
330
+ }
331
+ };
332
+ for (var _w = 0; _w < doorPHs; _w++) {
333
+ _loop3();
431
334
  }
335
+ } else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
336
+ if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
337
+ var phname = tempPlaceholders[0].name;
338
+ var newph = undefined;
339
+ var blAdd = true;
340
+ if (cabinetPayload.is_corner) {
341
+ if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
342
+ newph = tempPlaceholders.find(function (el) {
343
+ return el.name.isLeftPlaceholder();
344
+ });
345
+ } else {
346
+ blAdd = false;
347
+ }
348
+ } else {
349
+ if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
350
+ newph = tempPlaceholders.find(function (el) {
351
+ return el.name.isRightPlaceholder();
352
+ });
353
+ }
354
+ if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
355
+ newph = tempPlaceholders.find(function (el) {
356
+ return el.name.isLeftPlaceholder();
357
+ });
358
+ }
359
+ }
360
+ if (blAdd) {
361
+ if (newph != undefined) {
362
+ phname = newph.name;
363
+ }
364
+ if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
365
+ return el === t.name + '/' + phname;
366
+ })) {
367
+ tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
368
+ }
369
+ }
370
+ }
371
+ } else if (t.name.includes('base_fixed_drawer_door')) {
372
+ var _objCnt4 = temp.filter(function (felement) {
373
+ return felement.name.includes('base_fixed_drawer_door');
374
+ }).length;
375
+ tempPlaceholders = tempPlaceholders.filter(function (el) {
376
+ return el.name.includes('handle');
432
377
  });
433
- tempPlaceholdersData.push({
434
- id: parseInt(el, 10),
435
- placeholders: tempData,
436
- structure: cabinetPayload.structure_json.tempPlaceholders[k].structure
437
- });
438
- case 1:
439
- case "end":
440
- return _context4.stop();
378
+ if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
379
+ if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
380
+ var _loop4 = function _loop4() {
381
+ var phname = tempPlaceholders[0].name;
382
+ var newph = undefined;
383
+ if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
384
+ newph = tempPlaceholders.find(function (el) {
385
+ return el.name.isRightPlaceholder();
386
+ });
387
+ }
388
+ if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
389
+ newph = tempPlaceholders.find(function (el) {
390
+ return el.name.isLeftPlaceholder();
391
+ });
392
+ }
393
+ if (newph != undefined) {
394
+ phname = newph.name;
395
+ }
396
+ if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
397
+ return el === 'fixed_drawer_door_handle_1/' + phname;
398
+ })) {
399
+ tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
400
+ }
401
+ };
402
+ for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
403
+ _loop4();
404
+ }
405
+ } else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
406
+ if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
407
+ tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
408
+ }
409
+ var _phname = tempPlaceholders[0].name;
410
+ var _newph = undefined;
411
+ if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
412
+ _newph = tempPlaceholders.find(function (el) {
413
+ return el.name.isRightPlaceholder();
414
+ });
415
+ }
416
+ if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
417
+ _newph = tempPlaceholders.find(function (el) {
418
+ return el.name.isLeftPlaceholder();
419
+ });
420
+ }
421
+ if (_newph != undefined) {
422
+ _phname = _newph.name;
423
+ }
424
+ if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
425
+ return el === t.name + '/' + _phname;
426
+ })) {
427
+ tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
428
+ }
429
+ }
430
+ }
441
431
  }
442
- }, _loop3);
443
- });
444
- k = 0;
445
- case 5:
446
- 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))) {
447
- _context5.next = 7;
448
- break;
432
+ });
433
+ tempPlaceholdersData.push({
434
+ id: parseInt(el, 10),
435
+ placeholders: tempData,
436
+ structure: cabinetPayload.structure_json.tempPlaceholders[k].structure
437
+ });
449
438
  }
450
- return _context5.delegateYield(_loop3(k), "t0", 6);
451
- case 6:
452
- k++;
453
- _context5.next = 5;
454
- break;
455
- case 7:
456
- return _context5.abrupt("return", tempPlaceholdersData);
457
- case 8:
439
+ return _context4.abrupt("return", tempPlaceholdersData);
440
+ case 5:
458
441
  case "end":
459
- return _context5.stop();
442
+ return _context4.stop();
460
443
  }
461
444
  }, _callee4);
462
445
  }));
@@ -468,14 +451,14 @@ function updateCabinetPayload(_x3) {
468
451
  function _updateCabinetPayload() {
469
452
  _updateCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(cabinetPayload) {
470
453
  var tempPlaceholders, cabinetPayloadKeys, i;
471
- return _regenerator["default"].wrap(function (_context6) {
472
- while (1) switch (_context6.prev = _context6.next) {
454
+ return _regenerator["default"].wrap(function (_context5) {
455
+ while (1) switch (_context5.prev = _context5.next) {
473
456
  case 0:
474
457
  tempPlaceholders = [];
475
- _context6.next = 1;
458
+ _context5.next = 1;
476
459
  return parseTempPlaceholdersFromCabinetPayload(cabinetPayload);
477
460
  case 1:
478
- tempPlaceholders = _context6.sent;
461
+ tempPlaceholders = _context5.sent;
479
462
  cabinetPayloadKeys = Object.keys(cabinetPayload);
480
463
  for (i = 0; i < cabinetPayloadKeys.length; i++) {
481
464
  if (cabinetPayloadKeys[i] === 'structure_json') {
@@ -487,10 +470,10 @@ function _updateCabinetPayload() {
487
470
  cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'] = tempPlaceholders;
488
471
  }
489
472
  }
490
- return _context6.abrupt("return", cabinetPayload);
473
+ return _context5.abrupt("return", cabinetPayload);
491
474
  case 2:
492
475
  case "end":
493
- return _context6.stop();
476
+ return _context5.stop();
494
477
  }
495
478
  }, _callee5);
496
479
  }));
@@ -594,22 +577,22 @@ function _addItemToCatalog() {
594
577
  _addItemToCatalog = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(element, state, catalogInstance, projectActions) {
595
578
  var _elementJs, _elementJs3;
596
579
  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;
597
- return _regenerator["default"].wrap(function (_context7) {
598
- while (1) switch (_context7.prev = _context7.next) {
580
+ return _regenerator["default"].wrap(function (_context6) {
581
+ while (1) switch (_context6.prev = _context6.next) {
599
582
  case 0:
600
583
  if (!(0, _helper.isEmpty)(element === null || element === void 0 ? void 0 : element.name)) {
601
- _context7.next = 1;
584
+ _context6.next = 1;
602
585
  break;
603
586
  }
604
- return _context7.abrupt("return");
587
+ return _context6.abrupt("return");
605
588
  case 1:
606
589
  elementJs = populateCCDFList(element); // if (isEmpty(catalog?.elements[element.name])) {
607
- _context7.next = 2;
590
+ _context6.next = 2;
608
591
  return loadSVGsByItem(elementJs);
609
592
  case 2:
610
- outlineSVGData = _context7.sent;
593
+ outlineSVGData = _context6.sent;
611
594
  if (!(((_elementJs = elementJs) === null || _elementJs === void 0 ? void 0 : _elementJs.type) === 'cabinet')) {
612
- _context7.next = 4;
595
+ _context6.next = 4;
613
596
  break;
614
597
  }
615
598
  // move the tempPlaceholder of current door style to first of tempPlaceholders array
@@ -637,13 +620,13 @@ function _addItemToCatalog() {
637
620
  }
638
621
  });
639
622
  if ((0, _helper.isEmpty)((_elementJs$structure_3 = elementJs.structure_json) === null || _elementJs$structure_3 === void 0 ? void 0 : _elementJs$structure_3.tempPlaceholders)) {
640
- _context7.next = 4;
623
+ _context6.next = 4;
641
624
  break;
642
625
  }
643
- _context7.next = 3;
626
+ _context6.next = 3;
644
627
  return updateCabinetPayload(elementJs);
645
628
  case 3:
646
- elementJs = _context7.sent;
629
+ elementJs = _context6.sent;
647
630
  case 4:
648
631
  elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
649
632
  outlineSVGData: outlineSVGData,
@@ -660,18 +643,18 @@ function _addItemToCatalog() {
660
643
  k = 0;
661
644
  case 5:
662
645
  if (!(k < catalogElementKeys.length)) {
663
- _context7.next = 7;
646
+ _context6.next = 7;
664
647
  break;
665
648
  }
666
649
  if (!(((_catalogElements$cata = catalogElements[catalogElementKeys[k]]) === null || _catalogElements$cata === void 0 ? void 0 : _catalogElements$cata.itemID) === elementJs.itemID)) {
667
- _context7.next = 6;
650
+ _context6.next = 6;
668
651
  break;
669
652
  }
670
653
  catalogItem = catalogElements[catalogElementKeys[k]];
671
- return _context7.abrupt("continue", 7);
654
+ return _context6.abrupt("continue", 7);
672
655
  case 6:
673
656
  k++;
674
- _context7.next = 5;
657
+ _context6.next = 5;
675
658
  break;
676
659
  case 7:
677
660
  // get old tempPlaceholder array from catalog item
@@ -702,7 +685,7 @@ function _addItemToCatalog() {
702
685
  }
703
686
  case 8:
704
687
  case "end":
705
- return _context7.stop();
688
+ return _context6.stop();
706
689
  }
707
690
  }, _callee6);
708
691
  }));
@@ -1069,10 +1052,10 @@ function loadMoldingSvg(_x9) {
1069
1052
  }
1070
1053
  function _loadMoldingSvg() {
1071
1054
  _loadMoldingSvg = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(molding) {
1072
- return _regenerator["default"].wrap(function (_context8) {
1073
- while (1) switch (_context8.prev = _context8.next) {
1055
+ return _regenerator["default"].wrap(function (_context7) {
1056
+ while (1) switch (_context7.prev = _context7.next) {
1074
1057
  case 0:
1075
- return _context8.abrupt("return", new Promise(function (resolve, reject) {
1058
+ return _context7.abrupt("return", new Promise(function (resolve, reject) {
1076
1059
  var url = molding === null || molding === void 0 ? void 0 : molding.shape_svg;
1077
1060
  if (!url) {
1078
1061
  // Skip if no SVG URL available
@@ -1094,7 +1077,7 @@ function _loadMoldingSvg() {
1094
1077
  }));
1095
1078
  case 1:
1096
1079
  case "end":
1097
- return _context8.stop();
1080
+ return _context7.stop();
1098
1081
  }
1099
1082
  }, _callee7);
1100
1083
  }));