@roomle/web-sdk 2.76.0 → 2.77.0-alpha.2

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 (189) hide show
  1. package/lib/{banana-for-scale-00c51c97.nomodule.js → banana-for-scale-747faad0.nomodule.js} +2 -2
  2. package/lib/{banana-for-scale-00c51c97.nomodule.js.map → banana-for-scale-747faad0.nomodule.js.map} +1 -1
  3. package/lib/{banana-for-scale-6bb1ee7e.js → banana-for-scale-9b1f01e9.js} +2 -2
  4. package/lib/{banana-for-scale-6bb1ee7e.js.map → banana-for-scale-9b1f01e9.js.map} +1 -1
  5. package/lib/{camera-behaviour-c7eaa412.js → camera-behaviour-d6af6d09.js} +2 -2
  6. package/lib/{camera-behaviour-c7eaa412.js.map → camera-behaviour-d6af6d09.js.map} +1 -1
  7. package/lib/{camera-behaviour-35b9043c.nomodule.js → camera-behaviour-eee26e60.nomodule.js} +2 -2
  8. package/lib/{camera-behaviour-35b9043c.nomodule.js.map → camera-behaviour-eee26e60.nomodule.js.map} +1 -1
  9. package/lib/{component-dimensioning-be6f4978.nomodule.js → component-dimensioning-505e3be3.nomodule.js} +2 -2
  10. package/lib/component-dimensioning-505e3be3.nomodule.js.map +1 -0
  11. package/lib/{component-dimensioning-b340ff88.js → component-dimensioning-a87836c0.js} +2 -2
  12. package/lib/component-dimensioning-a87836c0.js.map +1 -0
  13. package/lib/{component-raycast-helper-fbc6ea71.js → component-raycast-helper-357d58fb.js} +2 -2
  14. package/lib/component-raycast-helper-357d58fb.js.map +1 -0
  15. package/lib/{component-raycast-helper-b5e775b6.nomodule.js → component-raycast-helper-4260f5f3.nomodule.js} +2 -2
  16. package/lib/component-raycast-helper-4260f5f3.nomodule.js.map +1 -0
  17. package/lib/{configurator-0545dd74.nomodule.js → configurator-28c8e5dc.nomodule.js} +2 -2
  18. package/lib/configurator-28c8e5dc.nomodule.js.map +1 -0
  19. package/lib/{configurator-e8e7249b.js → configurator-7be15b5d.js} +2 -2
  20. package/lib/configurator-7be15b5d.js.map +1 -0
  21. package/lib/configurator-main-9627b78d.js +2 -0
  22. package/lib/configurator-main-9627b78d.js.map +1 -0
  23. package/lib/configurator-main.nomodule.js +1 -1
  24. package/lib/{continuous-drawing-helper-3bf27c77.js → continuous-drawing-helper-51677944.js} +2 -2
  25. package/lib/continuous-drawing-helper-51677944.js.map +1 -0
  26. package/lib/{continuous-drawing-helper-c48a8810.nomodule.js → continuous-drawing-helper-ecb99fa7.nomodule.js} +2 -2
  27. package/lib/continuous-drawing-helper-ecb99fa7.nomodule.js.map +1 -0
  28. package/lib/{default-light-setting-50a8aae2.js → default-light-setting-432c00f7.js} +2 -2
  29. package/lib/default-light-setting-432c00f7.js.map +1 -0
  30. package/lib/{default-light-setting-4b8e7ee6.nomodule.js → default-light-setting-8492f1aa.nomodule.js} +2 -2
  31. package/lib/default-light-setting-8492f1aa.nomodule.js.map +1 -0
  32. package/lib/definitions/common-core/src/configurator-kernel-access.d.ts +1 -0
  33. package/lib/definitions/common-core/src/utils/shims.d.ts +2 -2
  34. package/lib/definitions/configurator-core/src/roomle-configurator.d.ts +4 -4
  35. package/lib/definitions/configurator-core/src/services/configurator-ui-callback.d.ts +2 -2
  36. package/lib/definitions/glb-viewer-core/src/roomle-glb-viewer.d.ts +1 -1
  37. package/lib/definitions/material-viewer/src/roomle-material-viewer.d.ts +1 -1
  38. package/lib/definitions/planner-core/src/roomle-planner-ui-callback.d.ts +5 -0
  39. package/lib/definitions/typings/kernel.d.ts +1 -0
  40. package/lib/{dimensioning-helper-ab6b7f69.js → dimensioning-helper-02499f1a.js} +2 -2
  41. package/lib/{dimensioning-helper-ab6b7f69.js.map → dimensioning-helper-02499f1a.js.map} +1 -1
  42. package/lib/{dimensioning-helper-c84c6aa3.nomodule.js → dimensioning-helper-be6a25b7.nomodule.js} +2 -2
  43. package/lib/{dimensioning-helper-c84c6aa3.nomodule.js.map → dimensioning-helper-be6a25b7.nomodule.js.map} +1 -1
  44. package/lib/{glb-viewer-622cb79a.nomodule.js → glb-viewer-7282caf7.nomodule.js} +2 -2
  45. package/lib/{glb-viewer-622cb79a.nomodule.js.map → glb-viewer-7282caf7.nomodule.js.map} +1 -1
  46. package/lib/{glb-viewer-camera-behaviour-6088e966.js → glb-viewer-camera-behaviour-94516099.js} +2 -2
  47. package/lib/glb-viewer-camera-behaviour-94516099.js.map +1 -0
  48. package/lib/{glb-viewer-camera-behaviour-8633618f.nomodule.js → glb-viewer-camera-behaviour-bee9e036.nomodule.js} +2 -2
  49. package/lib/glb-viewer-camera-behaviour-bee9e036.nomodule.js.map +1 -0
  50. package/lib/{glb-viewer-4a506f4e.js → glb-viewer-f88249d7.js} +2 -2
  51. package/lib/{glb-viewer-4a506f4e.js.map → glb-viewer-f88249d7.js.map} +1 -1
  52. package/lib/glb-viewer-main-42ec8932.js +2 -0
  53. package/lib/glb-viewer-main-42ec8932.js.map +1 -0
  54. package/lib/glb-viewer-main.nomodule.js +1 -1
  55. package/lib/legacy/{banana-for-scale-ebedc20c.legacy.js → banana-for-scale-adf89519.legacy.js} +2 -2
  56. package/lib/legacy/{banana-for-scale-ebedc20c.legacy.js.map → banana-for-scale-adf89519.legacy.js.map} +1 -1
  57. package/lib/legacy/{camera-behaviour-022aa24e.legacy.js → camera-behaviour-529c19c2.legacy.js} +2 -2
  58. package/lib/legacy/{camera-behaviour-022aa24e.legacy.js.map → camera-behaviour-529c19c2.legacy.js.map} +1 -1
  59. package/lib/legacy/{component-dimensioning-5e8990a3.legacy.js → component-dimensioning-480dad60.legacy.js} +2 -2
  60. package/lib/legacy/component-dimensioning-480dad60.legacy.js.map +1 -0
  61. package/lib/legacy/{component-raycast-helper-e04ecdef.legacy.js → component-raycast-helper-a732cc57.legacy.js} +2 -2
  62. package/lib/legacy/component-raycast-helper-a732cc57.legacy.js.map +1 -0
  63. package/lib/legacy/{configurator-a4557504.legacy.js → configurator-0ee3fb6e.legacy.js} +2 -2
  64. package/lib/legacy/configurator-0ee3fb6e.legacy.js.map +1 -0
  65. package/lib/legacy/configurator-main.legacy.js +1 -1
  66. package/lib/legacy/{continuous-drawing-helper-605724b0.legacy.js → continuous-drawing-helper-1c6ee6c9.legacy.js} +2 -2
  67. package/lib/legacy/continuous-drawing-helper-1c6ee6c9.legacy.js.map +1 -0
  68. package/lib/legacy/{default-light-setting-4bfdc4a5.legacy.js → default-light-setting-e546d92d.legacy.js} +2 -2
  69. package/lib/legacy/default-light-setting-e546d92d.legacy.js.map +1 -0
  70. package/lib/legacy/{dimensioning-helper-d2bd342f.legacy.js → dimensioning-helper-d367a9ae.legacy.js} +2 -2
  71. package/lib/legacy/{dimensioning-helper-d2bd342f.legacy.js.map → dimensioning-helper-d367a9ae.legacy.js.map} +1 -1
  72. package/lib/legacy/{glb-viewer-c3cdd113.legacy.js → glb-viewer-32520b42.legacy.js} +2 -2
  73. package/lib/legacy/{glb-viewer-c3cdd113.legacy.js.map → glb-viewer-32520b42.legacy.js.map} +1 -1
  74. package/lib/legacy/{glb-viewer-camera-behaviour-db58cf5d.legacy.js → glb-viewer-camera-behaviour-e7544c90.legacy.js} +2 -2
  75. package/lib/legacy/glb-viewer-camera-behaviour-e7544c90.legacy.js.map +1 -0
  76. package/lib/legacy/glb-viewer-main.legacy.js +1 -1
  77. package/lib/legacy/{material-viewer-8323195c.legacy.js → material-viewer-9f4642e2.legacy.js} +2 -2
  78. package/lib/legacy/material-viewer-9f4642e2.legacy.js.map +1 -0
  79. package/lib/legacy/material-viewer-main.legacy.js +1 -1
  80. package/lib/legacy/planner-ca9be806.legacy.js +2 -0
  81. package/lib/legacy/{planner-b5bb8ed7.legacy.js.map → planner-ca9be806.legacy.js.map} +1 -1
  82. package/lib/legacy/planner-main.legacy.js +1 -1
  83. package/lib/legacy/roomle-configurator-35ccd5e3.legacy.js +2 -0
  84. package/lib/legacy/roomle-configurator-35ccd5e3.legacy.js.map +1 -0
  85. package/lib/legacy/{roomle-dependency-injection-d61f4763.legacy.js → roomle-dependency-injection-32a7ed2e.legacy.js} +3 -3
  86. package/lib/legacy/{roomle-dependency-injection-d61f4763.legacy.js.map → roomle-dependency-injection-32a7ed2e.legacy.js.map} +1 -1
  87. package/lib/legacy/roomle-sdk.legacy.js +1 -1
  88. package/lib/legacy/{script-loader-0d8dab5c.legacy.js → script-loader-d14aa469.legacy.js} +2 -2
  89. package/lib/legacy/script-loader-d14aa469.legacy.js.map +1 -0
  90. package/lib/legacy/static/ConfiguratorKernel-c4372bbeb5743db2.wasm +0 -0
  91. package/lib/legacy/static/RoomleCore-0a87ce9a99621bd9.wasm +0 -0
  92. package/lib/{static/RoomleToolsCore-3ed4fcaccf294e37.wasm → legacy/static/RoomleToolsCore-61c01f70818028fb.wasm} +0 -0
  93. package/lib/legacy/{stats-helper-3a7e4556.legacy.js → stats-helper-048249dd.legacy.js} +2 -2
  94. package/lib/legacy/stats-helper-048249dd.legacy.js.map +1 -0
  95. package/lib/legacy/{tools-core-6800c7b7.legacy.js → tools-core-bef6b8f0.legacy.js} +2 -2
  96. package/lib/legacy/tools-core-bef6b8f0.legacy.js.map +1 -0
  97. package/lib/{material-viewer-ea6dba3f.js → material-viewer-561c5edf.js} +2 -2
  98. package/lib/material-viewer-561c5edf.js.map +1 -0
  99. package/lib/{material-viewer-ac971800.nomodule.js → material-viewer-da069f1a.nomodule.js} +2 -2
  100. package/lib/material-viewer-da069f1a.nomodule.js.map +1 -0
  101. package/lib/material-viewer-main-36f6466f.js +2 -0
  102. package/lib/material-viewer-main-36f6466f.js.map +1 -0
  103. package/lib/material-viewer-main.nomodule.js +1 -1
  104. package/lib/planner-2128f72c.js +2 -0
  105. package/lib/{planner-e8b990fe.js.map → planner-2128f72c.js.map} +1 -1
  106. package/lib/planner-948239c6.nomodule.js +2 -0
  107. package/lib/{planner-7f1380f3.nomodule.js.map → planner-948239c6.nomodule.js.map} +1 -1
  108. package/lib/planner-main-feee1b27.js +2 -0
  109. package/lib/planner-main-feee1b27.js.map +1 -0
  110. package/lib/planner-main.nomodule.js +1 -1
  111. package/lib/roomle-configurator-760afe57.nomodule.js +2 -0
  112. package/lib/roomle-configurator-760afe57.nomodule.js.map +1 -0
  113. package/lib/roomle-configurator-b8abfbd1.js +2 -0
  114. package/lib/roomle-configurator-b8abfbd1.js.map +1 -0
  115. package/lib/{roomle-dependency-injection-a1a06d1e.nomodule.js → roomle-dependency-injection-b567df3a.nomodule.js} +3 -3
  116. package/lib/{roomle-dependency-injection-a1a06d1e.nomodule.js.map → roomle-dependency-injection-b567df3a.nomodule.js.map} +1 -1
  117. package/lib/{roomle-dependency-injection-ae5fa28d.js → roomle-dependency-injection-d3a8c907.js} +3 -3
  118. package/lib/{roomle-dependency-injection-ae5fa28d.js.map → roomle-dependency-injection-d3a8c907.js.map} +1 -1
  119. package/lib/{roomle-sdk-2ab19e90.js → roomle-sdk-7a4f6fc0.js} +2 -2
  120. package/lib/roomle-sdk-7a4f6fc0.js.map +1 -0
  121. package/lib/roomle-sdk.nomodule.js +1 -1
  122. package/lib/{script-loader-234d078e.js → script-loader-3c5eb130.js} +2 -2
  123. package/lib/script-loader-3c5eb130.js.map +1 -0
  124. package/lib/{script-loader-687f7fbc.nomodule.js → script-loader-ed493cd8.nomodule.js} +2 -2
  125. package/lib/script-loader-ed493cd8.nomodule.js.map +1 -0
  126. package/lib/static/ConfiguratorKernel-c4372bbeb5743db2.wasm +0 -0
  127. package/lib/static/RoomleCore-0a87ce9a99621bd9.wasm +0 -0
  128. package/lib/{legacy/static/RoomleToolsCore-3ed4fcaccf294e37.wasm → static/RoomleToolsCore-61c01f70818028fb.wasm} +0 -0
  129. package/lib/{stats-helper-b09eb905.js → stats-helper-92c35a95.js} +2 -2
  130. package/lib/stats-helper-92c35a95.js.map +1 -0
  131. package/lib/{stats-helper-e97ec5e1.nomodule.js → stats-helper-9bdccb5b.nomodule.js} +2 -2
  132. package/lib/stats-helper-9bdccb5b.nomodule.js.map +1 -0
  133. package/lib/{tools-core-33ca2cb1.js → tools-core-86b0b79b.js} +2 -2
  134. package/lib/tools-core-86b0b79b.js.map +1 -0
  135. package/lib/{tools-core-fd03b0a0.nomodule.js → tools-core-9e4e23dc.nomodule.js} +2 -2
  136. package/lib/tools-core-9e4e23dc.nomodule.js.map +1 -0
  137. package/package.json +2 -2
  138. package/lib/component-dimensioning-b340ff88.js.map +0 -1
  139. package/lib/component-dimensioning-be6f4978.nomodule.js.map +0 -1
  140. package/lib/component-raycast-helper-b5e775b6.nomodule.js.map +0 -1
  141. package/lib/component-raycast-helper-fbc6ea71.js.map +0 -1
  142. package/lib/configurator-0545dd74.nomodule.js.map +0 -1
  143. package/lib/configurator-e8e7249b.js.map +0 -1
  144. package/lib/configurator-main-422f9df6.js +0 -2
  145. package/lib/configurator-main-422f9df6.js.map +0 -1
  146. package/lib/continuous-drawing-helper-3bf27c77.js.map +0 -1
  147. package/lib/continuous-drawing-helper-c48a8810.nomodule.js.map +0 -1
  148. package/lib/default-light-setting-4b8e7ee6.nomodule.js.map +0 -1
  149. package/lib/default-light-setting-50a8aae2.js.map +0 -1
  150. package/lib/glb-viewer-camera-behaviour-6088e966.js.map +0 -1
  151. package/lib/glb-viewer-camera-behaviour-8633618f.nomodule.js.map +0 -1
  152. package/lib/glb-viewer-main-06539243.js +0 -2
  153. package/lib/glb-viewer-main-06539243.js.map +0 -1
  154. package/lib/legacy/component-dimensioning-5e8990a3.legacy.js.map +0 -1
  155. package/lib/legacy/component-raycast-helper-e04ecdef.legacy.js.map +0 -1
  156. package/lib/legacy/configurator-a4557504.legacy.js.map +0 -1
  157. package/lib/legacy/continuous-drawing-helper-605724b0.legacy.js.map +0 -1
  158. package/lib/legacy/default-light-setting-4bfdc4a5.legacy.js.map +0 -1
  159. package/lib/legacy/glb-viewer-camera-behaviour-db58cf5d.legacy.js.map +0 -1
  160. package/lib/legacy/material-viewer-8323195c.legacy.js.map +0 -1
  161. package/lib/legacy/planner-b5bb8ed7.legacy.js +0 -2
  162. package/lib/legacy/roomle-configurator-876d1ced.legacy.js +0 -2
  163. package/lib/legacy/roomle-configurator-876d1ced.legacy.js.map +0 -1
  164. package/lib/legacy/script-loader-0d8dab5c.legacy.js.map +0 -1
  165. package/lib/legacy/static/ConfiguratorKernel-031e65eaee5cacde.wasm +0 -0
  166. package/lib/legacy/static/RoomleCore-55c9812f52948f19.wasm +0 -0
  167. package/lib/legacy/stats-helper-3a7e4556.legacy.js.map +0 -1
  168. package/lib/legacy/tools-core-6800c7b7.legacy.js.map +0 -1
  169. package/lib/material-viewer-ac971800.nomodule.js.map +0 -1
  170. package/lib/material-viewer-ea6dba3f.js.map +0 -1
  171. package/lib/material-viewer-main-2d9d0a22.js +0 -2
  172. package/lib/material-viewer-main-2d9d0a22.js.map +0 -1
  173. package/lib/planner-7f1380f3.nomodule.js +0 -2
  174. package/lib/planner-e8b990fe.js +0 -2
  175. package/lib/planner-main-39d3166e.js +0 -2
  176. package/lib/planner-main-39d3166e.js.map +0 -1
  177. package/lib/roomle-configurator-4136c482.js +0 -2
  178. package/lib/roomle-configurator-4136c482.js.map +0 -1
  179. package/lib/roomle-configurator-e97356ed.nomodule.js +0 -2
  180. package/lib/roomle-configurator-e97356ed.nomodule.js.map +0 -1
  181. package/lib/roomle-sdk-2ab19e90.js.map +0 -1
  182. package/lib/script-loader-234d078e.js.map +0 -1
  183. package/lib/script-loader-687f7fbc.nomodule.js.map +0 -1
  184. package/lib/static/ConfiguratorKernel-031e65eaee5cacde.wasm +0 -0
  185. package/lib/static/RoomleCore-55c9812f52948f19.wasm +0 -0
  186. package/lib/stats-helper-b09eb905.js.map +0 -1
  187. package/lib/stats-helper-e97ec5e1.nomodule.js.map +0 -1
  188. package/lib/tools-core-33ca2cb1.js.map +0 -1
  189. package/lib/tools-core-fd03b0a0.nomodule.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import{Planner}from"./planner-2128f72c.js";import"./script-loader-3c5eb130.js";import"./query-params-helper-68ed40a6.js";import"./main-thread-to-worker-82b32425.js";import"./roomle-dependency-injection-d3a8c907.js";import"./camera-behaviour-d6af6d09.js";import"./roomle-configurator-b8abfbd1.js";import"./default-light-setting-432c00f7.js";import"./glb-viewer-camera-behaviour-94516099.js";(new Planner).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let a=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-a))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)});
