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