@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.
@@ -28675,9 +28675,7 @@ function _attachIODevicesToComponent() {
28675
28675
  // ioConfig can use either 'states' (preferred) or legacy 'dataPoints' as the array key
28676
28676
  dataPoints: ((_deviceData$ioConfig = deviceData.ioConfig) === null || _deviceData$ioConfig === void 0 ? void 0 : _deviceData$ioConfig.states) || ((_deviceData$ioConfig2 = deviceData.ioConfig) === null || _deviceData$ioConfig2 === void 0 ? void 0 : _deviceData$ioConfig2.dataPoints) || [],
28677
28677
  // Device-level I/O direction: 'input' means the user can write state via the tooltip
28678
- ioDirection: ((_deviceData$ioConfig3 = deviceData.ioConfig) === null || _deviceData$ioConfig3 === void 0 ? void 0 : _deviceData$ioConfig3.direction) || 'output',
28679
- // Signal wiring sourced from this attachment (for state propagation reference)
28680
- signalOutputs: attachment.signalOutputs || []
28678
+ ioDirection: ((_deviceData$ioConfig3 = deviceData.ioConfig) === null || _deviceData$ioConfig3 === void 0 ? void 0 : _deviceData$ioConfig3.direction) || 'output'
28681
28679
  };
28682
28680
 
28683
28681
  // Position at the attachment point
@@ -32313,8 +32311,7 @@ var ComponentDragManager = /*#__PURE__*/function (_BaseDisposable) {
32313
32311
  // ioConfig can use either 'states' (preferred) or legacy 'dataPoints' as the array key
32314
32312
  dataPoints: ((_deviceData$ioConfig = deviceData.ioConfig) === null || _deviceData$ioConfig === void 0 ? void 0 : _deviceData$ioConfig.states) || ((_deviceData$ioConfig2 = deviceData.ioConfig) === null || _deviceData$ioConfig2 === void 0 ? void 0 : _deviceData$ioConfig2.dataPoints) || [],
32315
32313
  // Device-level I/O direction: 'input' means the user can write state via the tooltip
32316
- ioDirection: ((_deviceData$ioConfig3 = deviceData.ioConfig) === null || _deviceData$ioConfig3 === void 0 ? void 0 : _deviceData$ioConfig3.direction) || 'output',
32317
- signalOutputs: attachment.signalOutputs || []
32314
+ ioDirection: ((_deviceData$ioConfig3 = deviceData.ioConfig) === null || _deviceData$ioConfig3 === void 0 ? void 0 : _deviceData$ioConfig3.direction) || 'output'
32318
32315
  };
32319
32316
  if ((_attachment$attachmen = attachment.attachmentPoint) !== null && _attachment$attachmen !== void 0 && _attachment$attachmen.position) {
32320
32317
  pos = attachment.attachmentPoint.position;
@@ -36876,7 +36873,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
36876
36873
  * Initialize the CentralPlant manager
36877
36874
  *
36878
36875
  * @constructor
36879
- * @version 0.1.91
36876
+ * @version 0.1.92
36880
36877
  * @updated 2025-10-22
36881
36878
  *
36882
36879
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -37952,6 +37949,337 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
37952
37949
  return results;
37953
37950
  }
37954
37951
 