2
+ //# sourceMappingURL=planner-main-feee1b27.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-main-feee1b27.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- System.register(["./planner-7f1380f3.nomodule.js","./script-loader-687f7fbc.nomodule.js","./query-params-helper-712890e0.nomodule.js","./main-thread-to-worker-ff04af1e.nomodule.js","./roomle-dependency-injection-a1a06d1e.nomodule.js","./camera-behaviour-35b9043c.nomodule.js","./roomle-configurator-e97356ed.nomodule.js","./default-light-setting-4b8e7ee6.nomodule.js","./glb-viewer-camera-behaviour-8633618f.nomodule.js"],(function(){var e;return{setters:[function(n){e=n.Planner},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){(new e).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let n=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-n))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)})}}}));
1
+ System.register(["./planner-948239c6.nomodule.js","./script-loader-ed493cd8.nomodule.js","./query-params-helper-712890e0.nomodule.js","./main-thread-to-worker-ff04af1e.nomodule.js","./roomle-dependency-injection-b567df3a.nomodule.js","./camera-behaviour-eee26e60.nomodule.js","./roomle-configurator-760afe57.nomodule.js","./default-light-setting-8492f1aa.nomodule.js","./glb-viewer-camera-behaviour-bee9e036.nomodule.js"],(function(){var e;return{setters:[function(n){e=n.Planner},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){(new e).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let n=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-n))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)})}}}));
2
2
  //# sourceMappingURL=planner-main.nomodule.js.map
