@2112-lab/central-plant 0.1.0 → 0.1.1

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 (39) hide show
  1. package/dist/bundle/index.js +1487 -606
  2. package/dist/cjs/src/ConnectionManager.js +7 -7
  3. package/dist/cjs/src/Pathfinder.js +11 -11
  4. package/dist/cjs/src/animationManager.js +15 -15
  5. package/dist/cjs/src/componentManager.js +8 -8
  6. package/dist/cjs/src/disposalManager.js +12 -12
  7. package/dist/cjs/src/environmentManager.js +392 -99
  8. package/dist/cjs/src/hotReloadManager.js +26 -26
  9. package/dist/cjs/src/index.js +54 -52
  10. package/dist/cjs/src/keyboardControlsManager.js +23 -23
  11. package/dist/cjs/src/modelPreloader.js +166 -38
  12. package/dist/cjs/src/nameUtils.js +21 -21
  13. package/dist/cjs/src/pathfindingManager.js +16 -16
  14. package/dist/cjs/src/performanceMonitor.js +52 -52
  15. package/dist/cjs/src/sceneExportManager.js +23 -23
  16. package/dist/cjs/src/sceneInitializationManager.js +18 -18
  17. package/dist/cjs/src/sceneOperationsManager.js +95 -59
  18. package/dist/cjs/src/textureConfig.js +469 -40
  19. package/dist/cjs/src/transformControlsManager.js +79 -79
  20. package/dist/esm/src/ConnectionManager.js +7 -7
  21. package/dist/esm/src/Pathfinder.js +11 -11
  22. package/dist/esm/src/animationManager.js +15 -15
  23. package/dist/esm/src/componentManager.js +8 -8
  24. package/dist/esm/src/disposalManager.js +12 -12
  25. package/dist/esm/src/environmentManager.js +393 -100
  26. package/dist/esm/src/hotReloadManager.js +26 -26
  27. package/dist/esm/src/index.js +54 -53
  28. package/dist/esm/src/keyboardControlsManager.js +23 -23
  29. package/dist/esm/src/modelPreloader.js +165 -38
  30. package/dist/esm/src/nameUtils.js +21 -21
  31. package/dist/esm/src/pathfindingManager.js +16 -16
  32. package/dist/esm/src/performanceMonitor.js +52 -52
  33. package/dist/esm/src/sceneExportManager.js +23 -23
  34. package/dist/esm/src/sceneInitializationManager.js +18 -18
  35. package/dist/esm/src/sceneOperationsManager.js +95 -59
  36. package/dist/esm/src/textureConfig.js +469 -42
  37. package/dist/esm/src/transformControlsManager.js +79 -79
  38. package/dist/index.d.ts +259 -259
  39. package/package.json +52 -53
@@ -528,17 +528,17 @@ var debugLogger = /*#__PURE__*/Object.freeze({
528
528
  materialLogger: materialLogger
529
529
  });
530
530
 
531
- /**
532
- * Animation Manager
533
- * Handles animation loops and timing
531
+ /**
532
+ * Animation Manager
533
+ * Handles animation loops and timing
534
534
  */
535
535
  var animationFrameId = null;
536
536
  var isAnimating = false;
537
537
  var lastTime = 0;
538
538
  var callbacks = [];
539
539
 
540
- /**
541
- * Start the animation loop
540
+ /**
541
+ * Start the animation loop
542
542
  */
