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