@2112-lab/central-plant 0.1.39 → 0.1.41

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.
Files changed (45) hide show
  1. package/dist/bundle/index.js +7991 -7054
  2. package/dist/cjs/src/core/centralPlant.js +48 -3
  3. package/dist/cjs/src/core/centralPlantInternals.js +75 -566
  4. package/dist/cjs/src/core/sceneViewer.js +38 -13
  5. package/dist/cjs/src/index.js +6 -4
  6. package/dist/cjs/src/managers/components/pathfindingManager.js +75 -60
  7. package/dist/cjs/src/managers/components/transformOperationsManager.js +929 -0
  8. package/dist/cjs/src/managers/controls/keyboardControlsManager.js +57 -1
  9. package/dist/cjs/src/managers/controls/transformControls.js +11 -3
  10. package/dist/cjs/src/managers/controls/transformControlsManager.js +563 -263
  11. package/dist/cjs/src/managers/pathfinding/ConnectorManager.js +385 -0
  12. package/dist/cjs/src/managers/pathfinding/PathIntersectionDetector.js +387 -0
  13. package/dist/cjs/src/managers/pathfinding/PathRenderingManager.js +401 -0
  14. package/dist/cjs/src/managers/pathfinding/pathfindingManager.js +378 -0
  15. package/dist/cjs/src/managers/pathfinding/sceneDataManager.js +256 -0
  16. package/dist/cjs/src/managers/scene/animationManager.js +145 -0
  17. package/dist/cjs/src/managers/scene/sceneExportManager.js +14 -13
  18. package/dist/cjs/src/managers/scene/sceneOperationsManager.js +516 -21
  19. package/dist/cjs/src/managers/scene/sceneTooltipsManager.js +1 -8
  20. package/dist/cjs/src/managers/system/operationHistoryManager.js +414 -0
  21. package/dist/cjs/src/managers/system/settingsManager.js +2 -1
  22. package/dist/cjs/src/utils/objectTypes.js +5 -7
  23. package/dist/esm/src/core/centralPlant.js +48 -3
  24. package/dist/esm/src/core/centralPlantInternals.js +76 -567
  25. package/dist/esm/src/core/sceneViewer.js +38 -13
  26. package/dist/esm/src/index.js +4 -3
  27. package/dist/esm/src/managers/components/pathfindingManager.js +75 -60
  28. package/dist/esm/src/managers/components/transformOperationsManager.js +904 -0
  29. package/dist/esm/src/managers/controls/keyboardControlsManager.js +57 -1
  30. package/dist/esm/src/managers/controls/transformControls.js +11 -3
  31. package/dist/esm/src/managers/controls/transformControlsManager.js +564 -264
  32. package/dist/esm/src/managers/pathfinding/ConnectorManager.js +361 -0
  33. package/dist/esm/src/managers/pathfinding/PathIntersectionDetector.js +363 -0
  34. package/dist/esm/src/managers/pathfinding/PathRenderingManager.js +377 -0
  35. package/dist/esm/src/managers/pathfinding/pathfindingManager.js +374 -0
  36. package/dist/esm/src/managers/pathfinding/sceneDataManager.js +232 -0
  37. package/dist/esm/src/managers/scene/animationManager.js +141 -0
  38. package/dist/esm/src/managers/scene/sceneExportManager.js +14 -13
  39. package/dist/esm/src/managers/scene/sceneOperationsManager.js +516 -21
  40. package/dist/esm/src/managers/scene/sceneTooltipsManager.js +1 -8
  41. package/dist/esm/src/managers/system/operationHistoryManager.js +409 -0
  42. package/dist/esm/src/managers/system/settingsManager.js +2 -1
  43. package/dist/esm/src/utils/objectTypes.js +5 -7
  44. package/dist/index.d.ts +2 -2
  45. package/package.json +1 -1