543
543
  function startAnimation(component) {
544
544
  if (isAnimating) return;
@@ -573,8 +573,8 @@ function startAnimation(component) {
573
573
  logger.info('Animation loop started');
574
574
  }
575
575
 
576
- /**
577
- * Stop the animation loop
576
+ /**
577
+ * Stop the animation loop
578
578
  */
579
579
  function stopAnimation() {
580
580
  if (!isAnimating) return;
@@ -586,8 +586,8 @@ function stopAnimation() {
586
586
  logger.info('Animation loop stopped');
587
587
  }
588
588
 
589
- /**
590
- * Register an animation callback
589
+ /**
590
+ * Register an animation callback
591
591
  */
592
592
  function addAnimationCallback(callback) {
593
593
  if (typeof callback !== 'function') {
@@ -598,8 +598,8 @@ function addAnimationCallback(callback) {
598
598
  return callback;
599
599
  }
600
600
 
601
- /**
602
- * Remove an animation callback
601
+ /**
602
+ * Remove an animation callback
603
603
  */
604
604
  function removeAnimationCallback(callback) {
605
605
  var index = callbacks.indexOf(callback);
@@ -610,8 +610,8 @@ function removeAnimationCallback(callback) {
610
610
  return false;
611
611
  }
612
612
 
613
- /**
614
- * Execute all registered animation callbacks
613
+ /**
614
+ * Execute all registered animation callbacks
615
615
  */
616
616
  function executeCallbacks(time, deltaTime) {
617
617
  callbacks.forEach(function (callback) {
@@ -623,8 +623,8 @@ function executeCallbacks(time, deltaTime) {
623
623
  });
624
624
  }
625
625
 
626
- /**
627
- * Check if animation is running
626
+ /**
627
+ * Check if animation is running
628
628
  */
629
629
  function isAnimationRunning() {
630
630
  return isAnimating;
@@ -647,15 +647,15 @@ var animationManager$1 = /*#__PURE__*/Object.freeze({
647
647
  'default': animationManager
648
648
  });
649
649
 
650
- /**
651
- * Load a component from data
650
+ /**
651
+ * Load a component from data
652
652
  */
653
653
  function loadComponent(_x) {
654
654
  return _loadComponent.apply(this, arguments);
655
655
  }
656
656
 
657
- /**
658
- * Place a component in the scene
657
+ /**
658
+ * Place a component in the scene
659
659
  */
660
660
  function _loadComponent() {
661
661
  _loadComponent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(componentData) {
@@ -716,8 +716,8 @@ function placeComponent(component, position, rotation, scene) {
716
716
  return component;
717
717
  }
718
718
 
719
- /**
720
- * Remove a component from the scene
719
+ /**
720
+ * Remove a component from the scene
721
721
  */
722
722
  function removeComponent(componentId, scene) {
723
723
  if (!scene) {
@@ -742,8 +742,8 @@ function removeComponent(componentId, scene) {
742
742
  }
743
743
  }
744
744
 
745
- /**
746
- * Get a component by ID
745
+ /**
746
+ * Get a component by ID
747
747
  */
748
748
  function getComponentById(id, scene) {
749
749
  if (!scene) {
@@ -774,8 +774,8 @@ var componentManager$1 = /*#__PURE__*/Object.freeze({
774
774
  'default': componentManager
775
775
  });
776
776
 
777
- /**
778
- * Dispose a Three.js object including geometry, material, and textures
777
+ /**
778
+ * Dispose a Three.js object including geometry, material, and textures
779
779
  */
780
780
  function disposeObject(object) {
781
781
  if (!object) return;
@@ -806,8 +806,8 @@ function disposeObject(object) {
806
806
  }
807
807
  }
808
808
 
809
- /**
810
- * Dispose a Three.js material and its textures
809
+ /**
810
+ * Dispose a Three.js material and its textures
811
811
  */
812
812
  function disposeMaterial(material) {
813
813
  if (!material) return;
@@ -824,8 +824,8 @@ function disposeMaterial(material) {
824
824
  material.dispose();
825
825
  }
826
826
 
827
- /**
828
- * Clean up a Three.js scene
827
+ /**
828
+ * Clean up a Three.js scene
829
829
  */
830
830
  function cleanupScene(scene) {
831
831
  if (!scene) {
@@ -842,8 +842,8 @@ function cleanupScene(scene) {
842
842
  logger.info('Scene cleared and disposed');
843
843
  }
844
844
 
845
- /**
846
- * Clean up a Three.js renderer
845
+ /**
846
+ * Clean up a Three.js renderer
847
847
  */
848
848
  function cleanupRenderer(renderer) {
849
849
  if (!renderer) {
@@ -860,8 +860,8 @@ function cleanupRenderer(renderer) {
860
860
  logger.info('Renderer disposed');
861
861
  }
862
862
 
863
- /**
864
- * Clean up Nuxt-specific event listeners
863
+ /**
864
+ * Clean up Nuxt-specific event listeners
865
865
  */
866
866
  function cleanupNuxtEventListeners() {
867
867
  if (typeof window === 'undefined' || !window.$nuxt) {
@@ -876,8 +876,8 @@ function cleanupNuxtEventListeners() {
876
876
  }
877
877
  }
878
878
 
879
- /**
880
- * Comprehensive cleanup of Three.js resources
879
+ /**
880
+ * Comprehensive cleanup of Three.js resources
881
881
  */
882
882
  function cleanupThreeJsResources(component) {
883
883
  if (!component) return;
@@ -938,6 +938,47 @@ var disposalManager$1 = /*#__PURE__*/Object.freeze({
938
938
  // We'll need to import RGBELoader from three examples
939
939
  var RGBELoader$2;
940
940
 
941
+ /**
942
+ * Helper function to get asset paths that works in both bundled and modular contexts
943
+ * @param {string} assetPath - Relative path from the assets directory
944
+ * @returns {string} - The full path to the asset
945
+ */
946
+ function getAssetPath$1(assetPath) {
947
+ // Strip leading slash if present
948
+ if (assetPath.startsWith('/')) {
949
+ assetPath = assetPath.substring(1);
950
+ }
951
+
952
+ // In browser context, check for different module formats
953
+ if (typeof window !== 'undefined') {
954
+ // For bundled version, assets should be in dist/bundle/assets/
955
+ // For ESM/CJS, assets should be in their respective folders
956
+
957
+ // Try to determine if we're using the bundled version or ESM/CJS
958
+ var isBundled = typeof CentralPlantUtils !== 'undefined';
959
+
960
+ // Check if we're running in a Nuxt.js environment (localhost:3000 is a common dev server)
961
+ var isNuxtEnv = window.location.hostname === 'localhost' && (window.location.port === '3000' || window.location.port === '3001');
962
+ if (isNuxtEnv) {
963
+ // In Nuxt.js environment, assets are likely in the /static directory at the root
964
+ return "/".concat(assetPath); // No /assets/ prefix in the URL path
965
+ } else if (isBundled) {
966
+ // Get the base URL for the module
967
+ var baseUrl = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('index.js', document.baseURI).href));
968
+ // In bundled format, assets are in the assets folder next to the bundle
969
+ return new URL("./assets/".concat(assetPath), baseUrl).href;
970
+ } else {
971
+ // Get the base URL for the module
972
+ var _baseUrl = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('index.js', document.baseURI).href));
973
+ // In ESM/CJS format, need to go up relative to current module path
974
+ return new URL("../assets/".concat(assetPath), _baseUrl).href;
975
+ }
976
+ }
977
+
978
+ // In Node.js context
979
+ return "assets/".concat(assetPath);
980
+ }
981
+
941
982
  // Dynamic import for browser compatibility
942
983
  function importThreeLoaders() {
943
984
  return _importThreeLoaders.apply(this, arguments);
@@ -974,13 +1015,17 @@ function _importThreeLoaders() {
974
1015
  }));
975
1016
  return _importThreeLoaders.apply(this, arguments);
976
1017
  }
977
- var loadTextureSetAndCreateMaterial$1;
1018
+ var textureConfig$2 = {
1019
+ loadTextureSetAndCreateMaterial: null,
1020
+ checkThreeJSCompatibility: null,
1021
+ forceUpdateMaterials: null
1022
+ };
978
1023
  function importTextureConfig() {
979
1024
  return _importTextureConfig.apply(this, arguments);
980
1025
  }
981
1026
  function _importTextureConfig() {
982
1027
  _importTextureConfig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
983
- var module, _t1;
1028
+ var module, importedFunctions, _t1;
984
1029
  return _regenerator().w(function (_context1) {
985
1030
  while (1) switch (_context1.n) {
986
1031
  case 0:
@@ -994,8 +1039,28 @@ function _importTextureConfig() {
994
1039
  return Promise.resolve().then(function () { return textureConfig$1; });
995
1040
  case 2:
996
1041
  module = _context1.v;
997
- loadTextureSetAndCreateMaterial$1 = module.loadTextureSetAndCreateMaterial;
998
- console.log('✅ TextureConfig imported successfully:', loadTextureSetAndCreateMaterial$1 ? 'Available' : 'Undefined');
1042
+ // Store all exported functions
1043
+ textureConfig$2.loadTextureSetAndCreateMaterial = module.loadTextureSetAndCreateMaterial;
1044
+ textureConfig$2.checkThreeJSCompatibility = module.checkThreeJSCompatibility;
1045
+ textureConfig$2.forceUpdateMaterials = module.forceUpdateMaterials;
1046
+
1047
+ // Check what was successfully imported
1048
+ importedFunctions = Object.entries(textureConfig$2).filter(function (_ref2) {
1049
+ var _ref3 = _slicedToArray(_ref2, 2);
1050
+ _ref3[0];
1051
+ var fn = _ref3[1];
1052
+ return typeof fn === 'function';
1053
+ }).map(function (_ref4) {
1054
+ var _ref5 = _slicedToArray(_ref4, 1),
1055
+ name = _ref5[0];
1056
+ return name;
1057
+ });
1058
+ console.log("\u2705 TextureConfig imported successfully with functions: ".concat(importedFunctions.join(', ')));
1059
+
1060
+ // Run compatibility check if available
1061
+ if (typeof textureConfig$2.checkThreeJSCompatibility === 'function') {
1062
+ textureConfig$2.checkThreeJSCompatibility();
1063
+ }
999
1064
  return _context1.a(2, true);
1000
1065
  case 3:
1001
1066
  _context1.p = 3;
@@ -1051,15 +1116,15 @@ var EnvironmentManager = /*#__PURE__*/function () {
1051
1116
  }
1052
1117
  return initLoaders;
1053
1118
  }()
1054
- /**
1055
- * Create skybox with HDR environment mapping
1119
+ /**
1120
+ * Create skybox with HDR environment mapping
1056
1121
  */
1057
1122
  }, {
1058
1123
  key: "createSkybox",
1059
1124
  value: (function () {
1060
1125
  var _createSkybox = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
1061
1126
  var _this = this;
1062
- var component, isContextLost, pmremGenerator, loaders, applyEnvironmentMap, _loop, _ret, _i, _loaders, _t4, _t5, _t6;
1127
+ var component, isContextLost, pmremGenerator, hdrPath1, hdrPath2, jpgPath, loaders, applyEnvironmentMap, _loop, _ret, _i, _loaders, _t4, _t5, _t6;
1063
1128
  return _regenerator().w(function (_context4) {
1064
1129
  while (1) switch (_context4.n) {
1065
1130
  case 0:
@@ -1126,22 +1191,23 @@ var EnvironmentManager = /*#__PURE__*/function () {
1126
1191
  this.createFallbackEnvironment();
1127
1192
  return _context4.a(2);
1128
1193
  case 9:
1194
+ // Get resolved paths for better debugging
1195
+ hdrPath1 = getAssetPath$1('skyboxes/kloofendal_48d_partly_cloudy_puresky_2k.hdr');
1196
+ hdrPath2 = getAssetPath$1('skyboxes/kloofendal_48d_partly_cloudy_puresky_1k.hdr');
1197
+ jpgPath = getAssetPath$1('skyboxes/sky_fallback.jpg');
1198
+ console.log('🔍 Resolved HDR paths:', {
1199
+ hdr2k: hdrPath1,
1200
+ hdr1k: hdrPath2,
1201
+ jpg: jpgPath
1202
+ });
1129
1203
  loaders = [{
1130
1204
  type: 'hdr',
1131
1205
  loader: new RGBELoader$2(),
1132
- paths: [
1133
- // Try local paths first
1134
- '/skyboxes/kloofendal_48d_partly_cloudy_puresky_2k.hdr', '/skyboxes/kloofendal_48d_partly_cloudy_puresky_1k.hdr',
1135
- // Fall back to S3 paths
1136
- 'https://central-plant-assets.s3.us-east-1.amazonaws.com/skyboxes/kloofendal_48d_partly_cloudy_puresky_2k.hdr', 'https://central-plant-assets.s3.us-east-1.amazonaws.com/skyboxes/kloofendal_48d_partly_cloudy_puresky_1k.hdr']
1206
+ paths: [hdrPath1, hdrPath2]
1137
1207
  }, {
1138
1208
  type: 'jpeg',
1139
1209
  loader: component.textureLoader || new THREE__namespace.TextureLoader(),
1140
- paths: [
1141
- // Try local paths first
1142
- '/skyboxes/sky_fallback.jpg',
1143
- // Fall back to S3 path
1144
- 'https://central-plant-assets.s3.us-east-1.amazonaws.com/skyboxes/sky_fallback.jpg']
1210
+ paths: [jpgPath]
1145
1211
  }]; // Configure texture loaders with CORS settings
1146
1212
  loaders.forEach(function (_ref) {
1147
1213
  var loader = _ref.loader;
@@ -1208,7 +1274,7 @@ var EnvironmentManager = /*#__PURE__*/function () {
1208
1274
  case 0:
1209
1275
  path = _step.value;
1210
1276
  _context2.p = 1;
1211
- if (!path.startsWith('/')) {
1277
+ if (!(path.startsWith('/') && !path.includes('://'))) {
1212
1278
  _context2.n = 3;
1213
1279
  break;
1214
1280
  }
@@ -1348,8 +1414,8 @@ var EnvironmentManager = /*#__PURE__*/function () {
1348
1414
  }
1349
1415
  return createSkybox;
1350
1416
  }()
1351
- /**
1352
- * Create a fallback environment when renderer issues occur
1417
+ /**
1418
+ * Create a fallback environment when renderer issues occur
1353
1419
  */
1354
1420
  )
1355
1421
  }, {
@@ -1369,8 +1435,8 @@ var EnvironmentManager = /*#__PURE__*/function () {
1369
1435
  component.scene.background = new THREE__namespace.Color(0x87CEEB);
1370
1436
  }
1371
1437
 
1372
- /**
1373
- * Create procedural sky when textures fail to load
1438
+ /**
1439
+ * Create procedural sky when textures fail to load
1374
1440
  */
1375
1441
  }, {
1376
1442
  key: "createProceduralSky",
@@ -1410,8 +1476,8 @@ var EnvironmentManager = /*#__PURE__*/function () {
1410
1476
  }
1411
1477
  }
1412
1478
 
1413
- /**
1414
- * Setup scene lighting
1479
+ /**
1480
+ * Setup scene lighting
1415
1481
  */
1416
1482
  }, {
1417
1483
  key: "setupLighting",
@@ -1460,8 +1526,8 @@ var EnvironmentManager = /*#__PURE__*/function () {
1460
1526
  logger.info('Scene lighting setup complete');
1461
1527
  }
1462
1528
 
1463
- /**
1464
- * Create ground plane
1529
+ /**
1530
+ * Create ground plane
1465
1531
  */
1466
1532
  }, {
1467
1533
  key: "createGround",
@@ -1495,8 +1561,8 @@ var EnvironmentManager = /*#__PURE__*/function () {
1495
1561
  return ground;
1496
1562
  }
1497
1563
 
1498
- /**
1499
- * Create walls for the environment
1564
+ /**
1565
+ * Create walls for the environment
1500
1566
  */
1501
1567
  }, {
1502
1568
  key: "createWalls",
@@ -1560,8 +1626,8 @@ var EnvironmentManager = /*#__PURE__*/function () {
1560
1626
  return walls;
1561
1627
  }
1562
1628
 
1563
- /**
1564
- * Set fog in the scene
1629
+ /**
1630
+ * Set fog in the scene
1565
1631
  */
1566
1632
  }, {
1567
1633
  key: "setFog",
@@ -1575,15 +1641,15 @@ var EnvironmentManager = /*#__PURE__*/function () {
1575
1641
  }
1576
1642
  component.scene.fog = new THREE__namespace.FogExp2(color, density);
1577
1643
  logger.info('Scene fog applied');
1578
- }
1579
- /**
1580
- * Initialize the default environment
1581
- */
1644
+ } /**
1645
+ * Initialize the default environment
1646
+ */
1582
1647
  }, {
1583
1648
  key: "initializeEnvironment",
1584
1649
  value: (function () {
1585
1650
  var _initializeEnvironment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
1586
- var component, loadersReady, textureConfigReady, _t7;
1651
+ var _this2 = this;
1652
+ var component, loadersReady, textureConfigReady, ground, walls, _t7;
1587
1653
  return _regenerator().w(function (_context5) {
1588
1654
  while (1) switch (_context5.n) {
1589
1655
  case 0:
@@ -1609,39 +1675,91 @@ var EnvironmentManager = /*#__PURE__*/function () {
1609
1675
  _t7 = _context5.v;
1610
1676
  console.warn('⚠️ Error initializing environment loaders:', _t7);
1611
1677
  case 5:
1612
- // Configure renderer for proper HDR rendering if it exists
1613
- if (component && component.renderer) {
1614
- // Ensure proper tone mapping is set for HDR
1678
+ if (component) {
1679
+ _context5.n = 6;
1680
+ break;
1681
+ }
1682
+ logger.error('❌ Cannot initialize environment: component is null');
1683
+ return _context5.a(2);
1684
+ case 6:
1685
+ if (component.renderer) {
1686
+ _context5.n = 7;
1687
+ break;
1688
+ }
1689
+ logger.error('❌ Cannot initialize environment: renderer is null');
1690
+ return _context5.a(2);
1691
+ case 7:
1692
+ // Configure renderer for proper HDR rendering
1693
+ console.log('🎨 Configuring renderer for environment...');
1694
+
1695
+ // Don't override existing settings from sceneInitializationManager
1696
+ // Just ensure we have reasonable values set
1697
+ if (!component.renderer.toneMapping) {
1615
1698
  component.renderer.toneMapping = THREE__namespace.ACESFilmicToneMapping;
1616
- component.renderer.toneMappingExposure = 1.0;
1617
- // For all Three.js versions from r152+
1618
- if (component.renderer.outputColorSpace !== undefined) {
1619
- component.renderer.outputColorSpace = THREE__namespace.SRGBColorSpace;
1620
- }
1621
- // For older Three.js versions (legacy support)
1622
- else if (component.renderer.outputEncoding !== undefined) {
1623
- component.renderer.outputEncoding = THREE__namespace.sRGBEncoding;
1624
- }
1625
- logger.info("Renderer configured for HDR:\n - Tone mapping: ".concat(component.renderer.toneMapping, "\n - Color space: ").concat(component.renderer.outputColorSpace || component.renderer.outputEncoding));
1626
1699
  }
1700
+ component.renderer.toneMappingExposure = 1.0;
1701
+
1702
+ // Ensure correct color space is set based on Three.js version
1703
+ if (component.renderer.outputColorSpace !== undefined) {
1704
+ component.renderer.outputColorSpace = THREE__namespace.SRGBColorSpace; // For newer Three.js
1705
+ console.log('✅ Set SRGBColorSpace for renderer (newer Three.js)');
1706
+ } else if (component.renderer.outputEncoding !== undefined) {
1707
+ component.renderer.outputEncoding = THREE__namespace.sRGBEncoding; // For older Three.js
1708
+ console.log('✅ Set sRGBEncoding for renderer (older Three.js)');
1709
+ }
1710
+ logger.info("Renderer configured for HDR:\n - Tone mapping: ".concat(component.renderer.toneMapping, "\n - Color space: ").concat(component.renderer.outputColorSpace || component.renderer.outputEncoding));
1627
1711
 
1628
1712
  // Create skybox (includes base lighting)
1629
- _context5.n = 6;
1713
+ _context5.n = 8;
1630
1714
  return this.createSkybox();
1631
- case 6:
1715
+ case 8:
1632
1716
  // Add additional lighting
1633
1717
  this.setupLighting();
1634
1718
 
1635
1719
  // Use textured ground instead of basic ground
1636
- _context5.n = 7;
1720
+ console.log('🌍 Creating ground with texture...');
1721
+ _context5.n = 9;
1637
1722
  return this.addTexturedGround();
1638
- case 7:
1639
- // No walls or fog by default
1640
- // await this.addBrickWalls();
1641
- // this.addHorizonFog();
1723
+ case 9:
1724
+ ground = _context5.v;
1725
+ if (!ground) {
1726
+ logger.error('❌ Failed to create textured ground');
1727
+ } else {
1728
+ logger.info('✅ Ground created successfully');
1729
+ }
1642
1730
 
1643
- logger.info('Environment initialization complete');
1644
- case 8:
1731
+ // Add walls with textures
1732
+ console.log('🧱 Creating walls with textures...');
1733
+ _context5.n = 10;
1734
+ return this.addBrickWalls();
1735
+ case 10:
1736
+ walls = _context5.v;
1737
+ if (!walls || walls.length === 0) {
1738
+ logger.warn('⚠️ No walls were created');
1739
+ } else {
1740
+ logger.info("\u2705 Created ".concat(walls.length, " walls"));
1741
+ }
1742
+
1743
+ // Add atmospheric fog
1744
+ this.addHorizonFog();
1745
+ logger.info('Environment initialization complete'); // Force material refresh to ensure textures are applied correctly
1746
+ this.forceRefreshMaterials();
1747
+
1748
+ // Force renderer refresh
1749
+ if (component.renderer && component.scene && component.camera) {
1750
+ component.renderer.render(component.scene, component.camera);
1751
+ console.log('🔄 Forced initial render to refresh scene');
1752
+
1753
+ // Schedule another render after a short delay to catch any async texture loading
1754
+ setTimeout(function () {
1755
+ if (component.renderer && !component.isDestroyed) {
1756
+ _this2.forceRefreshMaterials();
1757
+ component.renderer.render(component.scene, component.camera);
1758
+ console.log('🔄 Performed delayed render to catch async texture loads');
1759
+ }
1760
+ }, 1000);
1761
+ }
1762
+ case 11:
1645
1763
  return _context5.a(2);
1646
1764
  }
1647
1765
  }, _callee3, this, [[1, 4]]);
@@ -1651,74 +1769,149 @@ var EnvironmentManager = /*#__PURE__*/function () {
1651
1769
  }
1652
1770
  return initializeEnvironment;
1653
1771
  }()
1654
- /**
1655
- * Add textured ground with materials from textureConfig
1772
+ /**
1773
+ * Add textured ground with materials from textureConfig
1656
1774
  */
1657
1775
  )
1658
1776
  }, {
1659
1777
  key: "addTexturedGround",
1660
1778
  value: (function () {
1661
1779
  var _addTexturedGround = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
1662
- var component, groundMaterial, groundGeometry, ground, _t8;
1780
+ var component, groundMaterial, debugMaterial, groundGeometry, ground, debugGround, errorGeometry, errorMaterial, errorGround, _t8;
1663
1781
  return _regenerator().w(function (_context6) {
1664
1782
  while (1) switch (_context6.n) {
1665
1783
  case 0:
1666
- if (loadTextureSetAndCreateMaterial$1) {
1667
- _context6.n = 1;
1784
+ if (textureConfig$2.loadTextureSetAndCreateMaterial) {
1785
+ _context6.n = 2;
1668
1786
  break;
1669
1787
  }
1788
+ console.log('🔄 TextureConfig module not yet loaded, importing now...');
1670
1789
  _context6.n = 1;
1671
1790
  return importTextureConfig();
1672
1791
  case 1:
1792
+ if (textureConfig$2.loadTextureSetAndCreateMaterial) {
1793
+ _context6.n = 2;
1794
+ break;
1795
+ }
1796
+ console.error('❌ Failed to load textureConfig module, falling back to basic ground');
1797
+ return _context6.a(2, this.createGround());
1798
+ case 2:
1673
1799
  component = this.component;
1674
1800
  if (!(!component || !component.scene)) {
1675
- _context6.n = 2;
1801
+ _context6.n = 3;
1676
1802
  break;
1677
1803
  }
1678
1804
  logger.warn('Cannot create textured ground: component or scene not available');
1679
1805
  return _context6.a(2, null);
1680
- case 2:
1806
+ case 3:
1807
+ // Force texture loading with crossOrigin support
1808
+ if (!component.textureLoader) {
1809
+ console.log('🔄 Creating texture loader in component');
1810
+ component.textureLoader = new THREE__namespace.TextureLoader();
1811
+ component.textureLoader.setCrossOrigin('anonymous');
1812
+ }
1813
+
1681
1814
  // Remove existing ground if present
1682
1815
  component.scene.traverse(function (object) {
1683
1816
  if (object.userData && object.userData.type === 'ground') {
1684
1817
  component.scene.remove(object);
1685
1818
  }
1686
1819
  });
1687
- _context6.p = 3;
1688
- _context6.n = 4;
1689
- return loadTextureSetAndCreateMaterial$1(component, 'gravel_embedded_concrete');
1690
- case 4:
1820
+ _context6.p = 4;
1821
+ console.log('🌍 Creating textured ground plane...');
1822
+ // Use the gravel_embedded_concrete texture set
1823
+ console.log('🔄 Loading ground material textures...');
1824
+ _context6.n = 5;
1825
+ return textureConfig$2.loadTextureSetAndCreateMaterial(component, 'gravel_embedded_concrete');
1826
+ case 5:
1691
1827
  groundMaterial = _context6.v;
1692
- groundGeometry = new THREE__namespace.PlaneGeometry(100, 100);
1828
+ if (groundMaterial) {
1829
+ _context6.n = 6;
1830
+ break;
1831
+ }
1832
+ throw new Error('Failed to create ground material');
1833
+ case 6:
1834
+ console.log('✅ Ground material created');
1835
+
1836
+ // First create a colored material to verify the mesh creation works
1837
+ debugMaterial = new THREE__namespace.MeshBasicMaterial({
1838
+ color: 0x22ff22,
1839
+ // Bright green for visibility
1840
+ wireframe: false,
1841
+ side: THREE__namespace.DoubleSide
1842
+ }); // Create a composite ground with both materials
1843
+ groundGeometry = new THREE__namespace.PlaneGeometry(100, 100); // Create the main ground mesh
1693
1844
  ground = new THREE__namespace.Mesh(groundGeometry, groundMaterial);
1694
1845
  ground.rotation.x = -Math.PI / 2; // Rotate to be horizontal
1695
1846
  ground.position.y = -0.01; // Slightly below origin
1696
1847
  ground.receiveShadow = true;
1697
1848
 
1849
+ // Create a debug ground mesh slightly below the main ground
1850
+ debugGround = new THREE__namespace.Mesh(groundGeometry, debugMaterial);
1851
+ debugGround.rotation.x = -Math.PI / 2;
1852
+ debugGround.position.y = -0.02; // Below the main ground
1853
+ debugGround.visible = false; // Hide by default
1854
+
1698
1855
  // Set user data for identification
1699
1856
  ground.userData = {
1700
1857
  isEnvironmentObject: true,
1858
+ isBaseGround: true,
1701
1859
  type: 'ground'
1702
1860
  };
1861
+ debugGround.userData = {
1862
+ isEnvironmentObject: true,
1863
+ type: 'ground-debug'
1864
+ };
1865
+
1866
+ // Add both to scene
1703
1867
  component.scene.add(ground);
1868
+ component.scene.add(debugGround);
1869
+
1870
+ // Log some properties about the created ground
1871
+ console.log('🌍 Textured ground created with properties:', {
1872
+ material: groundMaterial.type,
1873
+ hasMap: !!groundMaterial.map,
1874
+ hasNormalMap: !!groundMaterial.normalMap,
1875
+ hasRoughnessMap: !!groundMaterial.roughnessMap,
1876
+ hasMetalnessMap: !!groundMaterial.metalnessMap,
1877
+ hasAoMap: !!groundMaterial.aoMap,
1878
+ hasBumpMap: !!groundMaterial.bumpMap,
1879
+ materialColor: groundMaterial.color ? "#".concat(groundMaterial.color.getHexString()) : 'none'
1880
+ });
1704
1881
  logger.info('Textured ground created');
1705
1882
  return _context6.a(2, ground);
1706
- case 5:
1707
- _context6.p = 5;
1883
+ case 7:
1884
+ _context6.p = 7;
1708
1885
  _t8 = _context6.v;
1709
1886
  logger.error('Error creating textured ground:', _t8);
1710
- // Fallback to simple ground
1711
- return _context6.a(2, this.createGround());
1887
+ // Create a bright colored ground so it's obvious something was wrong
1888
+ errorGeometry = new THREE__namespace.PlaneGeometry(100, 100);
1889
+ errorMaterial = new THREE__namespace.MeshBasicMaterial({
1890
+ color: 0xff0000,
1891
+ wireframe: true,
1892
+ side: THREE__namespace.DoubleSide
1893
+ });
1894
+ errorGround = new THREE__namespace.Mesh(errorGeometry, errorMaterial);
1895
+ errorGround.rotation.x = -Math.PI / 2;
1896
+ errorGround.position.y = -0.01;
1897
+ errorGround.userData = {
1898
+ isEnvironmentObject: true,
1899
+ isBaseGround: true,
1900
+ type: 'ground-error'
1901
+ };
1902
+ component.scene.add(errorGround);
1903
+ console.error('⚠️ Fallback to error ground (red wireframe) due to texture loading failure:', _t8);
1904
+ return _context6.a(2, errorGround);
1712
1905
  }
1713
- }, _callee4, this, [[3, 5]]);
1906
+ }, _callee4, this, [[4, 7]]);
1714
1907
  }));
1715
1908
  function addTexturedGround() {
1716
1909
  return _addTexturedGround.apply(this, arguments);
1717
1910
  }
1718
1911
  return addTexturedGround;
1719
1912
  }()
1720
- /**
1721
- * Add brick walls with materials from textureConfig
1913
+ /**
1914
+ * Add brick walls with materials from textureConfig
1722
1915
  */
1723
1916
  )
1724
1917
  }, {
@@ -1729,31 +1922,41 @@ var EnvironmentManager = /*#__PURE__*/function () {
1729
1922
  return _regenerator().w(function (_context7) {
1730
1923
  while (1) switch (_context7.n) {
1731
1924
  case 0:
1732
- if (loadTextureSetAndCreateMaterial$1) {
1733
- _context7.n = 1;
1925
+ if (textureConfig$2.loadTextureSetAndCreateMaterial) {
1926
+ _context7.n = 2;
1734
1927
  break;
1735
1928
  }
1929
+ console.log('🔄 TextureConfig module not yet loaded for brick walls, importing now...');
1736
1930
  _context7.n = 1;
1737
1931
  return importTextureConfig();
1738
1932
  case 1:
1933
+ if (textureConfig$2.loadTextureSetAndCreateMaterial) {
1934
+ _context7.n = 2;
1935
+ break;
1936
+ }
1937
+ console.error('❌ Failed to load textureConfig module for brick walls');
1938
+ return _context7.a(2, this.createWalls());
1939
+ case 2:
1739
1940
  component = this.component;
1740
1941
  if (!(!component || !component.scene)) {
1741
- _context7.n = 2;
1942
+ _context7.n = 3;
1742
1943
  break;
1743
1944
  }
1744
1945
  logger.warn('Cannot create brick walls: component or scene not available');
1745
1946
  return _context7.a(2, []);
1746
- case 2:
1947
+ case 3:
1747
1948
  // Remove existing walls if present
1748
1949
  component.scene.traverse(function (object) {
1749
1950
  if (object.userData && object.userData.type === 'wall') {
1750
1951
  component.scene.remove(object);
1751
1952
  }
1752
1953
  });
1753
- _context7.p = 3;
1754
- _context7.n = 4;
1755
- return loadTextureSetAndCreateMaterial$1(component, 'brick');
1756
- case 4:
1954
+ _context7.p = 4;
1955
+ // Use the brick texture set
1956
+ console.log('🧱 Loading brick wall material textures...');
1957
+ _context7.n = 5;
1958
+ return textureConfig$2.loadTextureSetAndCreateMaterial(component, 'brick');
1959
+ case 5:
1757
1960
  wallMaterial = _context7.v;
1758
1961
  walls = [];
1759
1962
  wallHeight = 20;
@@ -1793,22 +1996,22 @@ var EnvironmentManager = /*#__PURE__*/function () {
1793
1996
  }
1794
1997
  logger.info('Textured environment walls created');
1795
1998
  return _context7.a(2, walls);
1796
- case 5:
1797
- _context7.p = 5;
1999
+ case 6:
2000
+ _context7.p = 6;
1798
2001
  _t9 = _context7.v;
1799
2002
  logger.error('Error creating brick walls:', _t9);
1800
2003
  // Fallback to simple walls
1801
2004
  return _context7.a(2, this.createWalls());
1802
2005
  }
1803
- }, _callee5, this, [[3, 5]]);
2006
+ }, _callee5, this, [[4, 6]]);
1804
2007
  }));
1805
2008
  function addBrickWalls() {
1806
2009
  return _addBrickWalls.apply(this, arguments);
1807
2010
  }
1808
2011
  return addBrickWalls;
1809
2012
  }()
1810
- /**
1811
- * Add horizon fog effect
2013
+ /**
2014
+ * Add horizon fog effect
1812
2015
  */
1813
2016
  )
1814
2017
  }, {
@@ -1828,10 +2031,10 @@ var EnvironmentManager = /*#__PURE__*/function () {
1828
2031
  logger.info('Horizon fog applied');
1829
2032
  }
1830
2033
 
1831
- /**
1832
- * Helper to check if a texture exists locally in static directory
1833
- * @param {string} path - Relative path to texture in static directory
1834
- * @returns {Promise<boolean>}
2034
+ /**
2035
+ * Helper to check if a texture exists locally in static directory
2036
+ * @param {string} path - Relative path to texture in static directory
2037
+ * @returns {Promise<boolean>}
1835
2038
  */
1836
2039
  }, {
1837
2040
  key: "checkLocalTextureExists",
@@ -1859,9 +2062,8 @@ var EnvironmentManager = /*#__PURE__*/function () {
1859
2062
  return resolve(false);
1860
2063
  };
1861
2064
 
1862
- // Create full path relative to app root
1863
- var fullPath = window.location.origin + '/' + path;
1864
- img.src = fullPath;
2065
+ // Use the path directly - it should already be processed by getAssetPath
2066
+ img.src = path;
1865
2067
 
1866
2068
  // Set a timeout in case the image load hangs
1867
2069
  setTimeout(function () {
@@ -1877,15 +2079,106 @@ var EnvironmentManager = /*#__PURE__*/function () {
1877
2079
  return _checkLocalTextureExists.apply(this, arguments);
1878
2080
  }
1879
2081
  return checkLocalTextureExists;
1880
- }())
2082
+ }()
2083
+ /**
2084
+ * Force refresh all materials in the scene
2085
+ * Helpful for ensuring textures are correctly displayed
2086
+ */
2087
+ )
2088
+ }, {
2089
+ key: "forceRefreshMaterials",
2090
+ value: function forceRefreshMaterials() {
2091
+ var component = this.component;
2092
+ if (!component || !component.scene) {
2093
+ logger.warn('Cannot refresh materials: component or scene not available');
2094
+ return;
2095
+ }
2096
+ console.log('🔄 Forcing material refresh for all objects...');
2097
+ var updatedMaterials = 0;
2098
+ var textureFixes = 0;
2099
+
2100
+ // Import helper functions if available
2101
+ var hasValidImageData = textureConfig$2.hasValidImageData || function (texture) {
2102
+ return texture && texture.image;
2103
+ };
2104
+ var createPlaceholderTexture = textureConfig$2.createPlaceholderTexture || function () {
2105
+ return null;
2106
+ };
2107
+
2108
+ // Traverse all meshes in the scene
2109
+ component.scene.traverse(function (object) {
2110
+ if (object.isMesh && object.material) {
2111
+ // Handle both single materials and material arrays
2112
+ var materials = Array.isArray(object.material) ? object.material : [object.material];
2113
+ materials.forEach(function (material) {
2114
+ if (material) {
2115
+ // Update material properties
2116
+ material.needsUpdate = true;
2117
+
2118
+ // Ensure color values are properly set
2119
+ if (material.color) {
2120
+ if (typeof material.color.convertSRGBToLinear === 'function') {
2121
+ material.color.convertSRGBToLinear();
2122
+ }
2123
+ }
2124
+
2125
+ // Check for maps and ensure they're correctly configured
2126
+ var maps = ['map', 'normalMap', 'roughnessMap', 'metalnessMap', 'aoMap', 'bumpMap'];
2127
+ maps.forEach(function (mapType) {
2128
+ var map = material[mapType];
2129
+ if (map) {
2130
+ // Check if this texture might trigger the warning
2131
+ var hasValidData = hasValidImageData(map);
2132
+ if (!hasValidData) {
2133
+ console.warn("\u26A0\uFE0F Found texture without valid image data in ".concat(mapType, " for object ").concat(object.name || object.uuid));
2134
+
2135
+ // Create and use a placeholder texture for now
2136
+ if (createPlaceholderTexture) {
2137
+ var placeholderColor = mapType === 'normalMap' ? 0x8080ff : 0xcccccc;
2138
+ var placeholder = createPlaceholderTexture(placeholderColor);
2139
+ if (placeholder) {
2140
+ material[mapType] = placeholder;
2141
+ textureFixes++;
2142
+ console.log("\uD83D\uDD04 Replaced missing image texture with placeholder for ".concat(mapType));
2143
+ }
2144
+ }
2145
+ } else {
2146
+ map.needsUpdate = true;
2147
+
2148
+ // Ensure correct color space for diffuse maps
2149
+ if (mapType === 'map' && map.colorSpace !== undefined) {
2150
+ map.colorSpace = THREE__namespace.SRGBColorSpace;
2151
+ } else if (mapType === 'map' && map.encoding !== undefined) {
2152
+ map.encoding = THREE__namespace.sRGBEncoding;
2153
+ }
2154
+ }
2155
+ }
2156
+ });
2157
+ updatedMaterials++;
2158
+ }
2159
+ });
2160
+ }
2161
+ });
2162
+
2163
+ // Use the dedicated function from textureConfig if available
2164
+ if (textureConfig$2.forceUpdateMaterials) {
2165
+ textureConfig$2.forceUpdateMaterials(component.scene);
2166
+ }
2167
+ console.log("\u2705 Refreshed ".concat(updatedMaterials, " materials, fixed ").concat(textureFixes, " texture warnings"));
2168
+
2169
+ // Force a renderer update if possible
2170
+ if (component.renderer && component.camera) {
2171
+ component.renderer.render(component.scene, component.camera);
2172
+ }
2173
+ }
1881
2174
  }]);
1882
2175
  }();
1883
2176
 
1884
2177
  // Create a singleton instance
1885
2178
  var environmentManager = null;
1886
2179
 
1887
- /**
1888
- * Get the global environment manager instance
2180
+ /**
2181
+ * Get the global environment manager instance
1889
2182
  */
1890
2183
  function getEnvironmentManager() {
1891
2184
  var component = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
@@ -1926,9 +2219,9 @@ var environmentManager$2 = /*#__PURE__*/Object.freeze({
1926
2219
  'default': environmentManager$1
1927
2220
  });
1928
2221
 
1929
- /**
1930
- * Hot-Reload Manager Module
1931
- * Handles development environment hot-reload detection and cleanup
2222
+ /**
2223
+ * Hot-Reload Manager Module
2224
+ * Handles development environment hot-reload detection and cleanup
1932
2225
  */
1933
2226
 
1934
2227
  // Check if we're in a browser environment
@@ -1952,8 +2245,8 @@ var HotReloadManager = /*#__PURE__*/function () {
1952
2245
  this.intervalIds = new Set();
1953
2246
  }
1954
2247
 
1955
- /**
1956
- * Setup hot-reload handling for development environment
2248
+ /**
2249
+ * Setup hot-reload handling for development environment
1957
2250
  */
1958
2251
  return _createClass(HotReloadManager, [{
1959
2252
  key: "setupHotReloadHandling",
@@ -1995,8 +2288,8 @@ var HotReloadManager = /*#__PURE__*/function () {
1995
2288
  console.log('✅ [Hot-Reload] Hot-reload handling setup completed');
1996
2289
  }
1997
2290
 
1998
- /**
1999
- * Cleanup hot-reload handlers (development only)
2291
+ /**
2292
+ * Cleanup hot-reload handlers (development only)
2000
2293
  */
2001
2294
  }, {
2002
2295
  key: "cleanupHotReloadHandlers",
@@ -2037,8 +2330,8 @@ var HotReloadManager = /*#__PURE__*/function () {
2037
2330
  }
2038
2331
  }
2039
2332
 
2040
- /**
2041
- * Track a timeout ID for cleanup on component destruction
2333
+ /**
2334
+ * Track a timeout ID for cleanup on component destruction
2042
2335
  */
2043
2336
  }, {
2044
2337
  key: "trackTimeout",
@@ -2049,8 +2342,8 @@ var HotReloadManager = /*#__PURE__*/function () {
2049
2342
  return timeoutId;
2050
2343
  }
2051
2344
 
2052
- /**
2053
- * Track an interval ID for cleanup on component destruction
2345
+ /**
2346
+ * Track an interval ID for cleanup on component destruction
2054
2347
  */
2055
2348
  }, {
2056
2349
  key: "trackInterval",
@@ -2061,8 +2354,8 @@ var HotReloadManager = /*#__PURE__*/function () {
2061
2354
  return intervalId;
2062
2355
  }
2063
2356
 
2064
- /**
2065
- * Clear a tracked timeout and remove from tracking
2357
+ /**
2358
+ * Clear a tracked timeout and remove from tracking
2066
2359
  */
2067
2360
  }, {
2068
2361
  key: "clearTrackedTimeout",
@@ -2075,8 +2368,8 @@ var HotReloadManager = /*#__PURE__*/function () {
2075
2368
  return false;
2076
2369
  }
2077
2370
 
2078
- /**
2079
- * Clear a tracked interval and remove from tracking
2371
+ /**
2372
+ * Clear a tracked interval and remove from tracking
2080
2373
  */
2081
2374
  }, {
2082
2375
  key: "clearTrackedInterval",
@@ -2089,8 +2382,8 @@ var HotReloadManager = /*#__PURE__*/function () {
2089
2382
  return false;
2090
2383
  }
2091
2384
 
2092
- /**
2093
- * Clear all tracked timeouts and intervals
2385
+ /**
2386
+ * Clear all tracked timeouts and intervals
2094
2387
  */
2095
2388
  }, {
2096
2389
  key: "clearAllTrackedTimers",
@@ -2111,10 +2404,10 @@ var HotReloadManager = /*#__PURE__*/function () {
2111
2404
  }]);
2112
2405
  }();
2113
2406
 
2114
- /**
2115
- * Simple utility to handle hot-reload for componentId
2116
- * @param {string} instanceId - Unique instance identifier for the component
2117
- * @param {Function} cleanupMethod - Method to call to clean up resources
2407
+ /**
2408
+ * Simple utility to handle hot-reload for componentId
2409
+ * @param {string} instanceId - Unique instance identifier for the component
2410
+ * @param {Function} cleanupMethod - Method to call to clean up resources
2118
2411
  */
2119
2412
  function handleHotReload(instanceId, cleanupMethod) {
2120
2413
  if (!isBrowser || !isDev) return;
@@ -2140,16 +2433,16 @@ function handleHotReload(instanceId, cleanupMethod) {
2140
2433
  });
2141
2434
  }
2142
2435
 
2143
- /**
2144
- * Check if we're currently hot-reloading
2436
+ /**
2437
+ * Check if we're currently hot-reloading
2145
2438
  */
2146
2439
  function isHotReloading() {
2147
2440
  return isDev && isBrowser && window._hotReloadRegistry && window._hotReloadRegistry.size > 0;
2148
2441
  }
2149
2442
 
2150
- /**
2151
- * Clean up resources for a component before hot-reload
2152
- * @param {string} instanceId - ID of the component instance to clean up
2443
+ /**
2444
+ * Clean up resources for a component before hot-reload
2445
+ * @param {string} instanceId - ID of the component instance to clean up
2153
2446
  */
2154
2447
  function cleanupForHotReload(instanceId) {
2155
2448
  if (!isBrowser || !isDev || !window._hotReloadRegistry) return;
@@ -2176,17 +2469,17 @@ var hotReloadManager$1 = /*#__PURE__*/Object.freeze({
2176
2469
  'default': hotReloadManager
2177
2470
  });
2178
2471
 
2179
- /**
2180
- * Keyboard Controls Manager
2181
- * Manages keyboard shortcuts and controls
2472
+ /**
2473
+ * Keyboard Controls Manager
2474
+ * Manages keyboard shortcuts and controls
2182
2475
  */
2183
2476
 
2184
2477
  // Store registered key handlers
2185
2478
  var keyHandlers = new Map();
2186
2479
  var isListening = false;
2187
2480
 
2188
- /**
2189
- * Initialize keyboard controls
2481
+ /**
2482
+ * Initialize keyboard controls
2190
2483
  */
2191
2484
  function initKeyboardControls() {
2192
2485
  if (typeof window === 'undefined') {
@@ -2204,8 +2497,8 @@ function initKeyboardControls() {
2204
2497
  logger.info('Keyboard controls initialized');
2205
2498
  }
2206
2499
 
2207
- /**
2208
- * Clean up keyboard controls
2500
+ /**
2501
+ * Clean up keyboard controls
2209
2502
  */
2210
2503
  function cleanupKeyboardControls() {
2211
2504
  if (typeof window === 'undefined' || !isListening) {
@@ -2218,8 +2511,8 @@ function cleanupKeyboardControls() {
2218
2511
  logger.info('Keyboard controls cleaned up');
2219
2512
  }
2220
2513
 
2221
- /**
2222
- * Handler for keydown events
2514
+ /**
2515
+ * Handler for keydown events
2223
2516
  */
2224
2517
  function handleKeyDown(event) {
2225
2518
  // Get key or combination
@@ -2233,8 +2526,8 @@ function handleKeyDown(event) {
2233
2526
  }
2234
2527
  }
2235
2528
 
2236
- /**
2237
- * Handler for keyup events
2529
+ /**
2530
+ * Handler for keyup events
2238
2531
  */
2239
2532
  function handleKeyUp(event) {
2240
2533
  var keyCombo = getKeyCombo(event);
@@ -2247,8 +2540,8 @@ function handleKeyUp(event) {
2247
2540
  }
2248
2541
  }
2249
2542
 
2250
- /**
2251
- * Register a key handler
2543
+ /**
2544
+ * Register a key handler
2252
2545
  */
2253
2546
  function registerKeyHandler(key, callback) {
2254
2547
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
@@ -2269,16 +2562,16 @@ function registerKeyHandler(key, callback) {
2269
2562
  return normalizedKey;
2270
2563
  }
2271
2564
 
2272
- /**
2273
- * Unregister a key handler
2565
+ /**
2566
+ * Unregister a key handler
2274
2567
  */
2275
2568
  function unregisterKeyHandler(key) {
2276
2569
  var normalizedKey = normalizeKey(key);
2277
2570
  return keyHandlers.delete(normalizedKey);
2278
2571
  }
2279
2572
 
2280
- /**
2281
- * Get all registered key handlers
2573
+ /**
2574
+ * Get all registered key handlers
2282
2575
  */
2283
2576
  function getRegisteredKeyHandlers() {
2284
2577
  var handlers = [];
@@ -2291,15 +2584,15 @@ function getRegisteredKeyHandlers() {
2291
2584
  return handlers;
2292
2585
  }
2293
2586
 
2294
- /**
2295
- * Helper function to normalize key format
2587
+ /**
2588
+ * Helper function to normalize key format
2296
2589
  */
2297
2590
  function normalizeKey(key) {
2298
2591
  return key.toLowerCase();
2299
2592
  }
2300
2593
 
2301
- /**
2302
- * Helper function to get key combo string from event
2594
+ /**
2595
+ * Helper function to get key combo string from event
2303
2596
  */
2304
2597
  function getKeyCombo(event) {
2305
2598
  var combo = '';
@@ -2311,8 +2604,8 @@ function getKeyCombo(event) {
2311
2604
  return combo;
2312
2605
  }
2313
2606
 
2314
- /**
2315
- * Setup common keyboard controls for a Three.js scene
2607
+ /**
2608
+ * Setup common keyboard controls for a Three.js scene
2316
2609
  */
2317
2610
  function setupCommonControls(component) {
2318
2611
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -2432,10 +2725,10 @@ var ModelPreloader = /*#__PURE__*/function () {
2432
2725
  }
2433
2726
  return initLoader;
2434
2727
  }()
2435
- /**
2436
- * Preload all models from the component dictionary
2437
- * @param {Object} componentDictionary - The component dictionary object
2438
- * @returns {Promise} Promise that resolves when all models are loaded
2728
+ /**
2729
+ * Preload all models from the component dictionary
2730
+ * @param {Object} componentDictionary - The component dictionary object
2731
+ * @returns {Promise} Promise that resolves when all models are loaded
2439
2732
  */
2440
2733
  }, {
2441
2734
  key: "preloadAllModels",
@@ -2445,6 +2738,7 @@ var ModelPreloader = /*#__PURE__*/function () {
2445
2738
  return _regenerator().w(function (_context4) {
2446
2739
  while (1) switch (_context4.n) {
2447
2740
  case 0:
2741
+ console.log('preloadAllModels called with:', componentDictionary ? "Dictionary of ".concat(Object.keys(componentDictionary).length, " components") : 'No dictionary provided');
2448
2742
  if (!this.isPreloading) {
2449
2743
  _context4.n = 1;
2450
2744
  break;
@@ -2456,7 +2750,14 @@ var ModelPreloader = /*#__PURE__*/function () {
2456
2750
  _context4.n = 2;
2457
2751
  break;
2458
2752
  }
2459
- throw new Error('Component dictionary is required to preload models');
2753
+ console.error('Component dictionary is required to preload models');
2754
+ return _context4.a(2, {
2755
+ total: 0,
2756
+ success: 0,
2757
+ failed: 1,
2758
+ skipped: 0,
2759
+ error: 'Component dictionary is required'
2760
+ });
2460
2761
  case 2:
2461
2762
  this.isPreloading = true;
2462
2763
  this.componentDictionary = componentDictionary;
@@ -2585,12 +2886,87 @@ var ModelPreloader = /*#__PURE__*/function () {
2585
2886
  }
2586
2887
  return preloadAllModels;
2587
2888
  }()
2588
- /**
2589
- * Convert a model key to a URL
2590
- * @param {string} modelKey - The model key from the dictionary
2591
- * @returns {string} The URL for the model
2889
+ /**
2890
+ * Load a component model by its ID
2891
+ * @param {string} componentId - The component ID from the dictionary
2892
+ * @param {Function} callback - Optional callback function to call when loading completes
2893
+ * @returns {Promise} Promise that resolves with the loaded model
2592
2894
  */
2593
2895
  )
2896
+ }, {
2897
+ key: "loadComponentById",
2898
+ value: (function () {
2899
+ var _loadComponentById = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(componentId, callback) {
2900
+ var component, modelUrl, model, _t4;
2901
+ return _regenerator().w(function (_context5) {
2902
+ while (1) switch (_context5.n) {
2903
+ case 0:
2904
+ if (this.componentDictionary) {
2905
+ _context5.n = 1;
2906
+ break;
2907
+ }
2908
+ console.warn('⚠️ No component dictionary available for loadComponentById');
2909
+ if (callback) callback(null);
2910
+ return _context5.a(2, null);
2911
+ case 1:
2912
+ component = this.componentDictionary[componentId];
2913
+ if (!(!component || !component.modelKey)) {
2914
+ _context5.n = 2;
2915
+ break;
2916
+ }
2917
+ console.warn("\u26A0\uFE0F No component or model key found for ID: ".concat(componentId));
2918
+ if (callback) callback(null);
2919
+ return _context5.a(2, null);
2920
+ case 2:
2921
+ _context5.p = 2;
2922
+ modelUrl = this.getModelUrlFromKey(component.modelKey);
2923
+ _context5.n = 3;
2924
+ return this.preloadModel(component.modelKey, modelUrl);
2925
+ case 3:
2926
+ model = _context5.v;
2927
+ if (callback) callback(model);
2928
+ return _context5.a(2, model);
2929
+ case 4:
2930
+ _context5.p = 4;
2931
+ _t4 = _context5.v;
2932
+ console.error("\u274C Failed to load component model for ID: ".concat(componentId), _t4);
2933
+ if (callback) callback(null);
2934
+ return _context5.a(2, null);
2935
+ }
2936
+ }, _callee4, this, [[2, 4]]);
2937
+ }));
2938
+ function loadComponentById(_x3, _x4) {
2939
+ return _loadComponentById.apply(this, arguments);
2940
+ }
2941
+ return loadComponentById;
2942
+ }()
2943
+ /**
2944
+ * Get a cached model by its key
2945
+ * @param {string} modelKey - The model key
2946
+ * @returns {Object|null} The loaded model or null if not found
2947
+ */
2948
+ )
2949
+ }, {
2950
+ key: "getCachedModel",
2951
+ value: function getCachedModel(modelKey) {
2952
+ return this.modelCache.get(modelKey) || null;
2953
+ }
2954
+
2955
+ /**
2956
+ * Get all cache keys
2957
+ * @returns {Array} Array of model keys in the cache
2958
+ */
2959
+ }, {
2960
+ key: "getCacheKeys",
2961
+ value: function getCacheKeys() {
2962
+ return Array.from(this.modelCache.keys());
2963
+ }
2964
+
2965
+ /**
2966
+ * Convert a model key to a URL
2967
+ * @param {string} modelKey - The model key from the dictionary
2968
+ * @returns {string} The URL for the model
2969
+ */
2594
2970
  }, {
2595
2971
  key: "getModelUrlFromKey",
2596
2972
  value: function getModelUrlFromKey(modelKey) {
@@ -2598,45 +2974,45 @@ var ModelPreloader = /*#__PURE__*/function () {
2598
2974
  return modelKey;
2599
2975
  }
2600
2976
 
2601
- /**
2602
- * Preload a specific model
2603
- * @param {string} modelKey - The model key
2604
- * @param {string} modelUrl - The URL to the model
2605
- * @returns {Promise} Promise that resolves with the loaded model
2977
+ /**
2978
+ * Preload a specific model
2979
+ * @param {string} modelKey - The model key
2980
+ * @param {string} modelUrl - The URL to the model
2981
+ * @returns {Promise} Promise that resolves with the loaded model
2606
2982
  */
2607
2983
  }, {
2608
2984
  key: "preloadModel",
2609
2985
  value: (function () {
2610
- var _preloadModel = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(modelKey, modelUrl) {
2986
+ var _preloadModel = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(modelKey, modelUrl) {
2611
2987
  var _this2 = this;
2612
2988
  var loadPromise;
2613
- return _regenerator().w(function (_context5) {
2614
- while (1) switch (_context5.n) {
2989
+ return _regenerator().w(function (_context6) {
2990
+ while (1) switch (_context6.n) {
2615
2991
  case 0:
2616
2992
  if (this.gltfLoader) {
2617
- _context5.n = 2;
2993
+ _context6.n = 2;
2618
2994
  break;
2619
2995
  }
2620
- _context5.n = 1;
2996
+ _context6.n = 1;
2621
2997
  return this.initLoader();
2622
2998
  case 1:
2623
2999
  if (this.gltfLoader) {
2624
- _context5.n = 2;
3000
+ _context6.n = 2;
2625
3001
  break;
2626
3002
  }
2627
3003
  throw new Error('GLTFLoader is not available');
2628
3004
  case 2:
2629
3005
  if (!this.modelCache.has(modelKey)) {
2630
- _context5.n = 3;
3006
+ _context6.n = 3;
2631
3007
  break;
2632
3008
  }
2633
- return _context5.a(2, this.modelCache.get(modelKey));
3009
+ return _context6.a(2, this.modelCache.get(modelKey));
2634
3010
  case 3:
2635
3011
  if (!this.loadingPromises.has(modelKey)) {
2636
- _context5.n = 4;
3012
+ _context6.n = 4;
2637
3013
  break;
2638
3014
  }
2639
- return _context5.a(2, this.loadingPromises.get(modelKey));
3015
+ return _context6.a(2, this.loadingPromises.get(modelKey));
2640
3016
  case 4:
2641
3017
  // Start loading the model
2642
3018
  loadPromise = new Promise(function (resolve, reject) {
@@ -2665,19 +3041,19 @@ var ModelPreloader = /*#__PURE__*/function () {
2665
3041
  });
2666
3042
  }); // Store the loading promise
2667
3043
  this.loadingPromises.set(modelKey, loadPromise);
2668
- return _context5.a(2, loadPromise);
3044
+ return _context6.a(2, loadPromise);
2669
3045
  }
2670
- }, _callee4, this);
3046
+ }, _callee5, this);
2671
3047
  }));
2672
- function preloadModel(_x3, _x4) {
3048
+ function preloadModel(_x5, _x6) {
2673
3049
  return _preloadModel.apply(this, arguments);
2674
3050
  }
2675
3051
  return preloadModel;
2676
3052
  }()
2677
- /**
2678
- * Get a model from the cache
2679
- * @param {string} modelKey - The model key
2680
- * @returns {Object|null} The loaded model or null if not found
3053
+ /**
3054
+ * Get a model from the cache
3055
+ * @param {string} modelKey - The model key
3056
+ * @returns {Object|null} The loaded model or null if not found
2681
3057
  */
2682
3058
  )
2683
3059
  }, {
@@ -2686,8 +3062,8 @@ var ModelPreloader = /*#__PURE__*/function () {
2686
3062
  return this.modelCache.get(modelKey) || null;
2687
3063
  }
2688
3064
 
2689
- /**
2690
- * Clear the model cache
3065
+ /**
3066
+ * Clear the model cache
2691
3067
  */
2692
3068
  }, {
2693
3069
  key: "clearCache",
@@ -2695,9 +3071,9 @@ var ModelPreloader = /*#__PURE__*/function () {
2695
3071
  this.modelCache.clear();
2696
3072
  }
2697
3073
 
2698
- /**
2699
- * Get statistics about the model cache
2700
- * @returns {Object} Cache statistics
3074
+ /**
3075
+ * Get statistics about the model cache
3076
+ * @returns {Object} Cache statistics
2701
3077
  */
2702
3078
  }, {
2703
3079
  key: "getCacheStats",
@@ -2710,24 +3086,62 @@ var ModelPreloader = /*#__PURE__*/function () {
2710
3086
  };
2711
3087
  }
2712
3088
  }]);
2713
- }(); // Create singleton instance
2714
- var modelPreloader = new ModelPreloader();
3089
+ }(); // Create singleton instance with explicit methods
3090
+ var modelPreloader$1 = new ModelPreloader();
3091
+
3092
+ // Ensure the model preloader is fully initialized
3093
+ if (typeof window !== 'undefined') {
3094
+ // Only run in browser environment
3095
+ modelPreloader$1.initLoader().catch(function (err) {
3096
+ console.warn('Error initializing model preloader:', err);
3097
+ });
3098
+ }
2715
3099
 
2716
- var modelPreloader$1 = /*#__PURE__*/Object.freeze({
2717
- __proto__: null,
2718
- 'default': modelPreloader,
2719
- ModelPreloader: ModelPreloader
2720
- });
3100
+ // Create a simple proxy object with all methods explicitly defined
3101
+ // This helps ensure webpack correctly recognizes all methods
3102
+ var explicitModelPreloader = {
3103
+ // Core methods from original implementation
3104
+ preloadAllModels: function preloadAllModels(componentDictionary) {
3105
+ return modelPreloader$1.preloadAllModels(componentDictionary);
3106
+ },
3107
+ preloadModel: function preloadModel(modelKey, modelUrl) {
3108
+ return modelPreloader$1.preloadModel(modelKey, modelUrl);
3109
+ },
3110
+ getModel: function getModel(modelKey) {
3111
+ return modelPreloader$1.getModel(modelKey);
3112
+ },
3113
+ clearCache: function clearCache() {
3114
+ return modelPreloader$1.clearCache();
3115
+ },
3116
+ getCacheStats: function getCacheStats() {
3117
+ return modelPreloader$1.getCacheStats();
3118
+ },
3119
+ getModelUrlFromKey: function getModelUrlFromKey(modelKey) {
3120
+ return modelPreloader$1.getModelUrlFromKey(modelKey);
3121
+ },
3122
+ // Added methods
3123
+ loadComponentById: function loadComponentById(componentId, callback) {
3124
+ return modelPreloader$1.loadComponentById(componentId, callback);
3125
+ },
3126
+ getCachedModel: function getCachedModel(modelKey) {
3127
+ return modelPreloader$1.getCachedModel(modelKey);
3128
+ },
3129
+ getCacheKeys: function getCacheKeys() {
3130
+ return modelPreloader$1.getCacheKeys();
3131
+ },
3132
+ // Original model cache access
3133
+ modelCache: modelPreloader$1.modelCache
3134
+ };
2721
3135
 
2722
- /**
2723
- * Name Utilities
2724
- * Common helper functions for name and UUID generation
3136
+ /**
3137
+ * Name Utilities
3138
+ * Common helper functions for name and UUID generation
2725
3139
  */
2726
3140
 
2727
- /**
2728
- * Generate UUID from name using consistent transformation rules
2729
- * @param {string} name - The name to convert to UUID
2730
- * @returns {string} The generated UUID
3141
+ /**
3142
+ * Generate UUID from name using consistent transformation rules
3143
+ * @param {string} name - The name to convert to UUID
3144
+ * @returns {string} The generated UUID
2731
3145
  */
2732
3146
  function generateUuidFromName(name) {
2733
3147
  if (!name) return null;
@@ -2742,11 +3156,11 @@ function generateUuidFromName(name) {
2742
3156
  return uuid;
2743
3157
  }
2744
3158
 
2745
- /**
2746
- * Check if two names would generate the same UUID
2747
- * @param {string} name1 - First name
2748
- * @param {string} name2 - Second name
2749
- * @returns {boolean} Whether the names generate the same UUID
3159
+ /**
3160
+ * Check if two names would generate the same UUID
3161
+ * @param {string} name1 - First name
3162
+ * @param {string} name2 - Second name
3163
+ * @returns {boolean} Whether the names generate the same UUID
2750
3164
  */
2751
3165
  function namesGenerateSameUuid(name1, name2) {
2752
3166
  var uuid1 = generateUuidFromName(name1);
@@ -2754,11 +3168,11 @@ function namesGenerateSameUuid(name1, name2) {
2754
3168
  return uuid1 && uuid2 && uuid1 === uuid2;
2755
3169
  }
2756
3170
 
2757
- /**
2758
- * Find an object in a Three.js scene by hardcoded UUID with fallback strategies
2759
- * @param {THREE.Scene} scene - The Three.js scene to search
2760
- * @param {string} targetUuid - The UUID to search for
2761
- * @returns {THREE.Object3D|null} The found object or null
3171
+ /**
3172
+ * Find an object in a Three.js scene by hardcoded UUID with fallback strategies
3173
+ * @param {THREE.Scene} scene - The Three.js scene to search
3174
+ * @param {string} targetUuid - The UUID to search for
3175
+ * @returns {THREE.Object3D|null} The found object or null
2762
3176
  */
2763
3177
  function findObjectByHardcodedUuid(scene, targetUuid) {
2764
3178
  if (!scene || !targetUuid) return null;
@@ -2791,10 +3205,10 @@ function findObjectByHardcodedUuid(scene, targetUuid) {
2791
3205
  return foundObject;
2792
3206
  }
2793
3207
 
2794
- /**
2795
- * Get the hardcoded UUID for an object, prioritizing original over current
2796
- * @param {THREE.Object3D} object - The Three.js object
2797
- * @returns {string|null} The hardcoded UUID or null
3208
+ /**
3209
+ * Get the hardcoded UUID for an object, prioritizing original over current
3210
+ * @param {THREE.Object3D} object - The Three.js object
3211
+ * @returns {string|null} The hardcoded UUID or null
2798
3212
  */
2799
3213
  function getHardcodedUuid(object) {
2800
3214
  var _object$userData;
@@ -2825,9 +3239,9 @@ var nameUtils = /*#__PURE__*/Object.freeze({
2825
3239
  getHardcodedUuid: getHardcodedUuid
2826
3240
  });
2827
3241
 
2828
- /**
2829
- * ConnectionManager class
2830
- * Handles object connections in the pathfinding system with improved safety for missing data
3242
+ /**
3243
+ * ConnectionManager class
3244
+ * Handles object connections in the pathfinding system with improved safety for missing data
2831
3245
  */
2832
3246
  var ConnectionManager = /*#__PURE__*/function () {
2833
3247
  function ConnectionManager(sceneManager) {
@@ -2835,10 +3249,10 @@ var ConnectionManager = /*#__PURE__*/function () {
2835
3249
  this.sceneManager = sceneManager;
2836
3250
  }
2837
3251
 
2838
- /**
2839
- * Safely cluster connections by shared objects
2840
- * @param {Array<Object>} connections - Array of connections between objects (or null/undefined)
2841
- * @returns {Array<Object>} Array of clusters
3252
+ /**
3253
+ * Safely cluster connections by shared objects
3254
+ * @param {Array<Object>} connections - Array of connections between objects (or null/undefined)
3255
+ * @returns {Array<Object>} Array of clusters
2842
3256
  */
2843
3257
  return _createClass(ConnectionManager, [{
2844
3258
  key: "clusterConnections",
@@ -2937,9 +3351,9 @@ var ConnectionManager$1 = /*#__PURE__*/Object.freeze({
2937
3351
  'default': ConnectionManager
2938
3352
  });
2939
3353
 
2940
- /**
2941
- * Pathfinder class
2942
- * Enhanced version with better error handling for missing data
3354
+ /**
3355
+ * Pathfinder class
3356
+ * Enhanced version with better error handling for missing data
2943
3357
  */
2944
3358
  var Pathfinder = /*#__PURE__*/function () {
2945
3359
  function Pathfinder(sceneData) {
@@ -2948,9 +3362,9 @@ var Pathfinder = /*#__PURE__*/function () {
2948
3362
  this.connectionManager = new ConnectionManager();
2949
3363
  }
2950
3364
 
2951
- /**
2952
- * Find paths in the scene
2953
- * @returns {Array} Array of paths
3365
+ /**
3366
+ * Find paths in the scene
3367
+ * @returns {Array} Array of paths
2954
3368
  */
2955
3369
  return _createClass(Pathfinder, [{
2956
3370
  key: "findPaths",
@@ -2992,11 +3406,11 @@ var Pathfinder = /*#__PURE__*/function () {
2992
3406
  }
2993
3407
  }
2994
3408
 
2995
- /**
2996
- * Generate paths for a single cluster
2997
- * @param {Object} cluster - The cluster to generate paths for
2998
- * @returns {Array} Array of paths for this cluster
2999
- * @private
3409
+ /**
3410
+ * Generate paths for a single cluster
3411
+ * @param {Object} cluster - The cluster to generate paths for
3412
+ * @returns {Array} Array of paths for this cluster
3413
+ * @private
3000
3414
  */
3001
3415
  }, {
3002
3416
  key: "_generatePathsForCluster",
@@ -3033,8 +3447,8 @@ var PathfindingManager = /*#__PURE__*/function () {
3033
3447
  this.pathfinder = new Pathfinder(component === null || component === void 0 ? void 0 : component.sceneData);
3034
3448
  }
3035
3449
 
3036
- /**
3037
- * Get pathfinder version information
3450
+ /**
3451
+ * Get pathfinder version information
3038
3452
  */
3039
3453
  return _createClass(PathfindingManager, [{
3040
3454
  key: "getPathfinderVersionInfo",
@@ -3065,8 +3479,8 @@ var PathfindingManager = /*#__PURE__*/function () {
3065
3479
  }
3066
3480
  return getPathfinderVersionInfo;
3067
3481
  }()
3068
- /**
3069
- * Log pathfinder version information
3482
+ /**
3483
+ * Log pathfinder version information
3070
3484
  */
3071
3485
  )
3072
3486
  }, {
@@ -3109,8 +3523,8 @@ var PathfindingManager = /*#__PURE__*/function () {
3109
3523
  }
3110
3524
  return logPathfinderVersion;
3111
3525
  }()
3112
- /**
3113
- * Get path colors for visual distinction
3526
+ /**
3527
+ * Get path colors for visual distinction
3114
3528
  */
3115
3529
  )
3116
3530
  }, {
@@ -3120,8 +3534,8 @@ var PathfindingManager = /*#__PURE__*/function () {
3120
3534
  return colors[index % colors.length];
3121
3535
  }
3122
3536
 
3123
- /**
3124
- * Initialize pathfinder and create paths
3537
+ /**
3538
+ * Initialize pathfinder and create paths
3125
3539
  */
3126
3540
  }, {
3127
3541
  key: "initializePathfinder",
@@ -3175,8 +3589,8 @@ var PathfindingManager = /*#__PURE__*/function () {
3175
3589
  }
3176
3590
  return initializePathfinder;
3177
3591
  }()
3178
- /**
3179
- * Remove all existing paths from the scene
3592
+ /**
3593
+ * Remove all existing paths from the scene
3180
3594
  */
3181
3595
  )
3182
3596
  }, {
@@ -3217,8 +3631,8 @@ var PathfindingManager = /*#__PURE__*/function () {
3217
3631
  console.log("Removed ".concat(objectsToRemove.length, " path objects"));
3218
3632
  }
3219
3633
 
3220
- /**
3221
- * Material factory function to reduce duplication
3634
+ /**
3635
+ * Material factory function to reduce duplication
3222
3636
  */
3223
3637
  }, {
3224
3638
  key: "createPipeMaterial",
@@ -3233,8 +3647,8 @@ var PathfindingManager = /*#__PURE__*/function () {
3233
3647
  return material;
3234
3648
  }
3235
3649
 
3236
- /**
3237
- * Helper function to create pipe paths
3650
+ /**
3651
+ * Helper function to create pipe paths
3238
3652
  */
3239
3653
  }, {
3240
3654
  key: "createPipePaths",
@@ -3296,8 +3710,8 @@ var PathfindingManager = /*#__PURE__*/function () {
3296
3710
  // Create a singleton instance
3297
3711
  var pathfindingManager = null;
3298
3712
 
3299
- /**
3300
- * Get the global pathfinding manager instance
3713
+ /**
3714
+ * Get the global pathfinding manager instance
3301
3715
  */
3302
3716
  function getPathfindingManager() {
3303
3717
  var component = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
@@ -3388,8 +3802,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3388
3802
  this._update = this._update.bind(this);
3389
3803
  }
3390
3804
 
3391
- /**
3392
- * Start the performance monitor
3805
+ /**
3806
+ * Start the performance monitor
3393
3807
  */
3394
3808
  return _createClass(PerformanceMonitor, [{
3395
3809
  key: "start",
@@ -3406,8 +3820,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3406
3820
  logger.info('Performance monitoring started');
3407
3821
  }
3408
3822
 
3409
- /**
3410
- * Stop the performance monitor
3823
+ /**
3824
+ * Stop the performance monitor
3411
3825
  */
3412
3826
  }, {
3413
3827
  key: "stop",
@@ -3416,8 +3830,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3416
3830
  logger.info('Performance monitoring stopped');
3417
3831
  }
3418
3832
 
3419
- /**
3420
- * Reset statistics
3833
+ /**
3834
+ * Reset statistics
3421
3835
  */
3422
3836
  }, {
3423
3837
  key: "reset",
@@ -3445,8 +3859,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3445
3859
  logger.info('Performance statistics reset');
3446
3860
  }
3447
3861
 
3448
- /**
3449
- * Update method called every animation frame
3862
+ /**
3863
+ * Update method called every animation frame
3450
3864
  */
3451
3865
  }, {
3452
3866
  key: "_update",
@@ -3488,8 +3902,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3488
3902
  requestAnimationFrame(this._update);
3489
3903
  }
3490
3904
 
3491
- /**
3492
- * Update statistics for a specific metric
3905
+ /**
3906
+ * Update statistics for a specific metric
3493
3907
  */
3494
3908
  }, {
3495
3909
  key: "_updateStat",
@@ -3518,8 +3932,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3518
3932
  }, 0) / stats.history.length;
3519
3933
  }
3520
3934
 
3521
- /**
3522
- * Get WebGL info from the renderer
3935
+ /**
3936
+ * Get WebGL info from the renderer
3523
3937
  */
3524
3938
  }, {
3525
3939
  key: "_getWebGLInfo",
@@ -3552,8 +3966,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3552
3966
  this.stats.memory.programs = ((_info$programs = info.programs) === null || _info$programs === void 0 ? void 0 : _info$programs.length) || 0;
3553
3967
  }
3554
3968
 
3555
- /**
3556
- * Get system memory info
3969
+ /**
3970
+ * Get system memory info
3557
3971
  */
3558
3972
  }, {
3559
3973
  key: "_getMemoryInfo",
@@ -3569,8 +3983,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3569
3983
  }
3570
3984
  }
3571
3985
 
3572
- /**
3573
- * Get GPU info if available
3986
+ /**
3987
+ * Get GPU info if available
3574
3988
  */
3575
3989
  }, {
3576
3990
  key: "_getGPUInfo",
@@ -3592,8 +4006,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3592
4006
  this.stats.gpu.extensions = gl.getSupportedExtensions();
3593
4007
  }
3594
4008
 
3595
- /**
3596
- * Check for performance warnings
4009
+ /**
4010
+ * Check for performance warnings
3597
4011
  */
3598
4012
  }, {
3599
4013
  key: "_checkWarnings",
@@ -3666,8 +4080,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3666
4080
  }
3667
4081
  }
3668
4082
 
3669
- /**
3670
- * Register an event callback
4083
+ /**
4084
+ * Register an event callback
3671
4085
  */
3672
4086
  }, {
3673
4087
  key: "on",
@@ -3676,8 +4090,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3676
4090
  this.callbacks[event].push(callback);
3677
4091
  }
3678
4092
 
3679
- /**
3680
- * Remove an event callback
4093
+ /**
4094
+ * Remove an event callback
3681
4095
  */
3682
4096
  }, {
3683
4097
  key: "off",
@@ -3689,8 +4103,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3689
4103
  }
3690
4104
  }
3691
4105
 
3692
- /**
3693
- * Trigger callbacks for an event
4106
+ /**
4107
+ * Trigger callbacks for an event
3694
4108
  */
3695
4109
  }, {
3696
4110
  key: "_triggerCallbacks",
@@ -3705,8 +4119,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3705
4119
  });
3706
4120
  }
3707
4121
 
3708
- /**
3709
- * Log performance summary to console
4122
+ /**
4123
+ * Log performance summary to console
3710
4124
  */
3711
4125
  }, {
3712
4126
  key: "logSummary",
@@ -3727,8 +4141,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3727
4141
  return this.stats;
3728
4142
  }
3729
4143
 
3730
- /**
3731
- * Export performance data
4144
+ /**
4145
+ * Export performance data
3732
4146
  */
3733
4147
  }, {
3734
4148
  key: "exportData",
@@ -3742,8 +4156,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3742
4156
  };
3743
4157
  }
3744
4158
 
3745
- /**
3746
- * Get active warnings
4159
+ /**
4160
+ * Get active warnings
3747
4161
  */
3748
4162
  }, {
3749
4163
  key: "_getActiveWarnings",
@@ -3790,8 +4204,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3790
4204
  return warnings;
3791
4205
  }
3792
4206
 
3793
- /**
3794
- * Set warning thresholds
4207
+ /**
4208
+ * Set warning thresholds
3795
4209
  */
3796
4210
  }, {
3797
4211
  key: "setWarningThresholds",
@@ -3801,8 +4215,8 @@ var PerformanceMonitor$1 = /*#__PURE__*/function () {
3801
4215
  }]);
3802
4216
  }();
3803
4217
 
3804
- /**
3805
- * Performance UI class for displaying performance statistics
4218
+ /**
4219
+ * Performance UI class for displaying performance statistics
3806
4220
  */
3807
4221
  var PerformanceUI$1 = /*#__PURE__*/function () {
3808
4222
  function PerformanceUI(monitor, container) {
@@ -3818,8 +4232,8 @@ var PerformanceUI$1 = /*#__PURE__*/function () {
3818
4232
  this._setupUpdateLoop();
3819
4233
  }
3820
4234
 
3821
- /**
3822
- * Create the UI element
4235
+ /**
4236
+ * Create the UI element
3823
4237
  */
3824
4238
  return _createClass(PerformanceUI, [{
3825
4239
  key: "_createUI",
@@ -3872,8 +4286,8 @@ var PerformanceUI$1 = /*#__PURE__*/function () {
3872
4286
  this.element.style.pointerEvents = 'none';
3873
4287
  }
3874
4288
 
3875
- /**
3876
- * Set UI theme
4289
+ /**
4290
+ * Set UI theme
3877
4291
  */
3878
4292
  }, {
3879
4293
  key: "setTheme",
@@ -3890,8 +4304,8 @@ var PerformanceUI$1 = /*#__PURE__*/function () {
3890
4304
  }
3891
4305
  }
3892
4306
 
3893
- /**
3894
- * Setup update loop for refreshing the UI
4307
+ /**
4308
+ * Setup update loop for refreshing the UI
3895
4309
  */
3896
4310
  }, {
3897
4311
  key: "_setupUpdateLoop",
@@ -3929,8 +4343,8 @@ var PerformanceUI$1 = /*#__PURE__*/function () {
3929
4343
  setInterval(updateStats, 500);
3930
4344
  }
3931
4345
 
3932
- /**
3933
- * Get color for a metric based on its value
4346
+ /**
4347
+ * Get color for a metric based on its value
3934
4348
  */
3935
4349
  }, {
3936
4350
  key: "_getMetricColor",
@@ -3952,8 +4366,8 @@ var PerformanceUI$1 = /*#__PURE__*/function () {
3952
4366
  return "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")");
3953
4367
  }
3954
4368
 
3955
- /**
3956
- * Format number for display
4369
+ /**
4370
+ * Format number for display
3957
4371
  */
3958
4372
  }, {
3959
4373
  key: "_formatNumber",
@@ -3966,8 +4380,8 @@ var PerformanceUI$1 = /*#__PURE__*/function () {
3966
4380
  return number.toString();
3967
4381
  }
3968
4382
 
3969
- /**
3970
- * Show the UI
4383
+ /**
4384
+ * Show the UI
3971
4385
  */
3972
4386
  }, {
3973
4387
  key: "show",
@@ -3983,8 +4397,8 @@ var PerformanceUI$1 = /*#__PURE__*/function () {
3983
4397
  }
3984
4398
  }
3985
4399
 
3986
- /**
3987
- * Hide the UI
4400
+ /**
4401
+ * Hide the UI
3988
4402
  */
3989
4403
  }, {
3990
4404
  key: "hide",
@@ -3995,8 +4409,8 @@ var PerformanceUI$1 = /*#__PURE__*/function () {
3995
4409
  this.element.style.pointerEvents = 'none';
3996
4410
  }
3997
4411
 
3998
- /**
3999
- * Toggle visibility
4412
+ /**
4413
+ * Toggle visibility
4000
4414
  */
4001
4415
  }, {
4002
4416
  key: "toggle",
@@ -4008,8 +4422,8 @@ var PerformanceUI$1 = /*#__PURE__*/function () {
4008
4422
  }
4009
4423
  }
4010
4424
 
4011
- /**
4012
- * Clean up resources
4425
+ /**
4426
+ * Clean up resources
4013
4427
  */
4014
4428
  }, {
4015
4429
  key: "dispose",
@@ -4032,22 +4446,22 @@ var performanceMonitor$1 = /*#__PURE__*/Object.freeze({
4032
4446
  'default': performanceMonitor
4033
4447
  });
4034
4448
 
4035
- /**
4036
- * Class for managing scene export operations
4449
+ /**
4450
+ * Class for managing scene export operations
4037
4451
  */
4038
4452
  var SceneExportManager = /*#__PURE__*/function () {
4039
- /**
4040
- * Create a SceneExportManager
4041
- * @param {Object} componentInstance - The component instance containing scene data
4453
+ /**
4454
+ * Create a SceneExportManager
4455
+ * @param {Object} componentInstance - The component instance containing scene data
4042
4456
  */
4043
4457
  function SceneExportManager(componentInstance) {
4044
4458
  _classCallCheck(this, SceneExportManager);
4045
4459
  this.component = componentInstance;
4046
4460
  }
4047
4461
 
4048
- /**
4049
- * Export function that recreates the JSON data structure from current scene objects
4050
- * @returns {Object|null} The exported scene data as JSON object or null if export failed
4462
+ /**
4463
+ * Export function that recreates the JSON data structure from current scene objects
4464
+ * @returns {Object|null} The exported scene data as JSON object or null if export failed
4051
4465
  */
4052
4466
  return _createClass(SceneExportManager, [{
4053
4467
  key: "exportSceneData",
@@ -4215,10 +4629,10 @@ var SceneExportManager = /*#__PURE__*/function () {
4215
4629
  return exportData;
4216
4630
  }
4217
4631
 
4218
- /**
4219
- * Helper function to download the exported scene data as JSON file
4220
- * @param {string} filename - Optional filename for the export
4221
- * @returns {boolean} Success status of the download operation
4632
+ /**
4633
+ * Helper function to download the exported scene data as JSON file
4634
+ * @param {string} filename - Optional filename for the export
4635
+ * @returns {boolean} Success status of the download operation
4222
4636
  */
4223
4637
  }, {
4224
4638
  key: "downloadSceneExport",
@@ -4264,10 +4678,10 @@ var SceneExportManager = /*#__PURE__*/function () {
4264
4678
  }
4265
4679
  }
4266
4680
 
4267
- /**
4268
- * Export scene data as JSON string
4269
- * @param {boolean} pretty - Whether to format the JSON with indentation
4270
- * @returns {string|null} JSON string or null if export failed
4681
+ /**
4682
+ * Export scene data as JSON string
4683
+ * @param {boolean} pretty - Whether to format the JSON with indentation
4684
+ * @returns {string|null} JSON string or null if export failed
4271
4685
  */
4272
4686
  }, {
4273
4687
  key: "exportSceneDataAsString",
@@ -4280,9 +4694,9 @@ var SceneExportManager = /*#__PURE__*/function () {
4280
4694
  return pretty ? JSON.stringify(exportData, null, 2) : JSON.stringify(exportData);
4281
4695
  }
4282
4696
 
4283
- /**
4284
- * Get export metadata
4285
- * @returns {Object|null} Export metadata or null if scene is not available
4697
+ /**
4698
+ * Get export metadata
4699
+ * @returns {Object|null} Export metadata or null if scene is not available
4286
4700
  */
4287
4701
  }, {
4288
4702
  key: "getExportMetadata",
@@ -4305,10 +4719,10 @@ var SceneExportManager = /*#__PURE__*/function () {
4305
4719
  }]);
4306
4720
  }();
4307
4721
 
4308
- /**
4309
- * Factory function to get SceneExportManager instance
4310
- * @param {CentralPlantComponent} component - The component instance
4311
- * @returns {SceneExportManager} SceneExportManager instance
4722
+ /**
4723
+ * Factory function to get SceneExportManager instance
4724
+ * @param {CentralPlantComponent} component - The component instance
4725
+ * @returns {SceneExportManager} SceneExportManager instance
4312
4726
  */
4313
4727
  function getSceneExportManager(component) {
4314
4728
  return new SceneExportManager(component);
@@ -4416,8 +4830,8 @@ var SceneInitializationManager = /*#__PURE__*/function () {
4416
4830
  importThreeJSDependencies();
4417
4831
  }
4418
4832
 
4419
- /**
4420
- * Initialize the Three.js scene, camera, and renderer
4833
+ /**
4834
+ * Initialize the Three.js scene, camera, and renderer
4421
4835
  */
4422
4836
  return _createClass(SceneInitializationManager, [{
4423
4837
  key: "initializeScene",
@@ -4470,8 +4884,8 @@ var SceneInitializationManager = /*#__PURE__*/function () {
4470
4884
  }
4471
4885
  return initializeScene;
4472
4886
  }()
4473
- /**
4474
- * Setup the WebGL renderer
4887
+ /**
4888
+ * Setup the WebGL renderer
4475
4889
  */
4476
4890
  )
4477
4891
  }, {
@@ -4548,8 +4962,8 @@ var SceneInitializationManager = /*#__PURE__*/function () {
4548
4962
  }
4549
4963
  return setupRenderer;
4550
4964
  }()
4551
- /**
4552
- * Setup orbit controls
4965
+ /**
4966
+ * Setup orbit controls
4553
4967
  */
4554
4968
  )
4555
4969
  }, {
@@ -4576,8 +4990,8 @@ var SceneInitializationManager = /*#__PURE__*/function () {
4576
4990
  return this.setupControlsInternal(container, options);
4577
4991
  }
4578
4992
 
4579
- /**
4580
- * Internal method to setup controls after dependencies are loaded
4993
+ /**
4994
+ * Internal method to setup controls after dependencies are loaded
4581
4995
  */
4582
4996
  }, {
4583
4997
  key: "setupControlsInternal",
@@ -4609,8 +5023,8 @@ var SceneInitializationManager = /*#__PURE__*/function () {
4609
5023
  return component.controls;
4610
5024
  }
4611
5025
 
4612
- /**
4613
- * Initialize performance monitoring
5026
+ /**
5027
+ * Initialize performance monitoring
4614
5028
  */
4615
5029
  }, {
4616
5030
  key: "initializePerformanceMonitoring",
@@ -4671,8 +5085,8 @@ var SceneInitializationManager = /*#__PURE__*/function () {
4671
5085
  }
4672
5086
  return initializePerformanceMonitoring;
4673
5087
  }()
4674
- /**
4675
- * Expose performance monitoring to global scope for debugging
5088
+ /**
5089
+ * Expose performance monitoring to global scope for debugging
4676
5090
  */
4677
5091
  )
4678
5092
  }, {
@@ -4729,8 +5143,8 @@ var SceneInitializationManager = /*#__PURE__*/function () {
4729
5143
  }
4730
5144
  }