37952
+ // ===== I/O DEVICE ASSET API =====
37953
+
37954
+ /**
37955
+ * Set the asset service for I/O device attachment operations.
37956
+ * The service handles S3 storage and Vuex state updates so that
37957
+ * the central-plant package stays free of sandbox-specific dependencies.
37958
+ * @param {Object} service - Object with createSmartComponent, addComponentAttachment, removeComponentAttachment methods
37959
+ * @example
37960
+ * import { createAssetService } from '~/services/AssetService'
37961
+ * centralPlant.setAssetService(createAssetService(store))
37962
+ */
37963
+ }, {
37964
+ key: "setAssetService",
37965
+ value: function setAssetService(service) {
37966
+ if (!service || _typeof(service) !== 'object') {
37967
+ console.warn('⚠️ setAssetService(): service must be an object');
37968
+ return;
37969
+ }
37970
+ this.assetService = service;
37971
+ console.log('✅ Asset service set');
37972
+ }
37973
+
37974
+ /**
37975
+ * List all available I/O Device assets from the component dictionary.
37976
+ * @param {Object} [options={}]
37977
+ * @param {'all'|'bundled'|'user'} [options.source='all'] - Filter by asset origin
37978
+ * @returns {Array<{uuid: string, name: string, assetType: string, ioConfig: Object}>}
37979
+ * @example
37980
+ * const devices = centralPlant.getIoDevices({ source: 'all' })
37981
+ * const bundledOnly = centralPlant.getIoDevices({ source: 'bundled' })
37982
+ */
37983
+ }, {
37984
+ key: "getIoDevices",
37985
+ value: function getIoDevices() {
37986
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
37987
+ _ref$source = _ref.source,
37988
+ source = _ref$source === void 0 ? 'all' : _ref$source;
37989
+ var mp = this.getUtility('modelPreloader');
37990
+ var dict = mp === null || mp === void 0 ? void 0 : mp.componentDictionary;
37991
+ if (!dict) {
37992
+ console.warn('⚠️ getIoDevices(): component dictionary not loaded');
37993
+ return [];
37994
+ }
37995
+ return Object.values(dict).filter(function (entry) {
37996
+ return entry.assetType === 'I/O Device';
37997
+ }).filter(function (entry) {
37998
+ if (source === 'bundled') return !entry.isS3Component;
37999
+ if (source === 'user') return entry.isS3Component === true;
38000
+ return true; // 'all'
38001
+ }).map(function (entry) {
38002
+ return {
38003
+ uuid: entry.uuid || entry.id,
38004
+ name: entry.name,
38005
+ assetType: entry.assetType,
38006
+ ioConfig: entry.ioConfig || {}
38007
+ };
38008
+ });
38009
+ }
38010
+
38011
+ /**
38012
+ * Return a list of smart components that reference a given I/O Device.
38013
+ * Useful for enforcing deletion guards.
38014
+ * @param {Object} options
38015
+ * @param {string} options.deviceUuid - UUID of the I/O Device asset to check
38016
+ * @returns {Array<{componentId: string, componentName: string}>}
38017
+ * @example
38018
+ * const usage = centralPlant.getIoDeviceUsage({ deviceUuid: 'io-def-push-button' })
38019
+ * // [{ componentId: 'comp-smart-pump-01', componentName: 'Smart Pump' }]
38020
+ */
38021
+ }, {
38022
+ key: "getIoDeviceUsage",
38023
+ value: function getIoDeviceUsage() {
38024
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
38025
+ deviceUuid = _ref2.deviceUuid;
38026
+ if (!deviceUuid) {
38027
+ console.warn('⚠️ getIoDeviceUsage(): deviceUuid is required');
38028
+ return [];
38029
+ }
38030
+ var mp = this.getUtility('modelPreloader');
38031
+ var dict = mp === null || mp === void 0 ? void 0 : mp.componentDictionary;
38032
+ if (!dict) {
38033
+ console.warn('⚠️ getIoDeviceUsage(): component dictionary not loaded');
38034
+ return [];
38035
+ }
38036
+ var results = [];
38037
+ Object.values(dict).forEach(function (entry) {
38038
+ if (!entry.isSmart || !entry.attachedDevices) return;
38039
+ var uses = Object.values(entry.attachedDevices).some(function (att) {
38040
+ return att.deviceId === deviceUuid;
38041
+ });
38042
+ if (uses) {
38043
+ results.push({
38044
+ componentId: entry.uuid || entry.id,
38045
+ componentName: entry.name || ''
38046
+ });
38047
+ }
38048
+ });
38049
+ return results;
38050
+ }
38051
+
38052
+ /**
38053
+ * Create a new smart component asset by attaching I/O devices to an existing component.
38054
+ * Requires setAssetService() to have been called first.
38055
+ * @param {Object} options
38056
+ * @param {string} options.componentUuid - UUID of the base component to promote
38057
+ * @param {string} [options.name] - Display name for the new smart component (auto-deduped)
38058
+ * @param {Array} options.attachments - Attachment descriptors (attachmentId, deviceId, attachmentLabel, attachmentPoint)
38059
+ * @param {Blob} [options.thumbnailBlob] - Optional thumbnail image blob
38060
+ * @returns {Promise<Object>} The new smart component asset object
38061
+ * @example
38062
+ * const newAsset = await centralPlant.createSmartComponent({
38063
+ * componentUuid: 'comp-base-pump-01',
38064
+ * name: 'Smart Pump A',
38065
+ * attachments: [{
38066
+ * attachmentId: 'attch-button-01',
38067
+ * deviceId: 'io-def-push-button',
38068
+ * attachmentLabel: 'Power Button',
38069
+ * attachmentPoint: { position: { x: -0.1, y: 0.3, z: 0.0 }, direction: { x: 0.0, y: 1.0, z: 0.0 } }
38070
+ * }]
38071
+ * })
38072
+ */
38073
+ }, {
38074
+ key: "createSmartComponent",
38075
+ value: (function () {
38076
+ var _createSmartComponent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
38077
+ var _ref3,
38078
+ componentUuid,
38079
+ name,
38080
+ attachments,
38081
+ thumbnailBlob,
38082
+ newAsset,
38083
+ mp,
38084
+ _args3 = arguments;
38085
+ return _regenerator().w(function (_context3) {
38086
+ while (1) switch (_context3.n) {
38087
+ case 0:
38088
+ _ref3 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, componentUuid = _ref3.componentUuid, name = _ref3.name, attachments = _ref3.attachments, thumbnailBlob = _ref3.thumbnailBlob;
38089
+ if (this.assetService) {
38090
+ _context3.n = 1;
38091
+ break;
38092
+ }
38093
+ throw new Error('createSmartComponent(): no asset service set — call setAssetService() first');
38094
+ case 1:
38095
+ if (componentUuid) {
38096
+ _context3.n = 2;
38097
+ break;
38098
+ }
38099
+ throw new Error('createSmartComponent(): componentUuid is required');
38100
+ case 2:
38101
+ if (!(!Array.isArray(attachments) || attachments.length === 0)) {
38102
+ _context3.n = 3;
38103
+ break;
38104
+ }
38105
+ throw new Error('createSmartComponent(): at least one attachment is required');
38106
+ case 3:
38107
+ _context3.n = 4;
38108
+ return this.assetService.createSmartComponent({
38109
+ componentUuid: componentUuid,
38110
+ name: name,
38111
+ attachments: attachments,
38112
+ thumbnailBlob: thumbnailBlob
38113
+ });
38114
+ case 4:
38115
+ newAsset = _context3.v;
38116
+ // Register in model preloader dictionary so addComponent() can use it immediately
38117
+ mp = this.getUtility('modelPreloader');
38118
+ if (mp !== null && mp !== void 0 && mp.componentDictionary && newAsset !== null && newAsset !== void 0 && newAsset.uuid) {
38119
+ mp.componentDictionary[newAsset.uuid] = _objectSpread2(_objectSpread2({}, newAsset), {}, {
38120
+ id: newAsset.uuid
38121
+ });
38122
+ console.log("\u2705 createSmartComponent(): registered \"".concat(newAsset.name, "\" in component dictionary"));
38123
+ }
38124
+ return _context3.a(2, newAsset);
38125
+ }
38126
+ }, _callee3, this);
38127
+ }));
38128
+ function createSmartComponent() {
38129
+ return _createSmartComponent.apply(this, arguments);
38130
+ }
38131
+ return createSmartComponent;
38132
+ }()
38133
+ /**
38134
+ * Add or update a single I/O device attachment on an existing smart component.
38135
+ * Requires setAssetService() to have been called first.
38136
+ * Updates S3 data and Vuex store only — does NOT update live scene objects.
38137
+ * @param {Object} options
38138
+ * @param {string} options.componentUuid - UUID of the smart component to update
38139
+ * @param {Object} options.attachment - Attachment descriptor
38140
+ * @param {string} options.attachment.attachmentId - Globally unique attachment key
38141
+ * @param {string} options.attachment.deviceId - UUID of the I/O Device asset
38142
+ * @param {string} options.attachment.attachmentLabel - Human-readable label
38143
+ * @param {Object} [options.attachment.attachmentPoint] - Position/direction on the model
38144
+ * @returns {Promise<Object>} The updated smart component asset object
38145
+ * @example
38146
+ * await centralPlant.addComponentAttachment({
38147
+ * componentUuid: 'comp-smart-pump-01',
38148
+ * attachment: {
38149
+ * attachmentId: 'attch-led-01',
38150
+ * deviceId: 'io-def-signal-light',
38151
+ * attachmentLabel: 'Status LED',
38152
+ * attachmentPoint: { position: { x: 0.1, y: 0.3, z: 0.0 }, direction: { x: 0.0, y: 1.0, z: 0.0 } }
38153
+ * }
38154
+ * })
38155
+ */
38156
+ )
38157
+ }, {
38158
+ key: "addComponentAttachment",
38159
+ value: (function () {
38160
+ var _addComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
38161
+ var _ref4,
38162
+ componentUuid,
38163
+ attachment,
38164
+ updatedAsset,
38165
+ mp,
38166
+ _args4 = arguments;
38167
+ return _regenerator().w(function (_context4) {
38168
+ while (1) switch (_context4.n) {
38169
+ case 0:
38170
+ _ref4 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, componentUuid = _ref4.componentUuid, attachment = _ref4.attachment;
38171
+ if (this.assetService) {
38172
+ _context4.n = 1;
38173
+ break;
38174
+ }
38175
+ throw new Error('addComponentAttachment(): no asset service set — call setAssetService() first');
38176
+ case 1:
38177
+ if (componentUuid) {
38178
+ _context4.n = 2;
38179
+ break;
38180
+ }
38181
+ throw new Error('addComponentAttachment(): componentUuid is required');
38182
+ case 2:
38183
+ if (!(!(attachment !== null && attachment !== void 0 && attachment.attachmentId) || !(attachment !== null && attachment !== void 0 && attachment.deviceId))) {
38184
+ _context4.n = 3;
38185
+ break;
38186
+ }
38187
+ throw new Error('addComponentAttachment(): attachment must have attachmentId and deviceId');
38188
+ case 3:
38189
+ _context4.n = 4;
38190
+ return this.assetService.addComponentAttachment({
38191
+ componentUuid: componentUuid,
38192
+ attachment: attachment
38193
+ });
38194
+ case 4:
38195
+ updatedAsset = _context4.v;
38196
+ // Sync component dictionary
38197
+ mp = this.getUtility('modelPreloader');
38198
+ if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
38199
+ mp.componentDictionary[updatedAsset.uuid] = _objectSpread2(_objectSpread2(_objectSpread2({}, mp.componentDictionary[updatedAsset.uuid] || {}), updatedAsset), {}, {
38200
+ id: updatedAsset.uuid
38201
+ });
38202
+ }
38203
+ return _context4.a(2, updatedAsset);
38204
+ }
38205
+ }, _callee4, this);
38206
+ }));
38207
+ function addComponentAttachment() {
38208
+ return _addComponentAttachment.apply(this, arguments);
38209
+ }
38210
+ return addComponentAttachment;
38211
+ }()
38212
+ /**
38213
+ * Remove a single I/O device attachment from a smart component.
38214
+ * Requires setAssetService() to have been called first.
38215
+ * If this is the last attachment the component is demoted to a plain component.
38216
+ * Updates S3 data and Vuex store only — does NOT update live scene objects.
38217
+ * @param {Object} options
38218
+ * @param {string} options.componentUuid - UUID of the smart component to update
38219
+ * @param {string} options.attachmentId - The attachmentId key to remove
38220
+ * @returns {Promise<Object>} The updated component asset object
38221
+ * @example
38222
+ * await centralPlant.removeComponentAttachment({
38223
+ * componentUuid: 'comp-smart-pump-01',
38224
+ * attachmentId: 'attch-led-01'
38225
+ * })
38226
+ */
38227
+ )
38228
+ }, {
38229
+ key: "removeComponentAttachment",
38230
+ value: (function () {
38231
+ var _removeComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
38232
+ var _ref5,
38233
+ componentUuid,
38234
+ attachmentId,
38235
+ updatedAsset,
38236
+ mp,
38237
+ _args5 = arguments;
38238
+ return _regenerator().w(function (_context5) {
38239
+ while (1) switch (_context5.n) {
38240
+ case 0:
38241
+ _ref5 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, componentUuid = _ref5.componentUuid, attachmentId = _ref5.attachmentId;
38242
+ if (this.assetService) {
38243
+ _context5.n = 1;
38244
+ break;
38245
+ }
38246
+ throw new Error('removeComponentAttachment(): no asset service set — call setAssetService() first');
38247
+ case 1:
38248
+ if (componentUuid) {
38249
+ _context5.n = 2;
38250
+ break;
38251
+ }
38252
+ throw new Error('removeComponentAttachment(): componentUuid is required');
38253
+ case 2:
38254
+ if (attachmentId) {
38255
+ _context5.n = 3;
38256
+ break;
38257
+ }
38258
+ throw new Error('removeComponentAttachment(): attachmentId is required');
38259
+ case 3:
38260
+ _context5.n = 4;
38261
+ return this.assetService.removeComponentAttachment({
38262
+ componentUuid: componentUuid,
38263
+ attachmentId: attachmentId
38264
+ });
38265
+ case 4:
38266
+ updatedAsset = _context5.v;
38267
+ // Sync component dictionary
38268
+ mp = this.getUtility('modelPreloader');
38269
+ if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
38270
+ mp.componentDictionary[updatedAsset.uuid] = _objectSpread2(_objectSpread2(_objectSpread2({}, mp.componentDictionary[updatedAsset.uuid] || {}), updatedAsset), {}, {
38271
+ id: updatedAsset.uuid
38272
+ });
38273
+ }
38274
+ return _context5.a(2, updatedAsset);
38275
+ }
38276
+ }, _callee5, this);
38277
+ }));
38278
+ function removeComponentAttachment() {
38279
+ return _removeComponentAttachment.apply(this, arguments);
38280
+ }
38281
+ return removeComponentAttachment;
38282
+ }()
37955
38283
  /**
37956
38284
  * Get all component IDs from the scene
37957
38285
  * @returns {Array<string>} Array of component UUID strings, or empty array if none exist
@@ -37969,6 +38297,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
37969
38297
  * // Check if specific component exists
37970
38298
  * const hasChiller = componentIds.some(id => id.includes('chiller'));
37971
38299
  */
