@roomle/web-sdk 2.107.0 → 2.108.0-alpha.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 (137) hide show
  1. package/lib/ConfiguratorKernel.wasm +0 -0
  2. package/lib/{PointLightHelper-BkdQaOKc.js → PointLightHelper-B8VP_55Z.js} +2 -2
  3. package/lib/{PointLightHelper-BkdQaOKc.js.map → PointLightHelper-B8VP_55Z.js.map} +1 -1
  4. package/lib/{PointLightHelper-qhWtXw8x.mjs → PointLightHelper-DtoZq5ME.mjs} +2 -2
  5. package/lib/{PointLightHelper-qhWtXw8x.mjs.map → PointLightHelper-DtoZq5ME.mjs.map} +1 -1
  6. package/lib/RoomleCore.js +6 -6
  7. package/lib/RoomleCore.wasm +0 -0
  8. package/lib/RoomleToolsCore.wasm +0 -0
  9. package/lib/{banana-for-scale-XjIfe69B.js → banana-for-scale-BVlDK4jg.js} +2 -2
  10. package/lib/{banana-for-scale-XjIfe69B.js.map → banana-for-scale-BVlDK4jg.js.map} +1 -1
  11. package/lib/{banana-for-scale-CDGM3hdN.mjs → banana-for-scale-CKSlc9Tc.mjs} +2 -2
  12. package/lib/{banana-for-scale-CDGM3hdN.mjs.map → banana-for-scale-CKSlc9Tc.mjs.map} +1 -1
  13. package/lib/camera-behaviour-CzgZxW1D.js +50 -0
  14. package/lib/camera-behaviour-CzgZxW1D.js.map +1 -0
  15. package/lib/{camera-behaviour-BLMduSEn.mjs → camera-behaviour-DWkBHxkk.mjs} +79 -75
  16. package/lib/camera-behaviour-DWkBHxkk.mjs.map +1 -0
  17. package/lib/{component-dimensioning-Do75G-kI.js → component-dimensioning-CUoDDxfk.js} +2 -2
  18. package/lib/{component-dimensioning-Do75G-kI.js.map → component-dimensioning-CUoDDxfk.js.map} +1 -1
  19. package/lib/{component-dimensioning-DvCO0pEp.mjs → component-dimensioning-CgVIP7Nu.mjs} +2 -2
  20. package/lib/{component-dimensioning-DvCO0pEp.mjs.map → component-dimensioning-CgVIP7Nu.mjs.map} +1 -1
  21. package/lib/{component-raycast-helper-Dl-pzfg_.js → component-raycast-helper-DvNtWlR5.js} +2 -2
  22. package/lib/{component-raycast-helper-Dl-pzfg_.js.map → component-raycast-helper-DvNtWlR5.js.map} +1 -1
  23. package/lib/{component-raycast-helper-CuZdUtrH.mjs → component-raycast-helper-zAwc-AuF.mjs} +2 -2
  24. package/lib/{component-raycast-helper-CuZdUtrH.mjs.map → component-raycast-helper-zAwc-AuF.mjs.map} +1 -1
  25. package/lib/{configurator-CT_ghGbX.mjs → configurator-DDhzCgxy.mjs} +6 -6
  26. package/lib/{configurator-CT_ghGbX.mjs.map → configurator-DDhzCgxy.mjs.map} +1 -1
  27. package/lib/{configurator-B01iJTNa.js → configurator-DJnpG8CG.js} +2 -2
  28. package/lib/{configurator-B01iJTNa.js.map → configurator-DJnpG8CG.js.map} +1 -1
  29. package/lib/configurator-scene-manager-Bxdyg2zz.js +2 -0
  30. package/lib/configurator-scene-manager-Bxdyg2zz.js.map +1 -0
  31. package/lib/{configurator-scene-manager-DbsYS4rm.mjs → configurator-scene-manager-DnZvFw0N.mjs} +150 -162
  32. package/lib/configurator-scene-manager-DnZvFw0N.mjs.map +1 -0
  33. package/lib/configurator.js +1 -1
  34. package/lib/configurator.nomodule.js +1 -1
  35. package/lib/{continuous-drawing-helper-DdnnCOqZ.js → continuous-drawing-helper-C6qDGAxa.js} +2 -2
  36. package/lib/{continuous-drawing-helper-DdnnCOqZ.js.map → continuous-drawing-helper-C6qDGAxa.js.map} +1 -1
  37. package/lib/{continuous-drawing-helper-DrpQFppG.mjs → continuous-drawing-helper-DbTM7uCv.mjs} +2 -2
  38. package/lib/{continuous-drawing-helper-DrpQFppG.mjs.map → continuous-drawing-helper-DbTM7uCv.mjs.map} +1 -1
  39. package/lib/{default-light-setting-D0Ie_AEw.mjs → default-light-setting-BdD0jDeP.mjs} +3 -3
  40. package/lib/{default-light-setting-D0Ie_AEw.mjs.map → default-light-setting-BdD0jDeP.mjs.map} +1 -1
  41. package/lib/{default-light-setting-DQxt3v5x.js → default-light-setting-CYiFuxeI.js} +2 -2
  42. package/lib/{default-light-setting-DQxt3v5x.js.map → default-light-setting-CYiFuxeI.js.map} +1 -1
  43. package/lib/definitions/common-core/src/light/light-source.d.ts +2 -0
  44. package/lib/definitions/common-core/src/utils/threejs-utils.d.ts +2 -1
  45. package/lib/definitions/common-core/src/webgl/roomle-component-factory.d.ts +1 -0
  46. package/lib/definitions/common-core/src/webgl/scene-manager.d.ts +1 -1
  47. package/lib/definitions/planner-core/src/lights/ceiling-light.d.ts +1 -1
  48. package/lib/definitions/planner-core/src/lights/light-group.d.ts +1 -2
  49. package/lib/definitions/planner-core/src/roomle-planner.d.ts +12 -6
  50. package/lib/definitions/planner-core/src/services/planner-kernel-access.d.ts +1 -1
  51. package/lib/definitions/planner-core/src/view-model/plan-view-model.d.ts +1 -4
  52. package/lib/definitions/planner-core/src/webgl/planner-scene-manager.d.ts +5 -1
  53. package/lib/{glb-viewer-BEWU9zxC.mjs → glb-viewer-BoZgMSrk.mjs} +6 -6
  54. package/lib/{glb-viewer-BEWU9zxC.mjs.map → glb-viewer-BoZgMSrk.mjs.map} +1 -1
  55. package/lib/{glb-viewer-camera-behaviour-Cl2bS83k.js → glb-viewer-camera-behaviour-AEWNZ6mR.js} +2 -2
  56. package/lib/{glb-viewer-camera-behaviour-Cl2bS83k.js.map → glb-viewer-camera-behaviour-AEWNZ6mR.js.map} +1 -1
  57. package/lib/{glb-viewer-camera-behaviour-DQ2sVbku.mjs → glb-viewer-camera-behaviour-CRnnMrL2.mjs} +2 -2
  58. package/lib/{glb-viewer-camera-behaviour-DQ2sVbku.mjs.map → glb-viewer-camera-behaviour-CRnnMrL2.mjs.map} +1 -1
  59. package/lib/{glb-viewer-6_OVDzVH.js → glb-viewer-vvpjnYPw.js} +2 -2
  60. package/lib/{glb-viewer-6_OVDzVH.js.map → glb-viewer-vvpjnYPw.js.map} +1 -1
  61. package/lib/glb-viewer.js +1 -1
  62. package/lib/glb-viewer.nomodule.js +1 -1
  63. package/lib/{imos-ix-poc-export-helper-r0pv9sOT.js → imos-ix-poc-export-helper-7AWayvID.js} +2 -2
  64. package/lib/{imos-ix-poc-export-helper-r0pv9sOT.js.map → imos-ix-poc-export-helper-7AWayvID.js.map} +1 -1
  65. package/lib/{imos-ix-poc-export-helper-BrpY0OHi.mjs → imos-ix-poc-export-helper-gQb0lbdn.mjs} +2 -2
  66. package/lib/{imos-ix-poc-export-helper-BrpY0OHi.mjs.map → imos-ix-poc-export-helper-gQb0lbdn.mjs.map} +1 -1
  67. package/lib/{main-05wLxbDZ.js → main-DVWEbQdM.js} +340 -149
  68. package/lib/{main-05wLxbDZ.js.map → main-DVWEbQdM.js.map} +1 -1
  69. package/lib/{main-CMu7hOEO.mjs → main-RpgY_kch.mjs} +2202 -1999
  70. package/lib/{main-CMu7hOEO.mjs.map → main-RpgY_kch.mjs.map} +1 -1
  71. package/lib/{material-viewer-B0MevA_r.mjs → material-viewer-DQjAOrWL.mjs} +4 -4
  72. package/lib/{material-viewer-B0MevA_r.mjs.map → material-viewer-DQjAOrWL.mjs.map} +1 -1
  73. package/lib/{material-viewer-CLqZXFrn.js → material-viewer-_9Sb1UCw.js} +2 -2
  74. package/lib/{material-viewer-CLqZXFrn.js.map → material-viewer-_9Sb1UCw.js.map} +1 -1
  75. package/lib/material-viewer.js +1 -1
  76. package/lib/material-viewer.nomodule.js +1 -1
  77. package/lib/planner-BcHlq0n3.js +155 -0
  78. package/lib/planner-BcHlq0n3.js.map +1 -0
  79. package/lib/{planner-B3Bt-cWy.mjs → planner-BilNNFJ0.mjs} +143 -125
  80. package/lib/planner-BilNNFJ0.mjs.map +1 -0
  81. package/lib/planner.js +1 -1
  82. package/lib/planner.nomodule.js +1 -1
  83. package/lib/roomle-sdk.js +7 -7
  84. package/lib/roomle-sdk.nomodule.js +1 -1
  85. package/lib/{script-loader-CZjzwkk2.js → script-loader-BZOMZ1AI.js} +2 -2
  86. package/lib/{script-loader-CZjzwkk2.js.map → script-loader-BZOMZ1AI.js.map} +1 -1
  87. package/lib/{script-loader-BzwDLtbS.mjs → script-loader-CHolkWhE.mjs} +2 -2
  88. package/lib/{script-loader-BzwDLtbS.mjs.map → script-loader-CHolkWhE.mjs.map} +1 -1
  89. package/lib/static/roomle-core-hsc/ConfiguratorKernel.wasm +0 -0
  90. package/lib/static/roomle-core-hsc/RoomleCore.js +6 -6
  91. package/lib/static/roomle-core-hsc/RoomleCore.wasm +0 -0
  92. package/lib/static/roomle-core-hsc/RoomleServiceCore.js +6 -6
  93. package/lib/static/roomle-core-hsc/RoomleServiceCore.wasm +0 -0
  94. package/lib/static/roomle-core-hsc/RoomleToolsCore.wasm +0 -0
  95. package/lib/static/roomle-core-hsc/configuratorCoreInterface.d.ts +2 -0
  96. package/lib/static/roomle-core-hsc/embind/configuratorCoreInterface.d.ts +2 -0
  97. package/lib/static/roomle-core-hsc/embind/plannerCoreCallback.d.ts +2 -2
  98. package/lib/static/roomle-core-hsc/embind/plannerCoreCallback.js +1 -1
  99. package/lib/static/roomle-core-hsc/embind/plannerCoreCallback.js.map +1 -1
  100. package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.d.ts +17 -2
  101. package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.js.map +1 -1
  102. package/lib/static/roomle-core-hsc/package.json +1 -1
  103. package/lib/static/roomle-core-hsc/plannerCoreCallback.d.ts +2 -2
  104. package/lib/static/roomle-core-hsc/plannerCoreCallback.js +1 -1
  105. package/lib/static/roomle-core-hsc/plannerCoreCallback.js.map +1 -1
  106. package/lib/static/roomle-core-hsc/plannerCoreInterface.d.ts +17 -2
  107. package/lib/static/roomle-core-hsc/plannerCoreInterface.js.map +1 -1
  108. package/lib/static/roomle-core-hsc/src/embind/configuratorCoreInterface.d.ts +2 -0
  109. package/lib/static/roomle-core-hsc/src/embind/plannerCoreCallback.d.ts +2 -2
  110. package/lib/static/roomle-core-hsc/src/embind/plannerCoreCallback.js +1 -1
  111. package/lib/static/roomle-core-hsc/src/embind/plannerCoreCallback.js.map +1 -1
  112. package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.d.ts +17 -2
  113. package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.js.map +1 -1
  114. package/lib/static/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
  115. package/lib/static/roomle-core-hsc/wasm_modern/RoomleCore.js +6 -6
  116. package/lib/static/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
  117. package/lib/static/roomle-core-hsc/wasm_modern/RoomleServiceCore.js +6 -6
  118. package/lib/static/roomle-core-hsc/wasm_modern/RoomleServiceCore.wasm +0 -0
  119. package/lib/static/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
  120. package/lib/{stats-helper-BaTpWjzi.mjs → stats-helper-BFpxduid.mjs} +2 -2
  121. package/lib/{stats-helper-BaTpWjzi.mjs.map → stats-helper-BFpxduid.mjs.map} +1 -1
  122. package/lib/{stats-helper-DylhlHS_.js → stats-helper-D4z7zVEi.js} +2 -2
  123. package/lib/{stats-helper-DylhlHS_.js.map → stats-helper-D4z7zVEi.js.map} +1 -1
  124. package/lib/{tools-core-BF9kMznR.js → tools-core-BJbLUz5-.js} +2 -2
  125. package/lib/{tools-core-BF9kMznR.js.map → tools-core-BJbLUz5-.js.map} +1 -1
  126. package/lib/{tools-core-BbL-KMAf.mjs → tools-core-COGP-hBi.mjs} +3 -3
  127. package/lib/{tools-core-BbL-KMAf.mjs.map → tools-core-COGP-hBi.mjs.map} +1 -1
  128. package/package.json +1 -1
  129. package/lib/camera-behaviour-BLMduSEn.mjs.map +0 -1
  130. package/lib/camera-behaviour-DgLVg_pP.js +0 -50
  131. package/lib/camera-behaviour-DgLVg_pP.js.map +0 -1
  132. package/lib/configurator-scene-manager-CRSHxOfd.js +0 -2
  133. package/lib/configurator-scene-manager-CRSHxOfd.js.map +0 -1
  134. package/lib/configurator-scene-manager-DbsYS4rm.mjs.map +0 -1
  135. package/lib/planner-B3Bt-cWy.mjs.map +0 -1
  136. package/lib/planner-D7lLZxgW.js +0 -155
  137. package/lib/planner-D7lLZxgW.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"banana-for-scale-XjIfe69B.js","sources":["../../packages/configurator-core/public/geometry/banana.glb?no-inline?url","../../packages/configurator-core/src/webgl/banana-for-scale.ts"],"sourcesContent":["export default \"__VITE_ASSET__CEZkpbOl__\"","import inject from '../../../common-core/src/di/inject';\nimport type StaticItemLoader from '../../../common-core/src/webgl/static-item-loader';\nimport { ScenePluginDefaultImplementation } from './plugin-system';\nimport { BANANA_FILE_NAME } from '../static-files/geometries';\nimport type { Box3, Object3D, Scene } from 'three';\nimport { Vector3 } from 'three';\n\nexport default class BananaForScale extends ScenePluginDefaultImplementation {\n private _scene: Scene;\n private _bounds: Box3;\n private _banana: Object3D;\n\n @inject\n private _staticItemLoader: StaticItemLoader;\n\n public setScene(scene: Scene) {\n this._scene = scene;\n\n this._staticItemLoader\n .loadGLB(BANANA_FILE_NAME)\n .then((glb) => {\n this._banana = glb.scene;\n this.updateBounds(null);\n });\n\n console.log(\n '%c' + 'Banana 3D model by https://sketchfab.com/daniel132',\n 'color: #ffe135'\n );\n console.log(\n '%c' +\n 'Banana source: https://sketchfab.com/3d-models/banana-mark-2-a7fef734bf4544cb8a780a858fa6af97',\n 'color: #ffe135'\n );\n console.log(\n '%c' +\n 'Licensed under Creative Commons 4.0: https://creativecommons.org/licenses/by/4.0/',\n 'color: #ffe135'\n );\n }\n\n public updateBounds(bounds: Box3) {\n if (bounds) {\n this._bounds = bounds;\n }\n if (!this._bounds) {\n return;\n }\n if (this._banana) {\n const size = this._bounds.getSize(new Vector3());\n const center = this._bounds.getCenter(new Vector3());\n const position = center.clone();\n position.x -= size.x / 2 + 0.18;\n position.z += size.z / 2 + 0.05;\n position.y = 0;\n let scale = 0.1;\n this._banana.scale.copy(new Vector3(scale, scale, scale));\n this._banana.rotation.y = 0.6;\n this._banana.position.copy(position);\n }\n if (!this._scene.children.includes(this._banana)) {\n this.addToScene();\n }\n }\n\n public clearScene(scene: Scene, uiScene: Scene): void {\n super.clearScene(scene, uiScene);\n\n this.removeFromScene();\n }\n\n public addToScene(): void {\n if (!this._scene || !this._banana) {\n return;\n }\n this._scene.add(this._banana);\n }\n\n public removeFromScene(): void {\n if (!this._scene || !this._banana) {\n return;\n }\n this._scene.remove(this._banana);\n }\n}\n"],"names":["BANANA_FILE_NAME","BananaForScale","ScenePluginDefaultImplementation","scene","glb","bounds","size","Vector3","position","scale","uiScene","exports","__decorateClass","inject"],"mappings":"uIAAA,MAAAA,EAAe,4KCOf,MAAqBC,UAAuBC,CAAiC,CAQpE,SAASC,EAAc,CAC5B,KAAK,OAASA,EAEd,KAAK,kBACF,QAAQH,CAAgB,EACxB,KAAMI,GAAQ,CACb,KAAK,QAAUA,EAAI,MACnB,KAAK,aAAa,IAAI,CACxB,CAAC,EAEH,QAAQ,IACN,uDACA,gBAAA,EAEF,QAAQ,IACN,kGAEA,gBAAA,EAEF,QAAQ,IACN,sFAEA,gBAAA,CAEJ,CAEO,aAAaC,EAAc,CAIhC,GAHIA,IACF,KAAK,QAAUA,GAEb,EAAC,KAAK,QAGV,IAAI,KAAK,QAAS,CAChB,MAAMC,EAAO,KAAK,QAAQ,QAAQ,IAAIC,CAAS,EAEzCC,EADS,KAAK,QAAQ,UAAU,IAAID,CAAS,EAC3B,MAAA,EACxBC,EAAS,GAAKF,EAAK,EAAI,EAAI,IAC3BE,EAAS,GAAKF,EAAK,EAAI,EAAI,IAC3BE,EAAS,EAAI,EACb,IAAIC,EAAQ,GACZ,KAAK,QAAQ,MAAM,KAAK,IAAIF,EAAQE,EAAOA,EAAOA,CAAK,CAAC,EACxD,KAAK,QAAQ,SAAS,EAAI,GAC1B,KAAK,QAAQ,SAAS,KAAKD,CAAQ,CACrC,CACK,KAAK,OAAO,SAAS,SAAS,KAAK,OAAO,GAC7C,KAAK,WAAA,EAET,CAEO,WAAWL,EAAcO,EAAsB,CACpD,MAAM,WAAWP,EAAOO,CAAO,EAE/B,KAAK,gBAAA,CACP,CAEO,YAAmB,CACpB,CAAC,KAAK,QAAU,CAAC,KAAK,SAG1B,KAAK,OAAO,IAAI,KAAK,OAAO,CAC9B,CAEO,iBAAwB,CACzB,CAAC,KAAK,QAAU,CAAC,KAAK,SAG1B,KAAK,OAAO,OAAO,KAAK,OAAO,CACjC,CACF,CAAAC,EAAA,UAAAV,CAAA,EAvEUW,EAAA,CADPC,CAAA,EALkBZ,EAMX,UAAA,mBAAA"}