4731
5145
 
4732
- /**
4733
- * Setup resize handler for responsive rendering
5146
+ /**
5147
+ * Setup resize handler for responsive rendering
4734
5148
  */
4735
5149
  }, {
4736
5150
  key: "setupResizeHandler",
@@ -4766,8 +5180,8 @@ var SceneInitializationManager = /*#__PURE__*/function () {
4766
5180
  logger.info('Resize handler initialized');
4767
5181
  }
4768
5182
 
4769
- /**
4770
- * Cleanup resize handler
5183
+ /**
5184
+ * Cleanup resize handler
4771
5185
  */
4772
5186
  }, {
4773
5187
  key: "cleanupResizeHandler",
@@ -4783,8 +5197,8 @@ var SceneInitializationManager = /*#__PURE__*/function () {
4783
5197
  // Create a singleton instance
4784
5198
  var sceneInitializationManager = null;
4785
5199
 
4786
- /**
4787
- * Get the global scene initialization manager instance
5200
+ /**
5201
+ * Get the global scene initialization manager instance
4788
5202
  */
4789
5203
  function getSceneInitializationManager() {
4790
5204
  var component = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
@@ -4837,15 +5251,15 @@ var sceneInitializationManager$2 = /*#__PURE__*/Object.freeze({
4837
5251
  'default': sceneInitializationManager$1
4838
5252
  });
4839
5253
 
4840
- /**
4841
- * SceneOperationsManager
4842
- * Handles scene loading, clearing, and object management operations
5254
+ /**
5255
+ * SceneOperationsManager
5256
+ * Handles scene loading, clearing, and object management operations
4843
5257
  */
4844
5258
 
4845
5259
  var THREE$1;
4846
5260
 
4847
- /**
4848
- * Dynamically import ThreeJS when in browser environment
5261
+ /**
5262
+ * Dynamically import ThreeJS when in browser environment
4849
5263
  */
4850
5264
  function importDependencies$1() {
4851
5265
  return _importDependencies$1.apply(this, arguments);
@@ -4880,13 +5294,13 @@ function _importDependencies$1() {
4880
5294
  return _importDependencies$1.apply(this, arguments);
4881
5295
  }
4882
5296
 
4883
- /**
4884
- * Class for managing scene operations like loading, clearing, and object management
5297
+ /**
5298
+ * Class for managing scene operations like loading, clearing, and object management
4885
5299
  */
4886
5300
  var SceneOperationsManager = /*#__PURE__*/function () {
4887
- /**
4888
- * Create a SceneOperationsManager
4889
- * @param {Object} component - The component with scene, camera, renderer, etc.
5301
+ /**
5302
+ * Create a SceneOperationsManager
5303
+ * @param {Object} component - The component with scene, camera, renderer, etc.
4890
5304
  */
4891
5305
  function SceneOperationsManager(component) {
4892
5306
  _classCallCheck(this, SceneOperationsManager);
@@ -4898,8 +5312,8 @@ var SceneOperationsManager = /*#__PURE__*/function () {
4898
5312
  }
4899
5313
  }
4900
5314
 
4901
- /**
4902
- * Clear scene objects while preserving base environment
5315
+ /**
5316
+ * Clear scene objects while preserving base environment
4903
5317
  */
4904
5318
  return _createClass(SceneOperationsManager, [{
4905
5319
  key: "clearSceneObjects",
@@ -4975,9 +5389,9 @@ var SceneOperationsManager = /*#__PURE__*/function () {
4975
5389
  console.log('✅ Scene clear operation completed');
4976
5390
  }
4977
5391
 
4978
- /**
4979
- * Ensure transform controls remain properly attached after scene operations
4980
- * @param {boolean} attachToSelected - Whether to attach to selected object
5392
+ /**
5393
+ * Ensure transform controls remain properly attached after scene operations
5394
+ * @param {boolean} attachToSelected - Whether to attach to selected object
4981
5395
  */
4982
5396
  }, {
4983
5397
  key: "ensureTransformControlsAttached",
@@ -4995,8 +5409,8 @@ var SceneOperationsManager = /*#__PURE__*/function () {
4995
5409
  }
4996
5410
  }
4997
5411
 
4998
- /**
4999
- * Deselect any selected object
5412
+ /**
5413
+ * Deselect any selected object
5000
5414
  */
5001
5415
  }, {
5002
5416
  key: "deselectObject",
@@ -5008,9 +5422,9 @@ var SceneOperationsManager = /*#__PURE__*/function () {
5008
5422
  }
5009
5423
  }
5010
5424
 
5011
- /**
5012
- * Load scene data from JSON
5013
- * @param {Object|string} sceneData - Scene data object or JSON string
5425
+ /**
5426
+ * Load scene data from JSON
5427
+ * @param {Object|string} sceneData - Scene data object or JSON string
5014
5428
  */
5015
5429
  }, {
5016
5430
  key: "loadSceneData",
@@ -5052,10 +5466,10 @@ var SceneOperationsManager = /*#__PURE__*/function () {
5052
5466
  return true;
5053
5467
  }
5054
5468
 
5055
- /**
5056
- * Load scene objects from parsed scene data
5057
- * @param {Object} sceneObject - The root scene object from parsed data
5058
- * @private
5469
+ /**
5470
+ * Load scene objects from parsed scene data
5471
+ * @param {Object} sceneObject - The root scene object from parsed data
5472
+ * @private
5059
5473
  */
5060
5474
  }, {
5061
5475
  key: "_loadSceneObjects",
@@ -5074,11 +5488,11 @@ var SceneOperationsManager = /*#__PURE__*/function () {
5074
5488
  }
5075
5489
  }
5076
5490
 
5077
- /**
5078
- * Create a Three.js object from object data
5079
- * @param {Object} objectData - The object data from parsed scene
5080
- * @returns {THREE.Object3D} The created object or null if invalid
5081
- * @private
5491
+ /**
5492
+ * Create a Three.js object from object data
5493
+ * @param {Object} objectData - The object data from parsed scene
5494
+ * @returns {THREE.Object3D} The created object or null if invalid
5495
+ * @private
5082
5496
  */
5083
5497
  }, {
5084
5498
  key: "_createObjectFromData",
@@ -5136,11 +5550,11 @@ var SceneOperationsManager = /*#__PURE__*/function () {
5136
5550
  return object;
5137
5551
  }
5138
5552
 
5139
- /**
5140
- * Set up object properties based on type
5141
- * @param {THREE.Object3D} object - The object to set up
5142
- * @param {Object} objectData - The object data
5143
- * @private
5553
+ /**
5554
+ * Set up object properties based on type
5555
+ * @param {THREE.Object3D} object - The object to set up
5556
+ * @param {Object} objectData - The object data
5557
+ * @private
5144
5558
  */
5145
5559
  }, {
5146
5560
  key: "_setupObjectByType",
@@ -5209,10 +5623,10 @@ var SceneOperationsManager = /*#__PURE__*/function () {
5209
5623
  }
5210
5624
  }
5211
5625
 
5212
- /**
5213
- * Load connections from scene data
5214
- * @param {Array} connections - Array of connection objects
5215
- * @private
5626
+ /**
5627
+ * Load connections from scene data
5628
+ * @param {Array} connections - Array of connection objects
5629
+ * @private
5216
5630
  */
5217
5631
  }, {
5218
5632
  key: "_loadConnections",
@@ -5246,10 +5660,46 @@ var SceneOperationsManager = /*#__PURE__*/function () {
5246
5660
  });
5247
5661
  }
5248
5662
 
5249
- /**
5250
- * Find object in scene by name
5251
- * @param {string} name - The name to search for
5252
- * @returns {THREE.Object3D|null} The found object or null
5663
+ /**
5664
+ * Ensure scene elements are visible
5665
+ * Makes sure all scene elements are properly visible and within camera view
5666
+ */
5667
+ }, {
5668
+ key: "ensureSceneElementsVisible",
5669
+ value: function ensureSceneElementsVisible() {
5670
+ var component = this.component;
5671
+ if (!component.scene || !component.camera) {
5672
+ console.warn('⚠️ Cannot ensure scene elements visibility: scene or camera missing');
5673
+ return false;
5674
+ }
5675
+
5676
+ // Reset camera position if it's too close to origin
5677
+ if (component.camera.position.length() < 5) {
5678
+ component.camera.position.set(10, 10, 10);
5679
+ component.camera.lookAt(0, 0, 0);
5680
+ if (component.controls) {
5681
+ component.controls.target.set(0, 0, 0);
5682
+ component.controls.update();
5683
+ }
5684
+ }
5685
+
5686
+ // Check if scene has any visible objects
5687
+ var hasVisibleObjects = false;
5688
+ component.scene.traverse(function (child) {
5689
+ if (child.visible && child !== component.scene && !child.isLight) {
5690
+ hasVisibleObjects = true;
5691
+ }
5692
+ });
5693
+ if (!hasVisibleObjects) {
5694
+ console.warn('⚠️ Scene has no visible objects');
5695
+ }
5696
+ return hasVisibleObjects;
5697
+ }
5698
+
5699
+ /**
5700
+ * Find object in scene by name
5701
+ * @param {string} name - The name to search for
5702
+ * @returns {THREE.Object3D|null} The found object or null
5253
5703
  */
5254
5704
  }, {
5255
5705
  key: "findObjectByName",
@@ -5266,10 +5716,10 @@ var SceneOperationsManager = /*#__PURE__*/function () {
5266
5716
  return foundObject;
5267
5717
  }
5268
5718
 
5269
- /**
5270
- * Find object in scene by UUID
5271
- * @param {string} uuid - The UUID to search for
5272
- * @returns {THREE.Object3D|null} The found object or null
5719
+ /**
5720
+ * Find object in scene by UUID
5721
+ * @param {string} uuid - The UUID to search for
5722
+ * @returns {THREE.Object3D|null} The found object or null
5273
5723
  */
5274
5724
  }, {
5275
5725
  key: "findObjectByUuid",
@@ -5286,9 +5736,9 @@ var SceneOperationsManager = /*#__PURE__*/function () {
5286
5736
  return foundObject;
5287
5737
  }
5288
5738
 
5289
- /**
5290
- * Remove an object from the scene
5291
- * @param {THREE.Object3D} object - The object to remove
5739
+ /**
5740
+ * Remove an object from the scene
5741
+ * @param {THREE.Object3D} object - The object to remove
5292
5742
  */
5293
5743
  }, {
5294
5744
  key: "removeObject",
@@ -5319,12 +5769,12 @@ var SceneOperationsManager = /*#__PURE__*/function () {
5319
5769
  return true;
5320
5770
  }
5321
5771
 
5322
- /**
5323
- * Duplicate an object in the scene
5324
- * @param {THREE.Object3D} sourceObject - The object to duplicate
5325
- * @param {Object} [options] - Options for duplication
5326
- * @param {THREE.Vector3} [options.positionOffset] - Position offset for the duplicate
5327
- * @returns {THREE.Object3D|null} The duplicated object or null if failed
5772
+ /**
5773
+ * Duplicate an object in the scene
5774
+ * @param {THREE.Object3D} sourceObject - The object to duplicate
5775
+ * @param {Object} [options] - Options for duplication
5776
+ * @param {THREE.Vector3} [options.positionOffset] - Position offset for the duplicate
5777
+ * @returns {THREE.Object3D|null} The duplicated object or null if failed
5328
5778
  */
5329
5779
  }, {
5330
5780
  key: "duplicateObject",
@@ -5360,10 +5810,10 @@ var SceneOperationsManager = /*#__PURE__*/function () {
5360
5810
  }]);
