@2112-lab/central-plant 0.1.4 → 0.1.6

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 (88) hide show
  1. package/dist/bundle/index.js +33146 -1
  2. package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +432 -1
  3. package/dist/cjs/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1448 -1
  4. package/dist/cjs/node_modules/three/examples/jsm/controls/OrbitControls.js +1853 -1
  5. package/dist/cjs/node_modules/three/examples/jsm/exporters/GLTFExporter.js +3537 -1
  6. package/dist/cjs/node_modules/three/examples/jsm/exporters/OBJExporter.js +305 -1
  7. package/dist/cjs/node_modules/three/examples/jsm/exporters/PLYExporter.js +542 -1
  8. package/dist/cjs/node_modules/three/examples/jsm/exporters/STLExporter.js +218 -1
  9. package/dist/cjs/node_modules/three/examples/jsm/loaders/DRACOLoader.js +683 -1
  10. package/dist/cjs/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4811 -1
  11. package/dist/cjs/node_modules/three/examples/jsm/loaders/RGBELoader.js +480 -1
  12. package/dist/cjs/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +309 -1
  13. package/dist/cjs/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +120 -1
  14. package/dist/cjs/src/analysis/analysis.js +560 -1
  15. package/dist/cjs/src/analysis/testing.js +958 -1
  16. package/dist/cjs/src/core/centralPlant.js +1149 -1
  17. package/dist/cjs/src/core/debugLogger.js +175 -1
  18. package/dist/cjs/src/core/mathUtils.js +574 -1
  19. package/dist/cjs/src/core/nameUtils.js +93 -1
  20. package/dist/cjs/src/data/export.js +716 -1
  21. package/dist/cjs/src/data/import.js +380 -1
  22. package/dist/cjs/src/data/numerics.js +522 -1
  23. package/dist/cjs/src/helpers/sceneHelper.js +572 -1
  24. package/dist/cjs/src/index.js +69 -1
  25. package/dist/cjs/src/managers/components/animationManager.js +123 -1
  26. package/dist/cjs/src/managers/components/componentManager.js +332 -1
  27. package/dist/cjs/src/managers/components/pathfindingManager.js +1441 -1
  28. package/dist/cjs/src/managers/controls/TransformControls.js +1063 -1
  29. package/dist/cjs/src/managers/controls/cameraControlsManager.js +79 -1
  30. package/dist/cjs/src/managers/controls/dragDropManager.js +1026 -1
  31. package/dist/cjs/src/managers/controls/keyboardControlsManager.js +395 -1
  32. package/dist/cjs/src/managers/controls/transformControlsManager.js +1807 -1
  33. package/dist/cjs/src/managers/environment/environmentManager.js +714 -1
  34. package/dist/cjs/src/managers/environment/textureConfig.js +229 -1
  35. package/dist/cjs/src/managers/scene/sceneExportManager.js +264 -1
  36. package/dist/cjs/src/managers/scene/sceneInitializationManager.js +346 -1
  37. package/dist/cjs/src/managers/scene/sceneOperationsManager.js +1509 -1
  38. package/dist/cjs/src/managers/scene/sceneTooltipsManager.js +661 -1
  39. package/dist/cjs/src/managers/system/disposalManager.js +444 -1
  40. package/dist/cjs/src/managers/system/hotReloadManager.js +291 -1
  41. package/dist/cjs/src/managers/system/performanceMonitor.js +863 -1
  42. package/dist/cjs/src/rendering/modelPreloader.js +369 -1
  43. package/dist/cjs/src/rendering/rendering2D.js +631 -1
  44. package/dist/cjs/src/rendering/rendering3D.js +685 -1
  45. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +396 -1
  46. package/dist/esm/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1444 -1
  47. package/dist/esm/node_modules/three/examples/jsm/controls/OrbitControls.js +1849 -1
  48. package/dist/esm/node_modules/three/examples/jsm/exporters/GLTFExporter.js +3533 -1
  49. package/dist/esm/node_modules/three/examples/jsm/exporters/OBJExporter.js +301 -1
  50. package/dist/esm/node_modules/three/examples/jsm/exporters/PLYExporter.js +538 -1
  51. package/dist/esm/node_modules/three/examples/jsm/exporters/STLExporter.js +214 -1
  52. package/dist/esm/node_modules/three/examples/jsm/loaders/DRACOLoader.js +679 -1
  53. package/dist/esm/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4807 -1
  54. package/dist/esm/node_modules/three/examples/jsm/loaders/RGBELoader.js +476 -1
  55. package/dist/esm/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +304 -1
  56. package/dist/esm/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +116 -1
  57. package/dist/esm/src/analysis/analysis.js +536 -1
  58. package/dist/esm/src/analysis/testing.js +954 -1
  59. package/dist/esm/src/core/centralPlant.js +1144 -1
  60. package/dist/esm/src/core/debugLogger.js +167 -1
  61. package/dist/esm/src/core/mathUtils.js +570 -1
  62. package/dist/esm/src/core/nameUtils.js +87 -1
  63. package/dist/esm/src/data/export.js +712 -1
  64. package/dist/esm/src/data/import.js +356 -1
  65. package/dist/esm/src/data/numerics.js +518 -1
  66. package/dist/esm/src/helpers/sceneHelper.js +547 -1
  67. package/dist/esm/src/index.js +35 -1
  68. package/dist/esm/src/managers/components/animationManager.js +119 -1
  69. package/dist/esm/src/managers/components/componentManager.js +328 -1
  70. package/dist/esm/src/managers/components/pathfindingManager.js +1417 -1
  71. package/dist/esm/src/managers/controls/TransformControls.js +1057 -1
  72. package/dist/esm/src/managers/controls/cameraControlsManager.js +75 -1
  73. package/dist/esm/src/managers/controls/dragDropManager.js +1002 -1
  74. package/dist/esm/src/managers/controls/keyboardControlsManager.js +371 -1
  75. package/dist/esm/src/managers/controls/transformControlsManager.js +1782 -1
  76. package/dist/esm/src/managers/environment/environmentManager.js +690 -1
  77. package/dist/esm/src/managers/environment/textureConfig.js +202 -1
  78. package/dist/esm/src/managers/scene/sceneExportManager.js +260 -1
  79. package/dist/esm/src/managers/scene/sceneInitializationManager.js +322 -1
  80. package/dist/esm/src/managers/scene/sceneOperationsManager.js +1485 -1
  81. package/dist/esm/src/managers/scene/sceneTooltipsManager.js +637 -1
  82. package/dist/esm/src/managers/system/disposalManager.js +440 -1
  83. package/dist/esm/src/managers/system/hotReloadManager.js +287 -1
  84. package/dist/esm/src/managers/system/performanceMonitor.js +858 -1
  85. package/dist/esm/src/rendering/modelPreloader.js +364 -1
  86. package/dist/esm/src/rendering/rendering2D.js +627 -1
  87. package/dist/esm/src/rendering/rendering3D.js +661 -1
  88. package/package.json +1 -1
