@2112-lab/central-plant 0.1.91 → 0.1.93

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.
@@ -11518,10 +11518,23 @@ var SceneExportManager = /*#__PURE__*/function () {
11518
11518
  // Helper function to extract behaviors from current scene data
11519
11519
  var extractBehaviors = function extractBehaviors() {
11520
11520
  var _this$sceneViewer, _this$sceneViewer2;
11521
+ // Only export behaviors that are NOT re-derivable from a component's
11522
+ // defaultBehaviors[]. All component/device default behaviors are
11523
+ // reconstructed at load time by Step B of _processBehaviors() using the
11524
+ // component dictionary, so writing compact behaviorRef entries for them
11525
+ // would be redundant. The scene JSON behaviors[] array is reserved for
11526
+ // any future scene-level overrides that cannot be derived from the asset.
11521
11527
  if ((_this$sceneViewer = _this.sceneViewer) !== null && _this$sceneViewer !== void 0 && (_this$sceneViewer = _this$sceneViewer.managers) !== null && _this$sceneViewer !== void 0 && _this$sceneViewer.behaviorManager) {
11522
- return _this.sceneViewer.managers.behaviorManager.getBehaviors();
11528
+ return _this.sceneViewer.managers.behaviorManager.getBehaviors().filter(function (b) {
11529
+ return !b._isDefaultBehavior;
11530
+ });
11523
11531
  }
11524
- return ((_this$sceneViewer2 = _this.sceneViewer) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.currentSceneData) === null || _this$sceneViewer2 === void 0 ? void 0 : _this$sceneViewer2.behaviors) || [];
11532
+ // Fallback when BehaviorManager is not available: exclude any entry that
11533
+ // was already a behaviorRef (it was derivable from the component asset)
11534
+ // and exclude the legacy _isDefaultBehavior marker if present.
11535
+ return (((_this$sceneViewer2 = _this.sceneViewer) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.currentSceneData) === null || _this$sceneViewer2 === void 0 ? void 0 : _this$sceneViewer2.behaviors) || []).filter(function (b) {
11536
+ return !b.behaviorRef && !b._isDefaultBehavior;
11537
+ });
11525
11538
  };
11526
11539
 
11527
11540
  // Build the complete export data structure (matching central-plant-input.json format)
@@ -19510,62 +19523,43 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
19510
19523
  key: "_loadComponentDictionary",
19511
19524
  value: (function () {
19512
19525
  var _loadComponentDictionary2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
19513
- var _yield$import, getCachedLocalJson, response, _t4, _t5;
19526
+ var response, _t4;
19514
19527
  return _regenerator().w(function (_context6) {
19515
19528
  while (1) switch (_context6.n) {
19516
19529
  case 0:
19517
19530
  _context6.p = 0;
19518
- if (!(typeof window !== 'undefined' && 'caches' in window)) {
19519
- _context6.n = 5;
19520
- break;
19521
- }
19522
- _context6.p = 1;
19523
- _context6.n = 2;
19524
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('~/utils/s3Cache')); });
19525
- case 2:
19526
- _yield$import = _context6.v;
19527
- getCachedLocalJson = _yield$import.getCachedLocalJson;
19528
- _context6.n = 3;
19529
- return getCachedLocalJson('/library/component-dictionary.json');
19530
- case 3:
19531
- this.componentDictionary = _context6.v;
19532
- console.log('📚 ComponentDataManager: Component dictionary loaded from cache');
19533
- return _context6.a(2);
19534
- case 4:
19535
- _context6.p = 4;
19536
- _t4 = _context6.v;
19537
- console.warn('⚠️ ComponentDataManager: Cache load failed, falling back to direct fetch:', _t4);
19538
- case 5:
19539
- _context6.n = 6;
19540
- return fetch('/library/component-dictionary.json');
19541
- case 6:
19531
+ _context6.n = 1;
19532
+ return fetch('/library/component-dictionary.json', {
19533
+ cache: 'no-cache'
19534
+ });
19535
+ case 1:
19542
19536
  response = _context6.v;
19543
19537
  if (!response.ok) {
19544
- _context6.n = 8;
19538
+ _context6.n = 3;
19545
19539
  break;
19546
19540
  }
19547
- _context6.n = 7;
19541
+ _context6.n = 2;
19548
19542
  return response.json();
19549
- case 7:
19543
+ case 2:
19550
19544
  this.componentDictionary = _context6.v;
19551
19545
  console.log('📚 ComponentDataManager: Component dictionary loaded successfully');
19552
- _context6.n = 9;
19546
+ _context6.n = 4;
19553
19547
  break;
19554
- case 8:
19548
+ case 3:
19555
19549
  console.warn('⚠️ ComponentDataManager: Could not load component dictionary');
19556
19550
  this.componentDictionary = null;
19557
- case 9:
19558
- _context6.n = 11;
19551
+ case 4:
19552
+ _context6.n = 6;
19559
19553
  break;
19560
- case 10:
19561
- _context6.p = 10;
19562
- _t5 = _context6.v;
19563
- console.warn('⚠️ ComponentDataManager: Error loading component dictionary:', _t5);
19554
+ case 5:
19555
+ _context6.p = 5;
19556
+ _t4 = _context6.v;
19557
+ console.warn('⚠️ ComponentDataManager: Error loading component dictionary:', _t4);
19564
19558
  this.componentDictionary = null;
19565
- case 11:
19559
+ case 6:
19566
19560
  return _context6.a(2);
19567
19561
  }
19568
- }, _callee6, this, [[1, 4], [0, 10]]);
19562
+ }, _callee6, this, [[0, 5]]);
19569
19563
  }));
19570
19564
  function _loadComponentDictionary() {
19571
19565
  return _loadComponentDictionary2.apply(this, arguments);
@@ -19814,6 +19808,8 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
19814
19808
  boundingBox: component.boundingBox || null,
19815
19809
  adaptedBoundingBox: component.adaptedBoundingBox || null,
19816
19810
  children: component.children || [],
19811
+ meshChildren: component.meshChildren || [],
19812
+ defaultBehaviors: component.defaultBehaviors || [],
19817
19813
  specifications: ((_component$metadata2 = component.metadata) === null || _component$metadata2 === void 0 ? void 0 : _component$metadata2.specifications) || {},
19818
19814
  description: ((_component$metadata3 = component.metadata) === null || _component$metadata3 === void 0 ? void 0 : _component$metadata3.description) || ''
19819
19815
  });
@@ -28675,9 +28671,7 @@ function _attachIODevicesToComponent() {
28675
28671
  // ioConfig can use either 'states' (preferred) or legacy 'dataPoints' as the array key
28676
28672
  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
28673
  // 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 || []
28674
+ ioDirection: ((_deviceData$ioConfig3 = deviceData.ioConfig) === null || _deviceData$ioConfig3 === void 0 ? void 0 : _deviceData$ioConfig3.direction) || 'output'
28681
28675
  };
28682
28676
 
28683
28677
  // Position at the attachment point
@@ -31064,20 +31058,252 @@ var SceneOperationsManager = /*#__PURE__*/function () {
31064
31058
  }
31065
31059
 
31066
31060
  /**
31067
- * Process behaviors from the scene data and pass them to the BehaviorManager.
31061
+ * Process behaviors from the scene data, expand any defaultBehaviors defined
31062
+ * on component dictionary entries, resolve behaviorRef entries against device
31063
+ * assets, inject per-instance component UUIDs, and hand the flat resolved
31064
+ * array to BehaviorManager.
31065
+ *
31066
+ * Resolution cascade:
31067
+ * 1. Explicit behaviors in data.behaviors — passed through as-is (behaviorRef
31068
+ * entries are resolved against the component/device dictionaries).
31069
+ * 2. defaultBehaviors[] on each placed smart component's dictionary entry —
31070
+ * expanded per instance with the instance UUID injected. Compact
31071
+ * behaviorRef-derived entries are tagged _isDefaultBehavior:true (the
31072
+ * exporter can re-derive them); full L2 behavior objects are tagged false
31073
+ * so they are exported verbatim and survive round-trips.
31074
+ *
31068
31075
  * @param {Object} data - Scene JSON data
31069
31076
  */