5361
5811
  }();
5362
5812
 
5363
- /**
5364
- * Factory function to get SceneOperationsManager instance
5365
- * @param {CentralPlantComponent} component - The component instance
5366
- * @returns {SceneOperationsManager} SceneOperationsManager instance
5813
+ /**
5814
+ * Factory function to get SceneOperationsManager instance
5815
+ * @param {CentralPlantComponent} component - The component instance
5816
+ * @returns {SceneOperationsManager} SceneOperationsManager instance
5367
5817
  */
5368
5818
  function getSceneOperationsManager(component) {
5369
5819
  return new SceneOperationsManager(component);
@@ -5376,9 +5826,51 @@ var sceneOperationsManager = /*#__PURE__*/Object.freeze({
5376
5826
  'default': SceneOperationsManager
5377
5827
  });
5378
5828
 
5829
+ /**
5830
+ * Helper function to get asset paths that works in both bundled and modular contexts
5831
+ * @param {string} assetPath - Relative path from the assets directory
5832
+ * @returns {string} - The full path to the asset
5833
+ */
5834
+ function getAssetPath(assetPath) {
5835
+ // Strip leading slash if present
5836
+ if (assetPath.startsWith('/')) {
5837
+ assetPath = assetPath.substring(1);
5838
+ }
5839
+
5840
+ // In browser context, check for different module formats
5841
+ if (typeof window !== 'undefined') {
5842
+ // For bundled version, assets should be in dist/bundle/assets/
5843
+ // For ESM/CJS, assets should be in their respective folders
5844
+
5845
+ // Try to determine if we're using the bundled version or ESM/CJS
5846
+ var isBundled = typeof CentralPlantUtils !== 'undefined';
5847
+
5848
+ // Check if we're running in a Nuxt.js environment (localhost:3000 is a common dev server)
5849
+ var isNuxtEnv = window.location.hostname === 'localhost' && (window.location.port === '3000' || window.location.port === '3001');
5850
+ if (isNuxtEnv) {
5851
+ // In Nuxt.js environment, assets are likely in the /static directory at the root
5852
+ return "/".concat(assetPath); // No /assets/ prefix in the URL path
5853
+ } else if (isBundled) {
5854
+ // Get the base URL for the module
5855
+ var baseUrl = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('index.js', document.baseURI).href));
5856
+ // In bundled format, assets are in the assets folder next to the bundle
5857
+ return new URL("./assets/".concat(assetPath), baseUrl).href;
5858
+ } else {
5859
+ // Get the base URL for the module
5860
+ var _baseUrl = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('index.js', document.baseURI).href));
5861
+ // In ESM/CJS format, need to go up relative to current module path
5862
+ return new URL("../assets/".concat(assetPath), _baseUrl).href;
5863
+ }
5864
+ }
5865
+
5866
+ // In Node.js context
5867
+ return "assets/".concat(assetPath);
5868
+ }
5379
5869
  var TEXTURE_SETS = {
5380
5870
  // Light metallic texture using the gravel_embedded_concrete with metallic properties
5381
5871
  light_metal: {
5872
+ // Local path first, with fallback to S3
5873
+ localPath: 'textures/gravel_embedded_concrete_1k',
5382
5874
  path: 'https://central-plant-assets.s3.us-east-1.amazonaws.com/textures/gravel_embedded_concrete_1k',
5383
5875
  files: {
5384
5876
  diffuse: 'diffuse.jpg',
@@ -5404,6 +5896,8 @@ var TEXTURE_SETS = {
5404
5896
  }
5405
5897
  },
5406
5898
  brick: {
5899
+ // Local path first, with fallback to S3
5900
+ localPath: 'textures/pavement_03_1k',
5407
5901
  path: 'https://central-plant-assets.s3.us-east-1.amazonaws.com/textures/pavement_03_1k',
5408
5902
  files: {
5409
5903
  diffuse: 'diffuse.jpg',
@@ -5426,6 +5920,8 @@ var TEXTURE_SETS = {
5426
5920
  }
5427
5921
  },
5428
5922
  gravel_embedded_concrete: {
5923
+ // Local path first, with fallback to S3
5924
+ localPath: 'textures/gravel_embedded_concrete_1k',
5429
5925
  path: 'https://central-plant-assets.s3.us-east-1.amazonaws.com/textures/gravel_embedded_concrete_1k',
5430
5926
  files: {
5431
5927
  diffuse: 'diffuse.jpg',
@@ -5446,8 +5942,8 @@ var TEXTURE_SETS = {
5446
5942
  }
5447
5943
  };
5448
5944
 
5449
- /**
5450
- * Create a Three.js texture with appropriate settings
5945
+ /**
5946
+ * Create a Three.js texture with appropriate settings
5451
5947
  */
5452
5948
  function createTexture(textureLoader, url) {
5453
5949
  var repeat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
@@ -5458,86 +5954,467 @@ function createTexture(textureLoader, url) {
5458
5954
  textureLoader = new THREE__namespace.TextureLoader();
5459
5955
  }
5460
5956
  try {
5461
- var texture = textureLoader.load(url);
5462
- texture.wrapS = THREE__namespace.RepeatWrapping;
5463
- texture.wrapT = THREE__namespace.RepeatWrapping;
5464
- texture.repeat.set(repeat.x, repeat.y);
5465
- texture.colorSpace = THREE__namespace.SRGBColorSpace;
5466
- return texture;
5957
+ console.log("\uD83D\uDD0D Beginning texture load from: ".concat(url));
5958
+
5959
+ // Create placeholder texture for immediate use
5960
+ // This will prevent the "no image data found" warning
5961
+ var placeholderTexture = createPlaceholderTexture(0xcccccc);
5962
+
5963
+ // Create a promise to track when the real texture is loaded
5964
+ var loadPromise = new Promise(function (resolve, reject) {
5965
+ textureLoader.load(url, function (loadedTexture) {
5966
+ console.log("\u2705 Successfully loaded texture from: ".concat(url));
5967
+
5968
+ // Check if the loaded texture has valid image data
5969
+ if (loadedTexture.image && (loadedTexture.image instanceof HTMLImageElement && loadedTexture.image.complete || !(loadedTexture.image instanceof HTMLImageElement))) {
5970
+ console.log("\u2705 Image data verified for ".concat(url));
5971
+
5972
+ // Explicitly set colorSpace for all textures to ensure proper rendering
5973
+ if (loadedTexture.colorSpace !== undefined) {
5974
+ loadedTexture.colorSpace = THREE__namespace.SRGBColorSpace;
5975
+ console.log("\uD83C\uDFA8 Set colorSpace to SRGBColorSpace for ".concat(url));
5976
+ } else if (loadedTexture.encoding !== undefined) {
5977
+ loadedTexture.encoding = THREE__namespace.sRGBEncoding;
5978
+ console.log("\uD83C\uDFA8 Set encoding to sRGBEncoding for ".concat(url));
5979
+ }
5980
+
5981
+ // Configure texture properties
5982
+ loadedTexture.wrapS = THREE__namespace.RepeatWrapping;
5983
+ loadedTexture.wrapT = THREE__namespace.RepeatWrapping;
5984
+ loadedTexture.repeat.set(repeat.x, repeat.y);
5985
+ loadedTexture.needsUpdate = true;
5986
+ resolve(loadedTexture);
5987
+ } else {
5988
+ console.warn("\u26A0\uFE0F Loaded texture from ".concat(url, " but image data is not ready"));
5989
+ reject(new Error('Texture loaded but image data not ready'));
5990
+ }
5991
+ }, function (progressEvent) {
5992
+ if (progressEvent.lengthComputable) {
5993
+ var percentComplete = progressEvent.loaded / progressEvent.total * 100;
5994
+ console.log("Loading texture ".concat(url, ": ").concat(Math.round(percentComplete), "% complete"));
5995
+ }
5996
+ }, function (error) {
5997
+ console.error("\u274C Error loading texture from ".concat(url, ":"), error);
5998
+ reject(error);
5999
+ });
6000
+ });
6001
+
6002
+ // Configure placeholder texture properties
6003
+ placeholderTexture.wrapS = THREE__namespace.RepeatWrapping;
6004
+ placeholderTexture.wrapT = THREE__namespace.RepeatWrapping;
6005
+ placeholderTexture.repeat.set(repeat.x, repeat.y);
6006
+
6007
+ // Store the load promise and url for later reference
6008
+ placeholderTexture.loadPromise = loadPromise;
6009
+ placeholderTexture.url = url;
6010
+
6011
+ // When the real texture loads, we'll swap it in
6012
+ loadPromise.then(function (realTexture) {
6013
+ // Copy all properties from the real texture to the placeholder
6014
+ Object.keys(realTexture).forEach(function (key) {
6015
+ // Skip certain properties that shouldn't be copied
6016
+ if (['uuid', 'id', 'version', 'isTexture'].includes(key)) return;
6017
+ placeholderTexture[key] = realTexture[key];
6018
+ });
6019
+ placeholderTexture.image = realTexture.image;
6020
+ placeholderTexture.source = realTexture.source;
6021
+ placeholderTexture.needsUpdate = true;
6022
+ console.log("\uD83D\uDD04 Updated placeholder texture with real image data for ".concat(url));
6023
+ }).catch(function () {
6024
+ console.warn("\u26A0\uFE0F Using placeholder for texture: ".concat(url));
6025
+ });
6026
+ return placeholderTexture;
5467
6027
  } catch (error) {
5468
6028
  console.error("Failed to load texture: ".concat(url), error);
5469
- return null;
6029
+ return createPlaceholderTexture(0xdd3333); // Red placeholder for errors
5470
6030
  }
5471
6031
  }
5472
6032
 
5473
- /**
5474
- * Load a texture set and create a material
6033
+ /**
6034
+ * Load a texture set and create a material
5475
6035
  */
5476
6036
  function loadTextureSetAndCreateMaterial(_x, _x2) {
5477
6037
  return _loadTextureSetAndCreateMaterial.apply(this, arguments);
5478
6038
  }
6039
+
6040
+ /**
6041
+ * Check if a texture has valid image data
6042
+ * @param {THREE.Texture} texture - The texture to check
6043
+ * @returns {boolean} - Whether the texture has valid image data
6044
+ */
5479
6045
  function _loadTextureSetAndCreateMaterial() {
5480
- _loadTextureSetAndCreateMaterial = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(component, textureSetName) {
5481
- var textureSet, textureLoader, repeat, loadedTextures, loadTexture, material;
5482
- return _regenerator().w(function (_context) {
5483
- while (1) switch (_context.n) {
6046
+ _loadTextureSetAndCreateMaterial = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(component, textureSetName) {
6047
+ var _textureSet$materialP2;
6048
+ var textureSet, textureLoader, repeat, loadedTextures, checkFileExists, loadTexture, texturePromises, hasAnyTextures, _textureSet$materialP, fallbackColor, texturesWithValidData, _i2, _Object$entries, _Object$entries$_i, type, texture, material;
6049
+ return _regenerator().w(function (_context4) {
6050
+ while (1) switch (_context4.n) {
5484
6051
  case 0:
5485
6052
  if (component) {
5486
- _context.n = 1;
6053
+ _context4.n = 1;
5487
6054
  break;
5488
6055
  }
5489
6056
  console.warn('Component is required for texture loading');
5490
- return _context.a(2, new THREE__namespace.MeshStandardMaterial({
6057
+ return _context4.a(2, new THREE__namespace.MeshStandardMaterial({
5491
6058
  color: 0xaaaaaa
5492
6059
  }));
5493
6060
  case 1:
5494
6061
  textureSet = TEXTURE_SETS[textureSetName];
5495
6062
  if (textureSet) {
5496
- _context.n = 2;
6063
+ _context4.n = 2;
5497
6064
  break;
5498
6065
  }
5499
6066
  console.warn("Texture set not found: ".concat(textureSetName));
5500
- return _context.a(2, new THREE__namespace.MeshStandardMaterial({
6067
+ return _context4.a(2, new THREE__namespace.MeshStandardMaterial({
5501
6068
  color: 0xaaaaaa
5502
6069
  }));
5503
6070
  case 2:
5504
- textureLoader = component.textureLoader || new THREE__namespace.TextureLoader();
6071
+ console.log("\uD83C\uDF08 Loading texture set: ".concat(textureSetName));
6072
+ textureLoader = component.textureLoader || new THREE__namespace.TextureLoader(); // Set cross-origin attribute to allow texture loading from different domains
6073
+ if (typeof textureLoader.setCrossOrigin === 'function') {
6074
+ textureLoader.setCrossOrigin('anonymous');
6075
+ console.log('📡 Set cross-origin to anonymous for texture loading');
6076
+ }
5505
6077
  repeat = textureSet.repeat || {
5506
6078
  x: 1,
5507
6079
  y: 1
5508
6080
  };
5509
- loadedTextures = {}; // Function to load a specific texture from the set
5510
- loadTexture = function loadTexture(type) {
5511
- if (!textureSet.files[type]) return null;
5512
- var url = "".concat(textureSet.path, "/").concat(textureSet.files[type]);
5513
- return createTexture(textureLoader, url, repeat);
5514
- }; // Load all textures in the set
5515
- Object.keys(textureSet.files).forEach(function (type) {
5516
- loadedTextures[type] = loadTexture(type);
6081
+ loadedTextures = {}; // Function to check if a file exists
6082
+ checkFileExists = /*#__PURE__*/function () {
6083
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(url) {
6084
+ return _regenerator().w(function (_context) {
6085
+ while (1) switch (_context.n) {
6086
+ case 0:
6087
+ if (!(typeof window !== 'undefined')) {
6088
+ _context.n = 1;
6089
+ break;
6090
+ }
6091
+ return _context.a(2, new Promise(function (resolve) {
6092
+ var img = new Image();
6093
+ img.onload = function () {
6094
+ return resolve(true);
6095
+ };
6096
+ img.onerror = function () {
6097
+ return resolve(false);
6098
+ };
6099
+ img.src = url;
6100
+ setTimeout(function () {
6101
+ return resolve(false);
6102
+ }, 2000);
6103
+ }));
6104
+ case 1:
6105
+ return _context.a(2, false);
6106
+ }
6107
+ }, _callee);
6108
+ }));
6109
+ return function checkFileExists(_x3) {
6110
+ return _ref.apply(this, arguments);
6111
+ };
6112
+ }(); // Function to load a specific texture from the set
6113
+ loadTexture = /*#__PURE__*/function () {
6114
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(type) {
6115
+ var paths, _i, _paths, path, exists;
6116
+ return _regenerator().w(function (_context2) {
6117
+ while (1) switch (_context2.n) {
6118
+ case 0:
6119
+ if (textureSet.files[type]) {
6120
+ _context2.n = 1;
6121
+ break;
6122
+ }
6123
+ return _context2.a(2, null);
6124
+ case 1:
6125
+ // Try multiple paths to find the texture
6126
+ paths = []; // 1. Try local bundled path first
6127
+ if (textureSet.localPath) {
6128
+ paths.push(getAssetPath("".concat(textureSet.localPath, "/").concat(textureSet.files[type])));
6129
+ }
6130
+
6131
+ // 2. Try direct path to static folder
6132
+ paths.push("/textures/".concat(textureSetName, "_1k/").concat(textureSet.files[type]));
6133
+
6134
+ // 3. Try remote path as fallback
6135
+ if (textureSet.path) {
6136
+ paths.push("".concat(textureSet.path, "/").concat(textureSet.files[type]));
6137
+ }
6138
+ console.log("\uD83D\uDD0D Will try loading texture ".concat(type, " from paths:"), paths);
6139
+
6140
+ // Try each path until one works
6141
+ _i = 0, _paths = paths;
6142
+ case 2:
6143
+ if (!(_i < _paths.length)) {
6144
+ _context2.n = 6;
6145
+ break;
6146
+ }
6147
+ path = _paths[_i];
6148
+ console.log("\uD83D\uDD04 Checking if texture exists at: ".concat(path));
6149
+ _context2.n = 3;
6150
+ return checkFileExists(path);
6151
+ case 3:
6152
+ exists = _context2.v;
6153
+ if (!exists) {
6154
+ _context2.n = 4;
6155
+ break;
6156
+ }
6157
+ console.log("\u2705 Texture found at: ".concat(path));
6158
+ return _context2.a(2, createTexture(textureLoader, path, repeat));
6159
+ case 4:
6160
+ console.log("\u274C Texture not found at: ".concat(path));
6161
+ case 5:
6162
+ _i++;
6163
+ _context2.n = 2;
6164
+ break;
6165
+ case 6:
6166
+ console.error("\u274C Failed to load ".concat(type, " texture from any path"));
6167
+ return _context2.a(2, null);
6168
+ }
6169
+ }, _callee2);
6170
+ }));
6171
+ return function loadTexture(_x4) {
6172
+ return _ref2.apply(this, arguments);
6173
+ };
6174
+ }(); // Load all textures in the set
6175
+ texturePromises = Object.keys(textureSet.files).map(/*#__PURE__*/function () {
6176
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(type) {
6177
+ return _regenerator().w(function (_context3) {
6178
+ while (1) switch (_context3.n) {
6179
+ case 0:
6180
+ _context3.n = 1;
6181
+ return loadTexture(type);
6182
+ case 1:
6183
+ loadedTextures[type] = _context3.v;
6184
+ return _context3.a(2, {
6185
+ type: type,
6186
+ texture: loadedTextures[type]
6187
+ });
6188
+ }
6189
+ }, _callee3);
6190
+ }));
6191
+ return function (_x5) {
6192
+ return _ref3.apply(this, arguments);
6193
+ };
6194
+ }());
6195
+ _context4.n = 3;
6196
+ return Promise.all(texturePromises);
6197
+ case 3:
6198
+ // Log successful texture loads
6199
+ Object.entries(loadedTextures).forEach(function (_ref4) {
6200
+ var _ref5 = _slicedToArray(_ref4, 2),
6201
+ type = _ref5[0],
6202
+ texture = _ref5[1];
6203
+ console.log("".concat(texture ? '✅' : '❌', " ").concat(type, " texture: ").concat(texture ? 'Loaded' : 'Failed'));
6204
+ }); // Create material with textures and properties
6205
+ console.log('Creating material with loaded textures and properties:', textureSet.materialProps);
6206
+
6207
+ // Check if we have at least one texture that's not null
6208
+ hasAnyTextures = Object.values(loadedTextures).some(function (texture) {
6209
+ return texture !== null;
5517
6210
  });
6211
+ if (hasAnyTextures) {
6212
+ _context4.n = 4;
6213
+ break;
6214
+ }
6215
+ console.warn('⚠️ No textures loaded successfully for material. Using fallback color material.');
6216
+
6217
+ // Create a colored material as fallback
6218
+ fallbackColor = ((_textureSet$materialP = textureSet.materialProps) === null || _textureSet$materialP === void 0 ? void 0 : _textureSet$materialP.color) || 0xaaaaaa;
6219
+ return _context4.a(2, new THREE__namespace.MeshStandardMaterial({
6220
+ color: fallbackColor,
6221
+ roughness: 0.8,
6222
+ metalness: 0.2,
6223
+ side: THREE__namespace.DoubleSide
6224
+ }));
6225
+ case 4:
6226
+ // Verify if the textures have valid image data
6227
+ texturesWithValidData = {};
6228
+ for (_i2 = 0, _Object$entries = Object.entries(loadedTextures); _i2 < _Object$entries.length; _i2++) {
6229
+ _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2), type = _Object$entries$_i[0], texture = _Object$entries$_i[1];
6230
+ if (texture && hasValidImageData(texture)) {
6231
+ console.log("\u2705 Texture '".concat(type, "' has valid image data"));
6232
+ texturesWithValidData[type] = texture;
6233
+ } else if (texture) {
6234
+ console.log("\u26A0\uFE0F Texture '".concat(type, "' doesn't have valid image data yet"));
6235
+ // Keep the texture even if it doesn't have valid data yet
6236
+ // Our createTexture function now handles this with placeholders
6237
+ texturesWithValidData[type] = texture;
6238
+ }
6239
+ }
6240
+
6241
+ // Create the standard material with loaded textures
6242
+ material = new THREE__namespace.MeshStandardMaterial(_objectSpread2(_objectSpread2({
6243
+ map: texturesWithValidData.diffuse,
6244
+ normalMap: texturesWithValidData.normal,
6245
+ roughnessMap: texturesWithValidData.roughness,
6246
+ metalnessMap: texturesWithValidData.metalness,
6247
+ aoMap: texturesWithValidData.ao,
6248
+ displacementMap: texturesWithValidData.displacement
6249
+ }, textureSet.materialProps), {}, {
6250
+ side: THREE__namespace.DoubleSide // Always set DoubleSide to avoid rendering issues
6251
+ })); // Ensure color is applied even if textures are loading
6252
+
6253
+ if ((!material.map || !hasValidImageData(material.map)) && (_textureSet$materialP2 = textureSet.materialProps) !== null && _textureSet$materialP2 !== void 0 && _textureSet$materialP2.color) {
6254
+ material.color = new THREE__namespace.Color(textureSet.materialProps.color);
6255
+ console.log("\uD83C\uDFA8 Applied fallback color: #".concat(material.color.getHexString()));
6256
+ }
5518
6257
 
5519
- // Create material with textures and properties
5520
- material = new THREE__namespace.MeshStandardMaterial(_objectSpread2({
5521
- map: loadedTextures.diffuse,
5522
- normalMap: loadedTextures.normal,
5523
- roughnessMap: loadedTextures.roughness,
5524
- metalnessMap: loadedTextures.metalness,
5525
- aoMap: loadedTextures.ao,
5526
- displacementMap: loadedTextures.displacement
5527
- }, textureSet.materialProps)); // Add the environment map if available from the component
6258
+ // Make sure material updates when textures load
6259
+ material.needsUpdate = true;
6260
+
6261
+ // Add the environment map if available from the component
5528
6262
  if (component.scene && component.scene.environment) {
5529
6263
  material.envMap = component.scene.environment;
6264
+ console.log('🌐 Added environment map to material');
5530
6265
  }
5531
- return _context.a(2, material);
6266
+
6267
+ // Set up texture load monitoring for each texture with a load promise
6268
+ Object.entries(texturesWithValidData).forEach(function (_ref6) {
6269
+ var _ref7 = _slicedToArray(_ref6, 2),
6270
+ type = _ref7[0],
6271
+ texture = _ref7[1];
6272
+ if (texture && texture.loadPromise) {
6273
+ texture.loadPromise.then(function () {
6274
+ console.log("\u2705 Texture '".concat(type, "' finished loading, updating material"));
6275
+ material.needsUpdate = true;
6276
+ }).catch(function (error) {
6277
+ console.warn("\u26A0\uFE0F Failed to load '".concat(type, "' texture:"), error);
6278
+ });
6279
+ }
6280
+ });
6281
+ return _context4.a(2, material);
5532
6282
  }
5533
- }, _callee);
6283
+ }, _callee4);
5534
6284
  }));
5535
6285
  return _loadTextureSetAndCreateMaterial.apply(this, arguments);
5536
6286
  }
6287
+ function hasValidImageData(texture) {
6288
+ if (!texture) return false;
6289
+
6290
+ // Check if image exists
6291
+ if (!texture.image) return false;
6292
+
6293
+ // For image objects, check width and height
6294
+ if (texture.image instanceof HTMLImageElement || texture.image instanceof HTMLCanvasElement) {
6295
+ return texture.image.width > 0 && texture.image.height > 0;
6296
+ }
6297
+
6298
+ // For other image types (like ImageBitmap)
6299
+ if (texture.image.data && Array.isArray(texture.image.data)) {
6300
+ return texture.image.data.length > 0;
6301
+ }
6302
+ return false;
6303
+ }
6304
+
6305
+ /**
6306
+ * Create a placeholder colored texture when image loading fails
6307
+ * @param {number} color - The color for the placeholder texture
6308
+ * @param {number} size - The size of the texture in pixels
6309
+ * @returns {THREE.Texture} - A colored placeholder texture
6310
+ */
6311
+ function createPlaceholderTexture() {
6312
+ var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0xcccccc;
6313
+ var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 64;
6314
+ // Create a canvas element
6315
+ var canvas = document.createElement('canvas');
6316
+ canvas.width = size;
6317
+ canvas.height = size;
6318
+
6319
+ // Get the 2D context and fill with color
6320
+ var context = canvas.getContext('2d');
6321
+ if (context) {
6322
+ var hexColor = '#' + color.toString(16).padStart(6, '0');
6323
+ context.fillStyle = hexColor;
6324
+ context.fillRect(0, 0, size, size);
6325
+
6326
+ // Optional: Add a pattern to make it obvious it's a placeholder
6327
+ context.fillStyle = '#' + (color + 0x222222 & 0xffffff).toString(16);
6328
+ context.fillRect(0, 0, size / 2, size / 2);
6329
+ context.fillRect(size / 2, size / 2, size / 2, size / 2);
6330
+ }
6331
+
6332
+ // Create a texture from the canvas
6333
+ var texture = new THREE__namespace.CanvasTexture(canvas);
6334
+ texture.needsUpdate = true;
6335
+
6336
+ // Set proper color space
6337
+ if (texture.colorSpace !== undefined) {
6338
+ texture.colorSpace = THREE__namespace.SRGBColorSpace;
6339
+ } else if (texture.encoding !== undefined) {
6340
+ texture.encoding = THREE__namespace.sRGBEncoding;
6341
+ }
6342
+ return texture;
6343
+ }
6344
+
6345
+ /**
6346
+ * Helper function to check Three.js compatibility and configuration
6347
+ */
6348
+ function checkThreeJSCompatibility() {
6349
+ console.group('🔍 Three.js Compatibility Check');
6350
+
6351
+ // Check Three.js version
6352
+ console.log('Three.js version:', THREE__namespace.REVISION);
6353
+
6354
+ // Check color space constants
6355
+ console.log('Color space support:', {
6356
+ SRGBColorSpace: typeof THREE__namespace.SRGBColorSpace !== 'undefined',
6357
+ LinearSRGBColorSpace: typeof THREE__namespace.LinearSRGBColorSpace !== 'undefined',
6358
+ sRGBEncoding: typeof THREE__namespace.sRGBEncoding !== 'undefined'
6359
+ });
6360
+
6361
+ // Check texture-related features
6362
+ console.log('Texture features:', {
6363
+ TextureLoader: typeof THREE__namespace.TextureLoader === 'function',
6364
+ RepeatWrapping: typeof THREE__namespace.RepeatWrapping !== 'undefined',
6365
+ MirroredRepeatWrapping: typeof THREE__namespace.MirroredRepeatWrapping !== 'undefined'
6366
+ });
6367
+
6368
+ // Check shader and material features
6369
+ console.log('Material features:', {
6370
+ MeshStandardMaterial: typeof THREE__namespace.MeshStandardMaterial === 'function',
6371
+ MeshBasicMaterial: typeof THREE__namespace.MeshBasicMaterial === 'function',
6372
+ ShaderMaterial: typeof THREE__namespace.ShaderMaterial === 'function'
6373
+ });
6374
+ console.groupEnd();
6375
+ return {
6376
+ version: THREE__namespace.REVISION,
6377
+ hasNewColorSpace: typeof THREE__namespace.SRGBColorSpace !== 'undefined',
6378
+ hasOldEncoding: typeof THREE__namespace.sRGBEncoding !== 'undefined',
6379
+ hasTextureLoader: typeof THREE__namespace.TextureLoader === 'function'
6380
+ };
6381
+ }
6382
+ function forceUpdateMaterials(scene) {
6383
+ if (!scene) return;
6384
+ console.log('🔄 Forcing update on all scene materials...');
6385
+ var materialCount = 0;
6386
+ scene.traverse(function (node) {
6387
+ if (node.isMesh && node.material) {
6388
+ var materials = Array.isArray(node.material) ? node.material : [node.material];
6389
+ materials.forEach(function (material) {
6390
+ if (material) {
6391
+ material.needsUpdate = true;
6392
+ materialCount++;
6393
+
6394
+ // Ensure maps are properly set
6395
+ if (material.map) {
6396
+ material.map.needsUpdate = true;
6397
+ }
6398
+ if (material.normalMap) {
6399
+ material.normalMap.needsUpdate = true;
6400
+ }
6401
+ if (material.roughnessMap) {
6402
+ material.roughnessMap.needsUpdate = true;
6403
+ }
6404
+ }
6405
+ });
6406
+ }
6407
+ });
6408
+ console.log("\u2705 Updated ".concat(materialCount, " materials in the scene"));
6409
+ }
5537
6410
  var textureConfig = {
5538
6411
  TEXTURE_SETS: TEXTURE_SETS,
5539
6412
  createTexture: createTexture,
5540
- loadTextureSetAndCreateMaterial: loadTextureSetAndCreateMaterial
6413
+ loadTextureSetAndCreateMaterial: loadTextureSetAndCreateMaterial,
6414
+ checkThreeJSCompatibility: checkThreeJSCompatibility,
6415
+ forceUpdateMaterials: forceUpdateMaterials,
6416
+ hasValidImageData: hasValidImageData,
6417
+ createPlaceholderTexture: createPlaceholderTexture
5541
6418
  };
5542
6419
 
5543
6420
  var textureConfig$1 = /*#__PURE__*/Object.freeze({
@@ -5545,25 +6422,27 @@ var textureConfig$1 = /*#__PURE__*/Object.freeze({
5545
6422
  TEXTURE_SETS: TEXTURE_SETS,
5546
6423
  createTexture: createTexture,
5547
6424
  loadTextureSetAndCreateMaterial: loadTextureSetAndCreateMaterial,
6425
+ checkThreeJSCompatibility: checkThreeJSCompatibility,
6426
+ forceUpdateMaterials: forceUpdateMaterials,
5548
6427
  'default': textureConfig
5549
6428
  });
5550
6429
 
5551
- /**
5552
- * Transform Controls Manager for Three.js
5553
- * Provides modular object transformation capabilities with position, rotation, and scale controls
6430
+ /**
6431
+ * Transform Controls Manager for Three.js
6432
+ * Provides modular object transformation capabilities with position, rotation, and scale controls
5554
6433
  */
5555
6434
 
5556
6435
  var THREE;
5557
6436
  var TransformControls$2;
5558
6437
 
5559
- /**
5560
- * Dynamically import ThreeJS and TransformControls when in browser environment
6438
+ /**
6439
+ * Dynamically import ThreeJS and TransformControls when in browser environment
5561
6440
  */
5562
6441
  function importDependencies() {
5563
6442
  return _importDependencies.apply(this, arguments);
5564
6443
  }
5565
- /**
5566
- * Class for managing object transform controls in a 3D scene
6444
+ /**
6445
+ * Class for managing object transform controls in a 3D scene
5567
6446
  */
5568
6447
  function _importDependencies() {
5569
6448
  _importDependencies = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
@@ -5618,12 +6497,12 @@ function _importDependencies() {
5618
6497
  return _importDependencies.apply(this, arguments);
5619
6498
  }
5620
6499
  var TransformControlsManager = /*#__PURE__*/function () {
5621
- /**
5622
- * Create a TransformControlsManager
5623
- * @param {THREE.Scene} scene - The Three.js scene
5624
- * @param {THREE.Camera} camera - The Three.js camera
5625
- * @param {THREE.WebGLRenderer} renderer - The Three.js renderer
5626
- * @param {THREE.OrbitControls} orbitControls - Optional orbit controls for camera
6500
+ /**
6501
+ * Create a TransformControlsManager
6502
+ * @param {THREE.Scene} scene - The Three.js scene
6503
+ * @param {THREE.Camera} camera - The Three.js camera
6504
+ * @param {THREE.WebGLRenderer} renderer - The Three.js renderer
6505
+ * @param {THREE.OrbitControls} orbitControls - Optional orbit controls for camera
5627
6506
  */
5628
6507
  function TransformControlsManager(scene, camera, renderer) {
5629
6508
  var _this = this;
@@ -5708,8 +6587,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
5708
6587
  }
5709
6588
  }
5710
6589
 
5711
- /**
5712
- * Initialize the transform controls
6590
+ /**
6591
+ * Initialize the transform controls
5713
6592
  */
5714
6593
  return _createClass(TransformControlsManager, [{
5715
6594
  key: "init",
@@ -5738,9 +6617,9 @@ var TransformControlsManager = /*#__PURE__*/function () {
5738
6617
  }
5739
6618
  return init;
5740
6619
  }()
5741
- /**
5742
- * Register event callbacks
5743
- * @param {Object} callbacks - Object containing callback functions
6620
+ /**
6621
+ * Register event callbacks
6622
+ * @param {Object} callbacks - Object containing callback functions
5744
6623
  */
5745
6624
  )
5746
6625
  }, {
@@ -5763,8 +6642,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
5763
6642
  }
5764
6643
  }
5765
6644
 
5766
- /**
5767
- * Create transform controls and add to scene
6645
+ /**
6646
+ * Create transform controls and add to scene
5768
6647
  */
5769
6648
  }, {
5770
6649
  key: "createTransformControls",
@@ -5797,8 +6676,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
5797
6676
  }
5798
6677
  }
5799
6678
 
5800
- /**
5801
- * Set up event listeners for transform controls
6679
+ /**
6680
+ * Set up event listeners for transform controls
5802
6681
  */
5803
6682
  }, {
5804
6683
  key: "setupEventListeners",
@@ -5866,8 +6745,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
5866
6745
  }
5867
6746
  }
5868
6747
 
5869
- /**
5870
- * Set up keyboard controls for transform operations
6748
+ /**
6749
+ * Set up keyboard controls for transform operations
5871
6750
  */
5872
6751
  }, {
5873
6752
  key: "setupKeyboardControls",
@@ -5954,8 +6833,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
5954
6833
  document.addEventListener('keydown', this.eventHandlers.keydown);
5955
6834
  }
5956
6835
 
5957
- /**
5958
- * Remove all event listeners
6836
+ /**
6837
+ * Remove all event listeners
5959
6838
  */
5960
6839
  }, {
5961
6840
  key: "removeEventListeners",
@@ -5975,9 +6854,9 @@ var TransformControlsManager = /*#__PURE__*/function () {
5975
6854
  }
5976
6855
  }
5977
6856
 
5978
- /**
5979
- * Select an object for transformation
5980
- * @param {THREE.Object3D} object - The object to transform
6857
+ /**
6858
+ * Select an object for transformation
6859
+ * @param {THREE.Object3D} object - The object to transform
5981
6860
  */
5982
6861
  }, {
5983
6862
  key: "selectObject",
@@ -6008,8 +6887,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
6008
6887
  return object;
6009
6888
  }