@@ -0,0 +1,2 @@
1
+ System.register(["./roomle-dependency-injection-b567df3a.nomodule.js","./camera-behaviour-eee26e60.nomodule.js","./main-thread-to-worker-ff04af1e.nomodule.js","./default-light-setting-8492f1aa.nomodule.js"],(function(e,t){var n,i,o,s,r,a,l,c,h,d,_,u,g,p,m,C,f,v,b,w,y,P,M,I,O,S,D,E,H,A,j,k,x,R,L,B,V,T,G,K,U,F,W,z,q,N,Z,Q,J,X,Y,$,ee,te,ne,ie,oe,se,re,ae,le,ce,he,de,_e,ue,ge,pe,me;return{setters:[function(e){n=e._,i=e.i,o=e.C,s=e.c,r=e.d,a=e.e,l=e.S,c=e.M,h=e.W,d=e.F,_=e.f,u=e.N,g=e.k,p=e.P,m=e.E,C=e.g,f=e.v,v=e.h,b=e.j,w=e.t,y=e.l,P=e.m,M=e.n,I=e.b,O=e.o,S=e.p,D=e.q,E=e.r,H=e.s,A=e.u,j=e.w,k=e.x,x=e.y,R=e.B,L=e.z,B=e.G,V=e.H,T=e.J,G=e.K,K=e.O,U=e.A,F=e.Q,W=e.T,z=e.U,q=e.V},function(e){N=e.b,Z=e.S,Q=e.B,J=e.D,X=e.C,Y=e.F,$=e.T},function(e){ee=e.K,te=e.aE,ne=e.ad,ie=e.a,oe=e.bA,se=e.bB,re=e.V,ae=e.Q,le=e.z,ce=e.by,he=e.aC,de=e.bC,_e=e.bD,ue=e.ag,ge=e.bE,pe=e.aD},function(e){me=e.D}],execute:function(){class Ce extends o{constructor(e){super(e),this._configurablePlanObjectViewModels=[],this._configurableConstructionPlanObjectViewModels=[],this._staticPlanObjectViewModels=[],this._constructionPlanObjectViewModels=[],this._wallPlanObjectViewModels=[],this._measurementLinePlanObjectViewModels=[],this._floorPlanObjectViewModels=[],this._nodePlanObjectViewModels=[],this._constructionGroup=new ee,this._constructionGroup.name="Construction",this._ceilingGroup=new ee,this._ceilingGroup.name="Ceiling",this._floorGroup=new ee,this._floorGroup.name="Floor",this._measurementLineGroup=new ee,this._measurementLineGroup.name="Measurement Line",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 s?this._handleConfiguratorConstructionPlanObjectViewModel(e):e instanceof r?this._handleConfiguratorPlanObjectViewModel(e):e instanceof a?this._handleConstructionPlanObjectViewModel(e):e instanceof l?this._handleStaticPlanObjectViewModel(e):e instanceof c?this._handleMeasurementLinePlanElementViewModel(e):e instanceof h?this._handleWallPlanElementViewModel(e):e instanceof d?this._handleFloorPlanElementViewModel(e):e instanceof _?this._handleCeilingPlanElementViewModel(e):e instanceof u&&this._handleNodePlanElementViewModel(e)}_handleConfiguratorPlanObjectViewModel(e){this._configurablePlanObjectViewModels.push(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}}_handleConfiguratorConstructionPlanObjectViewModel(e){e.setTopView(this._cameraType===te.CAMERA_2D),this._configurableConstructionPlanObjectViewModels.push(e)}_handleConstructionPlanObjectViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addConstructionPlanObjectHandlers(e),e.setTopView(this._cameraType===te.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===te.CAMERA_2D),e.getPoint1Draggable().scale.setScalar(this._nodeZoom),e.getPoint2Draggable().scale.setScalar(this._nodeZoom),this._measurementLinePlanObjectViewModels.push(e),this._measurementLineGroup.add(e.getContainer())}_handleWallPlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addWallHandlers(e),e.setTopView(this._cameraType===te.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===te.CAMERA_2D),e.getObject().scale.setScalar(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===te.CAMERA_2D)}dockComponent(e,t,n,i,o){var s;null===(s=this._plannerSceneEventHandler)||void 0===s||s.removeSelection(),super.dockComponent(e,t,n,i,o)}_addComponent(e){const t=e.isRootComponent?e.parentObjectId:e.runtimeId,n=this._getPlanObjectViewModelForRuntimeId(t);n&&n instanceof r&&(e.isRootComponent?n.addRootComponent(e):n.addChildEntityComponent(e),this._initData.edit&&(n instanceof s?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}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 g(e.getBounds())}catch(e){console.error(e)}const t=new ne;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}_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 p&&this.dockComponent(e,i,o,t,n)}addPlanObjectToScene(e){}handlerSwitchedPlans(e,t){this._constructionGroup.clear(),this._ceilingGroup.clear(),this._floorGroup.clear(),this._measurementLineGroup.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());i?n?i.finishConstruction():i.failConstruction():console.warn("planObjectConfigurationLoaded but no view model found")}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()),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 s?this._removeObject(this._configurableConstructionPlanObjectViewModels,n):n instanceof r?this._removeObject(this._configurablePlanObjectViewModels,n):n instanceof a?this._removeObject(this._constructionPlanObjectViewModels,n):n instanceof l?this._removeObject(this._staticPlanObjectViewModels,n):n instanceof d?this._removeObject(this._floorPlanObjectViewModels,n):n instanceof h?this._removeObject(this._wallPlanObjectViewModels,n):n instanceof u?this._removeObject(this._nodePlanObjectViewModels,n):n instanceof c&&this._removeObject(this._measurementLinePlanObjectViewModels,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._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===te.CAMERA_FP,this._floorGroup.visible=!0,this._measurementLineGroup.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(){}setCameraType(e){this._cameraType=e,this._wallPlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===te.CAMERA_2D)),this._measurementLinePlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===te.CAMERA_2D)),this._nodePlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===te.CAMERA_2D)),this._constructionPlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===te.CAMERA_2D)),this._configurablePlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===te.CAMERA_2D)),this._configurableConstructionPlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===te.CAMERA_2D))}get cameraType(){return this._cameraType}setNodeZoom(e){e=Math.min(4,e),this._nodeZoom=e;for(const t of this._nodePlanObjectViewModels)t.getObject().scale.setScalar(e);for(const t of this._measurementLinePlanObjectViewModels)t.getPoint1Draggable().scale.setScalar(e),t.getPoint2Draggable().scale.setScalar(e)}planCleared(){this._configurablePlanObjectViewModels.forEach(e=>e.remove()),this._configurableConstructionPlanObjectViewModels.forEach(e=>e.remove()),this._staticPlanObjectViewModels.forEach(e=>e.remove()),this._wallPlanObjectViewModels.forEach(e=>e.remove()),this._measurementLinePlanObjectViewModels.forEach(e=>e.remove()),this._nodePlanObjectViewModels.forEach(e=>e.remove()),this._floorPlanObjectViewModels.forEach(e=>e.remove()),this._constructionPlanObjectViewModels.forEach(e=>e.remove())}}e("P",Ce),n([i],Ce.prototype,"_plannerMeshGenerator",void 0),n([i],Ce.prototype,"_roomlePlannerUiCallback",void 0);const fe=w(30);class ve extends m{constructor(e,t,n,i){super(),this._offset=new ie(0,0,0),this._lastMoveCheck=0,this._onWallSnapping=!1,this._mode=void 0===i?1:i,this._scene=e,this._camera=t,this._raycaster=new oe,this._raycaster.layers.disableAll(),this._inputManager=n,this._addInputListeners(n),this._planeBottom=new se(new ie(0,1,0)),this._planeFront=new se(new ie(0,0,1)),this._planeSide=new se(new ie(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){const t=this._intersect(e);if(t.length<=0)return null;let n=t[0];return t.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&t.forEach(e=>{e.object.id===this._currentHover.id&&e.object.userData.priority===this._currentHover.userData.priority&&n.object.userData.priority<=e.object.userData.priority&&(n=e)}),n}_intersect(e){this._raycaster.setFromCamera(new re(e.x,e.y),this._camera);const t=[];return this._raycaster.intersectObjects(this._scene.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:C((new ne).setFromObject(e.object),(new ne).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 re(e.x,e.y),this._camera);let t,n=new ie(0,0,-5);if(this._raycaster.ray.intersectPlane(this._planeBottom,n),0===this._mode){const e=this._scene.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 ie(0,0,0),o=new ie(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>=-fe&&n<=fe?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 f(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 ie).y-this._rootComponentPosition.y,this._planeSide.constant=2*-e.boundingBox.getSize(new ie).x+e.boundingBox.getCenter(new ie).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+e.boundingBox.getCenter(new ie).z))}_calculateOffset(e){e&&e.boundingBox&&(this._offset.copy(e.boundingBox.getCenter(new ie)),this._offset.applyQuaternion(e.getWorldQuaternion(new ae)))}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 le&&e.geometry.computeBoundingBox()}}clear(){this._currentDrag&&v(this._currentDrag),this._currentHover&&v(this._currentHover)}enableDragIn(e){this._currentDrag=e}setRootComponentId(e){this._rootComponentId=e}setCamera(e){this._camera=e}setScene(e){this._scene=e}setMode(e){this._mode=e}intersectMouseOnScene(e){const t=new se,n=new ie;return n.copy(this._camera.position).normalize(),t.setFromNormalAndCoplanarPoint(n,this._scene.position),this._raycaster.setFromCamera(new re(e.positionRelative.x,e.positionRelative.y),this._camera),b(this._raycaster.ray.intersectPlane(t,new ie))}enableOnWallSnapping(){this._onWallSnapping=!0}disableOnWallSnapping(){this._onWallSnapping=!1}}class be extends m{constructor(e,t,n,i){super(),this._debug=!1,this._dragIn=!1,this._inputManager=i,this._raycastHelper=new ve(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",be);class we{constructor(e){const{component:t,preview:n,resetCamera:i,consecutive:o,type:s,forceRender:r}=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}}class ye extends be{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 we({component:e,consecutive:t})),this._inputManager.setDragEnabled(!0)},this),this._selectionHandler.addEventListener(1,({component:e,resetCamera:t})=>{this._selectionHandler.hasSelection()||this._inputManager.setDragEnabled(!1),this.dispatchEvent(9,new we({component:e,resetCamera:t}))},this),this._addInputListeners(this._inputManager)}disable(){const e=new ce;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}enable(){const e=new ce;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:1,roomleId:e.runtimeId}),e.meshes.forEach(t=>{this._addComponentHandlers(e,t,{hasListener:!0,priority:2,roomleId:e.runtimeId})})}addComponentDragInHandler(e){this._dragIn&&(this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:1,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=he(t.userData,{hasListener:!0,priority:3,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=he(t.userData,{hasListener:!0,priority:4,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 we({preview:e}))}_clickPreviewLine(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new we({preview:e}))}clickComponent(e){this._debug&&e.runtimeId,this._selectionHandler.check(e),this._configuratorUiCallbacks.onClickComponent(e)}_clickOutside(){this._selectionHandler.cancelSelection(),this.dispatchEvent(3),this._interaction()}_hoverOn(e,t){this._cameraMoving||(this._debug&&e.runtimeId,e.hoverOn(),this._interaction(),this.dispatchEvent(1,new we({component:e,type:t})),this._hoveredComponent=e)}_hoverOff(e,t){this._cameraMoving||(this._debug&&e.runtimeId,e.hoverOff(),this._interaction(),this.dispatchEvent(2,new we({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 le){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 we({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 we({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 we({component:e,preview:this._hoveredPreview})),this._interaction()}}_interaction(e){this.dispatchEvent(0,new we({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(){this._selectionHandler.setSelectionMode("standard"),this._selectionHandler.cancelSelection()}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)}}n([i],ye.prototype,"_selectionHandler",void 0),n([i],ye.prototype,"_configuratorUiCallbacks",void 0);class Pe extends m{constructor(e){super(),this._uiIntersectionMask=0,this.floorEnvironment=!1,this._camera=e}updateToBounds(e,t,n){let i=new ie(-e.x/2,0,-e.z/2),o=new ie(e.x/2,e.y,e.z/2);this._boundingBox=new ne(i,o),this._clientWidth=t,this._clientHeight=n;let s=this._boundingBox.getSize(new ie);this._boxVertices=[],this._boxVertices.push(this._boundingBox.min),this._boxVertices.push(this._boundingBox.min.clone().add(new ie(s.x,0,0))),this._boxVertices.push(this._boundingBox.max),this._boxVertices.push(this._boundingBox.max.clone().sub(new ie(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=y(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 Me extends N{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()}resetCameraOnStartConfiguring(e,t=0){this.cameraControl.setObjectRotation(t),this.cameraControl.updateAndReset(e,!1)}}e("a",Me);class Ie extends Z{constructor(e,t,n){super(e,t,P.HSC,n),this._configuratorContext.baseContext="configurator",this._getViewModel().setListener(this),this._sceneEventHandler=new ye(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),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})=>{this._deselectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(4,({component:e})=>{var t;"multiselect"===this._sceneEventHandler.getSelectionMode()&&this.cancelComponentSelection(),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 ie))}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),M.isProduction||(window.__RML__DEBUG__.SceneHelper=this),this.enableConfiguratorEvents(),this._initOptionalModules(),this._offsetAnimationStart=de(this._offsetAnimationStart.bind(this),250),this._offsetAnimationEnd=_e(this._offsetAnimationEnd.bind(this),32)}async _initOptionalModules(){const{transparentHighlighting:e}=this._initData;if(e){const{default:e}=await t.import("./component-raycast-helper-4260f5f3.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=I.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}_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),(O+1)*S)}}cancelDockings(){this._cancelDockings(!0,null,!0,!0,!1),this._renderEverything()}_cancelDockings(e,t,n,i,o=!0){var s,r,a;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&&(null===(r=this.configuratorCameraBehaviour)||void 0===r||r.updateBoundsOnCancelDockings(this.getBounds())),i&&n&&this._configuratorUiCallbacks.onDockingsPreviewRemoved(),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null),n&&(null===(a=this._roomleRenderer)||void 0===a||a.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._shouldHighlight())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()}pause(){super.pause(),this._getViewModel().materialQueue.unregisterCallback(),this._configuratorMeshGenerator.removeMaterialLoadedListener()}_setupScene(e,t,n){super._setupScene(e,t),this._uiIntersectionHelper=new Pe(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(D.createDynamicLightSettingSource(null,E.CAMERA)):this._lightSetting=new me(this._scene,this._lightSetting)),this._requestRender(),this._setEnvironment(new Q(this._scene,this._environment,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(),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),this._clearSelectionAndHovers();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+V(a);H.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._requestRender(),l}async renderImage(e){await this._externalMeshesAndMaterialsReady(),this._getViewModel().getPreviews()&&this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers();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._requestRender(),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=H.getCameraTargetForBBox((new ne).setFromObject(e));const s=A(this._scene);s.add(e);const r=await this._imageRenderer.preparePerspectiveImage(s,null,i,o,t);j(s),n(r)},i)})}_calculateBoundingBoxOfAllMeshes(e=0,t){let n=null;return n=t&&this._dimensionHelper?this._dimensionHelper.getBoundingBox():this._getViewModel().getBoundingBox(),H.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),this._clearSelectionAndHovers(),i&&(await this._initDimensions(),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._requestRender(),s}enableDragIn(e){this._sceneEventHandler.setDragIn(!0,e),this._requestRender()}async _zoomToComponentOnConsecutiveClick(e){let t=e.boundingBox.getSize(new ie),n=k(e),i=new ue(0,n,0),o=e.getWorldPosition(new ie).clone().add(e.boundingBox.getCenter(new ie).applyEuler(i));const s=new re;this._renderer.getSize(s);const r={yaw:i.y,pitch:w(15),distance:x(t.x,t.y,t.z,this.cameraBehaviour3d.cameraControl.getCamera().fov,s.width,s.height)*J,targetX:o.x,targetY:o.y,targetZ:o.z,blockOtherTweens:!0};ge(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)}_clearSelectionAndHovers(){this.cancelComponentSelection(),this._getViewModel().clearRootComponent()}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(),e.preventDefault()),e.key&&e.key.includes("Shift")&&this.cameraBehaviour3d.cameraControl instanceof X&&(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){(this._sceneEventHandler.hasSelection()||"standard"!==this._sceneEventHandler.getSelectionMode())&&this._cancelSelection(e)}_cancelSelection(e){this._sceneEventHandler.cancelSelection(),this._configuratorContext.selectionMode="standard",this._configuratorContext.selectedRuntimeComponentIds=[],this._getViewModel().removePreviews(),e&&!this._initData.debug&&this.configuratorCameraBehaviour.resetCameraToStateOnCancelSelection(),this._getKernelAccess().updatePlanObjectDependencies(this._configuratorContext.planObjectId),this._configuratorUiCallbacks.onSelectionCancel()}_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){"standard"===this._sceneEventHandler.getSelectionMode()&&(this._cancelSelection(t),this._highlightComponent()),"multiselect"===this._sceneEventHandler.getSelectionMode()&&(this._sceneEventHandler.hasSelection()?this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds():(this._cancelSelection(t),this._highlightComponent())),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}getScreenXY(e){return y(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 Y||(this._environment=new Y(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(){this._dimensionHelper||await t.import("./dimensioning-helper-be6a25b7.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 e=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);e&&e.boxForMeasurement&&this._dimensionHelper.updateSize(e.boxForMeasurement),this._dimensionHelper.moveCameraEnd(this.cameraBehaviour3d.cameraControl.getCamera().position)}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 Y}onCameraChanged(){super.onCameraChanged(),this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition()}requestDockingsPreview(e,t,n,i){i||(i=!1),e&&this.cancelPreviousDockings(),this.cancelComponentSelection(),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){R.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()}_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(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 ie(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 Me){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()}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 ie))),this._componentRaycastHelper&&this._componentRaycastHelper.checkPreviewVisibility(this._getViewModel())}configurationLoaded(e,t){e&&t&&this._sceneEventHandler.isDragIn()?(e.position.copy(new ie(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()}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 ne).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 ie)),type:"component",actions:o})}),this._getViewModel().getPreviews().forEach(t=>{const n=(new ne).setFromObject(t);e.push({id:t.runtimeId,position:this.getScreenXY(n.getCenter(new ie)),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 ie);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)}selectComponent(e){if(!e)return;const t=this._getViewModel().getComponents().find(t=>t.runtimeId===e);t?this._sceneEventHandler.clickComponent(t):console.warn('Can not select "'+e+'" because it was not found')}highlightParts(e){this._highlightComponent(null,e),this._requestRender()}_shouldHighlight(){return this._initData.highlighting===pe.ALWAYS||this._initData.highlighting!==pe.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(L(),o,n);this._idbManager.setValue(a,i,this._idbManager.configStore)}_getInputManager(){return this._configuratorInputManager}createCameraControl(e,t){this._componentFactory=B();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 ie(0,.5,5)),this._changeCameraBehaviour(new Me(new X(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 Me?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())}}e("C",Ie),n([i],Ie.prototype,"_configuratorInputManager",void 0),n([i],Ie.prototype,"_configuratorMeshGenerator",void 0),n([i],Ie.prototype,"_memoryManager",void 0),n([i],Ie.prototype,"_configuratorContext",void 0),n([i],Ie.prototype,"_componentDimensioningHelper",void 0),n([i],Ie.prototype,"_configuratorViewModel",void 0),n([i],Ie.prototype,"_configuratorHistory",void 0),n([i],Ie.prototype,"_configuratorUiCallbacks",void 0),n([i],Ie.prototype,"_plannerKernelAccess",void 0),n([i],Ie.prototype,"_globalInitData",void 0);const Oe=(e,t)=>e.sort||t.sort?e.sort?t.sort?e.sort-t.sort:-1:1:0,Se=(e,t)=>e&&!t?1:!e&&t?-1:e&&t?e.localeCompare(t):0;class De{_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"}))}initSceneManager(e){this._sceneManager=e||I.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=D.createDynamicLightSettingSource(i,o);s&&this.showStats(),this._sceneManager.enableHD(r),this._needsSync&&(this._needsSync=!1,this._plannerKernelAccess.requestSync(T,this._configuratorContext.planObjectId));const a=[this._scriptLoader.fetch($,{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=G(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(K(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=Oe(e,t);return 0!==n?n:(n=Se(e.label,t.label),0!==n?n:Se(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(),R.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=[F.waitFor(4),F.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?q(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=K(e)?this._rapiAccess.getPreloadForItem.bind(this._rapiAccess):this._rapiAccess.getPreloadForConfiguration.bind(this._rapiAccess),R.start("rapi_preloads");const n=()=>{const t=R.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===U.useHDGeometry?t():this._isReloading?n("Change of HD Geometry in progress"):(this._isReloading=!0,F.waitFor(3).then(([e,i])=>{this._reloadConfiguration(e,i,t,n)},n),U.useHDGeometry=e,void this._plannerKernelAccess.changeUseOfHDGeometry(this._configuratorContext,U.useHDGeometry)))}async _callOnPartListUpdate(){const{hash:e}=await F.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(){this._sceneManager.cancelComponentSelection()}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(){try{const e=await this._plannerKernelAccess.getConfigurationData(this._configuratorContext.planObjectId),t=await this._rapiAccess.saveConfiguration(e);this._configuratorUiCallbacks.onConfigurationSaved(t.configurationHash);const n=await this._rapiAccess.getComponent(t.rootComponentId),i=[Promise.resolve(t),Promise.resolve(t)];t.perspectiveImage||(i[0]=this._rapiAccess.savePerspectiveImage(t,await this._sceneManager.preparePerspectiveImage())),t.topImage||(i[1]=this._rapiAccess.saveTopImage(t,await this._sceneManager.prepareTopImage()));const[o,s]=await Promise.all(i);return t.perspectiveImage=o.perspectiveImage,t.topImage=s.topImage,t.label=n.label,this._rapiAccess.updateCache("configurations",t),t}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){R.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(R.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(W(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 F.waitFor(1,()=>this._plannerKernelAccess.uiRequestConfiguration(this._configuratorContext.planObjectId))}loadComponentIntoKernel(e){return F.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 F.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=M.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(Oe),t.sort(Oe),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=R.getMeasure("kernel_is_ready");if(Array.isArray(e)&&1===e.length){const t=e[0],n=R.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._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(e){return this._rapiAccess.getConfiguratorSettings(e)}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.kernelInstance.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(Oe),t.forEach(t=>{t.group?t.grouping=s[t.group]:t.grouping=null,this._unitFormatter.formatParameter(t),z(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(Oe),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.set(e.itemId,e)):(n.push(e.componentId),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=>{e.isItem=!1,e.isComponent=!0;const t=s.get(e.id);t&&(e.group=t.group,e.possible=t.possible),e.id===o&&(e.isDefault=!0,d=e),h.push(e)}),c.forEach(e=>{e.isItem=!0,e.isComponent=!1;const t=r.get(e.id);t&&(e.group=t.group,e.possible=t.possible),e.id===o&&(e.isDefault=!0,d=e),h.push(e)}),h.sort(Oe),{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=I.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.generateExport(0,e)}async generateTCExport(e=""){return this.generateExport(0,e)}async generateIMOSiXExport(e=""){return this.generateExport(1,e)}async generateExport(e,t=""){const n=this._configuratorContext.planObjectId;try{return this._plannerKernelAccess.configurationExporter.setDefaultExportDataDefinition(t),Promise.resolve(JSON.parse(this._plannerKernelAccess.configurationExporter.generateExport(e,n,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)}}e("R",De),n([i],De.prototype,"_rapiAccess",void 0),n([i],De.prototype,"_dataSyncer",void 0),n([i],De.prototype,"_errorHandler",void 0),n([i],De.prototype,"_unitFormatter",void 0),n([i],De.prototype,"_idbManager",void 0),n([i],De.prototype,"_domHelper",void 0),n([i],De.prototype,"_configuratorUiCallbacks",void 0),n([i],De.prototype,"_configuratorKernelAccessCallback",void 0),n([i],De.prototype,"_lifeCycleManager",void 0),n([i],De.prototype,"_plannerKernelAccess",void 0),n([i],De.prototype,"_scriptLoader",void 0),n([i],De.prototype,"_configuratorContext",void 0),n([i],De.prototype,"_initData",void 0),n([i],De.prototype,"_globalInitData",void 0),n([i],De.prototype,"_globalCallback",void 0),n([i],De.prototype,"_kernelIo",void 0),n([i],De.prototype,"_configuratorHistory",void 0)}}}));
2
+ //# sourceMappingURL=roomle-configurator-760afe57.nomodule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roomle-configurator-760afe57.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{_ as __decorate,i as inject,C as ConfiguratorViewModel,c as ConfigurableConstructionPlanObjectViewModel,d as ConfiguratorPlanObjectViewModel,e as ConstructionPlanObjectViewModel,S as StaticPlanObjectViewModel,M as MeasurementLinePlanElementViewModel,W as WallPlanElementViewModel,F as FloorPlanElementViewModel,f as CeilingPlanElementViewModel,N as NodePlanElementViewModel,k as kernelBoxToThreeBox,P as PlannerKernelAccess,E as EventDispatcher,g as compareBox3Size,v as vectorIsZero,h as disposeMesh,j as convertToKernel,t as toRadiant,l as getScreenXY,m as CANVAS_ID,n as Env,b as RoomleDependencyInjection,o as PULSE_LOOPS,p as PULSE_DURATION,q as DynamicLightSettingLoader,r as PREDEFINED_LIGHTSETTING,s as ImageRenderer,u as createEmptySceneFromCurrent,w as dispose,x as getYRotationOfObject,y as getIdealDistance,B as Benchmark,z as getHostname,G as RoomleComponentFactoryInitializer,H as toDegrees,J as DEFAULT_CONVERSATION_ID,K as getCatalogIdFromItemOrConfigurationId,O as isIdItemId,A as AppContext,Q as AsyncHelper,T as isRange,U as isMaterial,V as convertCObject}from"./roomle-dependency-injection-d3a8c907.js";import{b as CameraBehaviour,S as SceneManager,B as BackgroundEnvironment,D as DISTANCE_FACTOR,C as CameraControl3D,F as FloorEnvironment,T as TWEEN_FILE_NAME}from"./camera-behaviour-d6af6d09.js";import{K as Group,aE as CAMERA_TYPE,ad as Box3,a as Vector3,bA as Raycaster,bB as Plane,V as Vector2,Q as Quaternion,z as Mesh,by as Layers,aC as deepMerge,bC as callAgainAfter,bD as debounce,ag as Euler,bE as areCameraParametersEqual,aD as ROOMLE_HIGHLIGHTNG}from"./main-thread-to-worker-82b32425.js";import{D as DefaultLightSetting}from"./default-light-setting-432c00f7.js";class PlanViewModel extends ConfiguratorViewModel{constructor(e){super(e),this._configurablePlanObjectViewModels=[],this._configurableConstructionPlanObjectViewModels=[],this._staticPlanObjectViewModels=[],this._constructionPlanObjectViewModels=[],this._wallPlanObjectViewModels=[],this._measurementLinePlanObjectViewModels=[],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._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 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);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}}_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())}_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.getObject().scale.setScalar(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,i,o){var r;null===(r=this._plannerSceneEventHandler)||void 0===r||r.removeSelection(),super.dockComponent(e,t,n,i,o)}_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}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}_generateMesh(e=0,t=null,n,i,o,r,s,a,c,l){return this._plannerMeshGenerator.generateMesh(e,t,n,i,o,r,s,a,c,l)}_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 PlannerKernelAccess&&this.dockComponent(e,i,o,t,n)}addPlanObjectToScene(e){}handlerSwitchedPlans(e,t){this._constructionGroup.clear(),this._ceilingGroup.clear(),this._floorGroup.clear(),this._measurementLineGroup.clear()}planCompletelyLoaded(e){}beginPlanConstruction(e){}addPlanMesh(e,t,n,i,o,r,s){}endPlanConstruction(e){}planElementChanged(e,t){}planObjectConfigurationLoaded(e,t,n){const i=this.getConfigurablePlanObjectForId(t.getId());i?n?i.finishConstruction():i.failConstruction():console.warn("planObjectConfigurationLoaded but no view model found")}addMesh(e,t,n,i,o,r){const s=e.extRef.jsObject;let a=s.getMesh(t);a?a.geometry=this._plannerMeshGenerator.generateGeometry(null,n,i,o,r):(a=this._generateMesh(0,null,t,n,i,o,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()),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._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)}_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._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._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(){}setCameraType(e){this._cameraType=e,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._nodePlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D)),this._constructionPlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D)),this._configurablePlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D)),this._configurableConstructionPlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D))}get cameraType(){return this._cameraType}setNodeZoom(e){e=Math.min(4,e),this._nodeZoom=e;for(const t of this._nodePlanObjectViewModels)t.getObject().scale.setScalar(e);for(const t of this._measurementLinePlanObjectViewModels)t.getPoint1Draggable().scale.setScalar(e),t.getPoint2Draggable().scale.setScalar(e)}planCleared(){this._configurablePlanObjectViewModels.forEach(e=>e.remove()),this._configurableConstructionPlanObjectViewModels.forEach(e=>e.remove()),this._staticPlanObjectViewModels.forEach(e=>e.remove()),this._wallPlanObjectViewModels.forEach(e=>e.remove()),this._measurementLinePlanObjectViewModels.forEach(e=>e.remove()),this._nodePlanObjectViewModels.forEach(e=>e.remove()),this._floorPlanObjectViewModels.forEach(e=>e.remove()),this._constructionPlanObjectViewModels.forEach(e=>e.remove())}}__decorate([inject],PlanViewModel.prototype,"_plannerMeshGenerator",void 0),__decorate([inject],PlanViewModel.prototype,"_roomlePlannerUiCallback",void 0);const ROTATION_TO_DETECT_SIDE=toRadiant(30);class RaycastHelper extends EventDispatcher{constructor(e,t,n,i){super(),this._offset=new Vector3(0,0,0),this._lastMoveCheck=0,this._onWallSnapping=!1,this._mode=void 0===i?1:i,this._scene=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 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){const t=this._intersect(e);if(t.length<=0)return null;let n=t[0];return t.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&t.forEach(e=>{e.object.id===this._currentHover.id&&e.object.userData.priority===this._currentHover.userData.priority&&n.object.userData.priority<=e.object.userData.priority&&(n=e)}),n}_intersect(e){this._raycaster.setFromCamera(new Vector2(e.x,e.y),this._camera);const t=[];return this._raycaster.intersectObjects(this._scene.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._scene.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 Vector3(0,0,0),o=new Vector3(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,i),this._raycaster.ray.intersectPlane(this._planeSide,o);let r,s=this._getDistanceToCamera(o),a=this._getDistanceToCamera(i);return n>=-ROTATION_TO_DETECT_SIDE&&n<=ROTATION_TO_DETECT_SIDE?r=t<a?e.clone():i.clone():t<a&&t<s?r=e.clone():a<t&&a<s?r=i.clone():s<t&&s<a&&(r=o.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}setScene(e){this._scene=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._scene.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,i){super(),this._debug=!1,this._dragIn=!1,this._inputManager=i,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:i,consecutive:o,type:r,forceRender:s}=e;this.component=t,this.preview=n,this.resetCamera=void 0===i||i,this.consecutive=void 0===o||o,this.type=r||0,this.forceRender=void 0!==s&&s}}class ConfiguratorSceneEventHandler extends SceneEventHandler{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 SceneEventInfo({component:e,consecutive:t})),this._inputManager.setDragEnabled(!0)},this),this._selectionHandler.addEventListener(1,({component:e,resetCamera:t})=>{this._selectionHandler.hasSelection()||this._inputManager.setDragEnabled(!1),this.dispatchEvent(9,new SceneEventInfo({component:e,resetCamera:t}))},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:1,roomleId:e.runtimeId}),e.meshes.forEach(t=>{this._addComponentHandlers(e,t,{hasListener:!0,priority:2,roomleId:e.runtimeId})})}addComponentDragInHandler(e){this._dragIn&&(this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:1,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:3,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:4,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){this._debug&&e.runtimeId,this._selectionHandler.check(e),this._configuratorUiCallbacks.onClickComponent(e)}_clickOutside(){this._selectionHandler.cancelSelection(),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),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 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(){this._selectionHandler.setSelectionMode("standard"),this._selectionHandler.cancelSelection()}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)}}__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 i=new Vector3(-e.x/2,0,-e.z/2),o=new Vector3(e.x/2,e.y,e.z/2);this._boundingBox=new Box3(i,o),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()}resetCameraOnStartConfiguring(e,t=0){this.cameraControl.setObjectRotation(t),this.cameraControl.updateAndReset(e,!1)}}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),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})=>{this._deselectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(4,({component:e})=>{var t;"multiselect"===this._sceneEventHandler.getSelectionMode()&&this.cancelComponentSelection(),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__.SceneHelper=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-357d58fb.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}_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,i,o=!0){var r,s,a;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&&o&&(null===(s=this.configuratorCameraBehaviour)||void 0===s||s.updateBoundsOnCancelDockings(this.getBounds())),i&&n&&this._configuratorUiCallbacks.onDockingsPreviewRemoved(),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null),n&&(null===(a=this._roomleRenderer)||void 0===a||a.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._shouldHighlight())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()}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(),this._setEnvironment(new BackgroundEnvironment(this._scene,this._environment,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(),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),this._clearSelectionAndHovers();const o=this.cameraBehaviour3d.cameraControl.getCamera().clone();o.resetOffset();let r=this._calculateBoundingBoxOfAllMeshes(0,i);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(i){await this._initDimensions(),await this._dimensionHelper.isInitialized();const e=-30+toDegrees(a);ImageRenderer.placeCameraForPerspectiveImage(o,r,-20,e),this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(o.position),r=this._calculateBoundingBoxOfAllMeshes(0,i)}this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const c=await this._imageRenderer.preparePerspectiveImage(this._scene,this._uiScene,o,r,e,a);return s?(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._requestRender(),c}async renderImage(e){await this._externalMeshesAndMaterialsReady(),this._getViewModel().getPreviews()&&this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers();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._requestRender(),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=ImageRenderer.getCameraTargetForBBox((new Box3).setFromObject(e));const r=createEmptySceneFromCurrent(this._scene);r.add(e);const s=await this._imageRenderer.preparePerspectiveImage(r,null,i,o,t);dispose(r),n(s)},i)})}_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:i=!1}=e;this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers(),i&&(await this._initDimensions(),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 r=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._requestRender(),r}enableDragIn(e){this._sceneEventHandler.setDragIn(!0,e),this._requestRender()}async _zoomToComponentOnConsecutiveClick(e){let t=e.boundingBox.getSize(new Vector3),n=getYRotationOfObject(e),i=new Euler(0,n,0),o=e.getWorldPosition(new Vector3).clone().add(e.boundingBox.getCenter(new Vector3).applyEuler(i));const r=new Vector2;this._renderer.getSize(r);const s={yaw:i.y,pitch:toRadiant(15),distance:getIdealDistance(t.x,t.y,t.z,this.cameraBehaviour3d.cameraControl.getCamera().fov,r.width,r.height)*DISTANCE_FACTOR,targetX:o.x,targetY:o.y,targetZ:o.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)}_clearSelectionAndHovers(){this.cancelComponentSelection(),this._getViewModel().clearRootComponent()}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(),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){(this._sceneEventHandler.hasSelection()||"standard"!==this._sceneEventHandler.getSelectionMode())&&this._cancelSelection(e)}_cancelSelection(e){this._sceneEventHandler.cancelSelection(),this._configuratorContext.selectionMode="standard",this._configuratorContext.selectedRuntimeComponentIds=[],this._getViewModel().removePreviews(),e&&!this._initData.debug&&this.configuratorCameraBehaviour.resetCameraToStateOnCancelSelection(),this._getKernelAccess().updatePlanObjectDependencies(this._configuratorContext.planObjectId),this._configuratorUiCallbacks.onSelectionCancel()}_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){"standard"===this._sceneEventHandler.getSelectionMode()&&(this._cancelSelection(t),this._highlightComponent()),"multiselect"===this._sceneEventHandler.getSelectionMode()&&(this._sceneEventHandler.hasSelection()?this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds():(this._cancelSelection(t),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(){this._dimensionHelper||await import("./dimensioning-helper-02499f1a.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 e=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);e&&e.boxForMeasurement&&this._dimensionHelper.updateSize(e.boxForMeasurement),this._dimensionHelper.moveCameraEnd(this.cameraBehaviour3d.cameraControl.getCamera().position)}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,i){i||(i=!1),e&&this.cancelPreviousDockings(),this.cancelComponentSelection(),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){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()}_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(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 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 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()}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 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()}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 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 Vector3)),type:"component",actions:o})}),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 i;if(super._updateBounds(e,t,n),!e)return;let o=e.getSize(new Vector3);const r=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);r&&r.boxForMeasurement&&(null===(i=this._dimensionHelper)||void 0===i||i.updateSize(r.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)}selectComponent(e){if(!e)return;const t=this._getViewModel().getComponents().find(t=>t.runtimeId===e);t?this._sceneEventHandler.clickComponent(t):console.warn('Can not select "'+e+'" because it was not found')}highlightParts(e){this._highlightComponent(null,e),this._requestRender()}_shouldHighlight(){return 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,i;const{configuratorId:o}=this._globalInitData,{lastLoadedPlanId:r,lastLoadedRapiId:s}=this._configuratorContext;this._initData.moc?(n=r,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=s,i=this._getKernelAccess().kernelInstance.getSerializedConfiguration(this._configuratorContext.planObjectId));const a=this._idbManager.getKey(getHostname(),o,n);this._idbManager.setValue(a,i,this._idbManager.configStore)}_getInputManager(){return this._configuratorInputManager}createCameraControl(e,t){this._componentFactory=RoomleComponentFactoryInitializer();const n=this._domHelper.getClientDimensions(),i=n.x,o=n.y,r=this._componentFactory.createPerspectiveCamera(30,i/o,.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())}}__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,"_configuratorViewModel",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);const sortBySort=(e,t)=>e.sort||t.sort?e.sort?t.sort?e.sort-t.sort:-1:1:0,sortByString=(e,t)=>e&&!t?1:!e&&t?-1:e&&t?e.localeCompare(t):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 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"}))}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:i,ls:o,stats:r}=this._initData,s=DynamicLightSettingLoader.createDynamicLightSettingSource(i,o);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,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(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,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(),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(([i])=>{const o=[AsyncHelper.waitFor(4),AsyncHelper.waitFor(2)];Promise.all(o).then(([e,[n,o,r,s]])=>{const a=[];i&&this._initData.applyCurrentGlobalParameters&&i.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 i=n&&n[0]?n[0]:o,s=n&&n[1]?n[1]:r,a=await this._plannerKernelAccess.addUiDataAndPriceToPartList(i,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(()=>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=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,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===AppContext.useHDGeometry?t():this._isReloading?n("Change of HD Geometry in progress"):(this._isReloading=!0,AsyncHelper.waitFor(3).then(([e,i])=>{this._reloadConfiguration(e,i,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),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(){this._sceneManager.cancelComponentSelection()}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(){try{const e=await this._plannerKernelAccess.getConfigurationData(this._configuratorContext.planObjectId),t=await this._rapiAccess.saveConfiguration(e);this._configuratorUiCallbacks.onConfigurationSaved(t.configurationHash);const n=await this._rapiAccess.getComponent(t.rootComponentId),i=[Promise.resolve(t),Promise.resolve(t)];t.perspectiveImage||(i[0]=this._rapiAccess.savePerspectiveImage(t,await this._sceneManager.preparePerspectiveImage())),t.topImage||(i[1]=this._rapiAccess.saveTopImage(t,await this._sceneManager.prepareTopImage()));const[o,r]=await Promise.all(i);return t.perspectiveImage=o.perspectiveImage,t.topImage=r.topImage,t.label=n.label,this._rapiAccess.updateCache("configurations",t),t}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,i,o){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,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:r,type:s}=e;if(isRange(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:r,valueTo:a}=e.validRange,c=this._unitFormatter.getAllowedDelta();if(!Number.isNaN(r)&&i<r-c)return o(new RangeError('Value "'+t+'" is too small, min-val "'+r+'"'));if(!Number.isNaN(a)&&i>a+c)return o(new RangeError('Value "'+t+'" is too big, max-val "'+a+'"'));t="Integer"===s&&"number"==typeof i?i.toFixed():i.toString()}this._sceneManager.cancelDockings(),this._dispatchSetParameter(r,s,t,i,o),this._sceneManager.saveConfigToIdb()})}setParameterOfPlanObject(e,t){return new Promise((n,i)=>{const{planObjectId:o,rootComponentId:r,rootComponentParametersAsGlobal:s}=this._configuratorContext,{type:a,key:c}=e;s?this._plannerKernelAccess.changeComponentParameter(r,c,a,t,n,i):this._plannerKernelAccess.changePlanObjectParameter(o,c,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:r,key:s}=e;this._plannerKernelAccess.changeComponentParameter(o,s,r,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 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,i=Env.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([]),r=Promise.resolve([]);t&&t.include&&t.include.forEach(t=>{"materials"===t&&(o=this._rapiAccess.getMaterialsOf(e)),"items"===t&&(r=this._rapiAccess.getItems(e.items))}),Promise.all([o,r]).then(([t,i])=>(i.sort(sortBySort),t.sort(sortBySort),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=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 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._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(e){return this._rapiAccess.getConfiguratorSettings(e)}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,r)=>this._plannerKernelAccess.changeComponentParameter(e,i,o,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.kernelInstance.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 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(i,e)&&this._shouldBroadcastToUi(i)||o?n(t):r("Response does not match to ids")},r)})})}),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:r,defaultChild:s}=await this._getPossibleChildrenForKernelPossibleChildren(t,o),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,i=e.tags.length;n<i;n++){const i=t[n];-1===a.indexOf(i)&&a.push(i);let o=c.get(i);if(!o){const e=[];c.set(i,e),o=c.get(i)}o.push(e)}else l.push(e)}),this._isCorrectResponse(n,e)||!i){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=[],i=[];let o;const r=new Map,s=new Map;e.forEach(e=>{if(!e.possible&&!t)return;let a=e.itemId;e.itemId?(i.push(e.itemId),s.set(e.itemId,e)):(n.push(e.componentId),r.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)]),c=a[0],l=a[1],h=[];let d=null;return c.forEach(e=>{e.isItem=!1,e.isComponent=!0;const t=r.get(e.id);t&&(e.group=t.group,e.possible=t.possible),e.id===o&&(e.isDefault=!0,d=e),h.push(e)}),l.forEach(e=>{e.isItem=!0,e.isComponent=!1;const t=s.get(e.id);t&&(e.group=t.group,e.possible=t.possible),e.id===o&&(e.isDefault=!0,d=e),h.push(e)}),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.generateExport(0,e)}async generateTCExport(e=""){return this.generateExport(0,e)}async generateIMOSiXExport(e=""){return this.generateExport(1,e)}async generateExport(e,t=""){const n=this._configuratorContext.planObjectId;try{return this._plannerKernelAccess.configurationExporter.setDefaultExportDataDefinition(t),Promise.resolve(JSON.parse(this._plannerKernelAccess.configurationExporter.generateExport(e,n,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)}}__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,ConfiguratorCameraBehaviour as a};
2
+ //# sourceMappingURL=roomle-configurator-b8abfbd1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roomle-configurator-b8abfbd1.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}