@2112-lab/central-plant 0.1.91 → 0.1.92

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.
@@ -19,7 +19,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
19
19
  * Initialize the CentralPlant manager
20
20
  *
21
21
  * @constructor
22
- * @version 0.1.91
22
+ * @version 0.1.92
23
23
  * @updated 2025-10-22
24
24
  *
25
25
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -1095,6 +1095,337 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1095
1095
  return results;
1096
1096
  }
1097
1097
 
1098
+ // ===== I/O DEVICE ASSET API =====
1099
+
1100
+ /**
1101
+ * Set the asset service for I/O device attachment operations.
1102
+ * The service handles S3 storage and Vuex state updates so that
1103
+ * the central-plant package stays free of sandbox-specific dependencies.
1104
+ * @param {Object} service - Object with createSmartComponent, addComponentAttachment, removeComponentAttachment methods
1105
+ * @example
1106
+ * import { createAssetService } from '~/services/AssetService'
1107
+ * centralPlant.setAssetService(createAssetService(store))
1108
+ */
1109
+ }, {
1110
+ key: "setAssetService",
1111
+ value: function setAssetService(service) {
1112
+ if (!service || _rollupPluginBabelHelpers["typeof"](service) !== 'object') {
1113
+ console.warn('⚠️ setAssetService(): service must be an object');
1114
+ return;
1115
+ }
1116
+ this.assetService = service;
1117
+ console.log('✅ Asset service set');
1118
+ }
1119
+
1120
+ /**
1121
+ * List all available I/O Device assets from the component dictionary.
1122
+ * @param {Object} [options={}]
1123
+ * @param {'all'|'bundled'|'user'} [options.source='all'] - Filter by asset origin
1124
+ * @returns {Array<{uuid: string, name: string, assetType: string, ioConfig: Object}>}
1125
+ * @example
1126
+ * const devices = centralPlant.getIoDevices({ source: 'all' })
1127
+ * const bundledOnly = centralPlant.getIoDevices({ source: 'bundled' })
1128
+ */
1129
+ }, {
1130
+ key: "getIoDevices",
1131
+ value: function getIoDevices() {
1132
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1133
+ _ref$source = _ref.source,
1134
+ source = _ref$source === void 0 ? 'all' : _ref$source;
1135
+ var mp = this.getUtility('modelPreloader');
1136
+ var dict = mp === null || mp === void 0 ? void 0 : mp.componentDictionary;
1137
+ if (!dict) {
1138
+ console.warn('⚠️ getIoDevices(): component dictionary not loaded');
1139
+ return [];
1140
+ }
1141
+ return Object.values(dict).filter(function (entry) {
1142
+ return entry.assetType === 'I/O Device';
1143
+ }).filter(function (entry) {
1144
+ if (source === 'bundled') return !entry.isS3Component;
1145
+ if (source === 'user') return entry.isS3Component === true;
1146
+ return true; // 'all'
1147
+ }).map(function (entry) {
1148
+ return {
1149
+ uuid: entry.uuid || entry.id,
1150
+ name: entry.name,
1151
+ assetType: entry.assetType,
1152
+ ioConfig: entry.ioConfig || {}
1153
+ };
1154
+ });
1155
+ }
1156
+
1157
+ /**
1158
+ * Return a list of smart components that reference a given I/O Device.
1159
+ * Useful for enforcing deletion guards.
1160
+ * @param {Object} options
1161
+ * @param {string} options.deviceUuid - UUID of the I/O Device asset to check
1162
+ * @returns {Array<{componentId: string, componentName: string}>}
1163
+ * @example
1164
+ * const usage = centralPlant.getIoDeviceUsage({ deviceUuid: 'io-def-push-button' })
1165
+ * // [{ componentId: 'comp-smart-pump-01', componentName: 'Smart Pump' }]
1166
+ */
1167
+ }, {
1168
+ key: "getIoDeviceUsage",
1169
+ value: function getIoDeviceUsage() {
1170
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1171
+ deviceUuid = _ref2.deviceUuid;
1172
+ if (!deviceUuid) {
1173
+ console.warn('⚠️ getIoDeviceUsage(): deviceUuid is required');
1174
+ return [];
1175
+ }
1176
+ var mp = this.getUtility('modelPreloader');
1177
+ var dict = mp === null || mp === void 0 ? void 0 : mp.componentDictionary;
1178
+ if (!dict) {
1179
+ console.warn('⚠️ getIoDeviceUsage(): component dictionary not loaded');
1180
+ return [];
1181
+ }
1182
+ var results = [];
1183
+ Object.values(dict).forEach(function (entry) {
1184
+ if (!entry.isSmart || !entry.attachedDevices) return;
1185
+ var uses = Object.values(entry.attachedDevices).some(function (att) {
1186
+ return att.deviceId === deviceUuid;
1187
+ });
1188
+ if (uses) {
1189
+ results.push({
1190
+ componentId: entry.uuid || entry.id,
1191
+ componentName: entry.name || ''
1192
+ });
1193
+ }
1194
+ });
1195
+ return results;
1196
+ }
1197
+
1198
+ /**
1199
+ * Create a new smart component asset by attaching I/O devices to an existing component.
1200
+ * Requires setAssetService() to have been called first.
1201
+ * @param {Object} options
1202
+ * @param {string} options.componentUuid - UUID of the base component to promote
1203
+ * @param {string} [options.name] - Display name for the new smart component (auto-deduped)
1204
+ * @param {Array} options.attachments - Attachment descriptors (attachmentId, deviceId, attachmentLabel, attachmentPoint)
1205
+ * @param {Blob} [options.thumbnailBlob] - Optional thumbnail image blob
1206
+ * @returns {Promise<Object>} The new smart component asset object
1207
+ * @example
1208
+ * const newAsset = await centralPlant.createSmartComponent({
1209
+ * componentUuid: 'comp-base-pump-01',
1210
+ * name: 'Smart Pump A',
1211
+ * attachments: [{
1212
+ * attachmentId: 'attch-button-01',
1213
+ * deviceId: 'io-def-push-button',
1214
+ * attachmentLabel: 'Power Button',
1215
+ * attachmentPoint: { position: { x: -0.1, y: 0.3, z: 0.0 }, direction: { x: 0.0, y: 1.0, z: 0.0 } }
1216
+ * }]
1217
+ * })
1218
+ */
1219
+ }, {
1220
+ key: "createSmartComponent",
1221
+ value: (function () {
1222
+ var _createSmartComponent = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee3() {
1223
+ var _ref3,
1224
+ componentUuid,
1225
+ name,
1226
+ attachments,
1227
+ thumbnailBlob,
1228
+ newAsset,
1229
+ mp,
1230
+ _args3 = arguments;
1231
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context3) {
1232
+ while (1) switch (_context3.n) {
1233
+ case 0:
1234
+ _ref3 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, componentUuid = _ref3.componentUuid, name = _ref3.name, attachments = _ref3.attachments, thumbnailBlob = _ref3.thumbnailBlob;
1235
+ if (this.assetService) {
1236
+ _context3.n = 1;
1237
+ break;
1238
+ }
1239
+ throw new Error('createSmartComponent(): no asset service set — call setAssetService() first');
1240
+ case 1:
1241
+ if (componentUuid) {
1242
+ _context3.n = 2;
1243
+ break;
1244
+ }
1245
+ throw new Error('createSmartComponent(): componentUuid is required');
1246
+ case 2:
1247
+ if (!(!Array.isArray(attachments) || attachments.length === 0)) {
1248
+ _context3.n = 3;
1249
+ break;
1250
+ }
1251
+ throw new Error('createSmartComponent(): at least one attachment is required');
1252
+ case 3:
1253
+ _context3.n = 4;
1254
+ return this.assetService.createSmartComponent({
1255
+ componentUuid: componentUuid,
1256
+ name: name,
1257
+ attachments: attachments,
1258
+ thumbnailBlob: thumbnailBlob
1259
+ });
1260
+ case 4:
1261
+ newAsset = _context3.v;
1262
+ // Register in model preloader dictionary so addComponent() can use it immediately
1263
+ mp = this.getUtility('modelPreloader');
1264
+ if (mp !== null && mp !== void 0 && mp.componentDictionary && newAsset !== null && newAsset !== void 0 && newAsset.uuid) {
1265
+ mp.componentDictionary[newAsset.uuid] = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, newAsset), {}, {
1266
+ id: newAsset.uuid
1267
+ });
1268
+ console.log("\u2705 createSmartComponent(): registered \"".concat(newAsset.name, "\" in component dictionary"));
1269
+ }
1270
+ return _context3.a(2, newAsset);
1271
+ }
1272
+ }, _callee3, this);
1273
+ }));
1274
+ function createSmartComponent() {
1275
+ return _createSmartComponent.apply(this, arguments);
1276
+ }
1277
+ return createSmartComponent;
1278
+ }()
1279
+ /**
1280
+ * Add or update a single I/O device attachment on an existing smart component.
1281
+ * Requires setAssetService() to have been called first.
1282
+ * Updates S3 data and Vuex store only — does NOT update live scene objects.
1283
+ * @param {Object} options
1284
+ * @param {string} options.componentUuid - UUID of the smart component to update
1285
+ * @param {Object} options.attachment - Attachment descriptor
1286
+ * @param {string} options.attachment.attachmentId - Globally unique attachment key
1287
+ * @param {string} options.attachment.deviceId - UUID of the I/O Device asset
1288
+ * @param {string} options.attachment.attachmentLabel - Human-readable label
1289
+ * @param {Object} [options.attachment.attachmentPoint] - Position/direction on the model
1290
+ * @returns {Promise<Object>} The updated smart component asset object
1291
+ * @example
1292
+ * await centralPlant.addComponentAttachment({
1293
+ * componentUuid: 'comp-smart-pump-01',
1294
+ * attachment: {
1295
+ * attachmentId: 'attch-led-01',
1296
+ * deviceId: 'io-def-signal-light',
1297
+ * attachmentLabel: 'Status LED',
1298
+ * attachmentPoint: { position: { x: 0.1, y: 0.3, z: 0.0 }, direction: { x: 0.0, y: 1.0, z: 0.0 } }
1299
+ * }
1300
+ * })
1301
+ */
1302
+ )
1303
+ }, {
1304
+ key: "addComponentAttachment",
1305
+ value: (function () {
1306
+ var _addComponentAttachment = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee4() {
1307
+ var _ref4,
1308
+ componentUuid,
1309
+ attachment,
1310
+ updatedAsset,
1311
+ mp,
1312
+ _args4 = arguments;
1313
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context4) {
1314
+ while (1) switch (_context4.n) {
1315
+ case 0:
1316
+ _ref4 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, componentUuid = _ref4.componentUuid, attachment = _ref4.attachment;
1317
+ if (this.assetService) {
1318
+ _context4.n = 1;
1319
+ break;
1320
+ }
1321
+ throw new Error('addComponentAttachment(): no asset service set — call setAssetService() first');
1322
+ case 1:
1323
+ if (componentUuid) {
1324
+ _context4.n = 2;
1325
+ break;
1326
+ }
1327
+ throw new Error('addComponentAttachment(): componentUuid is required');
1328
+ case 2:
1329
+ if (!(!(attachment !== null && attachment !== void 0 && attachment.attachmentId) || !(attachment !== null && attachment !== void 0 && attachment.deviceId))) {
1330
+ _context4.n = 3;
1331
+ break;
1332
+ }
1333
+ throw new Error('addComponentAttachment(): attachment must have attachmentId and deviceId');
1334
+ case 3:
1335
+ _context4.n = 4;
1336
+ return this.assetService.addComponentAttachment({
1337
+ componentUuid: componentUuid,
1338
+ attachment: attachment
1339
+ });
1340
+ case 4:
1341
+ updatedAsset = _context4.v;
1342
+ // Sync component dictionary
1343
+ mp = this.getUtility('modelPreloader');
1344
+ if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
1345
+ mp.componentDictionary[updatedAsset.uuid] = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, mp.componentDictionary[updatedAsset.uuid] || {}), updatedAsset), {}, {
1346
+ id: updatedAsset.uuid
1347
+ });
1348
+ }
1349
+ return _context4.a(2, updatedAsset);
1350
+ }
1351
+ }, _callee4, this);
1352
+ }));
1353
+ function addComponentAttachment() {
1354
+ return _addComponentAttachment.apply(this, arguments);
1355
+ }
1356
+ return addComponentAttachment;
1357
+ }()
1358
+ /**
1359
+ * Remove a single I/O device attachment from a smart component.
1360
+ * Requires setAssetService() to have been called first.
1361
+ * If this is the last attachment the component is demoted to a plain component.
1362
+ * Updates S3 data and Vuex store only — does NOT update live scene objects.
1363
+ * @param {Object} options
1364
+ * @param {string} options.componentUuid - UUID of the smart component to update
1365
+ * @param {string} options.attachmentId - The attachmentId key to remove
1366
+ * @returns {Promise<Object>} The updated component asset object
1367
+ * @example
1368
+ * await centralPlant.removeComponentAttachment({
1369
+ * componentUuid: 'comp-smart-pump-01',
1370
+ * attachmentId: 'attch-led-01'
1371
+ * })
1372
+ */
1373
+ )
1374
+ }, {
1375
+ key: "removeComponentAttachment",
1376
+ value: (function () {
1377
+ var _removeComponentAttachment = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee5() {
1378
+ var _ref5,
1379
+ componentUuid,
1380
+ attachmentId,
1381
+ updatedAsset,
1382
+ mp,
1383
+ _args5 = arguments;
1384
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context5) {
1385
+ while (1) switch (_context5.n) {
1386
+ case 0:
1387
+ _ref5 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, componentUuid = _ref5.componentUuid, attachmentId = _ref5.attachmentId;
1388
+ if (this.assetService) {
1389
+ _context5.n = 1;
1390
+ break;
1391
+ }
1392
+ throw new Error('removeComponentAttachment(): no asset service set — call setAssetService() first');
1393
+ case 1:
1394
+ if (componentUuid) {
1395
+ _context5.n = 2;
1396
+ break;
1397
+ }
1398
+ throw new Error('removeComponentAttachment(): componentUuid is required');
1399
+ case 2:
1400
+ if (attachmentId) {
1401
+ _context5.n = 3;
1402
+ break;
1403
+ }
1404
+ throw new Error('removeComponentAttachment(): attachmentId is required');
1405
+ case 3:
1406
+ _context5.n = 4;
1407
+ return this.assetService.removeComponentAttachment({
1408
+ componentUuid: componentUuid,
1409
+ attachmentId: attachmentId
1410
+ });
1411
+ case 4:
1412
+ updatedAsset = _context5.v;
1413
+ // Sync component dictionary
1414
+ mp = this.getUtility('modelPreloader');
1415
+ if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
1416
+ mp.componentDictionary[updatedAsset.uuid] = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, mp.componentDictionary[updatedAsset.uuid] || {}), updatedAsset), {}, {
1417
+ id: updatedAsset.uuid
1418
+ });
1419
+ }
1420
+ return _context5.a(2, updatedAsset);
1421
+ }
1422
+ }, _callee5, this);
1423
+ }));
1424
+ function removeComponentAttachment() {
1425
+ return _removeComponentAttachment.apply(this, arguments);
1426
+ }
1427
+ return removeComponentAttachment;
1428
+ }()
1098
1429
  /**
1099
1430
  * Get all component IDs from the scene
1100
1431
  * @returns {Array<string>} Array of component UUID strings, or empty array if none exist
@@ -1112,6 +1443,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1112
1443
  * // Check if specific component exists
1113
1444
  * const hasChiller = componentIds.some(id => id.includes('chiller'));
1114
1445
  */