6010
6889
 
6011
- /**
6012
- * Deselect the currently selected object
6890
+ /**
6891
+ * Deselect the currently selected object
6013
6892
  */
6014
6893
  }, {
6015
6894
  key: "deselectObject",
@@ -6039,9 +6918,9 @@ var TransformControlsManager = /*#__PURE__*/function () {
6039
6918
  return null;
6040
6919
  }
6041
6920
 
6042
- /**
6043
- * Set transformation mode
6044
- * @param {string} mode - The transform mode ('translate', 'rotate', or 'scale')
6921
+ /**
6922
+ * Set transformation mode
6923
+ * @param {string} mode - The transform mode ('translate', 'rotate', or 'scale')
6045
6924
  */
6046
6925
  }, {
6047
6926
  key: "setMode",
@@ -6071,8 +6950,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
6071
6950
  }
6072
6951
  }
6073
6952
 
6074
- /**
6075
- * Toggle coordinate space between world and local
6953
+ /**
6954
+ * Toggle coordinate space between world and local
6076
6955
  */
6077
6956
  }, {
6078
6957
  key: "toggleSpace",
@@ -6082,8 +6961,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
6082
6961
  this.transformControls.setSpace(this.currentSpace);
6083
6962
  }
6084
6963
 
6085
- /**
6086
- * Toggle visibility of transform controls
6964
+ /**
6965
+ * Toggle visibility of transform controls
6087
6966
  */