31070
31077
  }, {
31071
31078
  key: "_processBehaviors",
31072
31079
  value: function _processBehaviors(data) {
31073
- var _this$sceneViewer2;
31074
- if (!(data !== null && data !== void 0 && data.behaviors) || !Array.isArray(data.behaviors)) return;
31080
+ var _this$sceneViewer2,
31081
+ _this$sceneViewer$cen2,
31082
+ _this5 = this,
31083
+ _data$scene3;
31075
31084
  var behaviorManager = (_this$sceneViewer2 = this.sceneViewer) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.managers) === null || _this$sceneViewer2 === void 0 ? void 0 : _this$sceneViewer2.behaviorManager;
31076
31085
  if (!behaviorManager) {
31077
31086
  console.warn('⚠️ _processBehaviors: BehaviorManager not available');
31078
31087
  return;
31079
31088
  }
31080
- behaviorManager.loadBehaviors(data.behaviors);
31089
+
31090
+ // Obtain the component dictionary (extended = includes S3/smart components)
31091
+ var componentDictionary = ((_this$sceneViewer$cen2 = this.sceneViewer.centralPlant) === null || _this$sceneViewer$cen2 === void 0 || (_this$sceneViewer$cen2 = _this$sceneViewer$cen2.managers) === null || _this$sceneViewer$cen2 === void 0 || (_this$sceneViewer$cen2 = _this$sceneViewer$cen2.componentDataManager) === null || _this$sceneViewer$cen2 === void 0 ? void 0 : _this$sceneViewer$cen2.componentDictionary) || {};
31092
+
31093
+ // ── Step A: Resolve any behaviorRef entries from data.behaviors ─────────
31094
+ var explicitBehaviors = [];
31095
+ if (Array.isArray(data === null || data === void 0 ? void 0 : data.behaviors)) {
31096
+ data.behaviors.forEach(function (entry) {
31097
+ if (entry.behaviorRef) {
31098
+ var resolved = _this5._resolveBehaviorRef(entry, componentDictionary);
31099
+ if (resolved) explicitBehaviors.push(resolved);
31100
+ } else {
31101
+ explicitBehaviors.push(entry);
31102
+ }
31103
+ });
31104
+ }
31105
+
31106
+ // Build a set of explicit behavior ids for deduplication
31107
+ var explicitIds = new Set(explicitBehaviors.map(function (b) {
31108
+ return b.id;
31109
+ }));
31110
+
31111
+ // Build a set of instanceUuids already covered by behaviorRef entries in
31112
+ // data.behaviors (written by the exporter for smart component defaults).
31113
+ // Step B skips these instances to avoid loading the same behaviors twice —
31114
+ // once via Step A (resolved from data.behaviors refs) and once via Step B
31115
+ // (auto-expanded from the component dictionary).
31116
+ var coveredInstances = new Set();
31117
+ if (Array.isArray(data === null || data === void 0 ? void 0 : data.behaviors)) {
31118
+ data.behaviors.forEach(function (entry) {
31119
+ if (entry.behaviorRef && entry.component) {
31120
+ coveredInstances.add(entry.component);
31121
+ }
31122
+ });
31123
+ }
31124
+
31125
+ // ── Step B: Walk placed components and expand their defaultBehaviors ─────
31126
+ var instanceBehaviors = [];
31127
+ if (Array.isArray(data === null || data === void 0 || (_data$scene3 = data.scene) === null || _data$scene3 === void 0 ? void 0 : _data$scene3.children)) {
31128
+ data.scene.children.forEach(function (child) {
31129
+ var _child$userData0, _compData$defaultBeha;
31130
+ var libraryId = (_child$userData0 = child.userData) === null || _child$userData0 === void 0 ? void 0 : _child$userData0.libraryId;
31131
+ if (!libraryId) return;
31132
+ var instanceUuid = child.uuid;
31133
+ // Skip instances whose defaults were already resolved by Step A
31134
+ // (they have explicit behaviorRef entries in data.behaviors).
31135
+ if (coveredInstances.has(instanceUuid)) return;
31136
+ var compData = componentDictionary[libraryId];
31137
+ if (!(compData !== null && compData !== void 0 && (_compData$defaultBeha = compData.defaultBehaviors) !== null && _compData$defaultBeha !== void 0 && _compData$defaultBeha.length)) return;
31138
+ compData.defaultBehaviors.forEach(function (template) {
31139
+ var expanded = _this5._expandDefaultBehavior(template, instanceUuid, componentDictionary);
31140
+ if (!expanded) return;
31141
+ // Skip if an explicit scene behavior already covers this id
31142
+ if (explicitIds.has(expanded.id)) return;
31143
+ // All component defaultBehaviors are re-derivable from the component
31144
+ // asset at export time (via compact behaviorRef), so mark them all.
31145
+ expanded._isDefaultBehavior = true;
31146
+ instanceBehaviors.push(expanded);
31147
+ });
31148
+ });
31149
+ }
31150
+ var allBehaviors = [].concat(explicitBehaviors, instanceBehaviors);
31151
+ if (allBehaviors.length === 0) return;
31152
+ behaviorManager.loadBehaviors(allBehaviors);
31153
+ console.log("\u2705 _processBehaviors: loaded ".concat(explicitBehaviors.length, " explicit + ").concat(instanceBehaviors.length, " default-expanded behavior(s)"));
31154
+ }
31155
+
31156
+ /**
31157
+ * Register the defaultBehaviors of a single newly placed component instance
31158
+ * into the BehaviorManager. Called from addComponent() (drag-drop), where
31159
+ * _processBehaviors() (scene-load path) is not invoked.
31160
+ *
31161
+ * @param {Object} componentData - Entry from the component dictionary
31162
+ * @param {string} instanceUuid - UUID of the placed component (componentModel.uuid)
31163
+ */
31164
+ }, {
31165
+ key: "registerBehaviorsForComponentInstance",
31166
+ value: function registerBehaviorsForComponentInstance(componentData, instanceUuid) {
31167
+ var _this$sceneViewer3,
31168
+ _componentData$defaul,
31169
+ _this$sceneViewer$cen3,
31170
+ _this6 = this;
31171
+ var behaviorManager = (_this$sceneViewer3 = this.sceneViewer) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.managers) === null || _this$sceneViewer3 === void 0 ? void 0 : _this$sceneViewer3.behaviorManager;
31172
+ if (!behaviorManager) return;
31173
+ if (!(componentData !== null && componentData !== void 0 && (_componentData$defaul = componentData.defaultBehaviors) !== null && _componentData$defaul !== void 0 && _componentData$defaul.length)) return;
31174
+ var componentDictionary = ((_this$sceneViewer$cen3 = this.sceneViewer.centralPlant) === null || _this$sceneViewer$cen3 === void 0 || (_this$sceneViewer$cen3 = _this$sceneViewer$cen3.managers) === null || _this$sceneViewer$cen3 === void 0 || (_this$sceneViewer$cen3 = _this$sceneViewer$cen3.componentDataManager) === null || _this$sceneViewer$cen3 === void 0 ? void 0 : _this$sceneViewer$cen3.componentDictionary) || {};
31175
+ var registered = 0;
31176
+ componentData.defaultBehaviors.forEach(function (template) {
31177
+ var expanded = _this6._expandDefaultBehavior(template, instanceUuid, componentDictionary);
31178
+ if (!expanded) return;
31179
+ expanded._isDefaultBehavior = true;
31180
+ behaviorManager.addBehavior(expanded);
31181
+ registered++;
31182
+ });
31183
+ if (registered > 0) {
31184
+ console.log("\u2705 registerBehaviorsForComponentInstance: registered ".concat(registered, " behavior(s) for instance ").concat(instanceUuid));
31185
+ }
31186
+ }
31187
+
31188
+ /**
31189
+ * Resolve a scene-level or component-level behaviorRef entry into a full
31190
+ * behavior definition by looking up the referenced template in the device
31191
+ * asset's defaultBehaviors[] and substituting 'self' with the real
31192
+ * attachmentId.
31193
+ *
31194
+ * Ref shape: { behaviorRef, deviceId, attachment, component? }
31195
+ *
31196
+ * @param {Object} ref
31197
+ * @param {Object} componentDictionary
31198
+ * @returns {Object|null} Resolved behavior or null if not found
31199
+ */
31200
+ }, {
31201
+ key: "_resolveBehaviorRef",
31202
+ value: function _resolveBehaviorRef(ref, componentDictionary) {
31203
+ var _resolved$input, _resolved$output;
31204
+ if (!ref.behaviorRef) {
31205
+ console.warn('⚠️ _resolveBehaviorRef: missing behaviorRef', ref);
31206
+ return null;
31207
+ }
31208
+
31209
+ // ── Component-level L2 ref: { behaviorRef, libraryId, component } ──────
31210
+ // The full behavior template lives on the smart component's defaultBehaviors[].
31211
+ // No 'self' substitution needed — attachment IDs are already real.
31212
+ if (ref.libraryId) {
31213
+ var compData = componentDictionary[ref.libraryId];
31214
+ if (!compData) {
31215
+ console.warn("\u26A0\uFE0F _resolveBehaviorRef: component \"".concat(ref.libraryId, "\" not in dictionary"));
31216
+ return null;
31217
+ }
31218
+ var _template = (compData.defaultBehaviors || []).find(function (b) {
31219
+ return b.id === ref.behaviorRef;
31220
+ });
31221
+ if (!_template) {
31222
+ console.warn("\u26A0\uFE0F _resolveBehaviorRef: behavior \"".concat(ref.behaviorRef, "\" not found on component \"").concat(ref.libraryId, "\""));
31223
+ return null;
31224
+ }
31225
+ var _resolved = JSON.parse(JSON.stringify(_template));
31226
+ _resolved.id = "".concat(_resolved.id, "::").concat(ref.component);
31227
+ if (ref.component) {
31228
+ _resolved.input = _objectSpread2(_objectSpread2({}, _resolved.input), {}, {
31229
+ component: ref.component
31230
+ });
31231
+ _resolved.output = _objectSpread2(_objectSpread2({}, _resolved.output), {}, {
31232
+ component: ref.component
31233
+ });
31234
+ }
31235
+ return _resolved;
31236
+ }
31237
+
31238
+ // ── Device-level L1 ref: { behaviorRef, deviceId, attachment, component } ─
31239
+ if (!ref.deviceId || !ref.attachment) {
31240
+ console.warn('⚠️ _resolveBehaviorRef: incomplete ref', ref);
31241
+ return null;
31242
+ }
31243
+ var deviceData = componentDictionary[ref.deviceId];
31244
+ if (!deviceData) {
31245
+ console.warn("\u26A0\uFE0F _resolveBehaviorRef: device \"".concat(ref.deviceId, "\" not in dictionary"));
31246
+ return null;
31247
+ }
31248
+ var template = (deviceData.defaultBehaviors || []).find(function (b) {
31249
+ return b.id === ref.behaviorRef;
31250
+ });
31251
+ if (!template) {
31252
+ console.warn("\u26A0\uFE0F _resolveBehaviorRef: behavior \"".concat(ref.behaviorRef, "\" not found on device \"").concat(ref.deviceId, "\""));
31253
+ return null;
31254
+ }
31255
+ // Deep clone and substitute 'self' -> real attachmentId
31256
+ var resolved = JSON.parse(JSON.stringify(template));
31257
+ resolved.id = "".concat(resolved.id, "::").concat(ref.attachment);
31258
+ if (((_resolved$input = resolved.input) === null || _resolved$input === void 0 ? void 0 : _resolved$input.attachment) === 'self') resolved.input.attachment = ref.attachment;
31259
+ if (((_resolved$output = resolved.output) === null || _resolved$output === void 0 ? void 0 : _resolved$output.attachment) === 'self') resolved.output.attachment = ref.attachment;
31260
+ // Inject component UUID guard if the ref carries one
31261
+ if (ref.component) {
31262
+ resolved.input = _objectSpread2(_objectSpread2({}, resolved.input), {}, {
31263
+ component: ref.component
31264
+ });
31265
+ resolved.output = _objectSpread2(_objectSpread2({}, resolved.output), {}, {
31266
+ component: ref.component
31267
+ });
31268
+ }
31269
+ return resolved;
31270
+ }
31271
+
31272
+ /**
31273
+ * Expand a single defaultBehaviors[] template entry for a specific component
31274
+ * instance placed in the scene.
31275
+ *
31276
+ * If the entry is a behaviorRef, it is first resolved against the device
31277
+ * library; otherwise it is treated as a full behavior definition.
31278
+ * In both cases the instanceUuid is injected as input.component and
31279
+ * output.component, and the behavior id is suffixed with ::instanceUuid.
31280
+ *
31281
+ * @param {Object} template - Entry from compData.defaultBehaviors[]
31282
+ * @param {string} instanceUuid - UUID of the placed component instance
31283
+ * @param {Object} componentDictionary
31284
+ * @returns {Object|null}
31285
+ */
31286
+ }, {
31287
+ key: "_expandDefaultBehavior",
31288
+ value: function _expandDefaultBehavior(template, instanceUuid, componentDictionary) {
31289
+ var base;
31290
+ if (template.behaviorRef) {
31291
+ // Resolve the device ref first (substitutes 'self' -> attachment)
31292
+ base = this._resolveBehaviorRef(template, componentDictionary);
31293
+ if (!base) return null;
31294
+ } else {
31295
+ base = JSON.parse(JSON.stringify(template));
31296
+ }
31297
+ // Suffix the id so each instance gets a unique behavior id
31298
+ base.id = "".concat(base.id, "::").concat(instanceUuid);
31299
+ // Inject the instance UUID as the component scope guard
31300
+ base.input = _objectSpread2(_objectSpread2({}, base.input), {}, {
31301
+ component: instanceUuid
31302
+ });
31303
+ base.output = _objectSpread2(_objectSpread2({}, base.output), {}, {
31304
+ component: instanceUuid
31305
+ });
31306
+ return base;
31081
31307
  }
31082
31308
 
31083
31309
  /**
@@ -31148,7 +31374,7 @@ var SceneOperationsManager = /*#__PURE__*/function () {
31148
31374
  key: "loadSceneFromData",
31149
31375
  value: (function () {
31150
31376
  var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(data) {
31151
- var _data$scene3, _data$scene4, _data$scene5, _data$scene6;
31377
+ var _data$scene4, _data$scene5, _data$scene6, _data$scene7;
31152
31378
  return _regenerator().w(function (_context9) {
31153
31379
  while (1) switch (_context9.n) {
31154
31380
  case 0:
@@ -31158,10 +31384,10 @@ var SceneOperationsManager = /*#__PURE__*/function () {
31158
31384
  dataType: _typeof(data),
31159
31385
  hasScene: !!(data !== null && data !== void 0 && data.scene),
31160
31386
  sceneType: _typeof(data === null || data === void 0 ? void 0 : data.scene),
31161
- hasChildren: !!(data !== null && data !== void 0 && (_data$scene3 = data.scene) !== null && _data$scene3 !== void 0 && _data$scene3.children),
31162
- childrenType: data !== null && data !== void 0 && (_data$scene4 = data.scene) !== null && _data$scene4 !== void 0 && _data$scene4.children ? _typeof(data.scene.children) : 'undefined',
31163
- isArray: Array.isArray(data === null || data === void 0 || (_data$scene5 = data.scene) === null || _data$scene5 === void 0 ? void 0 : _data$scene5.children),
31164
- childrenLength: data === null || data === void 0 || (_data$scene6 = data.scene) === null || _data$scene6 === void 0 || (_data$scene6 = _data$scene6.children) === null || _data$scene6 === void 0 ? void 0 : _data$scene6.length,
31387
+ hasChildren: !!(data !== null && data !== void 0 && (_data$scene4 = data.scene) !== null && _data$scene4 !== void 0 && _data$scene4.children),
31388
+ childrenType: data !== null && data !== void 0 && (_data$scene5 = data.scene) !== null && _data$scene5 !== void 0 && _data$scene5.children ? _typeof(data.scene.children) : 'undefined',
31389
+ isArray: Array.isArray(data === null || data === void 0 || (_data$scene6 = data.scene) === null || _data$scene6 === void 0 ? void 0 : _data$scene6.children),
31390
+ childrenLength: data === null || data === void 0 || (_data$scene7 = data.scene) === null || _data$scene7 === void 0 || (_data$scene7 = _data$scene7.children) === null || _data$scene7 === void 0 ? void 0 : _data$scene7.length,
31165
31391
  dataKeys: data ? Object.keys(data) : [],
31166
31392
  sceneKeys: data !== null && data !== void 0 && data.scene ? Object.keys(data.scene) : []
31167
31393
  });
@@ -31292,8 +31518,8 @@ var SceneOperationsManager = /*#__PURE__*/function () {
31292
31518
  // Process children (connectors, etc.) if they exist
31293
31519
  if (componentModel.children && componentModel.children.length > 0) {
31294
31520
  componentModel.children.forEach(function (child) {
31295
- var _child$userData0, _child$userData1;
31296
- var childType = ((_child$userData0 = child.userData) === null || _child$userData0 === void 0 ? void 0 : _child$userData0.objectType) || ((_child$userData1 = child.userData) === null || _child$userData1 === void 0 ? void 0 : _child$userData1.objectType);
31521
+ var _child$userData1, _child$userData10;
31522
+ var childType = ((_child$userData1 = child.userData) === null || _child$userData1 === void 0 ? void 0 : _child$userData1.objectType) || ((_child$userData10 = child.userData) === null || _child$userData10 === void 0 ? void 0 : _child$userData10.objectType);
31297
31523
  if (childType === 'connector') {
31298
31524
  var _child$geometry;
31299
31525
  var childBoundingBox = new THREE__namespace.Box3().setFromObject(child);
@@ -31378,8 +31604,8 @@ var SceneOperationsManager = /*#__PURE__*/function () {
31378
31604
  if (segment.children && segment.children.length > 0) {
31379
31605
  var childrenToRemove = _toConsumableArray(segment.children);
31380
31606
  childrenToRemove.forEach(function (child) {
31381
- var _child$userData10;
31382
- if ((_child$userData10 = child.userData) !== null && _child$userData10 !== void 0 && _child$userData10.isPipeElbow) {
31607
+ var _child$userData11;
31608
+ if ((_child$userData11 = child.userData) !== null && _child$userData11 !== void 0 && _child$userData11.isPipeElbow) {
31383
31609
  console.log("\uD83D\uDDD1\uFE0F Removing elbow child from segment before manualization: ".concat(child.uuid));
31384
31610
  segment.remove(child);
31385
31611
  if (child.geometry) child.geometry.dispose();
@@ -31530,7 +31756,7 @@ var SceneOperationsManager = /*#__PURE__*/function () {
31530
31756
  value: function _convertConnectedGatewaysToManual(connectors, currentSceneData) {
31531
31757
  var _connectors$,
31532
31758
  _segment$userData2,
31533
- _this5 = this;
31759
+ _this7 = this;
31534
31760
  console.log('🔍 Checking for connected gateways to convert to manual...');
31535
31761
  var sceneViewer = this.sceneViewer;
31536
31762
  var convertedGateways = [];
@@ -31567,7 +31793,7 @@ var SceneOperationsManager = /*#__PURE__*/function () {
31567
31793
  console.log("\uD83D\uDD27 Found computed gateway at endpoint: ".concat(endpointObject.uuid, " - converting to manual"));
31568
31794
 
31569
31795
  // Convert gateway to manual (declared) using manualizeGateway for consistency
31570
- _this5.manualizeGateway(endpointObject, currentSceneData);
31796
+ _this7.manualizeGateway(endpointObject, currentSceneData);
31571
31797
  convertedGateways.push(endpointObject);
31572
31798
  } else if (((_endpointObject$userD5 = endpointObject.userData) === null || _endpointObject$userD5 === void 0 ? void 0 : _endpointObject$userD5.objectType) === 'gateway' && ((_endpointObject$userD6 = endpointObject.userData) === null || _endpointObject$userD6 === void 0 ? void 0 : _endpointObject$userD6.isDeclared) === true) {
31573
31799
  console.log("\u2139\uFE0F Gateway ".concat(endpointObject.uuid, " is already declared (manual), skipping conversion"));
@@ -32313,8 +32539,7 @@ var ComponentDragManager = /*#__PURE__*/function (_BaseDisposable) {
32313
32539
  // ioConfig can use either 'states' (preferred) or legacy 'dataPoints' as the array key
32314
32540
  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
32541
  // 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 || []
32542
+ ioDirection: ((_deviceData$ioConfig3 = deviceData.ioConfig) === null || _deviceData$ioConfig3 === void 0 ? void 0 : _deviceData$ioConfig3.direction) || 'output'
32318
32543
  };
32319
32544
  if ((_attachment$attachmen = attachment.attachmentPoint) !== null && _attachment$attachmen !== void 0 && _attachment$attachmen.position) {
32320
32545
  pos = attachment.attachmentPoint.position;
@@ -36515,7 +36740,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
36515
36740
  return false;
36516
36741
  }
36517
36742
  try {
36518
- var _componentData$childr, _componentData$childr2, _this$centralPlant$sc6, _componentData$childr3;
36743
+ var _componentData$childr, _componentData$childr2, _this$centralPlant$sc6, _componentData$childr3, _componentData$defaul;
36519
36744
  // Generate a unique component ID if not provided
36520
36745
  var componentId = options.customId || this.generateUniqueComponentId(libraryId);
36521
36746
 
@@ -36721,6 +36946,15 @@ var CentralPlantInternals = /*#__PURE__*/function () {
36721
36946
  attachIODevicesToComponent(componentModel, componentData, modelPreloader, componentId);
36722
36947
  }
36723
36948
 
36949
+ // Register default behaviors for smart components so the BehaviorManager
36950
+ // responds to tooltip-driven state changes immediately after drop.
36951
+ // (The scene-load path uses _processBehaviors instead, which runs on loadSceneData.)
36952
+ if ((_componentData$defaul = componentData.defaultBehaviors) !== null && _componentData$defaul !== void 0 && _componentData$defaul.length) {
36953
+ var _this$centralPlant$sc7, _som$registerBehavior;
36954
+ var som = (_this$centralPlant$sc7 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc7 === void 0 ? void 0 : _this$centralPlant$sc7.sceneOperationsManager;
36955
+ som === null || som === void 0 || (_som$registerBehavior = som.registerBehaviorsForComponentInstance) === null || _som$registerBehavior === void 0 || _som$registerBehavior.call(som, componentData, componentId);
36956
+ }
36957
+
36724
36958
  // Notify the component manager about the new component
36725
36959
  if (componentManager.registerComponent) {
36726
36960
  componentManager.registerComponent(componentModel);
@@ -36779,9 +37013,9 @@ var CentralPlantInternals = /*#__PURE__*/function () {
36779
37013
  }, {
36780
37014
  key: "deleteComponent",
36781
37015
  value: function deleteComponent(componentId) {
36782
- var _this$centralPlant$sc7;
37016
+ var _this$centralPlant$sc8;
36783
37017
  // Check if component manager is available
36784
- var componentManager = (_this$centralPlant$sc7 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc7 === void 0 ? void 0 : _this$centralPlant$sc7.componentManager;
37018
+ var componentManager = (_this$centralPlant$sc8 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc8 === void 0 ? void 0 : _this$centralPlant$sc8.componentManager;
36785
37019
  if (!componentManager) {
36786
37020
  console.error('❌ deleteComponent(): Component manager not available');
36787
37021
  return false;
@@ -36876,7 +37110,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
36876
37110
  * Initialize the CentralPlant manager
36877
37111
  *
36878
37112
  * @constructor
36879
- * @version 0.1.91
37113
+ * @version 0.1.93
36880
37114
  * @updated 2025-10-22
36881
37115
  *
36882
37116
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -37952,6 +38186,337 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
37952
38186
  return results;
37953
38187
  }
37954
38188
 
38189
+ // ===== I/O DEVICE ASSET API =====
38190
+
38191
+ /**
38192
+ * Set the asset service for I/O device attachment operations.
38193
+ * The service handles S3 storage and Vuex state updates so that
38194
+ * the central-plant package stays free of sandbox-specific dependencies.
38195
+ * @param {Object} service - Object with createSmartComponent, addComponentAttachment, removeComponentAttachment methods
38196
+ * @example
38197
+ * import { createAssetService } from '~/services/AssetService'
38198
+ * centralPlant.setAssetService(createAssetService(store))
38199
+ */
38200
+ }, {
38201
+ key: "setAssetService",
38202
+ value: function setAssetService(service) {
38203
+ if (!service || _typeof(service) !== 'object') {
38204
+ console.warn('⚠️ setAssetService(): service must be an object');
38205
+ return;
38206
+ }
38207
+ this.assetService = service;
38208
+ console.log('✅ Asset service set');
38209
+ }
38210
+
38211
+ /**
38212
+ * List all available I/O Device assets from the component dictionary.
38213
+ * @param {Object} [options={}]
38214
+ * @param {'all'|'bundled'|'user'} [options.source='all'] - Filter by asset origin
38215
+ * @returns {Array<{uuid: string, name: string, assetType: string, ioConfig: Object}>}
38216
+ * @example
38217
+ * const devices = centralPlant.getIoDevices({ source: 'all' })
38218
+ * const bundledOnly = centralPlant.getIoDevices({ source: 'bundled' })
38219
+ */
38220
+ }, {
38221
+ key: "getIoDevices",
38222
+ value: function getIoDevices() {
38223
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
38224
+ _ref$source = _ref.source,
38225
+ source = _ref$source === void 0 ? 'all' : _ref$source;
38226
+ var mp = this.getUtility('modelPreloader');
38227
+ var dict = mp === null || mp === void 0 ? void 0 : mp.componentDictionary;
38228
+ if (!dict) {
38229
+ console.warn('⚠️ getIoDevices(): component dictionary not loaded');
38230
+ return [];
38231
+ }
38232
+ return Object.values(dict).filter(function (entry) {
38233
+ return entry.assetType === 'I/O Device';
38234
+ }).filter(function (entry) {
38235
+ if (source === 'bundled') return !entry.isS3Component;
38236
+ if (source === 'user') return entry.isS3Component === true;
38237
+ return true; // 'all'
38238
+ }).map(function (entry) {
38239
+ return {
38240
+ uuid: entry.uuid || entry.id,
38241
+ name: entry.name,
38242
+ assetType: entry.assetType,
38243
+ ioConfig: entry.ioConfig || {}
38244
+ };
38245
+ });
38246
+ }
38247
+
38248
+ /**
38249
+ * Return a list of smart components that reference a given I/O Device.
38250
+ * Useful for enforcing deletion guards.
38251
+ * @param {Object} options
38252
+ * @param {string} options.deviceUuid - UUID of the I/O Device asset to check
38253
+ * @returns {Array<{componentId: string, componentName: string}>}
38254
+ * @example
38255
+ * const usage = centralPlant.getIoDeviceUsage({ deviceUuid: 'io-def-push-button' })
38256
+ * // [{ componentId: 'comp-smart-pump-01', componentName: 'Smart Pump' }]
38257
+ */
38258
+ }, {
38259
+ key: "getIoDeviceUsage",
38260
+ value: function getIoDeviceUsage() {
38261
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
38262
+ deviceUuid = _ref2.deviceUuid;
38263
+ if (!deviceUuid) {
38264
+ console.warn('⚠️ getIoDeviceUsage(): deviceUuid is required');
38265
+ return [];
38266
+ }
38267
+ var mp = this.getUtility('modelPreloader');
38268
+ var dict = mp === null || mp === void 0 ? void 0 : mp.componentDictionary;
38269
+ if (!dict) {
38270
+ console.warn('⚠️ getIoDeviceUsage(): component dictionary not loaded');
38271
+ return [];
38272
+ }
38273
+ var results = [];
38274
+ Object.values(dict).forEach(function (entry) {
38275
+ if (!entry.isSmart || !entry.attachedDevices) return;
38276
+ var uses = Object.values(entry.attachedDevices).some(function (att) {
38277
+ return att.deviceId === deviceUuid;
38278
+ });
38279
+ if (uses) {
38280
+ results.push({
38281
+ componentId: entry.uuid || entry.id,
38282
+ componentName: entry.name || ''
38283
+ });
38284
+ }
38285
+ });
38286
+ return results;
38287
+ }
38288
+
38289
+ /**
38290
+ * Create a new smart component asset by attaching I/O devices to an existing component.
38291
+ * Requires setAssetService() to have been called first.
38292
+ * @param {Object} options
38293
+ * @param {string} options.componentUuid - UUID of the base component to promote
38294
+ * @param {string} [options.name] - Display name for the new smart component (auto-deduped)
38295
+ * @param {Array} options.attachments - Attachment descriptors (attachmentId, deviceId, attachmentLabel, attachmentPoint)
38296
+ * @param {Blob} [options.thumbnailBlob] - Optional thumbnail image blob
38297
+ * @returns {Promise<Object>} The new smart component asset object
38298
+ * @example
38299
+ * const newAsset = await centralPlant.createSmartComponent({
38300
+ * componentUuid: 'comp-base-pump-01',
38301
+ * name: 'Smart Pump A',
38302
+ * attachments: [{
38303
+ * attachmentId: 'attch-button-01',
38304
+ * deviceId: 'io-def-push-button',
38305
+ * attachmentLabel: 'Power Button',
38306
+ * attachmentPoint: { position: { x: -0.1, y: 0.3, z: 0.0 }, direction: { x: 0.0, y: 1.0, z: 0.0 } }
38307
+ * }]
38308
+ * })
38309
+ */
38310
+ }, {
38311
+ key: "createSmartComponent",
38312
+ value: (function () {
38313
+ var _createSmartComponent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
38314
+ var _ref3,
38315
+ componentUuid,
38316
+ name,
38317
+ attachments,
38318
+ thumbnailBlob,
38319
+ newAsset,
38320
+ mp,
38321
+ _args3 = arguments;
38322
+ return _regenerator().w(function (_context3) {
38323
+ while (1) switch (_context3.n) {
38324
+ case 0:
38325
+ _ref3 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, componentUuid = _ref3.componentUuid, name = _ref3.name, attachments = _ref3.attachments, thumbnailBlob = _ref3.thumbnailBlob;
38326
+ if (this.assetService) {
38327
+ _context3.n = 1;
38328
+ break;
38329
+ }
38330
+ throw new Error('createSmartComponent(): no asset service set — call setAssetService() first');
38331
+ case 1:
38332
+ if (componentUuid) {
38333
+ _context3.n = 2;
38334
+ break;
38335
+ }
38336
+ throw new Error('createSmartComponent(): componentUuid is required');
38337
+ case 2:
38338
+ if (!(!Array.isArray(attachments) || attachments.length === 0)) {
38339
+ _context3.n = 3;
38340
+ break;
38341
+ }
38342
+ throw new Error('createSmartComponent(): at least one attachment is required');
38343
+ case 3:
38344
+ _context3.n = 4;
38345
+ return this.assetService.createSmartComponent({
38346
+ componentUuid: componentUuid,
38347
+ name: name,
38348
+ attachments: attachments,
38349
+ thumbnailBlob: thumbnailBlob
38350
+ });
38351
+ case 4:
38352
+ newAsset = _context3.v;
38353
+ // Register in model preloader dictionary so addComponent() can use it immediately
38354
+ mp = this.getUtility('modelPreloader');
38355
+ if (mp !== null && mp !== void 0 && mp.componentDictionary && newAsset !== null && newAsset !== void 0 && newAsset.uuid) {
38356
+ mp.componentDictionary[newAsset.uuid] = _objectSpread2(_objectSpread2({}, newAsset), {}, {
38357
+ id: newAsset.uuid
38358
+ });
38359
+ console.log("\u2705 createSmartComponent(): registered \"".concat(newAsset.name, "\" in component dictionary"));
38360
+ }
38361
+ return _context3.a(2, newAsset);
38362
+ }
38363
+ }, _callee3, this);
38364
+ }));
38365
+ function createSmartComponent() {
38366
+ return _createSmartComponent.apply(this, arguments);
38367
+ }
38368
+ return createSmartComponent;
38369
+ }()
38370
+ /**
38371
+ * Add or update a single I/O device attachment on an existing smart component.
38372
+ * Requires setAssetService() to have been called first.
38373
+ * Updates S3 data and Vuex store only — does NOT update live scene objects.
38374
+ * @param {Object} options
38375
+ * @param {string} options.componentUuid - UUID of the smart component to update
38376
+ * @param {Object} options.attachment - Attachment descriptor
38377
+ * @param {string} options.attachment.attachmentId - Globally unique attachment key
38378
+ * @param {string} options.attachment.deviceId - UUID of the I/O Device asset
38379
+ * @param {string} options.attachment.attachmentLabel - Human-readable label
38380
+ * @param {Object} [options.attachment.attachmentPoint] - Position/direction on the model
38381
+ * @returns {Promise<Object>} The updated smart component asset object
38382
+ * @example
38383
+ * await centralPlant.addComponentAttachment({
38384
+ * componentUuid: 'comp-smart-pump-01',
38385
+ * attachment: {
38386
+ * attachmentId: 'attch-led-01',
38387
+ * deviceId: 'io-def-signal-light',
38388
+ * attachmentLabel: 'Status LED',
38389
+ * attachmentPoint: { position: { x: 0.1, y: 0.3, z: 0.0 }, direction: { x: 0.0, y: 1.0, z: 0.0 } }
38390
+ * }
38391
+ * })
38392
+ */
38393
+ )
38394
+ }, {
38395
+ key: "addComponentAttachment",
38396
+ value: (function () {
38397
+ var _addComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
38398
+ var _ref4,
38399
+ componentUuid,
38400
+ attachment,
38401
+ updatedAsset,
38402
+ mp,
38403
+ _args4 = arguments;
38404
+ return _regenerator().w(function (_context4) {
38405
+ while (1) switch (_context4.n) {
38406
+ case 0:
38407
+ _ref4 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, componentUuid = _ref4.componentUuid, attachment = _ref4.attachment;
38408
+ if (this.assetService) {
38409
+ _context4.n = 1;
38410
+ break;
38411
+ }
38412
+ throw new Error('addComponentAttachment(): no asset service set — call setAssetService() first');
38413
+ case 1:
38414
+ if (componentUuid) {
38415
+ _context4.n = 2;
38416
+ break;
38417
+ }
38418
+ throw new Error('addComponentAttachment(): componentUuid is required');
38419
+ case 2:
38420
+ if (!(!(attachment !== null && attachment !== void 0 && attachment.attachmentId) || !(attachment !== null && attachment !== void 0 && attachment.deviceId))) {
38421
+ _context4.n = 3;
38422
+ break;
38423
+ }
38424
+ throw new Error('addComponentAttachment(): attachment must have attachmentId and deviceId');
38425
+ case 3:
38426
+ _context4.n = 4;
38427
+ return this.assetService.addComponentAttachment({
38428
+ componentUuid: componentUuid,
38429
+ attachment: attachment
38430
+ });
38431
+ case 4:
38432
+ updatedAsset = _context4.v;
38433
+ // Sync component dictionary
38434
+ mp = this.getUtility('modelPreloader');
38435
+ if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
38436
+ mp.componentDictionary[updatedAsset.uuid] = _objectSpread2(_objectSpread2(_objectSpread2({}, mp.componentDictionary[updatedAsset.uuid] || {}), updatedAsset), {}, {
38437
+ id: updatedAsset.uuid
38438
+ });
38439
+ }
38440
+ return _context4.a(2, updatedAsset);
38441
+ }
38442
+ }, _callee4, this);
38443
+ }));
38444
+ function addComponentAttachment() {
38445
+ return _addComponentAttachment.apply(this, arguments);
38446
+ }
38447
+ return addComponentAttachment;
38448
+ }()
38449
+ /**
38450
+ * Remove a single I/O device attachment from a smart component.
38451
+ * Requires setAssetService() to have been called first.
38452
+ * If this is the last attachment the component is demoted to a plain component.
38453
+ * Updates S3 data and Vuex store only — does NOT update live scene objects.
38454
+ * @param {Object} options
38455
+ * @param {string} options.componentUuid - UUID of the smart component to update
38456
+ * @param {string} options.attachmentId - The attachmentId key to remove
38457
+ * @returns {Promise<Object>} The updated component asset object
38458
+ * @example
38459
+ * await centralPlant.removeComponentAttachment({
38460
+ * componentUuid: 'comp-smart-pump-01',
38461
+ * attachmentId: 'attch-led-01'
38462
+ * })
38463
+ */
38464
+ )
38465
+ }, {
38466
+ key: "removeComponentAttachment",
38467
+ value: (function () {
38468
+ var _removeComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
38469
+ var _ref5,
38470
+ componentUuid,
38471
+ attachmentId,
38472
+ updatedAsset,
38473
+ mp,
38474
+ _args5 = arguments;
38475
+ return _regenerator().w(function (_context5) {
38476
+ while (1) switch (_context5.n) {
38477
+ case 0:
38478
+ _ref5 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, componentUuid = _ref5.componentUuid, attachmentId = _ref5.attachmentId;
38479
+ if (this.assetService) {
38480
+ _context5.n = 1;
38481
+ break;
38482
+ }
38483
+ throw new Error('removeComponentAttachment(): no asset service set — call setAssetService() first');
38484
+ case 1:
38485
+ if (componentUuid) {
38486
+ _context5.n = 2;
38487
+ break;
38488
+ }
38489
+ throw new Error('removeComponentAttachment(): componentUuid is required');
38490
+ case 2:
38491
+ if (attachmentId) {
38492
+ _context5.n = 3;
38493
+ break;
38494
+ }
38495
+ throw new Error('removeComponentAttachment(): attachmentId is required');
38496
+ case 3:
38497
+ _context5.n = 4;
38498
+ return this.assetService.removeComponentAttachment({
38499
+ componentUuid: componentUuid,
38500
+ attachmentId: attachmentId
38501
+ });
38502
+ case 4:
38503
+ updatedAsset = _context5.v;
38504
+ // Sync component dictionary
38505
+ mp = this.getUtility('modelPreloader');
38506
+ if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
38507
+ mp.componentDictionary[updatedAsset.uuid] = _objectSpread2(_objectSpread2(_objectSpread2({}, mp.componentDictionary[updatedAsset.uuid] || {}), updatedAsset), {}, {
38508
+ id: updatedAsset.uuid
38509
+ });
38510
+ }
38511
+ return _context5.a(2, updatedAsset);
38512
+ }
38513
+ }, _callee5, this);
38514
+ }));
38515
+ function removeComponentAttachment() {
38516
+ return _removeComponentAttachment.apply(this, arguments);
38517
+ }
38518
+ return removeComponentAttachment;
38519
+ }()
37955
38520
  /**
37956
38521
  * Get all component IDs from the scene
37957
38522
  * @returns {Array<string>} Array of component UUID strings, or empty array if none exist
@@ -37969,6 +38534,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
37969
38534
  * // Check if specific component exists
37970
38535
  * const hasChiller = componentIds.some(id => id.includes('chiller'));
37971
38536
  */
38537
+ )
37972
38538
  }, {
37973
38539
  key: "getComponentIds",
37974
38540
  value: function getComponentIds() {
@@ -38137,41 +38703,41 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38137
38703
  }, {
38138
38704
  key: "getComponents",
38139
38705
  value: (function () {
38140
- var _getComponents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
38706
+ var _getComponents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
38141
38707
  var options,
38142
38708
  validation,
38143
38709
  enhancedOptions,
38144
- _args3 = arguments,
38710
+ _args6 = arguments,
38145
38711
  _t;
38146
- return _regenerator().w(function (_context3) {
38147
- while (1) switch (_context3.n) {
38712
+ return _regenerator().w(function (_context6) {
38713
+ while (1) switch (_context6.n) {
38148
38714
  case 0:
38149
- options = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
38715
+ options = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
38150
38716
  // Validate filter options using centralized validator
38151
38717
  validation = this.internals.validator.validateComponentFilter(options);
38152
38718
  if (validation.isValid) {
38153
- _context3.n = 1;
38719
+ _context6.n = 1;
38154
38720
  break;
38155
38721
  }
38156
38722
  console.warn('⚠️ getComponents(): Invalid filter options provided:', validation.message);
38157
- return _context3.a(2, []);
38723
+ return _context6.a(2, []);
38158
38724
  case 1:
38159
- _context3.p = 1;
38725
+ _context6.p = 1;
38160
38726
  // Always include metadata
38161
38727
  enhancedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
38162
38728
  includeMetadata: true
38163
38729
  });
38164
- _context3.n = 2;
38730
+ _context6.n = 2;
38165
38731
  return this.managers.componentDataManager.getDictionaryComponents(enhancedOptions);
38166
38732
  case 2:
38167
- return _context3.a(2, _context3.v);
38733
+ return _context6.a(2, _context6.v);
38168
38734
  case 3:
38169
- _context3.p = 3;
38170
- _t = _context3.v;
38735
+ _context6.p = 3;
38736
+ _t = _context6.v;
38171
38737
  console.error('❌ getDictionaryComponents(): Error retrieving available components:', _t);
38172
- return _context3.a(2, []);
38738
+ return _context6.a(2, []);
38173
38739
  }
38174
- }, _callee3, this, [[1, 3]]);
38740
+ }, _callee6, this, [[1, 3]]);
38175
38741
  }));
38176
38742
  function getComponents() {
38177
38743
  return _getComponents.apply(this, arguments);
@@ -38274,23 +38840,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38274
38840
  }, {
38275
38841
  key: "extendComponentDictionary",
38276
38842
  value: (function () {
38277
- var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(additionalComponents) {
38278
- return _regenerator().w(function (_context4) {
38279
- while (1) switch (_context4.n) {
38843
+ var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(additionalComponents) {
38844
+ return _regenerator().w(function (_context7) {
38845
+ while (1) switch (_context7.n) {
38280
38846
  case 0:
38281
38847
  if (this.managers.componentDataManager) {
38282
- _context4.n = 1;
38848
+ _context7.n = 1;
38283
38849
  break;
38284
38850
  }
38285
38851
  console.warn('⚠️ extendComponentDictionary(): Component data manager not available');
38286
- return _context4.a(2, false);
38852
+ return _context7.a(2, false);
38287
38853
  case 1:
38288
- _context4.n = 2;
38854
+ _context7.n = 2;
38289
38855
  return this.managers.componentDataManager.extendComponentDictionary(additionalComponents);
38290
38856
  case 2:
38291
- return _context4.a(2, _context4.v);
38857
+ return _context7.a(2, _context7.v);
38292
38858
  }
38293
- }, _callee4, this);
38859
+ }, _callee7, this);
38294
38860
  }));
38295
38861
  function extendComponentDictionary(_x3) {
38296
38862
  return _extendComponentDictionary.apply(this, arguments);
@@ -38313,23 +38879,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38313
38879
  }, {
38314
38880
  key: "removeS3Components",
38315
38881
  value: (function () {
38316
- var _removeS3Components = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
38317
- return _regenerator().w(function (_context5) {
38318
- while (1) switch (_context5.n) {
38882
+ var _removeS3Components = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
38883
+ return _regenerator().w(function (_context8) {
38884
+ while (1) switch (_context8.n) {
38319
38885
  case 0:
38320
38886
  if (this.managers.componentDataManager) {
38321
- _context5.n = 1;
38887
+ _context8.n = 1;
38322
38888
  break;
38323
38889
  }
38324
38890
  console.warn('⚠️ removeS3Components(): Component data manager not available');
38325
- return _context5.a(2, false);
38891
+ return _context8.a(2, false);
38326
38892
  case 1:
38327
- _context5.n = 2;
38893
+ _context8.n = 2;
38328
38894
  return this.managers.componentDataManager.removeS3Components();
38329
38895
  case 2:
38330
- return _context5.a(2, _context5.v);
38896
+ return _context8.a(2, _context8.v);
38331
38897
  }
38332
- }, _callee5, this);
38898
+ }, _callee8, this);
38333
38899
  }));
38334
38900
  function removeS3Components() {
38335
38901
  return _removeS3Components.apply(this, arguments);
@@ -38353,23 +38919,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38353
38919
  }, {
38354
38920
  key: "removeComponentFromDictionary",
38355
38921
  value: (function () {
38356
- var _removeComponentFromDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(componentKey) {
38357
- return _regenerator().w(function (_context6) {
38358
- while (1) switch (_context6.n) {
38922
+ var _removeComponentFromDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(componentKey) {
38923
+ return _regenerator().w(function (_context9) {
38924
+ while (1) switch (_context9.n) {
38359
38925
  case 0:
38360
38926
  if (this.managers.componentDataManager) {
38361
- _context6.n = 1;
38927
+ _context9.n = 1;
38362
38928
  break;
38363
38929
  }
38364
38930
  console.warn('⚠️ removeComponentFromDictionary(): Component data manager not available');
38365
- return _context6.a(2, false);
38931
+ return _context9.a(2, false);
38366
38932
  case 1:
38367
- _context6.n = 2;
38933
+ _context9.n = 2;
38368
38934
  return this.managers.componentDataManager.removeComponentFromDictionary(componentKey);
38369
38935
  case 2:
38370
- return _context6.a(2, _context6.v);
38936
+ return _context9.a(2, _context9.v);
38371
38937
  }
38372
- }, _callee6, this);
38938
+ }, _callee9, this);
38373
38939
  }));
38374
38940
  function removeComponentFromDictionary(_x4) {
38375
38941
  return _removeComponentFromDictionary.apply(this, arguments);
@@ -38616,49 +39182,49 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38616
39182
  }, {
38617
39183
  key: "initialize2DViewport",
38618
39184
  value: function () {
38619
- var _initialize2DViewport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(container) {
39185
+ var _initialize2DViewport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(container) {
38620
39186
  var viewType,
38621
39187
  instanceKey,
38622
39188
  success,
38623
- _args7 = arguments,
39189
+ _args0 = arguments,
38624
39190
  _t2;
38625
- return _regenerator().w(function (_context7) {
38626
- while (1) switch (_context7.n) {
39191
+ return _regenerator().w(function (_context0) {
39192
+ while (1) switch (_context0.n) {
38627
39193
  case 0:
38628
- viewType = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : 'top';
38629
- instanceKey = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : null;
39194
+ viewType = _args0.length > 1 && _args0[1] !== undefined ? _args0[1] : 'top';
39195
+ instanceKey = _args0.length > 2 && _args0[2] !== undefined ? _args0[2] : null;
38630
39196
  if (container) {
38631
- _context7.n = 1;
39197
+ _context0.n = 1;
38632
39198
  break;
38633
39199
  }
38634
39200
  console.warn('⚠️ initialize2DViewport(): No container provided');
38635
- return _context7.a(2, false);
39201
+ return _context0.a(2, false);
38636
39202
  case 1:
38637
39203
  if (this.managers.viewport2DManager) {
38638
- _context7.n = 2;
39204
+ _context0.n = 2;
38639
39205
  break;
38640
39206
  }
38641
39207
  console.warn('⚠️ initialize2DViewport(): Viewport2D manager not available');
38642
- return _context7.a(2, false);
39208
+ return _context0.a(2, false);
38643
39209
  case 2:
38644
- _context7.p = 2;
38645
- _context7.n = 3;
39210
+ _context0.p = 2;
39211
+ _context0.n = 3;
38646
39212
  return this.managers.viewport2DManager.initialize(container, viewType, instanceKey);
38647
39213
  case 3:
38648
- success = _context7.v;
39214
+ success = _context0.v;
38649
39215
  if (success) {
38650
39216
  console.log("\u2705 2D viewport initialized successfully (".concat(viewType, " view, key: ").concat(instanceKey || viewType, ")"));
38651
39217
  } else {
38652
39218
  console.warn("\u26A0\uFE0F Failed to initialize 2D viewport (".concat(viewType, " view)"));
38653
39219
  }
38654
- return _context7.a(2, success);
39220
+ return _context0.a(2, success);
38655
39221
  case 4:
38656
- _context7.p = 4;
38657
- _t2 = _context7.v;
39222
+ _context0.p = 4;
39223
+ _t2 = _context0.v;
38658
39224
  console.error('❌ initialize2DViewport(): Error initializing 2D viewport:', _t2);
38659
- return _context7.a(2, false);
39225
+ return _context0.a(2, false);
38660
39226
  }
38661
- }, _callee7, this, [[2, 4]]);
39227
+ }, _callee0, this, [[2, 4]]);
38662
39228
  }));
38663
39229
  function initialize2DViewport(_x5) {
38664
39230
  return _initialize2DViewport.apply(this, arguments);
@@ -38806,7 +39372,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38806
39372
  }, {
38807
39373
  key: "initializeModelPreloading",
38808
39374
  value: (function () {
38809
- var _initializeModelPreloading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
39375
+ var _initializeModelPreloading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
38810
39376
  var basePath,
38811
39377
  normalizedBasePath,
38812
39378
  dictionaryPath,
@@ -38815,13 +39381,13 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38815
39381
  componentDictionary,
38816
39382
  _modelPreloader2,
38817
39383
  progress,
38818
- _args8 = arguments,
39384
+ _args1 = arguments,
38819
39385
  _t3;
38820
- return _regenerator().w(function (_context8) {
38821
- while (1) switch (_context8.n) {
39386
+ return _regenerator().w(function (_context1) {
39387
+ while (1) switch (_context1.n) {
38822
39388
  case 0:
38823
- basePath = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : '/library/';
38824
- _context8.p = 1;
39389
+ basePath = _args1.length > 0 && _args1[0] !== undefined ? _args1[0] : '/library/';
39390
+ _context1.p = 1;
38825
39391
  // Ensure basePath ends with a slash
38826
39392
  normalizedBasePath = basePath.endsWith('/') ? basePath : "".concat(basePath, "/");
38827
39393
  dictionaryPath = "".concat(normalizedBasePath, "component-dictionary.json");
@@ -38832,39 +39398,39 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38832
39398
  console.log("\uFFFD Models path: ".concat(modelsBasePath));
38833
39399
 
38834
39400
  // Load the component dictionary
38835
- _context8.n = 2;
39401
+ _context1.n = 2;
38836
39402
  return fetch(dictionaryPath);
38837
39403
  case 2:
38838
- response = _context8.v;
39404
+ response = _context1.v;
38839
39405
  if (response.ok) {
38840
- _context8.n = 3;
39406
+ _context1.n = 3;
38841
39407
  break;
38842
39408
  }
38843
39409
  throw new Error("Failed to load component dictionary: ".concat(response.status));
38844
39410
  case 3:
38845
- _context8.n = 4;
39411
+ _context1.n = 4;
38846
39412
  return response.json();
38847
39413
  case 4:
38848
- componentDictionary = _context8.v;
39414
+ componentDictionary = _context1.v;
38849
39415
  console.log('📚 Component dictionary loaded:', Object.keys(componentDictionary));
38850
39416
 
38851
39417
  // Start preloading all models with the specified base path
38852
39418
  _modelPreloader2 = this.getUtility('modelPreloader');
38853
- _context8.n = 5;
39419
+ _context1.n = 5;
38854
39420
  return _modelPreloader2.preloadAllModels(componentDictionary, modelsBasePath);
38855
39421
  case 5:
38856
- progress = _context8.v;
39422
+ progress = _context1.v;
38857
39423
  console.log('🎉 Model preloading completed:', progress);
38858
- return _context8.a(2, progress);
39424
+ return _context1.a(2, progress);
38859
39425
  case 6:
38860
- _context8.p = 6;
38861
- _t3 = _context8.v;
39426
+ _context1.p = 6;
39427
+ _t3 = _context1.v;
38862
39428
  console.error('❌ Failed to initialize model preloading:', _t3);
38863
39429
  throw _t3;
38864
39430
  case 7:
38865
- return _context8.a(2);
39431
+ return _context1.a(2);
38866
39432
  }
38867
- }, _callee8, this, [[1, 6]]);
39433
+ }, _callee1, this, [[1, 6]]);
38868
39434
  }));
38869
39435
  function initializeModelPreloading() {
38870
39436
  return _initializeModelPreloading.apply(this, arguments);
@@ -38881,55 +39447,55 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38881
39447
  }, {
38882
39448
  key: "importScene",
38883
39449
  value: (function () {
38884
- var _importScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(jsonData) {
39450
+ var _importScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(jsonData) {
38885
39451
  var validation, _t4;
38886
- return _regenerator().w(function (_context9) {
38887
- while (1) switch (_context9.n) {
39452
+ return _regenerator().w(function (_context10) {
39453
+ while (1) switch (_context10.n) {
38888
39454
  case 0:
38889
39455
  if (jsonData) {
38890
- _context9.n = 1;
39456
+ _context10.n = 1;
38891
39457
  break;
38892
39458
  }
38893
39459
  console.error('❌ No JSON data provided for import');
38894
- return _context9.a(2, false);
39460
+ return _context10.a(2, false);
38895
39461
  case 1:
38896
- _context9.p = 1;
39462
+ _context10.p = 1;
38897
39463
  // Validate scene data structure
38898
39464
  validation = this.internals.validateAndAnalyzeSceneData(jsonData);
38899
39465
  if (validation.isValid) {
38900
- _context9.n = 2;
39466
+ _context10.n = 2;
38901
39467
  break;
38902
39468
  }
38903
39469
  console.error('❌ Invalid scene data format:', validation.message);
38904
- return _context9.a(2, false);
39470
+ return _context10.a(2, false);
38905
39471
  case 2:
38906
- _context9.n = 3;
39472
+ _context10.n = 3;
38907
39473
  return this.setImportedSceneData(jsonData);
38908
39474
  case 3:
38909
39475
  if (!(this.sceneViewer && this.sceneViewer.sceneOperationsManager)) {
38910
- _context9.n = 5;
39476
+ _context10.n = 5;
38911
39477
  break;
38912
39478
  }
38913
- _context9.n = 4;
39479
+ _context10.n = 4;
38914
39480
  return this.sceneViewer.sceneOperationsManager.loadSceneFromData(jsonData);
38915
39481
  case 4:
38916
39482
  console.log('✅ Scene imported successfully');
38917
- return _context9.a(2, true);
39483
+ return _context10.a(2, true);
38918
39484
  case 5:
38919
39485
  console.error('❌ SceneViewer not available for scene loading');
38920
- return _context9.a(2, false);
39486
+ return _context10.a(2, false);
38921
39487
  case 6:
38922
- _context9.n = 8;
39488
+ _context10.n = 8;
38923
39489
  break;
38924
39490
  case 7:
38925
- _context9.p = 7;
38926
- _t4 = _context9.v;
39491
+ _context10.p = 7;
39492
+ _t4 = _context10.v;
38927
39493
  console.error('❌ Error importing scene:', _t4);
38928
- return _context9.a(2, false);
39494
+ return _context10.a(2, false);
38929
39495
  case 8:
38930
- return _context9.a(2);
39496
+ return _context10.a(2);
38931
39497
  }
38932
- }, _callee9, this, [[1, 7]]);
39498
+ }, _callee10, this, [[1, 7]]);
38933
39499
  }));
38934
39500
  function importScene(_x6) {
38935
39501
  return _importScene.apply(this, arguments);
@@ -38953,33 +39519,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
38953
39519
  }, {
38954
39520
  key: "exportSceneJSON",
38955
39521
  value: (function () {
38956
- var _exportSceneJSON = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
39522
+ var _exportSceneJSON = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
38957
39523
  var filename,
38958
- _args0 = arguments,
39524
+ _args11 = arguments,
38959
39525
  _t5;
38960
- return _regenerator().w(function (_context0) {
38961
- while (1) switch (_context0.n) {
39526
+ return _regenerator().w(function (_context11) {
39527
+ while (1) switch (_context11.n) {
38962
39528
  case 0:
38963
- filename = _args0.length > 0 && _args0[0] !== undefined ? _args0[0] : null;
39529
+ filename = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : null;
38964
39530
  if (this.managers.sceneExportManager) {
38965
- _context0.n = 1;
39531
+ _context11.n = 1;
38966
39532
  break;
38967
39533
  }
38968
39534
  console.error('❌ Scene export manager not available');
38969
- return _context0.a(2, false);
39535
+ return _context11.a(2, false);
38970
39536
  case 1:
38971
- _context0.p = 1;
38972
- _context0.n = 2;
39537
+ _context11.p = 1;
39538
+ _context11.n = 2;
38973
39539
  return this.managers.sceneExportManager.downloadSceneJSON(filename);
38974
39540
  case 2:
38975
- return _context0.a(2, _context0.v);
39541
+ return _context11.a(2, _context11.v);
38976
39542
  case 3:
38977
- _context0.p = 3;
38978
- _t5 = _context0.v;
39543
+ _context11.p = 3;
39544
+ _t5 = _context11.v;
38979
39545
  console.error('❌ Error exporting scene as JSON:', _t5);
38980
- return _context0.a(2, false);
39546
+ return _context11.a(2, false);
38981
39547
  }
38982
- }, _callee0, this, [[1, 3]]);
39548
+ }, _callee11, this, [[1, 3]]);
38983
39549
  }));
38984
39550
  function exportSceneJSON() {
38985
39551
  return _exportSceneJSON.apply(this, arguments);
@@ -39004,33 +39570,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
39004
39570
  }, {
39005
39571
  key: "exportSceneGLTF",
39006
39572
  value: (function () {
39007
- var _exportSceneGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
39573
+ var _exportSceneGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
39008
39574
  var filename,
39009
- _args1 = arguments,
39575
+ _args12 = arguments,
39010
39576
  _t6;
39011
- return _regenerator().w(function (_context1) {
39012
- while (1) switch (_context1.n) {
39577
+ return _regenerator().w(function (_context12) {
39578
+ while (1) switch (_context12.n) {
39013
39579
  case 0:
39014
- filename = _args1.length > 0 && _args1[0] !== undefined ? _args1[0] : null;
39580
+ filename = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : null;
39015
39581
  if (this.managers.sceneExportManager) {
39016
- _context1.n = 1;
39582
+ _context12.n = 1;
39017
39583
  break;
39018
39584
  }
39019
39585
  console.error('❌ Scene export manager not available');
39020
- return _context1.a(2, false);
39586
+ return _context12.a(2, false);
39021
39587
  case 1:
39022
- _context1.p = 1;
39023
- _context1.n = 2;
39588
+ _context12.p = 1;
39589
+ _context12.n = 2;
39024
39590
  return this.managers.sceneExportManager.exportSceneAsGLTF(filename, false);
39025
39591
  case 2:
39026
- return _context1.a(2, _context1.v);
39592
+ return _context12.a(2, _context12.v);
39027
39593
  case 3:
39028
- _context1.p = 3;
39029
- _t6 = _context1.v;
39594
+ _context12.p = 3;
39595
+ _t6 = _context12.v;
39030
39596
  console.error('❌ Error exporting scene as GLTF:', _t6);
39031
- return _context1.a(2, false);
39597
+ return _context12.a(2, false);
39032
39598
  }
39033
- }, _callee1, this, [[1, 3]]);
39599
+ }, _callee12, this, [[1, 3]]);
39034
39600
  }));
39035
39601
  function exportSceneGLTF() {
39036
39602
  return _exportSceneGLTF.apply(this, arguments);
@@ -39056,33 +39622,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
39056
39622
  }, {
39057
39623
  key: "exportSceneGLB",
39058
39624
  value: (function () {
39059
- var _exportSceneGLB = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
39625
+ var _exportSceneGLB = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
39060
39626
  var filename,
39061
- _args10 = arguments,
39627
+ _args13 = arguments,
39062
39628
  _t7;
39063
- return _regenerator().w(function (_context10) {
39064
- while (1) switch (_context10.n) {
39629
+ return _regenerator().w(function (_context13) {
39630
+ while (1) switch (_context13.n) {
39065
39631
  case 0:
39066
- filename = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : null;
39632
+ filename = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : null;
39067
39633
  if (this.managers.sceneExportManager) {
39068
- _context10.n = 1;
39634
+ _context13.n = 1;
39069
39635
  break;
39070
39636
  }
39071
39637
  console.error('❌ Scene export manager not available');
39072
- return _context10.a(2, false);
39638
+ return _context13.a(2, false);
39073
39639
  case 1:
39074
- _context10.p = 1;
39075
- _context10.n = 2;
39640
+ _context13.p = 1;
39641
+ _context13.n = 2;
39076
39642
  return this.managers.sceneExportManager.exportSceneAsGLB(filename);
39077
39643
  case 2:
39078
- return _context10.a(2, _context10.v);
39644
+ return _context13.a(2, _context13.v);
39079
39645
  case 3:
39080
- _context10.p = 3;
39081
- _t7 = _context10.v;
39646
+ _context13.p = 3;
39647
+ _t7 = _context13.v;
39082
39648
  console.error('❌ Error exporting scene as GLB:', _t7);
39083
- return _context10.a(2, false);
39649
+ return _context13.a(2, false);
39084
39650
  }
39085
- }, _callee10, this, [[1, 3]]);
39651
+ }, _callee13, this, [[1, 3]]);
39086
39652
  }));
39087
39653
  function exportSceneGLB() {
39088
39654
  return _exportSceneGLB.apply(this, arguments);
@@ -39121,16 +39687,16 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
39121
39687
  }, {
39122
39688
  key: "loadSceneFromData",
39123
39689
  value: (function () {
39124
- var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(sceneData) {
39125
- return _regenerator().w(function (_context11) {
39126
- while (1) switch (_context11.n) {
39690
+ var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(sceneData) {
39691
+ return _regenerator().w(function (_context14) {
39692
+ while (1) switch (_context14.n) {
39127
39693
  case 0:
39128
- _context11.n = 1;
39694
+ _context14.n = 1;
39129
39695
  return this.setImportedSceneData(sceneData);
39130
39696
  case 1:
39131
- return _context11.a(2, true);
39697
+ return _context14.a(2, true);
39132
39698
  }
39133
- }, _callee11, this);
39699
+ }, _callee14, this);
39134
39700
  }));
39135
39701
  function loadSceneFromData(_x7) {
39136
39702
  return _loadSceneFromData.apply(this, arguments);