@roomle/web-sdk 2.28.0 → 2.29.0

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 (205) hide show
  1. package/lib/{banana-for-scale-dd4c5739.js → banana-for-scale-656cea8a.js} +2 -2
  2. package/lib/{banana-for-scale-dd4c5739.js.map → banana-for-scale-656cea8a.js.map} +1 -1
  3. package/lib/{banana-for-scale-2239eff7.nomodule.js → banana-for-scale-89f70127.nomodule.js} +2 -2
  4. package/lib/{banana-for-scale-2239eff7.nomodule.js.map → banana-for-scale-89f70127.nomodule.js.map} +1 -1
  5. package/lib/{budgeteer-measure-05dc445d.js → budgeteer-measure-8cfea554.js} +2 -2
  6. package/lib/{budgeteer-measure-05dc445d.js.map → budgeteer-measure-8cfea554.js.map} +1 -1
  7. package/lib/budgeteer-measure.nomodule.js +1 -1
  8. package/lib/{component-dimensioning-07857a7e.js → component-dimensioning-1b5f64dd.js} +2 -2
  9. package/lib/component-dimensioning-1b5f64dd.js.map +1 -0
  10. package/lib/{component-dimensioning-e121b044.nomodule.js → component-dimensioning-7bdd1b3b.nomodule.js} +2 -2
  11. package/lib/component-dimensioning-7bdd1b3b.nomodule.js.map +1 -0
  12. package/lib/configurator-6e7f5ef0.js +2 -0
  13. package/lib/{configurator-366b9a69.js.map → configurator-6e7f5ef0.js.map} +1 -1
  14. package/lib/configurator-eddf59f1.nomodule.js +2 -0
  15. package/lib/{configurator-b498456a.nomodule.js.map → configurator-eddf59f1.nomodule.js.map} +1 -1
  16. package/lib/configurator-main-7acfa92f.js +2 -0
  17. package/lib/configurator-main-7acfa92f.js.map +1 -0
  18. package/lib/configurator-main.nomodule.js +1 -1
  19. package/lib/configurator-mesh-generator-05375458.nomodule.js +2 -0
  20. package/lib/configurator-mesh-generator-05375458.nomodule.js.map +1 -0
  21. package/lib/{configurator-mesh-generator-e827c528.js → configurator-mesh-generator-f210ee04.js} +2 -2
  22. package/lib/configurator-mesh-generator-f210ee04.js.map +1 -0
  23. package/lib/{default-light-setting-7eb7961c.js → default-light-setting-7de63c9a.js} +2 -2
  24. package/lib/default-light-setting-7de63c9a.js.map +1 -0
  25. package/lib/{default-light-setting-f21a820b.nomodule.js → default-light-setting-e4720308.nomodule.js} +2 -2
  26. package/lib/default-light-setting-e4720308.nomodule.js.map +1 -0
  27. package/lib/definitions/common-core/src/services/global-callback.d.ts +1 -0
  28. package/lib/definitions/configurator-core/src/roomle-configurator.d.ts +7 -1
  29. package/lib/definitions/configurator-core/src/webgl/scene-helper.d.ts +1 -1
  30. package/lib/{dimensioning-helper-73700224.nomodule.js → dimensioning-helper-844fc69d.nomodule.js} +2 -2
  31. package/lib/dimensioning-helper-844fc69d.nomodule.js.map +1 -0
  32. package/lib/{dimensioning-helper-2f129aab.js → dimensioning-helper-e77fbedb.js} +2 -2
  33. package/lib/dimensioning-helper-e77fbedb.js.map +1 -0
  34. package/lib/glb-viewer-0331f919.js +2 -0
  35. package/lib/{glb-viewer-10243e50.js.map → glb-viewer-0331f919.js.map} +1 -1
  36. package/lib/glb-viewer-6e5482c7.nomodule.js +2 -0
  37. package/lib/{glb-viewer-d6e080e4.nomodule.js.map → glb-viewer-6e5482c7.nomodule.js.map} +1 -1
  38. package/lib/glb-viewer-main-17601c40.js +2 -0
  39. package/lib/glb-viewer-main-17601c40.js.map +1 -0
  40. package/lib/glb-viewer-main.nomodule.js +1 -1
  41. package/lib/image-renderer-880c414d.nomodule.js +2 -0
  42. package/lib/{image-renderer-9478b17b.nomodule.js.map → image-renderer-880c414d.nomodule.js.map} +1 -1
  43. package/lib/image-renderer-ad267c8b.js +2 -0
  44. package/lib/{image-renderer-9e47bc3a.js.map → image-renderer-ad267c8b.js.map} +1 -1
  45. package/lib/legacy/{banana-for-scale-1dc75d47.legacy.js → banana-for-scale-bd7d6dfd.legacy.js} +2 -2
  46. package/lib/legacy/{banana-for-scale-1dc75d47.legacy.js.map → banana-for-scale-bd7d6dfd.legacy.js.map} +1 -1
  47. package/lib/legacy/budgeteer-measure.legacy.js +1 -1
  48. package/lib/legacy/{component-dimensioning-d657350b.legacy.js → component-dimensioning-59fd1367.legacy.js} +2 -2
  49. package/lib/legacy/component-dimensioning-59fd1367.legacy.js.map +1 -0
  50. package/lib/legacy/configurator-82b7967e.legacy.js +2 -0
  51. package/lib/legacy/{configurator-3250dfc2.legacy.js.map → configurator-82b7967e.legacy.js.map} +1 -1
  52. package/lib/legacy/configurator-main.legacy.js +1 -1
  53. package/lib/legacy/{configurator-mesh-generator-d604f05c.legacy.js → configurator-mesh-generator-6266fa75.legacy.js} +2 -2
  54. package/lib/legacy/configurator-mesh-generator-6266fa75.legacy.js.map +1 -0
  55. package/lib/legacy/{default-light-setting-14b03f67.legacy.js → default-light-setting-97f711dc.legacy.js} +2 -2
  56. package/lib/legacy/default-light-setting-97f711dc.legacy.js.map +1 -0
  57. package/lib/legacy/{dimensioning-helper-bed08d96.legacy.js → dimensioning-helper-99057da2.legacy.js} +2 -2
  58. package/lib/legacy/dimensioning-helper-99057da2.legacy.js.map +1 -0
  59. package/lib/legacy/glb-viewer-be2c067a.legacy.js +2 -0
  60. package/lib/legacy/{glb-viewer-5dcdda0a.legacy.js.map → glb-viewer-be2c067a.legacy.js.map} +1 -1
  61. package/lib/legacy/glb-viewer-main.legacy.js +1 -1
  62. package/lib/legacy/image-renderer-6df9eca6.legacy.js +2 -0
  63. package/lib/legacy/{image-renderer-0f532f9c.legacy.js.map → image-renderer-6df9eca6.legacy.js.map} +1 -1
  64. package/lib/legacy/{main-thread-to-worker-880d5b78.legacy.js → main-thread-to-worker-4c02f179.legacy.js} +2 -2
  65. package/lib/legacy/main-thread-to-worker-4c02f179.legacy.js.map +1 -0
  66. package/lib/legacy/{material-viewer-41e5c677.legacy.js → material-viewer-e83460de.legacy.js} +2 -2
  67. package/lib/legacy/material-viewer-e83460de.legacy.js.map +1 -0
  68. package/lib/legacy/material-viewer-main.legacy.js +1 -1
  69. package/lib/legacy/{mesh-generator-4f2f2ec7.legacy.js → mesh-generator-084a73cd.legacy.js} +2 -2
  70. package/lib/legacy/mesh-generator-084a73cd.legacy.js.map +1 -0
  71. package/lib/legacy/{pixotron-cd4cd438.legacy.js → pixotron-6195d494.legacy.js} +2 -2
  72. package/lib/legacy/{pixotron-cd4cd438.legacy.js.map → pixotron-6195d494.legacy.js.map} +1 -1
  73. package/lib/legacy/{planner-03b11101.legacy.js → planner-5b7cc8fa.legacy.js} +2 -2
  74. package/lib/legacy/{planner-03b11101.legacy.js.map → planner-5b7cc8fa.legacy.js.map} +1 -1
  75. package/lib/legacy/planner-main.legacy.js +1 -1
  76. package/lib/legacy/{rapi-access-ef758fca.legacy.js → rapi-access-7d0f02e7.legacy.js} +3 -3
  77. package/lib/legacy/{rapi-access-ef758fca.legacy.js.map → rapi-access-7d0f02e7.legacy.js.map} +1 -1
  78. package/lib/legacy/roomle-sdk.legacy.js +1 -1
  79. package/lib/legacy/{scene-manager-afd27798.legacy.js → scene-manager-65a4c302.legacy.js} +2 -2
  80. package/lib/legacy/scene-manager-65a4c302.legacy.js.map +1 -0
  81. package/lib/legacy/static/ConfiguratorKernel-4c09558b00e81ba8.wasm +0 -0
  82. package/lib/legacy/static/{ConfiguratorKernel-c416f21e546a33f4.js → ConfiguratorKernel-7379813e2cd03c0d.js} +74 -74
  83. package/lib/legacy/static/ConfiguratorKernelJs-3789a15227520de1.js +143 -0
  84. package/lib/legacy/static/ConfiguratorKernelJs-dd075c23d87b4733.mem +0 -0
  85. package/lib/legacy/static/RoomleCore-43a1c9de57277471.wasm +0 -0
  86. package/lib/legacy/static/{RoomleCore-30311f70b9e1675b.js → RoomleCore-4da5951bbc66db16.js} +83 -83
  87. package/lib/legacy/static/RoomleCoreJs-86806817a5b958c9.js +151 -0
  88. package/lib/legacy/static/RoomleCoreJs-cfff2977254b7f93.mem +0 -0
  89. package/lib/legacy/static/shaders-df453330fdd84fa7.json +1 -0
  90. package/lib/legacy/{stats-helper-0acbc658.legacy.js → stats-helper-e832d5a9.legacy.js} +2 -2
  91. package/lib/legacy/{stats-helper-0acbc658.legacy.js.map → stats-helper-e832d5a9.legacy.js.map} +1 -1
  92. package/lib/{main-thread-to-worker-bb844d54.nomodule.js → main-thread-to-worker-4fc95d50.nomodule.js} +2 -2
  93. package/lib/main-thread-to-worker-4fc95d50.nomodule.js.map +1 -0
  94. package/lib/{main-thread-to-worker-91bf9f5e.js → main-thread-to-worker-5447c1c5.js} +2 -2
  95. package/lib/main-thread-to-worker-5447c1c5.js.map +1 -0
  96. package/lib/{material-viewer-1b0d838c.nomodule.js → material-viewer-8183024b.nomodule.js} +2 -2
  97. package/lib/material-viewer-8183024b.nomodule.js.map +1 -0
  98. package/lib/{material-viewer-90b397b7.js → material-viewer-9ee1ebf0.js} +2 -2
  99. package/lib/material-viewer-9ee1ebf0.js.map +1 -0
  100. package/lib/material-viewer-main-6c084313.js +2 -0
  101. package/lib/material-viewer-main-6c084313.js.map +1 -0
  102. package/lib/material-viewer-main.nomodule.js +1 -1
  103. package/lib/{mesh-generator-948c7db4.nomodule.js → mesh-generator-7dea7a1b.nomodule.js} +2 -2
  104. package/lib/mesh-generator-7dea7a1b.nomodule.js.map +1 -0
  105. package/lib/{mesh-generator-ff0dbfc8.js → mesh-generator-a980f1b0.js} +2 -2
  106. package/lib/mesh-generator-a980f1b0.js.map +1 -0
  107. package/lib/{pixotron-ec9a72e0.nomodule.js → pixotron-4065f090.nomodule.js} +2 -2
  108. package/lib/{pixotron-ec9a72e0.nomodule.js.map → pixotron-4065f090.nomodule.js.map} +1 -1
  109. package/lib/{pixotron-5167229f.js → pixotron-9baf521b.js} +2 -2
  110. package/lib/{pixotron-5167229f.js.map → pixotron-9baf521b.js.map} +1 -1
  111. package/lib/{planner-f1b53f57.nomodule.js → planner-2040e9ab.nomodule.js} +2 -2
  112. package/lib/{planner-f1b53f57.nomodule.js.map → planner-2040e9ab.nomodule.js.map} +1 -1
  113. package/lib/{planner-c3c34e74.js → planner-79b62302.js} +2 -2
  114. package/lib/{planner-c3c34e74.js.map → planner-79b62302.js.map} +1 -1
  115. package/lib/planner-main-74807374.js +2 -0
  116. package/lib/planner-main-74807374.js.map +1 -0
  117. package/lib/planner-main.nomodule.js +1 -1
  118. package/lib/{rapi-access-cf61a750.nomodule.js → rapi-access-65dbda00.nomodule.js} +3 -3
  119. package/lib/{rapi-access-cf61a750.nomodule.js.map → rapi-access-65dbda00.nomodule.js.map} +1 -1
  120. package/lib/{rapi-access-cc4f78e4.js → rapi-access-d209c65c.js} +3 -3
  121. package/lib/{rapi-access-cc4f78e4.js.map → rapi-access-d209c65c.js.map} +1 -1
  122. package/lib/{roomle-sdk-da4e3ccc.js → roomle-sdk-85d54446.js} +2 -2
  123. package/lib/roomle-sdk-85d54446.js.map +1 -0
  124. package/lib/roomle-sdk.nomodule.js +1 -1
  125. package/lib/{scene-manager-aa8b9035.nomodule.js → scene-manager-0ac7eb06.nomodule.js} +2 -2
  126. package/lib/scene-manager-0ac7eb06.nomodule.js.map +1 -0
  127. package/lib/{scene-manager-8c308533.js → scene-manager-424afdbc.js} +2 -2
  128. package/lib/scene-manager-424afdbc.js.map +1 -0
  129. package/lib/static/ConfiguratorKernel-4c09558b00e81ba8.wasm +0 -0
  130. package/lib/static/ConfiguratorKernel-7379813e2cd03c0d.js +1 -0
  131. package/lib/static/ConfiguratorKernel-7379813e2cd03c0d.js.map +1 -0
  132. package/lib/static/ConfiguratorKernelJs-3789a15227520de1.js +143 -0
  133. package/lib/static/ConfiguratorKernelJs-dd075c23d87b4733.mem +0 -0
  134. package/lib/static/RoomleCore-43a1c9de57277471.wasm +0 -0
  135. package/lib/static/RoomleCore-4da5951bbc66db16.js +1 -0
  136. package/lib/static/RoomleCore-4da5951bbc66db16.js.map +1 -0
  137. package/lib/static/RoomleCoreJs-86806817a5b958c9.js +151 -0
  138. package/lib/static/RoomleCoreJs-cfff2977254b7f93.mem +0 -0
  139. package/lib/static/shaders-df453330fdd84fa7.json +1 -0
  140. package/lib/{stats-helper-f53f8b2f.js → stats-helper-3ffe1651.js} +2 -2
  141. package/lib/{stats-helper-f53f8b2f.js.map → stats-helper-3ffe1651.js.map} +1 -1
  142. package/lib/{stats-helper-7dc63459.nomodule.js → stats-helper-9b173f93.nomodule.js} +2 -2
  143. package/lib/{stats-helper-7dc63459.nomodule.js.map → stats-helper-9b173f93.nomodule.js.map} +1 -1
  144. package/package.json +2 -2
  145. package/lib/component-dimensioning-07857a7e.js.map +0 -1
  146. package/lib/component-dimensioning-e121b044.nomodule.js.map +0 -1
  147. package/lib/configurator-366b9a69.js +0 -2
  148. package/lib/configurator-b498456a.nomodule.js +0 -2
  149. package/lib/configurator-main-1ba50225.js +0 -2
  150. package/lib/configurator-main-1ba50225.js.map +0 -1
  151. package/lib/configurator-mesh-generator-bedfe9a1.nomodule.js +0 -2
  152. package/lib/configurator-mesh-generator-bedfe9a1.nomodule.js.map +0 -1
  153. package/lib/configurator-mesh-generator-e827c528.js.map +0 -1
  154. package/lib/default-light-setting-7eb7961c.js.map +0 -1
  155. package/lib/default-light-setting-f21a820b.nomodule.js.map +0 -1
  156. package/lib/dimensioning-helper-2f129aab.js.map +0 -1
  157. package/lib/dimensioning-helper-73700224.nomodule.js.map +0 -1
  158. package/lib/glb-viewer-10243e50.js +0 -2
  159. package/lib/glb-viewer-d6e080e4.nomodule.js +0 -2
  160. package/lib/glb-viewer-main-39535b70.js +0 -2
  161. package/lib/glb-viewer-main-39535b70.js.map +0 -1
  162. package/lib/image-renderer-9478b17b.nomodule.js +0 -2
  163. package/lib/image-renderer-9e47bc3a.js +0 -2
  164. package/lib/legacy/component-dimensioning-d657350b.legacy.js.map +0 -1
  165. package/lib/legacy/configurator-3250dfc2.legacy.js +0 -2
  166. package/lib/legacy/configurator-mesh-generator-d604f05c.legacy.js.map +0 -1
  167. package/lib/legacy/default-light-setting-14b03f67.legacy.js.map +0 -1
  168. package/lib/legacy/dimensioning-helper-bed08d96.legacy.js.map +0 -1
  169. package/lib/legacy/glb-viewer-5dcdda0a.legacy.js +0 -2
  170. package/lib/legacy/image-renderer-0f532f9c.legacy.js +0 -2
  171. package/lib/legacy/main-thread-to-worker-880d5b78.legacy.js.map +0 -1
  172. package/lib/legacy/material-viewer-41e5c677.legacy.js.map +0 -1
  173. package/lib/legacy/mesh-generator-4f2f2ec7.legacy.js.map +0 -1
  174. package/lib/legacy/scene-manager-afd27798.legacy.js.map +0 -1
  175. package/lib/legacy/static/ConfiguratorKernel-a1daecbcb66a7ea2.wasm +0 -0
  176. package/lib/legacy/static/ConfiguratorKernelJs-2a6eb4d239731162.mem +0 -0
  177. package/lib/legacy/static/ConfiguratorKernelJs-fdb5588c5f9ad271.js +0 -143
  178. package/lib/legacy/static/RoomleCore-423543e6e81ce65d.wasm +0 -0
  179. package/lib/legacy/static/RoomleCoreJs-3ca6b11e7db6ad5c.js +0 -151
  180. package/lib/legacy/static/RoomleCoreJs-88d140ccbd2a0401.mem +0 -0
  181. package/lib/legacy/static/shaders-300ca3b7af102119.json +0 -1
  182. package/lib/main-thread-to-worker-91bf9f5e.js.map +0 -1
  183. package/lib/main-thread-to-worker-bb844d54.nomodule.js.map +0 -1
  184. package/lib/material-viewer-1b0d838c.nomodule.js.map +0 -1
  185. package/lib/material-viewer-90b397b7.js.map +0 -1
  186. package/lib/material-viewer-main-39b78443.js +0 -2
  187. package/lib/material-viewer-main-39b78443.js.map +0 -1
  188. package/lib/mesh-generator-948c7db4.nomodule.js.map +0 -1
  189. package/lib/mesh-generator-ff0dbfc8.js.map +0 -1
  190. package/lib/planner-main-f87ff090.js +0 -2
  191. package/lib/planner-main-f87ff090.js.map +0 -1
  192. package/lib/roomle-sdk-da4e3ccc.js.map +0 -1
  193. package/lib/scene-manager-8c308533.js.map +0 -1
  194. package/lib/scene-manager-aa8b9035.nomodule.js.map +0 -1
  195. package/lib/static/ConfiguratorKernel-a1daecbcb66a7ea2.wasm +0 -0
  196. package/lib/static/ConfiguratorKernel-c416f21e546a33f4.js +0 -1
  197. package/lib/static/ConfiguratorKernel-c416f21e546a33f4.js.map +0 -1
  198. package/lib/static/ConfiguratorKernelJs-2a6eb4d239731162.mem +0 -0
  199. package/lib/static/ConfiguratorKernelJs-fdb5588c5f9ad271.js +0 -143
  200. package/lib/static/RoomleCore-30311f70b9e1675b.js +0 -1
  201. package/lib/static/RoomleCore-30311f70b9e1675b.js.map +0 -1
  202. package/lib/static/RoomleCore-423543e6e81ce65d.wasm +0 -0
  203. package/lib/static/RoomleCoreJs-3ca6b11e7db6ad5c.js +0 -151
  204. package/lib/static/RoomleCoreJs-88d140ccbd2a0401.mem +0 -0
  205. package/lib/static/shaders-300ca3b7af102119.json +0 -1