6088
6967
  }, {
6089
6968
  key: "toggleVisibility",
@@ -6094,9 +6973,9 @@ var TransformControlsManager = /*#__PURE__*/function () {
6094
6973
  }
6095
6974
  }
6096
6975
 
6097
- /**
6098
- * Set enabled state of transform controls
6099
- * @param {boolean} enabled - Whether transform controls should be enabled
6976
+ /**
6977
+ * Set enabled state of transform controls
6978
+ * @param {boolean} enabled - Whether transform controls should be enabled
6100
6979
  */
6101
6980
  }, {
6102
6981
  key: "setEnabled",
@@ -6113,8 +6992,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
6113
6992
  }
6114
6993
  }
6115
6994
 
6116
- /**
6117
- * Update axis visibility based on config
6995
+ /**
6996
+ * Update axis visibility based on config
6118
6997
  */
6119
6998
  }, {
6120
6999
  key: "updateAxisVisibility",
@@ -6125,9 +7004,9 @@ var TransformControlsManager = /*#__PURE__*/function () {
6125
7004
  this.transformControls.showZ = this.config.showZ;
6126
7005
  }
6127
7006
 
6128
- /**
6129
- * Show bounding box for an object
6130
- * @param {THREE.Object3D} object - The object to show bounding box for
7007
+ /**
7008
+ * Show bounding box for an object
7009
+ * @param {THREE.Object3D} object - The object to show bounding box for
6131
7010
  */
6132
7011
  }, {
6133
7012
  key: "showBoundingBox",
@@ -6154,8 +7033,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
6154
7033
  object.userData.worldBoundingBox = boundingBox;
6155
7034
  }