@@ -0,0 +1,414 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
6
+ var baseDisposable = require('../../core/baseDisposable.js');
7
+
8
+ /**
9
+ * OperationHistoryManager handles operation history with sessionStorage persistence
10
+ */
11
+ var OperationHistoryManager = /*#__PURE__*/function (_BaseDisposable) {
12
+ function OperationHistoryManager(sceneViewer) {
13
+ var _this;
14
+ _rollupPluginBabelHelpers.classCallCheck(this, OperationHistoryManager);
15
+ _this = _rollupPluginBabelHelpers.callSuper(this, OperationHistoryManager);
16
+ _this.sceneViewer = sceneViewer;
17
+ _this.storageKey = 'centralPlant_history';
18
+ _this.maxHistorySize = 10; // Limit history to prevent storage overflow
19
+
20
+ // Register this manager with the sceneViewer (using 'operationHistory' for consistency)
21
+ if (_this.sceneViewer && _this.sceneViewer.managers) {
22
+ _this.sceneViewer.managers.operationHistory = _this;
23
+ }
24
+ console.log('📜 OperationHistoryManager initialized');
25
+ return _this;
26
+ }
27
+
28
+ /**
29
+ * Check if sessionStorage is available
30
+ * @returns {boolean} True if sessionStorage is available
31
+ * @private
32
+ */
33
+ _rollupPluginBabelHelpers.inherits(OperationHistoryManager, _BaseDisposable);
34
+ return _rollupPluginBabelHelpers.createClass(OperationHistoryManager, [{
35
+ key: "_isSessionStorageAvailable",
36
+ value: function _isSessionStorageAvailable() {
37
+ try {
38
+ return typeof sessionStorage !== 'undefined';
39
+ } catch (error) {
40
+ return false;
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Add an operation to the history
46
+ * @param {string} operationName - Name of operation ('translateComponent', 'translateSegment', 'translateGateway', etc.)
47
+ * @param {Object} params - Operation parameters (segmentId/componentId/gatewayId, axis, value, etc.)
48
+ * @returns {boolean} True if operation was stored successfully, false otherwise
49
+ */
50
+ }, {
51
+ key: "addToOperationHistory",
52
+ value: function addToOperationHistory(operationName, params) {
53
+ try {
54
+ if (!this._isSessionStorageAvailable()) {
55
+ console.warn('⚠️ sessionStorage not available, cannot store operation history');
56
+ return false;
57
+ }
58
+
59
+ // Get existing history
60
+ var history = [];
61
+ var stored = sessionStorage.getItem(this.storageKey);
62
+ if (stored) {
63
+ history = JSON.parse(stored);
64
+ }
65
+
66
+ // Create new operation entry
67
+ var operationEntry = {
68
+ operationName: operationName,
69
+ timestamp: new Date().toISOString(),
70
+ params: params
71
+ };
72
+
73
+ // Add to history (newest first)
74
+ history.unshift(operationEntry);
75
+
76
+ // Trim history if too large
77
+ if (history.length > this.maxHistorySize) {
78
+ history = history.slice(0, this.maxHistorySize);
79
+ }
80
+
81
+ // Save back to sessionStorage
82
+ sessionStorage.setItem(this.storageKey, JSON.stringify(history));
83
+ console.log("\uD83D\uDCBE Operation stored to sessionStorage:", operationEntry);
84
+ return true;
85
+ } catch (error) {
86
+ console.error('❌ Error storing operation to sessionStorage:', error);
87
+ return false;
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Get operation history from sessionStorage
93
+ * @param {Object} options - Filter options
94
+ * @param {string} [options.operationName] - Filter by operation name
95
+ * @param {number} [options.limit] - Limit number of results
96
+ * @returns {Array} Array of operation entries
97
+ */
98
+ }, {
99
+ key: "getOperationHistory",
100
+ value: function getOperationHistory() {
101
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
102
+ try {
103
+ if (!this._isSessionStorageAvailable()) {
104
+ console.warn('⚠️ sessionStorage not available');
105
+ return [];
106
+ }
107
+ var stored = sessionStorage.getItem(this.storageKey);
108
+ if (!stored) {
109
+ return [];
110
+ }
111
+ var history = JSON.parse(stored);
112
+
113
+ // Filter by operation name if specified
114
+ if (options.operationName) {
115
+ history = history.filter(function (entry) {
116
+ return entry.operationName === options.operationName;
117
+ });
118
+ }
119
+
120
+ // Limit results if specified
121
+ if (options.limit && options.limit > 0) {
122
+ history = history.slice(0, options.limit);
123
+ }
124
+ return history;
125
+ } catch (error) {
126
+ console.error('❌ Error reading operation history:', error);
127
+ return [];
128
+ }
129
+ }
130
+
131
+ /**
132
+ * Clear operation history from sessionStorage
133
+ * @returns {boolean} True if history was cleared successfully, false otherwise
134
+ */
135
+ }, {
136
+ key: "clearOperationHistory",
137
+ value: function clearOperationHistory() {
138
+ try {
139
+ if (!this._isSessionStorageAvailable()) {
140
+ console.warn('⚠️ sessionStorage not available');
141
+ return false;
142
+ }
143
+ sessionStorage.removeItem(this.storageKey);
144
+ console.log('🗑️ Operation history cleared from sessionStorage');
145
+ return true;
146
+ } catch (error) {
147
+ console.error('❌ Error clearing operation history:', error);
148
+ return false;
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Get the most recent operation
154
+ * @returns {Object|null} The most recent operation entry or null if none exists
155
+ */
156
+ }, {
157
+ key: "getLastOperation",
158
+ value: function getLastOperation() {
159
+ var history = this.getOperationHistory({
160
+ limit: 1
161
+ });
162
+ return history.length > 0 ? history[0] : null;
163
+ }
164
+
165
+ /**
166
+ * Undo the most recent operation and remove it from history
167
+ * @returns {boolean} True if undo was successful, false otherwise
168
+ */
169
+ }, {
170
+ key: "undoLastOperation",
171
+ value: function undoLastOperation() {
172
+ try {
173
+ // Get the last operation
174
+ var lastOp = this.getLastOperation();
175
+ if (!lastOp) {
176
+ console.warn('⚠️ No operation to undo');
177
+ return false;
178
+ }
179
+ console.log('⏪ Undoing last operation:', lastOp);
180
+
181
+ // Execute the reverse operation based on operation type
182
+ var undoSuccess = false;
183
+ switch (lastOp.operationName) {
184
+ case 'translateSegment':
185
+ undoSuccess = this._undoTranslateSegment(lastOp.params);
186
+ break;
187
+ case 'translateComponent':
188
+ undoSuccess = this._undoTranslateComponent(lastOp.params);
189
+ break;
190
+ case 'translateGateway':
191
+ undoSuccess = this._undoTranslateGateway(lastOp.params);
192
+ break;
193
+ default:
194
+ console.warn("\u26A0\uFE0F Unknown operation type: ".concat(lastOp.operationName));
195
+ return false;
196
+ }
197
+ if (undoSuccess) {
198
+ // Remove the operation from history
199
+ this._removeLastOperationFromHistory();
200
+ console.log('✅ Undo successful');
201
+ return true;
202
+ } else {
203
+ console.error('❌ Undo failed');
204
+ return false;
205
+ }
206
+ } catch (error) {
207
+ console.error('❌ Error during undo:', error);
208
+ return false;
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Undo a translateSegment operation
214
+ * @param {Object} params - Original operation parameters
215
+ * @returns {boolean} Success status
216
+ * @private
217
+ */
218
+ }, {
219
+ key: "_undoTranslateSegment",
220
+ value: function _undoTranslateSegment(params) {
221
+ var _this$sceneViewer, _centralPlant$manager;
222
+ var segmentId = params.segmentId,
223
+ axis = params.axis,
224
+ value = params.value;
225
+
226
+ // Access centralPlant through sceneViewer
227
+ var centralPlant = (_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 ? void 0 : _this$sceneViewer.centralPlant;
228
+ if (!centralPlant || !centralPlant.translateSegment) {
229
+ console.error('❌ CentralPlant translateSegment API not available for undo');
230
+ return false;
231
+ }
232
+
233
+ // Reverse the translation by applying negative value
234
+ // Note: We temporarily disable history tracking to avoid creating a new history entry
235
+ var historyManager = (_centralPlant$manager = centralPlant.managers) === null || _centralPlant$manager === void 0 ? void 0 : _centralPlant$manager.operationHistoryManager;
236
+ var originalAddMethod = historyManager === null || historyManager === void 0 ? void 0 : historyManager.addToOperationHistory;
237
+
238
+ // Disable history tracking during undo
239
+ if (historyManager) {
240
+ historyManager.addToOperationHistory = function () {
241
+ return true;
242
+ };
243
+ }
244
+ var success = centralPlant.translateSegment(segmentId, axis, -value);
245
+
246
+ // Restore history tracking
247
+ if (historyManager && originalAddMethod) {
248
+ historyManager.addToOperationHistory = originalAddMethod;
249
+ }
250
+ return success;
251
+ }
252
+
253
+ /**
254
+ * Undo a translateComponent operation
255
+ * @param {Object} params - Original operation parameters
256
+ * @returns {boolean} Success status
257
+ * @private
258
+ */
259
+ }, {
260
+ key: "_undoTranslateComponent",
261
+ value: function _undoTranslateComponent(params) {
262
+ var _this$sceneViewer2, _centralPlant$manager2;
263
+ var componentId = params.componentId,
264
+ axis = params.axis,
265
+ value = params.value;
266
+ var centralPlant = (_this$sceneViewer2 = this.sceneViewer) === null || _this$sceneViewer2 === void 0 ? void 0 : _this$sceneViewer2.centralPlant;
267
+ if (!centralPlant || !centralPlant.translateComponent) {
268
+ console.error('❌ CentralPlant translateComponent API not available for undo');
269
+ return false;
270
+ }
271
+
272
+ // Temporarily disable history tracking
273
+ var historyManager = (_centralPlant$manager2 = centralPlant.managers) === null || _centralPlant$manager2 === void 0 ? void 0 : _centralPlant$manager2.operationHistoryManager;
274
+ var originalAddMethod = historyManager === null || historyManager === void 0 ? void 0 : historyManager.addToOperationHistory;
275
+ if (historyManager) {
276
+ historyManager.addToOperationHistory = function () {
277
+ return true;
278
+ };
279
+ }
280
+ var success = centralPlant.translateComponent(componentId, axis, -value);
281
+ if (historyManager && originalAddMethod) {
282
+ historyManager.addToOperationHistory = originalAddMethod;
283
+ }
284
+ return success;
285
+ }
286
+
287
+ /**
288
+ * Undo a translateGateway operation
289
+ * @param {Object} params - Original operation parameters
290
+ * @returns {boolean} Success status
291
+ * @private
292
+ */
293
+ }, {
294
+ key: "_undoTranslateGateway",
295
+ value: function _undoTranslateGateway(params) {
296
+ var _this$sceneViewer3, _centralPlant$manager3;
297
+ var gatewayId = params.gatewayId,
298
+ axis = params.axis,
299
+ value = params.value;
300
+ var centralPlant = (_this$sceneViewer3 = this.sceneViewer) === null || _this$sceneViewer3 === void 0 ? void 0 : _this$sceneViewer3.centralPlant;
301
+ if (!centralPlant || !centralPlant.translateGateway) {
302
+ console.error('❌ CentralPlant translateGateway API not available for undo');
303
+ return false;
304
+ }
305
+
306
+ // Temporarily disable history tracking
307
+ var historyManager = (_centralPlant$manager3 = centralPlant.managers) === null || _centralPlant$manager3 === void 0 ? void 0 : _centralPlant$manager3.operationHistoryManager;
308
+ var originalAddMethod = historyManager === null || historyManager === void 0 ? void 0 : historyManager.addToOperationHistory;
309
+ if (historyManager) {
310
+ historyManager.addToOperationHistory = function () {
311
+ return true;
312
+ };
313
+ }
314
+ var success = centralPlant.translateGateway(gatewayId, axis, -value);
315
+ if (historyManager && originalAddMethod) {
316
+ historyManager.addToOperationHistory = originalAddMethod;
317
+ }
318
+ return success;
319
+ }
320
+
321
+ /**
322
+ * Remove the most recent operation from history
323
+ * @returns {boolean} Success status
324
+ * @private
325
+ */
326
+ }, {
327
+ key: "_removeLastOperationFromHistory",
328
+ value: function _removeLastOperationFromHistory() {
329
+ try {
330
+ if (!this._isSessionStorageAvailable()) {
331
+ return false;
332
+ }
333
+ var stored = sessionStorage.getItem(this.storageKey);
334
+ if (!stored) {
335
+ return false;
336
+ }
337
+ var history = JSON.parse(stored);
338
+
339
+ // Remove first item (most recent)
340
+ if (history.length > 0) {
341
+ history.shift();
342
+ sessionStorage.setItem(this.storageKey, JSON.stringify(history));
343
+ console.log('🗑️ Removed last operation from history');
344
+ return true;
345
+ }
346
+ return false;
347
+ } catch (error) {
348
+ console.error('❌ Error removing last operation from history:', error);
349
+ return false;
350
+ }
351
+ }
352
+
353
+ /**
354
+ * Get operation history count
355
+ * @returns {number} Number of operations in history
356
+ */
357
+ }, {
358
+ key: "getHistoryCount",
359
+ value: function getHistoryCount() {
360
+ var history = this.getOperationHistory();
361
+ return history.length;
362
+ }
363
+
364
+ /**
365
+ * Set the maximum history size
366
+ * @param {number} size - Maximum number of operations to store
367
+ */
368
+ }, {
369
+ key: "setMaxHistorySize",
370
+ value: function setMaxHistorySize(size) {
371
+ if (typeof size !== 'number' || size < 1) {
372
+ console.warn('⚠️ Invalid max history size, must be a positive number');
373
+ return;
374
+ }
375
+ this.maxHistorySize = size;
376
+ console.log("\uD83D\uDCCF Max history size set to ".concat(size));
377
+
378
+ // Trim existing history if needed
379
+ try {
380
+ if (this._isSessionStorageAvailable()) {
381
+ var stored = sessionStorage.getItem(this.storageKey);
382
+ if (stored) {
383
+ var history = JSON.parse(stored);
384
+ if (history.length > size) {
385
+ history = history.slice(0, size);
386
+ sessionStorage.setItem(this.storageKey, JSON.stringify(history));
387
+ console.log("\u2702\uFE0F Trimmed history to ".concat(size, " entries"));
388
+ }
389
+ }
390
+ }
391
+ } catch (error) {
392
+ console.error('❌ Error trimming history:', error);
393
+ }
394
+ }
395
+
396
+ /**
397
+ * Dispose method - clean up resources
398
+ * @override
399
+ */
400
+ }, {
401
+ key: "dispose",
402
+ value: function dispose() {
403
+ // Clear any references
404
+ this.sceneViewer = null;
405
+
406
+ // Call parent dispose
407
+ _rollupPluginBabelHelpers.superPropGet(OperationHistoryManager, "dispose", this, 3)([]);
408
+ console.log('🗑️ OperationHistoryManager disposed');
409
+ }
410
+ }]);
411
+ }(baseDisposable.BaseDisposable);
412
+
413
+ exports.OperationHistoryManager = OperationHistoryManager;
414
+ exports["default"] = OperationHistoryManager;
@@ -11,7 +11,8 @@ var baseDisposable = require('../../core/baseDisposable.js');
11
11
  var DEFAULT_SETTINGS = {
12
12
  scene: {
13
13
  autoRotation: false,
14
- checkUnderground: true
14
+ checkUnderground: true,
15
+ splitSegmentsWithComponentConnectors: true
15
16
  },
16
17
  viewport: {
17
18
  perspectiveFullscreen: true
@@ -21,7 +21,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
21
21
  */
22
22
  function isComponent(obj) {
23
23
  if (!obj || !obj.userData) return false;
24
- return obj.userData.objectType === 'component' || obj.userData.objectType !== undefined;
24
+ return obj.userData.objectType === 'component';
25
25
  }
26
26
 
27
27
  /**
@@ -37,7 +37,7 @@ function isComponent(obj) {
37
37
  */
38
38
  function isSegment(obj) {
39
39
  if (!obj || !obj.userData) return false;
40
- return obj.userData.objectType === 'segment' || obj.userData.isPipeSegment === true;
40
+ return obj.userData.objectType === 'segment';
41
41
  }
42
42
 
43
43
  /**
@@ -53,7 +53,7 @@ function isSegment(obj) {
53
53
  */
54
54
  function isGateway(obj) {
55
55
  if (!obj || !obj.userData) return false;
56
- return obj.userData.objectType === 'gateway' || obj.userData.objectType === 'gateway';
56
+ return obj.userData.objectType === 'gateway';
57
57
  }
58
58
 
59
59
  /**
@@ -73,7 +73,7 @@ function isConnector(obj) {
73
73
  }
74
74
 
75
75
  /**
76
- * Check if object was declared (from scene definition or manually edited)
76
+ * Check if object is declared (manually placed/positioned)
77
77
  * Declared objects should be preserved during regeneration.
78
78
  *
79
79
  * @param {Object} obj - Three.js object to check
@@ -86,7 +86,7 @@ function isConnector(obj) {
86
86
  */
87
87
  function isDeclared(obj) {
88
88
  if (!obj || !obj.userData) return false;
89
- return obj.userData.isDeclared === true || obj.userData.origin === 'declared';
89
+ return obj.userData.isDeclared === true;
90
90
  }
91
91
 
92
92
  /**
@@ -198,7 +198,6 @@ function getObjectTypeName(obj) {
198
198
  function markAsDeclared(obj) {
199
199
  if (obj && obj.userData) {
200
200
  obj.userData.isDeclared = true;
201
- obj.userData.origin = 'declared'; // Backward compatibility
202
201
  }
203
202
  }
204
203
 
@@ -215,7 +214,6 @@ function markAsDeclared(obj) {
215
214
  function markAsComputed(obj) {
216
215
  if (obj && obj.userData) {
217
216
  obj.userData.isDeclared = false;
218
- obj.userData.origin = 'computed'; // Backward compatibility
219
217
  }
220
218
  }
221
219
 
@@ -15,7 +15,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
15
15
  * Initialize the CentralPlant manager
16
16
  *
17
17
  * @constructor
18
- * @version 0.1.39
18
+ * @version 0.1.41
19
19
  * @updated 2025-10-22
20
20
  *
21
21
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -311,6 +311,51 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
311
311
  return this.internals.translateGateway(gatewayId, axis, value);
312
312
  }
313
313
 
314
+ /**
315
+ * Split a pipe segment in half at its midpoint
316
+ * @param {string} segmentId - The UUID of the segment to split
317
+ * @returns {Object|null} Object with {segment1, segment2} or null on failure
318
+ * @description Splits a selected pipe segment into two equal halves at its midpoint.
319
+ * Each resulting segment is automatically manualized (converted to manual/declared status).
320
+ * The original segment is removed and replaced with two new segments that maintain
321
+ * the same orientation and material properties. Paths are regenerated after splitting
322
+ * to ensure proper connections.
323
+ * @example
324
+ * // Split a segment when selected via transform controls
325
+ * const result = centralPlant.splitSegment('Segment-12345');
326
+ * if (result) {
327
+ * console.log('Segment split into:', result.segment1.uuid, result.segment2.uuid);
328
+ * }
329
+ *
330
+ * @since 0.1.37
331
+ */
332
+ }, {
333
+ key: "splitSegment",
334
+ value: function splitSegment(segmentId) {
335
+ var _this$sceneViewer$man;
336
+ if (!this.sceneViewer || !((_this$sceneViewer$man = this.sceneViewer.managers) !== null && _this$sceneViewer$man !== void 0 && _this$sceneViewer$man.sceneOperationsManager)) {
337
+ console.warn('⚠️ splitSegment(): Scene viewer or scene operations manager not available');
338
+ return null;
339
+ }
340
+ if (!segmentId) {
341
+ console.error('❌ splitSegment(): No segment ID provided');
342
+ return null;
343
+ }
344
+ try {
345
+ var result = this.sceneViewer.managers.sceneOperationsManager.splitSegment(segmentId, this.sceneViewer.currentSceneData);
346
+ if (result) {
347
+ console.log('✅ splitSegment(): Segment split successfully');
348
+ return result;
349
+ } else {
350
+ console.warn('⚠️ splitSegment(): Split operation returned null');
351
+ return null;
352
+ }
353
+ } catch (error) {
354
+ console.error('❌ splitSegment(): Error splitting segment:', error);
355
+ return null;
356
+ }
357
+ }
358
+
314
359
  /**
315
360
  * Rotate a component by componentId
316
361
  * @param {string} componentId - The UUID of the component to rotate
@@ -1592,8 +1637,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1592
1637
  }, {
1593
1638
  key: "generatePath",
1594
1639
  value: function generatePath(fromConnectorId, toConnectorId) {
1595
- var _this$sceneViewer$man;
1596
- if (!this.sceneViewer || !((_this$sceneViewer$man = this.sceneViewer.managers) !== null && _this$sceneViewer$man !== void 0 && _this$sceneViewer$man.pathfinding)) {
1640
+ var _this$sceneViewer$man2;
1641
+ if (!this.sceneViewer || !((_this$sceneViewer$man2 = this.sceneViewer.managers) !== null && _this$sceneViewer$man2 !== void 0 && _this$sceneViewer$man2.pathfinding)) {
1597
1642
  return null;
1598
1643
  }
1599
1644
  try {