38300
+ )
37972
38301
  }, {
37973
38302
  key: "getComponentIds",
37974
38303
  value: function getComponentIds() {
@@ -38137,41 +38466,41 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38137
38466
  }, {
38138
38467
  key: "getComponents",
38139
38468
  value: (function () {
38140
- var _getComponents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
38469
+ var _getComponents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
38141
38470
  var options,
38142
38471
  validation,
38143
38472
  enhancedOptions,
38144
- _args3 = arguments,
38473
+ _args6 = arguments,
38145
38474
  _t;
38146
- return _regenerator().w(function (_context3) {
38147
- while (1) switch (_context3.n) {
38475
+ return _regenerator().w(function (_context6) {
38476
+ while (1) switch (_context6.n) {
38148
38477
  case 0:
38149
- options = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
38478
+ options = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
38150
38479
  // Validate filter options using centralized validator
38151
38480
  validation = this.internals.validator.validateComponentFilter(options);
38152
38481
  if (validation.isValid) {
38153
- _context3.n = 1;
38482
+ _context6.n = 1;
38154
38483
  break;
38155
38484
  }
38156
38485
  console.warn('⚠️ getComponents(): Invalid filter options provided:', validation.message);
38157
- return _context3.a(2, []);
38486
+ return _context6.a(2, []);
38158
38487
  case 1:
38159
- _context3.p = 1;
38488
+ _context6.p = 1;
38160
38489
  // Always include metadata
38161
38490
  enhancedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
38162
38491
  includeMetadata: true
38163
38492
  });
38164
- _context3.n = 2;
38493
+ _context6.n = 2;
38165
38494
  return this.managers.componentDataManager.getDictionaryComponents(enhancedOptions);
38166
38495
  case 2:
38167
- return _context3.a(2, _context3.v);
38496
+ return _context6.a(2, _context6.v);
38168
38497
  case 3:
38169
- _context3.p = 3;
38170
- _t = _context3.v;
38498
+ _context6.p = 3;
38499
+ _t = _context6.v;
38171
38500
  console.error('❌ getDictionaryComponents(): Error retrieving available components:', _t);
38172
- return _context3.a(2, []);
38501
+ return _context6.a(2, []);
38173
38502
  }
38174
- }, _callee3, this, [[1, 3]]);
38503
+ }, _callee6, this, [[1, 3]]);
38175
38504
  }));