6156
7035
 
6157
- /**
6158
- * Hide bounding box helper
7036
+ /**
7037
+ * Hide bounding box helper
6159
7038
  */
6160
7039
  }, {
6161
7040
  key: "hideBoundingBox",
@@ -6166,8 +7045,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
6166
7045
  }
6167
7046
  }
6168
7047
 
6169
- /**
6170
- * Update bounding box for selected object
7048
+ /**
7049
+ * Update bounding box for selected object
6171
7050
  */
6172
7051
  }, {
6173
7052
  key: "updateBoundingBox",
@@ -6189,10 +7068,10 @@ var TransformControlsManager = /*#__PURE__*/function () {
6189
7068
  }
6190
7069
  }
6191
7070
 
6192
- /**
6193
- * Capture object transformation data
6194
- * @param {THREE.Object3D} object - The object to capture transform from
6195
- * @returns {Object} Object containing position, rotation and scale data
7071
+ /**
7072
+ * Capture object transformation data
7073
+ * @param {THREE.Object3D} object - The object to capture transform from
7074
+ * @returns {Object} Object containing position, rotation and scale data
6196
7075
  */
6197
7076
  }, {
6198
7077
  key: "captureObjectTransform",
@@ -6217,12 +7096,12 @@ var TransformControlsManager = /*#__PURE__*/function () {
6217
7096
  };
6218
7097
  }