@@ -1,2 +1,2 @@
1
- System.register(["./query-params-helper-c231e1b8.nomodule.js","./rapi-access-cf61a750.nomodule.js","./main-thread-to-worker-bb844d54.nomodule.js","./image-renderer-9478b17b.nomodule.js","./pixotron-ec9a72e0.nomodule.js","./mesh-generator-948c7db4.nomodule.js","./default-light-setting-f21a820b.nomodule.js","./scene-manager-aa8b9035.nomodule.js"],(function(e,t){var n,a,i,s,r,o,l,h,c,d,_,g,p,m,u,S,w,C,f,E,v,M,b,I,k,y,P,H,L,D,T,R,O,V,A,B,j,x,G,F,K,z,U,q,W,X,N,Q,J,Y,Z;return{setters:[function(){},function(e){n=e.h,a=e._,i=e.i,s=e.a4,r=e.d,o=e.F,l=e.a5,h=e.j,c=e.B,d=e.J,_=e.a6,g=e.r,p=e.G,m=e.a7,u=e.c,S=e.V,w=e.a2,C=e.U,f=e.n,E=e.L,v=e.o,M=e.s},function(e){b=e.s,I=e.l,k=e.m},function(e){y=e.S,P=e.c,H=e.d,L=e.G,D=e.b,T=e.a,R=e.g,O=e.P,V=e.C},function(e){A=e.L,B=e.B,j=e.a,x=e.C,G=e.h,F=e.T,K=e.e,z=e.g,U=e.I,q=e.E,W=e.S,X=e.M},function(e){N=e.M},function(e){Q=e.D},function(e){J=e.S,Y=e.C,Z=e.a}],execute:function(){class $ extends A{constructor(e,t){super(e,t),this._center=new THREE.Vector3(0,0,0),this._params={ambientLight:{color:"#ffffff"},hemiLight:{color:"#ffffff"},mainDirLight:{direction:{x:.03,y:1,z:.03},color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),.3),this._ambientLight.layers.set(1),this._mainDirLight=new THREE.DirectionalLight(new THREE.Color(this._params.mainDirLight.color),.5),this._mainDirLight.castShadow=!0,this._mainDirLight.shadow.camera.near=.5,this._mainDirLight.shadow.camera.far=100,this._mainDirLight.shadow.mapSize=new THREE.Vector2(1024,1024),this._mainDirLight.visible=!0,this.addToScene()}updateSunPosition(e,t){}addToScene(){this._scene.add(this._mainDirLight),this._scene.add(this._ambientLight),this._scene.add(this._mainDirLight.target)}removeFromScene(){this._scene.remove(this._mainDirLight),this._scene.remove(this._ambientLight),this._scene.remove(this._mainDirLight.target)}reload(){this.removeFromScene(),this.addToScene()}needsBounds(){return!0}updateBounds(e){this._center.copy(e.getCenter(new THREE.Vector3));const t=new THREE.Sphere;e.getBoundingSphere(t);const n=t.radius,a=new THREE.Vector3(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);a.normalize(),a.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(a),this._mainDirLight.target.position.copy(this._center),this._mainDirLight.target.updateMatrixWorld(!0),this._mainDirLight.shadow.camera.top=n,this._mainDirLight.shadow.camera.bottom=-n,this._mainDirLight.shadow.camera.left=-n,this._mainDirLight.shadow.camera.right=n,this._mainDirLight.shadow.camera.near=.01,this._mainDirLight.shadow.camera.far=2*n,this._mainDirLight.shadow.camera.updateProjectionMatrix()}showGUI(){let e=n();if(e){if(this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new THREE.Color(e))}if(this._hemiLight){let t=e.addFolder("Hemi Light");t.add(this._hemiLight,"visible"),t.add(this._hemiLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.hemiLight,"color").onChange(e=>this._hemiLight.color=new THREE.Color(e))}if(this._mainDirLight){let t=e.addFolder("Main Directional Light");t.add(this._mainDirLight,"visible"),t.add(this._mainDirLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(e=>this._mainDirLight.color=new THREE.Color(e)),t.add(this._mainDirLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center))}}}}class ee{constructor(e){const{planElementViewModel:t,resetCamera:n,state:a,oldState:i}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===a?0:a,this.oldState=void 0===i?0:i}}let te=(()=>{class e extends y{constructor(e,t,n,a){super(e,t,n,a),this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0);const i=new THREE.Layers;i.enable(3),i.enable(6),this._raycastHelper.setLayers(i),this._raycastHelper.addEventListener(3,()=>{this._plannerSelectionHandler.cancelSelection()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(0,new ee({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e})=>{this.setState(0),this.dispatchEvent(1,new ee({planElementViewModel:e}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}async addPlanObjectHandlers(e,t){t||(t=await e.getObjectAsync());const n={hasListener:!0,priority:1,roomleId:e.getId()};this._addPlanObjectHandlers(e,t,n)}addWallHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{hasListener:!0,priority:1,roomleId:e.getId()})}_addPlanObjectHandlers(e,t,n){t.userData.hasListener||(t.userData=n,t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)),t.addEventListener("rotate",t=>this._rotate(e,t.attachment.rotation)))}_addPlanElementHandlers(e,t,n){t.userData.hasListener||(t.userData=n,t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)))}_clickElement(e){this._debug&&e.getId(),this._plannerSelectionHandler.check(e),this._setCursor()}_hoverOn(e){this._hoveredObject=e,this._setCursor()}_hoverOff(e){this._hoveredObject=null,this._setCursor()}_setCursor(){2===this._state&&this._hasSelection()?b("ew-resize"):1===this._state?b("grabbing"):this._hoveredObject&&this._plannerSelectionHandler.isSelected(this._hoveredObject.getId())?b("move"):this._hoveredObject?b("pointer"):b("default")}setCamera(e){this._raycastHelper.setCamera(e)}setScene(e){this._raycastHelper.setScene(e)}getSelectedIds(){return this._plannerSelectionHandler.getSelectedIds()}setSelectionMode(e){this._plannerSelectionHandler.setSelectionMode(e)}setPlanViewModel(e){this._planViewModel=e}cancelSelection(){this._plannerSelectionHandler.cancelSelection()}_dragStart(e){this._plannerSelectionHandler.isSelected(e.getId())&&0===this._state&&(this._draggedObject=e,this.setState(1),this.dispatchEvent(4,new ee({planElementViewModel:e})),this._setCursor())}_drag(e,t){if(!this._draggedObject||1!==this._state)return;const n=this._plannerKernelAccess.planInteractionHandler;if(this._plannerSelectionHandler.getSelectedIds().length>1){const e=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let a=t.sub(this._draggedObject.getPosition());this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanObject())),n.moveObjectsBy(e,s(a))}else n.moveElementTo(e.getPlanElement(),s(t));this.dispatchEvent(5,new ee({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this.setState(0),this.dispatchEvent(6,new ee({planElementViewModel:e})),this._dragIn&&(this.cancelSelection(),this.setDragIn(!1)),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this._plannerKernelAccess.planInteractionHandler,a=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),a.rotation-t)}}setState(e){const t=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new ee({state:this._state,oldState:t})),this._position=null,2===this._state&&this._plannerKernelAccess.planInteractionHandler.deactivateAllSnappingActivity()}resetState(){this.setState(0)}_move(e){if(2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:a}=e.positionRelative;this._position?t=1.4*e.positionRelative.x*Math.PI-1.4*this._position.x*Math.PI:this._position=new THREE.Vector3(e.positionRelative.x,e.positionRelative.y,0);const i=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,r=new THREE.Box3;this.getSelectedIds().forEach(e=>{var t;const n=null===(t=this._planViewModel)||void 0===t?void 0:t.getPlanObjectForId(e);n&&n.getObject()&&(i.push_back(n.getPlanObject()),r.expandByObject(n.getContainer()))});const o=r.getCenter(new THREE.Vector3);this._plannerKernelAccess.planInteractionHandler.rotateObjectsBy(i,t,s(o)),this._position.copy(new THREE.Vector3(n,a,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}selectPlanElement(e){this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(0,new ee({}))}addComponentDragInHandler(e){if(!this._dragIn)return;const t=e.getBoundingBox();this._addPlanElementHandlers(e,t,{hasListener:!0,priority:1,roomleId:e.getId()}),this._raycastHelper.enableDragIn(t),this._dragStart(e)}}return a([i],e.prototype,"_plannerSelectionHandler",void 0),a([i],e.prototype,"_plannerKernelAccess",void 0),e})(),ne=(()=>{class e extends J{constructor(e,t,n,a){super(e,t,r.HSP,a),this._staticItemGuard=new o,this._configurableItemGuard=new o,this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new te(e,this._scene,this._cameraControl.getCamera(),this._getInputManager()),this._plannerSceneEventHandler.addEventListener(2,({state:e,oldState:t})=>{2===t&&e!==t&&this._roomlePlannerUiCallback.onRotationCancel(),2===e||1===e?this._cameraControl.lock():this._cameraControl.unlock()},this),this._plannerSceneEventHandler.addEventListener(0,({planElementViewModel:e})=>{e instanceof P&&this._initData.debug&&e.getGLBUrl(),this._highlight(e),this._onSelectionChange(e)},this),this._plannerSceneEventHandler.addEventListener(1,()=>{this._highlight(null),this._roomlePlannerUiCallback.onSelectionCancel()},this),this._plannerSceneEventHandler.addEventListener(4,()=>{this._plannerKernelAccess.planInteractionHandler.startInteraction(),this._cameraControl.lock(),this._environment instanceof B&&this._environment.removeFromScene(),this._requestRender(),this._dragStartBounds=this.getBounds()},this),this._plannerSceneEventHandler.addEventListener(5,({planElementViewModel:e})=>{this._cameraControl.checkNearFarDistance(e.getPosition()),this._requestRender()},this),this._plannerSceneEventHandler.addEventListener(6,({planElementViewModel:e})=>{const t=this._plannerKernelAccess.planInteractionHandler;t.endInteraction(),this._cameraControl.unlock(),this._environment instanceof B&&this._environment.addToScene();const n=this._getDragPosition(e.getPosition());n&&t.moveElementTo(e.getPlanElement(),s(n)),this._renderEverything(),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds()},this),this._plannerKernelAccess.addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._planViewModel.tryToMergeComponents(),this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this)}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new THREE.Vector3),a=e.distanceTo(n),i=t.getSize(new THREE.Vector3),s=Math.max(i.x,i.z)+3;if(a>s){const t=(new THREE.Vector3).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(s))}return null}_onSelectionChange(e){let t;e instanceof P&&(t="static"),e instanceof H&&(t="configuration");const n={};if(e instanceof P&&(n.item=e.getRapiItem()),e instanceof H){const t=e.getConfigurationRuntimeId();n.configurationRuntimeId=t}const a=(async()=>{const n={};if(e instanceof P&&(n.item=e.getRapiItem()),e instanceof H){const a=e.getConfigurationRuntimeId(),i=e.getPlanObject().getCatalogItemId(),s=this._plannerKernelAccess.kernelInstance.getHashOfConfiguration(a);let r;if(i&&g(i)){const e=await this._rapiAccess.getItem(i);n.item=e,r=e.rootComponentId?e.rootComponentId:null}else try{const e=await this._rapiAccess.getConfiguration(s);n.configuration=e,r=e.rootComponentId?e.rootComponentId:null}catch(e){console.warn("Could not get RAPI configuration for kernel hash "+s+", saving configuration...");const t=await this._plannerKernelAccess.getConfigurationData(a),i=await this._rapiAccess.saveConfiguration(t);n.configuration=i,r=i.rootComponentId?i.rootComponentId:null}if(r){const e=await this._rapiAccess.getComponent(r);n.component=e}n.configurationRuntimeId=a,t="configuration"}return I(n)})();this._roomlePlannerUiCallback.onSelectionChange(I(this._plannerSceneEventHandler.getSelectionMode()),I(t),I(n),a)}_setupScene(e,t){super._setupScene(e,t),this._initData.moc?(this._lightSetting=new Q(this._scene),this._setEnvironment(new j(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND)))):(this._lightSetting=new $(this._scene),this._addSky(),this._setEnvironment(new B(this._scene,this._environment)))}onBeforeRender(){this._cameraControl instanceof x&&this._plannerMeshGenerator.wallMeshes.forEach(e=>l(this._cameraControl.getCamera(),e.material))}_getInputManager(){return this._plannerInputManager}createCameraControl(e){this.setMode(e)}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart()}resetCameraToState(){this._cameraControl.resetToState()}resetCameraPositionToStart(){this._requestRender()}_getYRotationOfObject(e){let t=e.getWorldDirection(new THREE.Vector3).clone();t.y=0,t.lengthSq()<.01&&(t=new THREE.Vector3(0,1,0),t.applyQuaternion(e.quaternion),t.y=0),t.normalize();let n=Math.asin(t.x);return t.z<0&&(n=Math.PI-n),n<0&&(n+=2*Math.PI),n}loadStaticPlanObjects(){let e=new Map;this._planViewModel.getStaticPlanObjectViewModels().forEach(t=>{let n=t.getPlanObject();e.has(n.getCatalogItemId())?e.get(n.getCatalogItemId()).push(t):e.set(n.getCatalogItemId(),[t])}),this._rapiAccess.getItems(Array.from(e.keys())).then(t=>{let n=[];t.forEach(t=>{this._plannerKernelAccess.catalogItemLoaded(t),e.get(t.id).forEach(e=>{n.push(new Promise((n,a)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},a)}))})}),Promise.all(n).then(()=>this._staticItemsLoaded())})}_staticItemsLoaded(){this._requestRender(),this._staticItemGuard.resolve(),this._roomlePlannerUiCallback.onItemsLoaded()}preload(e){this._planId=e;let t=this._localStorageHelper.getItem(this._planId,"rml_plans");t&&this._loadGLTF(t).then(e=>{this._preloadScene=e,this._preloadScene&&this._scene.add(this._preloadScene),this._requestRender()})}planXMLLoaded(e){this.endPlanConstruction(e);const t=e.getBounds(),n=h(t);this._updateBounds(n),this.loadStaticPlanObjects()}planCompletelyLoaded(e){this._requestRender()}handlerSwitchedPlans(e){if(this._planViewModel=e,this._planViewModel.setPlannerSceneEventHandler(this._plannerSceneEventHandler),this._planViewModel.setGeometriesMergedListener(()=>{this._renderEverything()}),this._plannerSceneEventHandler.setPlanViewModel(this._planViewModel),this.clearScene(),!this._initData.moc){this._addSky();let e=new THREE.PlaneGeometry(1e3,1e3);e.rotateX(-Math.PI/2);let t=new THREE.MeshStandardMaterial({color:"#f0f0f0",roughness:1,metalness:0}),n=new THREE.Mesh(e,t);n.name="Ground",n.position.y=-.01,n.receiveShadow=!0,this._scene.add(n)}this.resetCamera(),this._setCeiling(),this._staticItemGuard.reset(),this._configurableItemGuard.reset(),Promise.all([this._staticItemGuard.wait(),this._configurableItemGuard.wait()]).then(this._itemsLoaded.bind(this))}_itemsLoaded(){const e=this._planViewModel.getCorePlan();if(this._pixotron){const t=h(e.getBounds());this._pixotron.getShadowPass().setShadowRecieverBBox(t)}this._roomlePlannerUiCallback.onCompletelyLoaded(),this.updateEnvironment(),this._renderEverything(),c.end("loadingTime")}beginPlanConstruction(e){}addPlanMesh(e,t,n,a,i,s,r){}endPlanConstruction(e){this._renderLoopFunction=()=>{this._scene.add(this._planViewModel.getConstructionGroup()),this._scene.add(this._planViewModel.getCeilingGroup()),this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(this._planViewModel.getBoundingBox()),this._scene.remove(this._preloadScene)}}addPlanObjectToScene(e){const t=e.getContainer();d(t),this._scene.add(t),this._zoomToBounds(),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.selectPlanElement(e),this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender())}removePlanObjectFromScene(e){this._scene.remove(e.getContainer()),this.updateEnvironment(this.getBounds()),this._renderEverything()}planElementChanged(e,t){this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),this._onPlanChanged()}exportGLB(e,t){this._scriptLoader.fetch(L,{id:"gltf-exporter"}).then(()=>{let n=new THREE.GLTFExporter;e||(e=[],this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)})),n.parse(e,e=>{let n=t||"test";this._localStorageHelper.addItem(n,JSON.stringify(e),"rml_plans")},{binary:!1,embedImages:!0,forceIndices:!0})})}importGLB(e){this._loadGLB(e).then(e=>this._scene.add(e))}clearScene(){this._plannerMeshGenerator.clear(),this._planViewModel.sceneCleared(),super.clearScene()}_addSky(){this._sky=new THREE.Sky,this._sky.name="Sky",this._sky.scale.setScalar(45e4),this._scene.add(this._sky),this._sky.material.uniforms.turbidity.value=10,this._sky.material.uniforms.rayleigh.value=2,this._sky.material.uniforms.luminance.value=1,this._sky.material.uniforms.mieCoefficient.value=.005,this._sky.material.uniforms.mieDirectionalG.value=.8;let e=new THREE.Mesh(new THREE.SphereBufferGeometry(2e4,16,8),new THREE.MeshBasicMaterial({color:16777215}));e.name="Sunsphere",e.position.y=-7e5,e.visible=!1,this._scene.add(e);let t=-.2*Math.PI,n=2*Math.PI*-.25;e.position.x=4e5*Math.cos(n),e.position.y=4e5*Math.sin(n)*Math.sin(t),e.position.z=4e5*Math.sin(n)*Math.cos(t),e.visible=!0,this._sky.material.uniforms.sunPosition.value.copy(e.position),this._lightSetting instanceof $&&this._lightSetting.updateSunPosition(.3,.25)}switchTo2D(){this._cameraControl instanceof Y||(this._requestRender(),this._changeCameraControl(new Y(this._creator_,this._getInputManager())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("2D"))}switchTo3D(){this._cameraControl instanceof x||(this._changeCameraControl(new x(this._creator_,this._getInputManager(),new THREE.Vector3(0,10,0),this.getPerspectiveOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("3D"))}_setCeiling(){this._planViewModel&&(this._cameraControl instanceof Z?this._planViewModel.getCeilingGroup().visible=!0:this._planViewModel.getCeilingGroup().visible=!1)}cameraControlChanged(){super.cameraControlChanged(),this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setCamera(this._cameraControl.getCamera())}sceneChanged(){this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setScene(this._scene)}closeHSC(){this._requestRender(),this._cameraControl instanceof x&&this._cameraControl.resetToState()}switchToFirstPerson(){if(this._cameraControl instanceof Z)return;this._plannerMeshGenerator.wallMeshes.forEach(e=>_(e.material,!1,!1)),this._requestRender();let e=new THREE.Vector3(0,0,0);this._planViewModel&&(e=this._planViewModel.getBoundingBox().getCenter(new THREE.Vector3)),this._cameraControl&&this._cameraControl.cleanUp(),this._changeCameraControl(new Z(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera())),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("FP")}_onKeyDown(e){super._onKeyDown(e),this._initData.debug&&this._checkNumKey(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("multiselect"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof x&&(this._cameraControl.enablePanning(),e.preventDefault())}_checkNumKey(e){e.key&&"1"===e.key&&(this.switchTo2D(),e.preventDefault()),e.key&&"2"===e.key&&(this.switchTo3D(),e.preventDefault()),e.key&&"3"===e.key&&(this.switchToFirstPerson(),e.preventDefault())}_onKeyUp(e){super._onKeyDown(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("standard"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof x&&(this._cameraControl.disablePanning(),e.preventDefault())}setMode(e){switch(e){case"2D":this.switchTo2D();break;case"3D":this.switchTo3D();break;case"FP":this.switchToFirstPerson()}}_highlight(e){let t=new Set;e&&e.getObject()&&e.getObject().children&&e.getObject().children.forEach(e=>t.add(e)),this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const n=this._planViewModel.getPlanObjectForId(e);n&&n.getObject()&&n.getObject().children&&n.getObject().children.forEach(e=>t.add(e))}),this._pixotron&&this._pixotron.highlightObjects(Array.from(t))}destroy(){super.destroy(),this._plannerMeshGenerator.removeMaterialLoadedListener(),this._planViewModel.removeGeometriesMergedListener()}getPixotronParams(){return{saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:2},shadowparams:{shadowMapResolution:1024,shadowRadius:3,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.6,nearPlane:.01,farPlane:50,fov:110,side:THREE.FrontSide,numSamples:100},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:.9,edgeThickness:2}}}getBakedShadowParams(){return{enable:!0,shadowMapResolution:1024,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4,bShadowMaterial:!0,falloff:1.8,darkness:.3,size:1.2,lightDirection:new THREE.Vector3(0,1,0),lightSolidAngle:40,yPosition:.006}}planObjectConfigurationLoaded(e,t,n){if(e&&e.extRef&&t&&t.extRef){let e=t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId();e>0&&this._planViewModel.constructComponents(e)}}addMesh(e,t,n,a,i,s){}_updateBounds(e){e&&(this._updateCamera(e),super._updateBounds(e))}_updateCamera(e){if(e||(e=this.getBounds()),e){if(this._cameraControl instanceof x){const t=e.getSize(new THREE.Vector3),n=Math.max(t.x,t.z),a=this._initData.moc?.5*n*-1:5,i=this._initData.moc?G:70;this._cameraControl.updateAndReset(t,e.getCenter(new THREE.Vector3),-15,i,a,!1)}this._cameraControl instanceof Y&&this._cameraControl.updateToBounds(e.getSize(new THREE.Vector3),e.getCenter(new THREE.Vector3))}}_zoomToBounds(){const e=this.getBounds();this._cameraControl instanceof x&&this._cameraControl.zoomToFitBounds(e)}getBounds(){return this._planViewModel?this._planViewModel.getBoundingBox():null}cancelSelection(){this._plannerSceneEventHandler.cancelSelection(),this._highlight(null),this._requestRender()}deleteSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelSelection(),e.forEach(e=>{const t=this._planViewModel.getPlanObjectForId(e);t&&t.getObject()&&this._plannerKernelAccess.planInteractionHandler.removeElement(t.getKernelObject())})}rotateSelection(e){const t=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,n=new THREE.Box3;this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const a=this._planViewModel.getPlanObjectForId(e);a&&a.getObject()&&(t.push_back(a.getPlanObject()),n.expandByObject(a.getContainer()))});const a=n.getCenter(new THREE.Vector3),i=this._plannerKernelAccess.planInteractionHandler.groupObjects(t);this._plannerKernelAccess.planInteractionHandler.rotateGroupBy(i,e,s(a))}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender()}planElementRemoved(e){this._onPlanChanged(),this._renderEverything()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={}){return new Promise(t=>{this._planViewModel.materialQueue.finished(!0).then(async()=>{let n=this._calculateBoundingBoxOfAllMeshes(.1);this._lightSetting.removeFromScene();let a=await D(this._scene,null,n,e);this._lightSetting.addToScene(),this._requestRender(),t(a)})})}preparePerspectiveImage(e={}){return new Promise((t,n)=>{this._planViewModel.materialQueue.finished(!0).then(async()=>{let n;n=this._cameraControl instanceof x?this._cameraControl.getCamera().clone():this.getPerspectiveOffsetCamera();let a=this._calculateBoundingBoxOfAllMeshes();this._lightSetting.removeFromScene();const i=await T(this._scene,null,n,a,e);this._lightSetting.addToScene(),this._requestRender(),t(i)},n)})}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return R(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}dragIn(e){this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}}return a([i],e.prototype,"_plannerKernelAccess",void 0),a([i],e.prototype,"_rapiAccess",void 0),a([i],e.prototype,"_plannerMeshGenerator",void 0),a([i],e.prototype,"_plannerInputManager",void 0),a([i],e.prototype,"_roomlePlannerUiCallback",void 0),a([i],e.prototype,"_localStorageHelper",void 0),e})();const ae={left:0,top:1,right:1,bottom:0};let ie=(()=>{class e{constructor(e){this._hscInstance=null,this._glbInstance=null,this._creator_=e,this._kernelAccessCallback.addListener(this),this._backstack.init([r.HSP],this)}deleteSelection(){this._sceneManager.deleteSelection()}rotateSelection(e){this._sceneManager.rotateSelection(e)}cancelSelection(){this._sceneManager.cancelSelection()}init(e,t,n){return c.start("loadingTime"),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):(this._preloadPlanId=t,this.setOverrides(n),new Promise(this._initPromiseCallback.bind(this)))}loadPlanXml(e,t){return this.setOverrides(t),new Promise(n=>{this._plan=this._planInteractionHandler.loadPlanXML(e),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._backstack.bringIntoForeground(r.HSP),this._initData.moc&&(t.id?this._rapiAccess.trackView(t.id):this._rapiAccess.trackView("planXML")),n()})}loadPlan(e,t){return this.setOverrides(t),new Promise((t,n)=>{this._rapiAccess.getPlan(e).then(n=>{this._plan=this._planInteractionHandler.loadPlanXML(n.planObjects),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._backstack.bringIntoForeground(r.HSP),this._initData.moc&&this._rapiAccess.trackView(e),t()},n)})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}switch2D(){this._sceneManager.switchTo2D()}switch3D(){this._sceneManager.switchTo3D()}switchToFirstPerson(){this._sceneManager.switchToFirstPerson()}exportGLB(){this._sceneManager.exportGLB()}importGLB(e){this._sceneManager.importGLB(e)}_initPromiseCallback(e,t){this._threeLoader.fetch().then(()=>{let t=this._scriptLoader.fetch(p,{id:"gltf-loader"}),n=this._scriptLoader.fetch(m,{id:"draco-loader"}),a=this._scriptLoader.fetch(F,{id:"tween-js"}),i=this._scriptLoader.fetch("static/Sky-6621935ea8a523af.js",{id:"sky-js"});Promise.all([t,n,a,i]).then(()=>{this._kernelReadyCallback=e;const{mode:t,stats:n}=this._initData;this._sceneManager||(this._sceneManager=new ne(this._creator_,ae,this,t)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId),n?this.showStats():this.enableHD(),this._planInteractionHandler&&this._kernelReadyCallback()})})}enableHD(){return new Promise((e,t)=>{const n=()=>{this._sceneManager.enableHD(),e()};this._threeLoader.fetch().then(()=>Promise.all(K.map(e=>this._scriptLoader.fetch(e,{id:e})))).then(()=>{this._scriptLoader.fetch(z,{id:"pi-js"}).then(n,t)},t)})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){c.showBenchmarks()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);t.import("./configurator-b498456a.nomodule.js").then((function(e){return e.c})).then(({Configurator:t})=>{const n=new t(this._creator_);n.boot({kernelInstance:this._planInteractionHandler.getConfiguratorKernel(),kernelContainer:this._plannerKernelAccess.kernelContainer}),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._hscInstance=n,e(this._hscInstance)})})});return this._backstack.bringIntoForeground(r.HSC),this.cancelSelection(),e}async switchToViewer(){const e=await this._singlePromiseFactory.create(4,"startGLB",e=>{if(this._glbInstance)return e(this._glbInstance);t.import("./glb-viewer-d6e080e4.nomodule.js").then(t=>{const n=new t.GlbViewer(this._creator_);n.boot(),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._glbInstance=n,e(this._glbInstance)})})});return this._backstack.bringIntoForeground(r.GLB),this.cancelSelection(),e}switchToPlanner(e){e&&this.loadPlan(e),this._backstack.bringIntoForeground(r.HSP)}updateSize(){this._sceneManager.updateCamera()}getMain(){}update(){this.updateSize(),this._glbInstance&&this._glbInstance.getApi().updateSize(),this._hscInstance&&this._hscInstance.getApi().updateSize()}get callbacks(){return this._roomlePlannerUiCallback}set callbacks(e){this._roomlePlannerUiCallback=e}showStats(){this._sceneManager.showStats()}onBackStackChanged(e){this._roomlePlannerUiCallback.onBackStackChanged(e)}onCloseHSC(){this._sceneManager.closeHSC(),this._hscInstance&&this._hscInstance.getApi().pauseKernelCallbacks()}back(){if(this._backstack.current()===r.GLB&&this._glbInstance&&this._glbInstance.getApi().clearScene(),this._backstack.current()===r.HSC&&this._hscInstance){const e=this._hscInstance.getApi();e.cancelSelection(),e.cancelDockings(),e.hideDimensions(),e.disableMultiselect(),this._sceneManager.updateScene()}this._backstack.back()}backTo(e){this._backstack.backTo(e)}getConfigurator(){return this._hscInstance}getCurrentSkin(){return this._rapiAccess.getCurrentSkin()}getRuntimeComponentIdOfRootComponent(e){return e?this._plannerKernelAccess.planInteractionHandler?this._plannerKernelAccess.planInteractionHandler.getConfiguratorKernel().getRootPlanComponentIdFromObjectId(e):(console.warn("Can not retrieve runtime id without planInteractionHandler"),0):(console.warn("Can not retrieve runtime id without planObjectId"),0)}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}loadError(e){}getPlanInteractionHandler(){return Promise.resolve(this._planInteractionHandler)}getPlanModelViewHelper(){return Promise.resolve(this._plannerKernelAccess.planModelViewHelper)}async insertObject(e,t,n){if(!this._planInteractionHandler)throw new Error("no plan interaction handler");const a=await(g(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),i=await this._plannerKernelAccess.addPlanObjectFromItem(a,t,n);return this._sceneManager.updateScene(),i}async insertItemList(e){const t=e.map(e=>g(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),n=await Promise.all(t);await this._plannerKernelAccess.insertItems(n)}async insertItems(e){await this._plannerKernelAccess.insertItems(e)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getCameraOffset(){return this._sceneManager.getCameraOffset()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}async getObjects(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);let t=[];for(let n=0;n<e.objects.size();n++)t.push(u(e.objects.get(n)));return t}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return u(e)}prepareTopImage(e={}){return this._sceneManager.prepareTopImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}enableRotation(){this._sceneManager.enableRotation()}disableRotation(){this._sceneManager.disableRotation()}async dragInObject(e,t){this._sceneManager.dragIn(t);const n=await this._rapiAccess.getItem(e);this.insertItems([n])}enableSnapping(){this._planInteractionHandler.reactivateAllSnappingActivity()}disableSnapping(){this._planInteractionHandler.deactivateAllSnappingActivity()}}return a([i],e.prototype,"_domHelper",void 0),a([i],e.prototype,"_scriptLoader",void 0),a([i],e.prototype,"_kernelAccessCallback",void 0),a([i],e.prototype,"_plannerKernelAccess",void 0),a([i],e.prototype,"_rapiAccess",void 0),a([i],e.prototype,"_singlePromiseFactory",void 0),a([i],e.prototype,"_roomlePlannerUiCallback",void 0),a([i],e.prototype,"_lifeCycleManager",void 0),a([i],e.prototype,"_backstack",void 0),a([i],e.prototype,"_threeLoader",void 0),a([i],e.prototype,"_dataSyncer",void 0),a([i],e.prototype,"_initData",void 0),a([i],e.prototype,"_globalInitData",void 0),e})(),se=(()=>{class e{constructor(e){this._initialStack=[],this._creator_=e,this._lifeCycleManager.addEventListener(this)}_setInitialStack(e){this._initialStack=[...e]}_setCallbacks(e){this._callbacks=e}_resetCanvasStack(){this._canvasStack=[...this._initialStack]}init(e,t){this._setInitialStack(e),this._resetCanvasStack(),this._setCallbacks(t)}bringIntoForeground(e){const t=this._domHelper.element.querySelectorAll("canvas");let n=!1;t.forEach(t=>{if(t.classList.contains(e)){if(!t.classList.contains("foreground")){const t=this.current();t&&e!==t&&(this._canvasStack.push(e),n=!0),t||(n=!0)}t.classList.remove("background"),t.classList.add("foreground")}else t.classList.remove("foreground"),t.classList.add("background")}),n&&this._callbacks.onBackStackChanged(this._canvasStack)}current(){return this._canvasStack[this._canvasStack.length-1]}back(){if(1===this._canvasStack.length)return;let e=this._canvasStack.pop();this.bringIntoForeground(this.current()),e===r.HSC&&this._callbacks.onCloseHSC(),this._callbacks.onBackStackChanged(this._canvasStack)}backTo(e){if(1!==this._canvasStack.length&&this.current()!==e)for(;this._canvasStack.length>0;){let t=this.current();if(t===e){this.bringIntoForeground(t);break}t===r.HSC&&this._callbacks.onCloseHSC(),this._canvasStack.pop(),this._callbacks.onBackStackChanged(this._canvasStack)}}pause(){this._resetCanvasStack()}resume(){}destroy(){}}return a([i],e.prototype,"_domHelper",void 0),a([i],e.prototype,"_lifeCycleManager",void 0),e})();class re{constructor(e){const{planElementViewModel:t}=e;this.planElementViewModel=t}}const oe=[new f("script-loader",W),new f("planner-input-manager",class extends U{_canDrag(e){return!0}},1),new f("planner-kernel-access",O),new f("logger",E),new f("planner-mesh-generator",class extends N{constructor(e){super(e),this._wallMeshes=[],this._defaultMaterial=new THREE.MeshStandardMaterial({color:"#ffffff",roughness:1,metalness:0,opacity:1,envMap:null}),this._environmentLoader.setEnvMap(this._defaultMaterial)}generateGeometry(e=null,t,n,a,i,s=!1){let r;return r=s?this._generateGeometry(e,t,n,a,i).clone():this._generateGeometry(e,t,n,a,i),r}generateMesh(e=null,t,n,a,i,s,r,o=!1){const l=this.generateGeometry(e,n,a,i,s,o),h=new THREE.Mesh(l,this._previewMaterial);return h.layers.set(3),!t&&r&&7!==r.value?(console.warn("material is undefined"),h):(this.setMaterial(h,t,r).then(()=>{const e=r&&3===r.value;h.castShadow=!e}),this._checkWallMaterial(h,r),h)}async setMaterial(e,t,n){if(e.userData.material=S(t,n),e.userData.materialId=t,k(t))t?await this._assignMaterial(e,t):(console.warn("Used default material because material is empty"),this.changeMaterialOfMesh(e,this._defaultMaterial));else{if(!t)return void this.changeMaterialOfMesh(e,this._defaultMaterial);2===(t=t).getSourceType().value?await this._assignMaterial(e,t.materialId):1===t.getSourceType().value?await this._assignItem(e,t.catalogItemId):3===t.getSourceType().value?await this._assignRGB(e,t.rgbValue):0===t.getSourceType().value?this.changeMaterialOfMesh(e,this._defaultMaterial):(this.changeMaterialOfMesh(e,this._defaultMaterial),1!==n.value&&7!==n.value&&3!==n.value&&console.warn("Used default material because material is not supported",t))}}set maxAnisotropy(e){this._maxAnisotropy=e}_checkWallMaterial(e,t){t&&1===t.value&&(e.renderOrder=5,this._wallMeshes.push(e))}clear(){super.clear(),this.clearWallMeshes()}clearWallMeshes(){this._wallMeshes.forEach(e=>{w(e)}),this._wallMeshes=[]}get wallMeshes(){return this._wallMeshes}}),new f("rapi-access",v),new f("roomle-planner-ui-callback",class extends C{constructor(e){super(e),this.onItemsLoaded=()=>{},this.onBackStackChanged=e=>{},this.onCameraChanged=e=>{},this.onTotalFloorAreaChanged=e=>{},this.onPlanInteractionHandlerCreated=e=>{},this.onPlannerKernelIsReady=e=>{},this.onConfiguratorKernelIsReady=(e,t)=>{},this.onSelectionChange=(e,t,n,a)=>{},this.onSelectionCancel=()=>{},this.onPlanChanged=()=>{},this.onCompletelyLoaded=()=>{},this.onRotationCancel=()=>{},this.onHistoryChange=(e,t)=>{}}}),new f("configurator-ui-callbacks",V,1),new f("backstack",se),new f("planner-selection-handler",class extends q{constructor(){super(...arguments),this._selectionMode="standard",this._selectedPlanElementViewModels=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}cancelSelection(){0!==this._selectedPlanElementViewModels.size&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new re({planElementViewModel:e}))})}_checkStandard(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new re({planElementViewModel:e}));this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new re({planElementViewModel:e}))}),this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new re({planElementViewModel:e}))}_checkMulti(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new re({planElementViewModel:e}));this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new re({planElementViewModel:e}))}setSelectionMode(e){this._selectionMode=e}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedPlanElementViewModels.size>0}getSelectedIds(){let e=[];return this._selectedPlanElementViewModels.forEach(t=>e.push(t.getId())),e}isSelected(e){return!!this._selectedPlanElementViewModels.get(e)}})];e("Planner",class extends X{setupGlobals(){}setupDependencies(){M.setup(oe),this.lookup("logger",this._context),this.lookup("planner-kernel-access",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._planner=new ie(this._context),this._planner.getMain=()=>this,window.RoomlePlanner||(window.RoomlePlanner=this._planner)}getApi(){return this._planner}getContextName(){return"planner"}})}}}));
2
- //# sourceMappingURL=planner-f1b53f57.nomodule.js.map
1
+ System.register(["./query-params-helper-c231e1b8.nomodule.js","./rapi-access-65dbda00.nomodule.js","./main-thread-to-worker-4fc95d50.nomodule.js","./image-renderer-880c414d.nomodule.js","./pixotron-4065f090.nomodule.js","./mesh-generator-7dea7a1b.nomodule.js","./default-light-setting-e4720308.nomodule.js","./scene-manager-0ac7eb06.nomodule.js"],(function(e,t){var n,a,i,s,r,o,l,h,c,d,_,g,p,m,u,S,w,C,f,E,v,M,b,I,k,y,P,H,L,D,T,R,O,V,A,B,j,x,G,F,K,z,U,q,W,X,N,Q,J,Y,Z;return{setters:[function(){},function(e){n=e.h,a=e._,i=e.i,s=e.a4,r=e.d,o=e.F,l=e.a5,h=e.j,c=e.B,d=e.J,_=e.a6,g=e.r,p=e.G,m=e.a7,u=e.c,S=e.V,w=e.a2,C=e.U,f=e.n,E=e.L,v=e.o,M=e.s},function(e){b=e.s,I=e.l,k=e.m},function(e){y=e.S,P=e.c,H=e.d,L=e.G,D=e.b,T=e.a,R=e.g,O=e.P,V=e.C},function(e){A=e.L,B=e.B,j=e.a,x=e.C,G=e.h,F=e.T,K=e.e,z=e.g,U=e.I,q=e.E,W=e.S,X=e.M},function(e){N=e.M},function(e){Q=e.D},function(e){J=e.S,Y=e.C,Z=e.a}],execute:function(){class $ extends A{constructor(e,t){super(e,t),this._center=new THREE.Vector3(0,0,0),this._params={ambientLight:{color:"#ffffff"},hemiLight:{color:"#ffffff"},mainDirLight:{direction:{x:.03,y:1,z:.03},color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),.3),this._ambientLight.layers.set(1),this._mainDirLight=new THREE.DirectionalLight(new THREE.Color(this._params.mainDirLight.color),.5),this._mainDirLight.castShadow=!0,this._mainDirLight.shadow.camera.near=.5,this._mainDirLight.shadow.camera.far=100,this._mainDirLight.shadow.mapSize=new THREE.Vector2(1024,1024),this._mainDirLight.visible=!0,this.addToScene()}updateSunPosition(e,t){}addToScene(){this._scene.add(this._mainDirLight),this._scene.add(this._ambientLight),this._scene.add(this._mainDirLight.target)}removeFromScene(){this._scene.remove(this._mainDirLight),this._scene.remove(this._ambientLight),this._scene.remove(this._mainDirLight.target)}reload(){this.removeFromScene(),this.addToScene()}needsBounds(){return!0}updateBounds(e){this._center.copy(e.getCenter(new THREE.Vector3));const t=new THREE.Sphere;e.getBoundingSphere(t);const n=t.radius,a=new THREE.Vector3(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);a.normalize(),a.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(a),this._mainDirLight.target.position.copy(this._center),this._mainDirLight.target.updateMatrixWorld(!0),this._mainDirLight.shadow.camera.top=n,this._mainDirLight.shadow.camera.bottom=-n,this._mainDirLight.shadow.camera.left=-n,this._mainDirLight.shadow.camera.right=n,this._mainDirLight.shadow.camera.near=.01,this._mainDirLight.shadow.camera.far=2*n,this._mainDirLight.shadow.camera.updateProjectionMatrix()}showGUI(){let e=n();if(e){if(this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new THREE.Color(e))}if(this._hemiLight){let t=e.addFolder("Hemi Light");t.add(this._hemiLight,"visible"),t.add(this._hemiLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.hemiLight,"color").onChange(e=>this._hemiLight.color=new THREE.Color(e))}if(this._mainDirLight){let t=e.addFolder("Main Directional Light");t.add(this._mainDirLight,"visible"),t.add(this._mainDirLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(e=>this._mainDirLight.color=new THREE.Color(e)),t.add(this._mainDirLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center))}}}}class ee{constructor(e){const{planElementViewModel:t,resetCamera:n,state:a,oldState:i}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===a?0:a,this.oldState=void 0===i?0:i}}let te=(()=>{class e extends y{constructor(e,t,n,a){super(e,t,n,a),this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0);const i=new THREE.Layers;i.enable(3),i.enable(6),this._raycastHelper.setLayers(i),this._raycastHelper.addEventListener(3,()=>{this._plannerSelectionHandler.cancelSelection()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(0,new ee({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e})=>{this.setState(0),this.dispatchEvent(1,new ee({planElementViewModel:e}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}async addPlanObjectHandlers(e,t){t||(t=await e.getObjectAsync());const n={hasListener:!0,priority:1,roomleId:e.getId()};this._addPlanObjectHandlers(e,t,n)}addWallHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{hasListener:!0,priority:1,roomleId:e.getId()})}_addPlanObjectHandlers(e,t,n){t.userData.hasListener||(t.userData=n,t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)),t.addEventListener("rotate",t=>this._rotate(e,t.attachment.rotation)))}_addPlanElementHandlers(e,t,n){t.userData.hasListener||(t.userData=n,t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)))}_clickElement(e){this._debug&&e.getId(),this._plannerSelectionHandler.check(e),this._setCursor()}_hoverOn(e){this._hoveredObject=e,this._setCursor()}_hoverOff(e){this._hoveredObject=null,this._setCursor()}_setCursor(){2===this._state&&this._hasSelection()?b("ew-resize"):1===this._state?b("grabbing"):this._hoveredObject&&this._plannerSelectionHandler.isSelected(this._hoveredObject.getId())?b("move"):this._hoveredObject?b("pointer"):b("default")}setCamera(e){this._raycastHelper.setCamera(e)}setScene(e){this._raycastHelper.setScene(e)}getSelectedIds(){return this._plannerSelectionHandler.getSelectedIds()}setSelectionMode(e){this._plannerSelectionHandler.setSelectionMode(e)}setPlanViewModel(e){this._planViewModel=e}cancelSelection(){this._plannerSelectionHandler.cancelSelection()}_dragStart(e){this._plannerSelectionHandler.isSelected(e.getId())&&0===this._state&&(this._draggedObject=e,this.setState(1),this.dispatchEvent(4,new ee({planElementViewModel:e})),this._setCursor())}_drag(e,t){if(!this._draggedObject||1!==this._state)return;const n=this._plannerKernelAccess.planInteractionHandler;if(this._plannerSelectionHandler.getSelectedIds().length>1){const e=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let a=t.sub(this._draggedObject.getPosition());this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanObject())),n.moveObjectsBy(e,s(a))}else n.moveElementTo(e.getPlanElement(),s(t));this.dispatchEvent(5,new ee({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this.setState(0),this.dispatchEvent(6,new ee({planElementViewModel:e})),this._dragIn&&(this.cancelSelection(),this.setDragIn(!1)),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this._plannerKernelAccess.planInteractionHandler,a=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),a.rotation-t)}}setState(e){const t=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new ee({state:this._state,oldState:t})),this._position=null,2===this._state&&this._plannerKernelAccess.planInteractionHandler.deactivateAllSnappingActivity()}resetState(){this.setState(0)}_move(e){if(2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:a}=e.positionRelative;this._position?t=1.4*e.positionRelative.x*Math.PI-1.4*this._position.x*Math.PI:this._position=new THREE.Vector3(e.positionRelative.x,e.positionRelative.y,0);const i=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,r=new THREE.Box3;this.getSelectedIds().forEach(e=>{var t;const n=null===(t=this._planViewModel)||void 0===t?void 0:t.getPlanObjectForId(e);n&&n.getObject()&&(i.push_back(n.getPlanObject()),r.expandByObject(n.getContainer()))});const o=r.getCenter(new THREE.Vector3);this._plannerKernelAccess.planInteractionHandler.rotateObjectsBy(i,t,s(o)),this._position.copy(new THREE.Vector3(n,a,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}selectPlanElement(e){this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(0,new ee({}))}addComponentDragInHandler(e){if(!this._dragIn)return;const t=e.getBoundingBox();this._addPlanElementHandlers(e,t,{hasListener:!0,priority:1,roomleId:e.getId()}),this._raycastHelper.enableDragIn(t),this._dragStart(e)}}return a([i],e.prototype,"_plannerSelectionHandler",void 0),a([i],e.prototype,"_plannerKernelAccess",void 0),e})(),ne=(()=>{class e extends J{constructor(e,t,n,a){super(e,t,r.HSP,a),this._staticItemGuard=new o,this._configurableItemGuard=new o,this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new te(e,this._scene,this._cameraControl.getCamera(),this._getInputManager()),this._plannerSceneEventHandler.addEventListener(2,({state:e,oldState:t})=>{2===t&&e!==t&&this._roomlePlannerUiCallback.onRotationCancel(),2===e||1===e?this._cameraControl.lock():this._cameraControl.unlock()},this),this._plannerSceneEventHandler.addEventListener(0,({planElementViewModel:e})=>{e instanceof P&&this._initData.debug&&e.getGLBUrl(),this._highlight(e),this._onSelectionChange(e)},this),this._plannerSceneEventHandler.addEventListener(1,()=>{this._highlight(null),this._roomlePlannerUiCallback.onSelectionCancel()},this),this._plannerSceneEventHandler.addEventListener(4,()=>{this._plannerKernelAccess.planInteractionHandler.startInteraction(),this._cameraControl.lock(),this._environment instanceof B&&this._environment.removeFromScene(),this._requestRender(),this._dragStartBounds=this.getBounds()},this),this._plannerSceneEventHandler.addEventListener(5,({planElementViewModel:e})=>{this._cameraControl.checkNearFarDistance(e.getPosition()),this._requestRender()},this),this._plannerSceneEventHandler.addEventListener(6,({planElementViewModel:e})=>{const t=this._plannerKernelAccess.planInteractionHandler;t.endInteraction(),this._cameraControl.unlock(),this._environment instanceof B&&this._environment.addToScene();const n=this._getDragPosition(e.getPosition());n&&t.moveElementTo(e.getPlanElement(),s(n)),this._renderEverything(),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds()},this),this._plannerKernelAccess.addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._planViewModel.tryToMergeComponents(),this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this)}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new THREE.Vector3),a=e.distanceTo(n),i=t.getSize(new THREE.Vector3),s=Math.max(i.x,i.z)+3;if(a>s){const t=(new THREE.Vector3).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(s))}return null}_onSelectionChange(e){let t;e instanceof P&&(t="static"),e instanceof H&&(t="configuration");const n={};if(e instanceof P&&(n.item=e.getRapiItem()),e instanceof H){const t=e.getConfigurationRuntimeId();n.configurationRuntimeId=t}const a=(async()=>{const n={};if(e instanceof P&&(n.item=e.getRapiItem()),e instanceof H){const a=e.getConfigurationRuntimeId(),i=e.getPlanObject().getCatalogItemId(),s=this._plannerKernelAccess.kernelInstance.getHashOfConfiguration(a);let r;if(i&&g(i)){const e=await this._rapiAccess.getItem(i);n.item=e,r=e.rootComponentId?e.rootComponentId:null}else try{const e=await this._rapiAccess.getConfiguration(s);n.configuration=e,r=e.rootComponentId?e.rootComponentId:null}catch(e){console.warn("Could not get RAPI configuration for kernel hash "+s+", saving configuration...");const t=await this._plannerKernelAccess.getConfigurationData(a),i=await this._rapiAccess.saveConfiguration(t);n.configuration=i,r=i.rootComponentId?i.rootComponentId:null}if(r){const e=await this._rapiAccess.getComponent(r);n.component=e}n.configurationRuntimeId=a,t="configuration"}return I(n)})();this._roomlePlannerUiCallback.onSelectionChange(I(this._plannerSceneEventHandler.getSelectionMode()),I(t),I(n),a)}_setupScene(e,t){super._setupScene(e,t),this._initData.moc?(this._lightSetting=new Q(this._scene),this._setEnvironment(new j(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND)))):(this._lightSetting=new $(this._scene),this._addSky(),this._setEnvironment(new B(this._scene,this._environment)))}onBeforeRender(){this._cameraControl instanceof x&&this._plannerMeshGenerator.wallMeshes.forEach(e=>l(this._cameraControl.getCamera(),e.material))}_getInputManager(){return this._plannerInputManager}createCameraControl(e){this.setMode(e)}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart()}resetCameraToState(){this._cameraControl.resetToState()}resetCameraPositionToStart(){this._requestRender()}_getYRotationOfObject(e){let t=e.getWorldDirection(new THREE.Vector3).clone();t.y=0,t.lengthSq()<.01&&(t=new THREE.Vector3(0,1,0),t.applyQuaternion(e.quaternion),t.y=0),t.normalize();let n=Math.asin(t.x);return t.z<0&&(n=Math.PI-n),n<0&&(n+=2*Math.PI),n}loadStaticPlanObjects(){let e=new Map;this._planViewModel.getStaticPlanObjectViewModels().forEach(t=>{let n=t.getPlanObject();e.has(n.getCatalogItemId())?e.get(n.getCatalogItemId()).push(t):e.set(n.getCatalogItemId(),[t])}),this._rapiAccess.getItems(Array.from(e.keys())).then(t=>{let n=[];t.forEach(t=>{this._plannerKernelAccess.catalogItemLoaded(t),e.get(t.id).forEach(e=>{n.push(new Promise((n,a)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},a)}))})}),Promise.all(n).then(()=>this._staticItemsLoaded())})}_staticItemsLoaded(){this._requestRender(),this._staticItemGuard.resolve(),this._roomlePlannerUiCallback.onItemsLoaded()}preload(e){this._planId=e;let t=this._localStorageHelper.getItem(this._planId,"rml_plans");t&&this._loadGLTF(t).then(e=>{this._preloadScene=e,this._preloadScene&&this._scene.add(this._preloadScene),this._requestRender()})}planXMLLoaded(e){this.endPlanConstruction(e);const t=e.getBounds(),n=h(t);this._updateBounds(n),this.loadStaticPlanObjects()}planCompletelyLoaded(e){this._requestRender()}handlerSwitchedPlans(e){if(this._planViewModel=e,this._planViewModel.setPlannerSceneEventHandler(this._plannerSceneEventHandler),this._planViewModel.setGeometriesMergedListener(()=>{this._renderEverything()}),this._plannerSceneEventHandler.setPlanViewModel(this._planViewModel),this.clearScene(),!this._initData.moc){this._addSky();let e=new THREE.PlaneGeometry(1e3,1e3);e.rotateX(-Math.PI/2);let t=new THREE.MeshStandardMaterial({color:"#f0f0f0",roughness:1,metalness:0}),n=new THREE.Mesh(e,t);n.name="Ground",n.position.y=-.01,n.receiveShadow=!0,this._scene.add(n)}this.resetCamera(),this._setCeiling(),this._staticItemGuard.reset(),this._configurableItemGuard.reset(),Promise.all([this._staticItemGuard.wait(),this._configurableItemGuard.wait()]).then(this._itemsLoaded.bind(this))}_itemsLoaded(){const e=this._planViewModel.getCorePlan();if(this._pixotron){const t=h(e.getBounds());this._pixotron.getShadowPass().setShadowRecieverBBox(t)}this._roomlePlannerUiCallback.onCompletelyLoaded(),this.updateEnvironment(),this._renderEverything(),c.end("loadingTime")}beginPlanConstruction(e){}addPlanMesh(e,t,n,a,i,s,r){}endPlanConstruction(e){this._renderLoopFunction=()=>{this._scene.add(this._planViewModel.getConstructionGroup()),this._scene.add(this._planViewModel.getCeilingGroup()),this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(this._planViewModel.getBoundingBox()),this._scene.remove(this._preloadScene)}}addPlanObjectToScene(e){const t=e.getContainer();d(t),this._scene.add(t),this._zoomToBounds(),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.selectPlanElement(e),this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender())}removePlanObjectFromScene(e){this._scene.remove(e.getContainer()),this.updateEnvironment(this.getBounds()),this._renderEverything()}planElementChanged(e,t){this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),this._onPlanChanged()}exportGLB(e,t){this._scriptLoader.fetch(L,{id:"gltf-exporter"}).then(()=>{let n=new THREE.GLTFExporter;e||(e=[],this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)})),n.parse(e,e=>{let n=t||"test";this._localStorageHelper.addItem(n,JSON.stringify(e),"rml_plans")},{binary:!1,embedImages:!0,forceIndices:!0})})}importGLB(e){this._loadGLB(e).then(e=>this._scene.add(e))}clearScene(){this._plannerMeshGenerator.clear(),this._planViewModel.sceneCleared(),super.clearScene()}_addSky(){this._sky=new THREE.Sky,this._sky.name="Sky",this._sky.scale.setScalar(45e4),this._scene.add(this._sky),this._sky.material.uniforms.turbidity.value=10,this._sky.material.uniforms.rayleigh.value=2,this._sky.material.uniforms.luminance.value=1,this._sky.material.uniforms.mieCoefficient.value=.005,this._sky.material.uniforms.mieDirectionalG.value=.8;let e=new THREE.Mesh(new THREE.SphereBufferGeometry(2e4,16,8),new THREE.MeshBasicMaterial({color:16777215}));e.name="Sunsphere",e.position.y=-7e5,e.visible=!1,this._scene.add(e);let t=-.2*Math.PI,n=2*Math.PI*-.25;e.position.x=4e5*Math.cos(n),e.position.y=4e5*Math.sin(n)*Math.sin(t),e.position.z=4e5*Math.sin(n)*Math.cos(t),e.visible=!0,this._sky.material.uniforms.sunPosition.value.copy(e.position),this._lightSetting instanceof $&&this._lightSetting.updateSunPosition(.3,.25)}switchTo2D(){this._cameraControl instanceof Y||(this._requestRender(),this._changeCameraControl(new Y(this._creator_,this._getInputManager())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("2D"))}switchTo3D(){this._cameraControl instanceof x||(this._changeCameraControl(new x(this._creator_,this._getInputManager(),new THREE.Vector3(0,10,0),this.getPerspectiveOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("3D"))}_setCeiling(){this._planViewModel&&(this._cameraControl instanceof Z?this._planViewModel.getCeilingGroup().visible=!0:this._planViewModel.getCeilingGroup().visible=!1)}cameraControlChanged(){super.cameraControlChanged(),this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setCamera(this._cameraControl.getCamera())}sceneChanged(){this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setScene(this._scene)}closeHSC(){this._requestRender(),this._cameraControl instanceof x&&this._cameraControl.resetToState()}switchToFirstPerson(){if(this._cameraControl instanceof Z)return;this._plannerMeshGenerator.wallMeshes.forEach(e=>_(e.material,!1,!1)),this._requestRender();let e=new THREE.Vector3(0,0,0);this._planViewModel&&(e=this._planViewModel.getBoundingBox().getCenter(new THREE.Vector3)),this._cameraControl&&this._cameraControl.cleanUp(),this._changeCameraControl(new Z(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera())),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("FP")}_onKeyDown(e){super._onKeyDown(e),this._initData.debug&&this._checkNumKey(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("multiselect"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof x&&(this._cameraControl.enablePanning(),e.preventDefault())}_checkNumKey(e){e.key&&"1"===e.key&&(this.switchTo2D(),e.preventDefault()),e.key&&"2"===e.key&&(this.switchTo3D(),e.preventDefault()),e.key&&"3"===e.key&&(this.switchToFirstPerson(),e.preventDefault())}_onKeyUp(e){super._onKeyDown(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("standard"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof x&&(this._cameraControl.disablePanning(),e.preventDefault())}setMode(e){switch(e){case"2D":this.switchTo2D();break;case"3D":this.switchTo3D();break;case"FP":this.switchToFirstPerson()}}_highlight(e){let t=new Set;e&&e.getObject()&&e.getObject().children&&e.getObject().children.forEach(e=>t.add(e)),this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const n=this._planViewModel.getPlanObjectForId(e);n&&n.getObject()&&n.getObject().children&&n.getObject().children.forEach(e=>t.add(e))}),this._pixotron&&this._pixotron.highlightObjects(Array.from(t))}destroy(){super.destroy(),this._plannerMeshGenerator.removeMaterialLoadedListener(),this._planViewModel.removeGeometriesMergedListener()}getPixotronParams(){return{saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:2},shadowparams:{shadowMapResolution:1024,shadowRadius:3,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.6,nearPlane:.01,farPlane:50,fov:110,side:THREE.FrontSide,numSamples:100},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:.9,edgeThickness:2}}}getBakedShadowParams(){return{enable:!0,shadowMapResolution:1024,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4,bShadowMaterial:!0,falloff:1.8,darkness:.3,size:1.2,lightDirection:new THREE.Vector3(0,1,0),lightSolidAngle:40,yPosition:.006}}planObjectConfigurationLoaded(e,t,n){if(e&&e.extRef&&t&&t.extRef){let e=t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId();e>0&&this._planViewModel.constructComponents(e)}}addMesh(e,t,n,a,i,s){}_updateBounds(e){e&&(this._updateCamera(e),super._updateBounds(e))}_updateCamera(e){if(e||(e=this.getBounds()),e){if(this._cameraControl instanceof x){const t=e.getSize(new THREE.Vector3),n=Math.max(t.x,t.z),a=this._initData.moc?.5*n*-1:5,i=this._initData.moc?G:70;this._cameraControl.updateAndReset(t,e.getCenter(new THREE.Vector3),-15,i,a,!1)}this._cameraControl instanceof Y&&this._cameraControl.updateToBounds(e.getSize(new THREE.Vector3),e.getCenter(new THREE.Vector3))}}_zoomToBounds(){const e=this.getBounds();this._cameraControl instanceof x&&this._cameraControl.zoomToFitBounds(e)}getBounds(){return this._planViewModel?this._planViewModel.getBoundingBox():null}cancelSelection(){this._plannerSceneEventHandler.cancelSelection(),this._highlight(null),this._requestRender()}deleteSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelSelection(),e.forEach(e=>{const t=this._planViewModel.getPlanObjectForId(e);t&&t.getObject()&&this._plannerKernelAccess.planInteractionHandler.removeElement(t.getKernelObject())})}rotateSelection(e){const t=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,n=new THREE.Box3;this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const a=this._planViewModel.getPlanObjectForId(e);a&&a.getObject()&&(t.push_back(a.getPlanObject()),n.expandByObject(a.getContainer()))});const a=n.getCenter(new THREE.Vector3),i=this._plannerKernelAccess.planInteractionHandler.groupObjects(t);this._plannerKernelAccess.planInteractionHandler.rotateGroupBy(i,e,s(a))}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender()}planElementRemoved(e){this._onPlanChanged(),this._renderEverything()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={}){return new Promise(t=>{this._planViewModel.materialQueue.finished(!0).then(async()=>{let n=this._calculateBoundingBoxOfAllMeshes(.1);this._lightSetting.removeFromScene();let a=await D(this._scene,null,n,e);this._lightSetting.addToScene(),this._requestRender(),t(a)})})}preparePerspectiveImage(e={}){return new Promise((t,n)=>{this._planViewModel.materialQueue.finished(!0).then(async()=>{let n;n=this._cameraControl instanceof x?this._cameraControl.getCamera().clone():this.getPerspectiveOffsetCamera();let a=this._calculateBoundingBoxOfAllMeshes();this._lightSetting.removeFromScene();const i=await T(this._scene,null,n,a,e);this._lightSetting.addToScene(),this._requestRender(),t(i)},n)})}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return R(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}dragIn(e){this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}}return a([i],e.prototype,"_plannerKernelAccess",void 0),a([i],e.prototype,"_rapiAccess",void 0),a([i],e.prototype,"_plannerMeshGenerator",void 0),a([i],e.prototype,"_plannerInputManager",void 0),a([i],e.prototype,"_roomlePlannerUiCallback",void 0),a([i],e.prototype,"_localStorageHelper",void 0),e})();const ae={left:0,top:1,right:1,bottom:0};let ie=(()=>{class e{constructor(e){this._hscInstance=null,this._glbInstance=null,this._creator_=e,this._kernelAccessCallback.addListener(this),this._backstack.init([r.HSP],this)}deleteSelection(){this._sceneManager.deleteSelection()}rotateSelection(e){this._sceneManager.rotateSelection(e)}cancelSelection(){this._sceneManager.cancelSelection()}init(e,t,n){return c.start("loadingTime"),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):(this._preloadPlanId=t,this.setOverrides(n),new Promise(this._initPromiseCallback.bind(this)))}loadPlanXml(e,t){return this.setOverrides(t),new Promise(n=>{this._plan=this._planInteractionHandler.loadPlanXML(e),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._backstack.bringIntoForeground(r.HSP),this._initData.moc&&(t.id?this._rapiAccess.trackView(t.id):this._rapiAccess.trackView("planXML")),n()})}loadPlan(e,t){return this.setOverrides(t),new Promise((t,n)=>{this._rapiAccess.getPlan(e).then(n=>{this._plan=this._planInteractionHandler.loadPlanXML(n.planObjects),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._backstack.bringIntoForeground(r.HSP),this._initData.moc&&this._rapiAccess.trackView(e),t()},n)})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}switch2D(){this._sceneManager.switchTo2D()}switch3D(){this._sceneManager.switchTo3D()}switchToFirstPerson(){this._sceneManager.switchToFirstPerson()}exportGLB(){this._sceneManager.exportGLB()}importGLB(e){this._sceneManager.importGLB(e)}_initPromiseCallback(e,t){this._threeLoader.fetch().then(()=>{let t=this._scriptLoader.fetch(p,{id:"gltf-loader"}),n=this._scriptLoader.fetch(m,{id:"draco-loader"}),a=this._scriptLoader.fetch(F,{id:"tween-js"}),i=this._scriptLoader.fetch("static/Sky-6621935ea8a523af.js",{id:"sky-js"});Promise.all([t,n,a,i]).then(()=>{this._kernelReadyCallback=e;const{mode:t,stats:n}=this._initData;this._sceneManager||(this._sceneManager=new ne(this._creator_,ae,this,t)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId),n?this.showStats():this.enableHD(),this._planInteractionHandler&&this._kernelReadyCallback()})})}enableHD(){return new Promise((e,t)=>{const n=()=>{this._sceneManager.enableHD(),e()};this._threeLoader.fetch().then(()=>Promise.all(K.map(e=>this._scriptLoader.fetch(e,{id:e})))).then(()=>{this._scriptLoader.fetch(z,{id:"pi-js"}).then(n,t)},t)})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){c.showBenchmarks()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);t.import("./configurator-eddf59f1.nomodule.js").then((function(e){return e.c})).then(({Configurator:t})=>{const n=new t(this._creator_);n.boot({kernelInstance:this._planInteractionHandler.getConfiguratorKernel(),kernelContainer:this._plannerKernelAccess.kernelContainer}),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._hscInstance=n,e(this._hscInstance)})})});return this._backstack.bringIntoForeground(r.HSC),this.cancelSelection(),e}async switchToViewer(){const e=await this._singlePromiseFactory.create(4,"startGLB",e=>{if(this._glbInstance)return e(this._glbInstance);t.import("./glb-viewer-6e5482c7.nomodule.js").then(t=>{const n=new t.GlbViewer(this._creator_);n.boot(),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._glbInstance=n,e(this._glbInstance)})})});return this._backstack.bringIntoForeground(r.GLB),this.cancelSelection(),e}switchToPlanner(e){e&&this.loadPlan(e),this._backstack.bringIntoForeground(r.HSP)}updateSize(){this._sceneManager.updateCamera()}getMain(){}update(){this.updateSize(),this._glbInstance&&this._glbInstance.getApi().updateSize(),this._hscInstance&&this._hscInstance.getApi().updateSize()}get callbacks(){return this._roomlePlannerUiCallback}set callbacks(e){this._roomlePlannerUiCallback=e}showStats(){this._sceneManager.showStats()}onBackStackChanged(e){this._roomlePlannerUiCallback.onBackStackChanged(e)}onCloseHSC(){this._sceneManager.closeHSC(),this._hscInstance&&this._hscInstance.getApi().pauseKernelCallbacks()}back(){if(this._backstack.current()===r.GLB&&this._glbInstance&&this._glbInstance.getApi().clearScene(),this._backstack.current()===r.HSC&&this._hscInstance){const e=this._hscInstance.getApi();e.cancelSelection(),e.cancelDockings(),e.hideDimensions(),e.disableMultiselect(),this._sceneManager.updateScene()}this._backstack.back()}backTo(e){this._backstack.backTo(e)}getConfigurator(){return this._hscInstance}getCurrentSkin(){return this._rapiAccess.getCurrentSkin()}getRuntimeComponentIdOfRootComponent(e){return e?this._plannerKernelAccess.planInteractionHandler?this._plannerKernelAccess.planInteractionHandler.getConfiguratorKernel().getRootPlanComponentIdFromObjectId(e):(console.warn("Can not retrieve runtime id without planInteractionHandler"),0):(console.warn("Can not retrieve runtime id without planObjectId"),0)}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}loadError(e){}getPlanInteractionHandler(){return Promise.resolve(this._planInteractionHandler)}getPlanModelViewHelper(){return Promise.resolve(this._plannerKernelAccess.planModelViewHelper)}async insertObject(e,t,n){if(!this._planInteractionHandler)throw new Error("no plan interaction handler");const a=await(g(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),i=await this._plannerKernelAccess.addPlanObjectFromItem(a,t,n);return this._sceneManager.updateScene(),i}async insertItemList(e){const t=e.map(e=>g(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),n=await Promise.all(t);await this._plannerKernelAccess.insertItems(n)}async insertItems(e){await this._plannerKernelAccess.insertItems(e)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getCameraOffset(){return this._sceneManager.getCameraOffset()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}async getObjects(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);let t=[];for(let n=0;n<e.objects.size();n++)t.push(u(e.objects.get(n)));return t}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return u(e)}prepareTopImage(e={}){return this._sceneManager.prepareTopImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}enableRotation(){this._sceneManager.enableRotation()}disableRotation(){this._sceneManager.disableRotation()}async dragInObject(e,t){this._sceneManager.dragIn(t);const n=await this._rapiAccess.getItem(e);this.insertItems([n])}enableSnapping(){this._planInteractionHandler.reactivateAllSnappingActivity()}disableSnapping(){this._planInteractionHandler.deactivateAllSnappingActivity()}}return a([i],e.prototype,"_domHelper",void 0),a([i],e.prototype,"_scriptLoader",void 0),a([i],e.prototype,"_kernelAccessCallback",void 0),a([i],e.prototype,"_plannerKernelAccess",void 0),a([i],e.prototype,"_rapiAccess",void 0),a([i],e.prototype,"_singlePromiseFactory",void 0),a([i],e.prototype,"_roomlePlannerUiCallback",void 0),a([i],e.prototype,"_lifeCycleManager",void 0),a([i],e.prototype,"_backstack",void 0),a([i],e.prototype,"_threeLoader",void 0),a([i],e.prototype,"_dataSyncer",void 0),a([i],e.prototype,"_initData",void 0),a([i],e.prototype,"_globalInitData",void 0),e})(),se=(()=>{class e{constructor(e){this._initialStack=[],this._creator_=e,this._lifeCycleManager.addEventListener(this)}_setInitialStack(e){this._initialStack=[...e]}_setCallbacks(e){this._callbacks=e}_resetCanvasStack(){this._canvasStack=[...this._initialStack]}init(e,t){this._setInitialStack(e),this._resetCanvasStack(),this._setCallbacks(t)}bringIntoForeground(e){const t=this._domHelper.element.querySelectorAll("canvas");let n=!1;t.forEach(t=>{if(t.classList.contains(e)){if(!t.classList.contains("foreground")){const t=this.current();t&&e!==t&&(this._canvasStack.push(e),n=!0),t||(n=!0)}t.classList.remove("background"),t.classList.add("foreground")}else t.classList.remove("foreground"),t.classList.add("background")}),n&&this._callbacks.onBackStackChanged(this._canvasStack)}current(){return this._canvasStack[this._canvasStack.length-1]}back(){if(1===this._canvasStack.length)return;let e=this._canvasStack.pop();this.bringIntoForeground(this.current()),e===r.HSC&&this._callbacks.onCloseHSC(),this._callbacks.onBackStackChanged(this._canvasStack)}backTo(e){if(1!==this._canvasStack.length&&this.current()!==e)for(;this._canvasStack.length>0;){let t=this.current();if(t===e){this.bringIntoForeground(t);break}t===r.HSC&&this._callbacks.onCloseHSC(),this._canvasStack.pop(),this._callbacks.onBackStackChanged(this._canvasStack)}}pause(){this._resetCanvasStack()}resume(){}destroy(){}}return a([i],e.prototype,"_domHelper",void 0),a([i],e.prototype,"_lifeCycleManager",void 0),e})();class re{constructor(e){const{planElementViewModel:t}=e;this.planElementViewModel=t}}const oe=[new f("script-loader",W),new f("planner-input-manager",class extends U{_canDrag(e){return!0}},1),new f("planner-kernel-access",O),new f("logger",E),new f("planner-mesh-generator",class extends N{constructor(e){super(e),this._wallMeshes=[],this._defaultMaterial=new THREE.MeshStandardMaterial({color:"#ffffff",roughness:1,metalness:0,opacity:1,envMap:null}),this._environmentLoader.setEnvMap(this._defaultMaterial)}generateGeometry(e=null,t,n,a,i,s=!1){let r;return r=s?this._generateGeometry(e,t,n,a,i).clone():this._generateGeometry(e,t,n,a,i),r}generateMesh(e=null,t,n,a,i,s,r,o=!1){const l=this.generateGeometry(e,n,a,i,s,o),h=new THREE.Mesh(l,this._previewMaterial);return h.layers.set(3),!t&&r&&7!==r.value?(console.warn("material is undefined"),h):(this.setMaterial(h,t,r).then(()=>{const e=r&&3===r.value;h.castShadow=!e}),this._checkWallMaterial(h,r),h)}async setMaterial(e,t,n){if(e.userData.material=S(t,n),e.userData.materialId=t,k(t))t?await this._assignMaterial(e,t):(console.warn("Used default material because material is empty"),this.changeMaterialOfMesh(e,this._defaultMaterial));else{if(!t)return void this.changeMaterialOfMesh(e,this._defaultMaterial);2===(t=t).getSourceType().value?await this._assignMaterial(e,t.materialId):1===t.getSourceType().value?await this._assignItem(e,t.catalogItemId):3===t.getSourceType().value?await this._assignRGB(e,t.rgbValue):0===t.getSourceType().value?this.changeMaterialOfMesh(e,this._defaultMaterial):(this.changeMaterialOfMesh(e,this._defaultMaterial),1!==n.value&&7!==n.value&&3!==n.value&&console.warn("Used default material because material is not supported",t))}}set maxAnisotropy(e){this._maxAnisotropy=e}_checkWallMaterial(e,t){t&&1===t.value&&(e.renderOrder=5,this._wallMeshes.push(e))}clear(){super.clear(),this.clearWallMeshes()}clearWallMeshes(){this._wallMeshes.forEach(e=>{w(e)}),this._wallMeshes=[]}get wallMeshes(){return this._wallMeshes}}),new f("rapi-access",v),new f("roomle-planner-ui-callback",class extends C{constructor(e){super(e),this.onItemsLoaded=()=>{},this.onBackStackChanged=e=>{},this.onCameraChanged=e=>{},this.onTotalFloorAreaChanged=e=>{},this.onPlanInteractionHandlerCreated=e=>{},this.onPlannerKernelIsReady=e=>{},this.onConfiguratorKernelIsReady=(e,t)=>{},this.onSelectionChange=(e,t,n,a)=>{},this.onSelectionCancel=()=>{},this.onPlanChanged=()=>{},this.onCompletelyLoaded=()=>{},this.onRotationCancel=()=>{},this.onHistoryChange=(e,t)=>{}}}),new f("configurator-ui-callbacks",V,1),new f("backstack",se),new f("planner-selection-handler",class extends q{constructor(){super(...arguments),this._selectionMode="standard",this._selectedPlanElementViewModels=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}cancelSelection(){0!==this._selectedPlanElementViewModels.size&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new re({planElementViewModel:e}))})}_checkStandard(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new re({planElementViewModel:e}));this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new re({planElementViewModel:e}))}),this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new re({planElementViewModel:e}))}_checkMulti(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new re({planElementViewModel:e}));this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new re({planElementViewModel:e}))}setSelectionMode(e){this._selectionMode=e}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedPlanElementViewModels.size>0}getSelectedIds(){let e=[];return this._selectedPlanElementViewModels.forEach(t=>e.push(t.getId())),e}isSelected(e){return!!this._selectedPlanElementViewModels.get(e)}})];e("Planner",class extends X{setupGlobals(){}setupDependencies(){M.setup(oe),this.lookup("logger",this._context),this.lookup("planner-kernel-access",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._planner=new ie(this._context),this._planner.getMain=()=>this,window.RoomlePlanner||(window.RoomlePlanner=this._planner)}getApi(){return this._planner}getContextName(){return"planner"}})}}}));
2
+ //# sourceMappingURL=planner-2040e9ab.nomodule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-f1b53f57.nomodule.js","sources":["../../node_modules/three/examples/js/objects/Sky.js"],"sourcesContent":["export default \"static/Sky-6621935ea8a523af.js\""],"names":[],"mappings":"8q2BAAe"}
1
+ {"version":3,"file":"planner-2040e9ab.nomodule.js","sources":["../../node_modules/three/examples/js/objects/Sky.js"],"sourcesContent":["export default \"static/Sky-6621935ea8a523af.js\""],"names":[],"mappings":"8q2BAAe"}
@@ -1,2 +1,2 @@
1
- import"./query-params-helper-a271f9dc.js";import{h as getGUI,_ as __decorate,i as inject,a4 as convertToKernel,d as CANVAS_ID,F as AsyncGuard,a5 as setWallTransparencyBasedOnCamera,j as kernelBoxToThreeBox,B as Benchmark,J as fadeIn,a6 as setWallTransparency,r as isIdItemId,G as GLTF_LOADER_FILE_NAME,a7 as DRACO_LOADER_FILE_NAME,c as convertCObject,V as getMaterialId,a2 as disposeMesh,U as UiCallback,n as DependencyInjectionAssignment,L as Logger,o as RapiAccess,s as RoomleDependencyInjection}from"./rapi-access-cc4f78e4.js";import{s as setCursor,l as copy,m as isString}from"./main-thread-to-worker-91bf9f5e.js";import{S as SceneEventHandler,c as StaticPlanObjectViewModel,d as ConfiguratorPlanObjectViewModel,G as GLTF_EXPORTER_FILE_NAME,b as prepareTopImage,a as preparePerspectiveImage,g as getCameraTargetForBBox,P as PlannerKernelAccess,C as ConfiguratorUiCallbacks}from"./image-renderer-9e47bc3a.js";import{L as LightSetting,B as BakedShadowEnvironment,a as BackgroundEnvironment,C as CameraControl3D,h as INITIAL_PITCH,T as TWEEN_FILE_NAME,e as PIXOTRON_EFFETCS,g as PIXOTRON_FILE_NAME,I as InputManager,E as EventDispatcher,S as ScriptLoader,M as Main}from"./pixotron-5167229f.js";import{M as MeshGenerator}from"./mesh-generator-ff0dbfc8.js";import{D as DefaultLightSetting}from"./default-light-setting-7eb7961c.js";import{S as SceneManager,C as CameraControl2D,a as CameraControlFirstPerson}from"./scene-manager-8c308533.js";class PlannerLightSetting extends LightSetting{constructor(e,t){super(e,t),this._center=new THREE.Vector3(0,0,0),this._params={ambientLight:{color:"#ffffff"},hemiLight:{color:"#ffffff"},mainDirLight:{direction:{x:.03,y:1,z:.03},color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),.3),this._ambientLight.layers.set(1),this._mainDirLight=new THREE.DirectionalLight(new THREE.Color(this._params.mainDirLight.color),.5),this._mainDirLight.castShadow=!0,this._mainDirLight.shadow.camera.near=.5,this._mainDirLight.shadow.camera.far=100,this._mainDirLight.shadow.mapSize=new THREE.Vector2(1024,1024),this._mainDirLight.visible=!0,this.addToScene()}updateSunPosition(e,t){}addToScene(){this._scene.add(this._mainDirLight),this._scene.add(this._ambientLight),this._scene.add(this._mainDirLight.target)}removeFromScene(){this._scene.remove(this._mainDirLight),this._scene.remove(this._ambientLight),this._scene.remove(this._mainDirLight.target)}reload(){this.removeFromScene(),this.addToScene()}needsBounds(){return!0}updateBounds(e){this._center.copy(e.getCenter(new THREE.Vector3));const t=new THREE.Sphere;e.getBoundingSphere(t);const n=t.radius,a=new THREE.Vector3(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);a.normalize(),a.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(a),this._mainDirLight.target.position.copy(this._center),this._mainDirLight.target.updateMatrixWorld(!0),this._mainDirLight.shadow.camera.top=n,this._mainDirLight.shadow.camera.bottom=-n,this._mainDirLight.shadow.camera.left=-n,this._mainDirLight.shadow.camera.right=n,this._mainDirLight.shadow.camera.near=.01,this._mainDirLight.shadow.camera.far=2*n,this._mainDirLight.shadow.camera.updateProjectionMatrix()}showGUI(){let e=getGUI();if(e){if(this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new THREE.Color(e))}if(this._hemiLight){let t=e.addFolder("Hemi Light");t.add(this._hemiLight,"visible"),t.add(this._hemiLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.hemiLight,"color").onChange(e=>this._hemiLight.color=new THREE.Color(e))}if(this._mainDirLight){let t=e.addFolder("Main Directional Light");t.add(this._mainDirLight,"visible"),t.add(this._mainDirLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(e=>this._mainDirLight.color=new THREE.Color(e)),t.add(this._mainDirLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center))}}}}class SceneEventInfo{constructor(e){const{planElementViewModel:t,resetCamera:n,state:a,oldState:i}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===a?0:a,this.oldState=void 0===i?0:i}}let PlannerSceneEventHandler=(()=>{class e extends SceneEventHandler{constructor(e,t,n,a){super(e,t,n,a),this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0);const i=new THREE.Layers;i.enable(3),i.enable(6),this._raycastHelper.setLayers(i),this._raycastHelper.addEventListener(3,()=>{this._plannerSelectionHandler.cancelSelection()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(0,new SceneEventInfo({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e})=>{this.setState(0),this.dispatchEvent(1,new SceneEventInfo({planElementViewModel:e}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}async addPlanObjectHandlers(e,t){t||(t=await e.getObjectAsync());const n={hasListener:!0,priority:1,roomleId:e.getId()};this._addPlanObjectHandlers(e,t,n)}addWallHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{hasListener:!0,priority:1,roomleId:e.getId()})}_addPlanObjectHandlers(e,t,n){t.userData.hasListener||(t.userData=n,t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)),t.addEventListener("rotate",t=>this._rotate(e,t.attachment.rotation)))}_addPlanElementHandlers(e,t,n){t.userData.hasListener||(t.userData=n,t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)))}_clickElement(e){this._debug&&e.getId(),this._plannerSelectionHandler.check(e),this._setCursor()}_hoverOn(e){this._hoveredObject=e,this._setCursor()}_hoverOff(e){this._hoveredObject=null,this._setCursor()}_setCursor(){2===this._state&&this._hasSelection()?setCursor("ew-resize"):1===this._state?setCursor("grabbing"):this._hoveredObject&&this._plannerSelectionHandler.isSelected(this._hoveredObject.getId())?setCursor("move"):this._hoveredObject?setCursor("pointer"):setCursor("default")}setCamera(e){this._raycastHelper.setCamera(e)}setScene(e){this._raycastHelper.setScene(e)}getSelectedIds(){return this._plannerSelectionHandler.getSelectedIds()}setSelectionMode(e){this._plannerSelectionHandler.setSelectionMode(e)}setPlanViewModel(e){this._planViewModel=e}cancelSelection(){this._plannerSelectionHandler.cancelSelection()}_dragStart(e){this._plannerSelectionHandler.isSelected(e.getId())&&0===this._state&&(this._draggedObject=e,this.setState(1),this.dispatchEvent(4,new SceneEventInfo({planElementViewModel:e})),this._setCursor())}_drag(e,t){if(!this._draggedObject||1!==this._state)return;const n=this._plannerKernelAccess.planInteractionHandler;if(this._plannerSelectionHandler.getSelectedIds().length>1){const e=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let a=t.sub(this._draggedObject.getPosition());this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanObject())),n.moveObjectsBy(e,convertToKernel(a))}else n.moveElementTo(e.getPlanElement(),convertToKernel(t));this.dispatchEvent(5,new SceneEventInfo({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this.setState(0),this.dispatchEvent(6,new SceneEventInfo({planElementViewModel:e})),this._dragIn&&(this.cancelSelection(),this.setDragIn(!1)),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this._plannerKernelAccess.planInteractionHandler,a=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),a.rotation-t)}}setState(e){const t=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new SceneEventInfo({state:this._state,oldState:t})),this._position=null,2===this._state&&this._plannerKernelAccess.planInteractionHandler.deactivateAllSnappingActivity()}resetState(){this.setState(0)}_move(e){if(2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:a}=e.positionRelative;this._position?t=1.4*e.positionRelative.x*Math.PI-1.4*this._position.x*Math.PI:this._position=new THREE.Vector3(e.positionRelative.x,e.positionRelative.y,0);const i=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,s=new THREE.Box3;this.getSelectedIds().forEach(e=>{var t;const n=null===(t=this._planViewModel)||void 0===t?void 0:t.getPlanObjectForId(e);n&&n.getObject()&&(i.push_back(n.getPlanObject()),s.expandByObject(n.getContainer()))});const r=s.getCenter(new THREE.Vector3);this._plannerKernelAccess.planInteractionHandler.rotateObjectsBy(i,t,convertToKernel(r)),this._position.copy(new THREE.Vector3(n,a,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}selectPlanElement(e){this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(0,new SceneEventInfo({}))}addComponentDragInHandler(e){if(!this._dragIn)return;const t=e.getBoundingBox();this._addPlanElementHandlers(e,t,{hasListener:!0,priority:1,roomleId:e.getId()}),this._raycastHelper.enableDragIn(t),this._dragStart(e)}}return __decorate([inject],e.prototype,"_plannerSelectionHandler",void 0),__decorate([inject],e.prototype,"_plannerKernelAccess",void 0),e})(),PlannerSceneManager=(()=>{class e extends SceneManager{constructor(e,t,n,a){super(e,t,CANVAS_ID.HSP,a),this._staticItemGuard=new AsyncGuard,this._configurableItemGuard=new AsyncGuard,this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new PlannerSceneEventHandler(e,this._scene,this._cameraControl.getCamera(),this._getInputManager()),this._plannerSceneEventHandler.addEventListener(2,({state:e,oldState:t})=>{2===t&&e!==t&&this._roomlePlannerUiCallback.onRotationCancel(),2===e||1===e?this._cameraControl.lock():this._cameraControl.unlock()},this),this._plannerSceneEventHandler.addEventListener(0,({planElementViewModel:e})=>{e instanceof StaticPlanObjectViewModel&&this._initData.debug&&e.getGLBUrl(),this._highlight(e),this._onSelectionChange(e)},this),this._plannerSceneEventHandler.addEventListener(1,()=>{this._highlight(null),this._roomlePlannerUiCallback.onSelectionCancel()},this),this._plannerSceneEventHandler.addEventListener(4,()=>{this._plannerKernelAccess.planInteractionHandler.startInteraction(),this._cameraControl.lock(),this._environment instanceof BakedShadowEnvironment&&this._environment.removeFromScene(),this._requestRender(),this._dragStartBounds=this.getBounds()},this),this._plannerSceneEventHandler.addEventListener(5,({planElementViewModel:e})=>{this._cameraControl.checkNearFarDistance(e.getPosition()),this._requestRender()},this),this._plannerSceneEventHandler.addEventListener(6,({planElementViewModel:e})=>{const t=this._plannerKernelAccess.planInteractionHandler;t.endInteraction(),this._cameraControl.unlock(),this._environment instanceof BakedShadowEnvironment&&this._environment.addToScene();const n=this._getDragPosition(e.getPosition());n&&t.moveElementTo(e.getPlanElement(),convertToKernel(n)),this._renderEverything(),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds()},this),this._plannerKernelAccess.addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._planViewModel.tryToMergeComponents(),this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this)}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new THREE.Vector3),a=e.distanceTo(n),i=t.getSize(new THREE.Vector3),s=Math.max(i.x,i.z)+3;if(a>s){const t=(new THREE.Vector3).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(s))}return null}_onSelectionChange(e){let t;e instanceof StaticPlanObjectViewModel&&(t="static"),e instanceof ConfiguratorPlanObjectViewModel&&(t="configuration");const n={};if(e instanceof StaticPlanObjectViewModel&&(n.item=e.getRapiItem()),e instanceof ConfiguratorPlanObjectViewModel){const t=e.getConfigurationRuntimeId();n.configurationRuntimeId=t}const a=(async()=>{const n={};if(e instanceof StaticPlanObjectViewModel&&(n.item=e.getRapiItem()),e instanceof ConfiguratorPlanObjectViewModel){const a=e.getConfigurationRuntimeId(),i=e.getPlanObject().getCatalogItemId(),s=this._plannerKernelAccess.kernelInstance.getHashOfConfiguration(a);let r;if(i&&isIdItemId(i)){const e=await this._rapiAccess.getItem(i);n.item=e,r=e.rootComponentId?e.rootComponentId:null}else try{const e=await this._rapiAccess.getConfiguration(s);n.configuration=e,r=e.rootComponentId?e.rootComponentId:null}catch(e){console.warn("Could not get RAPI configuration for kernel hash "+s+", saving configuration...");const t=await this._plannerKernelAccess.getConfigurationData(a),i=await this._rapiAccess.saveConfiguration(t);n.configuration=i,r=i.rootComponentId?i.rootComponentId:null}if(r){const e=await this._rapiAccess.getComponent(r);n.component=e}n.configurationRuntimeId=a,t="configuration"}return copy(n)})();this._roomlePlannerUiCallback.onSelectionChange(copy(this._plannerSceneEventHandler.getSelectionMode()),copy(t),copy(n),a)}_setupScene(e,t){super._setupScene(e,t),this._initData.moc?(this._lightSetting=new DefaultLightSetting(this._scene),this._setEnvironment(new BackgroundEnvironment(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND)))):(this._lightSetting=new PlannerLightSetting(this._scene),this._addSky(),this._setEnvironment(new BakedShadowEnvironment(this._scene,this._environment)))}onBeforeRender(){this._cameraControl instanceof CameraControl3D&&this._plannerMeshGenerator.wallMeshes.forEach(e=>setWallTransparencyBasedOnCamera(this._cameraControl.getCamera(),e.material))}_getInputManager(){return this._plannerInputManager}createCameraControl(e){this.setMode(e)}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart()}resetCameraToState(){this._cameraControl.resetToState()}resetCameraPositionToStart(){this._requestRender()}_getYRotationOfObject(e){let t=e.getWorldDirection(new THREE.Vector3).clone();t.y=0,t.lengthSq()<.01&&(t=new THREE.Vector3(0,1,0),t.applyQuaternion(e.quaternion),t.y=0),t.normalize();let n=Math.asin(t.x);return t.z<0&&(n=Math.PI-n),n<0&&(n+=2*Math.PI),n}loadStaticPlanObjects(){let e=new Map;this._planViewModel.getStaticPlanObjectViewModels().forEach(t=>{let n=t.getPlanObject();e.has(n.getCatalogItemId())?e.get(n.getCatalogItemId()).push(t):e.set(n.getCatalogItemId(),[t])}),this._rapiAccess.getItems(Array.from(e.keys())).then(t=>{let n=[];t.forEach(t=>{this._plannerKernelAccess.catalogItemLoaded(t),e.get(t.id).forEach(e=>{n.push(new Promise((n,a)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},a)}))})}),Promise.all(n).then(()=>this._staticItemsLoaded())})}_staticItemsLoaded(){this._requestRender(),this._staticItemGuard.resolve(),this._roomlePlannerUiCallback.onItemsLoaded()}preload(e){this._planId=e;let t=this._localStorageHelper.getItem(this._planId,"rml_plans");t&&this._loadGLTF(t).then(e=>{this._preloadScene=e,this._preloadScene&&this._scene.add(this._preloadScene),this._requestRender()})}planXMLLoaded(e){this.endPlanConstruction(e);const t=e.getBounds(),n=kernelBoxToThreeBox(t);this._updateBounds(n),this.loadStaticPlanObjects()}planCompletelyLoaded(e){this._requestRender()}handlerSwitchedPlans(e){if(this._planViewModel=e,this._planViewModel.setPlannerSceneEventHandler(this._plannerSceneEventHandler),this._planViewModel.setGeometriesMergedListener(()=>{this._renderEverything()}),this._plannerSceneEventHandler.setPlanViewModel(this._planViewModel),this.clearScene(),!this._initData.moc){this._addSky();let e=new THREE.PlaneGeometry(1e3,1e3);e.rotateX(-Math.PI/2);let t=new THREE.MeshStandardMaterial({color:"#f0f0f0",roughness:1,metalness:0}),n=new THREE.Mesh(e,t);n.name="Ground",n.position.y=-.01,n.receiveShadow=!0,this._scene.add(n)}this.resetCamera(),this._setCeiling(),this._staticItemGuard.reset(),this._configurableItemGuard.reset(),Promise.all([this._staticItemGuard.wait(),this._configurableItemGuard.wait()]).then(this._itemsLoaded.bind(this))}_itemsLoaded(){const e=this._planViewModel.getCorePlan();if(this._pixotron){const t=kernelBoxToThreeBox(e.getBounds());this._pixotron.getShadowPass().setShadowRecieverBBox(t)}this._roomlePlannerUiCallback.onCompletelyLoaded(),this.updateEnvironment(),this._renderEverything(),Benchmark.end("loadingTime")}beginPlanConstruction(e){}addPlanMesh(e,t,n,a,i,s,r){}endPlanConstruction(e){this._renderLoopFunction=()=>{this._scene.add(this._planViewModel.getConstructionGroup()),this._scene.add(this._planViewModel.getCeilingGroup()),this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(this._planViewModel.getBoundingBox()),this._scene.remove(this._preloadScene)}}addPlanObjectToScene(e){const t=e.getContainer();fadeIn(t),this._scene.add(t),this._zoomToBounds(),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.selectPlanElement(e),this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender())}removePlanObjectFromScene(e){this._scene.remove(e.getContainer()),this.updateEnvironment(this.getBounds()),this._renderEverything()}planElementChanged(e,t){this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),this._onPlanChanged()}exportGLB(e,t){this._scriptLoader.fetch(GLTF_EXPORTER_FILE_NAME,{id:"gltf-exporter"}).then(()=>{let n=new THREE.GLTFExporter;e||(e=[],this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)})),n.parse(e,e=>{let n=t||"test";this._localStorageHelper.addItem(n,JSON.stringify(e),"rml_plans")},{binary:!1,embedImages:!0,forceIndices:!0})})}importGLB(e){this._loadGLB(e).then(e=>this._scene.add(e))}clearScene(){this._plannerMeshGenerator.clear(),this._planViewModel.sceneCleared(),super.clearScene()}_addSky(){this._sky=new THREE.Sky,this._sky.name="Sky",this._sky.scale.setScalar(45e4),this._scene.add(this._sky),this._sky.material.uniforms.turbidity.value=10,this._sky.material.uniforms.rayleigh.value=2,this._sky.material.uniforms.luminance.value=1,this._sky.material.uniforms.mieCoefficient.value=.005,this._sky.material.uniforms.mieDirectionalG.value=.8;let e=new THREE.Mesh(new THREE.SphereBufferGeometry(2e4,16,8),new THREE.MeshBasicMaterial({color:16777215}));e.name="Sunsphere",e.position.y=-7e5,e.visible=!1,this._scene.add(e);let t=-.2*Math.PI,n=2*Math.PI*-.25;e.position.x=4e5*Math.cos(n),e.position.y=4e5*Math.sin(n)*Math.sin(t),e.position.z=4e5*Math.sin(n)*Math.cos(t),e.visible=!0,this._sky.material.uniforms.sunPosition.value.copy(e.position),this._lightSetting instanceof PlannerLightSetting&&this._lightSetting.updateSunPosition(.3,.25)}switchTo2D(){this._cameraControl instanceof CameraControl2D||(this._requestRender(),this._changeCameraControl(new CameraControl2D(this._creator_,this._getInputManager())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("2D"))}switchTo3D(){this._cameraControl instanceof CameraControl3D||(this._changeCameraControl(new CameraControl3D(this._creator_,this._getInputManager(),new THREE.Vector3(0,10,0),this.getPerspectiveOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("3D"))}_setCeiling(){this._planViewModel&&(this._cameraControl instanceof CameraControlFirstPerson?this._planViewModel.getCeilingGroup().visible=!0:this._planViewModel.getCeilingGroup().visible=!1)}cameraControlChanged(){super.cameraControlChanged(),this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setCamera(this._cameraControl.getCamera())}sceneChanged(){this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setScene(this._scene)}closeHSC(){this._requestRender(),this._cameraControl instanceof CameraControl3D&&this._cameraControl.resetToState()}switchToFirstPerson(){if(this._cameraControl instanceof CameraControlFirstPerson)return;this._plannerMeshGenerator.wallMeshes.forEach(e=>setWallTransparency(e.material,!1,!1)),this._requestRender();let e=new THREE.Vector3(0,0,0);this._planViewModel&&(e=this._planViewModel.getBoundingBox().getCenter(new THREE.Vector3)),this._cameraControl&&this._cameraControl.cleanUp(),this._changeCameraControl(new CameraControlFirstPerson(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera())),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("FP")}_onKeyDown(e){super._onKeyDown(e),this._initData.debug&&this._checkNumKey(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("multiselect"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof CameraControl3D&&(this._cameraControl.enablePanning(),e.preventDefault())}_checkNumKey(e){e.key&&"1"===e.key&&(this.switchTo2D(),e.preventDefault()),e.key&&"2"===e.key&&(this.switchTo3D(),e.preventDefault()),e.key&&"3"===e.key&&(this.switchToFirstPerson(),e.preventDefault())}_onKeyUp(e){super._onKeyDown(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("standard"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof CameraControl3D&&(this._cameraControl.disablePanning(),e.preventDefault())}setMode(e){switch(e){case"2D":this.switchTo2D();break;case"3D":this.switchTo3D();break;case"FP":this.switchToFirstPerson()}}_highlight(e){let t=new Set;e&&e.getObject()&&e.getObject().children&&e.getObject().children.forEach(e=>t.add(e)),this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const n=this._planViewModel.getPlanObjectForId(e);n&&n.getObject()&&n.getObject().children&&n.getObject().children.forEach(e=>t.add(e))}),this._pixotron&&this._pixotron.highlightObjects(Array.from(t))}destroy(){super.destroy(),this._plannerMeshGenerator.removeMaterialLoadedListener(),this._planViewModel.removeGeometriesMergedListener()}getPixotronParams(){return{saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:2},shadowparams:{shadowMapResolution:1024,shadowRadius:3,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.6,nearPlane:.01,farPlane:50,fov:110,side:THREE.FrontSide,numSamples:100},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:.9,edgeThickness:2}}}getBakedShadowParams(){return{enable:!0,shadowMapResolution:1024,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4,bShadowMaterial:!0,falloff:1.8,darkness:.3,size:1.2,lightDirection:new THREE.Vector3(0,1,0),lightSolidAngle:40,yPosition:.006}}planObjectConfigurationLoaded(e,t,n){if(e&&e.extRef&&t&&t.extRef){let e=t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId();e>0&&this._planViewModel.constructComponents(e)}}addMesh(e,t,n,a,i,s){}_updateBounds(e){e&&(this._updateCamera(e),super._updateBounds(e))}_updateCamera(e){if(e||(e=this.getBounds()),e){if(this._cameraControl instanceof CameraControl3D){const t=e.getSize(new THREE.Vector3),n=Math.max(t.x,t.z),a=this._initData.moc?.5*n*-1:5,i=this._initData.moc?INITIAL_PITCH:70;this._cameraControl.updateAndReset(t,e.getCenter(new THREE.Vector3),-15,i,a,!1)}this._cameraControl instanceof CameraControl2D&&this._cameraControl.updateToBounds(e.getSize(new THREE.Vector3),e.getCenter(new THREE.Vector3))}}_zoomToBounds(){const e=this.getBounds();this._cameraControl instanceof CameraControl3D&&this._cameraControl.zoomToFitBounds(e)}getBounds(){return this._planViewModel?this._planViewModel.getBoundingBox():null}cancelSelection(){this._plannerSceneEventHandler.cancelSelection(),this._highlight(null),this._requestRender()}deleteSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelSelection(),e.forEach(e=>{const t=this._planViewModel.getPlanObjectForId(e);t&&t.getObject()&&this._plannerKernelAccess.planInteractionHandler.removeElement(t.getKernelObject())})}rotateSelection(e){const t=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,n=new THREE.Box3;this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const a=this._planViewModel.getPlanObjectForId(e);a&&a.getObject()&&(t.push_back(a.getPlanObject()),n.expandByObject(a.getContainer()))});const a=n.getCenter(new THREE.Vector3),i=this._plannerKernelAccess.planInteractionHandler.groupObjects(t);this._plannerKernelAccess.planInteractionHandler.rotateGroupBy(i,e,convertToKernel(a))}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender()}planElementRemoved(e){this._onPlanChanged(),this._renderEverything()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={}){return new Promise(t=>{this._planViewModel.materialQueue.finished(!0).then(async()=>{let n=this._calculateBoundingBoxOfAllMeshes(.1);this._lightSetting.removeFromScene();let a=await prepareTopImage(this._scene,null,n,e);this._lightSetting.addToScene(),this._requestRender(),t(a)})})}preparePerspectiveImage(e={}){return new Promise((t,n)=>{this._planViewModel.materialQueue.finished(!0).then(async()=>{let n;n=this._cameraControl instanceof CameraControl3D?this._cameraControl.getCamera().clone():this.getPerspectiveOffsetCamera();let a=this._calculateBoundingBoxOfAllMeshes();this._lightSetting.removeFromScene();const i=await preparePerspectiveImage(this._scene,null,n,a,e);this._lightSetting.addToScene(),this._requestRender(),t(i)},n)})}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return getCameraTargetForBBox(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}dragIn(e){this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}}return __decorate([inject],e.prototype,"_plannerKernelAccess",void 0),__decorate([inject],e.prototype,"_rapiAccess",void 0),__decorate([inject],e.prototype,"_plannerMeshGenerator",void 0),__decorate([inject],e.prototype,"_plannerInputManager",void 0),__decorate([inject],e.prototype,"_roomlePlannerUiCallback",void 0),__decorate([inject],e.prototype,"_localStorageHelper",void 0),e})();const OFFSET={left:0,top:1,right:1,bottom:0};let RoomlePlanner=(()=>{class e{constructor(e){this._hscInstance=null,this._glbInstance=null,this._creator_=e,this._kernelAccessCallback.addListener(this),this._backstack.init([CANVAS_ID.HSP],this)}deleteSelection(){this._sceneManager.deleteSelection()}rotateSelection(e){this._sceneManager.rotateSelection(e)}cancelSelection(){this._sceneManager.cancelSelection()}init(e,t,n){return Benchmark.start("loadingTime"),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):(this._preloadPlanId=t,this.setOverrides(n),new Promise(this._initPromiseCallback.bind(this)))}loadPlanXml(e,t){return this.setOverrides(t),new Promise(n=>{this._plan=this._planInteractionHandler.loadPlanXML(e),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._backstack.bringIntoForeground(CANVAS_ID.HSP),this._initData.moc&&(t.id?this._rapiAccess.trackView(t.id):this._rapiAccess.trackView("planXML")),n()})}loadPlan(e,t){return this.setOverrides(t),new Promise((t,n)=>{this._rapiAccess.getPlan(e).then(n=>{this._plan=this._planInteractionHandler.loadPlanXML(n.planObjects),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._backstack.bringIntoForeground(CANVAS_ID.HSP),this._initData.moc&&this._rapiAccess.trackView(e),t()},n)})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}switch2D(){this._sceneManager.switchTo2D()}switch3D(){this._sceneManager.switchTo3D()}switchToFirstPerson(){this._sceneManager.switchToFirstPerson()}exportGLB(){this._sceneManager.exportGLB()}importGLB(e){this._sceneManager.importGLB(e)}_initPromiseCallback(e,t){this._threeLoader.fetch().then(()=>{let t=this._scriptLoader.fetch(GLTF_LOADER_FILE_NAME,{id:"gltf-loader"}),n=this._scriptLoader.fetch(DRACO_LOADER_FILE_NAME,{id:"draco-loader"}),a=this._scriptLoader.fetch(TWEEN_FILE_NAME,{id:"tween-js"}),i=this._scriptLoader.fetch("static/Sky-6621935ea8a523af.js",{id:"sky-js"});Promise.all([t,n,a,i]).then(()=>{this._kernelReadyCallback=e;const{mode:t,stats:n}=this._initData;this._sceneManager||(this._sceneManager=new PlannerSceneManager(this._creator_,OFFSET,this,t)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId),n?this.showStats():this.enableHD(),this._planInteractionHandler&&this._kernelReadyCallback()})})}enableHD(){return new Promise((e,t)=>{const n=()=>{this._sceneManager.enableHD(),e()};this._threeLoader.fetch().then(()=>Promise.all(PIXOTRON_EFFETCS.map(e=>this._scriptLoader.fetch(e,{id:e})))).then(()=>{this._scriptLoader.fetch(PIXOTRON_FILE_NAME,{id:"pi-js"}).then(n,t)},t)})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){Benchmark.showBenchmarks()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);import("./configurator-366b9a69.js").then((function(e){return e.c})).then(({Configurator:t})=>{const n=new t(this._creator_);n.boot({kernelInstance:this._planInteractionHandler.getConfiguratorKernel(),kernelContainer:this._plannerKernelAccess.kernelContainer}),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._hscInstance=n,e(this._hscInstance)})})});return this._backstack.bringIntoForeground(CANVAS_ID.HSC),this.cancelSelection(),e}async switchToViewer(){const e=await this._singlePromiseFactory.create(4,"startGLB",e=>{if(this._glbInstance)return e(this._glbInstance);import("./glb-viewer-10243e50.js").then(t=>{const n=new t.GlbViewer(this._creator_);n.boot(),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._glbInstance=n,e(this._glbInstance)})})});return this._backstack.bringIntoForeground(CANVAS_ID.GLB),this.cancelSelection(),e}switchToPlanner(e){e&&this.loadPlan(e),this._backstack.bringIntoForeground(CANVAS_ID.HSP)}updateSize(){this._sceneManager.updateCamera()}getMain(){}update(){this.updateSize(),this._glbInstance&&this._glbInstance.getApi().updateSize(),this._hscInstance&&this._hscInstance.getApi().updateSize()}get callbacks(){return this._roomlePlannerUiCallback}set callbacks(e){this._roomlePlannerUiCallback=e}showStats(){this._sceneManager.showStats()}onBackStackChanged(e){this._roomlePlannerUiCallback.onBackStackChanged(e)}onCloseHSC(){this._sceneManager.closeHSC(),this._hscInstance&&this._hscInstance.getApi().pauseKernelCallbacks()}back(){if(this._backstack.current()===CANVAS_ID.GLB&&this._glbInstance&&this._glbInstance.getApi().clearScene(),this._backstack.current()===CANVAS_ID.HSC&&this._hscInstance){const e=this._hscInstance.getApi();e.cancelSelection(),e.cancelDockings(),e.hideDimensions(),e.disableMultiselect(),this._sceneManager.updateScene()}this._backstack.back()}backTo(e){this._backstack.backTo(e)}getConfigurator(){return this._hscInstance}getCurrentSkin(){return this._rapiAccess.getCurrentSkin()}getRuntimeComponentIdOfRootComponent(e){return e?this._plannerKernelAccess.planInteractionHandler?this._plannerKernelAccess.planInteractionHandler.getConfiguratorKernel().getRootPlanComponentIdFromObjectId(e):(console.warn("Can not retrieve runtime id without planInteractionHandler"),0):(console.warn("Can not retrieve runtime id without planObjectId"),0)}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}loadError(e){}getPlanInteractionHandler(){return Promise.resolve(this._planInteractionHandler)}getPlanModelViewHelper(){return Promise.resolve(this._plannerKernelAccess.planModelViewHelper)}async insertObject(e,t,n){if(!this._planInteractionHandler)throw new Error("no plan interaction handler");const a=await(isIdItemId(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),i=await this._plannerKernelAccess.addPlanObjectFromItem(a,t,n);return this._sceneManager.updateScene(),i}async insertItemList(e){const t=e.map(e=>isIdItemId(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),n=await Promise.all(t);await this._plannerKernelAccess.insertItems(n)}async insertItems(e){await this._plannerKernelAccess.insertItems(e)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getCameraOffset(){return this._sceneManager.getCameraOffset()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}async getObjects(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);let t=[];for(let n=0;n<e.objects.size();n++)t.push(convertCObject(e.objects.get(n)));return t}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return convertCObject(e)}prepareTopImage(e={}){return this._sceneManager.prepareTopImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}enableRotation(){this._sceneManager.enableRotation()}disableRotation(){this._sceneManager.disableRotation()}async dragInObject(e,t){this._sceneManager.dragIn(t);const n=await this._rapiAccess.getItem(e);this.insertItems([n])}enableSnapping(){this._planInteractionHandler.reactivateAllSnappingActivity()}disableSnapping(){this._planInteractionHandler.deactivateAllSnappingActivity()}}return __decorate([inject],e.prototype,"_domHelper",void 0),__decorate([inject],e.prototype,"_scriptLoader",void 0),__decorate([inject],e.prototype,"_kernelAccessCallback",void 0),__decorate([inject],e.prototype,"_plannerKernelAccess",void 0),__decorate([inject],e.prototype,"_rapiAccess",void 0),__decorate([inject],e.prototype,"_singlePromiseFactory",void 0),__decorate([inject],e.prototype,"_roomlePlannerUiCallback",void 0),__decorate([inject],e.prototype,"_lifeCycleManager",void 0),__decorate([inject],e.prototype,"_backstack",void 0),__decorate([inject],e.prototype,"_threeLoader",void 0),__decorate([inject],e.prototype,"_dataSyncer",void 0),__decorate([inject],e.prototype,"_initData",void 0),__decorate([inject],e.prototype,"_globalInitData",void 0),e})(),Backstack=(()=>{class e{constructor(e){this._initialStack=[],this._creator_=e,this._lifeCycleManager.addEventListener(this)}_setInitialStack(e){this._initialStack=[...e]}_setCallbacks(e){this._callbacks=e}_resetCanvasStack(){this._canvasStack=[...this._initialStack]}init(e,t){this._setInitialStack(e),this._resetCanvasStack(),this._setCallbacks(t)}bringIntoForeground(e){const t=this._domHelper.element.querySelectorAll("canvas");let n=!1;t.forEach(t=>{if(t.classList.contains(e)){if(!t.classList.contains("foreground")){const t=this.current();t&&e!==t&&(this._canvasStack.push(e),n=!0),t||(n=!0)}t.classList.remove("background"),t.classList.add("foreground")}else t.classList.remove("foreground"),t.classList.add("background")}),n&&this._callbacks.onBackStackChanged(this._canvasStack)}current(){return this._canvasStack[this._canvasStack.length-1]}back(){if(1===this._canvasStack.length)return;let e=this._canvasStack.pop();this.bringIntoForeground(this.current()),e===CANVAS_ID.HSC&&this._callbacks.onCloseHSC(),this._callbacks.onBackStackChanged(this._canvasStack)}backTo(e){if(1!==this._canvasStack.length&&this.current()!==e)for(;this._canvasStack.length>0;){let t=this.current();if(t===e){this.bringIntoForeground(t);break}t===CANVAS_ID.HSC&&this._callbacks.onCloseHSC(),this._canvasStack.pop(),this._callbacks.onBackStackChanged(this._canvasStack)}}pause(){this._resetCanvasStack()}resume(){}destroy(){}}return __decorate([inject],e.prototype,"_domHelper",void 0),__decorate([inject],e.prototype,"_lifeCycleManager",void 0),e})();class PlannerSelectionHandlerEvent{constructor(e){const{planElementViewModel:t}=e;this.planElementViewModel=t}}const INJECTABLES=[new DependencyInjectionAssignment("script-loader",ScriptLoader),new DependencyInjectionAssignment("planner-input-manager",class extends InputManager{_canDrag(e){return!0}},1),new DependencyInjectionAssignment("planner-kernel-access",PlannerKernelAccess),new DependencyInjectionAssignment("logger",Logger),new DependencyInjectionAssignment("planner-mesh-generator",class extends MeshGenerator{constructor(e){super(e),this._wallMeshes=[],this._defaultMaterial=new THREE.MeshStandardMaterial({color:"#ffffff",roughness:1,metalness:0,opacity:1,envMap:null}),this._environmentLoader.setEnvMap(this._defaultMaterial)}generateGeometry(e=null,t,n,a,i,s=!1){let r;return r=s?this._generateGeometry(e,t,n,a,i).clone():this._generateGeometry(e,t,n,a,i),r}generateMesh(e=null,t,n,a,i,s,r,o=!1){const l=this.generateGeometry(e,n,a,i,s,o),c=new THREE.Mesh(l,this._previewMaterial);return c.layers.set(3),!t&&r&&7!==r.value?(console.warn("material is undefined"),c):(this.setMaterial(c,t,r).then(()=>{const e=r&&3===r.value;c.castShadow=!e}),this._checkWallMaterial(c,r),c)}async setMaterial(e,t,n){if(e.userData.material=getMaterialId(t,n),e.userData.materialId=t,isString(t))t?await this._assignMaterial(e,t):(console.warn("Used default material because material is empty"),this.changeMaterialOfMesh(e,this._defaultMaterial));else{if(!t)return void this.changeMaterialOfMesh(e,this._defaultMaterial);2===(t=t).getSourceType().value?await this._assignMaterial(e,t.materialId):1===t.getSourceType().value?await this._assignItem(e,t.catalogItemId):3===t.getSourceType().value?await this._assignRGB(e,t.rgbValue):0===t.getSourceType().value?this.changeMaterialOfMesh(e,this._defaultMaterial):(this.changeMaterialOfMesh(e,this._defaultMaterial),1!==n.value&&7!==n.value&&3!==n.value&&console.warn("Used default material because material is not supported",t))}}set maxAnisotropy(e){this._maxAnisotropy=e}_checkWallMaterial(e,t){t&&1===t.value&&(e.renderOrder=5,this._wallMeshes.push(e))}clear(){super.clear(),this.clearWallMeshes()}clearWallMeshes(){this._wallMeshes.forEach(e=>{disposeMesh(e)}),this._wallMeshes=[]}get wallMeshes(){return this._wallMeshes}}),new DependencyInjectionAssignment("rapi-access",RapiAccess),new DependencyInjectionAssignment("roomle-planner-ui-callback",class extends UiCallback{constructor(e){super(e),this.onItemsLoaded=()=>{},this.onBackStackChanged=e=>{},this.onCameraChanged=e=>{},this.onTotalFloorAreaChanged=e=>{},this.onPlanInteractionHandlerCreated=e=>{},this.onPlannerKernelIsReady=e=>{},this.onConfiguratorKernelIsReady=(e,t)=>{},this.onSelectionChange=(e,t,n,a)=>{},this.onSelectionCancel=()=>{},this.onPlanChanged=()=>{},this.onCompletelyLoaded=()=>{},this.onRotationCancel=()=>{},this.onHistoryChange=(e,t)=>{}}}),new DependencyInjectionAssignment("configurator-ui-callbacks",ConfiguratorUiCallbacks,1),new DependencyInjectionAssignment("backstack",Backstack),new DependencyInjectionAssignment("planner-selection-handler",class extends EventDispatcher{constructor(){super(...arguments),this._selectionMode="standard",this._selectedPlanElementViewModels=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}cancelSelection(){0!==this._selectedPlanElementViewModels.size&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new PlannerSelectionHandlerEvent({planElementViewModel:e}))})}_checkStandard(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new PlannerSelectionHandlerEvent({planElementViewModel:e}));this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new PlannerSelectionHandlerEvent({planElementViewModel:e}))}),this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new PlannerSelectionHandlerEvent({planElementViewModel:e}))}_checkMulti(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new PlannerSelectionHandlerEvent({planElementViewModel:e}));this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new PlannerSelectionHandlerEvent({planElementViewModel:e}))}setSelectionMode(e){this._selectionMode=e}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedPlanElementViewModels.size>0}getSelectedIds(){let e=[];return this._selectedPlanElementViewModels.forEach(t=>e.push(t.getId())),e}isSelected(e){return!!this._selectedPlanElementViewModels.get(e)}})];class Planner extends Main{setupGlobals(){}setupDependencies(){RoomleDependencyInjection.setup(INJECTABLES),this.lookup("logger",this._context),this.lookup("planner-kernel-access",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._planner=new RoomlePlanner(this._context),this._planner.getMain=()=>this,window.RoomlePlanner||(window.RoomlePlanner=this._planner)}getApi(){return this._planner}getContextName(){return"planner"}}export{Planner};
2
- //# sourceMappingURL=planner-c3c34e74.js.map
1
+ import"./query-params-helper-a271f9dc.js";import{h as getGUI,_ as __decorate,i as inject,a4 as convertToKernel,d as CANVAS_ID,F as AsyncGuard,a5 as setWallTransparencyBasedOnCamera,j as kernelBoxToThreeBox,B as Benchmark,J as fadeIn,a6 as setWallTransparency,r as isIdItemId,G as GLTF_LOADER_FILE_NAME,a7 as DRACO_LOADER_FILE_NAME,c as convertCObject,V as getMaterialId,a2 as disposeMesh,U as UiCallback,n as DependencyInjectionAssignment,L as Logger,o as RapiAccess,s as RoomleDependencyInjection}from"./rapi-access-d209c65c.js";import{s as setCursor,l as copy,m as isString}from"./main-thread-to-worker-5447c1c5.js";import{S as SceneEventHandler,c as StaticPlanObjectViewModel,d as ConfiguratorPlanObjectViewModel,G as GLTF_EXPORTER_FILE_NAME,b as prepareTopImage,a as preparePerspectiveImage,g as getCameraTargetForBBox,P as PlannerKernelAccess,C as ConfiguratorUiCallbacks}from"./image-renderer-ad267c8b.js";import{L as LightSetting,B as BakedShadowEnvironment,a as BackgroundEnvironment,C as CameraControl3D,h as INITIAL_PITCH,T as TWEEN_FILE_NAME,e as PIXOTRON_EFFETCS,g as PIXOTRON_FILE_NAME,I as InputManager,E as EventDispatcher,S as ScriptLoader,M as Main}from"./pixotron-9baf521b.js";import{M as MeshGenerator}from"./mesh-generator-a980f1b0.js";import{D as DefaultLightSetting}from"./default-light-setting-7de63c9a.js";import{S as SceneManager,C as CameraControl2D,a as CameraControlFirstPerson}from"./scene-manager-424afdbc.js";class PlannerLightSetting extends LightSetting{constructor(e,t){super(e,t),this._center=new THREE.Vector3(0,0,0),this._params={ambientLight:{color:"#ffffff"},hemiLight:{color:"#ffffff"},mainDirLight:{direction:{x:.03,y:1,z:.03},color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),.3),this._ambientLight.layers.set(1),this._mainDirLight=new THREE.DirectionalLight(new THREE.Color(this._params.mainDirLight.color),.5),this._mainDirLight.castShadow=!0,this._mainDirLight.shadow.camera.near=.5,this._mainDirLight.shadow.camera.far=100,this._mainDirLight.shadow.mapSize=new THREE.Vector2(1024,1024),this._mainDirLight.visible=!0,this.addToScene()}updateSunPosition(e,t){}addToScene(){this._scene.add(this._mainDirLight),this._scene.add(this._ambientLight),this._scene.add(this._mainDirLight.target)}removeFromScene(){this._scene.remove(this._mainDirLight),this._scene.remove(this._ambientLight),this._scene.remove(this._mainDirLight.target)}reload(){this.removeFromScene(),this.addToScene()}needsBounds(){return!0}updateBounds(e){this._center.copy(e.getCenter(new THREE.Vector3));const t=new THREE.Sphere;e.getBoundingSphere(t);const n=t.radius,a=new THREE.Vector3(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);a.normalize(),a.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(a),this._mainDirLight.target.position.copy(this._center),this._mainDirLight.target.updateMatrixWorld(!0),this._mainDirLight.shadow.camera.top=n,this._mainDirLight.shadow.camera.bottom=-n,this._mainDirLight.shadow.camera.left=-n,this._mainDirLight.shadow.camera.right=n,this._mainDirLight.shadow.camera.near=.01,this._mainDirLight.shadow.camera.far=2*n,this._mainDirLight.shadow.camera.updateProjectionMatrix()}showGUI(){let e=getGUI();if(e){if(this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new THREE.Color(e))}if(this._hemiLight){let t=e.addFolder("Hemi Light");t.add(this._hemiLight,"visible"),t.add(this._hemiLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.hemiLight,"color").onChange(e=>this._hemiLight.color=new THREE.Color(e))}if(this._mainDirLight){let t=e.addFolder("Main Directional Light");t.add(this._mainDirLight,"visible"),t.add(this._mainDirLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(e=>this._mainDirLight.color=new THREE.Color(e)),t.add(this._mainDirLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center))}}}}class SceneEventInfo{constructor(e){const{planElementViewModel:t,resetCamera:n,state:a,oldState:i}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===a?0:a,this.oldState=void 0===i?0:i}}let PlannerSceneEventHandler=(()=>{class e extends SceneEventHandler{constructor(e,t,n,a){super(e,t,n,a),this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0);const i=new THREE.Layers;i.enable(3),i.enable(6),this._raycastHelper.setLayers(i),this._raycastHelper.addEventListener(3,()=>{this._plannerSelectionHandler.cancelSelection()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(0,new SceneEventInfo({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e})=>{this.setState(0),this.dispatchEvent(1,new SceneEventInfo({planElementViewModel:e}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}async addPlanObjectHandlers(e,t){t||(t=await e.getObjectAsync());const n={hasListener:!0,priority:1,roomleId:e.getId()};this._addPlanObjectHandlers(e,t,n)}addWallHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{hasListener:!0,priority:1,roomleId:e.getId()})}_addPlanObjectHandlers(e,t,n){t.userData.hasListener||(t.userData=n,t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)),t.addEventListener("rotate",t=>this._rotate(e,t.attachment.rotation)))}_addPlanElementHandlers(e,t,n){t.userData.hasListener||(t.userData=n,t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)))}_clickElement(e){this._debug&&e.getId(),this._plannerSelectionHandler.check(e),this._setCursor()}_hoverOn(e){this._hoveredObject=e,this._setCursor()}_hoverOff(e){this._hoveredObject=null,this._setCursor()}_setCursor(){2===this._state&&this._hasSelection()?setCursor("ew-resize"):1===this._state?setCursor("grabbing"):this._hoveredObject&&this._plannerSelectionHandler.isSelected(this._hoveredObject.getId())?setCursor("move"):this._hoveredObject?setCursor("pointer"):setCursor("default")}setCamera(e){this._raycastHelper.setCamera(e)}setScene(e){this._raycastHelper.setScene(e)}getSelectedIds(){return this._plannerSelectionHandler.getSelectedIds()}setSelectionMode(e){this._plannerSelectionHandler.setSelectionMode(e)}setPlanViewModel(e){this._planViewModel=e}cancelSelection(){this._plannerSelectionHandler.cancelSelection()}_dragStart(e){this._plannerSelectionHandler.isSelected(e.getId())&&0===this._state&&(this._draggedObject=e,this.setState(1),this.dispatchEvent(4,new SceneEventInfo({planElementViewModel:e})),this._setCursor())}_drag(e,t){if(!this._draggedObject||1!==this._state)return;const n=this._plannerKernelAccess.planInteractionHandler;if(this._plannerSelectionHandler.getSelectedIds().length>1){const e=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let a=t.sub(this._draggedObject.getPosition());this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanObject())),n.moveObjectsBy(e,convertToKernel(a))}else n.moveElementTo(e.getPlanElement(),convertToKernel(t));this.dispatchEvent(5,new SceneEventInfo({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this.setState(0),this.dispatchEvent(6,new SceneEventInfo({planElementViewModel:e})),this._dragIn&&(this.cancelSelection(),this.setDragIn(!1)),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this._plannerKernelAccess.planInteractionHandler,a=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),a.rotation-t)}}setState(e){const t=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new SceneEventInfo({state:this._state,oldState:t})),this._position=null,2===this._state&&this._plannerKernelAccess.planInteractionHandler.deactivateAllSnappingActivity()}resetState(){this.setState(0)}_move(e){if(2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:a}=e.positionRelative;this._position?t=1.4*e.positionRelative.x*Math.PI-1.4*this._position.x*Math.PI:this._position=new THREE.Vector3(e.positionRelative.x,e.positionRelative.y,0);const i=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,s=new THREE.Box3;this.getSelectedIds().forEach(e=>{var t;const n=null===(t=this._planViewModel)||void 0===t?void 0:t.getPlanObjectForId(e);n&&n.getObject()&&(i.push_back(n.getPlanObject()),s.expandByObject(n.getContainer()))});const r=s.getCenter(new THREE.Vector3);this._plannerKernelAccess.planInteractionHandler.rotateObjectsBy(i,t,convertToKernel(r)),this._position.copy(new THREE.Vector3(n,a,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}selectPlanElement(e){this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(0,new SceneEventInfo({}))}addComponentDragInHandler(e){if(!this._dragIn)return;const t=e.getBoundingBox();this._addPlanElementHandlers(e,t,{hasListener:!0,priority:1,roomleId:e.getId()}),this._raycastHelper.enableDragIn(t),this._dragStart(e)}}return __decorate([inject],e.prototype,"_plannerSelectionHandler",void 0),__decorate([inject],e.prototype,"_plannerKernelAccess",void 0),e})(),PlannerSceneManager=(()=>{class e extends SceneManager{constructor(e,t,n,a){super(e,t,CANVAS_ID.HSP,a),this._staticItemGuard=new AsyncGuard,this._configurableItemGuard=new AsyncGuard,this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new PlannerSceneEventHandler(e,this._scene,this._cameraControl.getCamera(),this._getInputManager()),this._plannerSceneEventHandler.addEventListener(2,({state:e,oldState:t})=>{2===t&&e!==t&&this._roomlePlannerUiCallback.onRotationCancel(),2===e||1===e?this._cameraControl.lock():this._cameraControl.unlock()},this),this._plannerSceneEventHandler.addEventListener(0,({planElementViewModel:e})=>{e instanceof StaticPlanObjectViewModel&&this._initData.debug&&e.getGLBUrl(),this._highlight(e),this._onSelectionChange(e)},this),this._plannerSceneEventHandler.addEventListener(1,()=>{this._highlight(null),this._roomlePlannerUiCallback.onSelectionCancel()},this),this._plannerSceneEventHandler.addEventListener(4,()=>{this._plannerKernelAccess.planInteractionHandler.startInteraction(),this._cameraControl.lock(),this._environment instanceof BakedShadowEnvironment&&this._environment.removeFromScene(),this._requestRender(),this._dragStartBounds=this.getBounds()},this),this._plannerSceneEventHandler.addEventListener(5,({planElementViewModel:e})=>{this._cameraControl.checkNearFarDistance(e.getPosition()),this._requestRender()},this),this._plannerSceneEventHandler.addEventListener(6,({planElementViewModel:e})=>{const t=this._plannerKernelAccess.planInteractionHandler;t.endInteraction(),this._cameraControl.unlock(),this._environment instanceof BakedShadowEnvironment&&this._environment.addToScene();const n=this._getDragPosition(e.getPosition());n&&t.moveElementTo(e.getPlanElement(),convertToKernel(n)),this._renderEverything(),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds()},this),this._plannerKernelAccess.addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._planViewModel.tryToMergeComponents(),this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this)}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new THREE.Vector3),a=e.distanceTo(n),i=t.getSize(new THREE.Vector3),s=Math.max(i.x,i.z)+3;if(a>s){const t=(new THREE.Vector3).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(s))}return null}_onSelectionChange(e){let t;e instanceof StaticPlanObjectViewModel&&(t="static"),e instanceof ConfiguratorPlanObjectViewModel&&(t="configuration");const n={};if(e instanceof StaticPlanObjectViewModel&&(n.item=e.getRapiItem()),e instanceof ConfiguratorPlanObjectViewModel){const t=e.getConfigurationRuntimeId();n.configurationRuntimeId=t}const a=(async()=>{const n={};if(e instanceof StaticPlanObjectViewModel&&(n.item=e.getRapiItem()),e instanceof ConfiguratorPlanObjectViewModel){const a=e.getConfigurationRuntimeId(),i=e.getPlanObject().getCatalogItemId(),s=this._plannerKernelAccess.kernelInstance.getHashOfConfiguration(a);let r;if(i&&isIdItemId(i)){const e=await this._rapiAccess.getItem(i);n.item=e,r=e.rootComponentId?e.rootComponentId:null}else try{const e=await this._rapiAccess.getConfiguration(s);n.configuration=e,r=e.rootComponentId?e.rootComponentId:null}catch(e){console.warn("Could not get RAPI configuration for kernel hash "+s+", saving configuration...");const t=await this._plannerKernelAccess.getConfigurationData(a),i=await this._rapiAccess.saveConfiguration(t);n.configuration=i,r=i.rootComponentId?i.rootComponentId:null}if(r){const e=await this._rapiAccess.getComponent(r);n.component=e}n.configurationRuntimeId=a,t="configuration"}return copy(n)})();this._roomlePlannerUiCallback.onSelectionChange(copy(this._plannerSceneEventHandler.getSelectionMode()),copy(t),copy(n),a)}_setupScene(e,t){super._setupScene(e,t),this._initData.moc?(this._lightSetting=new DefaultLightSetting(this._scene),this._setEnvironment(new BackgroundEnvironment(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND)))):(this._lightSetting=new PlannerLightSetting(this._scene),this._addSky(),this._setEnvironment(new BakedShadowEnvironment(this._scene,this._environment)))}onBeforeRender(){this._cameraControl instanceof CameraControl3D&&this._plannerMeshGenerator.wallMeshes.forEach(e=>setWallTransparencyBasedOnCamera(this._cameraControl.getCamera(),e.material))}_getInputManager(){return this._plannerInputManager}createCameraControl(e){this.setMode(e)}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart()}resetCameraToState(){this._cameraControl.resetToState()}resetCameraPositionToStart(){this._requestRender()}_getYRotationOfObject(e){let t=e.getWorldDirection(new THREE.Vector3).clone();t.y=0,t.lengthSq()<.01&&(t=new THREE.Vector3(0,1,0),t.applyQuaternion(e.quaternion),t.y=0),t.normalize();let n=Math.asin(t.x);return t.z<0&&(n=Math.PI-n),n<0&&(n+=2*Math.PI),n}loadStaticPlanObjects(){let e=new Map;this._planViewModel.getStaticPlanObjectViewModels().forEach(t=>{let n=t.getPlanObject();e.has(n.getCatalogItemId())?e.get(n.getCatalogItemId()).push(t):e.set(n.getCatalogItemId(),[t])}),this._rapiAccess.getItems(Array.from(e.keys())).then(t=>{let n=[];t.forEach(t=>{this._plannerKernelAccess.catalogItemLoaded(t),e.get(t.id).forEach(e=>{n.push(new Promise((n,a)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},a)}))})}),Promise.all(n).then(()=>this._staticItemsLoaded())})}_staticItemsLoaded(){this._requestRender(),this._staticItemGuard.resolve(),this._roomlePlannerUiCallback.onItemsLoaded()}preload(e){this._planId=e;let t=this._localStorageHelper.getItem(this._planId,"rml_plans");t&&this._loadGLTF(t).then(e=>{this._preloadScene=e,this._preloadScene&&this._scene.add(this._preloadScene),this._requestRender()})}planXMLLoaded(e){this.endPlanConstruction(e);const t=e.getBounds(),n=kernelBoxToThreeBox(t);this._updateBounds(n),this.loadStaticPlanObjects()}planCompletelyLoaded(e){this._requestRender()}handlerSwitchedPlans(e){if(this._planViewModel=e,this._planViewModel.setPlannerSceneEventHandler(this._plannerSceneEventHandler),this._planViewModel.setGeometriesMergedListener(()=>{this._renderEverything()}),this._plannerSceneEventHandler.setPlanViewModel(this._planViewModel),this.clearScene(),!this._initData.moc){this._addSky();let e=new THREE.PlaneGeometry(1e3,1e3);e.rotateX(-Math.PI/2);let t=new THREE.MeshStandardMaterial({color:"#f0f0f0",roughness:1,metalness:0}),n=new THREE.Mesh(e,t);n.name="Ground",n.position.y=-.01,n.receiveShadow=!0,this._scene.add(n)}this.resetCamera(),this._setCeiling(),this._staticItemGuard.reset(),this._configurableItemGuard.reset(),Promise.all([this._staticItemGuard.wait(),this._configurableItemGuard.wait()]).then(this._itemsLoaded.bind(this))}_itemsLoaded(){const e=this._planViewModel.getCorePlan();if(this._pixotron){const t=kernelBoxToThreeBox(e.getBounds());this._pixotron.getShadowPass().setShadowRecieverBBox(t)}this._roomlePlannerUiCallback.onCompletelyLoaded(),this.updateEnvironment(),this._renderEverything(),Benchmark.end("loadingTime")}beginPlanConstruction(e){}addPlanMesh(e,t,n,a,i,s,r){}endPlanConstruction(e){this._renderLoopFunction=()=>{this._scene.add(this._planViewModel.getConstructionGroup()),this._scene.add(this._planViewModel.getCeilingGroup()),this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(this._planViewModel.getBoundingBox()),this._scene.remove(this._preloadScene)}}addPlanObjectToScene(e){const t=e.getContainer();fadeIn(t),this._scene.add(t),this._zoomToBounds(),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.selectPlanElement(e),this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender())}removePlanObjectFromScene(e){this._scene.remove(e.getContainer()),this.updateEnvironment(this.getBounds()),this._renderEverything()}planElementChanged(e,t){this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),this._onPlanChanged()}exportGLB(e,t){this._scriptLoader.fetch(GLTF_EXPORTER_FILE_NAME,{id:"gltf-exporter"}).then(()=>{let n=new THREE.GLTFExporter;e||(e=[],this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)})),n.parse(e,e=>{let n=t||"test";this._localStorageHelper.addItem(n,JSON.stringify(e),"rml_plans")},{binary:!1,embedImages:!0,forceIndices:!0})})}importGLB(e){this._loadGLB(e).then(e=>this._scene.add(e))}clearScene(){this._plannerMeshGenerator.clear(),this._planViewModel.sceneCleared(),super.clearScene()}_addSky(){this._sky=new THREE.Sky,this._sky.name="Sky",this._sky.scale.setScalar(45e4),this._scene.add(this._sky),this._sky.material.uniforms.turbidity.value=10,this._sky.material.uniforms.rayleigh.value=2,this._sky.material.uniforms.luminance.value=1,this._sky.material.uniforms.mieCoefficient.value=.005,this._sky.material.uniforms.mieDirectionalG.value=.8;let e=new THREE.Mesh(new THREE.SphereBufferGeometry(2e4,16,8),new THREE.MeshBasicMaterial({color:16777215}));e.name="Sunsphere",e.position.y=-7e5,e.visible=!1,this._scene.add(e);let t=-.2*Math.PI,n=2*Math.PI*-.25;e.position.x=4e5*Math.cos(n),e.position.y=4e5*Math.sin(n)*Math.sin(t),e.position.z=4e5*Math.sin(n)*Math.cos(t),e.visible=!0,this._sky.material.uniforms.sunPosition.value.copy(e.position),this._lightSetting instanceof PlannerLightSetting&&this._lightSetting.updateSunPosition(.3,.25)}switchTo2D(){this._cameraControl instanceof CameraControl2D||(this._requestRender(),this._changeCameraControl(new CameraControl2D(this._creator_,this._getInputManager())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("2D"))}switchTo3D(){this._cameraControl instanceof CameraControl3D||(this._changeCameraControl(new CameraControl3D(this._creator_,this._getInputManager(),new THREE.Vector3(0,10,0),this.getPerspectiveOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("3D"))}_setCeiling(){this._planViewModel&&(this._cameraControl instanceof CameraControlFirstPerson?this._planViewModel.getCeilingGroup().visible=!0:this._planViewModel.getCeilingGroup().visible=!1)}cameraControlChanged(){super.cameraControlChanged(),this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setCamera(this._cameraControl.getCamera())}sceneChanged(){this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setScene(this._scene)}closeHSC(){this._requestRender(),this._cameraControl instanceof CameraControl3D&&this._cameraControl.resetToState()}switchToFirstPerson(){if(this._cameraControl instanceof CameraControlFirstPerson)return;this._plannerMeshGenerator.wallMeshes.forEach(e=>setWallTransparency(e.material,!1,!1)),this._requestRender();let e=new THREE.Vector3(0,0,0);this._planViewModel&&(e=this._planViewModel.getBoundingBox().getCenter(new THREE.Vector3)),this._cameraControl&&this._cameraControl.cleanUp(),this._changeCameraControl(new CameraControlFirstPerson(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera())),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("FP")}_onKeyDown(e){super._onKeyDown(e),this._initData.debug&&this._checkNumKey(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("multiselect"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof CameraControl3D&&(this._cameraControl.enablePanning(),e.preventDefault())}_checkNumKey(e){e.key&&"1"===e.key&&(this.switchTo2D(),e.preventDefault()),e.key&&"2"===e.key&&(this.switchTo3D(),e.preventDefault()),e.key&&"3"===e.key&&(this.switchToFirstPerson(),e.preventDefault())}_onKeyUp(e){super._onKeyDown(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("standard"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof CameraControl3D&&(this._cameraControl.disablePanning(),e.preventDefault())}setMode(e){switch(e){case"2D":this.switchTo2D();break;case"3D":this.switchTo3D();break;case"FP":this.switchToFirstPerson()}}_highlight(e){let t=new Set;e&&e.getObject()&&e.getObject().children&&e.getObject().children.forEach(e=>t.add(e)),this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const n=this._planViewModel.getPlanObjectForId(e);n&&n.getObject()&&n.getObject().children&&n.getObject().children.forEach(e=>t.add(e))}),this._pixotron&&this._pixotron.highlightObjects(Array.from(t))}destroy(){super.destroy(),this._plannerMeshGenerator.removeMaterialLoadedListener(),this._planViewModel.removeGeometriesMergedListener()}getPixotronParams(){return{saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:2},shadowparams:{shadowMapResolution:1024,shadowRadius:3,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.6,nearPlane:.01,farPlane:50,fov:110,side:THREE.FrontSide,numSamples:100},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:.9,edgeThickness:2}}}getBakedShadowParams(){return{enable:!0,shadowMapResolution:1024,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4,bShadowMaterial:!0,falloff:1.8,darkness:.3,size:1.2,lightDirection:new THREE.Vector3(0,1,0),lightSolidAngle:40,yPosition:.006}}planObjectConfigurationLoaded(e,t,n){if(e&&e.extRef&&t&&t.extRef){let e=t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId();e>0&&this._planViewModel.constructComponents(e)}}addMesh(e,t,n,a,i,s){}_updateBounds(e){e&&(this._updateCamera(e),super._updateBounds(e))}_updateCamera(e){if(e||(e=this.getBounds()),e){if(this._cameraControl instanceof CameraControl3D){const t=e.getSize(new THREE.Vector3),n=Math.max(t.x,t.z),a=this._initData.moc?.5*n*-1:5,i=this._initData.moc?INITIAL_PITCH:70;this._cameraControl.updateAndReset(t,e.getCenter(new THREE.Vector3),-15,i,a,!1)}this._cameraControl instanceof CameraControl2D&&this._cameraControl.updateToBounds(e.getSize(new THREE.Vector3),e.getCenter(new THREE.Vector3))}}_zoomToBounds(){const e=this.getBounds();this._cameraControl instanceof CameraControl3D&&this._cameraControl.zoomToFitBounds(e)}getBounds(){return this._planViewModel?this._planViewModel.getBoundingBox():null}cancelSelection(){this._plannerSceneEventHandler.cancelSelection(),this._highlight(null),this._requestRender()}deleteSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelSelection(),e.forEach(e=>{const t=this._planViewModel.getPlanObjectForId(e);t&&t.getObject()&&this._plannerKernelAccess.planInteractionHandler.removeElement(t.getKernelObject())})}rotateSelection(e){const t=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,n=new THREE.Box3;this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const a=this._planViewModel.getPlanObjectForId(e);a&&a.getObject()&&(t.push_back(a.getPlanObject()),n.expandByObject(a.getContainer()))});const a=n.getCenter(new THREE.Vector3),i=this._plannerKernelAccess.planInteractionHandler.groupObjects(t);this._plannerKernelAccess.planInteractionHandler.rotateGroupBy(i,e,convertToKernel(a))}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender()}planElementRemoved(e){this._onPlanChanged(),this._renderEverything()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={}){return new Promise(t=>{this._planViewModel.materialQueue.finished(!0).then(async()=>{let n=this._calculateBoundingBoxOfAllMeshes(.1);this._lightSetting.removeFromScene();let a=await prepareTopImage(this._scene,null,n,e);this._lightSetting.addToScene(),this._requestRender(),t(a)})})}preparePerspectiveImage(e={}){return new Promise((t,n)=>{this._planViewModel.materialQueue.finished(!0).then(async()=>{let n;n=this._cameraControl instanceof CameraControl3D?this._cameraControl.getCamera().clone():this.getPerspectiveOffsetCamera();let a=this._calculateBoundingBoxOfAllMeshes();this._lightSetting.removeFromScene();const i=await preparePerspectiveImage(this._scene,null,n,a,e);this._lightSetting.addToScene(),this._requestRender(),t(i)},n)})}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return getCameraTargetForBBox(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}dragIn(e){this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}}return __decorate([inject],e.prototype,"_plannerKernelAccess",void 0),__decorate([inject],e.prototype,"_rapiAccess",void 0),__decorate([inject],e.prototype,"_plannerMeshGenerator",void 0),__decorate([inject],e.prototype,"_plannerInputManager",void 0),__decorate([inject],e.prototype,"_roomlePlannerUiCallback",void 0),__decorate([inject],e.prototype,"_localStorageHelper",void 0),e})();const OFFSET={left:0,top:1,right:1,bottom:0};let RoomlePlanner=(()=>{class e{constructor(e){this._hscInstance=null,this._glbInstance=null,this._creator_=e,this._kernelAccessCallback.addListener(this),this._backstack.init([CANVAS_ID.HSP],this)}deleteSelection(){this._sceneManager.deleteSelection()}rotateSelection(e){this._sceneManager.rotateSelection(e)}cancelSelection(){this._sceneManager.cancelSelection()}init(e,t,n){return Benchmark.start("loadingTime"),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):(this._preloadPlanId=t,this.setOverrides(n),new Promise(this._initPromiseCallback.bind(this)))}loadPlanXml(e,t){return this.setOverrides(t),new Promise(n=>{this._plan=this._planInteractionHandler.loadPlanXML(e),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._backstack.bringIntoForeground(CANVAS_ID.HSP),this._initData.moc&&(t.id?this._rapiAccess.trackView(t.id):this._rapiAccess.trackView("planXML")),n()})}loadPlan(e,t){return this.setOverrides(t),new Promise((t,n)=>{this._rapiAccess.getPlan(e).then(n=>{this._plan=this._planInteractionHandler.loadPlanXML(n.planObjects),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._backstack.bringIntoForeground(CANVAS_ID.HSP),this._initData.moc&&this._rapiAccess.trackView(e),t()},n)})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}switch2D(){this._sceneManager.switchTo2D()}switch3D(){this._sceneManager.switchTo3D()}switchToFirstPerson(){this._sceneManager.switchToFirstPerson()}exportGLB(){this._sceneManager.exportGLB()}importGLB(e){this._sceneManager.importGLB(e)}_initPromiseCallback(e,t){this._threeLoader.fetch().then(()=>{let t=this._scriptLoader.fetch(GLTF_LOADER_FILE_NAME,{id:"gltf-loader"}),n=this._scriptLoader.fetch(DRACO_LOADER_FILE_NAME,{id:"draco-loader"}),a=this._scriptLoader.fetch(TWEEN_FILE_NAME,{id:"tween-js"}),i=this._scriptLoader.fetch("static/Sky-6621935ea8a523af.js",{id:"sky-js"});Promise.all([t,n,a,i]).then(()=>{this._kernelReadyCallback=e;const{mode:t,stats:n}=this._initData;this._sceneManager||(this._sceneManager=new PlannerSceneManager(this._creator_,OFFSET,this,t)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId),n?this.showStats():this.enableHD(),this._planInteractionHandler&&this._kernelReadyCallback()})})}enableHD(){return new Promise((e,t)=>{const n=()=>{this._sceneManager.enableHD(),e()};this._threeLoader.fetch().then(()=>Promise.all(PIXOTRON_EFFETCS.map(e=>this._scriptLoader.fetch(e,{id:e})))).then(()=>{this._scriptLoader.fetch(PIXOTRON_FILE_NAME,{id:"pi-js"}).then(n,t)},t)})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){Benchmark.showBenchmarks()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);import("./configurator-6e7f5ef0.js").then((function(e){return e.c})).then(({Configurator:t})=>{const n=new t(this._creator_);n.boot({kernelInstance:this._planInteractionHandler.getConfiguratorKernel(),kernelContainer:this._plannerKernelAccess.kernelContainer}),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._hscInstance=n,e(this._hscInstance)})})});return this._backstack.bringIntoForeground(CANVAS_ID.HSC),this.cancelSelection(),e}async switchToViewer(){const e=await this._singlePromiseFactory.create(4,"startGLB",e=>{if(this._glbInstance)return e(this._glbInstance);import("./glb-viewer-0331f919.js").then(t=>{const n=new t.GlbViewer(this._creator_);n.boot(),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._glbInstance=n,e(this._glbInstance)})})});return this._backstack.bringIntoForeground(CANVAS_ID.GLB),this.cancelSelection(),e}switchToPlanner(e){e&&this.loadPlan(e),this._backstack.bringIntoForeground(CANVAS_ID.HSP)}updateSize(){this._sceneManager.updateCamera()}getMain(){}update(){this.updateSize(),this._glbInstance&&this._glbInstance.getApi().updateSize(),this._hscInstance&&this._hscInstance.getApi().updateSize()}get callbacks(){return this._roomlePlannerUiCallback}set callbacks(e){this._roomlePlannerUiCallback=e}showStats(){this._sceneManager.showStats()}onBackStackChanged(e){this._roomlePlannerUiCallback.onBackStackChanged(e)}onCloseHSC(){this._sceneManager.closeHSC(),this._hscInstance&&this._hscInstance.getApi().pauseKernelCallbacks()}back(){if(this._backstack.current()===CANVAS_ID.GLB&&this._glbInstance&&this._glbInstance.getApi().clearScene(),this._backstack.current()===CANVAS_ID.HSC&&this._hscInstance){const e=this._hscInstance.getApi();e.cancelSelection(),e.cancelDockings(),e.hideDimensions(),e.disableMultiselect(),this._sceneManager.updateScene()}this._backstack.back()}backTo(e){this._backstack.backTo(e)}getConfigurator(){return this._hscInstance}getCurrentSkin(){return this._rapiAccess.getCurrentSkin()}getRuntimeComponentIdOfRootComponent(e){return e?this._plannerKernelAccess.planInteractionHandler?this._plannerKernelAccess.planInteractionHandler.getConfiguratorKernel().getRootPlanComponentIdFromObjectId(e):(console.warn("Can not retrieve runtime id without planInteractionHandler"),0):(console.warn("Can not retrieve runtime id without planObjectId"),0)}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}loadError(e){}getPlanInteractionHandler(){return Promise.resolve(this._planInteractionHandler)}getPlanModelViewHelper(){return Promise.resolve(this._plannerKernelAccess.planModelViewHelper)}async insertObject(e,t,n){if(!this._planInteractionHandler)throw new Error("no plan interaction handler");const a=await(isIdItemId(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),i=await this._plannerKernelAccess.addPlanObjectFromItem(a,t,n);return this._sceneManager.updateScene(),i}async insertItemList(e){const t=e.map(e=>isIdItemId(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),n=await Promise.all(t);await this._plannerKernelAccess.insertItems(n)}async insertItems(e){await this._plannerKernelAccess.insertItems(e)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getCameraOffset(){return this._sceneManager.getCameraOffset()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}async getObjects(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);let t=[];for(let n=0;n<e.objects.size();n++)t.push(convertCObject(e.objects.get(n)));return t}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return convertCObject(e)}prepareTopImage(e={}){return this._sceneManager.prepareTopImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}enableRotation(){this._sceneManager.enableRotation()}disableRotation(){this._sceneManager.disableRotation()}async dragInObject(e,t){this._sceneManager.dragIn(t);const n=await this._rapiAccess.getItem(e);this.insertItems([n])}enableSnapping(){this._planInteractionHandler.reactivateAllSnappingActivity()}disableSnapping(){this._planInteractionHandler.deactivateAllSnappingActivity()}}return __decorate([inject],e.prototype,"_domHelper",void 0),__decorate([inject],e.prototype,"_scriptLoader",void 0),__decorate([inject],e.prototype,"_kernelAccessCallback",void 0),__decorate([inject],e.prototype,"_plannerKernelAccess",void 0),__decorate([inject],e.prototype,"_rapiAccess",void 0),__decorate([inject],e.prototype,"_singlePromiseFactory",void 0),__decorate([inject],e.prototype,"_roomlePlannerUiCallback",void 0),__decorate([inject],e.prototype,"_lifeCycleManager",void 0),__decorate([inject],e.prototype,"_backstack",void 0),__decorate([inject],e.prototype,"_threeLoader",void 0),__decorate([inject],e.prototype,"_dataSyncer",void 0),__decorate([inject],e.prototype,"_initData",void 0),__decorate([inject],e.prototype,"_globalInitData",void 0),e})(),Backstack=(()=>{class e{constructor(e){this._initialStack=[],this._creator_=e,this._lifeCycleManager.addEventListener(this)}_setInitialStack(e){this._initialStack=[...e]}_setCallbacks(e){this._callbacks=e}_resetCanvasStack(){this._canvasStack=[...this._initialStack]}init(e,t){this._setInitialStack(e),this._resetCanvasStack(),this._setCallbacks(t)}bringIntoForeground(e){const t=this._domHelper.element.querySelectorAll("canvas");let n=!1;t.forEach(t=>{if(t.classList.contains(e)){if(!t.classList.contains("foreground")){const t=this.current();t&&e!==t&&(this._canvasStack.push(e),n=!0),t||(n=!0)}t.classList.remove("background"),t.classList.add("foreground")}else t.classList.remove("foreground"),t.classList.add("background")}),n&&this._callbacks.onBackStackChanged(this._canvasStack)}current(){return this._canvasStack[this._canvasStack.length-1]}back(){if(1===this._canvasStack.length)return;let e=this._canvasStack.pop();this.bringIntoForeground(this.current()),e===CANVAS_ID.HSC&&this._callbacks.onCloseHSC(),this._callbacks.onBackStackChanged(this._canvasStack)}backTo(e){if(1!==this._canvasStack.length&&this.current()!==e)for(;this._canvasStack.length>0;){let t=this.current();if(t===e){this.bringIntoForeground(t);break}t===CANVAS_ID.HSC&&this._callbacks.onCloseHSC(),this._canvasStack.pop(),this._callbacks.onBackStackChanged(this._canvasStack)}}pause(){this._resetCanvasStack()}resume(){}destroy(){}}return __decorate([inject],e.prototype,"_domHelper",void 0),__decorate([inject],e.prototype,"_lifeCycleManager",void 0),e})();class PlannerSelectionHandlerEvent{constructor(e){const{planElementViewModel:t}=e;this.planElementViewModel=t}}const INJECTABLES=[new DependencyInjectionAssignment("script-loader",ScriptLoader),new DependencyInjectionAssignment("planner-input-manager",class extends InputManager{_canDrag(e){return!0}},1),new DependencyInjectionAssignment("planner-kernel-access",PlannerKernelAccess),new DependencyInjectionAssignment("logger",Logger),new DependencyInjectionAssignment("planner-mesh-generator",class extends MeshGenerator{constructor(e){super(e),this._wallMeshes=[],this._defaultMaterial=new THREE.MeshStandardMaterial({color:"#ffffff",roughness:1,metalness:0,opacity:1,envMap:null}),this._environmentLoader.setEnvMap(this._defaultMaterial)}generateGeometry(e=null,t,n,a,i,s=!1){let r;return r=s?this._generateGeometry(e,t,n,a,i).clone():this._generateGeometry(e,t,n,a,i),r}generateMesh(e=null,t,n,a,i,s,r,o=!1){const l=this.generateGeometry(e,n,a,i,s,o),c=new THREE.Mesh(l,this._previewMaterial);return c.layers.set(3),!t&&r&&7!==r.value?(console.warn("material is undefined"),c):(this.setMaterial(c,t,r).then(()=>{const e=r&&3===r.value;c.castShadow=!e}),this._checkWallMaterial(c,r),c)}async setMaterial(e,t,n){if(e.userData.material=getMaterialId(t,n),e.userData.materialId=t,isString(t))t?await this._assignMaterial(e,t):(console.warn("Used default material because material is empty"),this.changeMaterialOfMesh(e,this._defaultMaterial));else{if(!t)return void this.changeMaterialOfMesh(e,this._defaultMaterial);2===(t=t).getSourceType().value?await this._assignMaterial(e,t.materialId):1===t.getSourceType().value?await this._assignItem(e,t.catalogItemId):3===t.getSourceType().value?await this._assignRGB(e,t.rgbValue):0===t.getSourceType().value?this.changeMaterialOfMesh(e,this._defaultMaterial):(this.changeMaterialOfMesh(e,this._defaultMaterial),1!==n.value&&7!==n.value&&3!==n.value&&console.warn("Used default material because material is not supported",t))}}set maxAnisotropy(e){this._maxAnisotropy=e}_checkWallMaterial(e,t){t&&1===t.value&&(e.renderOrder=5,this._wallMeshes.push(e))}clear(){super.clear(),this.clearWallMeshes()}clearWallMeshes(){this._wallMeshes.forEach(e=>{disposeMesh(e)}),this._wallMeshes=[]}get wallMeshes(){return this._wallMeshes}}),new DependencyInjectionAssignment("rapi-access",RapiAccess),new DependencyInjectionAssignment("roomle-planner-ui-callback",class extends UiCallback{constructor(e){super(e),this.onItemsLoaded=()=>{},this.onBackStackChanged=e=>{},this.onCameraChanged=e=>{},this.onTotalFloorAreaChanged=e=>{},this.onPlanInteractionHandlerCreated=e=>{},this.onPlannerKernelIsReady=e=>{},this.onConfiguratorKernelIsReady=(e,t)=>{},this.onSelectionChange=(e,t,n,a)=>{},this.onSelectionCancel=()=>{},this.onPlanChanged=()=>{},this.onCompletelyLoaded=()=>{},this.onRotationCancel=()=>{},this.onHistoryChange=(e,t)=>{}}}),new DependencyInjectionAssignment("configurator-ui-callbacks",ConfiguratorUiCallbacks,1),new DependencyInjectionAssignment("backstack",Backstack),new DependencyInjectionAssignment("planner-selection-handler",class extends EventDispatcher{constructor(){super(...arguments),this._selectionMode="standard",this._selectedPlanElementViewModels=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}cancelSelection(){0!==this._selectedPlanElementViewModels.size&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new PlannerSelectionHandlerEvent({planElementViewModel:e}))})}_checkStandard(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new PlannerSelectionHandlerEvent({planElementViewModel:e}));this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new PlannerSelectionHandlerEvent({planElementViewModel:e}))}),this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new PlannerSelectionHandlerEvent({planElementViewModel:e}))}_checkMulti(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new PlannerSelectionHandlerEvent({planElementViewModel:e}));this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new PlannerSelectionHandlerEvent({planElementViewModel:e}))}setSelectionMode(e){this._selectionMode=e}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedPlanElementViewModels.size>0}getSelectedIds(){let e=[];return this._selectedPlanElementViewModels.forEach(t=>e.push(t.getId())),e}isSelected(e){return!!this._selectedPlanElementViewModels.get(e)}})];class Planner extends Main{setupGlobals(){}setupDependencies(){RoomleDependencyInjection.setup(INJECTABLES),this.lookup("logger",this._context),this.lookup("planner-kernel-access",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._planner=new RoomlePlanner(this._context),this._planner.getMain=()=>this,window.RoomlePlanner||(window.RoomlePlanner=this._planner)}getApi(){return this._planner}getContextName(){return"planner"}}export{Planner};
2
+ //# sourceMappingURL=planner-79b62302.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-c3c34e74.js","sources":["../../node_modules/three/examples/js/objects/Sky.js"],"sourcesContent":["export default \"static/Sky-6621935ea8a523af.js\""],"names":[],"mappings":"i/5BAAe"}
1
+ {"version":3,"file":"planner-79b62302.js","sources":["../../node_modules/three/examples/js/objects/Sky.js"],"sourcesContent":["export default \"static/Sky-6621935ea8a523af.js\""],"names":[],"mappings":"i/5BAAe"}
@@ -0,0 +1,2 @@
1
+ import"./query-params-helper-a271f9dc.js";import"./rapi-access-d209c65c.js";import"./main-thread-to-worker-5447c1c5.js";import"./image-renderer-ad267c8b.js";import{Planner}from"./planner-79b62302.js";import"./pixotron-9baf521b.js";import"./mesh-generator-a980f1b0.js";import"./default-light-setting-7de63c9a.js";import"./scene-manager-424afdbc.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-74807374.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-main-74807374.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- System.register(["./query-params-helper-c231e1b8.nomodule.js","./rapi-access-cf61a750.nomodule.js","./main-thread-to-worker-bb844d54.nomodule.js","./image-renderer-9478b17b.nomodule.js","./planner-f1b53f57.nomodule.js","./pixotron-ec9a72e0.nomodule.js","./mesh-generator-948c7db4.nomodule.js","./default-light-setting-f21a820b.nomodule.js","./scene-manager-aa8b9035.nomodule.js"],(function(){var e;return{setters:[function(){},function(){},function(){},function(){},function(n){e=n.Planner},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(["./query-params-helper-c231e1b8.nomodule.js","./rapi-access-65dbda00.nomodule.js","./main-thread-to-worker-4fc95d50.nomodule.js","./image-renderer-880c414d.nomodule.js","./planner-2040e9ab.nomodule.js","./pixotron-4065f090.nomodule.js","./mesh-generator-7dea7a1b.nomodule.js","./default-light-setting-e4720308.nomodule.js","./scene-manager-0ac7eb06.nomodule.js"],(function(){var e;return{setters:[function(){},function(){},function(){},function(){},function(n){e=n.Planner},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