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