38176
38505
  function getComponents() {
38177
38506
  return _getComponents.apply(this, arguments);
@@ -38274,23 +38603,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38274
38603
  }, {
38275
38604
  key: "extendComponentDictionary",
38276
38605
  value: (function () {
38277
- var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(additionalComponents) {
38278
- return _regenerator().w(function (_context4) {
38279
- while (1) switch (_context4.n) {
38606
+ var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(additionalComponents) {
38607
+ return _regenerator().w(function (_context7) {
38608
+ while (1) switch (_context7.n) {
38280
38609
  case 0:
38281
38610
  if (this.managers.componentDataManager) {
38282
- _context4.n = 1;
38611
+ _context7.n = 1;
38283
38612
  break;
38284
38613
  }
38285
38614
  console.warn('⚠️ extendComponentDictionary(): Component data manager not available');
38286
- return _context4.a(2, false);
38615
+ return _context7.a(2, false);
38287
38616
  case 1:
38288
- _context4.n = 2;
38617
+ _context7.n = 2;
38289
38618
  return this.managers.componentDataManager.extendComponentDictionary(additionalComponents);
38290
38619
  case 2:
38291
- return _context4.a(2, _context4.v);
38620
+ return _context7.a(2, _context7.v);
38292
38621
  }
38293
- }, _callee4, this);
38622
+ }, _callee7, this);
38294
38623
  }));
38295
38624
  function extendComponentDictionary(_x3) {
38296
38625
  return _extendComponentDictionary.apply(this, arguments);
@@ -38313,23 +38642,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38313
38642
  }, {
38314
38643
  key: "removeS3Components",
38315
38644
  value: (function () {
38316
- var _removeS3Components = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
38317
- return _regenerator().w(function (_context5) {
38318
- while (1) switch (_context5.n) {
38645
+ var _removeS3Components = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
38646
+ return _regenerator().w(function (_context8) {
38647
+ while (1) switch (_context8.n) {
38319
38648
  case 0:
38320
38649
  if (this.managers.componentDataManager) {
38321
- _context5.n = 1;
38650
+ _context8.n = 1;
38322
38651
  break;
38323
38652
  }
38324
38653
  console.warn('⚠️ removeS3Components(): Component data manager not available');
38325
- return _context5.a(2, false);
38654
+ return _context8.a(2, false);
38326
38655
  case 1:
38327
- _context5.n = 2;
38656
+ _context8.n = 2;
38328
38657
  return this.managers.componentDataManager.removeS3Components();
38329
38658
  case 2:
38330
- return _context5.a(2, _context5.v);
38659
+ return _context8.a(2, _context8.v);
38331
38660
  }
38332
- }, _callee5, this);
38661
+ }, _callee8, this);
38333
38662
  }));
38334
38663
  function removeS3Components() {
38335
38664
  return _removeS3Components.apply(this, arguments);
@@ -38353,23 +38682,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38353
38682
  }, {
38354
38683
  key: "removeComponentFromDictionary",
38355
38684
  value: (function () {
38356
- var _removeComponentFromDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(componentKey) {
38357
- return _regenerator().w(function (_context6) {
38358
- while (1) switch (_context6.n) {
38685
+ var _removeComponentFromDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(componentKey) {
38686
+ return _regenerator().w(function (_context9) {
38687
+ while (1) switch (_context9.n) {
38359
38688
  case 0:
38360
38689
  if (this.managers.componentDataManager) {
38361
- _context6.n = 1;
38690
+ _context9.n = 1;
38362
38691
  break;
38363
38692
  }
38364
38693
  console.warn('⚠️ removeComponentFromDictionary(): Component data manager not available');
38365
- return _context6.a(2, false);
38694
+ return _context9.a(2, false);
38366
38695
  case 1:
38367
- _context6.n = 2;
38696
+ _context9.n = 2;
38368
38697
  return this.managers.componentDataManager.removeComponentFromDictionary(componentKey);
38369
38698
  case 2:
38370
- return _context6.a(2, _context6.v);
38699
+ return _context9.a(2, _context9.v);
38371
38700
  }
38372
- }, _callee6, this);
38701
+ }, _callee9, this);
38373
38702
  }));
38374
38703
  function removeComponentFromDictionary(_x4) {
38375
38704
  return _removeComponentFromDictionary.apply(this, arguments);
@@ -38616,49 +38945,49 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38616
38945
  }, {
38617
38946
  key: "initialize2DViewport",
38618
38947
  value: function () {
38619
- var _initialize2DViewport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(container) {
38948
+ var _initialize2DViewport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(container) {
38620
38949
  var viewType,
38621
38950
  instanceKey,
38622
38951
  success,
38623
- _args7 = arguments,
38952
+ _args0 = arguments,
38624
38953
  _t2;
38625
- return _regenerator().w(function (_context7) {
38626
- while (1) switch (_context7.n) {
38954
+ return _regenerator().w(function (_context0) {
38955
+ while (1) switch (_context0.n) {
38627
38956
  case 0:
38628
- viewType = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : 'top';
38629
- instanceKey = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : null;
38957
+ viewType = _args0.length > 1 && _args0[1] !== undefined ? _args0[1] : 'top';
38958
+ instanceKey = _args0.length > 2 && _args0[2] !== undefined ? _args0[2] : null;
38630
38959
  if (container) {
38631
- _context7.n = 1;
38960
+ _context0.n = 1;
38632
38961
  break;
38633
38962
  }
38634
38963
  console.warn('⚠️ initialize2DViewport(): No container provided');
38635
- return _context7.a(2, false);
38964
+ return _context0.a(2, false);
38636
38965
  case 1:
38637
38966
  if (this.managers.viewport2DManager) {
38638
- _context7.n = 2;
38967
+ _context0.n = 2;
38639
38968
  break;
38640
38969
  }
38641
38970
  console.warn('⚠️ initialize2DViewport(): Viewport2D manager not available');
38642
- return _context7.a(2, false);
38971
+ return _context0.a(2, false);
38643
38972
  case 2:
38644
- _context7.p = 2;
38645
- _context7.n = 3;
38973
+ _context0.p = 2;
38974
+ _context0.n = 3;
38646
38975
  return this.managers.viewport2DManager.initialize(container, viewType, instanceKey);
38647
38976
  case 3:
38648
- success = _context7.v;
38977
+ success = _context0.v;
38649
38978
  if (success) {
38650
38979
  console.log("\u2705 2D viewport initialized successfully (".concat(viewType, " view, key: ").concat(instanceKey || viewType, ")"));
38651
38980
  } else {
38652
38981
  console.warn("\u26A0\uFE0F Failed to initialize 2D viewport (".concat(viewType, " view)"));
38653
38982
  }
38654
- return _context7.a(2, success);
38983
+ return _context0.a(2, success);
38655
38984
  case 4:
38656
- _context7.p = 4;
38657
- _t2 = _context7.v;
38985
+ _context0.p = 4;
38986
+ _t2 = _context0.v;
38658
38987
  console.error('❌ initialize2DViewport(): Error initializing 2D viewport:', _t2);
38659
- return _context7.a(2, false);
38988
+ return _context0.a(2, false);
38660
38989
  }
38661
- }, _callee7, this, [[2, 4]]);
38990
+ }, _callee0, this, [[2, 4]]);
38662
38991
  }));
38663
38992
  function initialize2DViewport(_x5) {
38664
38993
  return _initialize2DViewport.apply(this, arguments);
@@ -38806,7 +39135,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38806
39135
  }, {
38807
39136
  key: "initializeModelPreloading",
38808
39137
  value: (function () {
38809
- var _initializeModelPreloading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
39138
+ var _initializeModelPreloading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
38810
39139
  var basePath,
38811
39140
  normalizedBasePath,
38812
39141
  dictionaryPath,
@@ -38815,13 +39144,13 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38815
39144
  componentDictionary,
38816
39145
  _modelPreloader2,
38817
39146
  progress,
38818
- _args8 = arguments,
39147
+ _args1 = arguments,
38819
39148
  _t3;
38820
- return _regenerator().w(function (_context8) {
38821
- while (1) switch (_context8.n) {
39149
+ return _regenerator().w(function (_context1) {
39150
+ while (1) switch (_context1.n) {
38822
39151
  case 0:
38823
- basePath = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : '/library/';
38824
- _context8.p = 1;
39152
+ basePath = _args1.length > 0 && _args1[0] !== undefined ? _args1[0] : '/library/';
39153
+ _context1.p = 1;
38825
39154
  // Ensure basePath ends with a slash
38826
39155
  normalizedBasePath = basePath.endsWith('/') ? basePath : "".concat(basePath, "/");
38827
39156
  dictionaryPath = "".concat(normalizedBasePath, "component-dictionary.json");
@@ -38832,39 +39161,39 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38832
39161
  console.log("\uFFFD Models path: ".concat(modelsBasePath));
38833
39162
 
38834
39163
  // Load the component dictionary
38835
- _context8.n = 2;
39164
+ _context1.n = 2;
38836
39165
  return fetch(dictionaryPath);
38837
39166
  case 2:
38838
- response = _context8.v;
39167
+ response = _context1.v;
38839
39168
  if (response.ok) {
38840
- _context8.n = 3;
39169
+ _context1.n = 3;
38841
39170
  break;
38842
39171
  }
38843
39172
  throw new Error("Failed to load component dictionary: ".concat(response.status));
38844
39173
  case 3:
38845
- _context8.n = 4;
39174
+ _context1.n = 4;
38846
39175
  return response.json();
38847
39176
  case 4:
38848
- componentDictionary = _context8.v;
39177
+ componentDictionary = _context1.v;
38849
39178
  console.log('📚 Component dictionary loaded:', Object.keys(componentDictionary));
38850
39179
 
38851
39180
  // Start preloading all models with the specified base path
38852
39181
  _modelPreloader2 = this.getUtility('modelPreloader');
38853
- _context8.n = 5;
39182
+ _context1.n = 5;
38854
39183
  return _modelPreloader2.preloadAllModels(componentDictionary, modelsBasePath);
38855
39184
  case 5:
38856
- progress = _context8.v;
39185
+ progress = _context1.v;
38857
39186
  console.log('🎉 Model preloading completed:', progress);
38858
- return _context8.a(2, progress);
39187
+ return _context1.a(2, progress);
38859
39188
  case 6:
38860
- _context8.p = 6;
38861
- _t3 = _context8.v;
39189
+ _context1.p = 6;
39190
+ _t3 = _context1.v;
38862
39191
  console.error('❌ Failed to initialize model preloading:', _t3);
38863
39192
  throw _t3;
38864
39193
  case 7:
38865
- return _context8.a(2);
39194
+ return _context1.a(2);
38866
39195
  }
38867
- }, _callee8, this, [[1, 6]]);
39196
+ }, _callee1, this, [[1, 6]]);
38868
39197
  }));
38869
39198
  function initializeModelPreloading() {
38870
39199
  return _initializeModelPreloading.apply(this, arguments);
@@ -38881,55 +39210,55 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38881
39210
  }, {
38882
39211
  key: "importScene",
38883
39212
  value: (function () {
38884
- var _importScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(jsonData) {
39213
+ var _importScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(jsonData) {
38885
39214
  var validation, _t4;
38886
- return _regenerator().w(function (_context9) {
38887
- while (1) switch (_context9.n) {
39215
+ return _regenerator().w(function (_context10) {
39216
+ while (1) switch (_context10.n) {
38888
39217
  case 0:
38889
39218
  if (jsonData) {
38890
- _context9.n = 1;
39219
+ _context10.n = 1;
38891
39220
  break;
38892
39221
  }
38893
39222
  console.error('❌ No JSON data provided for import');
38894
- return _context9.a(2, false);
39223
+ return _context10.a(2, false);
38895
39224
  case 1:
38896
- _context9.p = 1;
39225
+ _context10.p = 1;
38897
39226
  // Validate scene data structure
38898
39227
  validation = this.internals.validateAndAnalyzeSceneData(jsonData);
38899
39228
  if (validation.isValid) {
38900
- _context9.n = 2;
39229
+ _context10.n = 2;
38901
39230
  break;
38902
39231
  }
38903
39232
  console.error('❌ Invalid scene data format:', validation.message);
38904
- return _context9.a(2, false);
39233
+ return _context10.a(2, false);
38905
39234
  case 2:
38906
- _context9.n = 3;
39235
+ _context10.n = 3;
38907
39236
  return this.setImportedSceneData(jsonData);
38908
39237
  case 3:
38909
39238
  if (!(this.sceneViewer && this.sceneViewer.sceneOperationsManager)) {
38910
- _context9.n = 5;
39239
+ _context10.n = 5;
38911
39240
  break;
38912
39241
  }
38913
- _context9.n = 4;
39242
+ _context10.n = 4;
38914
39243
  return this.sceneViewer.sceneOperationsManager.loadSceneFromData(jsonData);
38915
39244
  case 4:
38916
39245
  console.log('✅ Scene imported successfully');
38917
- return _context9.a(2, true);
39246
+ return _context10.a(2, true);
38918
39247
  case 5:
38919
39248
  console.error('❌ SceneViewer not available for scene loading');
38920
- return _context9.a(2, false);
39249
+ return _context10.a(2, false);
38921
39250
  case 6:
38922
- _context9.n = 8;
39251
+ _context10.n = 8;
38923
39252
  break;
38924
39253
  case 7:
38925
- _context9.p = 7;
38926
- _t4 = _context9.v;
39254
+ _context10.p = 7;
39255
+ _t4 = _context10.v;
38927
39256
  console.error('❌ Error importing scene:', _t4);
38928
- return _context9.a(2, false);
39257
+ return _context10.a(2, false);
38929
39258
  case 8:
38930
- return _context9.a(2);
39259
+ return _context10.a(2);
38931
39260
  }
38932
- }, _callee9, this, [[1, 7]]);
39261
+ }, _callee10, this, [[1, 7]]);
38933
39262
  }));
38934
39263
  function importScene(_x6) {
38935
39264
  return _importScene.apply(this, arguments);
@@ -38953,33 +39282,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38953
39282
  }, {
38954
39283
  key: "exportSceneJSON",
38955
39284
  value: (function () {
38956
- var _exportSceneJSON = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
39285
+ var _exportSceneJSON = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
38957
39286
  var filename,
38958
- _args0 = arguments,
39287
+ _args11 = arguments,
38959
39288
  _t5;
38960
- return _regenerator().w(function (_context0) {
38961
- while (1) switch (_context0.n) {
39289
+ return _regenerator().w(function (_context11) {
39290
+ while (1) switch (_context11.n) {
38962
39291
  case 0:
38963
- filename = _args0.length > 0 && _args0[0] !== undefined ? _args0[0] : null;
39292
+ filename = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : null;
38964
39293
  if (this.managers.sceneExportManager) {
38965
- _context0.n = 1;
39294
+ _context11.n = 1;
38966
39295
  break;
38967
39296
  }
38968
39297
  console.error('❌ Scene export manager not available');
38969
- return _context0.a(2, false);
39298
+ return _context11.a(2, false);
38970
39299
  case 1:
38971
- _context0.p = 1;
38972
- _context0.n = 2;
39300
+ _context11.p = 1;
39301
+ _context11.n = 2;
38973
39302
  return this.managers.sceneExportManager.downloadSceneJSON(filename);
38974
39303
  case 2:
38975
- return _context0.a(2, _context0.v);
39304
+ return _context11.a(2, _context11.v);
38976
39305
  case 3:
38977
- _context0.p = 3;
38978
- _t5 = _context0.v;
39306
+ _context11.p = 3;
39307
+ _t5 = _context11.v;
38979
39308
  console.error('❌ Error exporting scene as JSON:', _t5);
38980
- return _context0.a(2, false);
39309
+ return _context11.a(2, false);
38981
39310
  }
38982
- }, _callee0, this, [[1, 3]]);
39311
+ }, _callee11, this, [[1, 3]]);
38983
39312
  }));
38984
39313
  function exportSceneJSON() {
38985
39314
  return _exportSceneJSON.apply(this, arguments);
@@ -39004,33 +39333,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
39004
39333
  }, {
39005
39334
  key: "exportSceneGLTF",
39006
39335
  value: (function () {
39007
- var _exportSceneGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
39336
+ var _exportSceneGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
39008
39337
  var filename,
39009
- _args1 = arguments,
39338
+ _args12 = arguments,
39010
39339
  _t6;
39011
- return _regenerator().w(function (_context1) {
39012
- while (1) switch (_context1.n) {
39340
+ return _regenerator().w(function (_context12) {
39341
+ while (1) switch (_context12.n) {
39013
39342
  case 0:
39014
- filename = _args1.length > 0 && _args1[0] !== undefined ? _args1[0] : null;
39343
+ filename = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : null;
39015
39344
  if (this.managers.sceneExportManager) {
39016
- _context1.n = 1;
39345
+ _context12.n = 1;
39017
39346
  break;
39018
39347
  }
39019
39348
  console.error('❌ Scene export manager not available');
39020
- return _context1.a(2, false);
39349
+ return _context12.a(2, false);
39021
39350
  case 1:
39022
- _context1.p = 1;
39023
- _context1.n = 2;
39351
+ _context12.p = 1;
39352
+ _context12.n = 2;
39024
39353
  return this.managers.sceneExportManager.exportSceneAsGLTF(filename, false);
39025
39354
  case 2:
39026
- return _context1.a(2, _context1.v);
39355
+ return _context12.a(2, _context12.v);
39027
39356
  case 3:
39028
- _context1.p = 3;
39029
- _t6 = _context1.v;
39357
+ _context12.p = 3;
39358
+ _t6 = _context12.v;
39030
39359
  console.error('❌ Error exporting scene as GLTF:', _t6);
39031
- return _context1.a(2, false);
39360
+ return _context12.a(2, false);
39032
39361
  }
39033
- }, _callee1, this, [[1, 3]]);
39362
+ }, _callee12, this, [[1, 3]]);
39034
39363
  }));
39035
39364
  function exportSceneGLTF() {
39036
39365
  return _exportSceneGLTF.apply(this, arguments);
@@ -39056,33 +39385,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
39056
39385
  }, {
39057
39386
  key: "exportSceneGLB",
39058
39387
  value: (function () {
39059
- var _exportSceneGLB = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
39388
+ var _exportSceneGLB = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
39060
39389
  var filename,
39061
- _args10 = arguments,
39390
+ _args13 = arguments,
39062
39391
  _t7;
39063
- return _regenerator().w(function (_context10) {
39064
- while (1) switch (_context10.n) {
39392
+ return _regenerator().w(function (_context13) {
39393
+ while (1) switch (_context13.n) {
39065
39394
  case 0:
39066
- filename = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : null;
39395
+ filename = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : null;
39067
39396
  if (this.managers.sceneExportManager) {
39068
- _context10.n = 1;
39397
+ _context13.n = 1;
39069
39398
  break;
39070
39399
  }
39071
39400
  console.error('❌ Scene export manager not available');
39072
- return _context10.a(2, false);
39401
+ return _context13.a(2, false);
39073
39402
  case 1:
39074
- _context10.p = 1;
39075
- _context10.n = 2;
39403
+ _context13.p = 1;
39404
+ _context13.n = 2;
39076
39405
  return this.managers.sceneExportManager.exportSceneAsGLB(filename);
39077
39406
  case 2:
39078
- return _context10.a(2, _context10.v);
39407
+ return _context13.a(2, _context13.v);
39079
39408
  case 3:
39080
- _context10.p = 3;
39081
- _t7 = _context10.v;
39409
+ _context13.p = 3;
39410
+ _t7 = _context13.v;
39082
39411
  console.error('❌ Error exporting scene as GLB:', _t7);
39083
- return _context10.a(2, false);
39412
+ return _context13.a(2, false);
39084
39413
  }
39085
- }, _callee10, this, [[1, 3]]);
39414
+ }, _callee13, this, [[1, 3]]);
39086
39415
  }));
39087
39416
  function exportSceneGLB() {
39088
39417
  return _exportSceneGLB.apply(this, arguments);
@@ -39121,16 +39450,16 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
39121
39450
  }, {
39122
39451
  key: "loadSceneFromData",
39123
39452
  value: (function () {
39124
- var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(sceneData) {
39125
- return _regenerator().w(function (_context11) {
39126
- while (1) switch (_context11.n) {
39453
+ var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(sceneData) {
39454
+ return _regenerator().w(function (_context14) {
39455
+ while (1) switch (_context14.n) {
39127
39456
  case 0:
39128
- _context11.n = 1;
39457
+ _context14.n = 1;
39129
39458
  return this.setImportedSceneData(sceneData);
39130
39459
  case 1:
39131
- return _context11.a(2, true);
39460
+ return _context14.a(2, true);
39132
39461
  }
39133
- }, _callee11, this);
39462
+ }, _callee14, this);
39134
39463
  }));
39135
39464
  function loadSceneFromData(_x7) {
39136
39465
  return _loadSceneFromData.apply(this, arguments);