6219
7098
 
6220
- /**
6221
- * Set snap values for transformations
6222
- * @param {Object} options - Snap options
6223
- * @param {number} options.translation - Translation snap value
6224
- * @param {number} options.rotation - Rotation snap value in degrees
6225
- * @param {number} options.scale - Scale snap value
7099
+ /**
7100
+ * Set snap values for transformations
7101
+ * @param {Object} options - Snap options
7102
+ * @param {number} options.translation - Translation snap value
7103
+ * @param {number} options.rotation - Rotation snap value in degrees
7104
+ * @param {number} options.scale - Scale snap value
6226
7105
  */
6227
7106
  }, {
6228
7107
  key: "setSnapValues",
@@ -6251,9 +7130,9 @@ var TransformControlsManager = /*#__PURE__*/function () {
6251
7130
  }
6252
7131
  }
6253
7132
 
6254
- /**
6255
- * Set size of transform controls
6256
- * @param {number} size - The size factor for transform controls
7133
+ /**
7134
+ * Set size of transform controls
7135
+ * @param {number} size - The size factor for transform controls
6257
7136
  */
6258
7137
  }, {
6259
7138
  key: "setSize",
@@ -6264,8 +7143,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
6264
7143
  }
6265
7144
  }
6266
7145
 
6267
- /**
6268
- * Clean up resources and remove event listeners
7146
+ /**
7147
+ * Clean up resources and remove event listeners
6269
7148
  */
6270
7149
  }, {
6271
7150
  key: "dispose",
@@ -6284,10 +7163,10 @@ var TransformControlsManager = /*#__PURE__*/function () {
6284
7163
  console.log('🧹 TransformControlsManager disposed');
6285
7164
  }
6286
7165
 
6287
- /**
6288
- * Ensures transform controls are properly attached to the scene
6289
- * @param {boolean} allowVisible - Whether to allow controls to be visible when reattached
6290
- * @returns {boolean} - True if controls were reattached, false if already attached
7166
+ /**
7167
+ * Ensures transform controls are properly attached to the scene
7168
+ * @param {boolean} allowVisible - Whether to allow controls to be visible when reattached
7169
+ * @returns {boolean} - True if controls were reattached, false if already attached
6291
7170
  */
6292
7171
  }, {
6293
7172
  key: "ensureSceneAttachment",
@@ -6308,9 +7187,9 @@ var TransformControlsManager = /*#__PURE__*/function () {
6308
7187
  return false; // Already properly attached
6309
7188
  }
6310
7189
 
6311
- /**
6312
- * Get current transform data for the selected object
6313
- * @returns {Object|null} Object containing position, rotation, scale, and world coordinates
7190
+ /**
7191
+ * Get current transform data for the selected object
7192
+ * @returns {Object|null} Object containing position, rotation, scale, and world coordinates
6314
7193
  */
6315
7194
  }, {
6316
7195
  key: "getTransformData",
@@ -6360,13 +7239,13 @@ var TransformControlsManager = /*#__PURE__*/function () {
6360
7239
  }]);
6361
7240
  }();
6362
7241
 
6363
- /**
6364
- * Factory function to get TransformControlsManager instance
6365
- * @param {THREE.Scene} scene - The Three.js scene
6366
- * @param {THREE.Camera} camera - The Three.js camera
6367
- * @param {THREE.WebGLRenderer} renderer - The Three.js renderer
6368
- * @param {THREE.OrbitControls} orbitControls - Optional orbit controls for camera
6369
- * @returns {TransformControlsManager} TransformControlsManager instance
7242
+ /**
7243
+ * Factory function to get TransformControlsManager instance
7244
+ * @param {THREE.Scene} scene - The Three.js scene
7245
+ * @param {THREE.Camera} camera - The Three.js camera
7246
+ * @param {THREE.WebGLRenderer} renderer - The Three.js renderer
7247
+ * @param {THREE.OrbitControls} orbitControls - Optional orbit controls for camera
7248
+ * @returns {TransformControlsManager} TransformControlsManager instance
6370
7249
  */
6371
7250
  function getTransformControlsManager(scene, camera, renderer, orbitControls) {
6372
7251
  return new TransformControlsManager(scene, camera, renderer, orbitControls);
@@ -6379,60 +7258,62 @@ var transformControlsManager = /*#__PURE__*/Object.freeze({
6379
7258
  'default': TransformControlsManager
6380
7259
  });
6381
7260
 
6382
- /**
6383
- * @module CentralPlant/Utils
6384
- * @description Central Plant Utilities Module
6385
- *
6386
- * This is the main entry point for all utility functions and classes
6387
- * used in the Central Plant application. Import this module to access
6388
- * all utility functions through a single interface.
6389
- *
6390
- * @example
6391
- * // Import the entire utilities module
6392
- * import CentralPlant from 'central-plant';
6393
- *
6394
- * // Use a specific utility
6395
- * CentralPlant.modelPreloader.preloadAllModels(...);
6396
- *
6397
- * @example
6398
- * // Import specific modules
6399
- * import { modelPreloader, nameUtils } from 'CentralPlant';
6400
- *
6401
- * // Use them directly
6402
- * modelPreloader.preloadAllModels(...);
6403
- *
6404
- * @example
6405
- * // Import common functions directly
6406
- * import { getHardcodedUuid, logger } from 'CentralPlant';
6407
- *
6408
- * // Use functions directly
6409
- * const uuid = getHardcodedUuid(object);
6410
- * logger.info('Operation completed');
7261
+ /**
7262
+ * @module CentralPlant/Utils
7263
+ * @description Central Plant Utilities Module
7264
+ *
7265
+ * This is the main entry point for all utility functions and classes
7266
+ * used in the Central Plant application. Import this module to access
7267
+ * all utility functions through a single interface.
7268
+ *
7269
+ * @example
7270
+ * // Import the entire utilities module
7271
+ * import CentralPlant from 'central-plant';
7272
+ *
7273
+ * // Use a specific utility
7274
+ * CentralPlant.modelPreloader.preloadAllModels(...);
7275
+ *
7276
+ * @example
7277
+ * // Import specific modules
7278
+ * import { modelPreloader, nameUtils } from 'CentralPlant';
7279
+ *
7280
+ * // Use them directly
7281
+ * modelPreloader.preloadAllModels(...);
7282
+ *
7283
+ * @example
7284
+ * // Import common functions directly
7285
+ * import { getHardcodedUuid, logger } from 'CentralPlant';
7286
+ *
7287
+ * // Use functions directly
7288
+ * const uuid = getHardcodedUuid(object);
7289
+ * logger.info('Operation completed');
6411
7290
  */
7291
+ // Use the explicit modelPreloader object as the named export
7292
+ var modelPreloader = explicitModelPreloader;
6412
7293
 
6413
- /**
6414
- * Central API object that provides access to all utility modules
6415
- * @type {Object}
6416
- * @property {Object} animation - Animation management utilities
6417
- * @property {Object} component - Component management utilities
6418
- * @property {Object} debug - Debugging and logging utilities
6419
- * @property {Object} disposal - Resource disposal utilities
6420
- * @property {Object} environment - 3D environment management utilities
6421
- * @property {Object} hotReload - Hot reload handling utilities
6422
- * @property {Object} keyboardControls - Keyboard controls management
6423
- * @property {Object} modelPreloader - Model preloading utilities
6424
- * @property {Object} name - Name and UUID management utilities
6425
- * @property {Object} pathfinding - Pathfinding utilities
6426
- * @property {Object} performance - Performance monitoring utilities
6427
- * @property {Object} sceneExport - Scene export utilities
6428
- * @property {Object} sceneInitialization - Scene initialization utilities
6429
- * @property {Object} sceneOperations - Scene operations utilities
6430
- * @property {Object} texture - Texture management utilities
6431
- * @property {Object} transformControls - Transform controls utilities
6432
- * @property {Object} pathfinder - Pathfinder utilities
6433
- * @property {Object} connectionManager - Connection management utilities
7294
+ /**
7295
+ * Central API object that provides access to all utility modules
7296
+ * @type {Object}
7297
+ * @property {Object} animation - Animation management utilities
7298
+ * @property {Object} component - Component management utilities
7299
+ * @property {Object} debug - Debugging and logging utilities
7300
+ * @property {Object} disposal - Resource disposal utilities
7301
+ * @property {Object} environment - 3D environment management utilities
7302
+ * @property {Object} hotReload - Hot reload handling utilities
7303
+ * @property {Object} keyboardControls - Keyboard controls management
7304
+ * @property {Object} modelPreloader - Model preloading utilities
7305
+ * @property {Object} name - Name and UUID management utilities
7306
+ * @property {Object} pathfinding - Pathfinding utilities
7307
+ * @property {Object} performance - Performance monitoring utilities
7308
+ * @property {Object} sceneExport - Scene export utilities
7309
+ * @property {Object} sceneInitialization - Scene initialization utilities
7310
+ * @property {Object} sceneOperations - Scene operations utilities
7311
+ * @property {Object} texture - Texture management utilities
7312
+ * @property {Object} transformControls - Transform controls utilities
7313
+ * @property {Object} pathfinder - Pathfinder utilities
7314
+ * @property {Object} connectionManager - Connection management utilities
6434
7315
  */
6435
- var CentralPlantUtils = {
7316
+ var CentralPlantUtils$1 = {
6436
7317
  animation: animationManager$1,
6437
7318
  component: componentManager$1,
6438
7319
  debug: debugLogger,
@@ -6440,7 +7321,7 @@ var CentralPlantUtils = {
6440
7321
  environment: environmentManager$2,
6441
7322
  hotReload: hotReloadManager$1,
6442
7323
  keyboardControls: keyboardControlsManager$1,
6443
- modelPreloader: modelPreloader$1,
7324
+ modelPreloader: modelPreloader,
6444
7325
  name: nameUtils,
6445
7326
  pathfinding: pathfindingManager$2,
6446
7327
  performance: performanceMonitor$1,
@@ -14233,7 +15114,7 @@ exports.Pathfinder = Pathfinder$1;
14233
15114
  exports.animationManager = animationManager$1;
14234
15115
  exports.componentManager = componentManager$1;
14235
15116
  exports.debugLogger = debugLogger;
14236
- exports["default"] = CentralPlantUtils;
15117
+ exports["default"] = CentralPlantUtils$1;
14237
15118
  exports.disposalManager = disposalManager$1;
14238
15119
  exports.environmentManager = environmentManager$2;
14239
15120
  exports.findObjectByHardcodedUuid = findObjectByHardcodedUuid;
@@ -14246,7 +15127,7 @@ exports.hotReloadManager = hotReloadManager$1;
14246
15127
  exports.keyboardControlsManager = keyboardControlsManager$1;
14247
15128
  exports.logger = logger;
14248
15129
  exports.modelLogger = modelLogger;
14249
- exports.modelPreloader = modelPreloader$1;
15130
+ exports.modelPreloader = modelPreloader;
14250
15131
  exports.nameUtils = nameUtils;
14251
15132
  exports.pathfinderLogger = pathfinderLogger;
14252
15133
  exports.pathfindingManager = pathfindingManager$2;