1446
+ )
1115
1447
  }, {
1116
1448
  key: "getComponentIds",
1117
1449
  value: function getComponentIds() {
@@ -1280,41 +1612,41 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1280
1612
  }, {
1281
1613
  key: "getComponents",
1282
1614
  value: (function () {
1283
- var _getComponents = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee3() {
1615
+ var _getComponents = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee6() {
1284
1616
  var options,
1285
1617
  validation,
1286
1618
  enhancedOptions,
1287
- _args3 = arguments,
1619
+ _args6 = arguments,
1288
1620
  _t;
1289
- return _rollupPluginBabelHelpers.regenerator().w(function (_context3) {
1290
- while (1) switch (_context3.n) {
1621
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context6) {
1622
+ while (1) switch (_context6.n) {
1291
1623
  case 0:
1292
- options = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
1624
+ options = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
1293
1625
  // Validate filter options using centralized validator
1294
1626
  validation = this.internals.validator.validateComponentFilter(options);
1295
1627
  if (validation.isValid) {
1296
- _context3.n = 1;
1628
+ _context6.n = 1;
1297
1629
  break;
1298
1630
  }
1299
1631
  console.warn('⚠️ getComponents(): Invalid filter options provided:', validation.message);
1300
- return _context3.a(2, []);
1632
+ return _context6.a(2, []);
1301
1633
  case 1:
1302
- _context3.p = 1;
1634
+ _context6.p = 1;
1303
1635
  // Always include metadata
1304
1636
  enhancedOptions = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, options), {}, {
1305
1637
  includeMetadata: true
1306
1638
  });
1307
- _context3.n = 2;
1639
+ _context6.n = 2;
1308
1640
  return this.managers.componentDataManager.getDictionaryComponents(enhancedOptions);
1309
1641
  case 2:
1310
- return _context3.a(2, _context3.v);
1642
+ return _context6.a(2, _context6.v);
1311
1643
  case 3:
1312
- _context3.p = 3;
1313
- _t = _context3.v;
1644
+ _context6.p = 3;
1645
+ _t = _context6.v;
1314
1646
  console.error('❌ getDictionaryComponents(): Error retrieving available components:', _t);
1315
- return _context3.a(2, []);
1647
+ return _context6.a(2, []);
1316
1648
  }
1317
- }, _callee3, this, [[1, 3]]);
1649
+ }, _callee6, this, [[1, 3]]);
1318
1650
  }));
