@roomle/web-sdk 2.94.0 → 2.95.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 (318) hide show
  1. package/.releaserc.json +7 -5
  2. package/lib/TextGeometry-259292ec.nomodule.js +2 -0
  3. package/lib/TextGeometry-259292ec.nomodule.js.map +1 -0
  4. package/lib/TextGeometry-dc304c0e.js +2 -0
  5. package/lib/TextGeometry-dc304c0e.js.map +1 -0
  6. package/lib/{banana-for-scale-1f451414.nomodule.js → banana-for-scale-71781669.nomodule.js} +2 -2
  7. package/lib/{banana-for-scale-1f451414.nomodule.js.map → banana-for-scale-71781669.nomodule.js.map} +1 -1
  8. package/lib/{banana-for-scale-8479c8a1.js → banana-for-scale-bd7ed014.js} +2 -2
  9. package/lib/{banana-for-scale-8479c8a1.js.map → banana-for-scale-bd7ed014.js.map} +1 -1
  10. package/lib/{budgeteer-measure-f6505461.js → budgeteer-measure-7662ae7e.js} +2 -2
  11. package/lib/{budgeteer-measure-f6505461.js.map → budgeteer-measure-7662ae7e.js.map} +1 -1
  12. package/lib/budgeteer-measure.nomodule.js +1 -1
  13. package/lib/camera-behaviour-24973bc6.js +2 -0
  14. package/lib/camera-behaviour-24973bc6.js.map +1 -0
  15. package/lib/camera-behaviour-38b2e4d9.nomodule.js +2 -0
  16. package/lib/camera-behaviour-38b2e4d9.nomodule.js.map +1 -0
  17. package/lib/component-dimensioning-4e0a7151.nomodule.js +2 -0
  18. package/lib/component-dimensioning-4e0a7151.nomodule.js.map +1 -0
  19. package/lib/component-dimensioning-9829423d.js +2 -0
  20. package/lib/component-dimensioning-9829423d.js.map +1 -0
  21. package/lib/{component-raycast-helper-163d42ba.nomodule.js → component-raycast-helper-15d24684.nomodule.js} +2 -2
  22. package/lib/component-raycast-helper-15d24684.nomodule.js.map +1 -0
  23. package/lib/{component-raycast-helper-479486e8.js → component-raycast-helper-4fdfba05.js} +2 -2
  24. package/lib/component-raycast-helper-4fdfba05.js.map +1 -0
  25. package/lib/{configurator-b5e4a5ee.nomodule.js → configurator-0d7d6a64.nomodule.js} +2 -2
  26. package/lib/configurator-0d7d6a64.nomodule.js.map +1 -0
  27. package/lib/{configurator-9333ac17.js → configurator-d59d9acf.js} +2 -2
  28. package/lib/configurator-d59d9acf.js.map +1 -0
  29. package/lib/configurator-main-23183c5c.js +2 -0
  30. package/lib/configurator-main-23183c5c.js.map +1 -0
  31. package/lib/configurator-main.nomodule.js +1 -1
  32. package/lib/{continuous-drawing-helper-6f2f4c78.nomodule.js → continuous-drawing-helper-0f94d7f7.nomodule.js} +2 -2
  33. package/lib/continuous-drawing-helper-0f94d7f7.nomodule.js.map +1 -0
  34. package/lib/{continuous-drawing-helper-f8a966d9.js → continuous-drawing-helper-a1262a15.js} +2 -2
  35. package/lib/continuous-drawing-helper-a1262a15.js.map +1 -0
  36. package/lib/{default-light-setting-6425c714.js → default-light-setting-20f64f6d.js} +2 -2
  37. package/lib/default-light-setting-20f64f6d.js.map +1 -0
  38. package/lib/{default-light-setting-99036b6f.nomodule.js → default-light-setting-2983998d.nomodule.js} +2 -2
  39. package/lib/default-light-setting-2983998d.nomodule.js.map +1 -0
  40. package/lib/definitions/common-core/src/cameracontrol/camera-control.d.ts +1 -0
  41. package/lib/definitions/common-core/src/configurator-kernel-access.d.ts +0 -1
  42. package/lib/definitions/common-core/src/rapi-access.d.ts +5 -1
  43. package/lib/definitions/common-core/src/utils/init-data.d.ts +2 -0
  44. package/lib/definitions/common-core/src/utils/shims.d.ts +15 -1
  45. package/lib/definitions/common-core/src/view-model/plan-element-view-model.d.ts +1 -1
  46. package/lib/definitions/common-core/src/webgl/renderer/scene-renderer.d.ts +2 -1
  47. package/lib/definitions/common-core/src/webgl/roomle-webgl-renderer.d.ts +1 -1
  48. package/lib/definitions/configurator-core/src/roomle-configurator.d.ts +9 -2
  49. package/lib/definitions/configurator-core/src/services/configurator-ui-callback.d.ts +2 -1
  50. package/lib/definitions/configurator-core/src/utils/imos-ix-poc-export-helper.d.ts +43 -0
  51. package/lib/definitions/configurator-core/src/utils/selection-handler.d.ts +4 -1
  52. package/lib/definitions/configurator-core/src/webgl/configurator-scene-event-handler.d.ts +5 -2
  53. package/lib/definitions/configurator-core/src/webgl/configurator-scene-manager.d.ts +3 -2
  54. package/lib/definitions/packages/common-core/src/cameracontrol/camera-control.d.ts +1 -0
  55. package/lib/definitions/packages/common-core/src/configurator-kernel-access.d.ts +0 -1
  56. package/lib/definitions/packages/common-core/src/rapi-access.d.ts +5 -1
  57. package/lib/definitions/packages/common-core/src/utils/init-data.d.ts +2 -0
  58. package/lib/definitions/packages/common-core/src/utils/shims.d.ts +15 -1
  59. package/lib/definitions/packages/common-core/src/view-model/plan-element-view-model.d.ts +1 -1
  60. package/lib/definitions/packages/common-core/src/webgl/renderer/scene-renderer.d.ts +2 -1
  61. package/lib/definitions/packages/common-core/src/webgl/roomle-webgl-renderer.d.ts +1 -1
  62. package/lib/definitions/packages/configurator-core/src/roomle-configurator.d.ts +9 -2
  63. package/lib/definitions/packages/configurator-core/src/services/configurator-ui-callback.d.ts +2 -1
  64. package/lib/definitions/packages/configurator-core/src/utils/imos-ix-poc-export-helper.d.ts +43 -0
  65. package/lib/definitions/packages/configurator-core/src/utils/selection-handler.d.ts +4 -1
  66. package/lib/definitions/packages/configurator-core/src/webgl/configurator-scene-event-handler.d.ts +5 -2
  67. package/lib/definitions/packages/configurator-core/src/webgl/configurator-scene-manager.d.ts +3 -2
  68. package/lib/definitions/packages/planner-core/src/camera-control/camera-control-first-person.d.ts +1 -0
  69. package/lib/definitions/packages/planner-core/src/external-object-api-callbacks.d.ts +26 -12
  70. package/lib/definitions/packages/planner-core/src/external-object-api.d.ts +10 -3
  71. package/lib/definitions/packages/planner-core/src/roomle-planner-ui-callback.d.ts +10 -5
  72. package/lib/definitions/packages/planner-core/src/roomle-planner.d.ts +63 -7
  73. package/lib/definitions/packages/planner-core/src/services/planner-kernel-access.d.ts +11 -11
  74. package/lib/definitions/packages/planner-core/src/utils/planner-scene-manager.d.ts +1 -1
  75. package/lib/definitions/packages/planner-core/src/view-model/plan-view-model.d.ts +8 -0
  76. package/lib/definitions/packages/planner-core/src/view-model/wall-attic-plan-element-view-model.d.ts +9 -0
  77. package/lib/definitions/packages/planner-core/src/view-model/wall-plan-element-view-model.d.ts +4 -0
  78. package/lib/definitions/packages/planner-core/src/webgl/planner-scene-event-handler.d.ts +1 -0
  79. package/lib/definitions/packages/planner-core/src/webgl/planner-scene-manager.d.ts +6 -0
  80. package/lib/definitions/packages/typings/kernel.d.ts +15 -0
  81. package/lib/definitions/packages/typings/planner.d.ts +39 -4
  82. package/lib/definitions/planner-core/src/camera-control/camera-control-first-person.d.ts +1 -0
  83. package/lib/definitions/planner-core/src/external-object-api-callbacks.d.ts +26 -12
  84. package/lib/definitions/planner-core/src/external-object-api.d.ts +10 -3
  85. package/lib/definitions/planner-core/src/roomle-planner-ui-callback.d.ts +10 -5
  86. package/lib/definitions/planner-core/src/roomle-planner.d.ts +63 -7
  87. package/lib/definitions/planner-core/src/services/planner-kernel-access.d.ts +11 -11
  88. package/lib/definitions/planner-core/src/utils/planner-scene-manager.d.ts +1 -1
  89. package/lib/definitions/planner-core/src/view-model/plan-view-model.d.ts +8 -0
  90. package/lib/definitions/planner-core/src/view-model/wall-attic-plan-element-view-model.d.ts +9 -0
  91. package/lib/definitions/planner-core/src/view-model/wall-plan-element-view-model.d.ts +4 -0
  92. package/lib/definitions/planner-core/src/webgl/planner-scene-event-handler.d.ts +1 -0
  93. package/lib/definitions/planner-core/src/webgl/planner-scene-manager.d.ts +6 -0
  94. package/lib/definitions/typings/kernel.d.ts +15 -0
  95. package/lib/definitions/typings/planner.d.ts +39 -4
  96. package/lib/dimensioning-helper-9d046848.nomodule.js +2 -0
  97. package/lib/dimensioning-helper-9d046848.nomodule.js.map +1 -0
  98. package/lib/dimensioning-helper-c98b39cc.js +2 -0
  99. package/lib/{dimensioning-helper-318b729d.js.map → dimensioning-helper-c98b39cc.js.map} +1 -1
  100. package/lib/{glb-viewer-66869df0.js → glb-viewer-212c78d9.js} +2 -2
  101. package/lib/{glb-viewer-66869df0.js.map → glb-viewer-212c78d9.js.map} +1 -1
  102. package/lib/{glb-viewer-2d94a287.nomodule.js → glb-viewer-a684a4c6.nomodule.js} +2 -2
  103. package/lib/{glb-viewer-2d94a287.nomodule.js.map → glb-viewer-a684a4c6.nomodule.js.map} +1 -1
  104. package/lib/{glb-viewer-camera-behaviour-169bee0e.js → glb-viewer-camera-behaviour-45c2ab16.js} +2 -2
  105. package/lib/glb-viewer-camera-behaviour-45c2ab16.js.map +1 -0
  106. package/lib/{glb-viewer-camera-behaviour-0aba3eb3.nomodule.js → glb-viewer-camera-behaviour-9754b7f1.nomodule.js} +2 -2
  107. package/lib/glb-viewer-camera-behaviour-9754b7f1.nomodule.js.map +1 -0
  108. package/lib/glb-viewer-main-ad9f4fc7.js +2 -0
  109. package/lib/glb-viewer-main-ad9f4fc7.js.map +1 -0
  110. package/lib/glb-viewer-main.nomodule.js +1 -1
  111. package/lib/imos-ix-poc-export-helper-6a36afe0.nomodule.js +2 -0
  112. package/lib/imos-ix-poc-export-helper-6a36afe0.nomodule.js.map +1 -0
  113. package/lib/imos-ix-poc-export-helper-9404ff2e.js +2 -0
  114. package/lib/imos-ix-poc-export-helper-9404ff2e.js.map +1 -0
  115. package/lib/legacy/TextGeometry-7a5a6f22.legacy.js +2 -0
  116. package/lib/legacy/TextGeometry-7a5a6f22.legacy.js.map +1 -0
  117. package/lib/legacy/{banana-for-scale-a28854f7.legacy.js → banana-for-scale-063481d1.legacy.js} +2 -2
  118. package/lib/legacy/{banana-for-scale-a28854f7.legacy.js.map → banana-for-scale-063481d1.legacy.js.map} +1 -1
  119. package/lib/legacy/budgeteer-measure.legacy.js +1 -1
  120. package/lib/legacy/camera-behaviour-c9de2cca.legacy.js +2 -0
  121. package/lib/legacy/camera-behaviour-c9de2cca.legacy.js.map +1 -0
  122. package/lib/legacy/component-dimensioning-bdada177.legacy.js +2 -0
  123. package/lib/legacy/component-dimensioning-bdada177.legacy.js.map +1 -0
  124. package/lib/legacy/{component-raycast-helper-17b7f665.legacy.js → component-raycast-helper-9add4bb8.legacy.js} +2 -2
  125. package/lib/legacy/component-raycast-helper-9add4bb8.legacy.js.map +1 -0
  126. package/lib/legacy/{configurator-c69e87db.legacy.js → configurator-a0fc9e2b.legacy.js} +2 -2
  127. package/lib/legacy/configurator-a0fc9e2b.legacy.js.map +1 -0
  128. package/lib/legacy/configurator-main.legacy.js +1 -1
  129. package/lib/legacy/{continuous-drawing-helper-bb050ff2.legacy.js → continuous-drawing-helper-def6a16b.legacy.js} +2 -2
  130. package/lib/legacy/continuous-drawing-helper-def6a16b.legacy.js.map +1 -0
  131. package/lib/legacy/{default-light-setting-086a7648.legacy.js → default-light-setting-0867c2ad.legacy.js} +2 -2
  132. package/lib/legacy/default-light-setting-0867c2ad.legacy.js.map +1 -0
  133. package/lib/legacy/dimensioning-helper-6a8cddd0.legacy.js +2 -0
  134. package/lib/legacy/dimensioning-helper-6a8cddd0.legacy.js.map +1 -0
  135. package/lib/legacy/{glb-viewer-4a69cf11.legacy.js → glb-viewer-110cb6c4.legacy.js} +2 -2
  136. package/lib/legacy/{glb-viewer-4a69cf11.legacy.js.map → glb-viewer-110cb6c4.legacy.js.map} +1 -1
  137. package/lib/legacy/{glb-viewer-camera-behaviour-a0bd3636.legacy.js → glb-viewer-camera-behaviour-f6168432.legacy.js} +2 -2
  138. package/lib/legacy/glb-viewer-camera-behaviour-f6168432.legacy.js.map +1 -0
  139. package/lib/legacy/glb-viewer-main.legacy.js +1 -1
  140. package/lib/legacy/imos-ix-poc-export-helper-fdfedc90.legacy.js +2 -0
  141. package/lib/legacy/imos-ix-poc-export-helper-fdfedc90.legacy.js.map +1 -0
  142. package/lib/legacy/main-thread-to-worker-6115d235.legacy.js +7 -0
  143. package/lib/legacy/main-thread-to-worker-6115d235.legacy.js.map +1 -0
  144. package/lib/legacy/{material-viewer-aec0f3b7.legacy.js → material-viewer-b67b9c39.legacy.js} +2 -2
  145. package/lib/legacy/material-viewer-b67b9c39.legacy.js.map +1 -0
  146. package/lib/legacy/material-viewer-main.legacy.js +1 -1
  147. package/lib/legacy/planner-9f484212.legacy.js +2 -0
  148. package/lib/legacy/planner-9f484212.legacy.js.map +1 -0
  149. package/lib/legacy/planner-main.legacy.js +1 -1
  150. package/lib/legacy/{query-params-helper-aca6a1b1.legacy.js → query-params-helper-28b451be.legacy.js} +2 -2
  151. package/lib/legacy/query-params-helper-28b451be.legacy.js.map +1 -0
  152. package/lib/legacy/roomle-configurator-de101c34.legacy.js +2 -0
  153. package/lib/legacy/roomle-configurator-de101c34.legacy.js.map +1 -0
  154. package/lib/legacy/roomle-dependency-injection-6f2ea0b0.legacy.js +9 -0
  155. package/lib/legacy/roomle-dependency-injection-6f2ea0b0.legacy.js.map +1 -0
  156. package/lib/legacy/roomle-sdk.legacy.js +1 -1
  157. package/lib/legacy/{script-loader-d6b10e8e.legacy.js → script-loader-813426c5.legacy.js} +2 -2
  158. package/lib/legacy/script-loader-813426c5.legacy.js.map +1 -0
  159. package/lib/legacy/static/ConfiguratorKernel-224f3e49bcca1cee.wasm +0 -0
  160. package/lib/legacy/static/{ConfiguratorKernel-2ddc08f9542fc91f.js → ConfiguratorKernel-f5baba2ad8da5981.js} +3 -3
  161. package/lib/legacy/static/{RoomleCore-f2d7b1b87640ef15.js → RoomleCore-df3ed2b0c7211584.js} +50 -50
  162. package/lib/legacy/static/RoomleCore-f35e0972ad5263e7.wasm +0 -0
  163. package/lib/legacy/static/RoomleToolsCore-c263aadc8e58a52f.wasm +0 -0
  164. package/lib/legacy/static/default-external-object-api-configuration-c4294f96099e0d09.json +70 -0
  165. package/lib/legacy/{stats-helper-4d796606.legacy.js → stats-helper-df7e9281.legacy.js} +2 -2
  166. package/lib/legacy/stats-helper-df7e9281.legacy.js.map +1 -0
  167. package/lib/legacy/{tools-core-15dc1d58.legacy.js → tools-core-0de78af1.legacy.js} +2 -2
  168. package/lib/legacy/tools-core-0de78af1.legacy.js.map +1 -0
  169. package/lib/main-thread-to-worker-352ff4b1.js +8 -0
  170. package/lib/main-thread-to-worker-352ff4b1.js.map +1 -0
  171. package/lib/main-thread-to-worker-7f1cb5ea.nomodule.js +8 -0
  172. package/lib/main-thread-to-worker-7f1cb5ea.nomodule.js.map +1 -0
  173. package/lib/{material-viewer-2c8625ff.nomodule.js → material-viewer-17245c14.nomodule.js} +2 -2
  174. package/lib/material-viewer-17245c14.nomodule.js.map +1 -0
  175. package/lib/{material-viewer-c9197111.js → material-viewer-21b41edc.js} +2 -2
  176. package/lib/material-viewer-21b41edc.js.map +1 -0
  177. package/lib/material-viewer-main-7a85fb66.js +2 -0
  178. package/lib/material-viewer-main-7a85fb66.js.map +1 -0
  179. package/lib/material-viewer-main.nomodule.js +1 -1
  180. package/lib/planner-0f75d071.nomodule.js +2 -0
  181. package/lib/planner-0f75d071.nomodule.js.map +1 -0
  182. package/lib/planner-2a7134a5.js +2 -0
  183. package/lib/planner-2a7134a5.js.map +1 -0
  184. package/lib/planner-main-49e474c0.js +2 -0
  185. package/lib/planner-main-49e474c0.js.map +1 -0
  186. package/lib/planner-main.nomodule.js +1 -1
  187. package/lib/{query-params-helper-c9492f35.js → query-params-helper-28405b8d.js} +2 -2
  188. package/lib/query-params-helper-28405b8d.js.map +1 -0
  189. package/lib/{query-params-helper-51a53f8c.nomodule.js → query-params-helper-4f855064.nomodule.js} +2 -2
  190. package/lib/query-params-helper-4f855064.nomodule.js.map +1 -0
  191. package/lib/roomle-configurator-0efacaed.nomodule.js +2 -0
  192. package/lib/roomle-configurator-0efacaed.nomodule.js.map +1 -0
  193. package/lib/roomle-configurator-c663d225.js +2 -0
  194. package/lib/roomle-configurator-c663d225.js.map +1 -0
  195. package/lib/roomle-dependency-injection-2c9062d2.js +9 -0
  196. package/lib/roomle-dependency-injection-2c9062d2.js.map +1 -0
  197. package/lib/roomle-dependency-injection-7065f121.nomodule.js +9 -0
  198. package/lib/roomle-dependency-injection-7065f121.nomodule.js.map +1 -0
  199. package/lib/{roomle-sdk-6ccf3ded.js → roomle-sdk-05836f4b.js} +2 -2
  200. package/lib/roomle-sdk-05836f4b.js.map +1 -0
  201. package/lib/roomle-sdk.nomodule.js +1 -1
  202. package/lib/{script-loader-8964e022.js → script-loader-7e3054f7.js} +2 -2
  203. package/lib/script-loader-7e3054f7.js.map +1 -0
  204. package/lib/{script-loader-b4e814f2.nomodule.js → script-loader-d022ac10.nomodule.js} +2 -2
  205. package/lib/script-loader-d022ac10.nomodule.js.map +1 -0
  206. package/lib/static/ConfiguratorKernel-224f3e49bcca1cee.wasm +0 -0
  207. package/lib/static/{ConfiguratorKernel-2ddc08f9542fc91f.js → ConfiguratorKernel-f5baba2ad8da5981.js} +1 -1
  208. package/lib/static/{ConfiguratorKernel-2ddc08f9542fc91f.js.map → ConfiguratorKernel-f5baba2ad8da5981.js.map} +1 -1
  209. package/lib/static/RoomleCore-df3ed2b0c7211584.js +1 -0
  210. package/lib/static/RoomleCore-df3ed2b0c7211584.js.map +1 -0
  211. package/lib/static/RoomleCore-f35e0972ad5263e7.wasm +0 -0
  212. package/lib/static/RoomleToolsCore-c263aadc8e58a52f.wasm +0 -0
  213. package/lib/static/default-external-object-api-configuration-c4294f96099e0d09.json +70 -0
  214. package/lib/{stats-helper-510ddd65.js → stats-helper-35f4c9ae.js} +2 -2
  215. package/lib/stats-helper-35f4c9ae.js.map +1 -0
  216. package/lib/{stats-helper-86728f77.nomodule.js → stats-helper-76e1b50a.nomodule.js} +2 -2
  217. package/lib/stats-helper-76e1b50a.nomodule.js.map +1 -0
  218. package/lib/{tools-core-0f3ae134.nomodule.js → tools-core-027637cd.nomodule.js} +2 -2
  219. package/lib/tools-core-027637cd.nomodule.js.map +1 -0
  220. package/lib/{tools-core-bae4492f.js → tools-core-3bdc826b.js} +2 -2
  221. package/lib/tools-core-3bdc826b.js.map +1 -0
  222. package/package.json +3 -3
  223. package/lib/TextGeometry-ab643210.js +0 -2
  224. package/lib/TextGeometry-ab643210.js.map +0 -1
  225. package/lib/TextGeometry-cd81779b.nomodule.js +0 -2
  226. package/lib/TextGeometry-cd81779b.nomodule.js.map +0 -1
  227. package/lib/camera-behaviour-27b6ce79.nomodule.js +0 -2
  228. package/lib/camera-behaviour-27b6ce79.nomodule.js.map +0 -1
  229. package/lib/camera-behaviour-b9a52002.js +0 -2
  230. package/lib/camera-behaviour-b9a52002.js.map +0 -1
  231. package/lib/component-dimensioning-9cc86304.nomodule.js +0 -2
  232. package/lib/component-dimensioning-9cc86304.nomodule.js.map +0 -1
  233. package/lib/component-dimensioning-aa4cd8f4.js +0 -2
  234. package/lib/component-dimensioning-aa4cd8f4.js.map +0 -1
  235. package/lib/component-raycast-helper-163d42ba.nomodule.js.map +0 -1
  236. package/lib/component-raycast-helper-479486e8.js.map +0 -1
  237. package/lib/configurator-9333ac17.js.map +0 -1
  238. package/lib/configurator-b5e4a5ee.nomodule.js.map +0 -1
  239. package/lib/configurator-main-d0382ff8.js +0 -2
  240. package/lib/configurator-main-d0382ff8.js.map +0 -1
  241. package/lib/continuous-drawing-helper-6f2f4c78.nomodule.js.map +0 -1
  242. package/lib/continuous-drawing-helper-f8a966d9.js.map +0 -1
  243. package/lib/default-light-setting-6425c714.js.map +0 -1
  244. package/lib/default-light-setting-99036b6f.nomodule.js.map +0 -1
  245. package/lib/dimensioning-helper-318b729d.js +0 -2
  246. package/lib/dimensioning-helper-49404687.nomodule.js +0 -2
  247. package/lib/dimensioning-helper-49404687.nomodule.js.map +0 -1
  248. package/lib/glb-viewer-camera-behaviour-0aba3eb3.nomodule.js.map +0 -1
  249. package/lib/glb-viewer-camera-behaviour-169bee0e.js.map +0 -1
  250. package/lib/glb-viewer-main-1b2e5764.js +0 -2
  251. package/lib/glb-viewer-main-1b2e5764.js.map +0 -1
  252. package/lib/legacy/TextGeometry-f4299b59.legacy.js +0 -2
  253. package/lib/legacy/TextGeometry-f4299b59.legacy.js.map +0 -1
  254. package/lib/legacy/camera-behaviour-e6ce4b6d.legacy.js +0 -2
  255. package/lib/legacy/camera-behaviour-e6ce4b6d.legacy.js.map +0 -1
  256. package/lib/legacy/component-dimensioning-a3182494.legacy.js +0 -2
  257. package/lib/legacy/component-dimensioning-a3182494.legacy.js.map +0 -1
  258. package/lib/legacy/component-raycast-helper-17b7f665.legacy.js.map +0 -1
  259. package/lib/legacy/configurator-c69e87db.legacy.js.map +0 -1
  260. package/lib/legacy/continuous-drawing-helper-bb050ff2.legacy.js.map +0 -1
  261. package/lib/legacy/default-light-setting-086a7648.legacy.js.map +0 -1
  262. package/lib/legacy/dimensioning-helper-fb07be35.legacy.js +0 -2
  263. package/lib/legacy/dimensioning-helper-fb07be35.legacy.js.map +0 -1
  264. package/lib/legacy/glb-viewer-camera-behaviour-a0bd3636.legacy.js.map +0 -1
  265. package/lib/legacy/main-thread-to-worker-7c2b8bc9.legacy.js +0 -7
  266. package/lib/legacy/main-thread-to-worker-7c2b8bc9.legacy.js.map +0 -1
  267. package/lib/legacy/material-viewer-aec0f3b7.legacy.js.map +0 -1
  268. package/lib/legacy/planner-2bc74cf2.legacy.js +0 -2
  269. package/lib/legacy/planner-2bc74cf2.legacy.js.map +0 -1
  270. package/lib/legacy/query-params-helper-aca6a1b1.legacy.js.map +0 -1
  271. package/lib/legacy/roomle-configurator-d5ea14c2.legacy.js +0 -2
  272. package/lib/legacy/roomle-configurator-d5ea14c2.legacy.js.map +0 -1
  273. package/lib/legacy/roomle-dependency-injection-500dbf0d.legacy.js +0 -9
  274. package/lib/legacy/roomle-dependency-injection-500dbf0d.legacy.js.map +0 -1
  275. package/lib/legacy/script-loader-d6b10e8e.legacy.js.map +0 -1
  276. package/lib/legacy/static/ConfiguratorKernel-793e445c9d64ee4b.wasm +0 -0
  277. package/lib/legacy/static/RoomleCore-7d39e007d6f9b788.wasm +0 -0
  278. package/lib/legacy/static/RoomleToolsCore-9c348432c6d79392.wasm +0 -0
  279. package/lib/legacy/static/default-external-object-api-configuration-1e7103889f664a3f.json +0 -16
  280. package/lib/legacy/stats-helper-4d796606.legacy.js.map +0 -1
  281. package/lib/legacy/tools-core-15dc1d58.legacy.js.map +0 -1
  282. package/lib/main-thread-to-worker-2529fa31.nomodule.js +0 -2
  283. package/lib/main-thread-to-worker-2529fa31.nomodule.js.map +0 -1
  284. package/lib/main-thread-to-worker-ee3036b3.js +0 -2
  285. package/lib/main-thread-to-worker-ee3036b3.js.map +0 -1
  286. package/lib/material-viewer-2c8625ff.nomodule.js.map +0 -1
  287. package/lib/material-viewer-c9197111.js.map +0 -1
  288. package/lib/material-viewer-main-8787208d.js +0 -2
  289. package/lib/material-viewer-main-8787208d.js.map +0 -1
  290. package/lib/planner-5fb6f448.js +0 -2
  291. package/lib/planner-5fb6f448.js.map +0 -1
  292. package/lib/planner-65127889.nomodule.js +0 -2
  293. package/lib/planner-65127889.nomodule.js.map +0 -1
  294. package/lib/planner-main-d8ae156a.js +0 -2
  295. package/lib/planner-main-d8ae156a.js.map +0 -1
  296. package/lib/query-params-helper-51a53f8c.nomodule.js.map +0 -1
  297. package/lib/query-params-helper-c9492f35.js.map +0 -1
  298. package/lib/roomle-configurator-9fe534c7.js +0 -2
  299. package/lib/roomle-configurator-9fe534c7.js.map +0 -1
  300. package/lib/roomle-configurator-ebb94f0f.nomodule.js +0 -2
  301. package/lib/roomle-configurator-ebb94f0f.nomodule.js.map +0 -1
  302. package/lib/roomle-dependency-injection-4e221caa.js +0 -9
  303. package/lib/roomle-dependency-injection-4e221caa.js.map +0 -1
  304. package/lib/roomle-dependency-injection-5fd128b0.nomodule.js +0 -9
  305. package/lib/roomle-dependency-injection-5fd128b0.nomodule.js.map +0 -1
  306. package/lib/roomle-sdk-6ccf3ded.js.map +0 -1
  307. package/lib/script-loader-8964e022.js.map +0 -1
  308. package/lib/script-loader-b4e814f2.nomodule.js.map +0 -1
  309. package/lib/static/ConfiguratorKernel-793e445c9d64ee4b.wasm +0 -0
  310. package/lib/static/RoomleCore-7d39e007d6f9b788.wasm +0 -0
  311. package/lib/static/RoomleCore-f2d7b1b87640ef15.js +0 -1
  312. package/lib/static/RoomleCore-f2d7b1b87640ef15.js.map +0 -1
  313. package/lib/static/RoomleToolsCore-9c348432c6d79392.wasm +0 -0
  314. package/lib/static/default-external-object-api-configuration-1e7103889f664a3f.json +0 -16
  315. package/lib/stats-helper-510ddd65.js.map +0 -1
  316. package/lib/stats-helper-86728f77.nomodule.js.map +0 -1
  317. package/lib/tools-core-0f3ae134.nomodule.js.map +0 -1
  318. package/lib/tools-core-bae4492f.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ System.register(["./roomle-dependency-injection-7065f121.nomodule.js","./camera-behaviour-38b2e4d9.nomodule.js","./main-thread-to-worker-7f1cb5ea.nomodule.js","./default-light-setting-2983998d.nomodule.js"],(function(e,t){var n,i,o,s,r,a,l,c,h,d,_,u,g,m,p,C,f,v,b,w,P,y,M,I,O,E,D,S,A,x,k,H,j,R,L,V,B,T,F,G,K,U,W,N,q,z,Z,Q,J,X,Y,$,ee,te,ne,ie,oe,se,re,ae,le,ce,he,de,_e,ue,ge,me,pe,Ce,fe,ve,be,we,Pe,ye,Me,Ie,Oe,Ee,De,Se,Ae;return{setters:[function(e){n=e._,i=e.i,o=e.b,s=e.c,r=e.d,a=e.e,l=e.m,c=e.B,h=e.f,d=e.g,_=e.h,u=e.k,g=e.j,m=e.C,p=e.l,C=e.n,f=e.S,v=e.M,b=e.W,w=e.o,P=e.F,y=e.p,M=e.N,I=e.P,O=e.E,E=e.q,D=e.v,S=e.r,A=e.s,x=e.t,k=e.u,H=e.w,j=e.x,R=e.y,L=e.z,V=e.G,B=e.H,T=e.J,F=e.K,G=e.O,K=e.Q,U=e.T,W=e.U,N=e.V,q=e.X,z=e.A,Z=e.Y,Q=e.Z,J=e.$,X=e.a0,Y=e.a1},function(e){$=e.R,ee=e.b,te=e.S,ne=e.P,ie=e.c,oe=e.B,se=e.D,re=e.C,ae=e.F,le=e.T},function(e){ce=e.z,he=e.B,de=e.O,_e=e.ad,ue=e.K,ge=e.aE,me=e.a,pe=e.bz,Ce=e.bA,fe=e.V,ve=e.Q,be=e.bx,we=e.aC,Pe=e.bB,ye=e.bC,Me=e.bD,Ie=e.aF,Oe=e.ag,Ee=e.bE,De=e.aD,Se=e.bF},function(e){Ae=e.D}],execute:function(){class xe{constructor(e){this._mergeThreshold=3,this._componentsToMerge=new ke,this._mergeInProgress=!1,this._components=new Map,this._previews=new Map,this._componentNumberOfPossibleChildren=new Map,this._creator_=e,this._getKernelAccess().addConfiguratorListener(this),this._componentFactory=$()}get materialQueue(){return this.getMeshGenerator().materialQueue}_getKernelAccess(){return o.lookup("planner-kernel-access",this._creator_)}_applyMeshTransform(e,t,n,i,o,r,a){if(i){const e=t.userData.transform=s(i);n&&(t.userData.transform=e),t.applyMatrix4(e)}this._applyMeshUVTransform(t,n,o,a),this._addMeshAnimations(e,t,r)}_applyMeshUVTransform(e,t,n,i){if(6!==(null==n?void 0:n.length)||r(n))t&&(t.uvTransform=void 0),i&&(e.geometry=i);else{const o=a(n);t&&(t.uvTransform=o);const s=null!=i?i:e.geometry;if(s&&s.attributes.uv){const t=s.clone();t.attributes.uv.applyMatrix4(o),e.geometry=t}}}_addMeshAnimations(e,t,n){n||(t.userData.animations=void 0);const i=new Map;for(const e in n)i.set(e,s(n[e]));t.userData.animationMatrixMap=i,this._setComponentAnimationMatrix(e,t)}_setComponentAnimationMatrix(e,t){var n,i;if((null===(n=t.userData)||void 0===n?void 0:n.animationMatrixMap)&&(null===(i=t.userData)||void 0===i?void 0:i.transform)&&this.getComponent(e).animations)for(const e in t.userData.animationMatrixMap){const n=t.userData.animationMatrixMap.get(e);if(n){const e=t.userData.transform.clone().multiply(n);t.applyMatrix4(e)}}}_animateComponent(e,t,n,i,o){const s=t.split(":")[1];e.animateMeshes&&e.animateMeshes(s,n,i,o,this._invalidateRenderCallback)}updateAnimationParameters(e,t){const n=[];for(const e of t)e.key.startsWith("animation:")&&n.push(e);if(0===n.length)return;const i=Array.isArray(e)?e:[e];for(const e of i){const t=this.getComponentFromElementId(e);if(null==t?void 0:t.animationValues)for(const e of n){const n=e.key.split(":")[1],i=t.animationValues.get(n);i&&(e.value=i)}else if(t){t.animationValues=new Map;for(const e of n){const n=e.key.split(":")[1];t.animationValues.set(n,e.value)}}}}changeAnimationValue(e,t,n,i,o){const s=this.getComponentFromElementId(e);s&&(i?s.traverse(e=>{e.id&&this._changeAnimationValue(e,t,n,o)}):this._changeAnimationValue(s,t,n,o))}_changeAnimationValue(e,t,n,i){e.animationValues||(e.animationValues=new Map);const o=t.split(":")[1],s=e.animationValues.get(o);e.animationValues.set(o,n),this._animateComponent(e,t,s,n,i)}getComponentFromElementId(e){let t=this.getComponent(e);if(!t){const n=this._getKernelAccess().kernelInstance.getRootPlanComponentIdFromObjectId(e);t=this.getComponent(n)}return t||console.warn("component not found!",e),t}_addMeshToSubPart(e,t,n,i,o,s,r,a,l,c,h){const d=this._generateMesh(e,t,n,s,r,a,l,void 0,void 0,c);this._applyMeshTransform(e,d,null,i,o,h),this._subPartObject.add(d)}_addMeshToComponent(e,t,n,i,o,s,r,a,l,c,h,d,_){if(this._subPartGuard&&this._subPartGuard.info===e)return void this._addMeshToSubPart(e,null,i,null,null,r,a,l,c,d,_);const u=this.getComponent(e);if(!u)return;const g=this._componentFactory.isPreview(u),m=this._generateMesh(e,n,g?null:i,r,a,l,c,void 0,void 0,d);m.userData.meshId=t,m.userData.geometryId=n,m.userData.materialId=i,this._applyMeshTransform(e,m,m.userData,o,s,_),g&&m.layers.set(5),u&&u.addMesh(m),u.meshes.length>this._mergeThreshold&&this._componentsToMerge.set(e,u.meshes.length)}_changeMeshOfComponent(e,t,n,i,o,s,r,a){const l=this.getComponent(e);if(!l)return;const c=l.getMeshById(t);if(c){c.userData.geometryId!==n&&console.warn("Geometry of mesh has changed!"),c.userData.materialId=i,c.userData.materialAttributes=r;const t=c.material.clone();this._configuratorMeshGenerator.setMaterial(c,i,void 0,r).then(()=>{this._requestRenderSceneUpdateCallback&&this._requestRenderSceneUpdateCallback()}),t.opacity!==c.material.opacity&&this._requestRenderCallback&&this._requestRenderCallback(),o&&(c.position.set(0,0,0),c.scale.set(1,1,1),c.rotation.set(0,0,0));const l=this._configuratorMeshGenerator.getGeometry(n);this._applyMeshTransform(e,c,c.userData,o,s,a,l)}}_removeMeshFromComponent(e,t){const n=this.getComponent(e);n&&n.removeMeshById(t)}getComponent(e){let t=this._components.get(e);return t||(t=this._previews.get(e.toString()),t)?t:null}getNumberOfPossibleChildrenForComponent(e){if(this._componentNumberOfPossibleChildren.has(e))return this._componentNumberOfPossibleChildren.get(e);const t=this._getKernelAccess().kernelInstance.getPlanComponentPossibleChildren(e).length;return this._componentNumberOfPossibleChildren.set(e,t),t}tryToMergeComponents(){this._initData.moc||this._mergeInProgress||(this._mergeInProgress=!0,this._componentsToMerge.size,this._requestMergeComponents())}_requestMergeComponents(){window.requestIdleCallback(this._mergeNextComponent.bind(this))}_mergeNextComponent(){if(this._componentsToMerge.size>0){const e=this._componentsToMerge.largestValue();this._componentsToMerge.delete(e),this._mergeComponent(e),this._requestMergeComponents()}else this._mergeInProgress=!1,this._geometriesMerged&&this._geometriesMerged(),this._components.forEach(e=>{e.loadingMesh&&console.warn("component still has loading mesh: ",e.hash)})}_mergeComponent(e){const t=this._components.get(e);if(t&&!(t.meshes.length<=this._mergeThreshold))if(this._cacheHolder.componentCache.has(t.hash)){const e=this._cacheHolder.componentCache.get(t.hash).meshes;t.replaceMeshes(e)}else{const e=new Map,n=[],i=[];t.meshes.forEach(t=>{const o=t.userData.materialId;if(!o)return void console.warn("mesh has no material id set");if(!e.has(o)){const i=new ce(new he,t.material);i.userData.materialId=o,i.receiveShadow=!0,i.castShadow=!0,i.layers.set(3),this._setMaterial(i,o),n.push(i),e.set(o,i)}const s=e.get(o),r=s.geometry;t.userData.transform&&t.geometry.applyMatrix4(t.userData.transform),s.geometry=l([r,t.geometry]),i.push(t)}),n.forEach(e=>t.addMesh(e)),i.forEach(e=>t.removeMesh(e)),this._cacheHolder.componentCache.set(t.hash,t)}}_addComponent(e){this._listener&&e.isRootComponent&&this._listener.display(e)}removeDockingComponent(){this._getKernelAccess().requestDeleteComponent(this._configuratorContext.dockingRootComponentId),this._configuratorContext.dockingRootComponentId=null}dockComponent(e,t,n,i,o){let s=this._components.get(n),r=this._components.get(e);r&&(r.roomlePosition=i,r.roomleRotation=o,s&&s.add(r),r.parentObjectId=n,r.isRootComponent=t,this._addComponent(r))}dockComponentWithPosition(e,t){let n,i=this._components.get(e.parentId);n=t?t.getKernelPosition(i):e.getKernelPosition(i),c.start("dock_component_with_position_"+e.childId),this._getKernelAccess().dockComponentWithPosition(e.parentId,e.parentDockId,e.childId,e.childDockId,n),this._configuratorContext.dockingRootComponentId=null}removePreviews(){this._previews.size>0&&(this._previews.forEach(e=>{e.removeFromParent(),e.removeAllMeshes()}),this._previews.clear())}_updatePlanObject(e,t){const n=this._components.get(e.rootPlanComponentId);let i=!0;n&&(i=n.geometryChanged),this._listener&&this._listener.planObjectUpdated(e,i,t)}Editor3dAddDockPreview(e,t){const n=this._componentFactory.createPreview(t,e,this._creator_);this._previews.set(t.toString(),n)}Editor3dAddMesh(e,t,n,i,o,s){this._addMeshToComponent(e,t,n,o.materialId,o.transform,o.uvTransform,s.vertices,s.indices,s.uvCoords,s.normals,i,o.materialAttributes,o.animations)}Editor3ChangedMesh(e,t,n,i){this._changeMeshOfComponent(e,t,n,i.materialId,i.transform,i.uvTransform,i.materialAttributes,i.animations)}Editor3dRemoveMesh(e,t){this._removeMeshFromComponent(e,t)}Editor3dBeginConstruction(e,t){if(!t){const t=this._components.get(e);t&&t.removeAllMeshes()}this._subPartGuard&&e===this._subPartGuard.info&&(this._subPartObject=new de)}Editor3dComponentCreated(e,t,n,i,o){i&&(this._configuratorContext.rootComponentId=e);let s=null;this._components.has(e)?(s=this._components.get(e),s.removeAllMeshes()):(s=this._componentFactory.create(e,t,n,o,i),s.layers.set(3)),this._components.set(e,s),this._addComponent(s)}Editor3dComponentDocked(e,t,n,i,o){this.dockComponent(e,t,n,i,o)}Editor3dEndConstruction(e){if(this._subPartGuard&&this._subPartGuard.info===e)return void this._subPartGuard.resolve(this._subPartObject);const t=this._getKernelAccess().kernelInstance.getComponent(e),n=this._components.get(e);n&&(n.computeBoundingBox(t.boxForMeasurement),n.boundingBoxMesh&&this._listener&&this._listener.addComponentHandlers(n));let i=this._previews.get(e.toString());i&&i.computeBoundingBox(t.boxForMeasurement,!0)}Editor3dGeometryReady(e){const t=this._components.get(e);t&&t.loadingFinished()}Editor3dGeometryNotReady(e){const t=this._components.get(e);t&&t.loading()}Editor3dPlanObjectConstructionDone(e){const t=this._getKernelAccess().kernelInstance.getPlanObject(e),n=[t,this._getKernelAccess().kernelInstance.getFullPartList(),this._getKernelAccess().kernelInstance.getHashOfConfiguration(e),this._getKernelAccess().kernelInstance.getComponentId(t.rootPlanComponentId)];h.finishOperation(2,n),this._updatePlanObject(t,!1),this._listener&&this._listener.planObjectConstructionDone(t)}Editor3dPreviewConstructionDone(e,t){let n=!1;this._previews.forEach(e=>{null!==e.parent&&(this._listener&&(this._componentFactory.isPreviewLine(e)?this._listener.addPreviewLineHandlers(e):this._listener.addPreviewHandlers(e)),n=!0)}),this._listener&&this._listener.previewConstructionDone(this._components.get(e),n)}Editor3dSetPreviewLineAssociations(e,t){let n=this._previews.get(t.toString());if(n.clear(),!n)return;let i=this._componentFactory.createPreviewLine(n,this._creator_),o=this._components.get(this._configuratorContext.rootComponentId);for(let t=0;t<e.length;t++){let n;n=0===t?i:i.clonePreviewLine(t),n.name="Preview Line",n.parentDockId=e[t].parentDockId,n.parentId=e[t].parentId,n.childDockId=e[t].childDockId,n.childId=e[t].childId,n.docklineRotation=d(e[t].rotation),n.roomlePosition=e[t].position,n.roomleLineFrom=e[t].lineFrom,n.roomleLineTo=e[t].lineTo,n.lineSegments=[];for(const i of e[t].lineSegments)n.lineSegments.push({from:i.from/1e3,to:i.to/1e3});n.roomlePositionFrom=e[t].positionFrom,n.roomlePositionTo=e[t].positionTo,o.add(n),n.preparePreview(),this._previews.set(n.stringId,n)}}Editor3dSetPreviewPointAssociations(e,t){let n=this._previews.get(t.toString());if(!n)return;let i=this._components.get(this._configuratorContext.rootComponentId);for(let t=0;t<e.length;t++){let o;0===t?o=n:(o=n.clonePreview(t),this._previews.set(o.stringId,o)),o.name="Preview Point",o.parentDockId=e[t].parentDockId,o.parentId=e[t].parentId,o.childDockId=e[t].childDockId,o.childId=e[t].childId,o.preparePreview(),o.receivedPointAssociation=!0,o.userData.ignoreComponentRaycast=!0,i.add(o);let s=e[t].position;o.roomlePosition=s,o.roomleRotation=e[t].rotation,o.startPulsating()}}componentDeleted(e){const t=this._components.get(e);t&&(this._listener&&this._listener.componentDeleted(t),t.removeFromParent(),t.removeAllMeshes(),this._components.delete(e))}componentMetaUpdated(e){const t=this._getRuntimeComponent(e.id);t&&(t.hash=e.hash,t.roomlePosition=e.position,t.roomleRotation=e.rotation,e.boxForMeasurement&&t.computeBoundingBox(e.boxForMeasurement),this._listener&&this._listener.componentUpdated(t,e))}componentConfigurationUpdated(e,t){const n=this._getRuntimeComponent(e);n&&(n.geometryChanged=t)}_getRuntimeComponent(e){let t=this._components.get(e);return t||(t=this._previews.get(e.toString()),t)?t:null}configurationLoaded(e,t,n,i,o){e===_&&(this._configuratorContext.dockingRootComponentId=n);let s=0===t;s?this._getKernelAccess().kernelInstance.requestPlanComponentConstructionRecursive(n):this._getKernelAccess().kernelInstance.requestPlanObjectConstruction(t);let r=this._getKernelAccess().kernelInstance.getComponent(n),a=this._components.get(n);a&&(a.computeBoundingBox(r.boxForMeasurement),a.hash=r.hash),this._listener&&this._listener.configurationLoaded(a,s&&void 0!==a.boundingBoxMesh)}finishParameterChange(e,t){this.materialQueue.registerCallback(e)}planObjectConfigurationUpdated(e,t,n,i){let o=this._getKernelAccess().kernelInstance.getPlanObject(e);this._updatePlanObject(o,i)}planObjectCreated(e,t){this._configuratorContext.planObjectId=t,this._listener&&this._listener.clearScene()}planObjectUpdated(e,t){this._updatePlanObject(e,t)}sceneCleared(){this._components.forEach((function(e){e.removeFromParent(),e.removeAllMeshes()})),this._components.clear(),this._componentNumberOfPossibleChildren.clear(),this._previews.forEach(e=>{e.removeFromParent(),e.removeAllMeshes()}),this._previews.clear()}setListener(e){this._listener=e}getBoundingBox(){if(this._configuratorContext.planObjectId){const e=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);if(e&&e.boxForMeasurement)return u(e.boxForMeasurement)}else if(this._configuratorContext.rootComponentId){const e=this._components.get(this._configuratorContext.rootComponentId);return(new _e).setFromObject(e)}return null}getBoundingBoxOfGeometry(){if(this._configuratorContext.planObjectId){const e=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);if(e&&e.boxOfGeometry)return u(e.boxOfGeometry)}else if(this._configuratorContext.rootComponentId){const e=this._components.get(this._configuratorContext.rootComponentId);return(new _e).setFromObject(e)}return null}getBoundingBoxWithPreviews(){const e=this._components.get(this._configuratorContext.rootComponentId);return e?(new _e).setFromObject(e):null}hasPreviews(){return this._previews.size>0}clearRootComponent(){var e;null===(e=this._components.get(this._configuratorContext.rootComponentId))||void 0===e||e.hoverOff()}debugSceneGraph(e){e?this._components.has(e)?this._components.get(e):this._previews.has(e.toString())&&this._previews.get(e.toString()):this._configuratorContext}getComponentsForIds(e){let t=[];return e.forEach(e=>{const n=this._components.get(e);n&&t.push(n)}),t}getComponents(){return Array.from(this._components.values())}getPreviews(){return Array.from(this._previews.values())}hasPreviewLines(){for(const e of this._previews.values())if(this._componentFactory.isPreviewLine(e))return!0;return!1}isPreviewLine(e){return this._componentFactory.isPreviewLine(e)}isPreview(e){return this._componentFactory.isPreview(e)}setGeometriesMergedListener(e){this._geometriesMerged=e}removeGeometriesMergedListener(){this._geometriesMerged=void 0}setMergeThreshold(e){this._mergeThreshold=e}_generateMesh(e=0,t=null,n,i,o,s,r,a,l,c){return this._configuratorMeshGenerator.generateMesh(e,t,n,i,o,s,r,!1,c)}_setMaterial(e,t,n){this._configuratorMeshGenerator.setMaterial(e,t)}constructComponents(e){this._getKernelAccess().kernelInstance.requestPlanObjectConstruction(e)}requestSubPartConstruction(e){return this._subPartGuard=new g(e),this._getKernelAccess().requestPlanComponentConstruction(e,!1),this._subPartGuard.wait()}getMeshGenerator(){return this._configuratorMeshGenerator}setRequestRenderCallback(e){this._requestRenderCallback=e}setRequestRenderSceneUpdateCallback(e){this._requestRenderSceneUpdateCallback=e}setInvalidateRenderCallback(e){this._invalidateRenderCallback=e}}e("a",xe),n([i],xe.prototype,"_configuratorMeshGenerator",void 0),n([i],xe.prototype,"_configuratorContext",void 0),n([i],xe.prototype,"_cacheHolder",void 0),n([i],xe.prototype,"_initData",void 0);class ke extends Map{largestValue(){let e=this.entries().next().value[0],t=0;return this.forEach((n,i)=>{n>t&&(e=i,t=n)}),e}}class He extends xe{constructor(e){super(e),this._configurablePlanObjectViewModels=[],this._configurableConstructionPlanObjectViewModels=[],this._staticPlanObjectViewModels=[],this._constructionPlanObjectViewModels=[],this._wallPlanObjectViewModels=[],this._measurementLinePlanObjectViewModels=[],this._wallAtticsPlanObjectViewModels=[],this._floorPlanObjectViewModels=[],this._nodePlanObjectViewModels=[],this._constructionGroup=new ue,this._constructionGroup.name="Construction",this._ceilingGroup=new ue,this._ceilingGroup.name="Ceiling",this._floorGroup=new ue,this._floorGroup.name="Floor",this._measurementLineGroup=new ue,this._measurementLineGroup.name="Measurement Line",this._wallAtticsGroup=new ue,this._wallAtticsGroup.name="Wall Attics",this._getKernelAccess().addPlannerListener(this)}get latestWallPlanObjectViewModel(){return this._latestWallPlanObjectViewModel}get latestNodePlanObjectViewModel(){return this._latestNodePlanObjectViewModel}startedDrawing(){}stoppedDrawing(){}planBoundsChanged(){}setReference(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null}getCorePlan(){return this._coreReference}addPlanElementViewModel(e){e instanceof m?this._handleConfiguratorConstructionPlanObjectViewModel(e):e instanceof p?this._handleConfiguratorPlanObjectViewModel(e):e instanceof C?this._handleConstructionPlanObjectViewModel(e):e instanceof f?this._handleStaticPlanObjectViewModel(e):e instanceof v?this._handleMeasurementLinePlanElementViewModel(e):e instanceof b?this._handleWallAtticPlanElementViewModel(e):e instanceof w?this._handleWallPlanElementViewModel(e):e instanceof P?this._handleFloorPlanElementViewModel(e):e instanceof y?this._handleCeilingPlanElementViewModel(e):e instanceof M&&this._handleNodePlanElementViewModel(e)}_handleConfiguratorPlanObjectViewModel(e){this._configurablePlanObjectViewModels.push(e),this._linkPlanObjectViewModelAndComponent(e)}_linkPlanObjectViewModelAndComponent(e){const t=e.getConfigurationRuntimeId();if(t>0)for(const e of this._components.values())if(e.parentObjectId===t||e.runtimeId===t){this._addComponent(e);break}}_detachPlanObjectViewModelFromComponent(e){const t=e.getConfigurationRuntimeId();if(t>0)for(const e of this._components.values())if(e.parentObjectId===t||e.runtimeId===t){e.isChildPlanObject=!1;break}}_handleConfiguratorConstructionPlanObjectViewModel(e){e.setTopView(this._cameraType===ge.CAMERA_2D),this._configurableConstructionPlanObjectViewModels.push(e)}_handleConstructionPlanObjectViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addConstructionPlanObjectHandlers(e),e.setTopView(this._cameraType===ge.CAMERA_2D),this._constructionPlanObjectViewModels.push(e)}_handleStaticPlanObjectViewModel(e){this._staticPlanObjectViewModels.push(e),this.commonHandlerForEditableAndTopView(e)}_handleMeasurementLinePlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addMeasurementLineHandlers(e),e.setTopView(this._cameraType===ge.CAMERA_2D),e.getPoint1Draggable().scale.setScalar(this._nodeZoom),e.getPoint2Draggable().scale.setScalar(this._nodeZoom),this._measurementLinePlanObjectViewModels.push(e),this._measurementLineGroup.add(e.getContainer())}_handleWallAtticPlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addWallAtticHandlers(e),e.setTopView(this._cameraType===ge.CAMERA_2D),this._wallAtticsPlanObjectViewModels.push(e),this._wallAtticsGroup.add(e.getContainer())}_handleWallPlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addWallHandlers(e),e.setTopView(this._cameraType===ge.CAMERA_2D),this._wallPlanObjectViewModels.push(e),this._latestWallPlanObjectViewModel=e,this._constructionGroup.add(e.getContainer())}_handleFloorPlanElementViewModel(e){const t=e.getContainer();t.name="Floor",this._initData.edit&&this._plannerSceneEventHandler.addFloorHandlers(e),this._floorPlanObjectViewModels.push(e),this._floorGroup.add(t)}_handleCeilingPlanElementViewModel(e){this._ceilingGroup.add(e.getContainer())}_handleNodePlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addNodeHandlers(e),e.setTopView(this._cameraType===ge.CAMERA_2D),e.setZoom(this._nodeZoom),this._nodePlanObjectViewModels.push(e),this._latestNodePlanObjectViewModel=e,this._constructionGroup.add(e.getContainer())}commonHandlerForEditableAndTopView(e){this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(e),e.setTopView(this._cameraType===ge.CAMERA_2D)}dockComponent(e,t,n,i,o){var s;null===(s=this._plannerSceneEventHandler)||void 0===s||s.cancelSelection("dock_component"),super.dockComponent(e,t,n,i,o)}_addComponent(e){const t=e.isRootComponent?e.parentObjectId:e.runtimeId,n=this._getPlanObjectViewModelForRuntimeId(t);n&&n instanceof p&&(e.isRootComponent?n.addRootComponent(e):n.addChildEntityComponent(e),this._initData.edit&&(n instanceof m?this._plannerSceneEventHandler.addConstructionPlanObjectHandlers(n):this._plannerSceneEventHandler.addPlanObjectHandlers(n)),n.hidePreviewBox())}_getPlanObjectViewModelForRuntimeId(e){let t=null;return[...this._configurableConstructionPlanObjectViewModels,...this._configurablePlanObjectViewModels].forEach(n=>{e===n.getConfigurationRuntimeId()&&(t=n)}),t}getConfigurablePlanObjectForId(e){for(const t of[...this._configurableConstructionPlanObjectViewModels,...this._configurablePlanObjectViewModels])if(e===t.getId())return t;return null}getStaticPlanObjectForId(e){for(const t of this._staticPlanObjectViewModels)if(e===t.getId())return t;return null}getConstructionObjectForId(e){for(const t of this._constructionPlanObjectViewModels)if(e===t.getId())return t;return null}getStaticPlanObjectViewModelForId(e){return this.getStaticPlanObjectForId(e)||this.getConstructionObjectForId(e)}getPlanObjectForId(e){const t=this.getConfigurablePlanObjectForId(e);if(t)return t;const n=this.getStaticPlanObjectForId(e);if(n)return n;for(const t of this._nodePlanObjectViewModels)if(e===t.getId())return t;for(const t of this._wallPlanObjectViewModels)if(e===t.getId())return t;for(const t of this._measurementLinePlanObjectViewModels)if(e===t.getId())return t;for(const t of this._floorPlanObjectViewModels)if(e===t.getId())return t;for(const t of this._constructionPlanObjectViewModels)if(e===t.getId())return t;return null}getPlanObjectViewModelsFromRapiId(){return[...this._configurablePlanObjectViewModels,...this._configurableConstructionPlanObjectViewModels,...this._staticPlanObjectViewModels]}getPlanObjectCount(){return this._configurablePlanObjectViewModels.length+this._configurableConstructionPlanObjectViewModels.length+this._staticPlanObjectViewModels.length}getConstructionGroup(){return this._constructionGroup}getCeilingGroup(){return this._ceilingGroup}getFloorGroup(){return this._floorGroup}getMeasurementLineGroup(){return this._measurementLineGroup}getWallAtticsGroup(){return this._wallAtticsGroup}getBoundingBox(){if("configurator"===this._configuratorContext.baseContext){const e=this.getPlanObjectForId(this._configuratorContext.planElementId);if(e)return e.getBounds()}if("glb-viewer"===this._configuratorContext.baseContext){const e=this._plannerSceneEventHandler.getSelectedIds();if(e&&1===e.length){const t=this.getPlanObjectForId(e[0]);if(t)return t.getBounds()}}const e=this.getCorePlan();if(e)try{return u(e.getBounds())}catch(e){console.error(e)}const t=new _e;t.expandByObject(this._constructionGroup);for(const e of this._staticPlanObjectViewModels)t.expandByObject(e.getContainer());for(const e of this._configurablePlanObjectViewModels)t.expandByObject(e.getContainer());for(const e of this._configurableConstructionPlanObjectViewModels)t.expandByObject(e.getContainer());return t}getBoundingBoxOfGeometry(){return this.getBoundingBox()}setPlannerSceneEventHandler(e){this._plannerSceneEventHandler=e}getStaticPlanObjectViewModels(){return this._staticPlanObjectViewModels}getConfigurablePlanObjectViewModels(){return this._configurablePlanObjectViewModels}getConfigurableConstructionPlanObjectViewModels(){return this._configurableConstructionPlanObjectViewModels}getConstructionPlanObjectViewModels(){return this._constructionPlanObjectViewModels}getWallPlanObjectViewModels(){return this._wallPlanObjectViewModels}getNodePlanObjectViewModels(){return this._nodePlanObjectViewModels}getFloorPlanObjectViewModels(){return this._floorPlanObjectViewModels}getMeasurementLineObjectViewModels(){return this._measurementLinePlanObjectViewModels}getWallAtticsObjectViewModels(){return this._wallAtticsPlanObjectViewModels}_generateMesh(e=0,t=null,n,i,o,s,r,a,l,c){return this._plannerMeshGenerator.generateMesh(e,t,n,i,o,s,r,a,l,c)}_setMaterial(e,t,n,i){this._plannerMeshGenerator.setMaterial(e,t,n,i)}Editor3dComponentCreated(e,t,n,i,o){super.Editor3dComponentCreated(e,t,n,i,o),this._getKernelAccess()instanceof I&&this.dockComponent(e,i,o,t,n)}addPlanObjectToScene(e){}handlerSwitchedPlans(e,t){this._constructionGroup.clear(),this._ceilingGroup.clear(),this._floorGroup.clear(),this._measurementLineGroup.clear(),this._wallAtticsGroup.clear()}planCompletelyLoaded(e){}beginPlanConstruction(e){}addPlanMesh(e,t,n,i,o,s,r){}endPlanConstruction(e){}planElementChanged(e,t){}planObjectConfigurationLoaded(e,t,n){const i=this.getConfigurablePlanObjectForId(t.getId());if(!i)return void console.warn("planObjectConfigurationLoaded but no view model found");n?i.finishConstruction():i.failConstruction();const o=t.extRef.jsObject;o instanceof p&&this._linkPlanObjectViewModelAndComponent(o)}addMesh(e,t,n,i,o,s){const r=e.extRef.jsObject;let a=r.getMesh(t);a?a.geometry=this._plannerMeshGenerator.generateGeometry(null,n,i,o,s):(a=this._generateMesh(0,null,t,n,i,o,s,e.getType()),r.addMesh(a))}removePlanObjectFromScene(e){const t=e.getPlanElement().getType();this._isConstructionType(t)?this._constructionGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.FLOOR?this._floorGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.CEILING?this._ceilingGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.MEASURE?this._measurementLineGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.ATTIC&&this._wallAtticsGroup.remove(e.getContainer()),e.clear()}_isConstructionType(e){return e===this._getKernelAccess().kernelContainer.PlanElementType.WALL||e===this._getKernelAccess().kernelContainer.PlanElementType.NODE}planElementRemoved(e){var t;const n=null===(t=e.extRef)||void 0===t?void 0:t.jsObject;n instanceof m?this._removeObject(this._configurableConstructionPlanObjectViewModels,n):n instanceof p?(this._detachPlanObjectViewModelFromComponent(n),this._removeObject(this._configurablePlanObjectViewModels,n)):n instanceof C?this._removeObject(this._constructionPlanObjectViewModels,n):n instanceof f?this._removeObject(this._staticPlanObjectViewModels,n):n instanceof P?this._removeObject(this._floorPlanObjectViewModels,n):n instanceof w?this._removeObject(this._wallPlanObjectViewModels,n):n instanceof M?this._removeObject(this._nodePlanObjectViewModels,n):n instanceof v?this._removeObject(this._measurementLinePlanObjectViewModels,n):n instanceof b&&this._removeObject(this._wallAtticsPlanObjectViewModels,n)}_removeObject(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}getMeshGenerator(){return this._plannerMeshGenerator}componentConfigurationUpdated(e,t){super.componentConfigurationUpdated(e,t)}hideAllExcept(e){this._ceilingGroup.visible=!1,this._floorGroup.visible=!1,this._measurementLineGroup.visible=!1,this._wallAtticsGroup.visible=!1,this._constructionGroup.visible=!1,this._staticPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._configurablePlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._configurableConstructionPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._constructionPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)})}showAll(){this._ceilingGroup.visible=this._cameraType===ge.CAMERA_FP,this._floorGroup.visible=!0,this._measurementLineGroup.visible=!0,this._wallAtticsGroup.visible=!0,this._constructionGroup.visible=!0,this._staticPlanObjectViewModels.forEach(e=>e.getContainer().visible=!0),this._configurablePlanObjectViewModels.forEach(e=>e.getContainer().visible=!0),this._configurableConstructionPlanObjectViewModels.forEach(e=>e.getContainer().visible=!0),this._constructionPlanObjectViewModels.forEach(e=>e.getContainer().visible=!0)}planHistoryStateChanged(){}setNodeVisibility(e){this._nodePlanObjectViewModels.forEach(t=>t.setTopView(e))}async setCameraType(e){this._cameraType=e;const t=[];this._wallPlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===ge.CAMERA_2D)),this._measurementLinePlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===ge.CAMERA_2D)),this._wallAtticsPlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===ge.CAMERA_2D)),this._nodePlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===ge.CAMERA_2D)),this._configurablePlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===ge.CAMERA_2D)),this._constructionPlanObjectViewModels.forEach(e=>t.push(e.setTopView(this._cameraType===ge.CAMERA_2D))),this._configurableConstructionPlanObjectViewModels.forEach(e=>t.push(e.setTopView(this._cameraType===ge.CAMERA_2D))),await Promise.all(t)}get cameraType(){return this._cameraType}setNodeZoom(e){e=Math.min(4,e),this._nodeZoom=e;for(const t of this._nodePlanObjectViewModels)t.setZoom(e);for(const t of this._measurementLinePlanObjectViewModels)t.getPoint1Draggable().scale.setScalar(e),t.getPoint2Draggable().scale.setScalar(e)}planCleared(){[this._configurablePlanObjectViewModels,this._configurableConstructionPlanObjectViewModels,this._staticPlanObjectViewModels,this._wallPlanObjectViewModels,this._measurementLinePlanObjectViewModels,this._nodePlanObjectViewModels,this._floorPlanObjectViewModels,this._constructionPlanObjectViewModels,this._wallAtticsPlanObjectViewModels].forEach(e=>{e.forEach(e=>e.remove()),e.length=0})}requestCatalogItem(e){}}e("P",He),n([i],He.prototype,"_plannerMeshGenerator",void 0),n([i],He.prototype,"_roomlePlannerUiCallback",void 0);const je=e("b",{RAYCASTER_FLOOR:.8,FLOOR:.9,WALL:.95,DEFAULT:1,CONSTRUCTION:1,COMPONENT:2,PREVIEW:3,PREVIEW_LINE:4}),Re=x(30);class Le extends O{constructor(e,t,n,i){super(),this._offset=new me(0,0,0),this._lastMoveCheck=0,this._onWallSnapping=!1,this._mode=void 0===i?1:i,this._object=e,this._camera=t,this._raycaster=new pe,this._raycaster.layers.disableAll(),this._inputManager=n,this._addInputListeners(n),this._planeBottom=new Ce(new me(0,1,0)),this._planeFront=new Ce(new me(0,0,1)),this._planeSide=new Ce(new me(1,0,0))}setLayers(e){this._raycaster.layers=e}getLayers(){return this._raycaster.layers}_addInputListeners(e){e.addEventListener(3,e=>{this._findCandidate(e.positionRelative)},this),e.addEventListener(5,e=>{this._findSelection(e.positionRelative)},this),e.addEventListener(12,e=>{this._findSelection(e.positionRelative,!0,e.type)},this),e.addEventListener(14,e=>{this._findSelection(e.positionRelative,!0,e.type)},this),e.addEventListener(6,e=>{Date.now()-this._lastMoveCheck>32&&(this._findHover(e.positionRelative,e.type),this._lastMoveCheck=Date.now())},this),e.addEventListener(0,e=>{this._onDragStart(e.positionRelative)},this),e.addEventListener(1,e=>{this._onDrag(e.positionRelative)},this),e.addEventListener(2,e=>{this._onDragEnd(e.positionRelative)},this),e.addEventListener(9,e=>{this._onRotate(e.positionRelative,e.rotation)},this),e.addEventListener(10,()=>{this._currentRotate=null},this)}_findCandidate(e){let t=this._intersection(e);t&&!t.object.userData.ignoreElementHit&&0===this._mode&&this._inputManager.onElementHit()}_findSelection(e,t=!1,n=0){let i=this._intersection(e);if(i){if(i){const e=t?"double_click":"select";i.object.dispatchEvent({type:e,attachment:{intersection:i,type:n}})}}else this.dispatchEvent(0)}_findHover(e,t){const n=this._intersection(e);!n&&this._currentHover?(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null):n&&(this._currentHover&&this._currentHover.id!==n.object.id&&(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null),this._currentHover?this._currentHover.dispatchEvent({type:"hover_move",attachment:{intersection:n,type:t}}):(this._currentHover=n.object,this._currentHover.dispatchEvent({type:"hover_on",attachment:{intersection:n,type:t}})))}_intersection(e){var t;if(0===e.x&&0===e.y)return null;const n=this._intersect(e);if(null===(t=window.__RML__DEBUG__)||void 0===t?void 0:t.raycaster){const e=[];for(const t of n)e.push({name:t.object.userData.planElementName,distance:t.distance,priority:t.object.userData.priority});e.length&&console.table(e)}if(n.length<=0)return null;let i=n[0];return n.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&n.forEach(e=>{e.object.id===this._currentHover.id&&e.object.userData.priority===this._currentHover.userData.priority&&i.object.userData.priority<=e.object.userData.priority&&(i=e)}),i}_intersect(e){this._raycaster.setFromCamera(new fe(e.x,e.y),this._camera);const t=[];return this._raycaster.intersectObjects(this._object.children,!0).forEach(e=>{const n=this._findObjectWithHandler(e.object);n&&(e.object=n,t.push(e))}),t.length>=0?t.sort((e,t)=>e.object.userData.priority!==t.object.userData.priority?t.object.userData.priority-e.object.userData.priority:E((new _e).setFromObject(e.object),(new _e).setFromObject(t.object))<0?-1:e.distance-t.distance):[]}_findObjectWithHandler(e){return e.userData.hasListener?e:e.parent?this._findObjectWithHandler(e.parent):null}_onDragStart(e){let t=this._intersection(e);if(!t&&!this._currentDrag)return;if(t&&t.object.userData.roomleId===this._rootComponentId)return;!this._currentDrag&&t&&(this._currentDrag=t.object,this._currentDrag.dispatchEvent({type:"drag_start"}));let n=this._currentDrag.parent;n&&n.computeBoundingBox&&(n.computeBoundingBox(),this._calculateOffset(n)),this._positionPlanes(n)}_onDrag(e){if(!this._currentDrag)return;this._raycaster.setFromCamera(new fe(e.x,e.y),this._camera);let t,n=new me(0,0,-5);if(this._raycaster.ray.intersectPlane(this._planeBottom,n),0===this._mode){const e=this._object.children.find(({type:e,name:t})=>"Group"===e&&"Construction"===t),i=this._currentDrag.userData.snapToWall;if(e&&(this._onWallSnapping||i)){const t=this._raycaster.intersectObjects(e.children,!0);if(t.length){const e=t[0].point.clone();return void this._currentDrag.dispatchEvent({type:"drag",attachment:{position:e}})}}t=n.clone(),t.y=this._currentDrag.parent.position.y}else t=this._getIntersectionPosition(n),t.sub(this._offset);this._currentDrag.dispatchEvent({type:"drag",attachment:{position:t}})}_getIntersectionPosition(e){let t=this._getDistanceToCamera(e),n=this._camera.userData.yaw,i=new me(0,0,0),o=new me(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,i),this._raycaster.ray.intersectPlane(this._planeSide,o);let s,r=this._getDistanceToCamera(o),a=this._getDistanceToCamera(i);return n>=-Re&&n<=Re?s=t<a?e.clone():i.clone():t<a&&t<r?s=e.clone():a<t&&a<r?s=i.clone():r<t&&r<a&&(s=o.clone()),s}_getDistanceToCamera(e){let t=e.clone().sub(this._camera.position).length();return D(e)&&(t=Number.POSITIVE_INFINITY),t}_onDragEnd(e){this._currentDrag&&(this._currentDrag.dispatchEvent({type:"drag_end",attachment:{position:e}}),this._currentDrag=null)}_onRotate(e,t){if(!this._currentRotate){let t=this._intersection(e);if(!t)return;this._currentRotate=t.object}this._currentRotate.dispatchEvent({type:"rotate",attachment:{rotation:t}})}_positionPlanes(e){0===this._mode?(this._planeBottom.constant=0,this._camera.userData&&this._camera.userData.pitch&&this._camera.userData.pitch<0&&(this._planeBottom.constant=-3)):e&&e.boundingBox&&this._rootComponentPosition&&(this._planeBottom.constant=-e.boundingBox.getCenter(new me).y-this._rootComponentPosition.y,this._planeSide.constant=2*-e.boundingBox.getSize(new me).x+e.boundingBox.getCenter(new me).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+e.boundingBox.getCenter(new me).z))}_calculateOffset(e){e&&e.boundingBox&&(this._offset.copy(e.boundingBox.getCenter(new me)),this._offset.applyQuaternion(e.getWorldQuaternion(new ve)))}update(e,t,n){if(e&&(this._bounds=e),t&&(this._rootComponentPosition=t),n){this._backgroundScene=n;let e=this._backgroundScene.children[0];e instanceof ce&&e.geometry.computeBoundingBox()}}clear(){this._currentDrag&&S(this._currentDrag),this._currentHover&&S(this._currentHover)}enableDragIn(e){this._currentDrag=e}setRootComponentId(e){this._rootComponentId=e}setCamera(e){this._camera=e}setObject(e){this._object=e}setMode(e){this._mode=e}intersectMouseOnScene(e){const t=new Ce,n=new me;return n.copy(this._camera.position).normalize(),t.setFromNormalAndCoplanarPoint(n,this._object.position),this._raycaster.setFromCamera(new fe(e.positionRelative.x,e.positionRelative.y),this._camera),A(this._raycaster.ray.intersectPlane(t,new me))}enableOnWallSnapping(){this._onWallSnapping=!0}disableOnWallSnapping(){this._onWallSnapping=!1}}class Ve extends O{constructor(e,t,n,i){super(),this._debug=!1,this._dragIn=!1,this._inputManager=i,this._raycastHelper=new Le(t,n,this._inputManager),this._creator_=e}isDragIn(){return this._dragIn}setDragIn(e,t){this._dragIn=e,e?this._inputManager.enableDragIn(t):this._raycastHelper.clear(),this._interaction()}}e("S",Ve);class Be{constructor(e){const{component:t,preview:n,resetCamera:i,consecutive:o,type:s,forceRender:r,reason:a}=e;this.component=t,this.preview=n,this.resetCamera=void 0===i||i,this.consecutive=void 0===o||o,this.type=s||0,this.forceRender=void 0!==r&&r,this.reason=a}}class Te extends Ve{constructor(e,t,n,i){super(e,t,n,i),this._cameraMoving=!1,this._raycastHelper.addEventListener(0,()=>{this._clickOutside()},this),this._selectionHandler.addEventListener(0,({component:e,consecutive:t})=>{this.dispatchEvent(8,new Be({component:e,consecutive:t})),this._inputManager.setDragEnabled(!0)},this),this._selectionHandler.addEventListener(1,({component:e,resetCamera:t,reason:n})=>{this._selectionHandler.hasSelection()||this._inputManager.setDragEnabled(!1),this.dispatchEvent(9,new Be({component:e,resetCamera:t,reason:n}))},this),this._addInputListeners(this._inputManager)}disable(){const e=new be;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}enable(){const e=new be;e.disableAll(),e.enable(4),e.enable(5),e.enable(7),e.enable(8),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}_addInputListeners(e){e.addEventListener(7,e=>this._interaction(),this),e.addEventListener(8,e=>this._interaction(),this)}addComponentHandlers(e){this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:je.DEFAULT,roomleId:e.runtimeId}),e.meshes.forEach(t=>{this._addComponentHandlers(e,t,{hasListener:!0,priority:je.COMPONENT,roomleId:e.runtimeId})})}addComponentDragInHandler(e){this._dragIn&&(this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:je.DEFAULT,roomleId:e.runtimeId}),this._raycastHelper.enableDragIn(e.boundingBoxMesh))}_addComponentHandlers(e,t,n){t.userData.hasListener||(Object.assign(t.userData,n),t.addEventListener("select",()=>this.clickComponent(e)),t.addEventListener("hover_on",t=>this._hoverOn(e,t.attachment.type)),t.addEventListener("hover_off",t=>this._hoverOff(e,t.attachment.type)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",()=>this._dragEnd(e)))}addPreviewHandlers(e){let t=e.boundingBoxMesh;t.userData.hasListener||(t.userData=we(t.userData,{hasListener:!0,priority:je.PREVIEW,roomleId:e.runtimeId}),t.addEventListener("select",()=>this._clickPreview(e)),t.addEventListener("hover_on",()=>this._hoverOnPreview(e)),t.addEventListener("hover_off",()=>this._hoverOffPreview(e)))}addPreviewLineHandlers(e){let t=e.boundingLineMesh;t.userData.hasListener||(t.userData=we(t.userData,{hasListener:!0,priority:je.PREVIEW_LINE,roomleId:e.runtimeId}),t.addEventListener("select",()=>this._clickPreviewLine(e)),t.addEventListener("hover_on",t=>this._hoverOnPreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_move",t=>this._hoverMovePreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_off",()=>this._hoverOffPreviewLine(e)))}_clickPreview(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new Be({preview:e}))}_clickPreviewLine(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new Be({preview:e}))}clickComponent(e,t=!0){this._debug&&e.runtimeId,this._selectionHandler.check(e),t&&this._configuratorUiCallbacks.onClickComponent(e)}_clickOutside(){this._selectionHandler.cancelSelection("click_outside"),this.dispatchEvent(3),this._interaction()}_hoverOn(e,t){this._cameraMoving||(this._debug&&e.runtimeId,e.hoverOn(),this._interaction(),this.dispatchEvent(1,new Be({component:e,type:t})),this._hoveredComponent=e)}_hoverOff(e,t){this._cameraMoving||(this._debug&&e.runtimeId,e.hoverOff(),this._interaction(),this.dispatchEvent(2,new Be({component:e,type:t})),this._hoveredComponent=null)}_hoverOnPreview(e){e.hoverOn(),this._interaction(!0),this._hoveredPreview=e}_hoverOffPreview(e){e.hoverOff(),this._interaction(!0),this._hoveredPreview=null}_hoverOnPreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._draggedComponent||e.hoverOn(),this._interaction(),this._hoveredPreview=e}_hoverMovePreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._hoveredPreview=e,this._interaction(!0)}_updatePositionForPreviewLine(e,t){let n=t.object.parent.parent.worldToLocal(t.point);this._previewLineIntersection=n,e&&(this._draggedComponent?this._draggedComponent.visible=!0:e.updatePreviewPosition(n))}_hoverOffPreviewLine(e){this._draggedComponent||e.hoverOff(),this._interaction(),this._hoveredPreview=null,this._previewLineIntersection=null}_setDragComponentShadow(e){var t;null===(t=this._draggedComponent)||void 0===t||t.traverse(t=>{if(t instanceof ce){const n=t;e&&void 0!==n.castShadowOld?(n.receiveShadow=n.receiveShadowOld,n.castShadow=n.castShadowOld):(n.receiveShadowOld=t.receiveShadow,n.castShadowOld=t.castShadow,n.receiveShadow=!1,n.castShadow=!1)}})}_dragStart(e){e&&(this._selectionHandler.isSelected(e)||this.isDragIn())&&(this._dragStartPosition=e.position.clone(),this._dragStartRotation=e.rotation.clone(),this._draggedComponent=e,this._setDragComponentShadow(!1),this.dispatchEvent(4,new Be({component:e})),this._interaction())}_drag(e,t){if(e&&(this._selectionHandler.isSelected(e)||this.isDragIn())){if(e&&!this._draggedComponent&&(this._draggedComponent=e),this._previewLineIntersection){let e=this._hoveredPreview,t=e.getPositionForIntersectionPoint(this._previewLineIntersection),n=e.parent.localToWorld(t);this._draggedComponent.position.copy(this._draggedComponent.parent.worldToLocal(n)),this._draggedComponent.rotation.copy(e.docklineRotation),e.hideSelectionLine()}else e.parent?e.position.copy(e.parent.worldToLocal(t)):e.position.copy(t);this._hoveredPreview?e.visible=!1:e.visible=!0,this.dispatchEvent(5,new Be({component:e})),this._interaction()}}_dragEnd(e){if(e&&(this._selectionHandler.isSelected(e)||this.isDragIn())){if(this._hoveredPreview&&this._previewLineIntersection){let t=this._hoveredPreview,n=t.getPositionForIntersectionPoint(this._previewLineIntersection),i=t.parent.localToWorld(n);e.position.copy(e.parent.worldToLocal(i)),e.rotation.copy(t.docklineRotation)}else this._dragStartPosition&&this._dragStartRotation&&(e.position.copy(this._dragStartPosition),e.rotation.copy(this._dragStartRotation),this._dragStartPosition=null,this._dragStartRotation=null,this.addComponentHandlers(e));e.visible=!0,this._setDragComponentShadow(!0),this._draggedComponent=null,this._previewLineIntersection=null,this.dispatchEvent(6,new Be({component:e,preview:this._hoveredPreview})),this._interaction()}}_interaction(e){this.dispatchEvent(0,new Be({forceRender:e}))}hasSelection(){return this._selectionHandler.hasSelection()}update(e,t,n){this._raycastHelper.update(e,t,n)}isDragIn(){return this._dragIn}isDragging(){return null!=this._draggedComponent}setRootComponentId(e){this._raycastHelper.setRootComponentId(e)}cancelSelection(e){return this._selectionHandler.setSelectionMode("standard"),this._selectionHandler.cancelSelection(e)}setSelectionMode(e){this._selectionHandler.setSelectionMode(e)}getSelectionMode(){return this._selectionHandler.getSelectionMode()}getSelectedRuntimeComponentIds(){return this._selectionHandler.getSelectedRuntimeComponentIds()}setCameraMoving(e){e&&this._hoveredComponent&&this._hoverOff(this._hoveredComponent,0),this._cameraMoving=e}setCamera(e){this._raycastHelper.setCamera(e)}setObject(e){this._raycastHelper.setObject(e)}}n([i],Te.prototype,"_selectionHandler",void 0),n([i],Te.prototype,"_configuratorUiCallbacks",void 0);class Fe extends O{constructor(e){super(),this._uiIntersectionMask=0,this.floorEnvironment=!1,this._camera=e}updateToBounds(e,t,n){let i=new me(-e.x/2,0,-e.z/2),o=new me(e.x/2,e.y,e.z/2);this._boundingBox=new _e(i,o),this._clientWidth=t,this._clientHeight=n;let s=this._boundingBox.getSize(new me);this._boxVertices=[],this._boxVertices.push(this._boundingBox.min),this._boxVertices.push(this._boundingBox.min.clone().add(new me(s.x,0,0))),this._boxVertices.push(this._boundingBox.max),this._boxVertices.push(this._boundingBox.max.clone().sub(new me(s.x,0,0)))}set canvasOffset(e){this._offset=e,this.calculateUIIntersection()}calculateUIIntersection(){let e=[];if(null==this._boundingBox||null==this._offset)return;let t=this._checkPaddings();t.bottom=this._clientHeight-t.bottom,t.right=this._clientWidth-t.right;let n=0;this.floorEnvironment?(e=["left","right","bottom"],n=11):(this._offset.left>0&&t.left<this._offset.left*this._clientWidth&&(e.push("left"),n|=8),this._offset.right<1&&t.right<(1-this._offset.right)*this._clientWidth&&(e.push("right"),n|=2),this._offset.bottom>0&&t.bottom<this._offset.bottom*this._clientHeight&&(e.push("bottom"),n|=1)),this._offset.top<1&&t.top<(1-this._offset.top)*this._clientHeight&&(e.push("top"),n|=4),n!==this._uiIntersectionMask&&(this.dispatchEvent(0,e),this._uiIntersectionMask=n)}_checkPaddings(){let e={left:this._clientWidth/2,top:this._clientHeight/2,right:this._clientWidth/2,bottom:this._clientHeight/2};return this._boxVertices.forEach(t=>{let n=k(t,this._camera,this._clientWidth,this._clientHeight);n.x<e.left&&(e.left=n.x),n.x>e.right&&(e.right=n.x),n.y<e.top&&(e.top=n.y),n.y>e.bottom&&(e.bottom=n.y)}),e}}class Ge extends ee{get cameraControl(){return this._cameraControl}resetCameraOnSceneClear(){this.cameraControl.clear()}async externalApiMoveCamera(e){await this.cameraControl.moveCamera(e),this._onCameraChanged()}externalApiZoomIn(e){this.cameraControl.zoomIn(e),this._onCameraChanged()}externalApiZoomOut(e){this.cameraControl.zoomOut(e),this._onCameraChanged()}externalApiResetCameraPosition(e){this.cameraControl.updateAndReset(e,!0),this._onCameraChanged()}disablePanningOnShiftRelease(){this.cameraControl.disablePanning()}enablePanningOnShiftClick(){this.cameraControl.enablePanning()}resetCameraToStartOnConfigurationLoaded(e){this.cameraControl.updateAndReset(e,!1)}updateBoundsOnPlanObjectUpdated(e){this.cameraControl.updateToBounds(e,!1,!1)}updateBoundsOnCancelDockings(e){this.cameraControl.updateToBounds(e,!1,!1)}async zoomToComponentOnConsecutiveClick(e){this.cameraControl.saveState(!1),await this.cameraControl.zoomTo(e),this._onCameraChanged()}resetCameraToStateOnCancelSelection(){this.cameraControl.hasSavedState()&&(this.cameraControl.resetToState(),this._onCameraChanged())}zoomToFitBoundsAfterUserInitiatedPreviews(e){this.cameraControl.zoomToFitBounds(e),this._onCameraChanged()}async resetCameraOnStartConfiguring(e,t,n=0){this.cameraControl.setCurrentCameraParameters(t),this.cameraControl.setObjectRotation(n),await this.cameraControl.updateAndReset(e,!0)}}e("c",Ge);class Ke extends te{constructor(e,t,n){super(e,t,H.HSC,n),this._configuratorContext.baseContext="configurator",this._getViewModel().setListener(this),this._sceneEventHandler=new Te(this._creator_,this._scene,this.cameraBehaviour3d.cameraControl.getCamera(),this._getInputManager()),this._sceneEventHandler.addEventListener(0,({forceRender:e})=>{this._uiIntersectionHelper.calculateUIIntersection(),e&&this._renderEverything()},this),this._sceneEventHandler.addEventListener(1,({component:e,type:t})=>this._onHoverOn(e,t),this),this._sceneEventHandler.addEventListener(2,({component:e,type:t})=>this._onHoverOff(e,t),this),this._sceneEventHandler.addEventListener(3,()=>{this._configuratorUiCallbacks.onClickOutside(),this.cameraBehaviour.cameraControl.unlock(),this._cancelDockings(!1,null,this._getViewModel().hasPreviews(),!0,!1),this.cancelComponentSelection(!0,"click_outside"),this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentVisibility(this._sceneEventHandler,this._getViewModel()),this._requestRender()},this),this._sceneEventHandler.addEventListener(8,({component:e,consecutive:t})=>{this._getViewModel().hasPreviews()&&this._cancelDockings(!1,null,this._getViewModel().hasPreviews(),!0,!1),this._selectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(9,({component:e,resetCamera:t,reason:n})=>{this._deselectComponent(e,t,n),this._requestRender()},this),this._sceneEventHandler.addEventListener(4,({component:e})=>{var t;"multiselect"===this._sceneEventHandler.getSelectionMode()&&this.cancelComponentSelection(!1,"dragIn"),this._requestDockingsPreviewWithDrag(e.runtimeId),this.cameraBehaviour.cameraControl.lock(),null===(t=this._roomleRenderer)||void 0===t||t.enableUiInteractionMode(),this._requestRender()},this),this._sceneEventHandler.addEventListener(5,()=>{this._renderEverything()},this),this._sceneEventHandler.addEventListener(6,({component:e,preview:t})=>{var n;if(t){let n=t;this._getViewModel().isPreviewLine(n)?this._getViewModel().dockComponentWithPosition(n,e):this._getViewModel().isPreview(n)?this._dockComponent(n):this._getKernelAccess().cancelDocking(e.runtimeId),this._cancelDockings(!t,e,!0,!0)}else{this._getKernelAccess().cancelDocking(e.runtimeId);let t=this._sceneEventHandler.isDragIn()?e:null;this._cancelDockings(this._sceneEventHandler.isDragIn(),t,!1,!0);const n=this._getViewModel().getBoundingBox();this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new me))}this.cameraBehaviour.cameraControl.unlock(),null===(n=this._roomleRenderer)||void 0===n||n.disableUiInteractionMode(),this._renderEverything()},this),this._sceneEventHandler.addEventListener(7,({preview:e})=>{this._getViewModel().isPreview(e)&&(this._getViewModel().isPreviewLine(e)?this._getViewModel().dockComponentWithPosition(e):this._dockComponent(e),this._cancelDockings(!1,null,!this._getViewModel().hasPreviews(),!1,!1),this.requestDockingsPreview(!1),this._requestRender())},this),j.isProduction||(window.__RML__DEBUG__.SceneManager=this),this.enableConfiguratorEvents(),this._initOptionalModules(),this._offsetAnimationStart=Pe(this._offsetAnimationStart.bind(this),250),this._offsetAnimationEnd=ye(this._offsetAnimationEnd.bind(this),32)}async _initOptionalModules(){const{transparentHighlighting:e}=this._initData;if(e){const{default:e}=await t.import("./component-raycast-helper-15d24684.nomodule.js");this._componentRaycastHelper=new e,this._componentRaycastHelper.init(this._scene,this.cameraBehaviour3d.cameraControl.getCamera())}}_changeCameraBehaviour(e){var t;super._changeCameraBehaviour(e),null===(t=this._componentRaycastHelper)||void 0===t||t.setCamera(this.cameraBehaviour3d.cameraControl.getCamera())}disableEvents(){this.disableConfiguratorEvents()}enableEvents(){"configurator"===this._configuratorContext.baseContext&&this.enableConfiguratorEvents()}enableConfiguratorEvents(){this._sceneEventHandler.enable()}disableConfiguratorEvents(){this._sceneEventHandler.disable()}_getViewModel(){return this._viewModel||(this._viewModel=o.lookup("configurator-view-model",this._creator_),this._viewModel.setRequestRenderCallback(()=>this._renderEverything()),this._viewModel.setRequestRenderSceneUpdateCallback(()=>{var e;return null===(e=this._roomleRenderer)||void 0===e?void 0:e.clearCache()}),this._viewModel.setInvalidateRenderCallback(()=>{var e;return null===(e=this._roomleRenderer)||void 0===e?void 0:e.forceShadowUpdates(!0)})),this._viewModel}_getKernelAccess(){return this._plannerKernelAccess}_showDockings(){var e,t,n;if(null===(e=this._roomleRenderer)||void 0===e||e.enableUiInteractionMode(),null===(n=null===(t=this._initData)||void 0===t?void 0:t.featureFlags)||void 0===n?void 0:n.pulsePreview){this._renderEverything();const e=setInterval(()=>this._renderEverything(),16);setTimeout(()=>clearInterval(e),(ne+1)*ie)}}cancelDockings(){this._cancelDockings(!0,null,!0,!0,!1),this._renderEverything()}_cancelDockings(e,t,n,i,o=!0){var s,r;null===(s=this._roomleRenderer)||void 0===s||s.disableUiInteractionMode(),e&&(this._sceneEventHandler.setDragIn(!1),this._getViewModel().removeDockingComponent(),t&&this._scene.remove(t)),this._getViewModel().removePreviews(),n&&o&&Me().then(()=>{var e;null===(e=this.configuratorCameraBehaviour)||void 0===e||e.updateBoundsOnCancelDockings(this.getBounds())}),i&&n&&this._configuratorUiCallbacks.onDockingsPreviewRemoved(),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null,!1,()=>{var e,t;null===(e=this._roomleRenderer)||void 0===e||e.forceShadowUpdates(!0),this._initData.transparentHighlighting&&(null===(t=this._roomleRenderer)||void 0===t||t.clearCache()),this._renderEverything()}),n&&(null===(r=this._roomleRenderer)||void 0===r||r.forceShadowUpdates(!0))}_onHoverOn(e,t){2!==t&&this._highlightComponent(e),this._componentDimensioningHelper&&this._componentDimensioningHelper.add(e)&&this._renderEverything()}_onHoverOff(e,t){2!==t&&this._highlightComponent(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&(this._componentDimensioningHelper.remove(e),this._renderEverything()),this._requestRender()}_highlightComponent(e=null,t=[]){var n;if(!this._shouldHighlightComponent())return;const i=[],o=this._initData.meshSelection;e?o?i.push(...e.meshes):e.boundingBoxMesh&&i.push(e.boundingBoxMesh):t&&t.length||(t=this._sceneEventHandler.getSelectedRuntimeComponentIds()),this._getViewModel().getComponentsForIds(t).forEach(e=>{e&&(o?i.push(...e.meshes):e.boundingBoxMesh&&i.push(e.boundingBoxMesh))}),null===(n=this._roomleRenderer)||void 0===n||n.highlightObjects(i)}shouldClearShadowsAndAO(){var e;return super.shouldClearShadowsAndAO()||!(null===(e=this._sceneEventHandler)||void 0===e?void 0:e.isDragging())}resume(){super.resume(),this._getViewModel().materialQueue.registerCallback(()=>this._materialLoaded()),this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._renderWithoutShadowsAndAO()})}_materialLoaded(){this._renderEverything()}async waitForMaterialQueue(){await this._getViewModel().materialQueue.finished()}pause(){super.pause(),this._getViewModel().materialQueue.unregisterCallback(),this._configuratorMeshGenerator.removeMaterialLoadedListener()}_setupScene(e,t,n){super._setupScene(e,t),this._uiIntersectionHelper=new Fe(this.cameraBehaviour3d.cameraControl.getCamera()),this._uiIntersectionHelper.canvasOffset=e,this._uiIntersectionHelper.addEventListener(0,e=>{this._configuratorUiCallbacks.onUiIntersectionChange(e)},this),this._configuratorMeshGenerator.maxAnisotropy=this._maxAnisotropy,this._configuratorMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._renderWithoutShadowsAndAO()}),this._domHelper.element.appendChild(this._renderer.domElement),n||!this._initData.legacyLight||this._initData.ls||this._initData.dls||(this._renderer.capabilities.maxTextures>8?this.loadDynamicLightSetting(R.createDynamicLightSettingSource(null,L.CAMERA)):this._lightSetting=new Ae(this._scene,this._lightSetting)),this._requestRender(),t||this._setEnvironment(new oe(this._scene,this._environment,Ie(this._initData.colors.DEFAULT_BACKGROUND))),this._getViewModel().materialQueue.registerCallback(()=>this._materialLoaded())}sceneCleared(e){this._internalClearScene(e)}display(e){this._scene.add(e),this.setRootComponentId(e.runtimeId),this._requestRender()}setRootComponentId(e){this._sceneEventHandler.setRootComponentId(e)}debugSceneGraph(e){this._getViewModel().debugSceneGraph(e),this._printObjectGraph(this._scene,"")}debugScene(){return this._scene}_printObjectGraph(e,t){e.material&&e.material.opacity,e.type,e.id,e.runtimeId,e.children.length>0&&e.children.forEach(e=>{let n=t+" ";this._printObjectGraph(e,n)})}clearScene(){var e,t;null===(e=this.configuratorCameraBehaviour)||void 0===e||e.resetCameraOnSceneClear(),this._internalClearScene(!1),null===(t=this._sceneEventHandler)||void 0===t||t.cancelSelection("reset_scene"),this._pluginSystem.clearScene(this._scene,this._uiScene)}planObjectConstructionDone(e){this._componentDimensioningHelper.reset(),this._componentDimensioningHelper.setCamera(this.cameraBehaviour3d.cameraControl.getCamera())}_internalClearScene(e){var t;this._scene.children.forEach(e=>{"Object3D"!==e.type&&"Mesh"!==e.type&&"Line"!==e.type||this._scene.remove(e)}),this._uiScene.children.forEach(e=>{this._uiScene.remove(e)}),this._getViewModel().sceneCleared(),null===(t=this._componentDimensioningHelper)||void 0===t||t.invalidateDimensioningsCache(),(e||this._memoryManager.shouldHardReset())&&(this._configuratorMeshGenerator.clear(),this._renderer.renderLists.dispose(),this._memoryManager.executedHardReset()),this._renderEverything()}async _waitForAssets(){await super._waitForAssets(),await this._externalMeshesAndMaterialsReady()}async preparePerspectiveImage(e={}){var t,n;await this._externalMeshesAndMaterialsReady();const{showDimensions:i=!1}=e;this._cancelDockings(!0,null,!0,!0);const o=this.cameraBehaviour3d.cameraControl.getCamera().clone();o.resetOffset();let s=this._calculateBoundingBoxOfAllMeshes(0,i);null===(t=this._lightSetting)||void 0===t||t.removeFromScene();const r=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();r&&this._dimensionHelper.disableDimensions();const a=this.cameraBehaviour3d.cameraControl.getObjectRotation();if(i){await this._initDimensions(),await this._dimensionHelper.isInitialized();const e=-30+U(a);V.placeCameraForPerspectiveImage(o,s,-20,e),this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(o.position),s=this._calculateBoundingBoxOfAllMeshes(0,i)}this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const l=await this._imageRenderer.preparePerspectiveImage(this._scene,this._uiScene,o,s,e,a);return r?(this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(this.cameraBehaviour3d.cameraControl.getCamera().position)):i&&this._dimensionHelper.disableDimensions(),null===(n=this._lightSetting)||void 0===n||n.addToScene(),this._renderEverything(),l}async renderImage(e){await this._externalMeshesAndMaterialsReady(),this._getViewModel().getPreviews()&&this._cancelDockings(!0,null,!0,!0);let t=this.cameraBehaviour3d.cameraControl.getCamera(),n=null;e.useCurrentPerspective||(t=this.cameraBehaviour3d.cameraControl.getCamera().clone(),t.resetOffset(),n=this._calculateBoundingBoxOfAllMeshes());const i=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();i&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const o=await this._imageRenderer.renderPerspectiveImage(this._scene,t,n);return i&&(this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(this.cameraBehaviour3d.cameraControl.getCamera().position)),this._renderEverything(),o}async preparePartImage(e,t){return new Promise((n,i)=>{this._getViewModel().requestSubPartConstruction(e).then(async e=>{t.size||(t.size=256);const i=this.cameraBehaviour3d.cameraControl.getCamera().clone();i.resetOffset();let o=V.getCameraTargetForBBox((new _e).setFromObject(e));const s=B(this._scene);s.add(e);const r=await this._imageRenderer.preparePerspectiveImage(s,null,i,o,t);T(s),n(r)},i)})}_calculateBoundingBoxOfAllMeshes(e=0,t){let n=null;return n=t&&this._dimensionHelper?this._dimensionHelper.getBoundingBox():this._getViewModel().getBoundingBox(),V.getCameraTargetForBBox(n,e)}async _externalMeshesAndMaterialsReady(){await this._getKernelAccess().externalMeshQueue.finished(!0),await this._getViewModel().materialQueue.finished(!0)}async prepareTopImage(e={}){var t,n;await this._externalMeshesAndMaterialsReady();const{showDimensions:i=!1}=e;this._cancelDockings(!0,null,!0,!0),i&&(await this._initDimensions(!0),await this._dimensionHelper.isInitialized(),this._dimensionHelper.enableTopDimensions()),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();let o=this._calculateBoundingBoxOfAllMeshes(.1,i);null===(t=this._lightSetting)||void 0===t||t.removeFromScene();let s=await this._imageRenderer.prepareTopImage(this._scene,this._uiScene,o,e);return i&&this._dimensionHelper.disableTopDimensions(),null===(n=this._lightSetting)||void 0===n||n.addToScene(),this._renderEverything(),s}enableDragIn(e){this._sceneEventHandler.setDragIn(!0,e),this._requestRender()}async _zoomToComponentOnConsecutiveClick(e){let t=e.boundingBox.getSize(new me),n=F(e),i=new Oe(0,n,0),o=e.getWorldPosition(new me).clone().add(e.boundingBox.getCenter(new me).applyEuler(i));const s=new fe;this._renderer.getSize(s);const r={yaw:i.y,pitch:x(15),distance:G(t.x,t.y,t.z,this.cameraBehaviour3d.cameraControl.getCamera().fov,s.width,s.height)*se,targetX:o.x,targetY:o.y,targetZ:o.z,blockOtherTweens:!0};Ee(this.cameraBehaviour.cameraControl.getCurrentCameraParameters(),r)||(this._configuratorUiCallbacks.onZoomToComponent(),await this.configuratorCameraBehaviour.zoomToComponentOnConsecutiveClick(r))}resetCameraPositionToStart(){this._requestRender();const e=this._getViewModel().getBoundingBox();this.configuratorCameraBehaviour.externalApiResetCameraPosition(e)}resetPreviews(){this._getViewModel().removePreviews(),this._requestRender()}changeOffset(e){this.cameraBehaviour3d.cameraControl.getCamera().offset=e,this._uiIntersectionHelper&&(this._uiIntersectionHelper.canvasOffset=e)}setCameraOffset(e){this._offsetAnimationStart(),this.cameraBehaviour3d.cameraControl.getCamera().offset&&(this.cameraBehaviour3d.cameraControl.getCamera().offset=e,this._renderEverything()),this._offsetAnimationEnd()}_offsetAnimationStart(){this._onCameraMove()}_offsetAnimationEnd(){this._onCameraIdle()}getCameraOffset(){var e,t,n;return(null===(n=null===(t=null===(e=this.cameraBehaviour3d)||void 0===e?void 0:e.cameraControl)||void 0===t?void 0:t.getCamera())||void 0===n?void 0:n.offset)?JSON.parse(JSON.stringify(this.cameraBehaviour3d.cameraControl.getCamera().offset)):{left:0,top:1,right:1,bottom:0}}_onKeyDown(e){super._onKeyDown(e),!e.key||"Escape"!==e.key&&"Esc"!==e.key||(this._getViewModel().hasPreviews()||this.cancelComponentSelection(!1,"click_outside"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this.cameraBehaviour3d.cameraControl instanceof re&&(this.enablePanning(),e.preventDefault()),this._sceneEventHandler&&this._sceneEventHandler.hasSelection()&&e.key&&("Backspace"===e.key||"Delete"===e.key)&&(this.requestDeleteSelectedComponent(),e.preventDefault())}_onKeyUp(e,t=!1){super._onKeyUp(e,t),e.key&&e.key.includes("Shift")&&(t||this.disablePanning(),e.preventDefault())}enablePanning(){this.configuratorCameraBehaviour.enablePanningOnShiftClick()}disablePanning(){this.configuratorCameraBehaviour.disablePanningOnShiftRelease()}cancelPreviousDockings(){var e;this._cancelDockings(!0,null,!1,!1),null===(e=this._roomleRenderer)||void 0===e||e.forceShadowUpdates(!0),this._renderEverything()}cancelComponentSelection(e,t){(this._sceneEventHandler.hasSelection()||"standard"!==this._sceneEventHandler.getSelectionMode())&&this._cancelSelection(e,t)}notifyPlannerOnComponentSelectionCancel(e,t){}_cancelSelection(e,t){var n;this._sceneEventHandler.cancelSelection(t),this._configuratorContext.selectionMode="standard",this._configuratorContext.selectedRuntimeComponentIds=[],this._getViewModel().removePreviews(),e&&!this._initData.debug&&this.configuratorCameraBehaviour&&this.configuratorCameraBehaviour.resetCameraToStateOnCancelSelection();const i=null===(n=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId))||void 0===n?void 0:n.externalObject;this._getKernelAccess().updatePlanObjectDependencies(this._configuratorContext.planObjectId),this._configuratorUiCallbacks.onSelectionCancel(t),this.notifyPlannerOnComponentSelectionCancel(i,t)}_selectComponent(e,t){this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds(),t||("standard"===this._sceneEventHandler.getSelectionMode()?this._onSelectedRuntimeComponentChange(e):this._onSelectedRuntimeComponentsChange(this._sceneEventHandler.getSelectedRuntimeComponentIds())),this._highlightComponent(e),!this._initData.debug&&t&&this._zoomToComponentOnConsecutiveClick(e)}_deselectComponent(e,t,n){"standard"===this._sceneEventHandler.getSelectionMode()&&(this._cancelSelection(t,n),this._highlightComponent()),"multiselect"===this._sceneEventHandler.getSelectionMode()&&(this._sceneEventHandler.hasSelection()?this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds():(this._cancelSelection(t,n),this._highlightComponent())),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}getScreenXY(e){return k(e,this.cameraBehaviour.cameraControl.getCamera(),this._domHelper.element.clientWidth,this._domHelper.element.clientHeight)}setSelectionMode(e){this._sceneEventHandler.setSelectionMode(e)}changeFloorMaterial(e){return this._environment&&this._environment instanceof ae||(this._environment=new ae(this._scene,this._environment,!0),this._uiIntersectionHelper.floorEnvironment=!0),new Promise((t,n)=>{this._environment.changeFloorMaterial(e,this._maxAnisotropy).then(()=>{this._requestRender(),t()},n)})}zoomIn(e){this.configuratorCameraBehaviour.externalApiZoomIn(e),this._renderEverything()}zoomOut(e){this.configuratorCameraBehaviour.externalApiZoomOut(e),this._renderEverything()}async showDimensions(){await this._initDimensions(),this._dimensionHelper.enableDimensions(),this._dimensionHelper.onDimensionsVisibilityChanged(e=>{e&&this._renderEverything(),this._configuratorUiCallbacks.onDimensionsVisibilityChange(e)}),this._configuratorUiCallbacks.onDimensionsVisibilityChange(!0),this._renderEverything()}async _initDimensions(e=!1){this._dimensionHelper||await t.import("./dimensioning-helper-9d046848.nomodule.js").then(({default:e})=>{this._dimensionHelper=new e(this._creator_)}),this._dimensionHelper.setUiScene(this._uiScene),this._dimensionHelper.setObject(this._getViewModel().getComponent(this._configuratorContext.rootComponentId),this.cameraBehaviour3d.cameraControl.getObjectRotation());const n=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);n&&n.boxForMeasurement&&this._dimensionHelper.updateSize(n.boxForMeasurement);let i=this.cameraBehaviour3d.cameraControl.getCamera().position;if(e){const e=u(n.boxForMeasurement);i.copy(e.getCenter(new me)),i.y=e.getSize(new me).y+1}this._dimensionHelper.moveCameraEnd(i)}hideDimensions(){this._dimensionHelper&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._renderEverything()}async loadSceneSettings(e){await super.loadSceneSettings(e),this._uiIntersectionHelper.floorEnvironment=this._environment instanceof ae}onCameraChanged(){super.onCameraChanged(),this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition()}requestDockingsPreview(e,t,n,i){i||(i=!1),e&&this.cancelPreviousDockings(),this.cancelComponentSelection(!1,"dock_preview"),i&&this.enableDragIn(n),t&&(this._configuratorContext.lastPossibleChild=t),this._configuratorContext.requestPreviewsIsUserInitiated=e,this.resetPreviews(),this._getKernelAccess().webGlPreviewDockings(this._configuratorContext,i),this._showDockings()}_requestDockingsPreviewWithDrag(e){this.cancelPreviousDockings(),this._configuratorContext.rootComponentId!==e&&(this.resetPreviews(),this._getKernelAccess().previewDockingsWithDrag(e,this._configuratorContext.planObjectId),this._showDockings())}_dockComponent(e){this._getKernelAccess().kernelInstance.isExternalPlanObject(e.parentId)?this._dockExternalComponent(e):this._dockKernelComponent(e)}_dockKernelComponent(e){c.start("dock_component_"+e.childId),this._getKernelAccess().dockComponent(e.parentId,e.parentDockId,e.childId,e.childDockId),this._configuratorContext.dockingRootComponentId=null;const t=this._getKernelAccess().kernelInstance.getComponent(e.childId);this._configuratorUiCallbacks.onElementDocked(JSON.parse(JSON.stringify(t)),e.childId),this.saveConfigToIdb()}_dockExternalComponent(e){this._getKernelAccess().dockExternalObjectComponent(e.parentId,e.parentDockId,e.childId,e.childDockId)}_onSelectedRuntimeComponentsChange(e){this._getKernelAccess().multiSelectionChange(e,this._configuratorContext.rootComponentId)}_onSelectedRuntimeComponentChange(e){let t=!1,n=null;e&&(t=e.runtimeId===this._configuratorContext.rootComponentId,n=e.runtimeId),this._getKernelAccess().selectionChange(n,t),e&&this._getKernelAccess().selectedComponent(e.runtimeId)}requestDeleteSelectedComponent(){const e=this._configuratorContext.selectedRuntimeComponentIds,t=this._configuratorContext.rootComponentId;if(this._getKernelAccess().isExternalObjectOrComponent(t)||Array.isArray(e)&&0!==e.length&&t&&-1===e.indexOf(t)){switch(this._configuratorContext.selectionMode){case"standard":this._getKernelAccess().requestDeleteComponent(this._configuratorContext.selectedRuntimeComponentId);break;case"multiselect":this._getKernelAccess().requestDeleteComponents(this._configuratorContext.selectedRuntimeComponentIds)}this._configuratorContext.selectedRuntimeComponentIds=[]}}componentUpdated(e,t){var n;if(e.runtimeId===this._configuratorContext.rootComponentId){let t=new me(e.position.x/1e3,e.position.z/1e3,e.position.y/-1e3);this._sceneEventHandler.update(null,t,null)}void 0===e.geometryChanged||e.geometryChanged?this._renderEverything():this._renderWithoutShadowsAndAO(),null===(n=this._componentDimensioningHelper)||void 0===n||n.invalidateDimensioningsCache(e.runtimeId)}planObjectUpdated(e,t,n){const i=this._getKernelAccess().kernelInstance.getSerializedConfiguration(this._configuratorContext.planObjectId);if(n||this._configuratorHistory.push(i),e.bounds){if(this._configuratorContext.planObjectId===e.id&&this.cameraBehaviour3d instanceof Ge){const e=this._getViewModel().getBoundingBox();this.cameraBehaviour3d.updateBoundsOnPlanObjectUpdated(e);const n=this._getViewModel().getBoundingBoxOfGeometry();this._updateBounds(e,n,t)}this._highlightComponent(),this._requestRender()}}componentDeleted(e){-1===this._sceneEventHandler.getSelectedRuntimeComponentIds().indexOf(e.runtimeId)&&"multiselect"!==this._sceneEventHandler.getSelectionMode()||this.cancelComponentSelection(!1,"delete_component")}previewConstructionDone(e,t){const n=this._getViewModel().getBoundingBoxWithPreviews();t||(this._cancelDockings(!0,null,!1,!1,!1),this._configuratorContext.requestPreviewsIsUserInitiated&&this._configuratorUiCallbacks.onNoDockingsAvailable());let i=!0;this._componentRaycastHelper&&(i=!this._componentRaycastHelper.areAllComponentsInFrustum(this._getViewModel().getPreviews())),this._configuratorContext.requestPreviewsIsUserInitiated&&i&&this.configuratorCameraBehaviour.zoomToFitBoundsAfterUserInitiatedPreviews(n),this._lightSetting&&this._lightSetting.needsBounds()&&(this._lightSetting.updateBounds(n),this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new me))),this._componentRaycastHelper&&this._componentRaycastHelper.checkPreviewVisibility(this._getViewModel())}configurationLoaded(e,t){e&&t&&this._sceneEventHandler.isDragIn()?(e.position.copy(new me(0,100,0)),this._scene.add(e),this._sceneEventHandler.addComponentDragInHandler(e),this._requestRender()):t||this._initData.debug||this._initData.moc||this.configuratorCameraBehaviour.resetCameraToStartOnConfigurationLoaded(this.getBounds()),this._environment&&this._environment.reload(),this._waitForAssets().then(()=>{this._readyForRender()})}addComponentHandlers(e){this._sceneEventHandler.addComponentHandlers(e)}addPreviewHandlers(e){this._sceneEventHandler.addPreviewHandlers(e)}addPreviewLineHandlers(e){this._sceneEventHandler.addPreviewLineHandlers(e)}_updateComponentPosition(){if(!this._configuratorUiCallbacks.onComponentPositionsUpdated)return;const e=[];this._getViewModel().getComponents().forEach(t=>{if(!t.boundingBoxMesh)return;const n=(new _e).setFromObject(t.boundingBoxMesh);let i=this._getKernelAccess().kernelInstance.getComponent(t.runtimeId);const o=i.parameters||i.possibleChildren?["edit"]:[];e.push({id:t.runtimeId,position:this.getScreenXY(n.getCenter(new me)),type:"component",actions:o})}),this._getViewModel().getPreviews().forEach(t=>{const n=(new _e).setFromObject(t);e.push({id:t.runtimeId,position:this.getScreenXY(n.getCenter(new me)),type:"preview",actions:["add"]})}),this._configuratorUiCallbacks.onComponentPositionsUpdated(e)}_updateBounds(e,t,n=!1){var i;if(super._updateBounds(e,t,n),!e)return;let o=e.getSize(new me);const s=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);s&&s.boxForMeasurement&&(null===(i=this._dimensionHelper)||void 0===i||i.updateSize(s.boxForMeasurement)),this._sceneEventHandler.update(o,null,null),this._uiIntersectionHelper.updateToBounds(o,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this.cameraBehaviour3d.cameraControl.getCamera().updateProjectionMatrix()}async moveCamera(e){return this.configuratorCameraBehaviour.externalApiMoveCamera(e)}getSelectedRuntimeComponentIds(){return this._sceneEventHandler.getSelectedRuntimeComponentIds()}selectComponent(e,t=!0){if(!e)return;const n=this._getViewModel().getComponents().find(t=>t.runtimeId===e);n?this._sceneEventHandler.clickComponent(n,t):console.warn('Can not select "'+e+'" because it was not found')}highlightParts(e){this._highlightComponent(null,e),this._requestRender()}_shouldHighlightComponent(){return"configurator"===this._configuratorContext.baseContext&&(this._initData.highlighting===De.ALWAYS||this._initData.highlighting!==De.OFF&&(!!this._getKernelAccess().kernelInstance.getComponent(this._configuratorContext.rootComponentId).externalComponent||(this._plannerKernelAccess.kernelInstance.getChildrenOfPlanComponent(this._configuratorContext.rootComponentId,!0,!1)||[]).length>1))}saveConfigToIdb(){var e,t;let n,i;const{configuratorId:o}=this._globalInitData,{lastLoadedPlanId:s,lastLoadedRapiId:r}=this._configuratorContext;this._initData.moc?(n=s,i=null===(t=null===(e=this._getKernelAccess())||void 0===e?void 0:e.planInteractionHandler.getPlan())||void 0===t?void 0:t.getPlanXML(!1,2)):(n=r,i=this._getKernelAccess().kernelInstance.getSerializedConfiguration(this._configuratorContext.planObjectId));const a=this._idbManager.getKey(K(),o,n);this._idbManager.setValue(a,i,this._idbManager.configStore)}_getInputManager(){return this._configuratorInputManager}createCameraControl(e,t){this._componentFactory=$();const n=this._domHelper.getClientDimensions(),i=n.x,o=n.y,s=this._componentFactory.createPerspectiveCamera(30,i/o,.1,20,t);s.layers.set(3),s.layers.enable(1),s.layers.enable(2),s.layers.enable(6),s.layers.enable(5),s.position.copy(new me(0,.5,5)),this._changeCameraBehaviour(new Ge(new re(this._creator_,this._getInputManager(),null,s),this._cameraBehaviourState))}getBounds(){return this._getViewModel().getBoundingBox()}getGeometryBounds(){return this._getViewModel().getBoundingBoxOfGeometry()}sceneChanged(){}get configuratorCameraBehaviour(){return this.cameraBehaviour instanceof Ge?this.cameraBehaviour:null}get cameraBehaviour3d(){return this.cameraBehaviour}_onCameraIdle(){return super._onCameraIdle()}_onCameraMove(){return super._onCameraMove()}getComponent(e){return this._plannerKernelAccess.kernelInstance.getComponent(e)}cameraBehaviourChanged(){var e;super.cameraBehaviourChanged(),null===(e=this._sceneEventHandler)||void 0===e||e.setCamera(this.cameraBehaviour.cameraControl.getCamera()),this._setCameraControlListeners()}_setCameraControlListeners(){this.cameraBehaviour3d&&(this.cameraBehaviour.cameraControl.addEventListener(0,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._sceneEventHandler.setCameraMoving(!0),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(1,()=>{this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentAndPreviewVisibility(this._sceneEventHandler,this._getViewModel()),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(2,()=>{this._sceneEventHandler.setCameraMoving(!1),this._updateComponentPosition(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(5,({minZoom:e,maxZoom:t})=>{this._configuratorUiCallbacks.onZoomChange(e,t)},this),this.cameraBehaviour.cameraControl.addEventListener(3,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(4,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(7,()=>{var e;this._pluginSystem.moveCameraStart(this.cameraBehaviour.cameraControl.getCamera().position),null===(e=this._dimensionHelper)||void 0===e||e.moveCameraStart(this.cameraBehaviour.cameraControl.getCamera().position)},this),this.cameraBehaviour.cameraControl.addEventListener(8,()=>{var e;this._pluginSystem.moveCameraEnd(this.cameraBehaviour.cameraControl.getCamera().position),null===(e=this._dimensionHelper)||void 0===e||e.moveCameraEnd(this.cameraBehaviour.cameraControl.getCamera().position)},this))}_shouldRenderUi(){var e;return super._shouldRenderUi()||(null===(e=this._dimensionHelper)||void 0===e?void 0:e.areDimensionsEnabled())}setEventHandlerObject(e){this._sceneEventHandler.setObject(e)}_readyForRender(){"configurator"===this._configuratorContext.baseContext&&(this._configuratorUiCallbacks.onReadyForRender(),this._globalCallback.onReadyForRender())}animateElement(e,t,n,i,o){const s="animation:"+t;this._viewModel.changeAnimationValue(e,s,n,i,o)}}e("C",Ke),n([i],Ke.prototype,"_configuratorInputManager",void 0),n([i],Ke.prototype,"_configuratorMeshGenerator",void 0),n([i],Ke.prototype,"_memoryManager",void 0),n([i],Ke.prototype,"_configuratorContext",void 0),n([i],Ke.prototype,"_componentDimensioningHelper",void 0),n([i],Ke.prototype,"_configuratorHistory",void 0),n([i],Ke.prototype,"_configuratorUiCallbacks",void 0),n([i],Ke.prototype,"_plannerKernelAccess",void 0),n([i],Ke.prototype,"_globalInitData",void 0);class Ue{_isInitDone(){return this._isKernelReady&&this._isWebGlReady&&this._isPreloadReady}_checkInitDone(){this._isInitDone()&&(this._onInitDoneCollection.forEach(e=>e()),this._onInitDoneCollection=[])}_onInitDone(e){this._isInitDone()?e():this._onInitDoneCollection.push(e)}constructor(e){this._onInitDoneCollection=[],this._isKernelReady=!1,this._isWebGlReady=!1,this._isPreloadReady=!0,this._isLoadError=!1,this._isReloading=!1,this._needsSync=!1,this._creator_=e,this._configuratorKernelAccessCallback.addListener(this);const{dls:t,ls:n}=this._initData;(n||t)&&(this._initData.legacyLight=!0),this._initData.legacyLight&&(this._initData.envMapIntensity=.9);const i=this._errorHandler;i.subscribe(0,e=>this._configuratorUiCallbacks.onErrorDueToOffline(e)),i.subscribe(1,e=>this._configuratorUiCallbacks.onError(e)),i.subscribe(2,(e,t)=>this._configuratorUiCallbacks.onContentProblem({rapiPath:e,ids:t,message:"Could not load the ids"}))}exportCanvasScreenshot(e){return this._sceneManager.exportCanvasScreenshot(e)}initSceneManager(e){this._sceneManager=e||o.lookup("configurator-scene-manager",this._creator_)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}_loadWebGlLib(e,t){this._loadingWebGlSuccess(e,t)}_loadingWebGlSuccess(e,t){this.initSceneManager(),t&&this._sceneManager.changeOffset(t);const{initialFloorMaterial:n,dls:i,ls:o,stats:s}=this._initData,r=R.createDynamicLightSettingSource(i,o);s&&this.showStats(),this._sceneManager.enableHD(r),this._needsSync&&(this._needsSync=!1,this._plannerKernelAccess.requestSync(W,this._configuratorContext.planObjectId));const a=[this._scriptLoader.fetch(le,{id:"tween-js"})];n&&a.push(this._rapiAccess.getMaterial(n).then(e=>this._sceneManager.changeFloorMaterial(e))),Promise.all(a).then(this._webGlIsReady.bind(this),this.loadError.bind(this))}_webGlIsReady(){this._isWebGlReady=!0,this._checkInitDone()}_initPromiseCallback(e,t){this._isInitDone()?e():this._isLoadError?t("_initPromiseCallback failed"):(this._onInitDone(()=>e()),this._rejectOnLoadError=t)}_notifyOnConfigurationReady(e){return async t=>{const n=await this._plannerKernelAccess.addUiDataAndPriceToPartList(t.partList,t.hash);t.partList=n,e(t),this._configuratorUiCallbacks.onConfigurationReady(n,t.hash,t.rootComponentLabel),this._configuratorHistory.clearHistory()}}_notifyOnConfigurationLoadingError(e){return t=>{this._configuratorUiCallbacks.onConfigurationLoadError(),e(t)}}_loadItemOrConfigById(e,t){this._configuratorContext.lastLoadedRapiId=e,this._onLoadConfiguration(),this._preloadPackage(e),this._clearScene();const{offlineSync:n}=this._initData;if(n){const t=N(e);t&&this._dataSyncer.start(t)}return new Promise((n,i)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(t=>{t&&t.configuration?this._loadConfiguration(t.configuration).then(e=>{const i=this._notifyOnConfigurationReady(n);t.label?this._notifyUiAboutNewItem(t,e.rootComponentLabel):this._notifyUiAboutNewConfiguration(t),i(e)},this._notifyOnConfigurationLoadingError(i).bind(this)):i(new Error("Could not load item or config with id "+e))},i)})}_shouldBroadcastToUi(e){return!(0===e&&this._configuratorContext.selectedRuntimeComponentId||1===e&&!this._configuratorContext.selectedRuntimeComponentId||2===e&&!this._configuratorContext.selectedRuntimeComponentIds.length)}_isCorrectResponse(e,t){if(0===e)return t===this._configuratorContext.planObjectId;if(1===e)return t===this._configuratorContext.selectedRuntimeComponentId;const n=t.length;if(n!==this._configuratorContext.selectedRuntimeComponentIds.length)return!1;for(let e=0;e<n;e++)if(t[e]!==this._configuratorContext.selectedRuntimeComponentIds[e])return!1;return!0}_onLoadConfiguration(){this._clearScene(),this._configuratorUiCallbacks.onLoadConfiguration()}_clearScene(){this._sceneManager&&this._sceneManager.clearScene()}_notifyUiAboutNewItem(e,t){this._rapiAccess.getCatalog(e.catalog).then(n=>this._configuratorUiCallbacks.onConfigurationLabelChange(n.name,e.label,t))}_notifyUiAboutNewConfiguration(e){Promise.all([this._rapiAccess.getCatalog(e.catalog),this._rapiAccess.getComponent(e.rootComponentId)]).then(([e,t])=>this._configuratorUiCallbacks.onConfigurationLabelChange(e.name,null,t.label))}notifyUiAboutNewLabel(e){if(q(e)){const t=this._rapiAccess.peekItem(e),n=this._rapiAccess.peekComponent(t.rootComponentId);this._notifyUiAboutNewItem(t,n.label)}else this._notifyUiAboutNewConfiguration(this._rapiAccess.peekConfiguration(e))}_getMaterialGroups(e){const t=(e,t)=>{let n=Q(e,t);return 0!==n?n:(n=Y(e.label,t.label),0!==n?n:Y(e.id,t.id))},n=e=>(e.sort(t),e.forEach(e=>e.materials.sort(t)),e);if(e.validGroups.length>0)return new Promise((t,i)=>this._rapiAccess.getMaterialsByGroup(e.validGroups).then(e=>t(n(e)),i));const i=[];return e.validValues.forEach(e=>i.push(e.value)),new Promise((e,t)=>{this._rapiAccess.getMaterials(i).then(t=>{this._rapiAccess.combineMaterialsToGroups(t).then(t=>{e(n(t))})},t)})}_loadConfiguration(e){return this._plannerKernelAccess.externalMeshQueue.clear(),new Promise((t,n)=>{const i=()=>{const{x:i,y:o}=this._domHelper.getClientDimensions();if(i<=0&&o<=0){let e="Size of canvas is 0/0! When using embedding set correct size or remove id to load in idle mode!";return console.error(e),n(e)}this.resumeKernelCallbacks(),c.start("ui_load_configuration");const s=[];if(this._initData.applyCurrentGlobalParameters){const e=this._configuratorContext.planObjectId,t=this._configuratorContext.rootComponentParametersAsGlobal;s.push(this._plannerKernelAccess.getGlobalParameters(e,t))}Promise.all(s).then(([i])=>{const o=[h.waitFor(4),h.waitFor(2)];Promise.all(o).then(([e,[n,o,s,r]])=>{const a=[];i&&this._initData.applyCurrentGlobalParameters&&i.forEach(e=>a.push(this.setParameter(e,e.value,!0)));const l=this._rapiAccess.peekComponent(r);Promise.all(a).then(()=>{const n=[];a.length&&(n.push(this._plannerKernelAccess.getPartList()),n.push(this._plannerKernelAccess.getConfigurationHash(this._configuratorContext))),Promise.all(n).then(async n=>{const i=n&&n[0]?n[0]:o,r=n&&n[1]?n[1]:s,a=await this._plannerKernelAccess.addUiDataAndPriceToPartList(i,r);let c=e.errors;const h=c?X(c):[];this._configuratorUiCallbacks.onPartListUpdate(a,window.btoa(s)),t({partList:a,hash:r,rootComponentLabel:l?l.label:"",errors:h})})})},n),this._plannerKernelAccess.loadConfiguration(e)},n)};this._onInitDone(()=>i())})}_preLoadItemOrConfig(e,t){return new Promise((n,i)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(n,i)})}_preloadPackage(e){this._isPreloadReady=!1;let t=null;t=q(e)?this._rapiAccess.getPreloadForItem.bind(this._rapiAccess):this._rapiAccess.getPreloadForConfiguration.bind(this._rapiAccess),c.start("rapi_preloads");const n=()=>{const t=c.getMeasure("rapi_preloads");if(Array.isArray(t)&&1===t.length){const n=t[0];this._configuratorUiCallbacks.onTrackTiming("Timing","RapiPreloads",Math.round(n.duration),{id:e})}};t(e).then(()=>{this._isPreloadReady=!0,this._checkInitDone(),n()},e=>{this._isPreloadReady=!0,this._checkInitDone(),console.error(e),n()})}_reloadConfiguration(e,t,n,i){return this._performLoadConfiguration(e).then(e=>{this._isReloading=!1,n(e)},e=>{this._isReloading=!1,i(e)})}_performLoadConfiguration(e){return this._onLoadConfiguration(),new Promise((t,n)=>{this._initData.preloadHint?this._preloadPackage(this._initData.preloadHint):console.warn("When loading a configuration string you have to supply a preloadHint to use fast loading!"),setTimeout(()=>{this._loadConfiguration(e).then(this._notifyOnConfigurationReady(t).bind(this),this._notifyOnConfigurationLoadingError(n).bind(this))},0)})}_changeHDGeometry(e){return new Promise((t,n)=>e===z.useHDGeometry?t():this._isReloading?n("Change of HD Geometry in progress"):(this._isReloading=!0,h.waitFor(3).then(([e,i])=>{this._reloadConfiguration(e,i,t,n)},n),z.useHDGeometry=e,void this._plannerKernelAccess.changeUseOfHDGeometry(this._configuratorContext,z.useHDGeometry)))}async _callOnPartListUpdate(){const{hash:e}=await h.waitFor(4),t=await this._plannerKernelAccess.getPartList(),n=await this._plannerKernelAccess.getConfigurationHash(this._configuratorContext),i=await this._plannerKernelAccess.addUiDataAndPriceToPartList(t,n);this._configuratorUiCallbacks.onPartListUpdate(i,window.btoa(e))}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}init(e,t){this.setOverrides(t);const{preloadHint:n,offset:i,startTag:o}=this._initData;return this._domHelper.setDomElement(e),n?this._preloadPackage(n):console.warn("No preload hint! Therefore no preload during init!!"),o&&this.getTagById(o,{include:["items"]}).then(e=>this._configuratorUiCallbacks.onOpenTag(e),e=>console.error(e)),this._loadWebGlLib(e,i),new Promise(this._initPromiseCallback.bind(this))}cancelSelection({reason:e,resetCamera:t}={}){this._sceneManager.cancelComponentSelection(null!=t&&t,e||"unknown")}enableHDGeometry(){return this._changeHDGeometry(!0)}disableHDGeometry(){return this._changeHDGeometry(!1)}changeOffset(e){this._sceneManager.changeOffset(e)}previewDockings(e,t,n){this._sceneManager.requestDockingsPreview(!0,e,t,n)}cancelDockings(){this._sceneManager.cancelDockings()}requestDeleteComponent(){this._sceneManager.requestDeleteSelectedComponent()}renderImage(e){return this._sceneManager.renderImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}preparePartImage(e,t){let n={};return"number"==typeof t?n.size=t:(t||(t={}),"number"!=typeof t.size&&(t.size=256),n=t),this._sceneManager.preparePartImage(e,n)}async saveCurrentConfiguration(){var e;try{const t=await this._plannerKernelAccess.getConfigurationData(this._configuratorContext.planObjectId);if(null===(e=this._plannerKernelAccess.kernelInstance)||void 0===e?void 0:e.isExternalPlanObject(this._configuratorContext.planObjectId))return{...t,label:"",externalObject:!0};const n=await this._rapiAccess.saveConfiguration(t);this._configuratorUiCallbacks.onConfigurationSaved(n.configurationHash);const i=await this._rapiAccess.getComponent(n.rootComponentId);let o=null,s=null;if(n.perspectiveImage&&!this._initData.featureFlags.forceSaveThumbnails||(o=await this._sceneManager.preparePerspectiveImage()),n.topImage&&!this._initData.featureFlags.forceSaveThumbnails||(s=await this._sceneManager.prepareTopImage()),o&&s){const e=await this._rapiAccess.saveConfigurationImage(n,o,"perspectiveImage",s,"topImage");n.perspectiveImage=e.perspectiveImage,n.topImage=e.topImage}return n.label=i.label,n.externalObject=!1,this._rapiAccess.updateCache("configurations",n),n}catch(e){throw new Error(e)}}generateImagesOfCurrentConfiguration(){return new Promise((e,t)=>this.saveCurrentConfiguration().then(t=>e({topImage:t.topImage,perspectiveImage:t.perspectiveImage,isLocally:t.isLocally}),t))}prepareTopImage(e){let t={};return"boolean"==typeof e?t.showDimensions=e:(e||(e={}),"boolean"!=typeof e.showDimensions&&(e.showDimensions=!1),t=e),this._sceneManager.prepareTopImage(t)}resetCameraPosition(){this._sceneManager.resetCameraPositionToStart()}showBenchmarks(e){c.showBenchmarks(e)}debugSceneGraph(e){this._sceneManager.debugSceneGraph(e)}async loadConfiguration(e,t){this.setOverrides(t),this._configuratorContext.lastLoadedRapiId=null,this._sceneManager&&this._sceneManager.clearScene();const n=await this._performLoadConfiguration(e);return this._rapiAccess.trackView("configuration string"),n}async loadConfigurationById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!0);return this._rapiAccess.trackView(e),n}async loadConfigurableItemById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!1);return this._rapiAccess.trackView(e),n}preLoadConfigurationById(e){return this._preLoadItemOrConfig(e,!0)}preLoadConfigurableItemById(e){return this._preLoadItemOrConfig(e,!1)}_getTag(e){return this._rapiAccess.getTag(e)}_dispatchSetParameter(e,t,n,i,o){const s=this._configuratorContext.selectedRuntimeComponentId?"local":"global";switch(c.start("kernel_change_param_"+s+"_"+e),this._configuratorContext.selectionMode){case"standard":if(this._configuratorContext.selectedRuntimeComponentId||this._configuratorContext.rootComponentParametersAsGlobal){let s=this._configuratorContext.selectedRuntimeComponentId?this._configuratorContext.selectedRuntimeComponentId:this._configuratorContext.rootComponentId;this._plannerKernelAccess.changeComponentParameter(s,e,t,n,i,o)}else this._plannerKernelAccess.changePlanObjectParameter(this._configuratorContext.planObjectId,e,t,n,i,o);break;case"multiselect":this._plannerKernelAccess.changeCommonComponentParameter(this._configuratorContext.selectedRuntimeComponentIds,e,t,n,i,o)}}setParameter(e,t,n=!1){return new Promise((i,o)=>{const{key:s,type:r}=e;if(Z(e)){if(!n&&!this._unitFormatter.isParseableUnitString(t,e))return o(new SyntaxError('Value "'+t+'" is not parseable'));const i=n?t:this._unitFormatter.parseValue(t,e),{valueFrom:s,valueTo:a}=e.validRange,l=this._unitFormatter.getAllowedDelta();if(!Number.isNaN(s)&&i<s-l)return o(new RangeError('Value "'+t+'" is too small, min-val "'+s+'"'));if(!Number.isNaN(a)&&i>a+l)return o(new RangeError('Value "'+t+'" is too big, max-val "'+a+'"'));t="Integer"===r&&"number"==typeof i?i.toFixed():i.toString()}this._sceneManager.cancelDockings(),this._dispatchSetParameter(s,r,t,i,o),this._sceneManager.saveConfigToIdb()})}setParameterOfPlanObject(e,t){return new Promise((n,i)=>{const{planObjectId:o,rootComponentId:s,rootComponentParametersAsGlobal:r}=this._configuratorContext,{type:a,key:l}=e;r?this._plannerKernelAccess.changeComponentParameter(s,l,a,t,n,i):this._plannerKernelAccess.changePlanObjectParameter(o,l,a,t,n,i)})}getParametersOfPlanObject(){const{planObjectId:e,rootComponentParametersAsGlobal:t}=this._configuratorContext;return this._plannerKernelAccess.getGlobalParameters(e,t)}setParameterOfRootComponent(e,t){return new Promise((n,i)=>{const{rootComponentId:o}=this._configuratorContext,{type:s,key:r}=e;this._plannerKernelAccess.changeComponentParameter(o,r,s,t,n,i)})}getParametersOfRootComponent(){const{planObjectId:e}=this._configuratorContext;return this._plannerKernelAccess.getGlobalParameters(e,!0)}enableMultiselect(){this._sceneManager.setSelectionMode("multiselect"),this._configuratorContext.selectionMode="multiselect"}disableMultiselect(){this._sceneManager.setSelectionMode("standard"),this._configuratorContext.selectionMode="standard"}getCurrentConfiguration(){return h.waitFor(1,()=>this._plannerKernelAccess.uiRequestConfiguration(this._configuratorContext.planObjectId))}loadComponentIntoKernel(e){return h.waitFor(0,()=>{let t=null;try{if(t=JSON.parse(e).id,!t)throw new Error("Component string has no ID")}catch(e){return this._configuratorUiCallbacks.onContentProblem({rapiPath:"components",ids:[t],message:"Component string is not a valid JSON or has no ID"}),void h.failOperation(0,e)}this._kernelIo.setMeta({componentId:t}),this._plannerKernelAccess.loadComponentIntoKernel(e,t)})}getShortUrlOfCurrentConfiguration(){return new Promise((e,t)=>{this.saveCurrentConfiguration().then(n=>navigator.onLine?this._rapiAccess.getShortUrl(n.id,3).then(t=>{const n=t.shortId,i=j.APP.SHORTENER_URL+n;e(i)},t):t("Can not generate short url when offline"),t)})}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}getTagById(e,t){return new Promise((n,i)=>{this._getTag(e).then(e=>{let o=Promise.resolve([]),s=Promise.resolve([]);t&&t.include&&t.include.forEach(t=>{"materials"===t&&(o=this._rapiAccess.getMaterialsOf(e)),"items"===t&&(s=this._rapiAccess.getItems(e.items))}),Promise.all([o,s]).then(([t,i])=>(i.sort(Q),t.sort(Q),n({...e,items:i,materials:t})),i)},i)})}requestAsset(e){return this._dataSyncer.requestAsset(e)}changeFloorMaterial(e){return this._sceneManager.changeFloorMaterial(e)}async changeFloorMaterialById(e){const t=await this._rapiAccess.getMaterial(e);return this._sceneManager.changeFloorMaterial(t)}openFloorMaterials(){this._configuratorUiCallbacks.onOpenFloorMaterials()}openPartList(){this._configuratorUiCallbacks.onOpenPartList()}getAdditionalContentsOf(e){return this._rapiAccess.getAdditionalContentsOfItems(e)}changeTypeChangeTag(e){navigator.onLine&&this._initData.offlineSync&&this._dataSyncer.syncTypeChangeTag(e),this._configuratorUiCallbacks.onChangeTypeChangeTag(e)}removeTypeChangeTag(e){this._configuratorUiCallbacks.onRemoveTypeChangeTag(e)}showGUI(){this._sceneManager.showGUI()}showStats(){this._sceneManager.showStats()}showDimensions(){this._sceneManager.showDimensions()}hideDimensions(){this._sceneManager.hideDimensions()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}syncFloorTag(e){return this._dataSyncer.syncFloorTag(e)}syncTypeChangeTag(e){return this._dataSyncer.syncTypeChangeTag(e)}loadDynamicLightSetting(e){return this._sceneManager.loadDynamicLightSetting(e)}setBackgroundColor(e){this._sceneManager.setBackgroundColor(e)}setBackgroundImage(e){this._sceneManager.setBackgroundImage(e)}loadSceneSetting(e){return this._sceneManager.loadSceneSettings(e)}enableMeshSelection(e){this._initData.meshSelection=e}updateSize(){this._sceneManager.updateCamera()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}getCameraOffset(){return this._sceneManager.getCameraOffset()}getMain(){}cleanup(e={}){this._configuratorContext.selectedRuntimeComponentIds=[],this._plannerKernelAccess.cleanUpCallbacks(),this._sceneManager.sceneCleared(!!e.resetMeshCache),e.resetCoreCache&&this._plannerKernelAccess.kernelInstance.clearAll(),e.resetApiCache&&this._rapiAccess.cleanUp()}resumeTest(e){e&&this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}zoomIn(e){this._sceneManager.zoomIn(e)}zoomOut(e){this._sceneManager.zoomOut(e)}get callbacks(){return this._configuratorUiCallbacks}get globalCallbacks(){return this._globalCallback}getRuntimeComponentIdOfRootComponent(){const e=this._configuratorContext.planObjectId;return e?this._plannerKernelAccess.getRuntimeComponentIdOfRootComponent(e):(console.warn("planObjectId not set"),0)}getCurrentConfigurationHash(){return this._plannerKernelAccess.getConfigurationHash(this._configuratorContext)}getCurrentSelection(){let e=this._configuratorContext.selectedRuntimeComponentIds;return e&&e.length||(e=[this._configuratorContext.rootComponentId]),e.map(e=>this._plannerKernelAccess.getRuntimeComponentId(e))}isReady(){const e=c.getMeasure("kernel_is_ready");if(Array.isArray(e)&&1===e.length){const t=e[0],n=c.getMeta("kernel_is_ready");this._configuratorUiCallbacks.onTrackTiming("Timing","KernelIsReady",Math.round(t.duration),Object.assign(n,{startTime:t.startTime}))}this._isKernelReady=!0,this._checkInitDone(),"function"==typeof this._configuratorUiCallbacks.onKernelIsReady&&this._configuratorUiCallbacks.onKernelIsReady()}async updatePossibleChildren(e,t,n){const i=await this._addAdditionalInfoToPossibleChildren(e,t,n);if(i){const{tags:e,defaultChild:t}=i;this._shouldBroadcastToUi(n)&&this._configuratorUiCallbacks.onUpdatePossibleChildren(e,t)}}updateParameters(e,t,n,i){this._setParameterTooltip(e,n),this._addGroupsToParameters(n,e,t,i),this._plannerKernelAccess.updateAnimationParameters(n,e),this._shouldBroadcastToUi(i)&&this._configuratorUiCallbacks.onUpdateParameters(e)}loadError(e){this._isLoadError=!0,this._rejectOnLoadError&&this._rejectOnLoadError(e)}resumeKernelCallbacks(){this._plannerKernelAccess.muteKernelCallbacks=!1,this._plannerKernelAccess.resume()}pauseKernelCallbacks(){this._plannerKernelAccess.muteKernelCallbacks=!0,this._plannerKernelAccess.pause()}setActiveGroupInView(e){this._plannerKernelAccess.setActiveGroupInView(e)}setActiveGroupInViewForPlanObject(e,t){this._plannerKernelAccess.setActiveGroupInViewForPlanObject(e,t)}getParameterGroups(){return this._plannerKernelAccess.getParameterGroups()}async getConfiguratorSettings(){return this._rapiAccess.getConfiguratorSettings()}async moveCamera(e){return this._sceneManager.moveCamera(e)}selectComponent(e){return this._configuratorContext.selectedRuntimeComponentId===e?Promise.resolve():Promise.resolve(this._sceneManager.selectComponent(e))}setComponentParameter(e,t,n){const{key:i,type:o}=t;return new Promise((t,s)=>this._plannerKernelAccess.changeComponentParameter(e,i,o,n,t,s))}highlightParts(e){this._sceneManager.highlightParts(e)}undo(){return new Promise((e,t)=>{const n=this._configuratorHistory.undo();n&&(this._callOnPartListUpdate().then(e,t),this._plannerKernelAccess.loadConfiguration(n))})}redo(){return new Promise((e,t)=>{const n=this._configuratorHistory.redo();n&&(this._callOnPartListUpdate().then(e,t),this._plannerKernelAccess.loadConfiguration(n))})}clearHistory(){this._configuratorHistory.clearHistory()}getHashOfSerializedConfiguration(e){return this._plannerKernelAccess.kernelInstance.getHashOfSerializedConfiguration(e)}getParametersOfComponent(e){const t=this._plannerKernelAccess.getComponentParameters(e),n=this.getParameterGroups();return this._mapComponentTooltipsToParamKeys(t,e),this._addGroupsToParameters(e,t,n,1,!0)}_mapComponentTooltipsToParamKeys(e,t){const n=this._plannerKernelAccess.kernelInstance.getComponentId(t),i=this._rapiAccess.peekComponent(n);if(i&&i.additionalInfos)for(const t of e){const e=i.additionalInfos.find(e=>e.key.toLocaleLowerCase()===t.key.toLocaleLowerCase()&&"parameter"===e.type);e&&(t.tooltip=e.tooltip,t.additionalInfos=i.additionalInfos)}}_setParameterTooltip(e,t){Array.isArray(t)?t.forEach(t=>this._mapComponentTooltipsToParamKeys(e,t)):this._mapComponentTooltipsToParamKeys(e,t)}_addGroupsToParameters(e,t,n,i,o=!1){n||(n=[],console.warn("Kernel returned no parameter groups! Check why!"));const s={};return n.forEach(e=>{s[e.key]=e}),t.sort(Q),t.forEach(t=>{t.group?t.grouping=s[t.group]:t.grouping=null,this._unitFormatter.formatParameter(t),J(t)&&Object.defineProperty(t,"groups",{get:()=>new Promise((n,s)=>{this._getMaterialGroups(t).then(t=>{this._isCorrectResponse(i,e)&&this._shouldBroadcastToUi(i)||o?n(t):s("Response does not match to ids")},s)})})}),t}async _getChildrenOf(e,t,n,i){const o=i(e,t,n);return await this._addAdditionalInfoToPossibleChildren(e,o,2,!1,!0)}async getChildrenOfPlanComponent(e,t=!1,n=!1){const i=this._plannerKernelAccess.kernelInstance.getChildrenOfPlanComponent.bind(this._plannerKernelAccess.kernelInstance);return this._getChildrenOf(e,t,n,i)}async getChildrenOfPlanObject(e=!1,t=!1){const{planObjectId:n}=this._configuratorContext,i=this._plannerKernelAccess.kernelInstance.getChildrenOfPlanObject.bind(this._plannerKernelAccess.kernelInstance);return this._getChildrenOf(n,e,t,i)}async _addAdditionalInfoToPossibleChildren(e,t,n,i=!0,o=!1){const{possibleChildren:s,defaultChild:r}=await this._getPossibleChildrenForKernelPossibleChildren(t,o),a=[],l=new Map,c=[];if(s.forEach(e=>{const t=e.tags;if(e.tags&&Array.isArray(e.tags)&&e.tags.length)for(let n=0,i=e.tags.length;n<i;n++){const i=t[n];-1===a.indexOf(i)&&a.push(i);let o=l.get(i);if(!o){const e=[];l.set(i,e),o=l.get(i)}o.push(e)}else c.push(e)}),this._isCorrectResponse(n,e)||!i){let e=[];try{e=(await this._rapiAccess.getTags(a)).map(e=>({...e,possibleChildren:l.get(e.id)}))}catch(t){console.error("Couldnt load tags of possible children"),console.error(t),e=[]}return e.sort(Q),c.length&&e.unshift({id:"",externalIdentifier:"",global:!1,created:(new Date).toISOString(),updated:(new Date).toISOString(),language:this._globalInitData.locale,catalog:null,tags:[],parents:[],materials:[],items:[],possibleChildren:c}),{tags:e,defaultChild:r}}return null}async _getPossibleChildrenForKernelPossibleChildren(e,t=!1){const n=[],i=[];let o;const s=new Map,r=new Map;e.forEach(e=>{if(!e.possible&&!t)return;let a=e.itemId;e.itemId?(i.push(e.itemId),r.has(e.itemId)?r.get(e.itemId).push(e):r.set(e.itemId,[e])):(n.push(e.componentId),s.has(e.componentId)?s.get(e.componentId).push(e):s.set(e.componentId,[e]),a=e.componentId),e.isDefault&&!o&&(o=a)});const a=await Promise.all([this._rapiAccess.getComponents(n),this._rapiAccess.getItems(i)]),l=a[0],c=a[1],h=[];let d=null;return l.forEach(e=>{var t;e.isItem=!1,e.isComponent=!0;for(const n of null!==(t=s.get(e.id))&&void 0!==t?t:[]){const t=JSON.parse(JSON.stringify(e));t.group=n.group,t.possible=n.possible,t.id===o&&(t.isDefault=!0,d=t),h.push(t)}}),c.forEach(e=>{var t;e.isItem=!0,e.isComponent=!1;for(const n of null!==(t=r.get(e.id))&&void 0!==t?t:[]){const t=JSON.parse(JSON.stringify(e));t.group=n.group,t.possible=n.possible,t.id===o&&(t.isDefault=!0,d=t),h.push(t)}}),h.sort(Q),{possibleChildren:h,defaultChild:d}}getUnitFormatter(){return this._unitFormatter}getStorage(){return this._idbManager}getConfiguratorContext(){return this._configuratorContext}getComponent(e){return this._sceneManager.getComponent(e)}async getTools(){const e=o.lookup("roomle-tools-core",this._creator_);return await e.init(),e}exportImageFromCamera(e="image",t=!1){return this._sceneManager.exportImageFromCamera(e,t)}calcPartsPriceSum(e){return this._plannerKernelAccess.calcPartsPriceSum(e)}async generateProductionServiceExport(e=""){return this.generateHomagIxExport(0,e)}async generateTCExport(e=""){return this.generateHomagIxExport(0,e)}async generateIMOSiXExport(e=""){return this.generateHomagIxExport(1,e)}async generateHOMAGiXExport(e="",n={},i={},o={}){let s=await this.generateHomagIxExport(2,e);const{homagIxMockUpData:r}=await t.import("./imos-ix-poc-export-helper-6a36afe0.nomodule.js");return r(s,n,i,o)}async downloadHomagIxExportPoC(){const e=await this.generateHOMAGiXExport();Se("IMOSiX.xml",e)}async generateHomagIxExport(e,n=""){const{generateExportHomagIxConfiguration:i}=await t.import("./imos-ix-poc-export-helper-6a36afe0.nomodule.js"),o=this._configuratorContext.planObjectId;i(o,e,this._plannerKernelAccess.configurationExporter,this._plannerKernelAccess.kernelInstance,n);try{return this._plannerKernelAccess.configurationExporter.setDefaultExportDataDefinition(n),Promise.resolve(JSON.parse(this._plannerKernelAccess.configurationExporter.generateExport(e,o,this._plannerKernelAccess.kernelInstance)))}catch(t){return console.error(t),Promise.reject("Could not create export JSON "+e)}}setEnvironmentMap(e){const{url:t,intensity:n,rotation:i,maxLightSources:o}=e;this._sceneManager.setEnvironmentMap(t,n,i,o)}enableEvents(){this._sceneManager.enableEvents()}disableEvents(){this._sceneManager.disableEvents()}enableDebugging(){const e={debugValueMapChange:e=>{this.callbacks.onValueMapChanged(e)}};this._plannerKernelAccess.addDebugClient(e)}}e("R",Ue),n([i],Ue.prototype,"_rapiAccess",void 0),n([i],Ue.prototype,"_dataSyncer",void 0),n([i],Ue.prototype,"_errorHandler",void 0),n([i],Ue.prototype,"_unitFormatter",void 0),n([i],Ue.prototype,"_idbManager",void 0),n([i],Ue.prototype,"_domHelper",void 0),n([i],Ue.prototype,"_configuratorUiCallbacks",void 0),n([i],Ue.prototype,"_configuratorKernelAccessCallback",void 0),n([i],Ue.prototype,"_lifeCycleManager",void 0),n([i],Ue.prototype,"_plannerKernelAccess",void 0),n([i],Ue.prototype,"_scriptLoader",void 0),n([i],Ue.prototype,"_configuratorContext",void 0),n([i],Ue.prototype,"_initData",void 0),n([i],Ue.prototype,"_globalInitData",void 0),n([i],Ue.prototype,"_globalCallback",void 0),n([i],Ue.prototype,"_kernelIo",void 0),n([i],Ue.prototype,"_configuratorHistory",void 0)}}}));
2
+ //# sourceMappingURL=roomle-configurator-0efacaed.nomodule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roomle-configurator-0efacaed.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{_ as __decorate,i as inject,b as RoomleDependencyInjection,c as convertToThreeMatrix,d as isUVIdentityMatrix,e as convertToThreeUVMatrix,m as mergeGeometries,B as Benchmark,f as AsyncHelper,g as convertToEuler,h as DOCKING_CONVERSATION_ID,k as kernelBoxToThreeBox,j as AsyncGuard,C as ConfigurableConstructionPlanObjectViewModel,l as ConfiguratorPlanObjectViewModel,n as ConstructionPlanObjectViewModel,S as StaticPlanObjectViewModel,M as MeasurementLinePlanElementViewModel,W as WallAtticPlanElementViewModel,o as WallPlanElementViewModel,F as FloorPlanElementViewModel,p as CeilingPlanElementViewModel,N as NodePlanElementViewModel,P as PlannerKernelAccess,E as EventDispatcher,q as compareBox3Size,v as vectorIsZero,r as disposeMesh,s as convertToKernel,t as toRadiant,u as getScreenXY,w as CANVAS_ID,x as Env,y as DynamicLightSettingLoader,z as PREDEFINED_LIGHTSETTING,G as ImageRenderer,H as createEmptySceneFromCurrent,J as dispose,K as getYRotationOfObject,O as getIdealDistance,Q as getHostname,T as toDegrees,U as DEFAULT_CONVERSATION_ID,V as getCatalogIdFromItemOrConfigurationId,X as isIdItemId,A as AppContext,Y as isRange,Z as sortBySort,$ as isMaterial,a0 as convertCObject,a1 as sortByString}from"./roomle-dependency-injection-2c9062d2.js";import{R as RoomleComponentFactoryInitializer,b as CameraBehaviour,S as SceneManager,P as PULSE_LOOPS,c as PULSE_DURATION,B as BackgroundEnvironment,D as DISTANCE_FACTOR,C as CameraControl3D,F as FloorEnvironment,T as TWEEN_FILE_NAME}from"./camera-behaviour-24973bc6.js";import{z as Mesh,B as BufferGeometry,O as Object3D,ad as Box3,K as Group,aE as CAMERA_TYPE,a as Vector3,bz as Raycaster,bA as Plane,V as Vector2,Q as Quaternion,bx as Layers,aC as deepMerge,bB as callAgainAfter,bC as debounce,bD as nextTick,aF as getColor,ag as Euler,bE as areCameraParametersEqual,aD as ROOMLE_HIGHLIGHTNG,bF as download}from"./main-thread-to-worker-352ff4b1.js";import{D as DefaultLightSetting}from"./default-light-setting-20f64f6d.js";class ConfiguratorViewModel{constructor(e){this._mergeThreshold=3,this._componentsToMerge=new OccurrenceMap,this._mergeInProgress=!1,this._components=new Map,this._previews=new Map,this._componentNumberOfPossibleChildren=new Map,this._creator_=e,this._getKernelAccess().addConfiguratorListener(this),this._componentFactory=RoomleComponentFactoryInitializer()}get materialQueue(){return this.getMeshGenerator().materialQueue}_getKernelAccess(){return RoomleDependencyInjection.lookup("planner-kernel-access",this._creator_)}_applyMeshTransform(e,t,n,o,i,r,s){if(o){const e=t.userData.transform=convertToThreeMatrix(o);n&&(t.userData.transform=e),t.applyMatrix4(e)}this._applyMeshUVTransform(t,n,i,s),this._addMeshAnimations(e,t,r)}_applyMeshUVTransform(e,t,n,o){if(6!==(null==n?void 0:n.length)||isUVIdentityMatrix(n))t&&(t.uvTransform=void 0),o&&(e.geometry=o);else{const i=convertToThreeUVMatrix(n);t&&(t.uvTransform=i);const r=null!=o?o:e.geometry;if(r&&r.attributes.uv){const t=r.clone();t.attributes.uv.applyMatrix4(i),e.geometry=t}}}_addMeshAnimations(e,t,n){n||(t.userData.animations=void 0);const o=new Map;for(const e in n)o.set(e,convertToThreeMatrix(n[e]));t.userData.animationMatrixMap=o,this._setComponentAnimationMatrix(e,t)}_setComponentAnimationMatrix(e,t){var n,o;if((null===(n=t.userData)||void 0===n?void 0:n.animationMatrixMap)&&(null===(o=t.userData)||void 0===o?void 0:o.transform)&&this.getComponent(e).animations)for(const e in t.userData.animationMatrixMap){const n=t.userData.animationMatrixMap.get(e);if(n){const e=t.userData.transform.clone().multiply(n);t.applyMatrix4(e)}}}_animateComponent(e,t,n,o,i){const r=t.split(":")[1];e.animateMeshes&&e.animateMeshes(r,n,o,i,this._invalidateRenderCallback)}updateAnimationParameters(e,t){const n=[];for(const e of t)e.key.startsWith("animation:")&&n.push(e);if(0===n.length)return;const o=Array.isArray(e)?e:[e];for(const e of o){const t=this.getComponentFromElementId(e);if(null==t?void 0:t.animationValues)for(const e of n){const n=e.key.split(":")[1],o=t.animationValues.get(n);o&&(e.value=o)}else if(t){t.animationValues=new Map;for(const e of n){const n=e.key.split(":")[1];t.animationValues.set(n,e.value)}}}}changeAnimationValue(e,t,n,o,i){const r=this.getComponentFromElementId(e);r&&(o?r.traverse(e=>{e.id&&this._changeAnimationValue(e,t,n,i)}):this._changeAnimationValue(r,t,n,i))}_changeAnimationValue(e,t,n,o){e.animationValues||(e.animationValues=new Map);const i=t.split(":")[1],r=e.animationValues.get(i);e.animationValues.set(i,n),this._animateComponent(e,t,r,n,o)}getComponentFromElementId(e){let t=this.getComponent(e);if(!t){const n=this._getKernelAccess().kernelInstance.getRootPlanComponentIdFromObjectId(e);t=this.getComponent(n)}return t||console.warn("component not found!",e),t}_addMeshToSubPart(e,t,n,o,i,r,s,a,c,l,h){const d=this._generateMesh(e,t,n,r,s,a,c,void 0,void 0,l);this._applyMeshTransform(e,d,null,o,i,h),this._subPartObject.add(d)}_addMeshToComponent(e,t,n,o,i,r,s,a,c,l,h,d,_){if(this._subPartGuard&&this._subPartGuard.info===e)return void this._addMeshToSubPart(e,null,o,null,null,s,a,c,l,d,_);const u=this.getComponent(e);if(!u)return;const g=this._componentFactory.isPreview(u),m=this._generateMesh(e,n,g?null:o,s,a,c,l,void 0,void 0,d);m.userData.meshId=t,m.userData.geometryId=n,m.userData.materialId=o,this._applyMeshTransform(e,m,m.userData,i,r,_),g&&m.layers.set(5),u&&u.addMesh(m),u.meshes.length>this._mergeThreshold&&this._componentsToMerge.set(e,u.meshes.length)}_changeMeshOfComponent(e,t,n,o,i,r,s,a){const c=this.getComponent(e);if(!c)return;const l=c.getMeshById(t);if(l){l.userData.geometryId!==n&&console.warn("Geometry of mesh has changed!"),l.userData.materialId=o,l.userData.materialAttributes=s;const t=l.material.clone();this._configuratorMeshGenerator.setMaterial(l,o,void 0,s).then(()=>{this._requestRenderSceneUpdateCallback&&this._requestRenderSceneUpdateCallback()}),t.opacity!==l.material.opacity&&this._requestRenderCallback&&this._requestRenderCallback(),i&&(l.position.set(0,0,0),l.scale.set(1,1,1),l.rotation.set(0,0,0));const c=this._configuratorMeshGenerator.getGeometry(n);this._applyMeshTransform(e,l,l.userData,i,r,a,c)}}_removeMeshFromComponent(e,t){const n=this.getComponent(e);n&&n.removeMeshById(t)}getComponent(e){let t=this._components.get(e);return t||(t=this._previews.get(e.toString()),t)?t:null}getNumberOfPossibleChildrenForComponent(e){if(this._componentNumberOfPossibleChildren.has(e))return this._componentNumberOfPossibleChildren.get(e);const t=this._getKernelAccess().kernelInstance.getPlanComponentPossibleChildren(e).length;return this._componentNumberOfPossibleChildren.set(e,t),t}tryToMergeComponents(){this._initData.moc||this._mergeInProgress||(this._mergeInProgress=!0,this._componentsToMerge.size,this._requestMergeComponents())}_requestMergeComponents(){window.requestIdleCallback(this._mergeNextComponent.bind(this))}_mergeNextComponent(){if(this._componentsToMerge.size>0){const e=this._componentsToMerge.largestValue();this._componentsToMerge.delete(e),this._mergeComponent(e),this._requestMergeComponents()}else this._mergeInProgress=!1,this._geometriesMerged&&this._geometriesMerged(),this._components.forEach(e=>{e.loadingMesh&&console.warn("component still has loading mesh: ",e.hash)})}_mergeComponent(e){const t=this._components.get(e);if(t&&!(t.meshes.length<=this._mergeThreshold))if(this._cacheHolder.componentCache.has(t.hash)){const e=this._cacheHolder.componentCache.get(t.hash).meshes;t.replaceMeshes(e)}else{const e=new Map,n=[],o=[];t.meshes.forEach(t=>{const i=t.userData.materialId;if(!i)return void console.warn("mesh has no material id set");if(!e.has(i)){const o=new Mesh(new BufferGeometry,t.material);o.userData.materialId=i,o.receiveShadow=!0,o.castShadow=!0,o.layers.set(3),this._setMaterial(o,i),n.push(o),e.set(i,o)}const r=e.get(i),s=r.geometry;t.userData.transform&&t.geometry.applyMatrix4(t.userData.transform),r.geometry=mergeGeometries([s,t.geometry]),o.push(t)}),n.forEach(e=>t.addMesh(e)),o.forEach(e=>t.removeMesh(e)),this._cacheHolder.componentCache.set(t.hash,t)}}_addComponent(e){this._listener&&e.isRootComponent&&this._listener.display(e)}removeDockingComponent(){this._getKernelAccess().requestDeleteComponent(this._configuratorContext.dockingRootComponentId),this._configuratorContext.dockingRootComponentId=null}dockComponent(e,t,n,o,i){let r=this._components.get(n),s=this._components.get(e);s&&(s.roomlePosition=o,s.roomleRotation=i,r&&r.add(s),s.parentObjectId=n,s.isRootComponent=t,this._addComponent(s))}dockComponentWithPosition(e,t){let n,o=this._components.get(e.parentId);n=t?t.getKernelPosition(o):e.getKernelPosition(o),Benchmark.start("dock_component_with_position_"+e.childId),this._getKernelAccess().dockComponentWithPosition(e.parentId,e.parentDockId,e.childId,e.childDockId,n),this._configuratorContext.dockingRootComponentId=null}removePreviews(){this._previews.size>0&&(this._previews.forEach(e=>{e.removeFromParent(),e.removeAllMeshes()}),this._previews.clear())}_updatePlanObject(e,t){const n=this._components.get(e.rootPlanComponentId);let o=!0;n&&(o=n.geometryChanged),this._listener&&this._listener.planObjectUpdated(e,o,t)}Editor3dAddDockPreview(e,t){const n=this._componentFactory.createPreview(t,e,this._creator_);this._previews.set(t.toString(),n)}Editor3dAddMesh(e,t,n,o,i,r){this._addMeshToComponent(e,t,n,i.materialId,i.transform,i.uvTransform,r.vertices,r.indices,r.uvCoords,r.normals,o,i.materialAttributes,i.animations)}Editor3ChangedMesh(e,t,n,o){this._changeMeshOfComponent(e,t,n,o.materialId,o.transform,o.uvTransform,o.materialAttributes,o.animations)}Editor3dRemoveMesh(e,t){this._removeMeshFromComponent(e,t)}Editor3dBeginConstruction(e,t){if(!t){const t=this._components.get(e);t&&t.removeAllMeshes()}this._subPartGuard&&e===this._subPartGuard.info&&(this._subPartObject=new Object3D)}Editor3dComponentCreated(e,t,n,o,i){o&&(this._configuratorContext.rootComponentId=e);let r=null;this._components.has(e)?(r=this._components.get(e),r.removeAllMeshes()):(r=this._componentFactory.create(e,t,n,i,o),r.layers.set(3)),this._components.set(e,r),this._addComponent(r)}Editor3dComponentDocked(e,t,n,o,i){this.dockComponent(e,t,n,o,i)}Editor3dEndConstruction(e){if(this._subPartGuard&&this._subPartGuard.info===e)return void this._subPartGuard.resolve(this._subPartObject);const t=this._getKernelAccess().kernelInstance.getComponent(e),n=this._components.get(e);n&&(n.computeBoundingBox(t.boxForMeasurement),n.boundingBoxMesh&&this._listener&&this._listener.addComponentHandlers(n));let o=this._previews.get(e.toString());o&&o.computeBoundingBox(t.boxForMeasurement,!0)}Editor3dGeometryReady(e){const t=this._components.get(e);t&&t.loadingFinished()}Editor3dGeometryNotReady(e){const t=this._components.get(e);t&&t.loading()}Editor3dPlanObjectConstructionDone(e){const t=this._getKernelAccess().kernelInstance.getPlanObject(e),n=[t,this._getKernelAccess().kernelInstance.getFullPartList(),this._getKernelAccess().kernelInstance.getHashOfConfiguration(e),this._getKernelAccess().kernelInstance.getComponentId(t.rootPlanComponentId)];AsyncHelper.finishOperation(2,n),this._updatePlanObject(t,!1),this._listener&&this._listener.planObjectConstructionDone(t)}Editor3dPreviewConstructionDone(e,t){let n=!1;this._previews.forEach(e=>{null!==e.parent&&(this._listener&&(this._componentFactory.isPreviewLine(e)?this._listener.addPreviewLineHandlers(e):this._listener.addPreviewHandlers(e)),n=!0)}),this._listener&&this._listener.previewConstructionDone(this._components.get(e),n)}Editor3dSetPreviewLineAssociations(e,t){let n=this._previews.get(t.toString());if(n.clear(),!n)return;let o=this._componentFactory.createPreviewLine(n,this._creator_),i=this._components.get(this._configuratorContext.rootComponentId);for(let t=0;t<e.length;t++){let n;n=0===t?o:o.clonePreviewLine(t),n.name="Preview Line",n.parentDockId=e[t].parentDockId,n.parentId=e[t].parentId,n.childDockId=e[t].childDockId,n.childId=e[t].childId,n.docklineRotation=convertToEuler(e[t].rotation),n.roomlePosition=e[t].position,n.roomleLineFrom=e[t].lineFrom,n.roomleLineTo=e[t].lineTo,n.lineSegments=[];for(const o of e[t].lineSegments)n.lineSegments.push({from:o.from/1e3,to:o.to/1e3});n.roomlePositionFrom=e[t].positionFrom,n.roomlePositionTo=e[t].positionTo,i.add(n),n.preparePreview(),this._previews.set(n.stringId,n)}}Editor3dSetPreviewPointAssociations(e,t){let n=this._previews.get(t.toString());if(!n)return;let o=this._components.get(this._configuratorContext.rootComponentId);for(let t=0;t<e.length;t++){let i;0===t?i=n:(i=n.clonePreview(t),this._previews.set(i.stringId,i)),i.name="Preview Point",i.parentDockId=e[t].parentDockId,i.parentId=e[t].parentId,i.childDockId=e[t].childDockId,i.childId=e[t].childId,i.preparePreview(),i.receivedPointAssociation=!0,i.userData.ignoreComponentRaycast=!0,o.add(i);let r=e[t].position;i.roomlePosition=r,i.roomleRotation=e[t].rotation,i.startPulsating()}}componentDeleted(e){const t=this._components.get(e);t&&(this._listener&&this._listener.componentDeleted(t),t.removeFromParent(),t.removeAllMeshes(),this._components.delete(e))}componentMetaUpdated(e){const t=this._getRuntimeComponent(e.id);t&&(t.hash=e.hash,t.roomlePosition=e.position,t.roomleRotation=e.rotation,e.boxForMeasurement&&t.computeBoundingBox(e.boxForMeasurement),this._listener&&this._listener.componentUpdated(t,e))}componentConfigurationUpdated(e,t){const n=this._getRuntimeComponent(e);n&&(n.geometryChanged=t)}_getRuntimeComponent(e){let t=this._components.get(e);return t||(t=this._previews.get(e.toString()),t)?t:null}configurationLoaded(e,t,n,o,i){e===DOCKING_CONVERSATION_ID&&(this._configuratorContext.dockingRootComponentId=n);let r=0===t;r?this._getKernelAccess().kernelInstance.requestPlanComponentConstructionRecursive(n):this._getKernelAccess().kernelInstance.requestPlanObjectConstruction(t);let s=this._getKernelAccess().kernelInstance.getComponent(n),a=this._components.get(n);a&&(a.computeBoundingBox(s.boxForMeasurement),a.hash=s.hash),this._listener&&this._listener.configurationLoaded(a,r&&void 0!==a.boundingBoxMesh)}finishParameterChange(e,t){this.materialQueue.registerCallback(e)}planObjectConfigurationUpdated(e,t,n,o){let i=this._getKernelAccess().kernelInstance.getPlanObject(e);this._updatePlanObject(i,o)}planObjectCreated(e,t){this._configuratorContext.planObjectId=t,this._listener&&this._listener.clearScene()}planObjectUpdated(e,t){this._updatePlanObject(e,t)}sceneCleared(){this._components.forEach((function(e){e.removeFromParent(),e.removeAllMeshes()})),this._components.clear(),this._componentNumberOfPossibleChildren.clear(),this._previews.forEach(e=>{e.removeFromParent(),e.removeAllMeshes()}),this._previews.clear()}setListener(e){this._listener=e}getBoundingBox(){if(this._configuratorContext.planObjectId){const e=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);if(e&&e.boxForMeasurement)return kernelBoxToThreeBox(e.boxForMeasurement)}else if(this._configuratorContext.rootComponentId){const e=this._components.get(this._configuratorContext.rootComponentId);return(new Box3).setFromObject(e)}return null}getBoundingBoxOfGeometry(){if(this._configuratorContext.planObjectId){const e=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);if(e&&e.boxOfGeometry)return kernelBoxToThreeBox(e.boxOfGeometry)}else if(this._configuratorContext.rootComponentId){const e=this._components.get(this._configuratorContext.rootComponentId);return(new Box3).setFromObject(e)}return null}getBoundingBoxWithPreviews(){const e=this._components.get(this._configuratorContext.rootComponentId);return e?(new Box3).setFromObject(e):null}hasPreviews(){return this._previews.size>0}clearRootComponent(){var e;null===(e=this._components.get(this._configuratorContext.rootComponentId))||void 0===e||e.hoverOff()}debugSceneGraph(e){e?this._components.has(e)?this._components.get(e):this._previews.has(e.toString())&&this._previews.get(e.toString()):this._configuratorContext}getComponentsForIds(e){let t=[];return e.forEach(e=>{const n=this._components.get(e);n&&t.push(n)}),t}getComponents(){return Array.from(this._components.values())}getPreviews(){return Array.from(this._previews.values())}hasPreviewLines(){for(const e of this._previews.values())if(this._componentFactory.isPreviewLine(e))return!0;return!1}isPreviewLine(e){return this._componentFactory.isPreviewLine(e)}isPreview(e){return this._componentFactory.isPreview(e)}setGeometriesMergedListener(e){this._geometriesMerged=e}removeGeometriesMergedListener(){this._geometriesMerged=void 0}setMergeThreshold(e){this._mergeThreshold=e}_generateMesh(e=0,t=null,n,o,i,r,s,a,c,l){return this._configuratorMeshGenerator.generateMesh(e,t,n,o,i,r,s,!1,l)}_setMaterial(e,t,n){this._configuratorMeshGenerator.setMaterial(e,t)}constructComponents(e){this._getKernelAccess().kernelInstance.requestPlanObjectConstruction(e)}requestSubPartConstruction(e){return this._subPartGuard=new AsyncGuard(e),this._getKernelAccess().requestPlanComponentConstruction(e,!1),this._subPartGuard.wait()}getMeshGenerator(){return this._configuratorMeshGenerator}setRequestRenderCallback(e){this._requestRenderCallback=e}setRequestRenderSceneUpdateCallback(e){this._requestRenderSceneUpdateCallback=e}setInvalidateRenderCallback(e){this._invalidateRenderCallback=e}}__decorate([inject],ConfiguratorViewModel.prototype,"_configuratorMeshGenerator",void 0),__decorate([inject],ConfiguratorViewModel.prototype,"_configuratorContext",void 0),__decorate([inject],ConfiguratorViewModel.prototype,"_cacheHolder",void 0),__decorate([inject],ConfiguratorViewModel.prototype,"_initData",void 0);class OccurrenceMap extends Map{largestValue(){let e=this.entries().next().value[0],t=0;return this.forEach((n,o)=>{n>t&&(e=o,t=n)}),e}}class PlanViewModel extends ConfiguratorViewModel{constructor(e){super(e),this._configurablePlanObjectViewModels=[],this._configurableConstructionPlanObjectViewModels=[],this._staticPlanObjectViewModels=[],this._constructionPlanObjectViewModels=[],this._wallPlanObjectViewModels=[],this._measurementLinePlanObjectViewModels=[],this._wallAtticsPlanObjectViewModels=[],this._floorPlanObjectViewModels=[],this._nodePlanObjectViewModels=[],this._constructionGroup=new Group,this._constructionGroup.name="Construction",this._ceilingGroup=new Group,this._ceilingGroup.name="Ceiling",this._floorGroup=new Group,this._floorGroup.name="Floor",this._measurementLineGroup=new Group,this._measurementLineGroup.name="Measurement Line",this._wallAtticsGroup=new Group,this._wallAtticsGroup.name="Wall Attics",this._getKernelAccess().addPlannerListener(this)}get latestWallPlanObjectViewModel(){return this._latestWallPlanObjectViewModel}get latestNodePlanObjectViewModel(){return this._latestNodePlanObjectViewModel}startedDrawing(){}stoppedDrawing(){}planBoundsChanged(){}setReference(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null}getCorePlan(){return this._coreReference}addPlanElementViewModel(e){e instanceof ConfigurableConstructionPlanObjectViewModel?this._handleConfiguratorConstructionPlanObjectViewModel(e):e instanceof ConfiguratorPlanObjectViewModel?this._handleConfiguratorPlanObjectViewModel(e):e instanceof ConstructionPlanObjectViewModel?this._handleConstructionPlanObjectViewModel(e):e instanceof StaticPlanObjectViewModel?this._handleStaticPlanObjectViewModel(e):e instanceof MeasurementLinePlanElementViewModel?this._handleMeasurementLinePlanElementViewModel(e):e instanceof WallAtticPlanElementViewModel?this._handleWallAtticPlanElementViewModel(e):e instanceof WallPlanElementViewModel?this._handleWallPlanElementViewModel(e):e instanceof FloorPlanElementViewModel?this._handleFloorPlanElementViewModel(e):e instanceof CeilingPlanElementViewModel?this._handleCeilingPlanElementViewModel(e):e instanceof NodePlanElementViewModel&&this._handleNodePlanElementViewModel(e)}_handleConfiguratorPlanObjectViewModel(e){this._configurablePlanObjectViewModels.push(e),this._linkPlanObjectViewModelAndComponent(e)}_linkPlanObjectViewModelAndComponent(e){const t=e.getConfigurationRuntimeId();if(t>0)for(const e of this._components.values())if(e.parentObjectId===t||e.runtimeId===t){this._addComponent(e);break}}_detachPlanObjectViewModelFromComponent(e){const t=e.getConfigurationRuntimeId();if(t>0)for(const e of this._components.values())if(e.parentObjectId===t||e.runtimeId===t){e.isChildPlanObject=!1;break}}_handleConfiguratorConstructionPlanObjectViewModel(e){e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D),this._configurableConstructionPlanObjectViewModels.push(e)}_handleConstructionPlanObjectViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addConstructionPlanObjectHandlers(e),e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D),this._constructionPlanObjectViewModels.push(e)}_handleStaticPlanObjectViewModel(e){this._staticPlanObjectViewModels.push(e),this.commonHandlerForEditableAndTopView(e)}_handleMeasurementLinePlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addMeasurementLineHandlers(e),e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D),e.getPoint1Draggable().scale.setScalar(this._nodeZoom),e.getPoint2Draggable().scale.setScalar(this._nodeZoom),this._measurementLinePlanObjectViewModels.push(e),this._measurementLineGroup.add(e.getContainer())}_handleWallAtticPlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addWallAtticHandlers(e),e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D),this._wallAtticsPlanObjectViewModels.push(e),this._wallAtticsGroup.add(e.getContainer())}_handleWallPlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addWallHandlers(e),e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D),this._wallPlanObjectViewModels.push(e),this._latestWallPlanObjectViewModel=e,this._constructionGroup.add(e.getContainer())}_handleFloorPlanElementViewModel(e){const t=e.getContainer();t.name="Floor",this._initData.edit&&this._plannerSceneEventHandler.addFloorHandlers(e),this._floorPlanObjectViewModels.push(e),this._floorGroup.add(t)}_handleCeilingPlanElementViewModel(e){this._ceilingGroup.add(e.getContainer())}_handleNodePlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addNodeHandlers(e),e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D),e.setZoom(this._nodeZoom),this._nodePlanObjectViewModels.push(e),this._latestNodePlanObjectViewModel=e,this._constructionGroup.add(e.getContainer())}commonHandlerForEditableAndTopView(e){this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(e),e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D)}dockComponent(e,t,n,o,i){var r;null===(r=this._plannerSceneEventHandler)||void 0===r||r.cancelSelection("dock_component"),super.dockComponent(e,t,n,o,i)}_addComponent(e){const t=e.isRootComponent?e.parentObjectId:e.runtimeId,n=this._getPlanObjectViewModelForRuntimeId(t);n&&n instanceof ConfiguratorPlanObjectViewModel&&(e.isRootComponent?n.addRootComponent(e):n.addChildEntityComponent(e),this._initData.edit&&(n instanceof ConfigurableConstructionPlanObjectViewModel?this._plannerSceneEventHandler.addConstructionPlanObjectHandlers(n):this._plannerSceneEventHandler.addPlanObjectHandlers(n)),n.hidePreviewBox())}_getPlanObjectViewModelForRuntimeId(e){let t=null;return[...this._configurableConstructionPlanObjectViewModels,...this._configurablePlanObjectViewModels].forEach(n=>{e===n.getConfigurationRuntimeId()&&(t=n)}),t}getConfigurablePlanObjectForId(e){for(const t of[...this._configurableConstructionPlanObjectViewModels,...this._configurablePlanObjectViewModels])if(e===t.getId())return t;return null}getStaticPlanObjectForId(e){for(const t of this._staticPlanObjectViewModels)if(e===t.getId())return t;return null}getConstructionObjectForId(e){for(const t of this._constructionPlanObjectViewModels)if(e===t.getId())return t;return null}getStaticPlanObjectViewModelForId(e){return this.getStaticPlanObjectForId(e)||this.getConstructionObjectForId(e)}getPlanObjectForId(e){const t=this.getConfigurablePlanObjectForId(e);if(t)return t;const n=this.getStaticPlanObjectForId(e);if(n)return n;for(const t of this._nodePlanObjectViewModels)if(e===t.getId())return t;for(const t of this._wallPlanObjectViewModels)if(e===t.getId())return t;for(const t of this._measurementLinePlanObjectViewModels)if(e===t.getId())return t;for(const t of this._floorPlanObjectViewModels)if(e===t.getId())return t;for(const t of this._constructionPlanObjectViewModels)if(e===t.getId())return t;return null}getPlanObjectViewModelsFromRapiId(){return[...this._configurablePlanObjectViewModels,...this._configurableConstructionPlanObjectViewModels,...this._staticPlanObjectViewModels]}getPlanObjectCount(){return this._configurablePlanObjectViewModels.length+this._configurableConstructionPlanObjectViewModels.length+this._staticPlanObjectViewModels.length}getConstructionGroup(){return this._constructionGroup}getCeilingGroup(){return this._ceilingGroup}getFloorGroup(){return this._floorGroup}getMeasurementLineGroup(){return this._measurementLineGroup}getWallAtticsGroup(){return this._wallAtticsGroup}getBoundingBox(){if("configurator"===this._configuratorContext.baseContext){const e=this.getPlanObjectForId(this._configuratorContext.planElementId);if(e)return e.getBounds()}if("glb-viewer"===this._configuratorContext.baseContext){const e=this._plannerSceneEventHandler.getSelectedIds();if(e&&1===e.length){const t=this.getPlanObjectForId(e[0]);if(t)return t.getBounds()}}const e=this.getCorePlan();if(e)try{return kernelBoxToThreeBox(e.getBounds())}catch(e){console.error(e)}const t=new Box3;t.expandByObject(this._constructionGroup);for(const e of this._staticPlanObjectViewModels)t.expandByObject(e.getContainer());for(const e of this._configurablePlanObjectViewModels)t.expandByObject(e.getContainer());for(const e of this._configurableConstructionPlanObjectViewModels)t.expandByObject(e.getContainer());return t}getBoundingBoxOfGeometry(){return this.getBoundingBox()}setPlannerSceneEventHandler(e){this._plannerSceneEventHandler=e}getStaticPlanObjectViewModels(){return this._staticPlanObjectViewModels}getConfigurablePlanObjectViewModels(){return this._configurablePlanObjectViewModels}getConfigurableConstructionPlanObjectViewModels(){return this._configurableConstructionPlanObjectViewModels}getConstructionPlanObjectViewModels(){return this._constructionPlanObjectViewModels}getWallPlanObjectViewModels(){return this._wallPlanObjectViewModels}getNodePlanObjectViewModels(){return this._nodePlanObjectViewModels}getFloorPlanObjectViewModels(){return this._floorPlanObjectViewModels}getMeasurementLineObjectViewModels(){return this._measurementLinePlanObjectViewModels}getWallAtticsObjectViewModels(){return this._wallAtticsPlanObjectViewModels}_generateMesh(e=0,t=null,n,o,i,r,s,a,c,l){return this._plannerMeshGenerator.generateMesh(e,t,n,o,i,r,s,a,c,l)}_setMaterial(e,t,n,o){this._plannerMeshGenerator.setMaterial(e,t,n,o)}Editor3dComponentCreated(e,t,n,o,i){super.Editor3dComponentCreated(e,t,n,o,i),this._getKernelAccess()instanceof PlannerKernelAccess&&this.dockComponent(e,o,i,t,n)}addPlanObjectToScene(e){}handlerSwitchedPlans(e,t){this._constructionGroup.clear(),this._ceilingGroup.clear(),this._floorGroup.clear(),this._measurementLineGroup.clear(),this._wallAtticsGroup.clear()}planCompletelyLoaded(e){}beginPlanConstruction(e){}addPlanMesh(e,t,n,o,i,r,s){}endPlanConstruction(e){}planElementChanged(e,t){}planObjectConfigurationLoaded(e,t,n){const o=this.getConfigurablePlanObjectForId(t.getId());if(!o)return void console.warn("planObjectConfigurationLoaded but no view model found");n?o.finishConstruction():o.failConstruction();const i=t.extRef.jsObject;i instanceof ConfiguratorPlanObjectViewModel&&this._linkPlanObjectViewModelAndComponent(i)}addMesh(e,t,n,o,i,r){const s=e.extRef.jsObject;let a=s.getMesh(t);a?a.geometry=this._plannerMeshGenerator.generateGeometry(null,n,o,i,r):(a=this._generateMesh(0,null,t,n,o,i,r,e.getType()),s.addMesh(a))}removePlanObjectFromScene(e){const t=e.getPlanElement().getType();this._isConstructionType(t)?this._constructionGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.FLOOR?this._floorGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.CEILING?this._ceilingGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.MEASURE?this._measurementLineGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.ATTIC&&this._wallAtticsGroup.remove(e.getContainer()),e.clear()}_isConstructionType(e){return e===this._getKernelAccess().kernelContainer.PlanElementType.WALL||e===this._getKernelAccess().kernelContainer.PlanElementType.NODE}planElementRemoved(e){var t;const n=null===(t=e.extRef)||void 0===t?void 0:t.jsObject;n instanceof ConfigurableConstructionPlanObjectViewModel?this._removeObject(this._configurableConstructionPlanObjectViewModels,n):n instanceof ConfiguratorPlanObjectViewModel?(this._detachPlanObjectViewModelFromComponent(n),this._removeObject(this._configurablePlanObjectViewModels,n)):n instanceof ConstructionPlanObjectViewModel?this._removeObject(this._constructionPlanObjectViewModels,n):n instanceof StaticPlanObjectViewModel?this._removeObject(this._staticPlanObjectViewModels,n):n instanceof FloorPlanElementViewModel?this._removeObject(this._floorPlanObjectViewModels,n):n instanceof WallPlanElementViewModel?this._removeObject(this._wallPlanObjectViewModels,n):n instanceof NodePlanElementViewModel?this._removeObject(this._nodePlanObjectViewModels,n):n instanceof MeasurementLinePlanElementViewModel?this._removeObject(this._measurementLinePlanObjectViewModels,n):n instanceof WallAtticPlanElementViewModel&&this._removeObject(this._wallAtticsPlanObjectViewModels,n)}_removeObject(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}getMeshGenerator(){return this._plannerMeshGenerator}componentConfigurationUpdated(e,t){super.componentConfigurationUpdated(e,t)}hideAllExcept(e){this._ceilingGroup.visible=!1,this._floorGroup.visible=!1,this._measurementLineGroup.visible=!1,this._wallAtticsGroup.visible=!1,this._constructionGroup.visible=!1,this._staticPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._configurablePlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._configurableConstructionPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._constructionPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)})}showAll(){this._ceilingGroup.visible=this._cameraType===CAMERA_TYPE.CAMERA_FP,this._floorGroup.visible=!0,this._measurementLineGroup.visible=!0,this._wallAtticsGroup.visible=!0,this._constructionGroup.visible=!0,this._staticPlanObjectViewModels.forEach(e=>e.getContainer().visible=!0),this._configurablePlanObjectViewModels.forEach(e=>e.getContainer().visible=!0),this._configurableConstructionPlanObjectViewModels.forEach(e=>e.getContainer().visible=!0),this._constructionPlanObjectViewModels.forEach(e=>e.getContainer().visible=!0)}planHistoryStateChanged(){}setNodeVisibility(e){this._nodePlanObjectViewModels.forEach(t=>t.setTopView(e))}async setCameraType(e){this._cameraType=e;const t=[];this._wallPlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D)),this._measurementLinePlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D)),this._wallAtticsPlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D)),this._nodePlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D)),this._configurablePlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D)),this._constructionPlanObjectViewModels.forEach(e=>t.push(e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D))),this._configurableConstructionPlanObjectViewModels.forEach(e=>t.push(e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D))),await Promise.all(t)}get cameraType(){return this._cameraType}setNodeZoom(e){e=Math.min(4,e),this._nodeZoom=e;for(const t of this._nodePlanObjectViewModels)t.setZoom(e);for(const t of this._measurementLinePlanObjectViewModels)t.getPoint1Draggable().scale.setScalar(e),t.getPoint2Draggable().scale.setScalar(e)}planCleared(){[this._configurablePlanObjectViewModels,this._configurableConstructionPlanObjectViewModels,this._staticPlanObjectViewModels,this._wallPlanObjectViewModels,this._measurementLinePlanObjectViewModels,this._nodePlanObjectViewModels,this._floorPlanObjectViewModels,this._constructionPlanObjectViewModels,this._wallAtticsPlanObjectViewModels].forEach(e=>{e.forEach(e=>e.remove()),e.length=0})}requestCatalogItem(e){}}__decorate([inject],PlanViewModel.prototype,"_plannerMeshGenerator",void 0),__decorate([inject],PlanViewModel.prototype,"_roomlePlannerUiCallback",void 0);const RAYCAST_PRIORITY={RAYCASTER_FLOOR:.8,FLOOR:.9,WALL:.95,DEFAULT:1,CONSTRUCTION:1,COMPONENT:2,PREVIEW:3,PREVIEW_LINE:4},ROTATION_TO_DETECT_SIDE=toRadiant(30);class RaycastHelper extends EventDispatcher{constructor(e,t,n,o){super(),this._offset=new Vector3(0,0,0),this._lastMoveCheck=0,this._onWallSnapping=!1,this._mode=void 0===o?1:o,this._object=e,this._camera=t,this._raycaster=new Raycaster,this._raycaster.layers.disableAll(),this._inputManager=n,this._addInputListeners(n),this._planeBottom=new Plane(new Vector3(0,1,0)),this._planeFront=new Plane(new Vector3(0,0,1)),this._planeSide=new Plane(new Vector3(1,0,0))}setLayers(e){this._raycaster.layers=e}getLayers(){return this._raycaster.layers}_addInputListeners(e){e.addEventListener(3,e=>{this._findCandidate(e.positionRelative)},this),e.addEventListener(5,e=>{this._findSelection(e.positionRelative)},this),e.addEventListener(12,e=>{this._findSelection(e.positionRelative,!0,e.type)},this),e.addEventListener(14,e=>{this._findSelection(e.positionRelative,!0,e.type)},this),e.addEventListener(6,e=>{Date.now()-this._lastMoveCheck>32&&(this._findHover(e.positionRelative,e.type),this._lastMoveCheck=Date.now())},this),e.addEventListener(0,e=>{this._onDragStart(e.positionRelative)},this),e.addEventListener(1,e=>{this._onDrag(e.positionRelative)},this),e.addEventListener(2,e=>{this._onDragEnd(e.positionRelative)},this),e.addEventListener(9,e=>{this._onRotate(e.positionRelative,e.rotation)},this),e.addEventListener(10,()=>{this._currentRotate=null},this)}_findCandidate(e){let t=this._intersection(e);t&&!t.object.userData.ignoreElementHit&&0===this._mode&&this._inputManager.onElementHit()}_findSelection(e,t=!1,n=0){let o=this._intersection(e);if(o){if(o){const e=t?"double_click":"select";o.object.dispatchEvent({type:e,attachment:{intersection:o,type:n}})}}else this.dispatchEvent(0)}_findHover(e,t){const n=this._intersection(e);!n&&this._currentHover?(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null):n&&(this._currentHover&&this._currentHover.id!==n.object.id&&(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null),this._currentHover?this._currentHover.dispatchEvent({type:"hover_move",attachment:{intersection:n,type:t}}):(this._currentHover=n.object,this._currentHover.dispatchEvent({type:"hover_on",attachment:{intersection:n,type:t}})))}_intersection(e){var t;if(0===e.x&&0===e.y)return null;const n=this._intersect(e);if(null===(t=window.__RML__DEBUG__)||void 0===t?void 0:t.raycaster){const e=[];for(const t of n)e.push({name:t.object.userData.planElementName,distance:t.distance,priority:t.object.userData.priority});e.length&&console.table(e)}if(n.length<=0)return null;let o=n[0];return n.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&n.forEach(e=>{e.object.id===this._currentHover.id&&e.object.userData.priority===this._currentHover.userData.priority&&o.object.userData.priority<=e.object.userData.priority&&(o=e)}),o}_intersect(e){this._raycaster.setFromCamera(new Vector2(e.x,e.y),this._camera);const t=[];return this._raycaster.intersectObjects(this._object.children,!0).forEach(e=>{const n=this._findObjectWithHandler(e.object);n&&(e.object=n,t.push(e))}),t.length>=0?t.sort((e,t)=>e.object.userData.priority!==t.object.userData.priority?t.object.userData.priority-e.object.userData.priority:compareBox3Size((new Box3).setFromObject(e.object),(new Box3).setFromObject(t.object))<0?-1:e.distance-t.distance):[]}_findObjectWithHandler(e){return e.userData.hasListener?e:e.parent?this._findObjectWithHandler(e.parent):null}_onDragStart(e){let t=this._intersection(e);if(!t&&!this._currentDrag)return;if(t&&t.object.userData.roomleId===this._rootComponentId)return;!this._currentDrag&&t&&(this._currentDrag=t.object,this._currentDrag.dispatchEvent({type:"drag_start"}));let n=this._currentDrag.parent;n&&n.computeBoundingBox&&(n.computeBoundingBox(),this._calculateOffset(n)),this._positionPlanes(n)}_onDrag(e){if(!this._currentDrag)return;this._raycaster.setFromCamera(new Vector2(e.x,e.y),this._camera);let t,n=new Vector3(0,0,-5);if(this._raycaster.ray.intersectPlane(this._planeBottom,n),0===this._mode){const e=this._object.children.find(({type:e,name:t})=>"Group"===e&&"Construction"===t),o=this._currentDrag.userData.snapToWall;if(e&&(this._onWallSnapping||o)){const t=this._raycaster.intersectObjects(e.children,!0);if(t.length){const e=t[0].point.clone();return void this._currentDrag.dispatchEvent({type:"drag",attachment:{position:e}})}}t=n.clone(),t.y=this._currentDrag.parent.position.y}else t=this._getIntersectionPosition(n),t.sub(this._offset);this._currentDrag.dispatchEvent({type:"drag",attachment:{position:t}})}_getIntersectionPosition(e){let t=this._getDistanceToCamera(e),n=this._camera.userData.yaw,o=new Vector3(0,0,0),i=new Vector3(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,o),this._raycaster.ray.intersectPlane(this._planeSide,i);let r,s=this._getDistanceToCamera(i),a=this._getDistanceToCamera(o);return n>=-ROTATION_TO_DETECT_SIDE&&n<=ROTATION_TO_DETECT_SIDE?r=t<a?e.clone():o.clone():t<a&&t<s?r=e.clone():a<t&&a<s?r=o.clone():s<t&&s<a&&(r=i.clone()),r}_getDistanceToCamera(e){let t=e.clone().sub(this._camera.position).length();return vectorIsZero(e)&&(t=Number.POSITIVE_INFINITY),t}_onDragEnd(e){this._currentDrag&&(this._currentDrag.dispatchEvent({type:"drag_end",attachment:{position:e}}),this._currentDrag=null)}_onRotate(e,t){if(!this._currentRotate){let t=this._intersection(e);if(!t)return;this._currentRotate=t.object}this._currentRotate.dispatchEvent({type:"rotate",attachment:{rotation:t}})}_positionPlanes(e){0===this._mode?(this._planeBottom.constant=0,this._camera.userData&&this._camera.userData.pitch&&this._camera.userData.pitch<0&&(this._planeBottom.constant=-3)):e&&e.boundingBox&&this._rootComponentPosition&&(this._planeBottom.constant=-e.boundingBox.getCenter(new Vector3).y-this._rootComponentPosition.y,this._planeSide.constant=2*-e.boundingBox.getSize(new Vector3).x+e.boundingBox.getCenter(new Vector3).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+e.boundingBox.getCenter(new Vector3).z))}_calculateOffset(e){e&&e.boundingBox&&(this._offset.copy(e.boundingBox.getCenter(new Vector3)),this._offset.applyQuaternion(e.getWorldQuaternion(new Quaternion)))}update(e,t,n){if(e&&(this._bounds=e),t&&(this._rootComponentPosition=t),n){this._backgroundScene=n;let e=this._backgroundScene.children[0];e instanceof Mesh&&e.geometry.computeBoundingBox()}}clear(){this._currentDrag&&disposeMesh(this._currentDrag),this._currentHover&&disposeMesh(this._currentHover)}enableDragIn(e){this._currentDrag=e}setRootComponentId(e){this._rootComponentId=e}setCamera(e){this._camera=e}setObject(e){this._object=e}setMode(e){this._mode=e}intersectMouseOnScene(e){const t=new Plane,n=new Vector3;return n.copy(this._camera.position).normalize(),t.setFromNormalAndCoplanarPoint(n,this._object.position),this._raycaster.setFromCamera(new Vector2(e.positionRelative.x,e.positionRelative.y),this._camera),convertToKernel(this._raycaster.ray.intersectPlane(t,new Vector3))}enableOnWallSnapping(){this._onWallSnapping=!0}disableOnWallSnapping(){this._onWallSnapping=!1}}class SceneEventHandler extends EventDispatcher{constructor(e,t,n,o){super(),this._debug=!1,this._dragIn=!1,this._inputManager=o,this._raycastHelper=new RaycastHelper(t,n,this._inputManager),this._creator_=e}isDragIn(){return this._dragIn}setDragIn(e,t){this._dragIn=e,e?this._inputManager.enableDragIn(t):this._raycastHelper.clear(),this._interaction()}}class SceneEventInfo{constructor(e){const{component:t,preview:n,resetCamera:o,consecutive:i,type:r,forceRender:s,reason:a}=e;this.component=t,this.preview=n,this.resetCamera=void 0===o||o,this.consecutive=void 0===i||i,this.type=r||0,this.forceRender=void 0!==s&&s,this.reason=a}}class ConfiguratorSceneEventHandler extends SceneEventHandler{constructor(e,t,n,o){super(e,t,n,o),this._cameraMoving=!1,this._raycastHelper.addEventListener(0,()=>{this._clickOutside()},this),this._selectionHandler.addEventListener(0,({component:e,consecutive:t})=>{this.dispatchEvent(8,new SceneEventInfo({component:e,consecutive:t})),this._inputManager.setDragEnabled(!0)},this),this._selectionHandler.addEventListener(1,({component:e,resetCamera:t,reason:n})=>{this._selectionHandler.hasSelection()||this._inputManager.setDragEnabled(!1),this.dispatchEvent(9,new SceneEventInfo({component:e,resetCamera:t,reason:n}))},this),this._addInputListeners(this._inputManager)}disable(){const e=new Layers;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}enable(){const e=new Layers;e.disableAll(),e.enable(4),e.enable(5),e.enable(7),e.enable(8),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}_addInputListeners(e){e.addEventListener(7,e=>this._interaction(),this),e.addEventListener(8,e=>this._interaction(),this)}addComponentHandlers(e){this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:RAYCAST_PRIORITY.DEFAULT,roomleId:e.runtimeId}),e.meshes.forEach(t=>{this._addComponentHandlers(e,t,{hasListener:!0,priority:RAYCAST_PRIORITY.COMPONENT,roomleId:e.runtimeId})})}addComponentDragInHandler(e){this._dragIn&&(this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:RAYCAST_PRIORITY.DEFAULT,roomleId:e.runtimeId}),this._raycastHelper.enableDragIn(e.boundingBoxMesh))}_addComponentHandlers(e,t,n){t.userData.hasListener||(Object.assign(t.userData,n),t.addEventListener("select",()=>this.clickComponent(e)),t.addEventListener("hover_on",t=>this._hoverOn(e,t.attachment.type)),t.addEventListener("hover_off",t=>this._hoverOff(e,t.attachment.type)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",()=>this._dragEnd(e)))}addPreviewHandlers(e){let t=e.boundingBoxMesh;t.userData.hasListener||(t.userData=deepMerge(t.userData,{hasListener:!0,priority:RAYCAST_PRIORITY.PREVIEW,roomleId:e.runtimeId}),t.addEventListener("select",()=>this._clickPreview(e)),t.addEventListener("hover_on",()=>this._hoverOnPreview(e)),t.addEventListener("hover_off",()=>this._hoverOffPreview(e)))}addPreviewLineHandlers(e){let t=e.boundingLineMesh;t.userData.hasListener||(t.userData=deepMerge(t.userData,{hasListener:!0,priority:RAYCAST_PRIORITY.PREVIEW_LINE,roomleId:e.runtimeId}),t.addEventListener("select",()=>this._clickPreviewLine(e)),t.addEventListener("hover_on",t=>this._hoverOnPreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_move",t=>this._hoverMovePreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_off",()=>this._hoverOffPreviewLine(e)))}_clickPreview(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new SceneEventInfo({preview:e}))}_clickPreviewLine(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new SceneEventInfo({preview:e}))}clickComponent(e,t=!0){this._debug&&e.runtimeId,this._selectionHandler.check(e),t&&this._configuratorUiCallbacks.onClickComponent(e)}_clickOutside(){this._selectionHandler.cancelSelection("click_outside"),this.dispatchEvent(3),this._interaction()}_hoverOn(e,t){this._cameraMoving||(this._debug&&e.runtimeId,e.hoverOn(),this._interaction(),this.dispatchEvent(1,new SceneEventInfo({component:e,type:t})),this._hoveredComponent=e)}_hoverOff(e,t){this._cameraMoving||(this._debug&&e.runtimeId,e.hoverOff(),this._interaction(),this.dispatchEvent(2,new SceneEventInfo({component:e,type:t})),this._hoveredComponent=null)}_hoverOnPreview(e){e.hoverOn(),this._interaction(!0),this._hoveredPreview=e}_hoverOffPreview(e){e.hoverOff(),this._interaction(!0),this._hoveredPreview=null}_hoverOnPreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._draggedComponent||e.hoverOn(),this._interaction(),this._hoveredPreview=e}_hoverMovePreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._hoveredPreview=e,this._interaction(!0)}_updatePositionForPreviewLine(e,t){let n=t.object.parent.parent.worldToLocal(t.point);this._previewLineIntersection=n,e&&(this._draggedComponent?this._draggedComponent.visible=!0:e.updatePreviewPosition(n))}_hoverOffPreviewLine(e){this._draggedComponent||e.hoverOff(),this._interaction(),this._hoveredPreview=null,this._previewLineIntersection=null}_setDragComponentShadow(e){var t;null===(t=this._draggedComponent)||void 0===t||t.traverse(t=>{if(t instanceof Mesh){const n=t;e&&void 0!==n.castShadowOld?(n.receiveShadow=n.receiveShadowOld,n.castShadow=n.castShadowOld):(n.receiveShadowOld=t.receiveShadow,n.castShadowOld=t.castShadow,n.receiveShadow=!1,n.castShadow=!1)}})}_dragStart(e){e&&(this._selectionHandler.isSelected(e)||this.isDragIn())&&(this._dragStartPosition=e.position.clone(),this._dragStartRotation=e.rotation.clone(),this._draggedComponent=e,this._setDragComponentShadow(!1),this.dispatchEvent(4,new SceneEventInfo({component:e})),this._interaction())}_drag(e,t){if(e&&(this._selectionHandler.isSelected(e)||this.isDragIn())){if(e&&!this._draggedComponent&&(this._draggedComponent=e),this._previewLineIntersection){let e=this._hoveredPreview,t=e.getPositionForIntersectionPoint(this._previewLineIntersection),n=e.parent.localToWorld(t);this._draggedComponent.position.copy(this._draggedComponent.parent.worldToLocal(n)),this._draggedComponent.rotation.copy(e.docklineRotation),e.hideSelectionLine()}else e.parent?e.position.copy(e.parent.worldToLocal(t)):e.position.copy(t);this._hoveredPreview?e.visible=!1:e.visible=!0,this.dispatchEvent(5,new SceneEventInfo({component:e})),this._interaction()}}_dragEnd(e){if(e&&(this._selectionHandler.isSelected(e)||this.isDragIn())){if(this._hoveredPreview&&this._previewLineIntersection){let t=this._hoveredPreview,n=t.getPositionForIntersectionPoint(this._previewLineIntersection),o=t.parent.localToWorld(n);e.position.copy(e.parent.worldToLocal(o)),e.rotation.copy(t.docklineRotation)}else this._dragStartPosition&&this._dragStartRotation&&(e.position.copy(this._dragStartPosition),e.rotation.copy(this._dragStartRotation),this._dragStartPosition=null,this._dragStartRotation=null,this.addComponentHandlers(e));e.visible=!0,this._setDragComponentShadow(!0),this._draggedComponent=null,this._previewLineIntersection=null,this.dispatchEvent(6,new SceneEventInfo({component:e,preview:this._hoveredPreview})),this._interaction()}}_interaction(e){this.dispatchEvent(0,new SceneEventInfo({forceRender:e}))}hasSelection(){return this._selectionHandler.hasSelection()}update(e,t,n){this._raycastHelper.update(e,t,n)}isDragIn(){return this._dragIn}isDragging(){return null!=this._draggedComponent}setRootComponentId(e){this._raycastHelper.setRootComponentId(e)}cancelSelection(e){return this._selectionHandler.setSelectionMode("standard"),this._selectionHandler.cancelSelection(e)}setSelectionMode(e){this._selectionHandler.setSelectionMode(e)}getSelectionMode(){return this._selectionHandler.getSelectionMode()}getSelectedRuntimeComponentIds(){return this._selectionHandler.getSelectedRuntimeComponentIds()}setCameraMoving(e){e&&this._hoveredComponent&&this._hoverOff(this._hoveredComponent,0),this._cameraMoving=e}setCamera(e){this._raycastHelper.setCamera(e)}setObject(e){this._raycastHelper.setObject(e)}}__decorate([inject],ConfiguratorSceneEventHandler.prototype,"_selectionHandler",void 0),__decorate([inject],ConfiguratorSceneEventHandler.prototype,"_configuratorUiCallbacks",void 0);class UiIntersectionHelper extends EventDispatcher{constructor(e){super(),this._uiIntersectionMask=0,this.floorEnvironment=!1,this._camera=e}updateToBounds(e,t,n){let o=new Vector3(-e.x/2,0,-e.z/2),i=new Vector3(e.x/2,e.y,e.z/2);this._boundingBox=new Box3(o,i),this._clientWidth=t,this._clientHeight=n;let r=this._boundingBox.getSize(new Vector3);this._boxVertices=[],this._boxVertices.push(this._boundingBox.min),this._boxVertices.push(this._boundingBox.min.clone().add(new Vector3(r.x,0,0))),this._boxVertices.push(this._boundingBox.max),this._boxVertices.push(this._boundingBox.max.clone().sub(new Vector3(r.x,0,0)))}set canvasOffset(e){this._offset=e,this.calculateUIIntersection()}calculateUIIntersection(){let e=[];if(null==this._boundingBox||null==this._offset)return;let t=this._checkPaddings();t.bottom=this._clientHeight-t.bottom,t.right=this._clientWidth-t.right;let n=0;this.floorEnvironment?(e=["left","right","bottom"],n=11):(this._offset.left>0&&t.left<this._offset.left*this._clientWidth&&(e.push("left"),n|=8),this._offset.right<1&&t.right<(1-this._offset.right)*this._clientWidth&&(e.push("right"),n|=2),this._offset.bottom>0&&t.bottom<this._offset.bottom*this._clientHeight&&(e.push("bottom"),n|=1)),this._offset.top<1&&t.top<(1-this._offset.top)*this._clientHeight&&(e.push("top"),n|=4),n!==this._uiIntersectionMask&&(this.dispatchEvent(0,e),this._uiIntersectionMask=n)}_checkPaddings(){let e={left:this._clientWidth/2,top:this._clientHeight/2,right:this._clientWidth/2,bottom:this._clientHeight/2};return this._boxVertices.forEach(t=>{let n=getScreenXY(t,this._camera,this._clientWidth,this._clientHeight);n.x<e.left&&(e.left=n.x),n.x>e.right&&(e.right=n.x),n.y<e.top&&(e.top=n.y),n.y>e.bottom&&(e.bottom=n.y)}),e}}class ConfiguratorCameraBehaviour extends CameraBehaviour{get cameraControl(){return this._cameraControl}resetCameraOnSceneClear(){this.cameraControl.clear()}async externalApiMoveCamera(e){await this.cameraControl.moveCamera(e),this._onCameraChanged()}externalApiZoomIn(e){this.cameraControl.zoomIn(e),this._onCameraChanged()}externalApiZoomOut(e){this.cameraControl.zoomOut(e),this._onCameraChanged()}externalApiResetCameraPosition(e){this.cameraControl.updateAndReset(e,!0),this._onCameraChanged()}disablePanningOnShiftRelease(){this.cameraControl.disablePanning()}enablePanningOnShiftClick(){this.cameraControl.enablePanning()}resetCameraToStartOnConfigurationLoaded(e){this.cameraControl.updateAndReset(e,!1)}updateBoundsOnPlanObjectUpdated(e){this.cameraControl.updateToBounds(e,!1,!1)}updateBoundsOnCancelDockings(e){this.cameraControl.updateToBounds(e,!1,!1)}async zoomToComponentOnConsecutiveClick(e){this.cameraControl.saveState(!1),await this.cameraControl.zoomTo(e),this._onCameraChanged()}resetCameraToStateOnCancelSelection(){this.cameraControl.hasSavedState()&&(this.cameraControl.resetToState(),this._onCameraChanged())}zoomToFitBoundsAfterUserInitiatedPreviews(e){this.cameraControl.zoomToFitBounds(e),this._onCameraChanged()}async resetCameraOnStartConfiguring(e,t,n=0){this.cameraControl.setCurrentCameraParameters(t),this.cameraControl.setObjectRotation(n),await this.cameraControl.updateAndReset(e,!0)}}class ConfiguratorSceneManager extends SceneManager{constructor(e,t,n){super(e,t,CANVAS_ID.HSC,n),this._configuratorContext.baseContext="configurator",this._getViewModel().setListener(this),this._sceneEventHandler=new ConfiguratorSceneEventHandler(this._creator_,this._scene,this.cameraBehaviour3d.cameraControl.getCamera(),this._getInputManager()),this._sceneEventHandler.addEventListener(0,({forceRender:e})=>{this._uiIntersectionHelper.calculateUIIntersection(),e&&this._renderEverything()},this),this._sceneEventHandler.addEventListener(1,({component:e,type:t})=>this._onHoverOn(e,t),this),this._sceneEventHandler.addEventListener(2,({component:e,type:t})=>this._onHoverOff(e,t),this),this._sceneEventHandler.addEventListener(3,()=>{this._configuratorUiCallbacks.onClickOutside(),this.cameraBehaviour.cameraControl.unlock(),this._cancelDockings(!1,null,this._getViewModel().hasPreviews(),!0,!1),this.cancelComponentSelection(!0,"click_outside"),this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentVisibility(this._sceneEventHandler,this._getViewModel()),this._requestRender()},this),this._sceneEventHandler.addEventListener(8,({component:e,consecutive:t})=>{this._getViewModel().hasPreviews()&&this._cancelDockings(!1,null,this._getViewModel().hasPreviews(),!0,!1),this._selectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(9,({component:e,resetCamera:t,reason:n})=>{this._deselectComponent(e,t,n),this._requestRender()},this),this._sceneEventHandler.addEventListener(4,({component:e})=>{var t;"multiselect"===this._sceneEventHandler.getSelectionMode()&&this.cancelComponentSelection(!1,"dragIn"),this._requestDockingsPreviewWithDrag(e.runtimeId),this.cameraBehaviour.cameraControl.lock(),null===(t=this._roomleRenderer)||void 0===t||t.enableUiInteractionMode(),this._requestRender()},this),this._sceneEventHandler.addEventListener(5,()=>{this._renderEverything()},this),this._sceneEventHandler.addEventListener(6,({component:e,preview:t})=>{var n;if(t){let n=t;this._getViewModel().isPreviewLine(n)?this._getViewModel().dockComponentWithPosition(n,e):this._getViewModel().isPreview(n)?this._dockComponent(n):this._getKernelAccess().cancelDocking(e.runtimeId),this._cancelDockings(!t,e,!0,!0)}else{this._getKernelAccess().cancelDocking(e.runtimeId);let t=this._sceneEventHandler.isDragIn()?e:null;this._cancelDockings(this._sceneEventHandler.isDragIn(),t,!1,!0);const n=this._getViewModel().getBoundingBox();this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new Vector3))}this.cameraBehaviour.cameraControl.unlock(),null===(n=this._roomleRenderer)||void 0===n||n.disableUiInteractionMode(),this._renderEverything()},this),this._sceneEventHandler.addEventListener(7,({preview:e})=>{this._getViewModel().isPreview(e)&&(this._getViewModel().isPreviewLine(e)?this._getViewModel().dockComponentWithPosition(e):this._dockComponent(e),this._cancelDockings(!1,null,!this._getViewModel().hasPreviews(),!1,!1),this.requestDockingsPreview(!1),this._requestRender())},this),Env.isProduction||(window.__RML__DEBUG__.SceneManager=this),this.enableConfiguratorEvents(),this._initOptionalModules(),this._offsetAnimationStart=callAgainAfter(this._offsetAnimationStart.bind(this),250),this._offsetAnimationEnd=debounce(this._offsetAnimationEnd.bind(this),32)}async _initOptionalModules(){const{transparentHighlighting:e}=this._initData;if(e){const{default:e}=await import("./component-raycast-helper-4fdfba05.js");this._componentRaycastHelper=new e,this._componentRaycastHelper.init(this._scene,this.cameraBehaviour3d.cameraControl.getCamera())}}_changeCameraBehaviour(e){var t;super._changeCameraBehaviour(e),null===(t=this._componentRaycastHelper)||void 0===t||t.setCamera(this.cameraBehaviour3d.cameraControl.getCamera())}disableEvents(){this.disableConfiguratorEvents()}enableEvents(){"configurator"===this._configuratorContext.baseContext&&this.enableConfiguratorEvents()}enableConfiguratorEvents(){this._sceneEventHandler.enable()}disableConfiguratorEvents(){this._sceneEventHandler.disable()}_getViewModel(){return this._viewModel||(this._viewModel=RoomleDependencyInjection.lookup("configurator-view-model",this._creator_),this._viewModel.setRequestRenderCallback(()=>this._renderEverything()),this._viewModel.setRequestRenderSceneUpdateCallback(()=>{var e;return null===(e=this._roomleRenderer)||void 0===e?void 0:e.clearCache()}),this._viewModel.setInvalidateRenderCallback(()=>{var e;return null===(e=this._roomleRenderer)||void 0===e?void 0:e.forceShadowUpdates(!0)})),this._viewModel}_getKernelAccess(){return this._plannerKernelAccess}_showDockings(){var e,t,n;if(null===(e=this._roomleRenderer)||void 0===e||e.enableUiInteractionMode(),null===(n=null===(t=this._initData)||void 0===t?void 0:t.featureFlags)||void 0===n?void 0:n.pulsePreview){this._renderEverything();const e=setInterval(()=>this._renderEverything(),16);setTimeout(()=>clearInterval(e),(PULSE_LOOPS+1)*PULSE_DURATION)}}cancelDockings(){this._cancelDockings(!0,null,!0,!0,!1),this._renderEverything()}_cancelDockings(e,t,n,o,i=!0){var r,s;null===(r=this._roomleRenderer)||void 0===r||r.disableUiInteractionMode(),e&&(this._sceneEventHandler.setDragIn(!1),this._getViewModel().removeDockingComponent(),t&&this._scene.remove(t)),this._getViewModel().removePreviews(),n&&i&&nextTick().then(()=>{var e;null===(e=this.configuratorCameraBehaviour)||void 0===e||e.updateBoundsOnCancelDockings(this.getBounds())}),o&&n&&this._configuratorUiCallbacks.onDockingsPreviewRemoved(),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null,!1,()=>{var e,t;null===(e=this._roomleRenderer)||void 0===e||e.forceShadowUpdates(!0),this._initData.transparentHighlighting&&(null===(t=this._roomleRenderer)||void 0===t||t.clearCache()),this._renderEverything()}),n&&(null===(s=this._roomleRenderer)||void 0===s||s.forceShadowUpdates(!0))}_onHoverOn(e,t){2!==t&&this._highlightComponent(e),this._componentDimensioningHelper&&this._componentDimensioningHelper.add(e)&&this._renderEverything()}_onHoverOff(e,t){2!==t&&this._highlightComponent(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&(this._componentDimensioningHelper.remove(e),this._renderEverything()),this._requestRender()}_highlightComponent(e=null,t=[]){var n;if(!this._shouldHighlightComponent())return;const o=[],i=this._initData.meshSelection;e?i?o.push(...e.meshes):e.boundingBoxMesh&&o.push(e.boundingBoxMesh):t&&t.length||(t=this._sceneEventHandler.getSelectedRuntimeComponentIds()),this._getViewModel().getComponentsForIds(t).forEach(e=>{e&&(i?o.push(...e.meshes):e.boundingBoxMesh&&o.push(e.boundingBoxMesh))}),null===(n=this._roomleRenderer)||void 0===n||n.highlightObjects(o)}shouldClearShadowsAndAO(){var e;return super.shouldClearShadowsAndAO()||!(null===(e=this._sceneEventHandler)||void 0===e?void 0:e.isDragging())}resume(){super.resume(),this._getViewModel().materialQueue.registerCallback(()=>this._materialLoaded()),this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._renderWithoutShadowsAndAO()})}_materialLoaded(){this._renderEverything()}async waitForMaterialQueue(){await this._getViewModel().materialQueue.finished()}pause(){super.pause(),this._getViewModel().materialQueue.unregisterCallback(),this._configuratorMeshGenerator.removeMaterialLoadedListener()}_setupScene(e,t,n){super._setupScene(e,t),this._uiIntersectionHelper=new UiIntersectionHelper(this.cameraBehaviour3d.cameraControl.getCamera()),this._uiIntersectionHelper.canvasOffset=e,this._uiIntersectionHelper.addEventListener(0,e=>{this._configuratorUiCallbacks.onUiIntersectionChange(e)},this),this._configuratorMeshGenerator.maxAnisotropy=this._maxAnisotropy,this._configuratorMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._renderWithoutShadowsAndAO()}),this._domHelper.element.appendChild(this._renderer.domElement),n||!this._initData.legacyLight||this._initData.ls||this._initData.dls||(this._renderer.capabilities.maxTextures>8?this.loadDynamicLightSetting(DynamicLightSettingLoader.createDynamicLightSettingSource(null,PREDEFINED_LIGHTSETTING.CAMERA)):this._lightSetting=new DefaultLightSetting(this._scene,this._lightSetting)),this._requestRender(),t||this._setEnvironment(new BackgroundEnvironment(this._scene,this._environment,getColor(this._initData.colors.DEFAULT_BACKGROUND))),this._getViewModel().materialQueue.registerCallback(()=>this._materialLoaded())}sceneCleared(e){this._internalClearScene(e)}display(e){this._scene.add(e),this.setRootComponentId(e.runtimeId),this._requestRender()}setRootComponentId(e){this._sceneEventHandler.setRootComponentId(e)}debugSceneGraph(e){this._getViewModel().debugSceneGraph(e),this._printObjectGraph(this._scene,"")}debugScene(){return this._scene}_printObjectGraph(e,t){e.material&&e.material.opacity,e.type,e.id,e.runtimeId,e.children.length>0&&e.children.forEach(e=>{let n=t+" ";this._printObjectGraph(e,n)})}clearScene(){var e,t;null===(e=this.configuratorCameraBehaviour)||void 0===e||e.resetCameraOnSceneClear(),this._internalClearScene(!1),null===(t=this._sceneEventHandler)||void 0===t||t.cancelSelection("reset_scene"),this._pluginSystem.clearScene(this._scene,this._uiScene)}planObjectConstructionDone(e){this._componentDimensioningHelper.reset(),this._componentDimensioningHelper.setCamera(this.cameraBehaviour3d.cameraControl.getCamera())}_internalClearScene(e){var t;this._scene.children.forEach(e=>{"Object3D"!==e.type&&"Mesh"!==e.type&&"Line"!==e.type||this._scene.remove(e)}),this._uiScene.children.forEach(e=>{this._uiScene.remove(e)}),this._getViewModel().sceneCleared(),null===(t=this._componentDimensioningHelper)||void 0===t||t.invalidateDimensioningsCache(),(e||this._memoryManager.shouldHardReset())&&(this._configuratorMeshGenerator.clear(),this._renderer.renderLists.dispose(),this._memoryManager.executedHardReset()),this._renderEverything()}async _waitForAssets(){await super._waitForAssets(),await this._externalMeshesAndMaterialsReady()}async preparePerspectiveImage(e={}){var t,n;await this._externalMeshesAndMaterialsReady();const{showDimensions:o=!1}=e;this._cancelDockings(!0,null,!0,!0);const i=this.cameraBehaviour3d.cameraControl.getCamera().clone();i.resetOffset();let r=this._calculateBoundingBoxOfAllMeshes(0,o);null===(t=this._lightSetting)||void 0===t||t.removeFromScene();const s=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();s&&this._dimensionHelper.disableDimensions();const a=this.cameraBehaviour3d.cameraControl.getObjectRotation();if(o){await this._initDimensions(),await this._dimensionHelper.isInitialized();const e=-30+toDegrees(a);ImageRenderer.placeCameraForPerspectiveImage(i,r,-20,e),this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(i.position),r=this._calculateBoundingBoxOfAllMeshes(0,o)}this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const c=await this._imageRenderer.preparePerspectiveImage(this._scene,this._uiScene,i,r,e,a);return s?(this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(this.cameraBehaviour3d.cameraControl.getCamera().position)):o&&this._dimensionHelper.disableDimensions(),null===(n=this._lightSetting)||void 0===n||n.addToScene(),this._renderEverything(),c}async renderImage(e){await this._externalMeshesAndMaterialsReady(),this._getViewModel().getPreviews()&&this._cancelDockings(!0,null,!0,!0);let t=this.cameraBehaviour3d.cameraControl.getCamera(),n=null;e.useCurrentPerspective||(t=this.cameraBehaviour3d.cameraControl.getCamera().clone(),t.resetOffset(),n=this._calculateBoundingBoxOfAllMeshes());const o=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();o&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const i=await this._imageRenderer.renderPerspectiveImage(this._scene,t,n);return o&&(this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(this.cameraBehaviour3d.cameraControl.getCamera().position)),this._renderEverything(),i}async preparePartImage(e,t){return new Promise((n,o)=>{this._getViewModel().requestSubPartConstruction(e).then(async e=>{t.size||(t.size=256);const o=this.cameraBehaviour3d.cameraControl.getCamera().clone();o.resetOffset();let i=ImageRenderer.getCameraTargetForBBox((new Box3).setFromObject(e));const r=createEmptySceneFromCurrent(this._scene);r.add(e);const s=await this._imageRenderer.preparePerspectiveImage(r,null,o,i,t);dispose(r),n(s)},o)})}_calculateBoundingBoxOfAllMeshes(e=0,t){let n=null;return n=t&&this._dimensionHelper?this._dimensionHelper.getBoundingBox():this._getViewModel().getBoundingBox(),ImageRenderer.getCameraTargetForBBox(n,e)}async _externalMeshesAndMaterialsReady(){await this._getKernelAccess().externalMeshQueue.finished(!0),await this._getViewModel().materialQueue.finished(!0)}async prepareTopImage(e={}){var t,n;await this._externalMeshesAndMaterialsReady();const{showDimensions:o=!1}=e;this._cancelDockings(!0,null,!0,!0),o&&(await this._initDimensions(!0),await this._dimensionHelper.isInitialized(),this._dimensionHelper.enableTopDimensions()),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();let i=this._calculateBoundingBoxOfAllMeshes(.1,o);null===(t=this._lightSetting)||void 0===t||t.removeFromScene();let r=await this._imageRenderer.prepareTopImage(this._scene,this._uiScene,i,e);return o&&this._dimensionHelper.disableTopDimensions(),null===(n=this._lightSetting)||void 0===n||n.addToScene(),this._renderEverything(),r}enableDragIn(e){this._sceneEventHandler.setDragIn(!0,e),this._requestRender()}async _zoomToComponentOnConsecutiveClick(e){let t=e.boundingBox.getSize(new Vector3),n=getYRotationOfObject(e),o=new Euler(0,n,0),i=e.getWorldPosition(new Vector3).clone().add(e.boundingBox.getCenter(new Vector3).applyEuler(o));const r=new Vector2;this._renderer.getSize(r);const s={yaw:o.y,pitch:toRadiant(15),distance:getIdealDistance(t.x,t.y,t.z,this.cameraBehaviour3d.cameraControl.getCamera().fov,r.width,r.height)*DISTANCE_FACTOR,targetX:i.x,targetY:i.y,targetZ:i.z,blockOtherTweens:!0};areCameraParametersEqual(this.cameraBehaviour.cameraControl.getCurrentCameraParameters(),s)||(this._configuratorUiCallbacks.onZoomToComponent(),await this.configuratorCameraBehaviour.zoomToComponentOnConsecutiveClick(s))}resetCameraPositionToStart(){this._requestRender();const e=this._getViewModel().getBoundingBox();this.configuratorCameraBehaviour.externalApiResetCameraPosition(e)}resetPreviews(){this._getViewModel().removePreviews(),this._requestRender()}changeOffset(e){this.cameraBehaviour3d.cameraControl.getCamera().offset=e,this._uiIntersectionHelper&&(this._uiIntersectionHelper.canvasOffset=e)}setCameraOffset(e){this._offsetAnimationStart(),this.cameraBehaviour3d.cameraControl.getCamera().offset&&(this.cameraBehaviour3d.cameraControl.getCamera().offset=e,this._renderEverything()),this._offsetAnimationEnd()}_offsetAnimationStart(){this._onCameraMove()}_offsetAnimationEnd(){this._onCameraIdle()}getCameraOffset(){var e,t,n;return(null===(n=null===(t=null===(e=this.cameraBehaviour3d)||void 0===e?void 0:e.cameraControl)||void 0===t?void 0:t.getCamera())||void 0===n?void 0:n.offset)?JSON.parse(JSON.stringify(this.cameraBehaviour3d.cameraControl.getCamera().offset)):{left:0,top:1,right:1,bottom:0}}_onKeyDown(e){super._onKeyDown(e),!e.key||"Escape"!==e.key&&"Esc"!==e.key||(this._getViewModel().hasPreviews()||this.cancelComponentSelection(!1,"click_outside"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this.cameraBehaviour3d.cameraControl instanceof CameraControl3D&&(this.enablePanning(),e.preventDefault()),this._sceneEventHandler&&this._sceneEventHandler.hasSelection()&&e.key&&("Backspace"===e.key||"Delete"===e.key)&&(this.requestDeleteSelectedComponent(),e.preventDefault())}_onKeyUp(e,t=!1){super._onKeyUp(e,t),e.key&&e.key.includes("Shift")&&(t||this.disablePanning(),e.preventDefault())}enablePanning(){this.configuratorCameraBehaviour.enablePanningOnShiftClick()}disablePanning(){this.configuratorCameraBehaviour.disablePanningOnShiftRelease()}cancelPreviousDockings(){var e;this._cancelDockings(!0,null,!1,!1),null===(e=this._roomleRenderer)||void 0===e||e.forceShadowUpdates(!0),this._renderEverything()}cancelComponentSelection(e,t){(this._sceneEventHandler.hasSelection()||"standard"!==this._sceneEventHandler.getSelectionMode())&&this._cancelSelection(e,t)}notifyPlannerOnComponentSelectionCancel(e,t){}_cancelSelection(e,t){var n;this._sceneEventHandler.cancelSelection(t),this._configuratorContext.selectionMode="standard",this._configuratorContext.selectedRuntimeComponentIds=[],this._getViewModel().removePreviews(),e&&!this._initData.debug&&this.configuratorCameraBehaviour&&this.configuratorCameraBehaviour.resetCameraToStateOnCancelSelection();const o=null===(n=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId))||void 0===n?void 0:n.externalObject;this._getKernelAccess().updatePlanObjectDependencies(this._configuratorContext.planObjectId),this._configuratorUiCallbacks.onSelectionCancel(t),this.notifyPlannerOnComponentSelectionCancel(o,t)}_selectComponent(e,t){this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds(),t||("standard"===this._sceneEventHandler.getSelectionMode()?this._onSelectedRuntimeComponentChange(e):this._onSelectedRuntimeComponentsChange(this._sceneEventHandler.getSelectedRuntimeComponentIds())),this._highlightComponent(e),!this._initData.debug&&t&&this._zoomToComponentOnConsecutiveClick(e)}_deselectComponent(e,t,n){"standard"===this._sceneEventHandler.getSelectionMode()&&(this._cancelSelection(t,n),this._highlightComponent()),"multiselect"===this._sceneEventHandler.getSelectionMode()&&(this._sceneEventHandler.hasSelection()?this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds():(this._cancelSelection(t,n),this._highlightComponent())),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}getScreenXY(e){return getScreenXY(e,this.cameraBehaviour.cameraControl.getCamera(),this._domHelper.element.clientWidth,this._domHelper.element.clientHeight)}setSelectionMode(e){this._sceneEventHandler.setSelectionMode(e)}changeFloorMaterial(e){return this._environment&&this._environment instanceof FloorEnvironment||(this._environment=new FloorEnvironment(this._scene,this._environment,!0),this._uiIntersectionHelper.floorEnvironment=!0),new Promise((t,n)=>{this._environment.changeFloorMaterial(e,this._maxAnisotropy).then(()=>{this._requestRender(),t()},n)})}zoomIn(e){this.configuratorCameraBehaviour.externalApiZoomIn(e),this._renderEverything()}zoomOut(e){this.configuratorCameraBehaviour.externalApiZoomOut(e),this._renderEverything()}async showDimensions(){await this._initDimensions(),this._dimensionHelper.enableDimensions(),this._dimensionHelper.onDimensionsVisibilityChanged(e=>{e&&this._renderEverything(),this._configuratorUiCallbacks.onDimensionsVisibilityChange(e)}),this._configuratorUiCallbacks.onDimensionsVisibilityChange(!0),this._renderEverything()}async _initDimensions(e=!1){this._dimensionHelper||await import("./dimensioning-helper-c98b39cc.js").then(({default:e})=>{this._dimensionHelper=new e(this._creator_)}),this._dimensionHelper.setUiScene(this._uiScene),this._dimensionHelper.setObject(this._getViewModel().getComponent(this._configuratorContext.rootComponentId),this.cameraBehaviour3d.cameraControl.getObjectRotation());const t=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);t&&t.boxForMeasurement&&this._dimensionHelper.updateSize(t.boxForMeasurement);let n=this.cameraBehaviour3d.cameraControl.getCamera().position;if(e){const e=kernelBoxToThreeBox(t.boxForMeasurement);n.copy(e.getCenter(new Vector3)),n.y=e.getSize(new Vector3).y+1}this._dimensionHelper.moveCameraEnd(n)}hideDimensions(){this._dimensionHelper&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._renderEverything()}async loadSceneSettings(e){await super.loadSceneSettings(e),this._uiIntersectionHelper.floorEnvironment=this._environment instanceof FloorEnvironment}onCameraChanged(){super.onCameraChanged(),this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition()}requestDockingsPreview(e,t,n,o){o||(o=!1),e&&this.cancelPreviousDockings(),this.cancelComponentSelection(!1,"dock_preview"),o&&this.enableDragIn(n),t&&(this._configuratorContext.lastPossibleChild=t),this._configuratorContext.requestPreviewsIsUserInitiated=e,this.resetPreviews(),this._getKernelAccess().webGlPreviewDockings(this._configuratorContext,o),this._showDockings()}_requestDockingsPreviewWithDrag(e){this.cancelPreviousDockings(),this._configuratorContext.rootComponentId!==e&&(this.resetPreviews(),this._getKernelAccess().previewDockingsWithDrag(e,this._configuratorContext.planObjectId),this._showDockings())}_dockComponent(e){this._getKernelAccess().kernelInstance.isExternalPlanObject(e.parentId)?this._dockExternalComponent(e):this._dockKernelComponent(e)}_dockKernelComponent(e){Benchmark.start("dock_component_"+e.childId),this._getKernelAccess().dockComponent(e.parentId,e.parentDockId,e.childId,e.childDockId),this._configuratorContext.dockingRootComponentId=null;const t=this._getKernelAccess().kernelInstance.getComponent(e.childId);this._configuratorUiCallbacks.onElementDocked(JSON.parse(JSON.stringify(t)),e.childId),this.saveConfigToIdb()}_dockExternalComponent(e){this._getKernelAccess().dockExternalObjectComponent(e.parentId,e.parentDockId,e.childId,e.childDockId)}_onSelectedRuntimeComponentsChange(e){this._getKernelAccess().multiSelectionChange(e,this._configuratorContext.rootComponentId)}_onSelectedRuntimeComponentChange(e){let t=!1,n=null;e&&(t=e.runtimeId===this._configuratorContext.rootComponentId,n=e.runtimeId),this._getKernelAccess().selectionChange(n,t),e&&this._getKernelAccess().selectedComponent(e.runtimeId)}requestDeleteSelectedComponent(){const e=this._configuratorContext.selectedRuntimeComponentIds,t=this._configuratorContext.rootComponentId;if(this._getKernelAccess().isExternalObjectOrComponent(t)||Array.isArray(e)&&0!==e.length&&t&&-1===e.indexOf(t)){switch(this._configuratorContext.selectionMode){case"standard":this._getKernelAccess().requestDeleteComponent(this._configuratorContext.selectedRuntimeComponentId);break;case"multiselect":this._getKernelAccess().requestDeleteComponents(this._configuratorContext.selectedRuntimeComponentIds)}this._configuratorContext.selectedRuntimeComponentIds=[]}}componentUpdated(e,t){var n;if(e.runtimeId===this._configuratorContext.rootComponentId){let t=new Vector3(e.position.x/1e3,e.position.z/1e3,e.position.y/-1e3);this._sceneEventHandler.update(null,t,null)}void 0===e.geometryChanged||e.geometryChanged?this._renderEverything():this._renderWithoutShadowsAndAO(),null===(n=this._componentDimensioningHelper)||void 0===n||n.invalidateDimensioningsCache(e.runtimeId)}planObjectUpdated(e,t,n){const o=this._getKernelAccess().kernelInstance.getSerializedConfiguration(this._configuratorContext.planObjectId);if(n||this._configuratorHistory.push(o),e.bounds){if(this._configuratorContext.planObjectId===e.id&&this.cameraBehaviour3d instanceof ConfiguratorCameraBehaviour){const e=this._getViewModel().getBoundingBox();this.cameraBehaviour3d.updateBoundsOnPlanObjectUpdated(e);const n=this._getViewModel().getBoundingBoxOfGeometry();this._updateBounds(e,n,t)}this._highlightComponent(),this._requestRender()}}componentDeleted(e){-1===this._sceneEventHandler.getSelectedRuntimeComponentIds().indexOf(e.runtimeId)&&"multiselect"!==this._sceneEventHandler.getSelectionMode()||this.cancelComponentSelection(!1,"delete_component")}previewConstructionDone(e,t){const n=this._getViewModel().getBoundingBoxWithPreviews();t||(this._cancelDockings(!0,null,!1,!1,!1),this._configuratorContext.requestPreviewsIsUserInitiated&&this._configuratorUiCallbacks.onNoDockingsAvailable());let o=!0;this._componentRaycastHelper&&(o=!this._componentRaycastHelper.areAllComponentsInFrustum(this._getViewModel().getPreviews())),this._configuratorContext.requestPreviewsIsUserInitiated&&o&&this.configuratorCameraBehaviour.zoomToFitBoundsAfterUserInitiatedPreviews(n),this._lightSetting&&this._lightSetting.needsBounds()&&(this._lightSetting.updateBounds(n),this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new Vector3))),this._componentRaycastHelper&&this._componentRaycastHelper.checkPreviewVisibility(this._getViewModel())}configurationLoaded(e,t){e&&t&&this._sceneEventHandler.isDragIn()?(e.position.copy(new Vector3(0,100,0)),this._scene.add(e),this._sceneEventHandler.addComponentDragInHandler(e),this._requestRender()):t||this._initData.debug||this._initData.moc||this.configuratorCameraBehaviour.resetCameraToStartOnConfigurationLoaded(this.getBounds()),this._environment&&this._environment.reload(),this._waitForAssets().then(()=>{this._readyForRender()})}addComponentHandlers(e){this._sceneEventHandler.addComponentHandlers(e)}addPreviewHandlers(e){this._sceneEventHandler.addPreviewHandlers(e)}addPreviewLineHandlers(e){this._sceneEventHandler.addPreviewLineHandlers(e)}_updateComponentPosition(){if(!this._configuratorUiCallbacks.onComponentPositionsUpdated)return;const e=[];this._getViewModel().getComponents().forEach(t=>{if(!t.boundingBoxMesh)return;const n=(new Box3).setFromObject(t.boundingBoxMesh);let o=this._getKernelAccess().kernelInstance.getComponent(t.runtimeId);const i=o.parameters||o.possibleChildren?["edit"]:[];e.push({id:t.runtimeId,position:this.getScreenXY(n.getCenter(new Vector3)),type:"component",actions:i})}),this._getViewModel().getPreviews().forEach(t=>{const n=(new Box3).setFromObject(t);e.push({id:t.runtimeId,position:this.getScreenXY(n.getCenter(new Vector3)),type:"preview",actions:["add"]})}),this._configuratorUiCallbacks.onComponentPositionsUpdated(e)}_updateBounds(e,t,n=!1){var o;if(super._updateBounds(e,t,n),!e)return;let i=e.getSize(new Vector3);const r=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);r&&r.boxForMeasurement&&(null===(o=this._dimensionHelper)||void 0===o||o.updateSize(r.boxForMeasurement)),this._sceneEventHandler.update(i,null,null),this._uiIntersectionHelper.updateToBounds(i,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this.cameraBehaviour3d.cameraControl.getCamera().updateProjectionMatrix()}async moveCamera(e){return this.configuratorCameraBehaviour.externalApiMoveCamera(e)}getSelectedRuntimeComponentIds(){return this._sceneEventHandler.getSelectedRuntimeComponentIds()}selectComponent(e,t=!0){if(!e)return;const n=this._getViewModel().getComponents().find(t=>t.runtimeId===e);n?this._sceneEventHandler.clickComponent(n,t):console.warn('Can not select "'+e+'" because it was not found')}highlightParts(e){this._highlightComponent(null,e),this._requestRender()}_shouldHighlightComponent(){return"configurator"===this._configuratorContext.baseContext&&(this._initData.highlighting===ROOMLE_HIGHLIGHTNG.ALWAYS||this._initData.highlighting!==ROOMLE_HIGHLIGHTNG.OFF&&(!!this._getKernelAccess().kernelInstance.getComponent(this._configuratorContext.rootComponentId).externalComponent||(this._plannerKernelAccess.kernelInstance.getChildrenOfPlanComponent(this._configuratorContext.rootComponentId,!0,!1)||[]).length>1))}saveConfigToIdb(){var e,t;let n,o;const{configuratorId:i}=this._globalInitData,{lastLoadedPlanId:r,lastLoadedRapiId:s}=this._configuratorContext;this._initData.moc?(n=r,o=null===(t=null===(e=this._getKernelAccess())||void 0===e?void 0:e.planInteractionHandler.getPlan())||void 0===t?void 0:t.getPlanXML(!1,2)):(n=s,o=this._getKernelAccess().kernelInstance.getSerializedConfiguration(this._configuratorContext.planObjectId));const a=this._idbManager.getKey(getHostname(),i,n);this._idbManager.setValue(a,o,this._idbManager.configStore)}_getInputManager(){return this._configuratorInputManager}createCameraControl(e,t){this._componentFactory=RoomleComponentFactoryInitializer();const n=this._domHelper.getClientDimensions(),o=n.x,i=n.y,r=this._componentFactory.createPerspectiveCamera(30,o/i,.1,20,t);r.layers.set(3),r.layers.enable(1),r.layers.enable(2),r.layers.enable(6),r.layers.enable(5),r.position.copy(new Vector3(0,.5,5)),this._changeCameraBehaviour(new ConfiguratorCameraBehaviour(new CameraControl3D(this._creator_,this._getInputManager(),null,r),this._cameraBehaviourState))}getBounds(){return this._getViewModel().getBoundingBox()}getGeometryBounds(){return this._getViewModel().getBoundingBoxOfGeometry()}sceneChanged(){}get configuratorCameraBehaviour(){return this.cameraBehaviour instanceof ConfiguratorCameraBehaviour?this.cameraBehaviour:null}get cameraBehaviour3d(){return this.cameraBehaviour}_onCameraIdle(){return super._onCameraIdle()}_onCameraMove(){return super._onCameraMove()}getComponent(e){return this._plannerKernelAccess.kernelInstance.getComponent(e)}cameraBehaviourChanged(){var e;super.cameraBehaviourChanged(),null===(e=this._sceneEventHandler)||void 0===e||e.setCamera(this.cameraBehaviour.cameraControl.getCamera()),this._setCameraControlListeners()}_setCameraControlListeners(){this.cameraBehaviour3d&&(this.cameraBehaviour.cameraControl.addEventListener(0,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._sceneEventHandler.setCameraMoving(!0),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(1,()=>{this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentAndPreviewVisibility(this._sceneEventHandler,this._getViewModel()),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(2,()=>{this._sceneEventHandler.setCameraMoving(!1),this._updateComponentPosition(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(5,({minZoom:e,maxZoom:t})=>{this._configuratorUiCallbacks.onZoomChange(e,t)},this),this.cameraBehaviour.cameraControl.addEventListener(3,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(4,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(7,()=>{var e;this._pluginSystem.moveCameraStart(this.cameraBehaviour.cameraControl.getCamera().position),null===(e=this._dimensionHelper)||void 0===e||e.moveCameraStart(this.cameraBehaviour.cameraControl.getCamera().position)},this),this.cameraBehaviour.cameraControl.addEventListener(8,()=>{var e;this._pluginSystem.moveCameraEnd(this.cameraBehaviour.cameraControl.getCamera().position),null===(e=this._dimensionHelper)||void 0===e||e.moveCameraEnd(this.cameraBehaviour.cameraControl.getCamera().position)},this))}_shouldRenderUi(){var e;return super._shouldRenderUi()||(null===(e=this._dimensionHelper)||void 0===e?void 0:e.areDimensionsEnabled())}setEventHandlerObject(e){this._sceneEventHandler.setObject(e)}_readyForRender(){"configurator"===this._configuratorContext.baseContext&&(this._configuratorUiCallbacks.onReadyForRender(),this._globalCallback.onReadyForRender())}animateElement(e,t,n,o,i){const r="animation:"+t;this._viewModel.changeAnimationValue(e,r,n,o,i)}}__decorate([inject],ConfiguratorSceneManager.prototype,"_configuratorInputManager",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_configuratorMeshGenerator",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_memoryManager",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_configuratorContext",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_componentDimensioningHelper",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_configuratorHistory",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_configuratorUiCallbacks",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_plannerKernelAccess",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_globalInitData",void 0);class RoomleConfigurator{_isInitDone(){return this._isKernelReady&&this._isWebGlReady&&this._isPreloadReady}_checkInitDone(){this._isInitDone()&&(this._onInitDoneCollection.forEach(e=>e()),this._onInitDoneCollection=[])}_onInitDone(e){this._isInitDone()?e():this._onInitDoneCollection.push(e)}constructor(e){this._onInitDoneCollection=[],this._isKernelReady=!1,this._isWebGlReady=!1,this._isPreloadReady=!0,this._isLoadError=!1,this._isReloading=!1,this._needsSync=!1,this._creator_=e,this._configuratorKernelAccessCallback.addListener(this);const{dls:t,ls:n}=this._initData;(n||t)&&(this._initData.legacyLight=!0),this._initData.legacyLight&&(this._initData.envMapIntensity=.9);const o=this._errorHandler;o.subscribe(0,e=>this._configuratorUiCallbacks.onErrorDueToOffline(e)),o.subscribe(1,e=>this._configuratorUiCallbacks.onError(e)),o.subscribe(2,(e,t)=>this._configuratorUiCallbacks.onContentProblem({rapiPath:e,ids:t,message:"Could not load the ids"}))}exportCanvasScreenshot(e){return this._sceneManager.exportCanvasScreenshot(e)}initSceneManager(e){this._sceneManager=e||RoomleDependencyInjection.lookup("configurator-scene-manager",this._creator_)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}_loadWebGlLib(e,t){this._loadingWebGlSuccess(e,t)}_loadingWebGlSuccess(e,t){this.initSceneManager(),t&&this._sceneManager.changeOffset(t);const{initialFloorMaterial:n,dls:o,ls:i,stats:r}=this._initData,s=DynamicLightSettingLoader.createDynamicLightSettingSource(o,i);r&&this.showStats(),this._sceneManager.enableHD(s),this._needsSync&&(this._needsSync=!1,this._plannerKernelAccess.requestSync(DEFAULT_CONVERSATION_ID,this._configuratorContext.planObjectId));const a=[this._scriptLoader.fetch(TWEEN_FILE_NAME,{id:"tween-js"})];n&&a.push(this._rapiAccess.getMaterial(n).then(e=>this._sceneManager.changeFloorMaterial(e))),Promise.all(a).then(this._webGlIsReady.bind(this),this.loadError.bind(this))}_webGlIsReady(){this._isWebGlReady=!0,this._checkInitDone()}_initPromiseCallback(e,t){this._isInitDone()?e():this._isLoadError?t("_initPromiseCallback failed"):(this._onInitDone(()=>e()),this._rejectOnLoadError=t)}_notifyOnConfigurationReady(e){return async t=>{const n=await this._plannerKernelAccess.addUiDataAndPriceToPartList(t.partList,t.hash);t.partList=n,e(t),this._configuratorUiCallbacks.onConfigurationReady(n,t.hash,t.rootComponentLabel),this._configuratorHistory.clearHistory()}}_notifyOnConfigurationLoadingError(e){return t=>{this._configuratorUiCallbacks.onConfigurationLoadError(),e(t)}}_loadItemOrConfigById(e,t){this._configuratorContext.lastLoadedRapiId=e,this._onLoadConfiguration(),this._preloadPackage(e),this._clearScene();const{offlineSync:n}=this._initData;if(n){const t=getCatalogIdFromItemOrConfigurationId(e);t&&this._dataSyncer.start(t)}return new Promise((n,o)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(t=>{t&&t.configuration?this._loadConfiguration(t.configuration).then(e=>{const o=this._notifyOnConfigurationReady(n);t.label?this._notifyUiAboutNewItem(t,e.rootComponentLabel):this._notifyUiAboutNewConfiguration(t),o(e)},this._notifyOnConfigurationLoadingError(o).bind(this)):o(new Error("Could not load item or config with id "+e))},o)})}_shouldBroadcastToUi(e){return!(0===e&&this._configuratorContext.selectedRuntimeComponentId||1===e&&!this._configuratorContext.selectedRuntimeComponentId||2===e&&!this._configuratorContext.selectedRuntimeComponentIds.length)}_isCorrectResponse(e,t){if(0===e)return t===this._configuratorContext.planObjectId;if(1===e)return t===this._configuratorContext.selectedRuntimeComponentId;const n=t.length;if(n!==this._configuratorContext.selectedRuntimeComponentIds.length)return!1;for(let e=0;e<n;e++)if(t[e]!==this._configuratorContext.selectedRuntimeComponentIds[e])return!1;return!0}_onLoadConfiguration(){this._clearScene(),this._configuratorUiCallbacks.onLoadConfiguration()}_clearScene(){this._sceneManager&&this._sceneManager.clearScene()}_notifyUiAboutNewItem(e,t){this._rapiAccess.getCatalog(e.catalog).then(n=>this._configuratorUiCallbacks.onConfigurationLabelChange(n.name,e.label,t))}_notifyUiAboutNewConfiguration(e){Promise.all([this._rapiAccess.getCatalog(e.catalog),this._rapiAccess.getComponent(e.rootComponentId)]).then(([e,t])=>this._configuratorUiCallbacks.onConfigurationLabelChange(e.name,null,t.label))}notifyUiAboutNewLabel(e){if(isIdItemId(e)){const t=this._rapiAccess.peekItem(e),n=this._rapiAccess.peekComponent(t.rootComponentId);this._notifyUiAboutNewItem(t,n.label)}else this._notifyUiAboutNewConfiguration(this._rapiAccess.peekConfiguration(e))}_getMaterialGroups(e){const t=(e,t)=>{let n=sortBySort(e,t);return 0!==n?n:(n=sortByString(e.label,t.label),0!==n?n:sortByString(e.id,t.id))},n=e=>(e.sort(t),e.forEach(e=>e.materials.sort(t)),e);if(e.validGroups.length>0)return new Promise((t,o)=>this._rapiAccess.getMaterialsByGroup(e.validGroups).then(e=>t(n(e)),o));const o=[];return e.validValues.forEach(e=>o.push(e.value)),new Promise((e,t)=>{this._rapiAccess.getMaterials(o).then(t=>{this._rapiAccess.combineMaterialsToGroups(t).then(t=>{e(n(t))})},t)})}_loadConfiguration(e){return this._plannerKernelAccess.externalMeshQueue.clear(),new Promise((t,n)=>{const o=()=>{const{x:o,y:i}=this._domHelper.getClientDimensions();if(o<=0&&i<=0){let e="Size of canvas is 0/0! When using embedding set correct size or remove id to load in idle mode!";return console.error(e),n(e)}this.resumeKernelCallbacks(),Benchmark.start("ui_load_configuration");const r=[];if(this._initData.applyCurrentGlobalParameters){const e=this._configuratorContext.planObjectId,t=this._configuratorContext.rootComponentParametersAsGlobal;r.push(this._plannerKernelAccess.getGlobalParameters(e,t))}Promise.all(r).then(([o])=>{const i=[AsyncHelper.waitFor(4),AsyncHelper.waitFor(2)];Promise.all(i).then(([e,[n,i,r,s]])=>{const a=[];o&&this._initData.applyCurrentGlobalParameters&&o.forEach(e=>a.push(this.setParameter(e,e.value,!0)));const c=this._rapiAccess.peekComponent(s);Promise.all(a).then(()=>{const n=[];a.length&&(n.push(this._plannerKernelAccess.getPartList()),n.push(this._plannerKernelAccess.getConfigurationHash(this._configuratorContext))),Promise.all(n).then(async n=>{const o=n&&n[0]?n[0]:i,s=n&&n[1]?n[1]:r,a=await this._plannerKernelAccess.addUiDataAndPriceToPartList(o,s);let l=e.errors;const h=l?convertCObject(l):[];this._configuratorUiCallbacks.onPartListUpdate(a,window.btoa(r)),t({partList:a,hash:s,rootComponentLabel:c?c.label:"",errors:h})})})},n),this._plannerKernelAccess.loadConfiguration(e)},n)};this._onInitDone(()=>o())})}_preLoadItemOrConfig(e,t){return new Promise((n,o)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(n,o)})}_preloadPackage(e){this._isPreloadReady=!1;let t=null;t=isIdItemId(e)?this._rapiAccess.getPreloadForItem.bind(this._rapiAccess):this._rapiAccess.getPreloadForConfiguration.bind(this._rapiAccess),Benchmark.start("rapi_preloads");const n=()=>{const t=Benchmark.getMeasure("rapi_preloads");if(Array.isArray(t)&&1===t.length){const n=t[0];this._configuratorUiCallbacks.onTrackTiming("Timing","RapiPreloads",Math.round(n.duration),{id:e})}};t(e).then(()=>{this._isPreloadReady=!0,this._checkInitDone(),n()},e=>{this._isPreloadReady=!0,this._checkInitDone(),console.error(e),n()})}_reloadConfiguration(e,t,n,o){return this._performLoadConfiguration(e).then(e=>{this._isReloading=!1,n(e)},e=>{this._isReloading=!1,o(e)})}_performLoadConfiguration(e){return this._onLoadConfiguration(),new Promise((t,n)=>{this._initData.preloadHint?this._preloadPackage(this._initData.preloadHint):console.warn("When loading a configuration string you have to supply a preloadHint to use fast loading!"),setTimeout(()=>{this._loadConfiguration(e).then(this._notifyOnConfigurationReady(t).bind(this),this._notifyOnConfigurationLoadingError(n).bind(this))},0)})}_changeHDGeometry(e){return new Promise((t,n)=>e===AppContext.useHDGeometry?t():this._isReloading?n("Change of HD Geometry in progress"):(this._isReloading=!0,AsyncHelper.waitFor(3).then(([e,o])=>{this._reloadConfiguration(e,o,t,n)},n),AppContext.useHDGeometry=e,void this._plannerKernelAccess.changeUseOfHDGeometry(this._configuratorContext,AppContext.useHDGeometry)))}async _callOnPartListUpdate(){const{hash:e}=await AsyncHelper.waitFor(4),t=await this._plannerKernelAccess.getPartList(),n=await this._plannerKernelAccess.getConfigurationHash(this._configuratorContext),o=await this._plannerKernelAccess.addUiDataAndPriceToPartList(t,n);this._configuratorUiCallbacks.onPartListUpdate(o,window.btoa(e))}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}init(e,t){this.setOverrides(t);const{preloadHint:n,offset:o,startTag:i}=this._initData;return this._domHelper.setDomElement(e),n?this._preloadPackage(n):console.warn("No preload hint! Therefore no preload during init!!"),i&&this.getTagById(i,{include:["items"]}).then(e=>this._configuratorUiCallbacks.onOpenTag(e),e=>console.error(e)),this._loadWebGlLib(e,o),new Promise(this._initPromiseCallback.bind(this))}cancelSelection({reason:e,resetCamera:t}={}){this._sceneManager.cancelComponentSelection(null!=t&&t,e||"unknown")}enableHDGeometry(){return this._changeHDGeometry(!0)}disableHDGeometry(){return this._changeHDGeometry(!1)}changeOffset(e){this._sceneManager.changeOffset(e)}previewDockings(e,t,n){this._sceneManager.requestDockingsPreview(!0,e,t,n)}cancelDockings(){this._sceneManager.cancelDockings()}requestDeleteComponent(){this._sceneManager.requestDeleteSelectedComponent()}renderImage(e){return this._sceneManager.renderImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}preparePartImage(e,t){let n={};return"number"==typeof t?n.size=t:(t||(t={}),"number"!=typeof t.size&&(t.size=256),n=t),this._sceneManager.preparePartImage(e,n)}async saveCurrentConfiguration(){var e;try{const t=await this._plannerKernelAccess.getConfigurationData(this._configuratorContext.planObjectId);if(null===(e=this._plannerKernelAccess.kernelInstance)||void 0===e?void 0:e.isExternalPlanObject(this._configuratorContext.planObjectId))return{...t,label:"",externalObject:!0};const n=await this._rapiAccess.saveConfiguration(t);this._configuratorUiCallbacks.onConfigurationSaved(n.configurationHash);const o=await this._rapiAccess.getComponent(n.rootComponentId);let i=null,r=null;if(n.perspectiveImage&&!this._initData.featureFlags.forceSaveThumbnails||(i=await this._sceneManager.preparePerspectiveImage()),n.topImage&&!this._initData.featureFlags.forceSaveThumbnails||(r=await this._sceneManager.prepareTopImage()),i&&r){const e=await this._rapiAccess.saveConfigurationImage(n,i,"perspectiveImage",r,"topImage");n.perspectiveImage=e.perspectiveImage,n.topImage=e.topImage}return n.label=o.label,n.externalObject=!1,this._rapiAccess.updateCache("configurations",n),n}catch(e){throw new Error(e)}}generateImagesOfCurrentConfiguration(){return new Promise((e,t)=>this.saveCurrentConfiguration().then(t=>e({topImage:t.topImage,perspectiveImage:t.perspectiveImage,isLocally:t.isLocally}),t))}prepareTopImage(e){let t={};return"boolean"==typeof e?t.showDimensions=e:(e||(e={}),"boolean"!=typeof e.showDimensions&&(e.showDimensions=!1),t=e),this._sceneManager.prepareTopImage(t)}resetCameraPosition(){this._sceneManager.resetCameraPositionToStart()}showBenchmarks(e){Benchmark.showBenchmarks(e)}debugSceneGraph(e){this._sceneManager.debugSceneGraph(e)}async loadConfiguration(e,t){this.setOverrides(t),this._configuratorContext.lastLoadedRapiId=null,this._sceneManager&&this._sceneManager.clearScene();const n=await this._performLoadConfiguration(e);return this._rapiAccess.trackView("configuration string"),n}async loadConfigurationById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!0);return this._rapiAccess.trackView(e),n}async loadConfigurableItemById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!1);return this._rapiAccess.trackView(e),n}preLoadConfigurationById(e){return this._preLoadItemOrConfig(e,!0)}preLoadConfigurableItemById(e){return this._preLoadItemOrConfig(e,!1)}_getTag(e){return this._rapiAccess.getTag(e)}_dispatchSetParameter(e,t,n,o,i){const r=this._configuratorContext.selectedRuntimeComponentId?"local":"global";switch(Benchmark.start("kernel_change_param_"+r+"_"+e),this._configuratorContext.selectionMode){case"standard":if(this._configuratorContext.selectedRuntimeComponentId||this._configuratorContext.rootComponentParametersAsGlobal){let r=this._configuratorContext.selectedRuntimeComponentId?this._configuratorContext.selectedRuntimeComponentId:this._configuratorContext.rootComponentId;this._plannerKernelAccess.changeComponentParameter(r,e,t,n,o,i)}else this._plannerKernelAccess.changePlanObjectParameter(this._configuratorContext.planObjectId,e,t,n,o,i);break;case"multiselect":this._plannerKernelAccess.changeCommonComponentParameter(this._configuratorContext.selectedRuntimeComponentIds,e,t,n,o,i)}}setParameter(e,t,n=!1){return new Promise((o,i)=>{const{key:r,type:s}=e;if(isRange(e)){if(!n&&!this._unitFormatter.isParseableUnitString(t,e))return i(new SyntaxError('Value "'+t+'" is not parseable'));const o=n?t:this._unitFormatter.parseValue(t,e),{valueFrom:r,valueTo:a}=e.validRange,c=this._unitFormatter.getAllowedDelta();if(!Number.isNaN(r)&&o<r-c)return i(new RangeError('Value "'+t+'" is too small, min-val "'+r+'"'));if(!Number.isNaN(a)&&o>a+c)return i(new RangeError('Value "'+t+'" is too big, max-val "'+a+'"'));t="Integer"===s&&"number"==typeof o?o.toFixed():o.toString()}this._sceneManager.cancelDockings(),this._dispatchSetParameter(r,s,t,o,i),this._sceneManager.saveConfigToIdb()})}setParameterOfPlanObject(e,t){return new Promise((n,o)=>{const{planObjectId:i,rootComponentId:r,rootComponentParametersAsGlobal:s}=this._configuratorContext,{type:a,key:c}=e;s?this._plannerKernelAccess.changeComponentParameter(r,c,a,t,n,o):this._plannerKernelAccess.changePlanObjectParameter(i,c,a,t,n,o)})}getParametersOfPlanObject(){const{planObjectId:e,rootComponentParametersAsGlobal:t}=this._configuratorContext;return this._plannerKernelAccess.getGlobalParameters(e,t)}setParameterOfRootComponent(e,t){return new Promise((n,o)=>{const{rootComponentId:i}=this._configuratorContext,{type:r,key:s}=e;this._plannerKernelAccess.changeComponentParameter(i,s,r,t,n,o)})}getParametersOfRootComponent(){const{planObjectId:e}=this._configuratorContext;return this._plannerKernelAccess.getGlobalParameters(e,!0)}enableMultiselect(){this._sceneManager.setSelectionMode("multiselect"),this._configuratorContext.selectionMode="multiselect"}disableMultiselect(){this._sceneManager.setSelectionMode("standard"),this._configuratorContext.selectionMode="standard"}getCurrentConfiguration(){return AsyncHelper.waitFor(1,()=>this._plannerKernelAccess.uiRequestConfiguration(this._configuratorContext.planObjectId))}loadComponentIntoKernel(e){return AsyncHelper.waitFor(0,()=>{let t=null;try{if(t=JSON.parse(e).id,!t)throw new Error("Component string has no ID")}catch(e){return this._configuratorUiCallbacks.onContentProblem({rapiPath:"components",ids:[t],message:"Component string is not a valid JSON or has no ID"}),void AsyncHelper.failOperation(0,e)}this._kernelIo.setMeta({componentId:t}),this._plannerKernelAccess.loadComponentIntoKernel(e,t)})}getShortUrlOfCurrentConfiguration(){return new Promise((e,t)=>{this.saveCurrentConfiguration().then(n=>navigator.onLine?this._rapiAccess.getShortUrl(n.id,3).then(t=>{const n=t.shortId,o=Env.APP.SHORTENER_URL+n;e(o)},t):t("Can not generate short url when offline"),t)})}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}getTagById(e,t){return new Promise((n,o)=>{this._getTag(e).then(e=>{let i=Promise.resolve([]),r=Promise.resolve([]);t&&t.include&&t.include.forEach(t=>{"materials"===t&&(i=this._rapiAccess.getMaterialsOf(e)),"items"===t&&(r=this._rapiAccess.getItems(e.items))}),Promise.all([i,r]).then(([t,o])=>(o.sort(sortBySort),t.sort(sortBySort),n({...e,items:o,materials:t})),o)},o)})}requestAsset(e){return this._dataSyncer.requestAsset(e)}changeFloorMaterial(e){return this._sceneManager.changeFloorMaterial(e)}async changeFloorMaterialById(e){const t=await this._rapiAccess.getMaterial(e);return this._sceneManager.changeFloorMaterial(t)}openFloorMaterials(){this._configuratorUiCallbacks.onOpenFloorMaterials()}openPartList(){this._configuratorUiCallbacks.onOpenPartList()}getAdditionalContentsOf(e){return this._rapiAccess.getAdditionalContentsOfItems(e)}changeTypeChangeTag(e){navigator.onLine&&this._initData.offlineSync&&this._dataSyncer.syncTypeChangeTag(e),this._configuratorUiCallbacks.onChangeTypeChangeTag(e)}removeTypeChangeTag(e){this._configuratorUiCallbacks.onRemoveTypeChangeTag(e)}showGUI(){this._sceneManager.showGUI()}showStats(){this._sceneManager.showStats()}showDimensions(){this._sceneManager.showDimensions()}hideDimensions(){this._sceneManager.hideDimensions()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}syncFloorTag(e){return this._dataSyncer.syncFloorTag(e)}syncTypeChangeTag(e){return this._dataSyncer.syncTypeChangeTag(e)}loadDynamicLightSetting(e){return this._sceneManager.loadDynamicLightSetting(e)}setBackgroundColor(e){this._sceneManager.setBackgroundColor(e)}setBackgroundImage(e){this._sceneManager.setBackgroundImage(e)}loadSceneSetting(e){return this._sceneManager.loadSceneSettings(e)}enableMeshSelection(e){this._initData.meshSelection=e}updateSize(){this._sceneManager.updateCamera()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}getCameraOffset(){return this._sceneManager.getCameraOffset()}getMain(){}cleanup(e={}){this._configuratorContext.selectedRuntimeComponentIds=[],this._plannerKernelAccess.cleanUpCallbacks(),this._sceneManager.sceneCleared(!!e.resetMeshCache),e.resetCoreCache&&this._plannerKernelAccess.kernelInstance.clearAll(),e.resetApiCache&&this._rapiAccess.cleanUp()}resumeTest(e){e&&this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}zoomIn(e){this._sceneManager.zoomIn(e)}zoomOut(e){this._sceneManager.zoomOut(e)}get callbacks(){return this._configuratorUiCallbacks}get globalCallbacks(){return this._globalCallback}getRuntimeComponentIdOfRootComponent(){const e=this._configuratorContext.planObjectId;return e?this._plannerKernelAccess.getRuntimeComponentIdOfRootComponent(e):(console.warn("planObjectId not set"),0)}getCurrentConfigurationHash(){return this._plannerKernelAccess.getConfigurationHash(this._configuratorContext)}getCurrentSelection(){let e=this._configuratorContext.selectedRuntimeComponentIds;return e&&e.length||(e=[this._configuratorContext.rootComponentId]),e.map(e=>this._plannerKernelAccess.getRuntimeComponentId(e))}isReady(){const e=Benchmark.getMeasure("kernel_is_ready");if(Array.isArray(e)&&1===e.length){const t=e[0],n=Benchmark.getMeta("kernel_is_ready");this._configuratorUiCallbacks.onTrackTiming("Timing","KernelIsReady",Math.round(t.duration),Object.assign(n,{startTime:t.startTime}))}this._isKernelReady=!0,this._checkInitDone(),"function"==typeof this._configuratorUiCallbacks.onKernelIsReady&&this._configuratorUiCallbacks.onKernelIsReady()}async updatePossibleChildren(e,t,n){const o=await this._addAdditionalInfoToPossibleChildren(e,t,n);if(o){const{tags:e,defaultChild:t}=o;this._shouldBroadcastToUi(n)&&this._configuratorUiCallbacks.onUpdatePossibleChildren(e,t)}}updateParameters(e,t,n,o){this._setParameterTooltip(e,n),this._addGroupsToParameters(n,e,t,o),this._plannerKernelAccess.updateAnimationParameters(n,e),this._shouldBroadcastToUi(o)&&this._configuratorUiCallbacks.onUpdateParameters(e)}loadError(e){this._isLoadError=!0,this._rejectOnLoadError&&this._rejectOnLoadError(e)}resumeKernelCallbacks(){this._plannerKernelAccess.muteKernelCallbacks=!1,this._plannerKernelAccess.resume()}pauseKernelCallbacks(){this._plannerKernelAccess.muteKernelCallbacks=!0,this._plannerKernelAccess.pause()}setActiveGroupInView(e){this._plannerKernelAccess.setActiveGroupInView(e)}setActiveGroupInViewForPlanObject(e,t){this._plannerKernelAccess.setActiveGroupInViewForPlanObject(e,t)}getParameterGroups(){return this._plannerKernelAccess.getParameterGroups()}async getConfiguratorSettings(){return this._rapiAccess.getConfiguratorSettings()}async moveCamera(e){return this._sceneManager.moveCamera(e)}selectComponent(e){return this._configuratorContext.selectedRuntimeComponentId===e?Promise.resolve():Promise.resolve(this._sceneManager.selectComponent(e))}setComponentParameter(e,t,n){const{key:o,type:i}=t;return new Promise((t,r)=>this._plannerKernelAccess.changeComponentParameter(e,o,i,n,t,r))}highlightParts(e){this._sceneManager.highlightParts(e)}undo(){return new Promise((e,t)=>{const n=this._configuratorHistory.undo();n&&(this._callOnPartListUpdate().then(e,t),this._plannerKernelAccess.loadConfiguration(n))})}redo(){return new Promise((e,t)=>{const n=this._configuratorHistory.redo();n&&(this._callOnPartListUpdate().then(e,t),this._plannerKernelAccess.loadConfiguration(n))})}clearHistory(){this._configuratorHistory.clearHistory()}getHashOfSerializedConfiguration(e){return this._plannerKernelAccess.kernelInstance.getHashOfSerializedConfiguration(e)}getParametersOfComponent(e){const t=this._plannerKernelAccess.getComponentParameters(e),n=this.getParameterGroups();return this._mapComponentTooltipsToParamKeys(t,e),this._addGroupsToParameters(e,t,n,1,!0)}_mapComponentTooltipsToParamKeys(e,t){const n=this._plannerKernelAccess.kernelInstance.getComponentId(t),o=this._rapiAccess.peekComponent(n);if(o&&o.additionalInfos)for(const t of e){const e=o.additionalInfos.find(e=>e.key.toLocaleLowerCase()===t.key.toLocaleLowerCase()&&"parameter"===e.type);e&&(t.tooltip=e.tooltip,t.additionalInfos=o.additionalInfos)}}_setParameterTooltip(e,t){Array.isArray(t)?t.forEach(t=>this._mapComponentTooltipsToParamKeys(e,t)):this._mapComponentTooltipsToParamKeys(e,t)}_addGroupsToParameters(e,t,n,o,i=!1){n||(n=[],console.warn("Kernel returned no parameter groups! Check why!"));const r={};return n.forEach(e=>{r[e.key]=e}),t.sort(sortBySort),t.forEach(t=>{t.group?t.grouping=r[t.group]:t.grouping=null,this._unitFormatter.formatParameter(t),isMaterial(t)&&Object.defineProperty(t,"groups",{get:()=>new Promise((n,r)=>{this._getMaterialGroups(t).then(t=>{this._isCorrectResponse(o,e)&&this._shouldBroadcastToUi(o)||i?n(t):r("Response does not match to ids")},r)})})}),t}async _getChildrenOf(e,t,n,o){const i=o(e,t,n);return await this._addAdditionalInfoToPossibleChildren(e,i,2,!1,!0)}async getChildrenOfPlanComponent(e,t=!1,n=!1){const o=this._plannerKernelAccess.kernelInstance.getChildrenOfPlanComponent.bind(this._plannerKernelAccess.kernelInstance);return this._getChildrenOf(e,t,n,o)}async getChildrenOfPlanObject(e=!1,t=!1){const{planObjectId:n}=this._configuratorContext,o=this._plannerKernelAccess.kernelInstance.getChildrenOfPlanObject.bind(this._plannerKernelAccess.kernelInstance);return this._getChildrenOf(n,e,t,o)}async _addAdditionalInfoToPossibleChildren(e,t,n,o=!0,i=!1){const{possibleChildren:r,defaultChild:s}=await this._getPossibleChildrenForKernelPossibleChildren(t,i),a=[],c=new Map,l=[];if(r.forEach(e=>{const t=e.tags;if(e.tags&&Array.isArray(e.tags)&&e.tags.length)for(let n=0,o=e.tags.length;n<o;n++){const o=t[n];-1===a.indexOf(o)&&a.push(o);let i=c.get(o);if(!i){const e=[];c.set(o,e),i=c.get(o)}i.push(e)}else l.push(e)}),this._isCorrectResponse(n,e)||!o){let e=[];try{e=(await this._rapiAccess.getTags(a)).map(e=>({...e,possibleChildren:c.get(e.id)}))}catch(t){console.error("Couldnt load tags of possible children"),console.error(t),e=[]}return e.sort(sortBySort),l.length&&e.unshift({id:"",externalIdentifier:"",global:!1,created:(new Date).toISOString(),updated:(new Date).toISOString(),language:this._globalInitData.locale,catalog:null,tags:[],parents:[],materials:[],items:[],possibleChildren:l}),{tags:e,defaultChild:s}}return null}async _getPossibleChildrenForKernelPossibleChildren(e,t=!1){const n=[],o=[];let i;const r=new Map,s=new Map;e.forEach(e=>{if(!e.possible&&!t)return;let a=e.itemId;e.itemId?(o.push(e.itemId),s.has(e.itemId)?s.get(e.itemId).push(e):s.set(e.itemId,[e])):(n.push(e.componentId),r.has(e.componentId)?r.get(e.componentId).push(e):r.set(e.componentId,[e]),a=e.componentId),e.isDefault&&!i&&(i=a)});const a=await Promise.all([this._rapiAccess.getComponents(n),this._rapiAccess.getItems(o)]),c=a[0],l=a[1],h=[];let d=null;return c.forEach(e=>{var t;e.isItem=!1,e.isComponent=!0;for(const n of null!==(t=r.get(e.id))&&void 0!==t?t:[]){const t=JSON.parse(JSON.stringify(e));t.group=n.group,t.possible=n.possible,t.id===i&&(t.isDefault=!0,d=t),h.push(t)}}),l.forEach(e=>{var t;e.isItem=!0,e.isComponent=!1;for(const n of null!==(t=s.get(e.id))&&void 0!==t?t:[]){const t=JSON.parse(JSON.stringify(e));t.group=n.group,t.possible=n.possible,t.id===i&&(t.isDefault=!0,d=t),h.push(t)}}),h.sort(sortBySort),{possibleChildren:h,defaultChild:d}}getUnitFormatter(){return this._unitFormatter}getStorage(){return this._idbManager}getConfiguratorContext(){return this._configuratorContext}getComponent(e){return this._sceneManager.getComponent(e)}async getTools(){const e=RoomleDependencyInjection.lookup("roomle-tools-core",this._creator_);return await e.init(),e}exportImageFromCamera(e="image",t=!1){return this._sceneManager.exportImageFromCamera(e,t)}calcPartsPriceSum(e){return this._plannerKernelAccess.calcPartsPriceSum(e)}async generateProductionServiceExport(e=""){return this.generateHomagIxExport(0,e)}async generateTCExport(e=""){return this.generateHomagIxExport(0,e)}async generateIMOSiXExport(e=""){return this.generateHomagIxExport(1,e)}async generateHOMAGiXExport(e="",t={},n={},o={}){let i=await this.generateHomagIxExport(2,e);const{homagIxMockUpData:r}=await import("./imos-ix-poc-export-helper-9404ff2e.js");return r(i,t,n,o)}async downloadHomagIxExportPoC(){const e=await this.generateHOMAGiXExport();download("IMOSiX.xml",e)}async generateHomagIxExport(e,t=""){const{generateExportHomagIxConfiguration:n}=await import("./imos-ix-poc-export-helper-9404ff2e.js"),o=this._configuratorContext.planObjectId;n(o,e,this._plannerKernelAccess.configurationExporter,this._plannerKernelAccess.kernelInstance,t);try{return this._plannerKernelAccess.configurationExporter.setDefaultExportDataDefinition(t),Promise.resolve(JSON.parse(this._plannerKernelAccess.configurationExporter.generateExport(e,o,this._plannerKernelAccess.kernelInstance)))}catch(t){return console.error(t),Promise.reject("Could not create export JSON "+e)}}setEnvironmentMap(e){const{url:t,intensity:n,rotation:o,maxLightSources:i}=e;this._sceneManager.setEnvironmentMap(t,n,o,i)}enableEvents(){this._sceneManager.enableEvents()}disableEvents(){this._sceneManager.disableEvents()}enableDebugging(){const e={debugValueMapChange:e=>{this.callbacks.onValueMapChanged(e)}};this._plannerKernelAccess.addDebugClient(e)}}__decorate([inject],RoomleConfigurator.prototype,"_rapiAccess",void 0),__decorate([inject],RoomleConfigurator.prototype,"_dataSyncer",void 0),__decorate([inject],RoomleConfigurator.prototype,"_errorHandler",void 0),__decorate([inject],RoomleConfigurator.prototype,"_unitFormatter",void 0),__decorate([inject],RoomleConfigurator.prototype,"_idbManager",void 0),__decorate([inject],RoomleConfigurator.prototype,"_domHelper",void 0),__decorate([inject],RoomleConfigurator.prototype,"_configuratorUiCallbacks",void 0),__decorate([inject],RoomleConfigurator.prototype,"_configuratorKernelAccessCallback",void 0),__decorate([inject],RoomleConfigurator.prototype,"_lifeCycleManager",void 0),__decorate([inject],RoomleConfigurator.prototype,"_plannerKernelAccess",void 0),__decorate([inject],RoomleConfigurator.prototype,"_scriptLoader",void 0),__decorate([inject],RoomleConfigurator.prototype,"_configuratorContext",void 0),__decorate([inject],RoomleConfigurator.prototype,"_initData",void 0),__decorate([inject],RoomleConfigurator.prototype,"_globalInitData",void 0),__decorate([inject],RoomleConfigurator.prototype,"_globalCallback",void 0),__decorate([inject],RoomleConfigurator.prototype,"_kernelIo",void 0),__decorate([inject],RoomleConfigurator.prototype,"_configuratorHistory",void 0);export{ConfiguratorSceneManager as C,PlanViewModel as P,RoomleConfigurator as R,SceneEventHandler as S,ConfiguratorViewModel as a,RAYCAST_PRIORITY as b,ConfiguratorCameraBehaviour as c};
2
+ //# sourceMappingURL=roomle-configurator-c663d225.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roomle-configurator-c663d225.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}