1
+ {"version":3,"file":"banana-for-scale-BVlDK4jg.js","sources":["../../packages/configurator-core/public/geometry/banana.glb?no-inline?url","../../packages/configurator-core/src/webgl/banana-for-scale.ts"],"sourcesContent":["export default \"__VITE_ASSET__CEZkpbOl__\"","import inject from '../../../common-core/src/di/inject';\nimport type StaticItemLoader from '../../../common-core/src/webgl/static-item-loader';\nimport { ScenePluginDefaultImplementation } from './plugin-system';\nimport { BANANA_FILE_NAME } from '../static-files/geometries';\nimport type { Box3, Object3D, Scene } from 'three';\nimport { Vector3 } from 'three';\n\nexport default class BananaForScale extends ScenePluginDefaultImplementation {\n private _scene: Scene;\n private _bounds: Box3;\n private _banana: Object3D;\n\n @inject\n private _staticItemLoader: StaticItemLoader;\n\n public setScene(scene: Scene) {\n this._scene = scene;\n\n this._staticItemLoader\n .loadGLB(BANANA_FILE_NAME)\n .then((glb) => {\n this._banana = glb.scene;\n this.updateBounds(null);\n });\n\n console.log(\n '%c' + 'Banana 3D model by https://sketchfab.com/daniel132',\n 'color: #ffe135'\n );\n console.log(\n '%c' +\n 'Banana source: https://sketchfab.com/3d-models/banana-mark-2-a7fef734bf4544cb8a780a858fa6af97',\n 'color: #ffe135'\n );\n console.log(\n '%c' +\n 'Licensed under Creative Commons 4.0: https://creativecommons.org/licenses/by/4.0/',\n 'color: #ffe135'\n );\n }\n\n public updateBounds(bounds: Box3) {\n if (bounds) {\n this._bounds = bounds;\n }\n if (!this._bounds) {\n return;\n }\n if (this._banana) {\n const size = this._bounds.getSize(new Vector3());\n const center = this._bounds.getCenter(new Vector3());\n const position = center.clone();\n position.x -= size.x / 2 + 0.18;\n position.z += size.z / 2 + 0.05;\n position.y = 0;\n let scale = 0.1;\n this._banana.scale.copy(new Vector3(scale, scale, scale));\n this._banana.rotation.y = 0.6;\n this._banana.position.copy(position);\n }\n if (!this._scene.children.includes(this._banana)) {\n this.addToScene();\n }\n }\n\n public clearScene(scene: Scene, uiScene: Scene): void {\n super.clearScene(scene, uiScene);\n\n this.removeFromScene();\n }\n\n public addToScene(): void {\n if (!this._scene || !this._banana) {\n return;\n }\n this._scene.add(this._banana);\n }\n\n public removeFromScene(): void {\n if (!this._scene || !this._banana) {\n return;\n }\n this._scene.remove(this._banana);\n }\n}\n"],"names":["BANANA_FILE_NAME","BananaForScale","ScenePluginDefaultImplementation","scene","glb","bounds","size","Vector3","position","scale","uiScene","exports","__decorateClass","inject"],"mappings":"uIAAA,MAAAA,EAAe,4KCOf,MAAqBC,UAAuBC,CAAiC,CAQpE,SAASC,EAAc,CAC5B,KAAK,OAASA,EAEd,KAAK,kBACF,QAAQH,CAAgB,EACxB,KAAMI,GAAQ,CACb,KAAK,QAAUA,EAAI,MACnB,KAAK,aAAa,IAAI,CACxB,CAAC,EAEH,QAAQ,IACN,uDACA,gBAAA,EAEF,QAAQ,IACN,kGAEA,gBAAA,EAEF,QAAQ,IACN,sFAEA,gBAAA,CAEJ,CAEO,aAAaC,EAAc,CAIhC,GAHIA,IACF,KAAK,QAAUA,GAEb,EAAC,KAAK,QAGV,IAAI,KAAK,QAAS,CAChB,MAAMC,EAAO,KAAK,QAAQ,QAAQ,IAAIC,CAAS,EAEzCC,EADS,KAAK,QAAQ,UAAU,IAAID,CAAS,EAC3B,MAAA,EACxBC,EAAS,GAAKF,EAAK,EAAI,EAAI,IAC3BE,EAAS,GAAKF,EAAK,EAAI,EAAI,IAC3BE,EAAS,EAAI,EACb,IAAIC,EAAQ,GACZ,KAAK,QAAQ,MAAM,KAAK,IAAIF,EAAQE,EAAOA,EAAOA,CAAK,CAAC,EACxD,KAAK,QAAQ,SAAS,EAAI,GAC1B,KAAK,QAAQ,SAAS,KAAKD,CAAQ,CACrC,CACK,KAAK,OAAO,SAAS,SAAS,KAAK,OAAO,GAC7C,KAAK,WAAA,EAET,CAEO,WAAWL,EAAcO,EAAsB,CACpD,MAAM,WAAWP,EAAOO,CAAO,EAE/B,KAAK,gBAAA,CACP,CAEO,YAAmB,CACpB,CAAC,KAAK,QAAU,CAAC,KAAK,SAG1B,KAAK,OAAO,IAAI,KAAK,OAAO,CAC9B,CAEO,iBAAwB,CACzB,CAAC,KAAK,QAAU,CAAC,KAAK,SAG1B,KAAK,OAAO,OAAO,KAAK,OAAO,CACjC,CACF,CAAAC,EAAA,UAAAV,CAAA,EAvEUW,EAAA,CADPC,CAAA,EALkBZ,EAMX,UAAA,mBAAA"}
@@ -1,4 +1,4 @@
1
- import { S as r, V as o, j as l } from "./main-CMu7hOEO.mjs";
1
+ import { S as r, V as o, j as l } from "./main-RpgY_kch.mjs";
2
2
  const h = "" + new URL("banana.glb", import.meta.url).href;