@@ -1 +1,712 @@
1
- import{createClass as e,objectSpread2 as t,toConsumableArray as r,classCallCheck as n,typeof as o,asyncToGenerator as i,regenerator as a,createForOfIteratorHelper as s}from"../../_virtual/_rollupPluginBabelHelpers.js";import"three";import{GLTFExporter as u}from"../../node_modules/three/examples/jsm/exporters/GLTFExporter.js";import{OBJExporter as c}from"../../node_modules/three/examples/jsm/exporters/OBJExporter.js";import{STLExporter as l}from"../../node_modules/three/examples/jsm/exporters/STLExporter.js";import{PLYExporter as f}from"../../node_modules/three/examples/jsm/exporters/PLYExporter.js";import{logger as p}from"../core/debugLogger.js";var m=function(){return e(function e(){n(this,e),this.exporters={gltf:new u,obj:new c,stl:new l,ply:new f},this.supportedFormats={models:["gltf","glb","obj","stl","ply","dae"],scenes:["json"],images:["png","jpg","jpeg","webp"],data:["json","csv","xml"]},this.exportHistory=[]},[{key:"exportModel",value:(g=i(a().m(function e(r,n){var o,i,s,u,c,l,f,m,v,d,h=arguments;return a().w(function(e){for(;;)switch(e.n){case 0:o=h.length>2&&void 0!==h[2]?h[2]:{},i=performance.now(),p.info("🔄 Exporting model to ".concat(n.toUpperCase(),"...")),e.p=1,u=t({binary:"glb"===n,embedImages:!0,includeCustomExtensions:!1},o),v=n.toLowerCase(),e.n="gltf"===v||"glb"===v?2:"obj"===v?4:"stl"===v?6:8;break;case 2:return e.n=3,this.exportGLTF(r,u);case 3:case 5:case 7:return s=e.v,e.a(3,9);case 4:return e.n=5,this.exportOBJ(r,u);case 6:return e.n=7,this.exportSTL(r,u);case 8:throw new Error("Unsupported format: ".concat(n));case 9:return c=performance.now()-i,l={timestamp:(new Date).toISOString(),format:n.toLowerCase(),objectName:r.name||"Unnamed Object",exportTime:c,options:u,success:!0},this.exportHistory.push(l),p.info("✅ Model exported successfully to ".concat(n.toUpperCase()," in ").concat(c.toFixed(2),"ms")),e.a(2,{data:s,format:n,exportTime:c,filename:this.generateFilename(r.name||"model",n)});case 10:throw e.p=10,d=e.v,f=performance.now()-i,m={timestamp:(new Date).toISOString(),format:n.toLowerCase(),objectName:r.name||"Unnamed Object",exportTime:f,options:o,success:!1,error:d.message},this.exportHistory.push(m),p.error("❌ Failed to export model to ".concat(n.toUpperCase(),":"),d),d;case 11:return e.a(2)}},e,this,[[1,10]])})),function(e,t){return g.apply(this,arguments)})},{key:"exportGLTF",value:(y=i(a().m(function e(t){var r,n=this,o=arguments;return a().w(function(e){for(;;)if(0===e.n)return r=o.length>1&&void 0!==o[1]?o[1]:{},e.a(2,new Promise(function(e,o){n.exporters.gltf.parse(t,function(t){return e(t)},o,r)}))},e)})),function(e){return y.apply(this,arguments)})},{key:"exportOBJ",value:(h=i(a().m(function e(t){var r=this;return a().w(function(e){for(;;)if(0===e.n)return e.a(2,new Promise(function(e){e(r.exporters.obj.parse(t))}))},e)})),function(e){return h.apply(this,arguments)})},{key:"exportSTL",value:(d=i(a().m(function e(t){var r,n=this,o=arguments;return a().w(function(e){for(;;)if(0===e.n)return r=o.length>1&&void 0!==o[1]?o[1]:{},e.a(2,new Promise(function(e){e(n.exporters.stl.parse(t,r))}))},e)})),function(e){return d.apply(this,arguments)})},{key:"exportPLY",value:(v=i(a().m(function e(t){var r,n=this,o=arguments;return a().w(function(e){for(;;)if(0===e.n)return r=o.length>1&&void 0!==o[1]?o[1]:{},e.a(2,new Promise(function(e){e(n.exporters.ply.parse(t,r))}))},e)})),function(e){return v.apply(this,arguments)})},{key:"exportSceneConfig",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};p.info("🔄 Exporting scene configuration...");try{var i={metadata:t({version:"1.0.0",generator:"Export",timestamp:(new Date).toISOString()},o),scene:this.serializeObject(e),connections:r(n),cameras:this.extractCameras(e),lights:this.extractLights(e)};return p.info("✅ Scene configuration exported successfully"),i}catch(e){throw p.error("❌ Failed to export scene configuration:",e),e}}},{key:"serializeObject",value:function(e){var r=this,n={uuid:e.uuid,name:e.name,type:e.type,position:e.position.toArray(),rotation:e.rotation.toArray(),scale:e.scale.toArray(),visible:e.visible,castShadow:e.castShadow,receiveShadow:e.receiveShadow,userData:t({},e.userData),children:[]};return e.geometry&&(n.geometry={type:e.geometry.type,uuid:e.geometry.uuid,attributes:this.serializeGeometryAttributes(e.geometry)}),e.material&&(n.material=this.serializeMaterial(e.material)),e.children.forEach(function(e){n.children.push(r.serializeObject(e))}),n}},{key:"serializeGeometryAttributes",value:function(e){var t={};return Object.keys(e.attributes).forEach(function(r){var n=e.attributes[r];t[r]={type:n.constructor.name,itemSize:n.itemSize,count:n.count,normalized:n.normalized}}),t}},{key:"serializeMaterial",value:function(e){var t={type:e.type,uuid:e.uuid,name:e.name,color:e.color?e.color.getHex():null,transparent:e.transparent,opacity:e.opacity,side:e.side,visible:e.visible};void 0!==e.metalness&&(t.metalness=e.metalness),void 0!==e.roughness&&(t.roughness=e.roughness),void 0!==e.clearcoat&&(t.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(t.clearcoatRoughness=e.clearcoatRoughness);return["map","normalMap","roughnessMap","metalnessMap","aoMap","emissiveMap"].forEach(function(r){var n;e[r]&&(t[r]={uuid:e[r].uuid,name:e[r].name,image:(null===(n=e[r].image)||void 0===n?void 0:n.src)||null})}),t}},{key:"extractCameras",value:function(e){var t=[];return e.traverse(function(e){if(e.isCamera){var r={uuid:e.uuid,name:e.name,type:e.type,position:e.position.toArray(),rotation:e.rotation.toArray(),fov:e.fov,aspect:e.aspect,near:e.near,far:e.far};t.push(r)}}),t}},{key:"extractLights",value:function(e){var t=[];return e.traverse(function(e){if(e.isLight){var r={uuid:e.uuid,name:e.name,type:e.type,position:e.position.toArray(),color:e.color.getHex(),intensity:e.intensity};void 0!==e.distance&&(r.distance=e.distance),void 0!==e.decay&&(r.decay=e.decay),void 0!==e.angle&&(r.angle=e.angle),void 0!==e.penumbra&&(r.penumbra=e.penumbra),void 0!==e.castShadow&&(r.castShadow=e.castShadow),t.push(r)}}),t}},{key:"exportToCSV",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e||0===e.length)return"";t||(t=Object.keys(e[0]));var r=[];return r.push(t.join(",")),e.forEach(function(e){var n=t.map(function(t){var r=e[t];return"string"==typeof r&&(r.includes(",")||r.includes('"'))?'"'.concat(r.replace(/"/g,'""'),'"'):r});r.push(n.join(","))}),r.join("\n")}},{key:"exportToXML",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"root",n=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=" ".repeat(r),a="";return Object.keys(e).forEach(function(s){var u=e[s];"object"!==o(u)||null===u||Array.isArray(u)?Array.isArray(u)?u.forEach(function(e){a+="".concat(i,"<").concat(s,">"),"object"===o(e)?a+="\n"+n(e,r+1)+i:a+=t.escapeXML(e),a+="</".concat(s,">\n")}):a+="".concat(i,"<").concat(s,">").concat(t.escapeXML(u),"</").concat(s,">\n"):(a+="".concat(i,"<").concat(s,">\n"),a+=n(u,r+1),a+="".concat(i,"</").concat(s,">\n"))}),a};return'<?xml version="1.0" encoding="UTF-8"?>\n'+"<".concat(r,">\n")+n(e,1)+"</".concat(r,">")}},{key:"downloadFile",value:function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/octet-stream";r=e instanceof ArrayBuffer||"string"==typeof e?new Blob([e],{type:n}):new Blob([JSON.stringify(e,null,2)],{type:"application/json"});var o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=t,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o),p.info("✅ File downloaded: ".concat(t))}},{key:"exportBatch",value:(m=i(a().m(function e(t){var r,n,o,i,u,c,l,f;return a().w(function(e){for(;;)switch(e.n){case 0:p.info("🔄 Starting batch export of ".concat(t.length," objects...")),r=[],n=[],o=s(t),e.p=1,o.s();case 2:if((i=o.n()).done){e.n=7;break}return u=i.value,e.p=3,e.n=4,this.exportModel(u.object,u.format,u.options);case 4:c=e.v,r.push(c),e.n=6;break;case 5:e.p=5,l=e.v,n.push({object:u.object.name||"Unnamed Object",format:u.format,error:l.message});case 6:e.n=2;break;case 7:e.n=9;break;case 8:e.p=8,f=e.v,o.e(f);case 9:return e.p=9,o.f(),e.f(9);case 10:return p.info("✅ Batch export complete: ".concat(r.length," successful, ").concat(n.length," failed")),e.a(2,{results:r,errors:n})}},e,this,[[3,5],[1,8,9,10]])})),function(e){return m.apply(this,arguments)})},{key:"generateFilename",value:function(e,t){var r=(new Date).toISOString().replace(/[:.]/g,"-").slice(0,-5),n=e.replace(/[^a-zA-Z0-9_-]/g,"_");return"".concat(n,"_").concat(r,".").concat(t.toLowerCase())}},{key:"escapeXML",value:function(e){return null==e?"":String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}},{key:"isFormatSupported",value:function(e,t){var r;return(null===(r=this.supportedFormats[t])||void 0===r?void 0:r.includes(e.toLowerCase()))||!1}},{key:"getExportHistory",value:function(){return this.exportHistory}},{key:"clearHistory",value:function(){this.exportHistory=[]}},{key:"getSupportedFormats",value:function(){return t({},this.supportedFormats)}},{key:"dispose",value:function(){this.clearHistory(),p.info("Export disposed")}}]);var m,v,d,h,y,g}();export{m as Export};
1
+ import { createClass as _createClass, objectSpread2 as _objectSpread2, toConsumableArray as _toConsumableArray, classCallCheck as _classCallCheck, typeof as _typeof, asyncToGenerator as _asyncToGenerator, regenerator as _regenerator, createForOfIteratorHelper as _createForOfIteratorHelper } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import 'three';
3
+ import { GLTFExporter } from '../../node_modules/three/examples/jsm/exporters/GLTFExporter.js';
4
+ import { OBJExporter } from '../../node_modules/three/examples/jsm/exporters/OBJExporter.js';
5
+ import { STLExporter } from '../../node_modules/three/examples/jsm/exporters/STLExporter.js';
6
+ import { PLYExporter } from '../../node_modules/three/examples/jsm/exporters/PLYExporter.js';
7
+ import { logger } from '../core/debugLogger.js';
8
+
9
+ var Export = /*#__PURE__*/function () {
10
+ function Export() {
11
+ _classCallCheck(this, Export);
12
+ this.exporters = {
13
+ gltf: new GLTFExporter(),
14
+ obj: new OBJExporter(),
15
+ stl: new STLExporter(),
16
+ ply: new PLYExporter()
17
+ };
18
+ this.supportedFormats = {
19
+ models: ['gltf', 'glb', 'obj', 'stl', 'ply', 'dae'],
20
+ scenes: ['json'],
21
+ images: ['png', 'jpg', 'jpeg', 'webp'],
22
+ data: ['json', 'csv', 'xml']
23
+ };
24
+ this.exportHistory = [];
25
+ }
26
+
27
+ /**
28
+ * Export 3D model in various formats
29
+ * @param {THREE.Object3D} object - Object to export
30
+ * @param {string} format - Export format
31
+ * @param {Object} options - Export options
32
+ * @returns {Promise<Object>} Export result
33
+ */
34
+ return _createClass(Export, [{
35
+ key: "exportModel",
36
+ value: (function () {
37
+ var _exportModel = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(object, format) {
38
+ var options,
39
+ startTime,
40
+ result,
41
+ exportOptions,
42
+ exportTime,
43
+ exportRecord,
44
+ _exportTime,
45
+ _exportRecord,
46
+ _args = arguments,
47
+ _t,
48
+ _t2;
49
+ return _regenerator().w(function (_context) {
50
+ while (1) switch (_context.n) {
51
+ case 0:
52
+ options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
53
+ startTime = performance.now();
54
+ logger.info("\uD83D\uDD04 Exporting model to ".concat(format.toUpperCase(), "..."));
55
+ _context.p = 1;
56
+ exportOptions = _objectSpread2({
57
+ binary: format === 'glb',
58
+ embedImages: true,
59
+ includeCustomExtensions: false
60
+ }, options);
61
+ _t = format.toLowerCase();
62
+ _context.n = _t === 'gltf' ? 2 : _t === 'glb' ? 2 : _t === 'obj' ? 4 : _t === 'stl' ? 6 : 8;
63
+ break;
64
+ case 2:
65
+ _context.n = 3;
66
+ return this.exportGLTF(object, exportOptions);
67
+ case 3:
68
+ result = _context.v;
69
+ return _context.a(3, 9);
70
+ case 4:
71
+ _context.n = 5;
72
+ return this.exportOBJ(object, exportOptions);
73
+ case 5:
74
+ result = _context.v;
75
+ return _context.a(3, 9);
76
+ case 6:
77
+ _context.n = 7;
78
+ return this.exportSTL(object, exportOptions);
79
+ case 7:
80
+ result = _context.v;
81
+ return _context.a(3, 9);
82
+ case 8:
83
+ throw new Error("Unsupported format: ".concat(format));
84
+ case 9:
85
+ exportTime = performance.now() - startTime;
86
+ exportRecord = {
87
+ timestamp: new Date().toISOString(),
88
+ format: format.toLowerCase(),
89
+ objectName: object.name || 'Unnamed Object',
90
+ exportTime: exportTime,
91
+ options: exportOptions,
92
+ success: true
93
+ };
94
+ this.exportHistory.push(exportRecord);
95
+ logger.info("\u2705 Model exported successfully to ".concat(format.toUpperCase(), " in ").concat(exportTime.toFixed(2), "ms"));
96
+ return _context.a(2, {
97
+ data: result,
98
+ format: format,
99
+ exportTime: exportTime,
100
+ filename: this.generateFilename(object.name || 'model', format)
101
+ });
102
+ case 10:
103
+ _context.p = 10;
104
+ _t2 = _context.v;
105
+ _exportTime = performance.now() - startTime;
106
+ _exportRecord = {
107
+ timestamp: new Date().toISOString(),
108
+ format: format.toLowerCase(),
109
+ objectName: object.name || 'Unnamed Object',
110
+ exportTime: _exportTime,
111
+ options: options,
112
+ success: false,
113
+ error: _t2.message
114
+ };
115
+ this.exportHistory.push(_exportRecord);
116
+ logger.error("\u274C Failed to export model to ".concat(format.toUpperCase(), ":"), _t2);
117
+ throw _t2;
118
+ case 11:
119
+ return _context.a(2);
120
+ }
121
+ }, _callee, this, [[1, 10]]);
122
+ }));
123
+ function exportModel(_x, _x2) {
124
+ return _exportModel.apply(this, arguments);
125
+ }
126
+ return exportModel;
127
+ }()
128
+ /**
129
+ * Export to GLTF/GLB format
130
+ * @param {THREE.Object3D} object - Object to export
131
+ * @param {Object} options - Export options
132
+ * @returns {Promise<ArrayBuffer|Object>} Export result
133
+ */
134
+ )
135
+ }, {
136
+ key: "exportGLTF",
137
+ value: (function () {
138
+ var _exportGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(object) {
139
+ var _this = this;
140
+ var options,
141
+ _args2 = arguments;
142
+ return _regenerator().w(function (_context2) {
143
+ while (1) switch (_context2.n) {
144
+ case 0:
145
+ options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
146
+ return _context2.a(2, new Promise(function (resolve, reject) {
147
+ _this.exporters.gltf.parse(object, function (result) {
148
+ return resolve(result);
149
+ }, reject, options);
150
+ }));
151
+ }
152
+ }, _callee2);
153
+ }));
154
+ function exportGLTF(_x3) {
155
+ return _exportGLTF.apply(this, arguments);
156
+ }
157
+ return exportGLTF;
158
+ }()
159
+ /**
160
+ * Export to OBJ format
161
+ * @param {THREE.Object3D} object - Object to export
162
+ * @param {Object} options - Export options
163
+ * @returns {Promise<string>} OBJ string
164
+ */
165
+ )
166
+ }, {
167
+ key: "exportOBJ",
168
+ value: (function () {
169
+ var _exportOBJ = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(object) {
170
+ var _this2 = this;
171
+ return _regenerator().w(function (_context3) {
172
+ while (1) switch (_context3.n) {
173
+ case 0:
174
+ return _context3.a(2, new Promise(function (resolve) {
175
+ var result = _this2.exporters.obj.parse(object);
176
+ resolve(result);
177
+ }));
178
+ }
179
+ }, _callee3);
180
+ }));
181
+ function exportOBJ(_x4) {
182
+ return _exportOBJ.apply(this, arguments);
183
+ }
184
+ return exportOBJ;
185
+ }()
186
+ /**
187
+ * Export to STL format
188
+ * @param {THREE.Object3D} object - Object to export
189
+ * @param {Object} options - Export options
190
+ * @returns {Promise<ArrayBuffer|string>} STL data
191
+ */
192
+ )
193
+ }, {
194
+ key: "exportSTL",
195
+ value: (function () {
196
+ var _exportSTL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(object) {
197
+ var _this3 = this;
198
+ var options,
199
+ _args4 = arguments;
200
+ return _regenerator().w(function (_context4) {
201
+ while (1) switch (_context4.n) {
202
+ case 0:
203
+ options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
204
+ return _context4.a(2, new Promise(function (resolve) {
205
+ var result = _this3.exporters.stl.parse(object, options);
206
+ resolve(result);
207
+ }));
208
+ }
209
+ }, _callee4);
210
+ }));
211
+ function exportSTL(_x5) {
212
+ return _exportSTL.apply(this, arguments);
213
+ }
214
+ return exportSTL;
215
+ }()
216
+ /**
217
+ * Export to PLY format
218
+ * @param {THREE.Object3D} object - Object to export
219
+ * @param {Object} options - Export options
220
+ * @returns {Promise<ArrayBuffer|string>} PLY data
221
+ */
222
+ )
223
+ }, {
224
+ key: "exportPLY",
225
+ value: (function () {
226
+ var _exportPLY = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(object) {
227
+ var _this4 = this;
228
+ var options,
229
+ _args5 = arguments;
230
+ return _regenerator().w(function (_context5) {
231
+ while (1) switch (_context5.n) {
232
+ case 0:
233
+ options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
234
+ return _context5.a(2, new Promise(function (resolve) {
235
+ var result = _this4.exporters.ply.parse(object, options);
236
+ resolve(result);
237
+ }));
238
+ }
239
+ }, _callee5);
240
+ }));
241
+ function exportPLY(_x6) {
242
+ return _exportPLY.apply(this, arguments);
243
+ }
244
+ return exportPLY;
245
+ }()
246
+ /**
247
+ * Export scene configuration to JSON
248
+ * @param {THREE.Scene} scene - Scene to export
249
+ * @param {Array} connections - Scene connections
250
+ * @param {Object} metadata - Additional metadata
251
+ * @returns {Object} Scene JSON data
252
+ */
253
+ )
254
+ }, {
255
+ key: "exportSceneConfig",
256
+ value: function exportSceneConfig(scene) {
257
+ var connections = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
258
+ var metadata = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
259
+ logger.info('🔄 Exporting scene configuration...');
260
+ try {
261
+ var sceneData = {
262
+ metadata: _objectSpread2({
263
+ version: '1.0.0',
264
+ generator: 'Export',
265
+ timestamp: new Date().toISOString()
266
+ }, metadata),
267
+ scene: this.serializeObject(scene),
268
+ connections: _toConsumableArray(connections),
269
+ cameras: this.extractCameras(scene),
270
+ lights: this.extractLights(scene)
271
+ };
272
+ logger.info('✅ Scene configuration exported successfully');
273
+ return sceneData;
274
+ } catch (error) {
275
+ logger.error('❌ Failed to export scene configuration:', error);
276
+ throw error;
277
+ }
278
+ }
279
+
280
+ /**
281
+ * Serialize Three.js object to JSON
282
+ * @param {THREE.Object3D} object - Object to serialize
283
+ * @returns {Object} Serialized object
284
+ */
285
+ }, {
286
+ key: "serializeObject",
287
+ value: function serializeObject(object) {
288
+ var _this5 = this;
289
+ var serialized = {
290
+ uuid: object.uuid,
291
+ name: object.name,
292
+ type: object.type,
293
+ position: object.position.toArray(),
294
+ rotation: object.rotation.toArray(),
295
+ scale: object.scale.toArray(),
296
+ visible: object.visible,
297
+ castShadow: object.castShadow,
298
+ receiveShadow: object.receiveShadow,
299
+ userData: _objectSpread2({}, object.userData),
300
+ children: []
301
+ };
302
+
303
+ // Serialize geometry if it exists
304
+ if (object.geometry) {
305
+ serialized.geometry = {
306
+ type: object.geometry.type,
307
+ uuid: object.geometry.uuid,
308
+ attributes: this.serializeGeometryAttributes(object.geometry)
309
+ };
310
+ }
311
+
312
+ // Serialize material if it exists
313
+ if (object.material) {
314
+ serialized.material = this.serializeMaterial(object.material);
315
+ }
316
+
317
+ // Recursively serialize children
318
+ object.children.forEach(function (child) {
319
+ serialized.children.push(_this5.serializeObject(child));
320
+ });
321
+ return serialized;
322
+ }
323
+
324
+ /**
325
+ * Serialize geometry attributes
326
+ * @param {THREE.BufferGeometry} geometry - Geometry to serialize
327
+ * @returns {Object} Serialized attributes
328
+ */
329
+ }, {
330
+ key: "serializeGeometryAttributes",
331
+ value: function serializeGeometryAttributes(geometry) {
332
+ var attributes = {};
333
+ Object.keys(geometry.attributes).forEach(function (name) {
334
+ var attribute = geometry.attributes[name];
335
+ attributes[name] = {
336
+ type: attribute.constructor.name,
337
+ itemSize: attribute.itemSize,
338
+ count: attribute.count,
339
+ normalized: attribute.normalized
340
+ };
341
+ });
342
+ return attributes;
343
+ }
344
+
345
+ /**
346
+ * Serialize material
347
+ * @param {THREE.Material} material - Material to serialize
348
+ * @returns {Object} Serialized material
349
+ */
350
+ }, {
351
+ key: "serializeMaterial",
352
+ value: function serializeMaterial(material) {
353
+ var serialized = {
354
+ type: material.type,
355
+ uuid: material.uuid,
356
+ name: material.name,
357
+ color: material.color ? material.color.getHex() : null,
358
+ transparent: material.transparent,
359
+ opacity: material.opacity,
360
+ side: material.side,
361
+ visible: material.visible
362
+ };
363
+
364
+ // Add material-specific properties
365
+ if (material.metalness !== undefined) serialized.metalness = material.metalness;
366
+ if (material.roughness !== undefined) serialized.roughness = material.roughness;
367
+ if (material.clearcoat !== undefined) serialized.clearcoat = material.clearcoat;
368
+ if (material.clearcoatRoughness !== undefined) serialized.clearcoatRoughness = material.clearcoatRoughness;
369
+
370
+ // Serialize textures
371
+ var textureProperties = ['map', 'normalMap', 'roughnessMap', 'metalnessMap', 'aoMap', 'emissiveMap'];
372
+ textureProperties.forEach(function (prop) {
373
+ if (material[prop]) {
374
+ var _material$prop$image;
375
+ serialized[prop] = {
376
+ uuid: material[prop].uuid,
377
+ name: material[prop].name,
378
+ image: ((_material$prop$image = material[prop].image) === null || _material$prop$image === void 0 ? void 0 : _material$prop$image.src) || null
379
+ };
380
+ }
381
+ });
382
+ return serialized;
383
+ }
384
+
385
+ /**
386
+ * Extract cameras from scene
387
+ * @param {THREE.Scene} scene - Scene to extract from
388
+ * @returns {Array} Camera data
389
+ */
390
+ }, {
391
+ key: "extractCameras",
392
+ value: function extractCameras(scene) {
393
+ var cameras = [];
394
+ scene.traverse(function (object) {
395
+ if (object.isCamera) {
396
+ var cameraData = {
397
+ uuid: object.uuid,
398
+ name: object.name,
399
+ type: object.type,
400
+ position: object.position.toArray(),
401
+ rotation: object.rotation.toArray(),
402
+ fov: object.fov,
403
+ aspect: object.aspect,
404
+ near: object.near,
405
+ far: object.far
406
+ };
407
+ cameras.push(cameraData);
408
+ }
409
+ });
410
+ return cameras;
411
+ }
412
+
413
+ /**
414
+ * Extract lights from scene
415
+ * @param {THREE.Scene} scene - Scene to extract from
416
+ * @returns {Array} Light data
417
+ */
418
+ }, {
419
+ key: "extractLights",
420
+ value: function extractLights(scene) {
421
+ var lights = [];
422
+ scene.traverse(function (object) {
423
+ if (object.isLight) {
424
+ var lightData = {
425
+ uuid: object.uuid,
426
+ name: object.name,
427
+ type: object.type,
428
+ position: object.position.toArray(),
429
+ color: object.color.getHex(),
430
+ intensity: object.intensity
431
+ };
432
+
433
+ // Add light-specific properties
434
+ if (object.distance !== undefined) lightData.distance = object.distance;
435
+ if (object.decay !== undefined) lightData.decay = object.decay;
436
+ if (object.angle !== undefined) lightData.angle = object.angle;
437
+ if (object.penumbra !== undefined) lightData.penumbra = object.penumbra;
438
+ if (object.castShadow !== undefined) lightData.castShadow = object.castShadow;
439
+ lights.push(lightData);
440
+ }
441
+ });
442
+ return lights;
443
+ }
444
+
445
+ /**
446
+ * Export data to CSV format
447
+ * @param {Array} data - Array of objects to export
448
+ * @param {Array} headers - Column headers
449
+ * @returns {string} CSV string
450
+ */
451
+ }, {
452
+ key: "exportToCSV",
453
+ value: function exportToCSV(data) {
454
+ var headers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
455
+ if (!data || data.length === 0) {
456
+ return '';
457
+ }
458
+
459
+ // Auto-generate headers if not provided
460
+ if (!headers) {
461
+ headers = Object.keys(data[0]);
462
+ }
463
+ var csvRows = [];
464
+
465
+ // Add headers
466
+ csvRows.push(headers.join(','));
467
+
468
+ // Add data rows
469
+ data.forEach(function (row) {
470
+ var values = headers.map(function (header) {
471
+ var value = row[header];
472
+ // Escape commas and quotes
473
+ if (typeof value === 'string' && (value.includes(',') || value.includes('"'))) {
474
+ return "\"".concat(value.replace(/"/g, '""'), "\"");
475
+ }
476
+ return value;
477
+ });
478
+ csvRows.push(values.join(','));
479
+ });
480
+ return csvRows.join('\n');
481
+ }
482
+
483
+ /**
484
+ * Export data to XML format
485
+ * @param {Object} data - Data to export
486
+ * @param {string} rootElement - Root element name
487
+ * @returns {string} XML string
488
+ */
489
+ }, {
490
+ key: "exportToXML",
491
+ value: function exportToXML(data) {
492
+ var _this6 = this;
493
+ var rootElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'root';
494
+ var xmlHeader = '<?xml version="1.0" encoding="UTF-8"?>\n';
495
+ var _objectToXML = function objectToXML(obj) {
496
+ var indent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
497
+ var spaces = ' '.repeat(indent);
498
+ var xml = '';
499
+ Object.keys(obj).forEach(function (key) {
500
+ var value = obj[key];
501
+ if (_typeof(value) === 'object' && value !== null && !Array.isArray(value)) {
502
+ xml += "".concat(spaces, "<").concat(key, ">\n");
503
+ xml += _objectToXML(value, indent + 1);
504
+ xml += "".concat(spaces, "</").concat(key, ">\n");
505
+ } else if (Array.isArray(value)) {
506
+ value.forEach(function (item) {
507
+ xml += "".concat(spaces, "<").concat(key, ">");
508
+ if (_typeof(item) === 'object') {
509
+ xml += '\n' + _objectToXML(item, indent + 1) + spaces;
510
+ } else {
511
+ xml += _this6.escapeXML(item);
512
+ }
513
+ xml += "</".concat(key, ">\n");
514
+ });
515
+ } else {
516
+ xml += "".concat(spaces, "<").concat(key, ">").concat(_this6.escapeXML(value), "</").concat(key, ">\n");
517
+ }
518
+ });
519
+ return xml;
520
+ };
521
+ return xmlHeader + "<".concat(rootElement, ">\n") + _objectToXML(data, 1) + "</".concat(rootElement, ">");
522
+ }
523
+
524
+ /**
525
+ * Download file from data
526
+ * @param {*} data - Data to download
527
+ * @param {string} filename - Filename
528
+ * @param {string} mimeType - MIME type
529
+ */
530
+ }, {
531
+ key: "downloadFile",
532
+ value: function downloadFile(data, filename) {
533
+ var mimeType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'application/octet-stream';
534
+ var blob;
535
+ if (data instanceof ArrayBuffer) {
536
+ blob = new Blob([data], {
537
+ type: mimeType
538
+ });
539
+ } else if (typeof data === 'string') {
540
+ blob = new Blob([data], {
541
+ type: mimeType
542
+ });
543
+ } else {
544
+ blob = new Blob([JSON.stringify(data, null, 2)], {
545
+ type: 'application/json'
546
+ });
547
+ }
548
+ var url = URL.createObjectURL(blob);
549
+ var link = document.createElement('a');
550
+ link.href = url;
551
+ link.download = filename;
552
+ link.style.display = 'none';
553
+ document.body.appendChild(link);
554
+ link.click();
555
+ document.body.removeChild(link);
556
+ URL.revokeObjectURL(url);
557
+ logger.info("\u2705 File downloaded: ".concat(filename));
558
+ }
559
+
560
+ /**
561
+ * Export multiple objects in batch
562
+ * @param {Array} objects - Array of {object, format, options} objects
563
+ * @returns {Promise<Array>} Array of export results
564
+ */
565
+ }, {
566
+ key: "exportBatch",
567
+ value: (function () {
568
+ var _exportBatch = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(objects) {
569
+ var results, errors, _iterator, _step, item, result, _t3, _t4;
570
+ return _regenerator().w(function (_context6) {
571
+ while (1) switch (_context6.n) {
572
+ case 0:
573
+ logger.info("\uD83D\uDD04 Starting batch export of ".concat(objects.length, " objects..."));
574
+ results = [];
575
+ errors = [];
576
+ _iterator = _createForOfIteratorHelper(objects);
577
+ _context6.p = 1;
578
+ _iterator.s();
579
+ case 2:
580
+ if ((_step = _iterator.n()).done) {
581
+ _context6.n = 7;
582
+ break;
583
+ }
584
+ item = _step.value;
585
+ _context6.p = 3;
586
+ _context6.n = 4;
587
+ return this.exportModel(item.object, item.format, item.options);
588
+ case 4:
589
+ result = _context6.v;
590
+ results.push(result);
591
+ _context6.n = 6;
592
+ break;
593
+ case 5:
594
+ _context6.p = 5;
595
+ _t3 = _context6.v;
596
+ errors.push({
597
+ object: item.object.name || 'Unnamed Object',
598
+ format: item.format,
599
+ error: _t3.message
600
+ });
601
+ case 6:
602
+ _context6.n = 2;
603
+ break;
604
+ case 7:
605
+ _context6.n = 9;
606
+ break;
607
+ case 8:
608
+ _context6.p = 8;
609
+ _t4 = _context6.v;
610
+ _iterator.e(_t4);
611
+ case 9:
612
+ _context6.p = 9;
613
+ _iterator.f();
614
+ return _context6.f(9);
615
+ case 10:
616
+ logger.info("\u2705 Batch export complete: ".concat(results.length, " successful, ").concat(errors.length, " failed"));
617
+ return _context6.a(2, {
618
+ results: results,
619
+ errors: errors
620
+ });
621
+ }
622
+ }, _callee6, this, [[3, 5], [1, 8, 9, 10]]);
623
+ }));
624
+ function exportBatch(_x7) {
625
+ return _exportBatch.apply(this, arguments);
626
+ }
627
+ return exportBatch;
628
+ }()
629
+ /**
630
+ * Generate filename for export
631
+ * @param {string} baseName - Base name
632
+ * @param {string} format - File format
633
+ * @returns {string} Generated filename
634
+ */
635
+ )
636
+ }, {
637
+ key: "generateFilename",
638
+ value: function generateFilename(baseName, format) {
639
+ var timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, -5);
640
+ var sanitizedName = baseName.replace(/[^a-zA-Z0-9_-]/g, '_');
641
+ return "".concat(sanitizedName, "_").concat(timestamp, ".").concat(format.toLowerCase());
642
+ }
643
+
644
+ /**
645
+ * Escape XML special characters
646
+ * @param {*} value - Value to escape
647
+ * @returns {string} Escaped string
648
+ */
649
+ }, {
650
+ key: "escapeXML",
651
+ value: function escapeXML(value) {
652
+ if (value === null || value === undefined) {
653
+ return '';
654
+ }
655
+ return String(value).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
656
+ }
657
+
658
+ /**
659
+ * Check if format is supported
660
+ * @param {string} format - Format to check
661
+ * @param {string} category - Category (models, scenes, images, data)
662
+ * @returns {boolean} Whether format is supported
663
+ */
664
+ }, {
665
+ key: "isFormatSupported",
666
+ value: function isFormatSupported(format, category) {
667
+ var _this$supportedFormat;
668
+ return ((_this$supportedFormat = this.supportedFormats[category]) === null || _this$supportedFormat === void 0 ? void 0 : _this$supportedFormat.includes(format.toLowerCase())) || false;
669
+ }
670
+
671
+ /**
672
+ * Get export history
673
+ * @returns {Array} Export history
674
+ */
675
+ }, {
676
+ key: "getExportHistory",
677
+ value: function getExportHistory() {
678
+ return this.exportHistory;
679
+ }
680
+
681
+ /**
682
+ * Clear export history
683
+ */
684
+ }, {
685
+ key: "clearHistory",
686
+ value: function clearHistory() {
687
+ this.exportHistory = [];
688
+ }
689
+
690
+ /**
691
+ * Get supported formats
692
+ * @returns {Object} Supported formats by category
693
+ */
694
+ }, {
695
+ key: "getSupportedFormats",
696
+ value: function getSupportedFormats() {
697
+ return _objectSpread2({}, this.supportedFormats);
698
+ }
699
+
700
+ /**
701
+ * Dispose of export manager
702
+ */
703
+ }, {
704
+ key: "dispose",
705
+ value: function dispose() {
706
+ this.clearHistory();
707
+ logger.info('Export disposed');
708
+ }
709
+ }]);
710
+ }();
711
+
712
+ export { Export };