1319
1651
  function getComponents() {
1320
1652
  return _getComponents.apply(this, arguments);
@@ -1417,23 +1749,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1417
1749
  }, {
1418
1750
  key: "extendComponentDictionary",
1419
1751
  value: (function () {
1420
- var _extendComponentDictionary = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee4(additionalComponents) {
1421
- return _rollupPluginBabelHelpers.regenerator().w(function (_context4) {
1422
- while (1) switch (_context4.n) {
1752
+ var _extendComponentDictionary = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee7(additionalComponents) {
1753
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context7) {
1754
+ while (1) switch (_context7.n) {
1423
1755
  case 0:
1424
1756
  if (this.managers.componentDataManager) {
1425
- _context4.n = 1;
1757
+ _context7.n = 1;
1426
1758
  break;
1427
1759
  }
1428
1760
  console.warn('⚠️ extendComponentDictionary(): Component data manager not available');
1429
- return _context4.a(2, false);
1761
+ return _context7.a(2, false);
1430
1762
  case 1:
1431
- _context4.n = 2;
1763
+ _context7.n = 2;
1432
1764
  return this.managers.componentDataManager.extendComponentDictionary(additionalComponents);
1433
1765
  case 2:
1434
- return _context4.a(2, _context4.v);
1766
+ return _context7.a(2, _context7.v);
1435
1767
  }
1436
- }, _callee4, this);
1768
+ }, _callee7, this);
1437
1769
  }));
1438
1770
  function extendComponentDictionary(_x3) {
1439
1771
  return _extendComponentDictionary.apply(this, arguments);
@@ -1456,23 +1788,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1456
1788
  }, {
1457
1789
  key: "removeS3Components",
1458
1790
  value: (function () {
1459
- var _removeS3Components = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee5() {
1460
- return _rollupPluginBabelHelpers.regenerator().w(function (_context5) {
1461
- while (1) switch (_context5.n) {
1791
+ var _removeS3Components = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee8() {
1792
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context8) {
1793
+ while (1) switch (_context8.n) {
1462
1794
  case 0:
1463
1795
  if (this.managers.componentDataManager) {
1464
- _context5.n = 1;
1796
+ _context8.n = 1;
1465
1797
  break;
1466
1798
  }
1467
1799
  console.warn('⚠️ removeS3Components(): Component data manager not available');
1468
- return _context5.a(2, false);
1800
+ return _context8.a(2, false);
1469
1801
  case 1:
1470
- _context5.n = 2;
1802
+ _context8.n = 2;
1471
1803
  return this.managers.componentDataManager.removeS3Components();
1472
1804
  case 2:
1473
- return _context5.a(2, _context5.v);
1805
+ return _context8.a(2, _context8.v);
1474
1806
  }
1475
- }, _callee5, this);
1807
+ }, _callee8, this);
1476
1808
  }));
1477
1809
  function removeS3Components() {
1478
1810
  return _removeS3Components.apply(this, arguments);
@@ -1496,23 +1828,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1496
1828
  }, {
1497
1829
  key: "removeComponentFromDictionary",
1498
1830
  value: (function () {
1499
- var _removeComponentFromDictionary = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee6(componentKey) {
1500
- return _rollupPluginBabelHelpers.regenerator().w(function (_context6) {
1501
- while (1) switch (_context6.n) {
1831
+ var _removeComponentFromDictionary = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee9(componentKey) {
1832
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context9) {
1833
+ while (1) switch (_context9.n) {
1502
1834
  case 0:
1503
1835
  if (this.managers.componentDataManager) {
1504
- _context6.n = 1;
1836
+ _context9.n = 1;
1505
1837
  break;
1506
1838
  }
1507
1839
  console.warn('⚠️ removeComponentFromDictionary(): Component data manager not available');
1508
- return _context6.a(2, false);
1840
+ return _context9.a(2, false);
1509
1841
  case 1:
1510
- _context6.n = 2;
1842
+ _context9.n = 2;
1511
1843
  return this.managers.componentDataManager.removeComponentFromDictionary(componentKey);
1512
1844
  case 2:
1513
- return _context6.a(2, _context6.v);
1845
+ return _context9.a(2, _context9.v);
1514
1846
  }
1515
- }, _callee6, this);
1847
+ }, _callee9, this);
1516
1848
  }));
1517
1849
  function removeComponentFromDictionary(_x4) {
1518
1850
  return _removeComponentFromDictionary.apply(this, arguments);
@@ -1759,49 +2091,49 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1759
2091
  }, {
1760
2092
  key: "initialize2DViewport",
1761
2093
  value: function () {
1762
- var _initialize2DViewport = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee7(container) {
2094
+ var _initialize2DViewport = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee0(container) {
1763
2095
  var viewType,
1764
2096
  instanceKey,
1765
2097
  success,
1766
- _args7 = arguments,
2098
+ _args0 = arguments,
1767
2099
  _t2;
1768
- return _rollupPluginBabelHelpers.regenerator().w(function (_context7) {
1769
- while (1) switch (_context7.n) {
2100
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context0) {
2101
+ while (1) switch (_context0.n) {
1770
2102
  case 0:
1771
- viewType = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : 'top';
1772
- instanceKey = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : null;
2103
+ viewType = _args0.length > 1 && _args0[1] !== undefined ? _args0[1] : 'top';
2104
+ instanceKey = _args0.length > 2 && _args0[2] !== undefined ? _args0[2] : null;
1773
2105
  if (container) {
1774
- _context7.n = 1;
2106
+ _context0.n = 1;
1775
2107
  break;
1776
2108
  }
1777
2109
  console.warn('⚠️ initialize2DViewport(): No container provided');
1778
- return _context7.a(2, false);
2110
+ return _context0.a(2, false);
1779
2111
  case 1:
1780
2112
  if (this.managers.viewport2DManager) {
1781
- _context7.n = 2;
2113
+ _context0.n = 2;
1782
2114
  break;
1783
2115
  }
1784
2116
  console.warn('⚠️ initialize2DViewport(): Viewport2D manager not available');
1785
- return _context7.a(2, false);
2117
+ return _context0.a(2, false);
1786
2118
  case 2:
1787
- _context7.p = 2;
1788
- _context7.n = 3;
2119
+ _context0.p = 2;
2120
+ _context0.n = 3;
1789
2121
  return this.managers.viewport2DManager.initialize(container, viewType, instanceKey);
1790
2122
  case 3:
1791
- success = _context7.v;
2123
+ success = _context0.v;
1792
2124
  if (success) {
1793
2125
  console.log("\u2705 2D viewport initialized successfully (".concat(viewType, " view, key: ").concat(instanceKey || viewType, ")"));
1794
2126
  } else {
1795
2127
  console.warn("\u26A0\uFE0F Failed to initialize 2D viewport (".concat(viewType, " view)"));
1796
2128
  }
1797
- return _context7.a(2, success);
2129
+ return _context0.a(2, success);
1798
2130
  case 4:
1799
- _context7.p = 4;
1800
- _t2 = _context7.v;
2131
+ _context0.p = 4;
2132
+ _t2 = _context0.v;
1801
2133
  console.error('❌ initialize2DViewport(): Error initializing 2D viewport:', _t2);
1802
- return _context7.a(2, false);
2134
+ return _context0.a(2, false);
1803
2135
  }
1804
- }, _callee7, this, [[2, 4]]);
2136
+ }, _callee0, this, [[2, 4]]);
1805
2137
  }));
1806
2138
  function initialize2DViewport(_x5) {
1807
2139
  return _initialize2DViewport.apply(this, arguments);
@@ -1949,7 +2281,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1949
2281
  }, {
1950
2282
  key: "initializeModelPreloading",
1951
2283
  value: (function () {
1952
- var _initializeModelPreloading = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee8() {
2284
+ var _initializeModelPreloading = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee1() {
1953
2285
  var basePath,
1954
2286
  normalizedBasePath,
1955
2287
  dictionaryPath,
@@ -1958,13 +2290,13 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1958
2290
  componentDictionary,
1959
2291
  _modelPreloader2,
1960
2292
  progress,
1961
- _args8 = arguments,
2293
+ _args1 = arguments,
1962
2294
  _t3;
1963
- return _rollupPluginBabelHelpers.regenerator().w(function (_context8) {
1964
- while (1) switch (_context8.n) {
2295
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context1) {
2296
+ while (1) switch (_context1.n) {
1965
2297
  case 0:
1966
- basePath = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : '/library/';
1967
- _context8.p = 1;
2298
+ basePath = _args1.length > 0 && _args1[0] !== undefined ? _args1[0] : '/library/';
2299
+ _context1.p = 1;
1968
2300
  // Ensure basePath ends with a slash
1969
2301
  normalizedBasePath = basePath.endsWith('/') ? basePath : "".concat(basePath, "/");
1970
2302
  dictionaryPath = "".concat(normalizedBasePath, "component-dictionary.json");
@@ -1975,39 +2307,39 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1975
2307
  console.log("\uFFFD Models path: ".concat(modelsBasePath));
1976
2308
 
1977
2309
  // Load the component dictionary
1978
- _context8.n = 2;
2310
+ _context1.n = 2;
1979
2311
  return fetch(dictionaryPath);
1980
2312
  case 2:
1981
- response = _context8.v;
2313
+ response = _context1.v;
1982
2314
  if (response.ok) {
1983
- _context8.n = 3;
2315
+ _context1.n = 3;
1984
2316
  break;
1985
2317
  }
1986
2318
  throw new Error("Failed to load component dictionary: ".concat(response.status));
1987
2319
  case 3:
1988
- _context8.n = 4;
2320
+ _context1.n = 4;
1989
2321
  return response.json();
1990
2322
  case 4:
1991
- componentDictionary = _context8.v;
2323
+ componentDictionary = _context1.v;
1992
2324
  console.log('📚 Component dictionary loaded:', Object.keys(componentDictionary));
1993
2325
 
1994
2326
  // Start preloading all models with the specified base path
1995
2327
  _modelPreloader2 = this.getUtility('modelPreloader');
1996
- _context8.n = 5;
2328
+ _context1.n = 5;
1997
2329
  return _modelPreloader2.preloadAllModels(componentDictionary, modelsBasePath);
1998
2330
  case 5:
1999
- progress = _context8.v;
2331
+ progress = _context1.v;
2000
2332
  console.log('🎉 Model preloading completed:', progress);
2001
- return _context8.a(2, progress);
2333
+ return _context1.a(2, progress);
2002
2334
  case 6:
2003
- _context8.p = 6;
2004
- _t3 = _context8.v;
2335
+ _context1.p = 6;
2336
+ _t3 = _context1.v;
2005
2337
  console.error('❌ Failed to initialize model preloading:', _t3);
2006
2338
  throw _t3;
2007
2339
  case 7:
2008
- return _context8.a(2);
2340
+ return _context1.a(2);
2009
2341
  }
2010
- }, _callee8, this, [[1, 6]]);
2342
+ }, _callee1, this, [[1, 6]]);
2011
2343
  }));
2012
2344
  function initializeModelPreloading() {
2013
2345
  return _initializeModelPreloading.apply(this, arguments);
@@ -2024,55 +2356,55 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2024
2356
  }, {
2025
2357
  key: "importScene",
2026
2358
  value: (function () {
2027
- var _importScene = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee9(jsonData) {
2359
+ var _importScene = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee10(jsonData) {
2028
2360
  var validation, _t4;
2029
- return _rollupPluginBabelHelpers.regenerator().w(function (_context9) {
2030
- while (1) switch (_context9.n) {
2361
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context10) {
2362
+ while (1) switch (_context10.n) {
2031
2363
  case 0:
2032
2364
  if (jsonData) {
2033
- _context9.n = 1;
2365
+ _context10.n = 1;
2034
2366
  break;
2035
2367
  }
2036
2368
  console.error('❌ No JSON data provided for import');
2037
- return _context9.a(2, false);
2369
+ return _context10.a(2, false);
2038
2370
  case 1:
2039
- _context9.p = 1;
2371
+ _context10.p = 1;
2040
2372
  // Validate scene data structure
2041
2373
  validation = this.internals.validateAndAnalyzeSceneData(jsonData);
2042
2374
  if (validation.isValid) {
2043
- _context9.n = 2;
2375
+ _context10.n = 2;
2044
2376
  break;
2045
2377
  }
2046
2378
  console.error('❌ Invalid scene data format:', validation.message);
2047
- return _context9.a(2, false);
2379
+ return _context10.a(2, false);
2048
2380
  case 2:
2049
- _context9.n = 3;
2381
+ _context10.n = 3;
2050
2382
  return this.setImportedSceneData(jsonData);
2051
2383
  case 3:
2052
2384
  if (!(this.sceneViewer && this.sceneViewer.sceneOperationsManager)) {
2053
- _context9.n = 5;
2385
+ _context10.n = 5;
2054
2386
  break;
2055
2387
  }
2056
- _context9.n = 4;
2388
+ _context10.n = 4;
2057
2389
  return this.sceneViewer.sceneOperationsManager.loadSceneFromData(jsonData);
2058
2390
  case 4:
2059
2391
  console.log('✅ Scene imported successfully');
2060
- return _context9.a(2, true);
2392
+ return _context10.a(2, true);
2061
2393
  case 5:
2062
2394
  console.error('❌ SceneViewer not available for scene loading');
2063
- return _context9.a(2, false);
2395
+ return _context10.a(2, false);
2064
2396
  case 6:
2065
- _context9.n = 8;
2397
+ _context10.n = 8;
2066
2398
  break;
2067
2399
  case 7:
2068
- _context9.p = 7;
2069
- _t4 = _context9.v;
2400
+ _context10.p = 7;
2401
+ _t4 = _context10.v;
2070
2402
  console.error('❌ Error importing scene:', _t4);
2071
- return _context9.a(2, false);
2403
+ return _context10.a(2, false);
2072
2404
  case 8:
2073
- return _context9.a(2);
2405
+ return _context10.a(2);
2074
2406
  }
2075
- }, _callee9, this, [[1, 7]]);
2407
+ }, _callee10, this, [[1, 7]]);
2076
2408
  }));
2077
2409
  function importScene(_x6) {
2078
2410
  return _importScene.apply(this, arguments);
@@ -2096,33 +2428,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2096
2428
  }, {
2097
2429
  key: "exportSceneJSON",
2098
2430
  value: (function () {
2099
- var _exportSceneJSON = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee0() {
2431
+ var _exportSceneJSON = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee11() {
2100
2432
  var filename,
2101
- _args0 = arguments,
2433
+ _args11 = arguments,
2102
2434
  _t5;
2103
- return _rollupPluginBabelHelpers.regenerator().w(function (_context0) {
2104
- while (1) switch (_context0.n) {
2435
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context11) {
2436
+ while (1) switch (_context11.n) {
2105
2437
  case 0:
2106
- filename = _args0.length > 0 && _args0[0] !== undefined ? _args0[0] : null;
2438
+ filename = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : null;
2107
2439
  if (this.managers.sceneExportManager) {
2108
- _context0.n = 1;
2440
+ _context11.n = 1;
2109
2441
  break;
2110
2442
  }
2111
2443
  console.error('❌ Scene export manager not available');
2112
- return _context0.a(2, false);
2444
+ return _context11.a(2, false);
2113
2445
  case 1:
2114
- _context0.p = 1;
2115
- _context0.n = 2;
2446
+ _context11.p = 1;
2447
+ _context11.n = 2;
2116
2448
  return this.managers.sceneExportManager.downloadSceneJSON(filename);
2117
2449
  case 2:
2118
- return _context0.a(2, _context0.v);
2450
+ return _context11.a(2, _context11.v);
2119
2451
  case 3:
2120
- _context0.p = 3;
2121
- _t5 = _context0.v;
2452
+ _context11.p = 3;
2453
+ _t5 = _context11.v;
2122
2454
  console.error('❌ Error exporting scene as JSON:', _t5);
2123
- return _context0.a(2, false);
2455
+ return _context11.a(2, false);
2124
2456
  }
2125
- }, _callee0, this, [[1, 3]]);
2457
+ }, _callee11, this, [[1, 3]]);
2126
2458
  }));
2127
2459
  function exportSceneJSON() {
2128
2460
  return _exportSceneJSON.apply(this, arguments);
@@ -2147,33 +2479,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2147
2479
  }, {
2148
2480
  key: "exportSceneGLTF",
2149
2481
  value: (function () {
2150
- var _exportSceneGLTF = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee1() {
2482
+ var _exportSceneGLTF = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee12() {
2151
2483
  var filename,
2152
- _args1 = arguments,
2484
+ _args12 = arguments,
2153
2485
  _t6;
2154
- return _rollupPluginBabelHelpers.regenerator().w(function (_context1) {
2155
- while (1) switch (_context1.n) {
2486
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context12) {
2487
+ while (1) switch (_context12.n) {
2156
2488
  case 0:
2157
- filename = _args1.length > 0 && _args1[0] !== undefined ? _args1[0] : null;
2489
+ filename = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : null;
2158
2490
  if (this.managers.sceneExportManager) {
2159
- _context1.n = 1;
2491
+ _context12.n = 1;
2160
2492
  break;
2161
2493
  }
2162
2494
  console.error('❌ Scene export manager not available');
2163
- return _context1.a(2, false);
2495
+ return _context12.a(2, false);
2164
2496
  case 1:
2165
- _context1.p = 1;
2166
- _context1.n = 2;
2497
+ _context12.p = 1;
2498
+ _context12.n = 2;
2167
2499
  return this.managers.sceneExportManager.exportSceneAsGLTF(filename, false);
2168
2500
  case 2:
2169
- return _context1.a(2, _context1.v);
2501
+ return _context12.a(2, _context12.v);
2170
2502
  case 3:
2171
- _context1.p = 3;
2172
- _t6 = _context1.v;
2503
+ _context12.p = 3;
2504
+ _t6 = _context12.v;
2173
2505
  console.error('❌ Error exporting scene as GLTF:', _t6);
2174
- return _context1.a(2, false);
2506
+ return _context12.a(2, false);
2175
2507
  }
2176
- }, _callee1, this, [[1, 3]]);
2508
+ }, _callee12, this, [[1, 3]]);
2177
2509
  }));
2178
2510
  function exportSceneGLTF() {
2179
2511
  return _exportSceneGLTF.apply(this, arguments);
@@ -2199,33 +2531,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2199
2531
  }, {
2200
2532
  key: "exportSceneGLB",
2201
2533
  value: (function () {
2202
- var _exportSceneGLB = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee10() {
2534
+ var _exportSceneGLB = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee13() {
2203
2535
  var filename,
2204
- _args10 = arguments,
2536
+ _args13 = arguments,
2205
2537
  _t7;
2206
- return _rollupPluginBabelHelpers.regenerator().w(function (_context10) {
2207
- while (1) switch (_context10.n) {
2538
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context13) {
2539
+ while (1) switch (_context13.n) {
2208
2540
  case 0:
2209
- filename = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : null;
2541
+ filename = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : null;
2210
2542
  if (this.managers.sceneExportManager) {
2211
- _context10.n = 1;
2543
+ _context13.n = 1;
2212
2544
  break;
2213
2545
  }
2214
2546
  console.error('❌ Scene export manager not available');
2215
- return _context10.a(2, false);
2547
+ return _context13.a(2, false);
2216
2548
  case 1:
2217
- _context10.p = 1;
2218
- _context10.n = 2;
2549
+ _context13.p = 1;
2550
+ _context13.n = 2;
2219
2551
  return this.managers.sceneExportManager.exportSceneAsGLB(filename);
2220
2552
  case 2:
2221
- return _context10.a(2, _context10.v);
2553
+ return _context13.a(2, _context13.v);
2222
2554
  case 3:
2223
- _context10.p = 3;
2224
- _t7 = _context10.v;
2555
+ _context13.p = 3;
2556
+ _t7 = _context13.v;
2225
2557
  console.error('❌ Error exporting scene as GLB:', _t7);
2226
- return _context10.a(2, false);
2558
+ return _context13.a(2, false);
2227
2559
  }
2228
- }, _callee10, this, [[1, 3]]);
2560
+ }, _callee13, this, [[1, 3]]);
2229
2561
  }));
2230
2562
  function exportSceneGLB() {
2231
2563
  return _exportSceneGLB.apply(this, arguments);
@@ -2264,16 +2596,16 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2264
2596
  }, {
2265
2597
  key: "loadSceneFromData",
2266
2598
  value: (function () {
2267
- var _loadSceneFromData = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee11(sceneData) {
2268
- return _rollupPluginBabelHelpers.regenerator().w(function (_context11) {
2269
- while (1) switch (_context11.n) {
2599
+ var _loadSceneFromData = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee14(sceneData) {
2600
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context14) {
2601
+ while (1) switch (_context14.n) {
2270
2602
  case 0:
2271
- _context11.n = 1;
2603
+ _context14.n = 1;
2272
2604
  return this.setImportedSceneData(sceneData);
2273
2605
  case 1:
2274
- return _context11.a(2, true);
2606
+ return _context14.a(2, true);
2275
2607
  }
2276
- }, _callee11, this);
2608
+ }, _callee14, this);
2277
2609
  }));
2278
2610
  function loadSceneFromData(_x7) {
2279
2611
  return _loadSceneFromData.apply(this, arguments);