3
3
  var d = Object.defineProperty, f = (s, n, a, i) => {
4
4
  for (var e = void 0, t = s.length - 1, c; t >= 0; t--)
@@ -47,4 +47,4 @@ f([
47
47
  export {
48
48
  _ as default
49
49
  };
50
- //# sourceMappingURL=banana-for-scale-CDGM3hdN.mjs.map
50
+ //# sourceMappingURL=banana-for-scale-CKSlc9Tc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"banana-for-scale-CDGM3hdN.mjs","sources":["../../packages/configurator-core/public/geometry/banana.glb?no-inline?url","../../packages/configurator-core/src/webgl/banana-for-scale.ts"],"sourcesContent":["export default \"__VITE_ASSET__CEZkpbOl__\"","import inject from '../../../common-core/src/di/inject';\nimport type StaticItemLoader from '../../../common-core/src/webgl/static-item-loader';\nimport { ScenePluginDefaultImplementation } from './plugin-system';\nimport { BANANA_FILE_NAME } from '../static-files/geometries';\nimport type { Box3, Object3D, Scene } from 'three';\nimport { Vector3 } from 'three';\n\nexport default class BananaForScale extends ScenePluginDefaultImplementation {\n private _scene: Scene;\n private _bounds: Box3;\n private _banana: Object3D;\n\n @inject\n private _staticItemLoader: StaticItemLoader;\n\n public setScene(scene: Scene) {\n this._scene = scene;\n\n this._staticItemLoader\n .loadGLB(BANANA_FILE_NAME)\n .then((glb) => {\n this._banana = glb.scene;\n this.updateBounds(null);\n });\n\n console.log(\n '%c' + 'Banana 3D model by https://sketchfab.com/daniel132',\n 'color: #ffe135'\n );\n console.log(\n '%c' +\n 'Banana source: https://sketchfab.com/3d-models/banana-mark-2-a7fef734bf4544cb8a780a858fa6af97',\n 'color: #ffe135'\n );\n console.log(\n '%c' +\n 'Licensed under Creative Commons 4.0: https://creativecommons.org/licenses/by/4.0/',\n 'color: #ffe135'\n );\n }\n\n public updateBounds(bounds: Box3) {\n if (bounds) {\n this._bounds = bounds;\n }\n if (!this._bounds) {\n return;\n }\n if (this._banana) {\n const size = this._bounds.getSize(new Vector3());\n const center = this._bounds.getCenter(new Vector3());\n const position = center.clone();\n position.x -= size.x / 2 + 0.18;\n position.z += size.z / 2 + 0.05;\n position.y = 0;\n let scale = 0.1;\n this._banana.scale.copy(new Vector3(scale, scale, scale));\n this._banana.rotation.y = 0.6;\n this._banana.position.copy(position);\n }\n if (!this._scene.children.includes(this._banana)) {\n this.addToScene();\n }\n }\n\n public clearScene(scene: Scene, uiScene: Scene): void {\n super.clearScene(scene, uiScene);\n\n this.removeFromScene();\n }\n\n public addToScene(): void {\n if (!this._scene || !this._banana) {\n return;\n }\n this._scene.add(this._banana);\n }\n\n public removeFromScene(): void {\n if (!this._scene || !this._banana) {\n return;\n }\n this._scene.remove(this._banana);\n }\n}\n"],"names":["BANANA_FILE_NAME","BananaForScale","ScenePluginDefaultImplementation","scene","glb","bounds","size","Vector3","position","scale","uiScene","__decorateClass","inject"],"mappings":";AAAA,MAAAA,IAAe;;;;;;ACOf,MAAqBC,UAAuBC,EAAiC;AAAA,EAQpE,SAASC,GAAc;AAC5B,SAAK,SAASA,GAEd,KAAK,kBACF,QAAQH,CAAgB,EACxB,KAAK,CAACI,MAAQ;AACb,WAAK,UAAUA,EAAI,OACnB,KAAK,aAAa,IAAI;AAAA,IACxB,CAAC,GAEH,QAAQ;AAAA,MACN;AAAA,MACA;AAAA,IAAA,GAEF,QAAQ;AAAA,MACN;AAAA,MAEA;AAAA,IAAA,GAEF,QAAQ;AAAA,MACN;AAAA,MAEA;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEO,aAAaC,GAAc;AAIhC,QAHIA,MACF,KAAK,UAAUA,IAEb,EAAC,KAAK,SAGV;AAAA,UAAI,KAAK,SAAS;AAChB,cAAMC,IAAO,KAAK,QAAQ,QAAQ,IAAIC,GAAS,GAEzCC,IADS,KAAK,QAAQ,UAAU,IAAID,GAAS,EAC3B,MAAA;AACxB,QAAAC,EAAS,KAAKF,EAAK,IAAI,IAAI,MAC3BE,EAAS,KAAKF,EAAK,IAAI,IAAI,MAC3BE,EAAS,IAAI;AACb,YAAIC,IAAQ;AACZ,aAAK,QAAQ,MAAM,KAAK,IAAIF,EAAQE,GAAOA,GAAOA,CAAK,CAAC,GACxD,KAAK,QAAQ,SAAS,IAAI,KAC1B,KAAK,QAAQ,SAAS,KAAKD,CAAQ;AAAA,MACrC;AACA,MAAK,KAAK,OAAO,SAAS,SAAS,KAAK,OAAO,KAC7C,KAAK,WAAA;AAAA;AAAA,EAET;AAAA,EAEO,WAAWL,GAAcO,GAAsB;AACpD,UAAM,WAAWP,GAAOO,CAAO,GAE/B,KAAK,gBAAA;AAAA,EACP;AAAA,EAEO,aAAmB;AACxB,IAAI,CAAC,KAAK,UAAU,CAAC,KAAK,WAG1B,KAAK,OAAO,IAAI,KAAK,OAAO;AAAA,EAC9B;AAAA,EAEO,kBAAwB;AAC7B,IAAI,CAAC,KAAK,UAAU,CAAC,KAAK,WAG1B,KAAK,OAAO,OAAO,KAAK,OAAO;AAAA,EACjC;AACF;AAvEUC,EAAA;AAAA,EADPC;AAAA,GALkBX,EAMX,WAAA,mBAAA;"}
1
+ {"version":3,"file":"banana-for-scale-CKSlc9Tc.mjs","sources":["../../packages/configurator-core/public/geometry/banana.glb?no-inline?url","../../packages/configurator-core/src/webgl/banana-for-scale.ts"],"sourcesContent":["export default \"__VITE_ASSET__CEZkpbOl__\"","import inject from '../../../common-core/src/di/inject';\nimport type StaticItemLoader from '../../../common-core/src/webgl/static-item-loader';\nimport { ScenePluginDefaultImplementation } from './plugin-system';\nimport { BANANA_FILE_NAME } from '../static-files/geometries';\nimport type { Box3, Object3D, Scene } from 'three';\nimport { Vector3 } from 'three';\n\nexport default class BananaForScale extends ScenePluginDefaultImplementation {\n private _scene: Scene;\n private _bounds: Box3;\n private _banana: Object3D;\n\n @inject\n private _staticItemLoader: StaticItemLoader;\n\n public setScene(scene: Scene) {\n this._scene = scene;\n\n this._staticItemLoader\n .loadGLB(BANANA_FILE_NAME)\n .then((glb) => {\n this._banana = glb.scene;\n this.updateBounds(null);\n });\n\n console.log(\n '%c' + 'Banana 3D model by https://sketchfab.com/daniel132',\n 'color: #ffe135'\n );\n console.log(\n '%c' +\n 'Banana source: https://sketchfab.com/3d-models/banana-mark-2-a7fef734bf4544cb8a780a858fa6af97',\n 'color: #ffe135'\n );\n console.log(\n '%c' +\n 'Licensed under Creative Commons 4.0: https://creativecommons.org/licenses/by/4.0/',\n 'color: #ffe135'\n );\n }\n\n public updateBounds(bounds: Box3) {\n if (bounds) {\n this._bounds = bounds;\n }\n if (!this._bounds) {\n return;\n }\n if (this._banana) {\n const size = this._bounds.getSize(new Vector3());\n const center = this._bounds.getCenter(new Vector3());\n const position = center.clone();\n position.x -= size.x / 2 + 0.18;\n position.z += size.z / 2 + 0.05;\n position.y = 0;\n let scale = 0.1;\n this._banana.scale.copy(new Vector3(scale, scale, scale));\n this._banana.rotation.y = 0.6;\n this._banana.position.copy(position);\n }\n if (!this._scene.children.includes(this._banana)) {\n this.addToScene();\n }\n }\n\n public clearScene(scene: Scene, uiScene: Scene): void {\n super.clearScene(scene, uiScene);\n\n this.removeFromScene();\n }\n\n public addToScene(): void {\n if (!this._scene || !this._banana) {\n return;\n }\n this._scene.add(this._banana);\n }\n\n public removeFromScene(): void {\n if (!this._scene || !this._banana) {\n return;\n }\n this._scene.remove(this._banana);\n }\n}\n"],"names":["BANANA_FILE_NAME","BananaForScale","ScenePluginDefaultImplementation","scene","glb","bounds","size","Vector3","position","scale","uiScene","__decorateClass","inject"],"mappings":";AAAA,MAAAA,IAAe;;;;;;ACOf,MAAqBC,UAAuBC,EAAiC;AAAA,EAQpE,SAASC,GAAc;AAC5B,SAAK,SAASA,GAEd,KAAK,kBACF,QAAQH,CAAgB,EACxB,KAAK,CAACI,MAAQ;AACb,WAAK,UAAUA,EAAI,OACnB,KAAK,aAAa,IAAI;AAAA,IACxB,CAAC,GAEH,QAAQ;AAAA,MACN;AAAA,MACA;AAAA,IAAA,GAEF,QAAQ;AAAA,MACN;AAAA,MAEA;AAAA,IAAA,GAEF,QAAQ;AAAA,MACN;AAAA,MAEA;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEO,aAAaC,GAAc;AAIhC,QAHIA,MACF,KAAK,UAAUA,IAEb,EAAC,KAAK,SAGV;AAAA,UAAI,KAAK,SAAS;AAChB,cAAMC,IAAO,KAAK,QAAQ,QAAQ,IAAIC,GAAS,GAEzCC,IADS,KAAK,QAAQ,UAAU,IAAID,GAAS,EAC3B,MAAA;AACxB,QAAAC,EAAS,KAAKF,EAAK,IAAI,IAAI,MAC3BE,EAAS,KAAKF,EAAK,IAAI,IAAI,MAC3BE,EAAS,IAAI;AACb,YAAIC,IAAQ;AACZ,aAAK,QAAQ,MAAM,KAAK,IAAIF,EAAQE,GAAOA,GAAOA,CAAK,CAAC,GACxD,KAAK,QAAQ,SAAS,IAAI,KAC1B,KAAK,QAAQ,SAAS,KAAKD,CAAQ;AAAA,MACrC;AACA,MAAK,KAAK,OAAO,SAAS,SAAS,KAAK,OAAO,KAC7C,KAAK,WAAA;AAAA;AAAA,EAET;AAAA,EAEO,WAAWL,GAAcO,GAAsB;AACpD,UAAM,WAAWP,GAAOO,CAAO,GAE/B,KAAK,gBAAA;AAAA,EACP;AAAA,EAEO,aAAmB;AACxB,IAAI,CAAC,KAAK,UAAU,CAAC,KAAK,WAG1B,KAAK,OAAO,IAAI,KAAK,OAAO;AAAA,EAC9B;AAAA,EAEO,kBAAwB;AAC7B,IAAI,CAAC,KAAK,UAAU,CAAC,KAAK,WAG1B,KAAK,OAAO,OAAO,KAAK,OAAO;AAAA,EACjC;AACF;AAvEUC,EAAA;AAAA,EADPC;AAAA,GALkBX,EAMX,WAAA,mBAAA;"}
@@ -0,0 +1,50 @@
1
+ System.register(["./main-DVWEbQdM.js","./main-thread-to-worker-C8MPjAY0.js"],function(T,Rt){"use strict";var ce,l,L,V,_e,Tt,k,At,Bt,I,R,E,O,ct,kt,zt,Nt,Ut,Ft,_t,et,lt,le,Gt,Ht,Z,de,dt,ut,ue,me,B,it,st,j,z,ge,Vt,q,W,fe,Zt,pe,jt,we,mt,gt,ft,ye,nt,ve,pt,Me,Pe,qt,Wt,Ce,Yt,be,xe,Kt,Xt,Ee,Se,Q,Ie,Oe,Le,De,Re,Te,Ae,Be,ke,Y,ze,$t,Ne,Ue,Fe,Ge,He,Ve,Ze,je,at,qe,We,Ye,Ke,Xe,$e,Je,Qe,ti,ei,A,ii,si,ni,Jt,ai,ri,Qt,oi,hi,ci;return{setters:[h=>{ce=h.aq,l=h.V,L=h.bw,V=h.a8,_e=h.bY,Tt=h.c4,k=h.az,At=h.c5,Bt=h.c6,I=h.j,R=h.H,E=h.au,O=h.ao,ct=h.c7,kt=h.bS,zt=h.c0,Nt=h.ap,Ut=h.b$,Ft=h.bv,_t=h.c8,et=h.Q,lt=h.Z,le=h.ax,Gt=h.bF,Ht=h.c9,Z=h.t,de=h.ca,dt=h.O,ut=h.cb,ue=h.cc,me=h.cd,B=h.q,it=h.bU,st=h.ab,j=h.ac,z=h.$,ge=h.ce,Vt=h.cf,q=h.aC,W=h.aD,fe=h.W,Zt=h.o,pe=h.b6,jt=h.ay,we=h.N,mt=h.cg,gt=h.ch,ft=h.ci,ye=h.cj,nt=h.v,ve=h.ck,pt=h.cl,Me=h.bI,Pe=h.u,qt=h.cm,Wt=h.cn,Ce=h.co,Yt=h.cp,be=h.aW,xe=h.cq,Kt=h.aX,Xt=h.m,Ee=h.cr,Se=h.aj,Q=h.a0,Ie=h.cs,Oe=h.ct,Le=h.cu,De=h.cv,Re=h.cw,Te=h._,Ae=h.an,Be=h.bz,ke=h.ag,Y=h.M,ze=h.P,$t=h.cx,Ne=h.L,Ue=h.cy,Fe=h.aS,Ge=h.cz,He=h.cA,Ve=h.cB,Ze=h.ah,je=h.cC,at=h.cD,qe=h.cE,We=h.bl,Ye=h.cF,Ke=h.cG,Xe=h.a5,$e=h.a6,Je=h.cH,Qe=h.cI,ti=h.cJ,ei=h.cK,A=h.cL,ii=h.bp,si=h.bo,ni=h.cM,Jt=h.cN,ai=h.a9,ri=h.a2,Qt=h.h,oi=h.cO,hi=h.cP},h=>{ci=h.s}],execute:function(){T("R",ae);const h=""+new URL("default_1k.exr",Rt.meta.url).href,Ei=""+new URL("legacy_env.exr",Rt.meta.url).href;var Si=Object.defineProperty,te=(d,t,e,i)=>{for(var s=void 0,a=d.length-1,o;a>=0;a--)(o=d[a])&&(s=o(t,e,s)||s);return s&&Si(t,e,s),s},P=T("b",(d=>(d[d.ORBIT_START=0]="ORBIT_START",d[d.ORBIT_MOVE=1]="ORBIT_MOVE",d[d.ORBIT_END=2]="ORBIT_END",d[d.ZOOM_IN=3]="ZOOM_IN",d[d.ZOOM_OUT=4]="ZOOM_OUT",d[d.ZOOM_CHANGE=5]="ZOOM_CHANGE",d[d.KEYBOARD_PRESSED=6]="KEYBOARD_PRESSED",d[d.MOVING=7]="MOVING",d[d.IDLE=8]="IDLE",d))(P||{}));const ee=-30,ie=10,se=-1,_i="debug_camera_position";class K extends ce{constructor(t,e,i){if(super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._distance=se,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=t,this._inputManager=e,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new l,this._targetPosition=new l,i?this.setCurrentCameraParameters(i):(this._cameraPosition=new l(0,.5,3),this._pitch=L(this._initData.verticalCameraAngle??ie),this._yaw=L(this._initData.horizontalCameraAngle??ee)),this._initData.debug&&this._getCamera()instanceof V){const a=this.getDebugCameraPosition();a&&this.setCurrentCameraParameters(a)}const s=this._domHelper.getClientDimensions();this._width=s.x,this._height=s.y,this._dispatchCameraIdle=_e(this._dispatchCameraIdle.bind(this),32)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(t=>{this._inputManager.addEventListener(t.key,t.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(t=>{this._inputManager.removeEventListener(t.key,t.fun)})}setUp(){this._inputListeners.length&&this._inputManager.hasEventListener(this._inputListeners[0].key,this._inputListeners[0].fun,this)||this._addInputListeners()}cleanUp(){this._removeInputListeners()}animateCamera(t){const e=this._cameraPosition;if(!e||Tt(e,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,setTimeout(()=>this._dispatchCameraIdle(),16),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,k.AUTO),this._cameraStandingStill=!1,this._lerpEnabled&&!this._tweenEnd&&!this._globalInitData.e2e){const i=this.getCamera().position.clone(),s=Math.min(t*10,1);i.lerp(e,s),this.getCamera().position.copy(i)}else this.getCamera().position.copy(e);return!0}getDebugCameraPosition(){return JSON.parse(localStorage.getItem(_i))}saveDebugCameraPosition(){localStorage.setItem(_i,JSON.stringify(this.getCurrentCameraParameters()))}_dispatchCameraIdle(){this.dispatchEvent(8,k.AUTO)}_tweenCameraParameter(t,e,i=!1){return this._globalInitData.e2e||!this._initData.animateCamera?(this.dispatchEvent(0,k.AUTO),this.dispatchEvent(1,k.AUTO),this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._setCameraNear(),this._update(new l(e.targetX,e.targetY,e.targetZ),i),this.dispatchEvent(1,k.AUTO),this.dispatchEvent(2,k.AUTO),this.dispatchEvent(8,k.AUTO),Promise.resolve()):new Promise(s=>{if(e.yaw-t.yaw<=-Math.PI?t.yaw-=Math.PI*2:e.yaw-t.yaw>=Math.PI&&(t.yaw+=Math.PI*2),this._tweenEnd!==null&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=e;const a=new At(t).to(e,400).easing(Bt.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,k.AUTO),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._setCameraNear(),this._update(new l(t.targetX,t.targetY,t.targetZ),i,!0)}).onComplete(()=>{this.dispatchEvent(2,k.AUTO),this._dispatchCameraIdle(),this._tweenEnd=null,window.TWEEN?.remove(a),s()}).start();window.TWEEN?.add(a),this.dispatchEvent(0,k.AUTO)})}_setCameraNear(){const t=this.getCamera();if(t instanceof V){const e=Math.max(.1,this._distance/6);t.near=e}}getCurrentCameraParameters(){const t=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:t.x,targetY:t.y,targetZ:t.z}}setCurrentCameraParameters(t){this._yaw=t.yaw??0,this._pitch=t.pitch??0,this._distance=t.distance??0,this._targetPosition.copy(new l(t.targetX,t.targetY,t.targetZ)),this._update(null,!0,!0)}_rotateHorizontal(t){this._yaw-=t,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(t){this._pitch+=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(t){if(t||!this._stateSaved){const e=this._yaw,i=this._pitch,s=this._distance,a=this._targetPosition.clone();if(this._stateSaved={yaw:e,pitch:i,distance:s,targetX:a.x,targetY:a.y,targetZ:a.z,blockOtherTweens:!0},this._getCamera().fov){const o=this._getCamera();this._stateSaved.fov=o.fov,this._stateSaved.near=o.near,this._stateSaved.far=o.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;const t=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:t.x,targetY:t.y,targetZ:t.z},this._stateSaved,!0)}this._stateSaved=null}async setToState(t,e){await this._tweenCameraParameter(t,e,!0)}hasSavedState(){return this._stateSaved!=null}lock(){this._locked=!0}unlock(){this._locked=!1}isLocked(){return this._locked}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(t){const{x:e,y:i}=this._domHelper.getClientDimensions();return new l(t.x/e*2-1,-(t.y/i)*2+1,.5)}addLightContainer(t){t.name="lights";const e=this._getCamera(),i=e.children.find(s=>s.name==="lights");i&&e.remove(i),e.add(t)}checkNearFarDistance(t){if(!t)return;const e=this._cameraPosition.distanceTo(t),i=this._getCamera();i instanceof V&&e>i.far&&(i.far=e+1)}setBounds(t){this._boundingBox=t}get domHelper(){return this._domHelper}}T("a",K),te([I],K.prototype,"_domHelper"),te([I],K.prototype,"_initData"),te([I],K.prototype,"_globalInitData");class ne{constructor(t,e){this.minZoom=!1,this.maxZoom=!1,this.minZoom=t,this.maxZoom=e}}var G=(d=>(d[d.NONE=0]="NONE",d[d.ORBIT=1]="ORBIT",d[d.MOVE=2]="MOVE",d))(G||{});const li=1,Ii=4,Oi=2,Li=3,di=2,ui=.3,wt=3,as=T("D",2.725),mi=85;class yt extends K{constructor(t,e,i,s){super(t,e,i),this._bounds=new l,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,Li),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=L(0),this.maxPolarAngle=L(mi),this._objectRotation=0,this._lookAtSide=0,this.minAzimuthAngle=Number.NEGATIVE_INFINITY,this.maxAzimuthAngle=Number.POSITIVE_INFINITY,this._zoomDistance=.1,this._userInteraction=!1,this._currentZoomHash="",this._maxZoomedIn=!1,this._maxZoomedOut=!1,this._panningEnabled=!1,this._targetPositionIsPanned=!1,s?this._camera=s:this._initCamera(),this._camera.fov=30,this._targetPosition||(this._targetPosition=new l(0,0,0),this._targetPositionIsPanned=!1);const{cameraRestriction:a,zoomDistance:o,minVerticalCameraAngle:_,maxVerticalCameraAngle:u,minHorizontalCameraAngle:g,maxHorizontalCameraAngle:p}=this._initData;if(o&&(this._zoomDistance=o/100),_!==void 0&&(this.minPolarAngle=L(_<0?_:_*-1)),u!==void 0&&(this.maxPolarAngle=L(u)),g!==void 0&&(this.minAzimuthAngle=L(g<0?g:g*-1)),p!==void 0&&(this.maxAzimuthAngle=L(p)),a!==void 0){let v=Math.abs(L(a));this.minAzimuthAngle=-v,this.maxAzimuthAngle=v,this.maxPolarAngle=Math.min(v,L(mi))}this._update()}_getCamera(){return this._camera?this._camera:(this._initCamera(),this._camera)}getCamera(){return super.getCamera()}_initCamera(){this._camera=new V,this._camera.fov=30,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(R.OBJECT),this._camera.layers.enable(R.LIGHTING),this._camera.layers.enable(R.BACKGROUND),this._camera.layers.enable(R.UI),this._camera.layers.enable(R.PREVIEW)}setObjectRotation(t,e=0){this._objectRotation=t,this._lookAtSide=e}getObjectRotation(){return this._objectRotation}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions();this._camera.aspect=t/e,this._camera.updateProjectionMatrix()}animateCamera(t){if(!super.animateCamera(t))return!1;let e=this._targetPosition;return e?(this.getCamera().lookAt(e),!0):!1}_initInputListener(){this._inputListeners.push({key:E.DOWN,fun:()=>{this._state=1}}),this._inputListeners.push({key:E.MOVE,fun:t=>{this._state===1&&!this._locked&&(this._userInteraction=!0,!(t.event?.shiftKey!==void 0&&t.event?.shiftKey)&&this._panningEnabled&&this.disablePanning(),this._move(new O(t.position.x,t.position.y),t.type))}}),this._inputListeners.push({key:E.PAN,fun:t=>{this._state!==1&&!this._locked&&(this._userInteraction=!0,this._pan(new O(t.position.x,t.position.y),t.type))}}),this._inputListeners.push({key:E.UP,fun:t=>{this._state===1&&this.dispatchEvent(P.ORBIT_END,t.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:E.ZOOM_IN,fun:({event:t})=>{this._maxZoomedIn||(t&&(t.preventDefault(),t.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:E.ZOOM_OUT,fun:({event:t})=>{this._maxZoomedOut||(t&&(t.preventDefault(),t.stopPropagation()),this.zoomOut())}})}_panTargetPosition(t){const e=t.clone().sub(this._orbitPosition),i=this._domHelper.element,s=this._targetPosition.project(this._camera),a=Math.max(Oi,(1-this._distance/this.maxDistance)*Ii);s.x=s.x-e.x/i.clientHeight*a,s.y=s.y+e.y/i.clientHeight*a,this._targetPositionIsPanned=!0,this._targetPosition.copy(s.unproject(this._camera))}_pan(t,e){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new O(t.x,t.y),this.dispatchEvent(P.ORBIT_START,e)),this._panTargetPosition(t),ct(this._orbitPosition,t)||this.dispatchEvent(P.ORBIT_MOVE,e),this._orbitPosition.copy(t),this._update()}_move(t,e){this._orbitPosition||(this._orbitPosition=new O(t.x,t.y),this.dispatchEvent(P.ORBIT_START,e));const i=t.clone().sub(this._orbitPosition),s=this._domHelper.element;this._panningEnabled?this._panTargetPosition(t):(this._rotateHorizontal(2*Math.PI*i.x/s.clientWidth*li),this._rotateVertical(2*Math.PI*i.y/s.clientHeight*li)),ct(this._orbitPosition,t)||this.dispatchEvent(P.ORBIT_MOVE,e),this._orbitPosition.copy(t),this._update()}checkBoundsAndPlaceCamera(t,e=!0){if(this._boundingBox&&kt(t,this._boundingBox)<=0){this.setBounds(t);return}this.zoomToFitBounds(t,e)}adjustToBoundsWithoutChangingDistance(t){this.setBounds(t);const e=t.getSize(new l);if(this._initData.debug||e.x+e.y+e.z===0)return;const i=this.getCurrentCameraParameters(),s=t.getCenter(new l);this._setDistanceAndRangesBasedOnBounds(e,!1);const a={yaw:i.yaw,pitch:i.pitch,distance:this._distance,targetX:s.x,targetY:s.y,targetZ:s.z};zt(i,a)||this._tweenCameraParameter(i,a,!1)}zoomToFitBounds(t,e=!0){this.setBounds(t);const i=t.getSize(new l);if(this._initData.debug||i.x+i.y+i.z===0)return;const s=this.getCurrentCameraParameters(),a=t.getCenter(new l),o=this._setDistanceAndRangesBasedOnBounds(i);this._checkZoomDistance(t,o);const _={yaw:e?this._yaw:s.yaw,pitch:e?this._pitch:s.pitch,distance:o,targetX:a.x,targetY:a.y,targetZ:a.z};zt(s,_)||this._tweenCameraParameter(s,_,!1)}updateToBounds(t,e,i=!0,s){if(this.setBounds(t),this._initData.debug)return;const a=t.getCenter(new l);s?(this._targetPosition=s.clone(),this._targetPositionIsPanned=!1):this._targetPositionIsPanned||(this._targetPosition=new l(a.x,a.y,a.z));const o=this.getCurrentCameraParameters(),_=t.getSize(new l);if(i){const u=this._setDistanceAndRangesBasedOnBounds(_);this._distance=u,this._checkZoomDistance(t,u),this._userInteraction?this._tweenCameraParameter(o,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},e):this._update()}else this._setDistanceAndRangesBasedOnBounds(_,!1);this._update()}_checkZoomDistance(t,e){const i=t.getBoundingSphere(new Nt);e-i.radius<this._zoomDistance&&(console.warn("the initial camera position is closer than the zoomDistance param, zoomDistance is set to initial camera position."),this._zoomDistance=e-i.radius)}_setDistanceAndRangesBasedOnBounds(t,e=!0){const{offsetWidth:i,offsetHeight:s}=this._getOffset();this._bounds.copy(t);const{cameraSpacing:a}=this._initData;t.addScalar(a/100),this.minDistance=Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z);const o=Math.max(t.x,t.y),{x:_,y:u}=this._getMargin(i,s),g=Ut(t.x+_,t.y+u,t.z,this._camera.fov,i,s);return this._distance<g&&e&&(this._distance=g),this.maxDistance=g+o,this.maxDistance<di&&(this.maxDistance=di),this._camera.far=this.maxDistance*5,this._setCameraNear(),g}_getIdealDistance(){const{offsetWidth:t,offsetHeight:e}=this._getOffset(),{x:i,y:s}=this._getMargin(t,e);return Ut(this._bounds.x+i,this._bounds.y+s,this._bounds.z,this._camera.fov,t,e)}_getOffset(){const t=this._domHelper.getClientDimensions(),e=t.x,i=t.y,s=this._camera.offset?e-e*this._camera.offset.left-e*(1-this._camera.offset.right):e,a=this._camera.offset?i-i*this._camera.offset.bottom-i*(1-this._camera.offset.top):i;return{offsetWidth:s,offsetHeight:a}}_getMargin(t,e){const i=Math.max(this._bounds.x,this._bounds.y);let s=i>wt?0:this._bounds.x/2,a=i>wt?0:this._bounds.y/2;const o=1080;if(t>o){const _=i>wt?0:this._bounds.x;s+=i<ui?.1:0,s+=_*(t/o-1)}if(e>o){const _=i>wt?0:this._bounds.y;s+=i<ui?.1:0,a+=_*(e/o-1)}return{x:s,y:a}}reset(t,e,i,s,a=!0){const o=t.getSize(new l);if(o){if(e)this._targetPosition.copy(e);else{const M=t.getCenter(new l);this._targetPosition.copy(M)}const _=this.getCurrentCameraParameters();if(i||(i=this._initData.horizontalCameraAngle??ee),s||(s=this._initData.verticalCameraAngle??ie),i+=Ft(this._objectRotation),this._initData.debug){this._distance=this._setDistanceAndRangesBasedOnBounds(o),this._update(this._targetPosition),this._setDistanceAndRangesBasedOnBounds(o);return}const u=this._setDistanceAndRangesBasedOnBounds(o),g=L(s),p=L(i);let v=this._targetPosition.clone();a?this._tweenCameraParameter(_,{yaw:p,pitch:g,distance:u,targetX:v.x,targetY:v.y,targetZ:v.z},!0):(this._pitch=g,this._yaw=p,this._distance=u,this._update(this._targetPosition))}else console.warn("you cant reset without bounds!")}updateDistanceAndRangesBasedOnBounds(t){if(!t)return;const e=t.getSize(new l),i=t.getCenter(new l);this.setBounds(t),this._targetPosition.copy(i),this._setDistanceAndRangesBasedOnBounds(e,!1)}async updateAndReset(t,e=!0){const i=t.getSize(new l),s=t.getCenter(new l);this.setBounds(t),this._targetPosition.copy(s),this._distance===se&&(this._distance=this._setDistanceAndRangesBasedOnBounds(i));const a=this.getCurrentCameraParameters();this._camera.fov=30,this._pitch=L(this._initData.verticalCameraAngle??ie);const o=this._initData.horizontalCameraAngle??ee;this._yaw=L(o*(this._lookAtSide<0?-1:1)+Ft(this._objectRotation)),this._setDistanceAndRangesBasedOnBounds(i);let _=this._targetPosition.clone();e?await this._tweenCameraParameter(a,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:_.x,targetY:_.y,targetZ:_.z},!0):this._update(this._targetPosition)}_update(t,e,i){i||(this._yaw=_t(this._yaw,this.minAzimuthAngle,this.maxAzimuthAngle),this._pitch=this._initData.debug?_t(this._pitch,L(-89),L(89)):_t(this._pitch,this.minPolarAngle,this.maxPolarAngle),this._saveYawAndPitch());const s=new et().setFromEuler(new lt(-this._pitch,this._yaw,0,"ZYX")),a=new l(0,0,-1).applyQuaternion(s);i||(this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance))),t&&this._targetPosition.copy(t);const o=this._targetPosition.clone().sub(a.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(o),this._zoomChanged(!1,!1);else if(e)this._cameraPosition.copy(o);else{const _=this._getCameraSphere(o);this._boundingBox!=null&&this._boundingBox.intersectsSphere(_)&&this._scale>=1?this._distance+=.1:this._boundingBox!=null&&!this._boundingBox.intersectsSphere(_)?(this._cameraPosition.copy(o),this._zoomChanged(this._distance===this.maxDistance,!1)):this._zoomChanged(!1,!0)}this._scale=1}_zoomChanged(t,e){let i=t+""+e;this._currentZoomHash?.length===0||this._currentZoomHash!==i?(this.dispatchEvent(P.ZOOM_CHANGE,new ne(t,e)),this._currentZoomHash=i):!t&&!e&&this.dispatchEvent(P.ZOOM_CHANGE,new ne(t,e)),this._maxZoomedIn=e,this._maxZoomedOut=t}zoomTo(t){return this._tweenCameraParameter(this.getCurrentCameraParameters(),t,!0)}_getCameraSphere(t){const e=Math.max(this._bounds.x,this._bounds.y),i=Math.max(e/10,this._zoomDistance);return new Nt(t,i)}zoomIn(t){this._lerpEnabled=!0,this._scale*=t?Math.pow(.95,t):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(P.ZOOM_IN)}zoomOut(t){this._lerpEnabled=!0,this._scale/=t?Math.pow(.95,t):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(P.ZOOM_OUT)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=se,this._targetPosition=new l(0,0,0),this._targetPositionIsPanned=!1)}async moveCamera(t){const{x:e,y:i,z:s}=this._boundingBox.getCenter(new l);t.targetX=t.targetX||e,t.targetY=t.targetY||i,t.targetZ=t.targetZ||s,t.distance=t.distance||this._getIdealDistance();const a=this.getCurrentCameraParameters(),o=le(JSON.parse(JSON.stringify(a)),t);return this._tweenCameraParameter(a,o,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}getKernelZoomFactor(){const e=this.maxDistance;return 1-this._distance/(e-2)+.2}}T("C",yt);class tt{constructor(){this.animationMap=new Map}static setObjectAnimations(t,e,i){if(!e||Object.keys(e).length===0){t.userData.objectAnimations=void 0;return}t.userData.objectAnimations=new tt;const s=new Map;for(const a in e)s.set(a,{matrix:Gt(e[a].matrix),visible:e[a].visibility,initial:e[a].initial});this.addObjectAnimations(t,s,i)}static addObjectAnimations(t,e,i){if(!e||e.size===0)return;t.userData.objectAnimations??=new tt;const s=t.userData.objectAnimations;e.forEach((a,o)=>{if(s.animationMap.set(o,a),i?.animationValueMap?.hasKeyAndValue(o)){if(t.userData.transform){const _=t.userData.transform.clone().multiply(a.matrix);Ht(t,_)}t.visible=a.visible}})}static removeObjectAnimations(t,e){if(!t.userData?.objectAnimations)return;const i=t.userData.objectAnimations;i.animationMap.delete(e),i.animationMap.size===0&&(t.userData.objectAnimations=void 0)}static animateObject(t,e,i,s=!0,a){return t.userData.objectAnimations instanceof tt?t.userData.objectAnimations._animate(t,e,i,s,a):null}_animate(t,e,i,s=!0,a){let o=new Z,_=this.animationMap.get(`${e}:${i.from}`),u=this.animationMap.get(`${e}:${i.to}`);if(i.priorAnimations.length>0||i.subsequentAnimations.length>0){o=this._calculateCombinedAnimationMatrix(i.priorAnimations);const g=this._calculateCombinedAnimationMatrix(i.subsequentAnimations);_=this._calculateAnimationTransformation(_,g),u=this._calculateAnimationTransformation(u,g)}return this._animateMesh(t,o,_,u,s,a)}_calculateCombinedAnimationMatrix(t){const e=new Z;return t.forEach(i=>{const s=this.animationMap.get(i);s?.matrix&&e.multiply(s.matrix)}),e}_calculateAnimationTransformation(t,e){const i=e.clone();return t?.matrix&&i.multiply(t.matrix),{matrix:i,visible:t?.visible??!0,initial:!1}}_animateMesh(t,e,i,s,a=!0,o){if(!t.userData||!i&&!s)return null;t.userData.transform??=t.matrix.clone();const _=t.userData.transform.clone(),u=s?.matrix.clone()??new Z;if(a){const g=i?.matrix.clone()??new Z;return de(t,e,g,u,_,o)}return Ht(t,_.clone().multiply(u).multiply(e)),s?.visible!==void 0&&(t.visible=s.visible),o&&o(),null}}T("O",tt);var Di=Object.defineProperty,Ri=(d,t,e,i)=>{for(var s=void 0,a=d.length-1,o;a>=0;a--)(o=d[a])&&(s=o(t,e,s)||s);return s&&Di(t,e,s),s};const Ti=!1,Ai=T("g",1500),Bi=T("P",5);function ae(){class d extends dt{constructor(n,r,c,m,f){super(),this._selected=!1,this.isChildPlanObject=!1,this.geometryChanged=!0,this.meshes=[],this._lightSources=new Map,this.castShadow=!1,this.receiveShadow=!0,this._setValues(n,r,c,m,f)}static _generateOutline(n,r){const c=new ut(new ue(n),new me({color:"#000000",dashSize:.03,gapSize:.01,linewidth:1}));return c.translateOnAxis(r,1),c.userData.ignoreComponentRaycast=!0,c}static cloneDockLine(n,r){const c=new ut(n.geometry,n.material);return c.translateOnAxis(r.getCenter(new l),1),c.name="dockline",c.layers.set(R.PREVIEW),c.userData.ignoreComponentRaycast=!0,c}_setValues(n,r,c,m,f){n&&(this.runtimeId=n,this.name=n.toString()),r&&(this.roomlePosition=Object.assign({},r)),c&&(this.roomleRotation=Object.assign({},c)),m&&(this.parentObjectId=m),f&&(this.isRootComponent=f)}get loadingMesh(){return this._loadingMesh}get boundingBoxMesh(){return this._boundingBoxMesh}get boundingBox(){return this._boundingBox}set roomlePosition(n){this._roomlePosition=n,n&&this.position.set(n.x/1e3,n.z/1e3,n.y/-1e3)}get roomlePosition(){return this._roomlePosition}set roomleRotation(n){this._roomleRotation=n,n&&this.rotation.set(n.x,n.z,-n.y)}get roomleRotation(){return this._roomleRotation}replaceMeshes(n){this.removeAllMeshes(),n.forEach(r=>{this.addMesh(new B(r.geometry,r.material))})}addMesh(n,r){n.renderOrder=2,n.userData.meshType=0,r&&n.applyMatrix4(Gt(r)),this.add(n),this.meshes.push(n)}getMeshById(n){return this.meshes.find(r=>r.userData.meshId===n)}removeMeshById(n){const r=this.getMeshById(n);if(!r){console.warn("Could not remove mesh with id "+n,this.runtimeId,this.meshes);return}this.removeMesh(r)}removeMesh(n){const r=this.meshes.indexOf(n);this.remove(n),it(n),!(r<0)&&this.meshes.splice(r,1)}removeAllMeshes(n=!0){this.removeAllLightSources(),this.meshes.forEach(r=>{this.remove(r),n&&it(r)}),this.meshes=[],this._removeLoadingMesh(),this.remove(this._boundingBoxMesh),it(this._boundingBoxMesh),this._boundingBoxMesh=null}getLightSourceById(n){return this._lightSources.get(n)}removeLightSourceById(n){const r=this._lightSources.get(n);r&&(r.removeFromScene(),this._lightSources.delete(n))}removeAllLightSources(){this._lightSources.forEach(n=>{n.removeFromScene()}),this._lightSources.clear()}addLightSource(n){this._lightSources.has(n.lightSourceId)||(this._lightSources.set(n.lightSourceId,n),n.addToScene(this))}getAllLightSources(){return this._lightSources}_hideAllMeshes(){this.meshes.forEach(n=>n.visible=!1)}_showAllMeshes(){this.meshes.forEach(n=>n.visible=!0)}select(){this._selected=!0}loading(){if(!this._kernelBoundingBox){console.warn("Bounding box (box for measurements) for component "+this.runtimeId+" not set, can not show external mesh loading box!");return}this._removeLoadingMesh(),this._hideAllMeshes();const{x:n,y:r,z:c}=this._kernelBoundingBox.getSize(new l),m=new st(n,r,c);this._loadingMesh=new B(m,j.createMeshStandardMaterial({transparent:!0,opacity:ge,color:new z(Vt)})),this._loadingMesh.name="loading mesh",this._loadingMesh.receiveShadow=!1,this._loadingMesh.castShadow=!1,this._loadingMesh.layers.set(R.PREVIEW),this._loadingMesh.translateOnAxis(this._kernelBoundingBox.getCenter(new l),1),this._loadingMesh.renderOrder=3,this.add(this._loadingMesh)}_removeLoadingMesh(){this._loadingMesh&&(this.remove(this._loadingMesh),it(this._loadingMesh),this._loadingMesh=null)}loadingFinished(){this._removeLoadingMesh(),this._showAllMeshes()}deselect(){this._selected=!1}hoverOn(){q(W.HOVER)}hoverOff(){q(W.DEFAULT)}computeBoundingBox(n,r=!1){if(this._boundingBoxMesh&&this.remove(this._boundingBoxMesh),!r&&n&&n.size.x===0&&n.size.y===0&&n.size.z===0)return;let c;if(!n||r){this._boundingBox=new fe;const f=new l;this.meshes.forEach(D=>{if(D.geometry instanceof Zt){const S=D.geometry.attributes.position;if(S!==void 0)for(let x=0,F=S.count;x<F;x++)f.fromBufferAttribute(S,x).applyMatrix4(D.matrix),this._boundingBox.expandByPoint(f)}}),this._kernelBoundingBox=this._boundingBox.clone();const w=this._boundingBox.max.x-this._boundingBox.min.x,b=this._boundingBox.max.y-this._boundingBox.min.y,y=this._boundingBox.max.z-this._boundingBox.min.z;c=new st(w,b,y)}else{this._kernelBoundingBox=pe(n),this._boundingBox=this._kernelBoundingBox.clone();const{x:f,y:w,z:b}=this._boundingBox.getSize(new l);c=new st(f,w,b)}this._boundingBoxMesh=new B(c,j.createMeshStandardMaterial({color:"#FFFFFF",transparent:!0,opacity:0,polygonOffset:!0,polygonOffsetFactor:-1,visible:Ti})),this._boundingBoxMesh.name="bounding box mesh";const m=this._boundingBox.getCenter(new l);this._boundingBoxMesh.position.add(m),this._boundingBoxMesh.layers.set(R.PREVIEW),this._boundingBoxMesh.renderOrder=3,this._boundingBoxMesh.castShadow=!1,this._boundingBoxMesh.receiveShadow=!1,this.add(this._boundingBoxMesh),this._dockline=d._generateOutline(c,m),this._dockline.name="bounding box outline",this._dockline.layers.set(R.PREVIEW),this._selected&&this.add(this._dockline)}recursiveMeshes(){const n=this.meshes.slice();return this.children.forEach(r=>{r instanceof d&&n.push(...r.recursiveMeshes())}),n}isChild(n){let r=!1;return this.children.forEach(c=>{c instanceof d&&!r&&(c.runtimeId===n?r=!0:r=c.isChild(n))}),r}getKernelPosition(n){const r=this.parent.localToWorld(this.position);return jt(n.worldToLocal(r))}animateMeshes(n,r,c=!0,m){this.meshes.forEach(f=>tt.animateObject(f,n,r,c,m))}}class t extends d{constructor(n,r){super(n,null,null,null,!1),this.glbUrl=r}}const e=class xi extends d{constructor(n,r,c,m,f,w){super(r,c,m,f,w),this._stringId=null,this.receivedPointAssociation=!1,this.castShadow=!1,this.receiveShadow=!1,this._creator_=n}get stringId(){return this._stringId?this._stringId:this.runtimeId.toString()}addMesh(n,r){super.addMesh(n,r),n.material instanceof we&&(n.material.opacity=mt,n.material.roughness=gt,n.material.metalness=ft,n.material.color=new z(this._initData.colors.PREVIEW_DOCKING_COLOR)),n.renderOrder=1,n.castShadow=!1,n.receiveShadow=!1}startPulsating(){if(this._initData?.featureFlags?.pulsePreview)for(const n of this.meshes){const r={opacity:mt},c={opacity:.3},m=new At(r).to(c,Ai).easing(Bt.Sinusoidal.In).onUpdate(()=>{n.material.opacity=r.opacity}).onStop(()=>{window.TWEEN?.remove(m)}).yoyo(!0).repeat(Bi).start();window.TWEEN?.add(m)}}hoverOn(){this.remove(this._dockline),this.meshes.forEach(({material:n})=>{n.opacity=ye,n.roughness=gt,n.metalness=ft,n.color=new z(this._initData.colors.PREVIEW_DOCKING_COLOR)}),q(W.HOVER)}hoverOff(){this.add(this._dockline),this.meshes.forEach(({material:n})=>{n.opacity=mt,n.roughness=gt,n.metalness=ft,n.color=new z(this._initData.colors.PREVIEW_DOCKING_COLOR)}),q(W.DEFAULT)}clonePreview(n){const r=new xi(this._creator_,this.runtimeId,this.roomlePosition,this.roomleRotation,this.parentObjectId,this.isRootComponent);return r._stringId=this.runtimeId+"_"+n,this.children.forEach(c=>{c instanceof B&&c.userData.meshType===0&&r.meshes.push(c.clone(!0))}),r.meshes.forEach(c=>{c.material=c.material.clone(),c.geometry=c.geometry.clone(),r.add(c)}),this._dockline&&(r._dockline=d.cloneDockLine(this._dockline,this._boundingBox)),this._boundingBoxMesh&&(r._boundingBoxMesh=this._boundingBoxMesh.clone(!0)),this._boundingBox&&(r._boundingBox=this._boundingBox.clone()),r}preparePreview(){this.add(this._dockline),this.add(this._boundingBoxMesh)}};Ri([I],e.prototype,"_initData");let i=e;class s extends i{constructor(n,r,c,m,f,w){super(n,r,c,m,f,!1),this.lineSegments=[],w&&(this._stringId=this.runtimeId+"_has_additional_dock_point_copy")}set roomleLineFrom(n){this._roomleLineFrom=n,this.lineFrom=nt(n)}get roomleLineFrom(){return this._roomleLineFrom}set roomleLineTo(n){this._roomleLineTo=n;const r=nt(n);r.equals(this.lineFrom)&&(console.warn("lineFrom and lineTo are equal!"),r.add(new l(0,.01,0))),this.lineTo=r}get roomleLineTo(){return this._roomleLineTo}set roomlePositionFrom(n){this._roomlePositionFrom=n,this.positionFrom=nt(n)}get roomlePositionFrom(){return this._roomlePositionFrom}set roomlePositionTo(n){this._roomlePositionTo=n;const r=nt(n);r.equals(this.positionFrom)&&(console.warn("positionFrom and positionTo are equal!"),r.add(new l(0,.01,0))),this.positionTo=r}get roomlePositionTo(){return this._roomlePositionTo}addMesh(n,r){super.addMesh(n,r),n.visible=!1,n.renderOrder=3}hoverOn(){this._dockline.visible=!0,q(W.HOVER)}hoverOff(){this._dockline.visible=!1,q(W.DEFAULT)}preparePreview(){super.preparePreview(),this._dockline.visible=!1;const n=this.lineTo.clone(),r=this.lineFrom.clone(),c=new l().subVectors(n,r),m=c.length(),f=c.normalize();this._createLineMesh(.01,m,this.lineSegments);const w=new et().setFromUnitVectors(new l(0,1,0),f);this.lineMesh.quaternion.multiply(w),this.lineMesh.renderOrder=1;const b=new l().addVectors(n,r).multiplyScalar(.5);this.lineMesh.position.copy(new l().subVectors(b,this.position.clone())),this.add(this.lineMesh);const y=this._boundingBox.getCenter(new l).applyEuler(this.docklineRotation);let D=null,S=0;const x=Math.abs(f.x),F=Math.abs(f.y),ot=Math.abs(f.z);x>=F&&x>=ot?(D=new l(y.x,0,0),S=Math.sqrt(y.y*y.y+y.z*y.z)):F>=x&&F>=ot?(D=new l(0,y.y,0),S=Math.sqrt(y.x*y.x+y.z*y.z)):ot>=F&&ot>=x&&(D=new l(0,0,y.z),S=Math.sqrt(y.y*y.y+y.x*y.x)),S=S>0?S:.01;const ht=new l().subVectors(this.positionTo.clone(),this.positionFrom.clone()).length()+D.length();this._createBoundingLineMesh(S*1.1,ht,this.lineSegments);const Dt=this.positionTo.clone(),X=this.positionFrom.clone(),$=new l().subVectors(Dt,X).normalize(),J=new et().setFromUnitVectors(new l(0,1,0),$);this.boundingLineMesh.quaternion.multiply(J),this.boundingLineMesh.renderOrder=3;const ns=new l().addVectors(this.positionTo.clone(),this.positionFrom.clone()).multiplyScalar(.5).add(y);this.boundingLineMesh.position.copy(new l().subVectors(ns,this.position.clone())),this.add(this.boundingLineMesh)}_createLineMesh(n,r,c){this.lineMesh=this._createPreviewMesh(n,r,c,16,j.createMeshStandardMaterial({color:Vt,transparent:!0,opacity:ve})),this.lineMesh.name="line mesh"}_createBoundingLineMesh(n,r,c){this.boundingLineMesh=this._createPreviewMesh(n,r,c,32,j.createMeshStandardMaterial({color:"#ffffff",transparent:!0,opacity:0})),this.boundingLineMesh.name="bounding line mesh",this.boundingLineMesh.userData.ignoreComponentRaycast=!0,this.boundingLineMesh.layers.set(R.PREVIEW)}_createPreviewMesh(n,r,c,m,f){let w;if(c.length===0)w=new pt(n,n,r,m,1);else{const b=[];for(const y of c){const D=y.to-y.from,S=(y.from+y.to)/2,x=new pt(n,n,D,m,1);x.translate(0,S-r/2,0),b.push(x)}w=Me(b,!1)}return new B(w,f)}clonePreviewLine(n){const r=new s(this._creator_,this.runtimeId,this.roomlePosition,this.roomleRotation,this.parentObjectId,this.receivedPointAssociation);return r._stringId=this.runtimeId+"_"+n,this.children.forEach(c=>{c instanceof B&&c.userData.meshType===0&&r.meshes.push(c.clone(!0))}),r.meshes.forEach(c=>{c.material=c.material.clone(),c.geometry=c.geometry.clone(),r.add(c)}),this._dockline&&(r._dockline=d.cloneDockLine(this._dockline,this._boundingBox)),this._boundingBoxMesh&&(r._boundingBoxMesh=this._boundingBoxMesh.clone(!0)),this._boundingBox&&(r._boundingBox=this._boundingBox.clone()),r}getPositionForIntersectionPoint(n){const r=this._boundingBox.getCenter(new l).applyEuler(this.docklineRotation),c=this.positionTo.clone().add(r),m=this.positionFrom.clone().add(r),w=new Pe(m,c).closestPointToPoint(n,!0,new l);return(isNaN(w.x)||isNaN(w.y)||isNaN(w.z))&&w.copy(n),w.sub(r)}updatePreviewPosition(n){const r=this.getPositionForIntersectionPoint(n),c=this.parent.localToWorld(r);this._newPosition=this.worldToLocal(c);const m=this._boundingBox.getCenter(new l).applyEuler(this.docklineRotation);this._dockline.position.copy(new l().addVectors(this._newPosition,m)),this._dockline.rotation.copy(this.docklineRotation)}hideSelectionLine(){this._dockline.visible=!1}getKernelPosition(n){if(this._newPosition){const r=this.localToWorld(this._newPosition);return jt(n.worldToLocal(r))}return super.getKernelPosition(n)}}class a extends qt{constructor(n,r,c,m,f,w,b){super(n,r,c,m,f,w),b||(b={left:0,top:1,right:1,bottom:0}),this.offset=b}set offset(n){this._offset=n,this.updateProjectionMatrix()}get offset(){return this._offset}resetOffset(){this._offset={left:0,top:1,right:1,bottom:0}}updateProjectionMatrix(){this._offset?(this.projectionMatrix=this._calculateProjectionMatrix(),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()):super.updateProjectionMatrix()}_calculateProjectionMatrix(){const n=this._calculate2DPlanes();if(this._offset.left>=this._offset.right||this._offset.bottom>this._offset.top)return new Z().makeOrthographic(n.left,n.right,n.top,n.bottom,this.near,this.far);const r=this._scaleRange(n.left,n.right,this._offset.left,this._offset.right);let c=r.from,m=r.to;const f=this._scaleRange(n.bottom,n.top,this._offset.bottom,this._offset.top);let w=f.from,b=f.to;const y=(n.right-n.left)/(n.top-n.bottom),D=(m-c)/(b-w);if(D>y){const S=(w+b)/2,x=(b-w)*D/y;w=S-x/2,b=S+x/2}else{const S=(c+m)/2,x=(m-c)*y/D;c=S-x/2,m=S+x/2}return new Z().makeOrthographic(c,m,b,w,this.near,this.far)}_scaleRange(n,r,c,m){const w=(r-n)/(m-c),b=n-w*c,y=r+w*(1-m);return{from:b,to:y}}_calculate2DPlanes(){const n=(this.right-this.left)/(2*this.zoom),r=(this.top-this.bottom)/(2*this.zoom),c=(this.right+this.left)/2,m=(this.top+this.bottom)/2;let f=c-n,w=c+n,b=m+r,y=m-r;if(this.view!==null&&this.view.enabled){const D=(this.right-this.left)/this.view.fullWidth/this.zoom,S=(this.top-this.bottom)/this.view.fullHeight/this.zoom;f+=D*this.view.offsetX,w=f+D*this.view.width,b-=S*this.view.offsetY,y=b-S*this.view.height}return{left:f,right:w,top:b,bottom:y}}}class o extends V{constructor(n,r,c,m,f){super(n,r,c,m),f||(f={left:0,top:1,right:1,bottom:0}),this.offset=f}copy(n,r){return super.copy(n,r),this._offset=n._offset,this}set offset(n){this._offset=n,this.updateProjectionMatrix()}get offset(){return this._offset}resetOffset(){this._offset={left:0,top:1,right:1,bottom:0}}_calculateProjectionMatrix(){const n=this.fov*(Math.PI*2/360)/2;let r,c,m,f;m=Math.tan(n),f=-m;const w=Math.atan(this.aspect*Math.tan(n));c=Math.tan(w),r=-c;const b=this._offset.left,y=this._offset.right,D=this._offset.top,S=this._offset.bottom,x=new O(y-b,D-S),F=new O(b+x.x/2,S+x.y/2);if(x.x<x.y){const X=(1-F.x)/(x.x/2),$=F.x/(x.x/2);c*=X,r*=$;const J=(X+$)/2;m*=J,f*=J}else{const X=(1-F.y)/(x.y/2),$=F.y/(x.y/2);m*=X,f*=$;const J=($+X)/2;r*=J,c*=J}r*=this.near,c*=this.near,m*=this.near,f*=this.near;const ht=2*(this.near*Math.tan(Math.PI/180*.5*this.fov)/this.zoom),Dt=this.aspect*ht;return this.view&&this.view.enabled&&(r+=this.view.offsetX*Dt/this.view.fullWidth,m-=this.view.offsetY*ht/this.view.fullHeight,c+=this.view.offsetX*Dt/this.view.fullWidth,f-=this.view.offsetY*ht/this.view.fullHeight),new Z().makePerspective(r,c,m,f,this.near,this.far)}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){this._offset?(this.projectionMatrix=this._calculateProjectionMatrix(),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()):super.updateProjectionMatrix()}}function _(C,n,r,c,m){return new d(C,n,r,c,m)}function u(C,n){return new t(C,n)}function g(C,n,r){return new i(r,C,{x:0,y:0,z:0},{x:0,y:0,z:0},n,!1)}function p(C,n){const r=new s(n,C.id,C.roomlePosition,C.roomleRotation,C.parentObjectId,C.receivedPointAssociation);return C.meshes.forEach(c=>{const m=c.clone();m.material=c.material.clone(),m.geometry=c.geometry.clone(),r.addMesh(m)}),r.computeBoundingBox(),r}function v(C,n,r,c,m,f,w){return new a(C,n,r,c,m,f,w)}function M(C,n,r,c,m){return new o(C,n,r,c,m)}function H(C){return C instanceof i}function Lt(C){return C instanceof s}return{create:_,createPreview:g,createStatic:u,createPreviewLine:p,isPreview:H,isPreviewLine:Lt,createPerspectiveCamera:M,createOrthographicCamera:v}}class re{constructor(t,e){this._scene=t,e&&(e.removeFromScene(),e.cleanUp())}updateCamera(t){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(t,e){this._bounds=t}cleanUp(){this._scene=null}}class ki{constructor(t){this._innerSize=1,this._outerSize=100,this._plane=new dt,this._plane.rotation.x=-Math.PI/2;const e=j.createMeshStandardMaterial({});this._innerPlaneMesh=new B,this._innerPlaneMesh.layers.set(R.BACKGROUND),this._innerPlaneMesh.material=e,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new B,this._outerPlaneMesh.layers.set(R.BACKGROUND),this._outerPlaneMesh.material=e,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=t,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(t){this._innerSize=t,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(t,e){const i=new Wt;i.moveTo(-t/2,-t/2),i.lineTo(-t/2,t/2),i.lineTo(t/2,t/2),i.lineTo(t/2,-t/2),i.lineTo(-t/2,-t/2);const s=new Wt;s.moveTo(-e/2,-e/2),s.lineTo(-e/2,e/2),s.lineTo(e/2,e/2),s.lineTo(e/2,-e/2),s.lineTo(-e/2,-e/2);const a=new Ce;a.moveTo(-t/2,-t/2),a.lineTo(-t/2,t/2),a.lineTo(t/2,t/2),a.lineTo(t/2,-t/2),a.lineTo(-t/2,-t/2),s.holes.push(a);const o=new Yt(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=o;const _=new Yt(s);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=_;const u=o.attributes.uv.clone();o.setAttribute("uv2",u);const g=o.attributes.uv2.array;for(let p=0;p<g.length;++p)g[p]+=.5}}var zi=Object.defineProperty,gi=(d,t,e,i)=>{for(var s=void 0,a=d.length-1,o;a>=0;a--)(o=d[a])&&(s=o(t,e,s)||s);return s&&zi(t,e,s),s};const oe=100,fi=16185078;class vt extends re{constructor(t,e,i){super(t,e),this._longestSide=2,this._bakedShadowPlane=new ki(oe),this._fog=i||!1,this._textureLoader=new be,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(t){return super.updateBounds(t),this._longestSide=Math.max(t.x,t.z),this._update(),!0}updateCamera(t){this._cameraDistance=t.position.distanceTo(new l(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let t=this._longestSide/2,e=3;this._scene.fog=new xe(fi,this._cameraDistance+t+e,this._cameraDistance+t+e+1),this._scene.background=new z(fi)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let t=this._width/1e3,e=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=Kt,this._floorTexture.wrapT=Kt,this._floorTexture.repeat.set(oe/t,oe/e));let i=j.createMeshStandardMaterial({map:this._floorTexture,side:Xt});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&this._scene.add(this._bakedShadowPlane.getRootNode())}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(t,e,i,s){return this._width=e,this._height=i,this._repeatable=s,this._floorPromise=new Promise((a,o)=>{this._textureLoader.load(t,_=>{this._floorTexture=_,a()},null,o)}),new Promise((a,o)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),a()},o)})}changeFloorMaterial(t,e){this._floorPromise=new Promise((s,a)=>{this._floorMaterial=Ee(t),this._rapiAccess.getTexturesOf(t).then(o=>{if(o.length>0){let _=[];o.forEach(u=>{_.push(Se(this._dataSyncer.requestAsset(u.image,!0),u,this._floorMaterial,e,1,1))}),Promise.all(_).then(()=>{setTimeout(()=>s(),0)},a)}else setTimeout(()=>s(),0)})});let i=[this._floorPromise];return new Promise((s,a)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),s()},a)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let t=Q();if(!t)return;let e=t.addFolder("Floor");e.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),e.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),e.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),e.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),e.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),e.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),e.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}T("F",vt),gi([I],vt.prototype,"_rapiAccess"),gi([I],vt.prototype,"_dataSyncer");const Mt=Math.PI/4,Pt=1,Ct=1,Ni=.1,bt=1.5,xt=.2,Ui=-60,Fi=60;class Et extends K{constructor(t,e,i,s){super(t,e,i),this._state=G.NONE,this._cameraRotation=new et,this._rotationSpeed=Ct,this._keyMap=new Map,this.minPolarAngle=L(Ui),this.maxPolarAngle=L(Fi),s?this._camera=s:this._camera=new V,this._camera.fov=75,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(R.OBJECT),this._camera.layers.enable(R.LIGHTING),this._camera.layers.enable(R.BACKGROUND),this._camera.layers.enable(R.UI),this._camera.layers.enable(R.PREVIEW),i||this._camera.position.set(0,1.5,0),this._cameraPosition=new l,this._cameraPosition.copy(this._camera.position),this._pitch=0,this._yaw=0;let a=new lt(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(a),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}setUp(){super.setUp(),this._camera.fov=75,this._initInputListener()}_gamepadConnected(t){console.log("gamepad connected"),this.startButtonPressListener()}_gamepadDisconnected(t){console.log("gamepad disconnected"),window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let t=navigator.getGamepads()[0];this._checkRightStick(t),this._checkLeftStick(t),this._checkButtons(t),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(t){let e=t.axes[2],i=t.axes[3];Math.abs(e)>xt&&(this._rotateHorizontal(Mt*.01*e),this._update(),this.dispatchEvent(P.ORBIT_MOVE)),Math.abs(i)>xt&&(this._rotateVertical(Mt*.01*i),this._update(),this.dispatchEvent(P.ORBIT_MOVE))}_checkLeftStick(t){let e=t.axes[0],i=t.axes[1];Math.abs(i)>xt?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):t.buttons&&t.buttons[12]&&t.buttons[12].pressed?this._keyMap.set(87,!0):t.buttons&&t.buttons[13]&&t.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(e)>xt?e<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(t){t.buttons&&t.buttons[6]&&t.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),t.buttons&&t.buttons[14]&&t.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(P.ORBIT_MOVE)):this._keyMap.set(37,!1),t.buttons&&t.buttons[15]&&t.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(P.ORBIT_MOVE)):this._keyMap.set(39,!1)}animateCamera(t){let e=this._cameraPosition,i=this._cameraRotation,s=this.getCamera(),a=Tt(e,s.position),o=Ie(i,s.quaternion);if(!e||a&&o)return!1;let _=this.getCamera().position.clone(),u=Math.min(t*10,1);_.lerp(e,u),this.getCamera().position.copy(_);let g=this.getCamera().quaternion.clone(),p=Math.min(t*5,1);g.slerp(i,p),this.getCamera().setRotationFromQuaternion(g);let v=!1;return this._keyMap.forEach(M=>{M&&(v=!0)}),v&&this._processKeyMap(this._keyMap,t),!0}_getCamera(){return this._camera}_initInputListener(){this._onKeyChanged=this._onKeyChanged.bind(this),this._inputListeners.push({key:E.KEY_DOWN,fun:t=>{this._onKeyChanged(t.event)}}),this._inputListeners.push({key:E.KEY_UP,fun:t=>{this._onKeyChanged(t.event)}}),this._inputListeners.push({key:E.DOWN,fun:t=>{this._down(t)}}),this._inputListeners.push({key:E.MOVE,fun:t=>{this._move(t)}}),this._inputListeners.push({key:E.UP,fun:t=>{this._up(t)}})}_removeInputListener(){this._inputListeners=this._inputListeners.filter(t=>t.key!==E.KEY_UP&&t.key!==E.KEY_DOWN)}_down(t){this._downPosition=t.position,this._position=t.position,this._state=G.ORBIT,t.type===k.TOUCH&&window.setTimeout(this._onLongDown.bind(this),350),t.type===k.TOUCH?this._rotationSpeed=Ni:this._rotationSpeed=Ct}_move(t){this._position=t.position,this._state===G.ORBIT&&!this._locked&&this._orbit(new O(t.position.x,t.position.y)),this._state===G.MOVE&&!this._locked&&(this._orbit(new O(t.position.x,t.position.y)),this._moveForward())}_up(t){this._state===G.ORBIT&&this.dispatchEvent(P.ORBIT_END),this._state===G.MOVE&&this._keyMap.set(87,!1),this._state=G.NONE,this._orbitPosition=null}_onLongDown(){Oe(this._downPosition,this._position)<Le&&this._state===G.ORBIT&&(this._state=G.MOVE,this._orbit(new O(this._position.x,this._position.y)),this._moveForward())}_update(t){let e=new lt(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation?.setFromEuler(e)}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions();this._camera.aspect=t/e,this._camera.updateProjectionMatrix(),this._camera.near=.1,this._camera.far=100}_onKeyChanged(t){this._keyMap.set(t.keyCode,t.type==="keydown"),this.dispatchEvent(P.KEYBOARD_PRESSED),this._processKeyMap(this._keyMap,.001)&&t.preventDefault()}_processKeyMap(t,e){e=Math.min(e,.1);let i=new l(0,0,0),s=!1;return this._processUpDown(t,i,e),t.get(65)&&(i.x=-Pt*bt*e),t.get(68)&&(i.x=Pt*bt*e),t.get(37)&&(this._rotateHorizontal(-Mt*this._rotationSpeed*e),s=!0),t.get(39)&&(this._rotateHorizontal(Mt*this._rotationSpeed*e),s=!0),t.get(16)&&(i.x*=3,i.z*=3),i.x!==0||i.y!==0||i.z!==0||s?(i.applyQuaternion(this.getCamera().quaternion),this._cameraPosition.add(new l(i.x,0,i.z)),this._update(),!0):!1}_processUpDown(t,e,i){(t.get(87)||t.get(38))&&(e.z=-Pt*bt*i),(t.get(83)||t.get(40))&&(e.z=Pt*bt*i)}_orbit(t){this._orbitPosition||(this._orbitPosition=new O(t.x,t.y),this.dispatchEvent(P.ORBIT_START));let e=t.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;e.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*e.x/i.clientWidth*Ct),this._rotateVertical(2*Math.PI*e.y/i.clientHeight*Ct),ct(this._orbitPosition,t)||this.dispatchEvent(P.ORBIT_MOVE),this._orbitPosition.copy(t),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(t){let e=this._pitch+t;e>this.maxPolarAngle||e<this.minPolarAngle||(this._pitch=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}getKernelZoomFactor(){return this._camera.zoom}}T("e",Et);const he="rml-scene-background";class rt extends re{constructor(t,e,i,s,a){if(super(t,e),this._color=i,this._oldBackground=t.background,s&&a){this._canvas=s,this._style=document.createElement("style");let o='background-image: url("'+a+'"); background-size: cover;';this._style.innerText="."+he+" {"+o+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._color&&(this._scene.background=this._color),this._canvas&&this._canvas.classList&&(this._scene.background=null,this._canvas.classList.add(he))}removeFromScene(){this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove(he)}showGUI(){}}T("B",rt);var Gi=Object.defineProperty,Hi=(d,t,e,i)=>{for(var s=void 0,a=d.length-1,o;a>=0;a--)(o=d[a])&&(s=o(t,e,s)||s);return s&&Gi(t,e,s),s};class pi{parse(t,e,i,s,a){let o=JSON.parse(s);return o.environment?this.load(t,e,i,o,a):null}load(t,e,i,s,a){let o,_=s.environment;if(!_)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(_.type){case"color":o=new Promise(u=>u(new rt(t,i,new z(_.details.color))));break;case"image":o=new Promise(u=>u(new rt(t,i,null,e,_.details.imageUrl)));break;case"floor":o=new Promise(u=>{this._rapiAccess.getMaterial(_.details.material).then(g=>{let p=_.details.fog===void 0?!0:_.details.fog,v=new vt(t,i,p);v.changeFloorMaterial(g,a).then(()=>{u(v)})})});break;default:console.warn("Could not load environment, return old environment"),o=new Promise(u=>u(i));break}return o}}Hi([I],pi.prototype,"_rapiAccess");class wi{constructor(t,e){this._scene=t,e&&e.removeFromScene()}needsBounds(){return!1}updateBounds(t){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new dt),this._cameraContainer}}T("L",wi);var Vi=Object.defineProperty,Zi=(d,t,e,i)=>{for(var s=void 0,a=d.length-1,o;a>=0;a--)(o=d[a])&&(s=o(t,e,s)||s);return s&&Vi(t,e,s),s};class St extends wi{constructor(t,e){super(t,e),this._lights=[]}needsBounds(){return!0}updateBounds(t){if(this._cameraLight){const e=this._cameraLight,i=new l;t.getSize(i);const s=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=s,e.shadow.camera.top=s/2,e.shadow.camera.bottom=-s/2,e.shadow.camera.left=-s/2,e.shadow.camera.right=s/2,e.shadow.camera.updateProjectionMatrix()}}loadFromJSON(t){return new Promise(e=>{this._lights=this._dynamicLightSettingLoader.parse(t),this.addToScene(),e()})}loadFromObject(t){return new Promise(e=>{t?.lights||e(),this._lights=this._dynamicLightSettingLoader.load(t),this._lights.forEach((i,s)=>{i.userData.movesWithCamera&&(this._cameraLight=i,this._lights.splice(s,1))}),this.addToScene(),e()})}loadFromURL(t){return new Promise((e,i)=>{fetch(new Request(t,{method:"GET"})).then(De).then(s=>this.loadFromObject(s).then(e,i))})}addToScene(){this._lights.forEach(t=>{this._scene.add(t)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(t,e){if(!this._cameraLight)return;let i=new l;t.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let s=e.clone().add(i);this._cameraLight.position.copy(s)}removeFromScene(){this._lights.forEach(t=>{this._scene.remove(t)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let t=Q();this._cameraLight&&this._addToGUI(t,this._cameraLight),this._lights.forEach(e=>{this._addToGUI(t,e)})}_addToGUI(t,e){t&&(e instanceof Re&&this._addSpotLightToGUI(t,e),e instanceof Te&&this._addAmbientLightToGUI(t,e),e instanceof Ae&&this._addDirectionalLightToGUI(t,e),e instanceof Be&&this._addRectAreaLightToGUI(t,e))}_addRectAreaLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString(),intensity:e.intensity*(e.width*e.height)};i.add(e,"visible"),i.add(s,"intensity").min(10).max(400).step(10).onChange(a=>{e.intensity=a/(e.width*e.height)}),i.add(e,"castShadow"),i.addColor(s,"color").onChange(a=>{e.color=new z(a)}),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new l(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new l(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new l(0,0,0))})}_addSpotLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString(),angle:e.angle*180/Math.PI};i.add(e,"visible"),i.add(e,"intensity").min(0).max(5).step(.1),i.add(e,"penumbra").min(0).max(1).step(.1),i.addColor(s,"color").onChange(a=>{e.color=new z(a)}),i.add(s,"angle").min(10).max(180).step(1).onChange(a=>{e.angle=a*Math.PI/180}),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new l(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new l(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new l(0,0,0))})}_addAmbientLightToGUI(t,e){let i={name:e.name,color:"#"+e.color.getHexString()},s=t.addFolder(e.name);s.add(e,"visible"),s.add(e,"intensity").min(0).max(5).step(.1),s.addColor(i,"color").onChange(a=>{e.color=new z(a)})}_addDirectionalLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString()};i.add(e,"visible"),i.add(e,"intensity").min(0).max(5).step(.1),i.addColor(s,"color").onChange(a=>{e.color=new z(a)}),i.add(e,"castShadow"),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new l(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new l(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new l(0,0,0))})}}Zi([I],St.prototype,"_dynamicLightSettingLoader");class ji extends B{constructor(t,e,i,s=128){if(e<=0||i<=0||s<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const a=new ke(i,2*s,s);a.scale(1,1,-1);const o=a.getAttribute("position"),_=new l;for(let u=0;u<o.count;++u)if(_.fromBufferAttribute(o,u),_.y<0){const g=-e*3/2,p=_.y<g?-e/_.y:1-_.y*_.y/(3*g*g);_.multiplyScalar(p),_.toArray(o.array,3*u)}o.needsUpdate=!0,super(a,new Y({map:t,depthWrite:!1}))}}class qi extends re{constructor(t,e,i){super(t,e),this.updateEnvironmentTexture(i)}updateEnvironmentTexture(t){t&&(this._environmentTexture=t,this._skybox=new ji(this._environmentTexture,15,100),this._skybox.name="Ground projected skybox",this._skybox.scale.setScalar(100)),this.reload()}needsBounds(){return!1}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._skybox&&this._scene.add(this._skybox)}removeFromScene(){this._scene&&this._skybox&&this._scene.remove(this._skybox)}showGUI(t){let e=Q();if(!e)return;let i=e.addFolder("Ground Projected Environment");i.add(this._skybox,"height").min(10).max(100).step(.1).onChange(t),i.add(this._skybox,"radius").min(20).max(200).step(.1).onChange(t)}}class yi{constructor(t){this._lightSourceDetector=t}static createPlane(t,e){const i=new ze(2,1),s=e??new Y({color:12632256,side:Xt}),a=new B(i,s);return a.position.z=-.1,t.add(a),a}createDebugScene(t,e){this._scene=t,this._createLightGraphInMap(this._lightSourceDetector.sampleUVs,this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph,e)}_createLightGraphInMap(t,e,i,s){const a=[],o=[];for(let M=0;M<this._lightSourceDetector.lightGraph.noOfNodes;++M)i.adjacent[M].length===0?a.push(e[M]):o.push(e[M]);const _=a.map(M=>M.uv),u=o.map(M=>M.uv),g=t.filter(M=>!_.includes(M)&&!u.includes(M));this._createSamplePointsInMap(g,.005,16711680),this._createSamplePointsInMap(_,.01,255),this._createSamplePointsInMap(u,.01,65280),this._createClusterLinesInMap(this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph.edges,128);const p=this._lightSourceDetector.lightSources.map(M=>M.uv);this._createSamplePointsInMap(p,.015,16776960);let v=this._lightSourceDetector.lightSources;s!==void 0&&s>=0&&s<v.length&&(v=v.slice(0,s)),this._createCirclesInMap(v,8421376)}_createSamplePointsInMap(t,e,i){const s=new $t(e,8,4),a=new Y({color:i});t.forEach(o=>{const _=new B(s,a);_.position.copy(this._uvToMapPosition(o)),_.name="samplePoint",this._scene?.add(_)})}_createCirclesInMap(t,e){const i=new Y({color:e,transparent:!0,opacity:.5});t.forEach(s=>{const a=new $t(s.size,8,4),o=new B(a,i);o.position.copy(this._uvToMapPosition(s.uv)),o.name="samplePoint",this._scene?.add(o)})}_createClusterLinesInMap(t,e,i){const s=new Ne({color:i}),a=[];e.forEach(u=>{for(let g=1;g<u.length;g++){const p=t[u[0]].uv,v=t[u[g]].uv;if(a.push(this._uvToMapPosition(p)),Math.abs(p.x-v.x)>.5){const M=(p.y+v.y)/2,H=p.x<v.x?0:1;a.push(this._uvToMapPosition(new O(H,M))),a.push(this._uvToMapPosition(new O(1-H,M)))}a.push(this._uvToMapPosition(v))}});const o=new Zt().setFromPoints(a),_=new ut(o,s);_.name="clusterLine",this._scene?.add(_)}_uvToMapPosition(t){return new l(t.x*2-1,t.y-.5,0)}}class Wi extends Ue{constructor(t){super(t),this._extendedEquirectMaterial=this._createEquirectMaterial()}fromEquirectangularTexture(t,e){const i=e?.rotation??0,s=e?.intensity??1;return this._extendedEquirectMaterial.uniforms.intensity.value=s,this._extendedEquirectMaterial.uniforms.rotationMatrix.value.set(Math.cos(i),0,-Math.sin(i),0,1,0,Math.sin(i),0,Math.cos(i)),super.fromEquirectangular(t)}_createEquirectMaterial(){const t=new Fe({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},intensity:{value:1},rotationMatrix:{value:new He}},vertexShader:Yi,fragmentShader:Ki,blending:Ge,depthTest:!1,depthWrite:!1});return this._equirectMaterial=t,t}}const Yi=`
2
+ precision mediump float;
3
+ precision mediump int;
4
+ attribute float faceIndex;
5
+ varying vec3 vOutputDirection;
6
+ uniform mat3 rotationMatrix;
7
+
8
+ // RH coordinate system; PMREM face-indexing convention
9
+ vec3 getDirection( vec2 uv, float face ) {
10
+ uv = 2.0 * uv - 1.0;
11
+ vec3 direction = vec3( uv, 1.0 );
12
+ if ( face == 0.0 ) {
13
+ direction = direction.zyx; // ( 1, v, u ) pos x
14
+ } else if ( face == 1.0 ) {
15
+ direction = direction.xzy;
16
+ direction.xz *= -1.0; // ( -u, 1, -v ) pos y
17
+ } else if ( face == 2.0 ) {
18
+ direction.x *= -1.0; // ( -u, v, 1 ) pos z
19
+ } else if ( face == 3.0 ) {
20
+ direction = direction.zyx;
21
+ direction.xz *= -1.0; // ( -1, v, -u ) neg x
22
+ } else if ( face == 4.0 ) {
23
+ direction = direction.xzy;
24
+ direction.xy *= -1.0; // ( -u, -1, v ) neg y
25
+ } else if ( face == 5.0 ) {
26
+ direction.z *= -1.0; // ( u, v, -1 ) neg z
27
+ }
28
+ return direction;
29
+ }
30
+
31
+ void main() {
32
+ vOutputDirection = rotationMatrix * getDirection(uv, faceIndex);
33
+ gl_Position = vec4(position, 1.0);
34
+ }
35
+ `,Ki=`
36
+ precision mediump float;
37
+ precision mediump int;
38
+ varying vec3 vOutputDirection;
39
+ uniform sampler2D envMap;
40
+ uniform float intensity;
41
+
42
+ #include <common>
43
+
44
+ void main() {
45
+ vec3 outputDirection = normalize(vOutputDirection);
46
+ vec2 uv = equirectUv(outputDirection);
47
+ gl_FragColor = vec4(texture2D(envMap, uv).rgb * intensity, 1.0);
48
+ }
49
+ `;class vi{}class It{constructor(t,e){this.needsUpdate=!0,this._lightSources=[],t instanceof vi?this.environmentSceneGenerator=t:t instanceof Ve?this.cubeTexture=t:t instanceof Ze&&(this.equirectangularTexture=t),e?.textureData&&(this.textureData=e?.textureData),this._rotation=e?.rotation??0,this._intensity=e?.intensity??1,e?.maxNoOfLightSources!==void 0&&(this._maxNoOfLightSources=e.maxNoOfLightSources),this._parameters=e,this._environment=t}get lightSources(){return this._lightSources}set rotation(t){this._rotation!==t&&(this._rotation=t,this.needsUpdate=!0)}set intensity(t){this._intensity!==t&&(this._intensity=t,this.needsUpdate=!0)}set maxNoOfLightSources(t){this._maxNoOfLightSources!==t&&(this._maxNoOfLightSources=t,this.needsUpdate=!0)}get maxNoOfLightSources(){return this._maxNoOfLightSources}clone(){return new It(this._environment,this._parameters)}createNewEnvironment(t){const e=this._createPmremTexture(t),i=this._detectLightSources(t,e);return this._lightSources=i.lightSources,e??null}_getTextureOffset(){const t=this._rotation/(Math.PI*2)%1;return new O(t,0)}_createPmremTexture(t){const e=new Wi(t);let i;if(this.equirectangularTexture)this.equirectangularTexture.offset.copy(this._getTextureOffset()),i=e.fromEquirectangularTexture(this.equirectangularTexture,{rotation:this._rotation,intensity:this._intensity});else if(this.cubeTexture)i=e.fromCubemap(this.cubeTexture);else if(this.environmentSceneGenerator){const s=this.environmentSceneGenerator.generateScene(this._intensity,this._rotation);i=e.fromScene(s,.04)}return this._debugScene=void 0,this.needsUpdate=!1,i?.texture}_detectLightSources(t,e){const i=new je;return this.equirectangularTexture&&this.rotation===0?i.detectLightSources(t,this.equirectangularTexture,this.textureData):e&&i.detectLightSources(t,e),i}createDebugScene(t,e,i){const s=i??-1;if(this._debugScene&&s===this._debugScene.userData.maximumNumberOfLightSources)return this._debugScene;this._debugScene=new at;const a=new qe(!0,!1);a.setSourceTexture(e.environment),yi.createPlane(this._debugScene,a);const o=this._detectLightSources(t,e.environment);return new yi(o).createDebugScene(this._debugScene,s),this._debugScene.userData.maximumNumberOfLightSources=s,this._debugScene}}const Ot={ALL_AROUND:"all_around",FRONT:"front"};class Xi extends vi{constructor(t={}){super(),this._parameters={},this._parameters=t}generateScene(t,e){const i=new $i({...this._parameters,lightIntensity:t*(this._parameters.lightIntensity||1),topLightIntensity:t*(this._parameters.topLightIntensity||1),sidLightIntensity:t*(this._parameters.sidLightIntensity||1)});return i.rotation.y=e,i}}class $i extends at{constructor(t={}){super(),this._type=t?.type??Ot.ALL_AROUND,this._topLightIntensity=t?.topLightIntensity||t?.lightIntensity||1,this._sideLightIntensity=t?.sidLightIntensity||t?.lightIntensity||1,this._sideReflectorIntensity=t?.sidLightIntensity||t?.lightIntensity||1;const e=this._type===Ot.FRONT?.3:0;this._ambientLightIntensity=t?.ambientLightIntensity||e,this._colorVariation=t?.colorVariation||.5,this._lightGeometry=new st,this._lightGeometry.deleteAttribute("uv"),this._reflectorLightGeometry=new pt(.7,.4,2,32),this._reflectorLightGeometry.deleteAttribute("uv"),this.generateScene(this)}generateScene(t){switch(this._type){default:case Ot.ALL_AROUND:this._createAllAroundSceneLight(t);break;case Ot.FRONT:this._createFrontSceneLight(t);break}}dispose(){const t=new Set;this.traverse(e=>{e.isMesh&&(t.add(e.geometry),t.add(e.material))});for(const e of t)e.dispose()}_createAllAroundSceneLight(t){const e=this._ambientLightIntensity;this.background=new z(e,e,e),this._createTopLight(t,6,1);for(let i=0;i<6;i++){const s=i*Math.PI*2/6,a=Math.sin(s),o=Math.cos(s);i%2===0?this._createReflector(t,new O(a,o),3,1,.8,.2):this._createSideLight(t,new O(a,o),(i-1)/2,15,1.1,.33,1)}}_createFrontSceneLight(t){const e=this._ambientLightIntensity;this.background=new z(e,e,e),this._createTopLight(t,6,.7);for(let i=0;i<6;i++){const s=i*Math.PI*2/6,a=Math.sin(s),o=Math.cos(s);if(i===0){this._createReflector(t,new O(a,o),1.1,.6,.8,-.4);for(let _=0;_<2;_++){const u=(i-.3+_*.6)*Math.PI*2/6,g=Math.sin(u),p=Math.cos(u);this._createSideLight(t,new O(g,p),(i-1)/2,50,1.2,.7,.8)}}else this._createReflector(t,new O(a,o),1.1,.7,1.4,0)}}_createAreaLightMaterial(t,e,i){const s=new Y;return s.color.set(t,e??t,i??t),s}_createTopLight(t,e,i){const s=new B(this._lightGeometry,this._createAreaLightMaterial(e*this._topLightIntensity));s.position.set(0,20,0),s.scale.set(5*i,.1,5*i),t.add(s)}_createSideLight(t,e,i,s,a,o,_){for(let u=0;u<3;u++){const g=s*this._sideLightIntensity,p=new B(this._lightGeometry,this._createAreaLightMaterial((u+i)%3===0?g:g*(1-this._colorVariation),(u+i)%3===1?g:g*(1-this._colorVariation),(u+i)%3===2?g:g*(1-this._colorVariation))),v=(u===1?-e.y:u===2?e.y:0)/Math.sqrt(2),M=u===0?0:1,H=(u===1?e.x:u===2?-e.x:0)/Math.sqrt(2);p.position.set(e.x*_*15+v*1.1*a,o*15+M*1.1*a,e.y*_*15+H*1.1*a),p.rotation.set(0,Math.atan2(e.x,e.y),0),p.scale.setScalar(a),t.add(p)}}_createReflector(t,e,i,s,a,o){const _=new B(this._reflectorLightGeometry,this._createAreaLightMaterial(i*this._sideReflectorIntensity));_.position.set(e.x*15,10*o,e.y*15),_.scale.set(10*s,10*a,10*s),t.add(_)}}const Ji=2,Mi=5,Pi=.1,Ci=1.1;class bi extends K{constructor(t,e,i,s){super(t,e,i),this._scale=1,this._cameraZoom=1,this._state=0,this._size=5,this._lastPosition=new O,this._zoomPosition=new l,this._lastZoom=0,this._wasZooming=!1,this._zoomSpeed=Math.pow(.95,Ji),s?(this._camera=s,this._cameraPosition=new l().copy(this._camera.position)):this._initCamera(i?new l(i.targetX,10,i.targetZ):new l(0,10,0)),this._lerpEnabled=!1}_getCamera(){return this._camera?this._camera:(this._initCamera(new l(0,10,0)),this._camera)}_initCamera(t){let{x:e,y:i}=this._domHelper.getClientDimensions(),a=(e/i||1)*this._size,o=this._size;this._camera=new qt(a/-2,a/2,o/2,o/-2,1,1e3),this._camera.position.copy(t),this._cameraPosition=t,this._camera.lookAt(new l(0,0,0))}updateCamera(){let e=this._domHelper.getAspectRatio()*this._size,i=this._size;this._camera.left=e/-2,this._camera.right=e/2,this._camera.top=i/2,this._camera.bottom=i/-2,this._camera.updateProjectionMatrix()}_initInputListener(){this._inputListeners.push({key:E.DOWN,fun:t=>{this._locked||(this._state=1,this._lastPosition.set(t.positionRelative.x,t.positionRelative.y),this.dispatchEvent(P.ORBIT_START))}}),this._inputListeners.push({key:E.MOVE,fun:t=>{this._lastPosition.x===t.positionRelative.x&&this._lastPosition.y===t.positionRelative.y||this._state===1&&!this._locked&&(this._move(new O(t.positionRelative.x,t.positionRelative.y),t.type),this.dispatchEvent(P.ORBIT_MOVE))}}),this._inputListeners.push({key:E.UP,fun:t=>{this._state===1&&this.dispatchEvent(P.ORBIT_END),this._state=0}}),this._inputListeners.push({key:E.ZOOM_IN,fun:t=>{t.event&&(t.event.stopPropagation(),t.event.preventDefault()),this.dispatchEvent(P.ZOOM_IN),this._scale/=this._zoomSpeed,this._zoomTo(t.positionRelative),this._update()}}),this._inputListeners.push({key:E.ZOOM_OUT,fun:t=>{t.event&&(t.event.stopPropagation(),t.event.preventDefault()),this.dispatchEvent(P.ZOOM_OUT),this._scale*=this._zoomSpeed,this._zoomTo(t.positionRelative),this._update()}})}_zoomTo(t){if(Date.now()-this._lastZoom>200){let e=new l(t.x,t.y,0);e.unproject(this._camera),this._zoomPosition.copy(e)}this._lastZoom=Date.now()}_move(t,e){let i=new l,s=new l(this._lastPosition.x,this._lastPosition.y,0),a=new l(t.x,t.y,0);s.unproject(this._camera),a.unproject(this._camera),i.subVectors(a,s),this._cameraPosition.x-=i.x*(e===k.TOUCH?Ci:1),this._cameraPosition.z-=i.z*(e===k.TOUCH?Ci:1),this._lastPosition.copy(t)}zoomToFitBounds(t,e,i){if(kt(t,this._boundingBox)<0&&!i){this.setBounds(t);return}this.setBounds(t);const s=t.getSize(new l),a=t.getCenter(new l),o=s.x/-2/this._camera.left,_=s.z/-2/this._camera.bottom,g=1/Math.max(o,_);(g<this._cameraZoom||e)&&(this._scale=g,this._cameraZoom=g,this._cameraPosition.x=a.x,this._cameraPosition.z=a.z)}_update(t,e,i){this._scale=Math.min(this._scale,Mi),this._scale=Math.max(this._scale,Pi);let s=new l().subVectors(this._zoomPosition,this._cameraPosition).multiplyScalar((this._scale-this._cameraZoom)/this._scale);this._cameraPosition.x+=s.x,this._cameraPosition.z+=s.z,this._cameraZoom!==this._scale&&this.dispatchEvent(P.ZOOM_CHANGE,new ne(this._scale===Pi,this._scale===Mi)),this._cameraZoom=this._scale,this._camera.updateProjectionMatrix()}animateCamera(t){const e=Math.abs(this._cameraZoom-this._camera.zoom)>.01;if(this._lerpEnabled=e,e&&(this._wasZooming=!0),this._wasZooming&&!e&&(setTimeout(()=>this._dispatchCameraIdle(),16),this._wasZooming=!1),!super.animateCamera(t)&&!e)return!1;this._lerpEnabled=!1;const i=Math.min(t*10,1);return this._camera.zoom=We.lerp(this._camera.zoom,this._cameraZoom,i),!0}getKernelZoomFactor(){const t=(this._camera.right-this._camera.left)*1e3;return this._domHelper.element.clientWidth/t*this._camera.zoom}}T("d",bi);var Qi=Object.defineProperty,U=(d,t,e,i)=>{for(var s=void 0,a=d.length-1,o;a>=0;a--)(o=d[a])&&(s=o(t,e,s)||s);return s&&Qi(t,e,s),s};const ts=3e3,es=T("f",.35),is=T("I",1.16);class N{constructor(t,e,i,s){this._depthWriteMaterial=new Y({colorWrite:!1}),this._maxAnisotropy=1,this._clock=new Ye,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._roomleRenderer=null,this._forceRender=!1,this._lastChange=Date.now(),this._running=!1,this._isInteriorLightActive=!1,this._perspectiveOffsetCamera=null,this._orthographicOffsetCamera=null,this._onAfterRender=()=>{},this._creator_=t,this._canvasID=i,this._renderListener=()=>{this._requestRender()},this.createCameraControl(ci(s),e),this._setupScene(e,this._initData.transparentBackground),this._lifeCycleManager.addEventListener(this)}get cameraBehaviour(){return this._cameraBehaviour}onBeforeRender(){}addEventListener(t){throw new Error("Method not implemented.")}removeEventListener(t){throw new Error("Method not implemented.")}_changeCameraBehaviour(t){this._cameraBehaviour&&(this.cameraBehaviour.cameraControl instanceof Et&&(this._getInputManager().removeEventListener(E.ZOOM_IN,this._renderListener),this._getInputManager().removeEventListener(E.ZOOM_OUT,this._renderListener)),this._cameraBehaviour.cameraControl.cleanUp()),this._cameraBehaviour=t,this._cameraBehaviour.cameraControl.setUp(),this._cameraBehaviour.setCameraChangeListener(this.onCameraChanged.bind(this)),t.cameraControl instanceof Et&&(this._getInputManager().addEventListener(E.ZOOM_IN,this._renderListener,this),this._getInputManager().addEventListener(E.ZOOM_OUT,this._renderListener,this)),this.cameraBehaviourChanged()}onCameraChanged(){}cameraBehaviourChanged(){this.cameraBehaviour.cameraControl instanceof yt&&this.cameraBehaviour.cameraControl.updateDistanceAndRangesBasedOnBounds(this.getBounds())}_addCameraControlListener(){this.cameraBehaviour.cameraControl.addEventListener(P.ORBIT_START,()=>{this._roomleRenderer?.movingCameraStarts(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(P.ORBIT_MOVE,this._requestRender,this),this.cameraBehaviour.cameraControl.addEventListener(P.ORBIT_END,()=>{this._roomleRenderer?.movingCameraStops(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(P.KEYBOARD_PRESSED,this._requestRender,this)}_renderEverything(){this._roomleRenderer&&(this._forceRender=!0,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}_renderWithoutShadowsAndAO(){this._roomleRenderer&&(this._forceRender=!0),this._requestRender()}_requestRender(){if(!this._renderer||this._stopRendering)return;const t=()=>{if(this._delta=this._clock.getDelta(),this._animateCamera(),this.cameraBehaviour.cameraControl.getCamera().layers.mask=65535,this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._globalInitData.e2e&&window.TWEEN){const e=window.TWEEN.getAll();for(const i of e)i.end()}if(this._roomleRenderer)this._statsHelper?.updateRenderInfo(this._roomleRenderer.renderer.info),this._roomleRenderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._forceRender=!1,this._shouldRenderUi()&&this._renderUi();else{this._statsHelper?.updateRenderInfo(this._renderer.info);const e=this.cameraBehaviour.cameraControl.getCamera();e.updateMatrixWorld(),e.updateProjectionMatrix(),this._renderer.render(this._scene,e)}this._onAfterRender(),window.TWEEN?.update(),this._lastChange+ts<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(t))};this._lastChange=Date.now(),!this._running&&!this._stopRendering&&(this._running=!0,requestAnimationFrame(t))}_shouldRenderUi(){return this._pluginSystem?.needsUiScene()}_renderUi(){const t=this._scene.background?this._scene.background.clone():null;this._scene.overrideMaterial=this._depthWriteMaterial,this._scene.background=null,this._renderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._scene.overrideMaterial=null;const e=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this.cameraBehaviour.cameraControl.getCamera()),this._renderer.autoClear=e,this._scene.background=t}_animateCamera(){this.cameraBehaviour.cameraControl&&(!this.cameraBehaviour.cameraControl.animateCamera(this._delta)&&this.shouldClearShadowsAndAO()&&!this._forceRender||this._lightSetting instanceof St&&this.cameraBehaviour.cameraControl.getCamera()instanceof V&&this._lightSetting.update(this.cameraBehaviour.cameraControl.getCamera(),this.cameraBehaviour.cameraControl.getTargetPosition())),this._environment&&this._environment.needsCamera()&&this.cameraBehaviour.cameraControl instanceof yt&&this._environment.updateCamera(this.cameraBehaviour.cameraControl.getCamera())}shouldClearShadowsAndAO(){return!1}_setupScene(t,e){this._initData.featureFlags.interiorLights&&Ke(oi);const{x:i,y:s}=this._domHelper.getClientDimensions();this._scene=new at,this._uiScene=new at,e=e||!1,e||(this._scene.background=this._initData.colors.DEFAULT_BACKGROUND),this._renderer=new Xe({antialias:!this._globalInitData.e2e,alpha:!0}),this._initData?.debug!==!0&&this._renderer?.debug!==void 0&&(this._renderer.debug.checkShaderErrors=!1);const a=this._initData.autoQuality?Math.min(window.devicePixelRatio,1.5):window.devicePixelRatio;this._renderer.setPixelRatio(a),this._renderer.setSize(i,s),this._renderer.outputColorSpace=$e,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=Je,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._globalInitData.e2e||(this._roomleRenderer=new Qe(this._renderer,i,s,this._initData.linearAoFilter??!1),this._initData.debug&&this._roomleRenderer.sceneRenderer.loadLutImages(ti),this._roomleRenderer.setQualityMap(ei),this._roomleRenderer.setAutoQuality(this._initData.autoQuality),this._roomleRenderer.setShadingType(this._initData.shading),this._roomleRenderer.setCustomShadingParameters(this._initData.customShading,this._initData.customShadingMoc),this._roomleRenderer?.setSize(i,s),this._roomleRenderer.sceneRenderer.outlineRenderer.parameters.hiddenEdgeColor=this._initData.colors.SELECTION.getHex(),this._roomleRenderer.sceneRenderer.outlineRenderer.parameters.visibleEdgeColor=this._initData.colors.SELECTION.getHex(),this._roomleRenderer.sceneRenderer.outlineRenderer.applyParameters()),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element?.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._hdrEnvironmentLoader.registerEnvironmentChangedCallback(o=>{this._setEnvMap(o)}),this._initData.legacyLight?this.loadEnvMap(Ei):this._initData.sceneLight?this._setDefaultEnvironmentScene():this.loadEnvMap(this._initData.envMapUrl),this._requestRender(),window.addEventListener(A.RESIZE,this,!1),window.addEventListener(A.KEY_DOWN,this,!1),window.addEventListener(A.KEY_UP,this,!1),document.addEventListener(A.VISIBILITY_CHANGE,this),this._pluginSystem.init(this._scene,this._uiScene,this.cameraBehaviour.cameraControl.getCamera().position),this._addCameraControlListener(),this.sceneChanged()}async loadEnvMap(t){await this._hdrEnvironmentLoader.loadUrl(this._renderer,t)}_getEnvMapIntensityAndRotation(){let t=this._initData.envMapIntensity,e=this._initData.envMapRotation;return t===ii&&this._isInteriorLightActive&&(t=es),e===si&&this._isInteriorLightActive&&(e=is),{intensity:t,rotation:e}}_setDefaultEnvironmentScene(){const t=this._initData.sceneLight,{intensity:e,rotation:i}=this._getEnvMapIntensityAndRotation();this._scene.userData.environmentDefinition=new It(new Xi({type:t}),{rotation:i,intensity:e,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!0,this._requestRender()}_setEnvMap(t){const{url:e,environmentMap:i}=t,{intensity:s,rotation:a}=this._getEnvMapIntensityAndRotation();this._scene.environment=i,this._scene.userData.environmentDefinition=new It(i,{rotation:a,intensity:this._initData.legacyLight?.9:s,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!this._initData.legacyLight,this._environment instanceof qi&&this._environment.updateEnvironmentTexture(i),e===ni&&!this._globalInitData.e2e&&window.requestIdleCallback(this.loadEnvMap.bind(this,h)),this._requestRender()}_tabVisible(){this.updateCamera(!1)}_releaseKeystrokeStates(){const t=["Shift","Meta","Control","Escape"];for(const e of t){const i=new KeyboardEvent("keyup",{key:e});this._onKeyUp(i,!0)}}updateCamera(t=!0){const{x:e,y:i}=this._domHelper.getClientDimensions();this._roomleRenderer?.setSize(e,i),this.cameraBehaviour.cameraControl.updateCamera(),this._renderEverything()}_onWindowResize(){const t=this._getInputManager();t&&t.updateSize(),this.updateCamera(),this._requestRender()}_isPartOfScene(t){return t.type==="Object3D"||t.type==="Mesh"||t.type===Jt.GLB||t.type===Jt.GLTF||t.type==="Group"}cleanUp(){this._getInputManager().removeEventListener(E.ZOOM_IN,this._renderListener),this._getInputManager().removeEventListener(E.ZOOM_OUT,this._renderListener),this.cameraBehaviour.cameraControl&&this.cameraBehaviour.cameraControl.cleanUp(),this._stopRendering=!0}clearScene(){let t=[];this._scene.children.forEach(e=>{this._isPartOfScene(e)&&t.push(e)}),t.forEach(e=>{ai(e),this._scene.remove(e)}),this._renderer.renderLists.dispose()}enableHD(t){this._renderer.capabilities.maxTextures>8&&t&&this.loadDynamicLightSetting(t),this._requestRender()}_loadGLTF(t,e,i,s,a,o,_){return new Promise((u,g)=>{this._staticItemLoader.loadGLTF(t,e,i,s,a,o,null,_).then(p=>{u(p.scene)},g)})}_loadGLB(t,e,i,s,a,o,_,u){return new Promise((g,p)=>{this._staticItemLoader.loadGLB(t,e,i,s,a,o,_,u).then(v=>{g(v.scene)},p)})}showGUI(){if(this._initData.disableDebugGUI)return;const t=document.createElement("style");t.innerText=".dg.main{position:absolute;z-index:999;top:0;left:0;}",document.head.appendChild(t);let e=Q(!1);if(!e)return;this._domHelper.element.appendChild(e.domElement),e.domElement.style.zIndex="999",e.domElement.style.overflowY="auto",e.domElement.style.maxHeight=this._domHelper.element.clientHeight+"px",this._guiLoaded()}_guiLoaded(){let t=Q();if(!t)return;const e=t.addFolder("Scene Parameter"),i={intensity:this._initData.envMapIntensity,rotation:this._initData.envMapRotation};e.add(i,"intensity",0,4,.01).name("env map intensity").onChange(s=>{this.changeEnvironmentMapIntensity(s),this._requestRender()}),e.add(i,"rotation",0,Math.PI*2,.01).name("env map rotation").onChange(s=>{this._scene.userData.environmentDefinition.rotation=s,this._requestRender()}),this._lightSetting&&this._lightSetting.showGUI(),this._roomleRenderer&&this._roomleRenderer.showGUI(()=>this._requestRender()),this._environment&&this._environment.showGUI(()=>this._requestRender()),this._addGUIListener(t)}_addGUIListener(t){let e=t.__folders;Object.keys(e).forEach(i=>{let s=e[i];s.__folders&&Object.keys(s.__folders).forEach(a=>{let o=s.__folders[a];this._addGUIListener(o)}),s.__controllers&&s.__controllers.forEach(a=>{a.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._renderEverything()}showStats(){Rt.import("./stats-helper-D4z7zVEi.js").then(t=>{this._statsHelper=new t.default,this._roomleRenderer.setOnQualityLevelChangeCallback(e=>{this._statsHelper?.updateQualityInfo(e)})})}_onKeyDown(t){}_onKeyUp(t,e=!1){}pause(){this._getInputManager().removeEvents(this._renderer.domElement),window.removeEventListener(A.RESIZE,this,!1),window.removeEventListener(A.KEY_DOWN,this,!1),window.removeEventListener(A.KEY_UP,this,!1),document.removeEventListener(A.VISIBILITY_CHANGE,this)}resume(){this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),window.addEventListener(A.RESIZE,this,!1),window.addEventListener(A.KEY_DOWN,this,!1),window.addEventListener(A.KEY_UP,this,!1),document.addEventListener(A.VISIBILITY_CHANGE,this),this.updateCamera()}destroy(){this.pause(),this.cleanUp()}handleEvent(t){switch(t.type){case A.RESIZE:this._onWindowResize();break;case A.KEY_DOWN:if(t.target&&(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement))break;this._onKeyDown(t);break;case A.KEY_UP:if(t.target&&(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement))break;this._onKeyUp(t);break;case A.VISIBILITY_CHANGE:this._tabVisible(),this._releaseKeystrokeStates();break}}async loadSceneSettings(t){let e;t.environment?e=new Promise(s=>{new pi().load(this._scene,this._renderer.domElement,this._environment,t,this._maxAnisotropy).then(o=>{this._setEnvironment(o),s()})}):e=Promise.resolve();let i;return t.lights?(this._lightSetting=new St(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(t)):i=Promise.resolve(),new Promise((s,a)=>{Promise.all([e,i]).then(()=>{this._renderEverything(),s()},a)})}setBackgroundColor(t){this._setEnvironment(new rt(this._scene,this._environment,new z(t)))}setBackgroundImage(t){this._setEnvironment(new rt(this._scene,this._environment,null,this._renderer.domElement,t))}_setEnvironment(t){this._environment=t,this._renderEverything()}async loadDynamicLightSetting(t){this._lightSetting=new St(this._scene,this._lightSetting);let e=!1;if(t.url)await this._lightSetting.loadFromURL(t.url),e=!0;else if(t.json)await this._lightSetting.loadFromJSON(t.json),e=!0;else if(t.object)await this._lightSetting.loadFromObject(t.object),e=!0;else if(t.ls){const i=ri.createDynamicLightSettingSource(null,t.ls);await this._lightSetting.loadFromURL(i.url),e=!0}if(e)this._requestRender();else throw new Error("No dynamic light setting source set")}getScene(){return this._scene}updateScene(){this._updateBounds(this.getBounds(),this.getGeometryBounds()),this._roomleRenderer?.forceShadowUpdates(!0),this._renderEverything()}_updateBounds(t,e,i=!1){if(!t)return;const s=e??t;this.updateEnvironment(s,i),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(t),this._roomleRenderer?.updateBounds(s),this._requestRender(),this._pluginSystem.updateBounds(t)}setCameraOffset(t){const e=this.cameraBehaviour.cameraControl.getCamera(),i=e||e;i?.offset?(i.offset=t,this._renderEverything()):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){const t=this.cameraBehaviour?.cameraControl?.getCamera(),e=t||t;return e?.offset?JSON.parse(JSON.stringify(e.offset)):{left:0,top:0,right:1,bottom:1}}getOrthographicOffsetCamera(){if(!this._orthographicOffsetCamera){const t=this.getCameraOffset(),e=5;let s=this._domHelper.getAspectRatio()*e,a=e;const o=ae();this._orthographicOffsetCamera=o.createOrthographicCamera(s/-2,s/2,a/2,a/-2,1,1e3,t),this._orthographicOffsetCamera.position.set(0,10,0),this._orthographicOffsetCamera.lookAt(new l(0,0,0))}return this._orthographicOffsetCamera}getPerspectiveOffsetCamera(){if(!this._perspectiveOffsetCamera){const t=this.getCameraOffset(),e=this._domHelper.getClientDimensions(),i=e.x,s=e.y,a=ae();this._perspectiveOffsetCamera=a.createPerspectiveCamera(30,i/s,.1,20,t)}return this._perspectiveOffsetCamera}updateEnvironment(t,e=!1){if(t&&this._environment&&this._environment.needsBounds()){const i=t.getSize(new l);(i.x+i.y+i.z!==0||e)&&this._environment.updateBounds(t.getSize(new l),e)}this._roomleRenderer?.updateBounds(t)}_onCameraIdle(){return!0}_onCameraMove(){return!0}_waitForAssets(){return Promise.resolve()}async exportCanvasScreenshot(t=1){return await this._waitForAssets(),new Promise(e=>{this._onAfterRender=()=>{const i=this._renderer.domElement.toDataURL(this._initData.transparentBackground?"image/png":"image/jpeg",t);e(i),this._onAfterRender=()=>{}},this._requestRender()})}async exportImageFromCamera(t,e=!1){return e&&await this._waitForAssets(),new Promise((i,s)=>{this._onAfterRender=()=>{this._onAfterRender=()=>{};const a=this._renderer.domElement.toDataURL("image/jpeg",1),{left:o,right:_,top:u,bottom:g}=this.getCameraOffset(),p=_-o,v=u-g;if(p===1&&v===1){Qt(t,a),i();return}const M=new Image;M.src=a,M.onload=()=>{const{naturalWidth:H,naturalHeight:Lt}=M,C=document.createElement("canvas");C.width=H*p,C.height=Lt*v;const n=C.getContext("2d"),r=H*o*-1,c=Lt*(1-u)*-1;n.drawImage(M,r,c),n.save(),Qt(t,C.toDataURL("image/jpeg",1)),i()},M.onerror=s},this._requestRender()})}changeEnvironmentMapIntensity(t){this._scene.userData.environmentDefinition.intensity=t}lockCamera(){this.cameraBehaviour.cameraControl.lock()}unlockCamera(){this.cameraBehaviour.cameraControl.unlock()}setEnvironmentMap(t,e,i,s){t!==void 0&&this._hdrEnvironmentLoader.loadUrl(this._renderer,t),e!==void 0&&(this._scene.userData.environmentDefinition.intensity=e),i!==void 0&&(this._scene.userData.environmentDefinition.rotation=i),s!==void 0&&(this._scene.userData.environmentDefinition.maxNoOfLightSources=s,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}_getCameraControl3D(t){return this._cameraControl3D?t&&this._cameraControl3D.setCurrentCameraParameters(t):this._cameraControl3D=new yt(this._creator_,this._getInputManager(),t,this.getPerspectiveOffsetCamera()),this._cameraControl3D}_getCameraControl2D(){return this._cameraControl2D||(this._cameraControl2D=new bi(this._creator_,this._getInputManager(),null,this.getOrthographicOffsetCamera())),this._cameraControl2D}_getCameraControlFirstPerson(){return this._cameraControlFirstPerson||(this._cameraControlFirstPerson=new Et(this._creator_,this._getInputManager(),null,this.getPerspectiveOffsetCamera())),this._cameraControlFirstPerson}}T("S",N),U([I],N.prototype,"_domHelper"),U([I],N.prototype,"_scriptLoader"),U([I],N.prototype,"_lifeCycleManager"),U([I],N.prototype,"_staticItemLoader"),U([I],N.prototype,"_hdrEnvironmentLoader"),U([I],N.prototype,"_initData"),U([I],N.prototype,"_globalInitData"),U([I],N.prototype,"_globalCallback"),U([I],N.prototype,"_idbManager"),U([I],N.prototype,"_pluginSystem"),U([I],N.prototype,"_imageRenderer"),U([I],N.prototype,"_cameraBehaviourState");class ss{constructor(t,e){return this._state=null,this._cameraChangeListener=null,this._cameraControl=t,this._state=e,window.__RML__DEBUG__?.camera?hi(this,"CameraBehaviour"):this}get state(){return this._state}setCameraChangeListener(t){this._cameraChangeListener=t}removeCameraChangeListener(){this._cameraChangeListener=null}_onCameraChanged(){this._cameraChangeListener&&this._cameraChangeListener()}}T("c",ss)}}});
50
+ //# sourceMappingURL=camera-behaviour-CzgZxW1D.js.map