@roomle/web-sdk 2.41.0-alpha.2 → 2.41.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 (173) hide show
  1. package/lib/{banana-for-scale-ae5b86f3.js → banana-for-scale-5ff6afa2.js} +2 -2
  2. package/lib/{banana-for-scale-ae5b86f3.js.map → banana-for-scale-5ff6afa2.js.map} +1 -1
  3. package/lib/{banana-for-scale-adac0bbc.nomodule.js → banana-for-scale-63b9dccb.nomodule.js} +2 -2
  4. package/lib/{banana-for-scale-adac0bbc.nomodule.js.map → banana-for-scale-63b9dccb.nomodule.js.map} +1 -1
  5. package/lib/{component-dimensioning-a3d0fd84.nomodule.js → component-dimensioning-6b29650e.nomodule.js} +2 -2
  6. package/lib/component-dimensioning-6b29650e.nomodule.js.map +1 -0
  7. package/lib/{component-dimensioning-c02017dc.js → component-dimensioning-86ee8104.js} +2 -2
  8. package/lib/component-dimensioning-86ee8104.js.map +1 -0
  9. package/lib/{component-raycast-helper-ab2376e7.nomodule.js → component-raycast-helper-5d22b992.nomodule.js} +2 -2
  10. package/lib/component-raycast-helper-5d22b992.nomodule.js.map +1 -0
  11. package/lib/{component-raycast-helper-fa1afd7d.js → component-raycast-helper-e9a05061.js} +2 -2
  12. package/lib/component-raycast-helper-e9a05061.js.map +1 -0
  13. package/lib/{configurator-9a219c6c.js → configurator-0499617b.js} +2 -2
  14. package/lib/configurator-0499617b.js.map +1 -0
  15. package/lib/{configurator-528af742.nomodule.js → configurator-3815d8dc.nomodule.js} +2 -2
  16. package/lib/configurator-3815d8dc.nomodule.js.map +1 -0
  17. package/lib/configurator-main-7bb5f0f6.js +2 -0
  18. package/lib/configurator-main-7bb5f0f6.js.map +1 -0
  19. package/lib/configurator-main.nomodule.js +1 -1
  20. package/lib/{default-light-setting-ee7cd0ac.nomodule.js → default-light-setting-86900b75.nomodule.js} +2 -2
  21. package/lib/default-light-setting-86900b75.nomodule.js.map +1 -0
  22. package/lib/{default-light-setting-4da6d23a.js → default-light-setting-a373e78e.js} +2 -2
  23. package/lib/default-light-setting-a373e78e.js.map +1 -0
  24. package/lib/{dimensioning-helper-131972e4.js → dimensioning-helper-7d14802f.js} +2 -2
  25. package/lib/{dimensioning-helper-131972e4.js.map → dimensioning-helper-7d14802f.js.map} +1 -1
  26. package/lib/{dimensioning-helper-4cb45f13.nomodule.js → dimensioning-helper-81e24b70.nomodule.js} +2 -2
  27. package/lib/{dimensioning-helper-4cb45f13.nomodule.js.map → dimensioning-helper-81e24b70.nomodule.js.map} +1 -1
  28. package/lib/{glb-viewer-ab95b772.nomodule.js → glb-viewer-2d08a55b.nomodule.js} +2 -2
  29. package/lib/{glb-viewer-ab95b772.nomodule.js.map → glb-viewer-2d08a55b.nomodule.js.map} +1 -1
  30. package/lib/{glb-viewer-70e9420a.js → glb-viewer-ca969b1b.js} +2 -2
  31. package/lib/{glb-viewer-70e9420a.js.map → glb-viewer-ca969b1b.js.map} +1 -1
  32. package/lib/glb-viewer-main-dc8a490a.js +2 -0
  33. package/lib/glb-viewer-main-dc8a490a.js.map +1 -0
  34. package/lib/glb-viewer-main.nomodule.js +1 -1
  35. package/lib/legacy/{banana-for-scale-4cba6922.legacy.js → banana-for-scale-3aaa2a02.legacy.js} +2 -2
  36. package/lib/legacy/{banana-for-scale-4cba6922.legacy.js.map → banana-for-scale-3aaa2a02.legacy.js.map} +1 -1
  37. package/lib/legacy/{component-dimensioning-bffb0f3b.legacy.js → component-dimensioning-86b32d3b.legacy.js} +2 -2
  38. package/lib/legacy/component-dimensioning-86b32d3b.legacy.js.map +1 -0
  39. package/lib/legacy/{component-raycast-helper-9f1b4f67.legacy.js → component-raycast-helper-69f2b444.legacy.js} +2 -2
  40. package/lib/legacy/component-raycast-helper-69f2b444.legacy.js.map +1 -0
  41. package/lib/legacy/{configurator-17f905eb.legacy.js → configurator-ab1c48da.legacy.js} +2 -2
  42. package/lib/legacy/configurator-ab1c48da.legacy.js.map +1 -0
  43. package/lib/legacy/configurator-main.legacy.js +1 -1
  44. package/lib/legacy/{default-light-setting-b4370cc1.legacy.js → default-light-setting-edbfae4a.legacy.js} +2 -2
  45. package/lib/legacy/default-light-setting-edbfae4a.legacy.js.map +1 -0
  46. package/lib/legacy/{dimensioning-helper-a4308bf5.legacy.js → dimensioning-helper-c78d3335.legacy.js} +2 -2
  47. package/lib/legacy/{dimensioning-helper-a4308bf5.legacy.js.map → dimensioning-helper-c78d3335.legacy.js.map} +1 -1
  48. package/lib/legacy/{glb-viewer-25726a33.legacy.js → glb-viewer-ac0f25b4.legacy.js} +2 -2
  49. package/lib/legacy/{glb-viewer-25726a33.legacy.js.map → glb-viewer-ac0f25b4.legacy.js.map} +1 -1
  50. package/lib/legacy/glb-viewer-main.legacy.js +1 -1
  51. package/lib/legacy/{material-viewer-2ae5c85f.legacy.js → material-viewer-ae767c51.legacy.js} +2 -2
  52. package/lib/legacy/material-viewer-ae767c51.legacy.js.map +1 -0
  53. package/lib/legacy/material-viewer-main.legacy.js +1 -1
  54. package/lib/legacy/{pixotron-084097ac.legacy.js → pixotron-77572ad9.legacy.js} +2 -2
  55. package/lib/legacy/{pixotron-084097ac.legacy.js.map → pixotron-77572ad9.legacy.js.map} +1 -1
  56. package/lib/legacy/{planner-ef79f503.legacy.js → planner-c9fae545.legacy.js} +2 -2
  57. package/lib/legacy/{planner-ef79f503.legacy.js.map → planner-c9fae545.legacy.js.map} +1 -1
  58. package/lib/legacy/planner-main.legacy.js +1 -1
  59. package/lib/legacy/{roomle-configurator-8d3e7c20.legacy.js → roomle-configurator-f6cddbe7.legacy.js} +2 -2
  60. package/lib/legacy/{roomle-configurator-8d3e7c20.legacy.js.map → roomle-configurator-f6cddbe7.legacy.js.map} +1 -1
  61. package/lib/legacy/{roomle-dependency-injection-f964807d.legacy.js → roomle-dependency-injection-85943177.legacy.js} +2 -2
  62. package/lib/legacy/{roomle-dependency-injection-f964807d.legacy.js.map → roomle-dependency-injection-85943177.legacy.js.map} +1 -1
  63. package/lib/legacy/roomle-sdk.legacy.js +1 -1
  64. package/lib/legacy/{script-loader-d596fefb.legacy.js → script-loader-cecb38a7.legacy.js} +2 -2
  65. package/lib/legacy/script-loader-cecb38a7.legacy.js.map +1 -0
  66. package/lib/legacy/static/ConfiguratorKernel-f0fd8475c9bb6ae3.wasm +0 -0
  67. package/lib/legacy/static/ConfiguratorKernelJs-733c537c978e8757.mem +0 -0
  68. package/lib/legacy/static/ConfiguratorKernelJs-94b662be35edd490.js +146 -0
  69. package/lib/legacy/static/RoomleCore-26406f45882636dc.wasm +0 -0
  70. package/lib/legacy/static/RoomleCoreJs-a667b9fb53d1da6d.js +154 -0
  71. package/lib/legacy/static/RoomleCoreJs-df5a3b5d84f74e48.mem +0 -0
  72. package/lib/legacy/static/RoomleToolsCore-03a0e982a9cbba05.wasm +0 -0
  73. package/lib/legacy/static/shaders-966e51d62bed1518.json +1 -0
  74. package/lib/legacy/{stats-helper-9898756b.legacy.js → stats-helper-47d4bb11.legacy.js} +2 -2
  75. package/lib/legacy/{stats-helper-9898756b.legacy.js.map → stats-helper-47d4bb11.legacy.js.map} +1 -1
  76. package/lib/legacy/{tools-core-becb0fa3.legacy.js → tools-core-89decd49.legacy.js} +2 -2
  77. package/lib/legacy/tools-core-89decd49.legacy.js.map +1 -0
  78. package/lib/{material-viewer-337773a9.nomodule.js → material-viewer-2299150f.nomodule.js} +2 -2
  79. package/lib/material-viewer-2299150f.nomodule.js.map +1 -0
  80. package/lib/{material-viewer-aad1c1fe.js → material-viewer-c37accb7.js} +2 -2
  81. package/lib/material-viewer-c37accb7.js.map +1 -0
  82. package/lib/material-viewer-main-1836fe13.js +2 -0
  83. package/lib/material-viewer-main-1836fe13.js.map +1 -0
  84. package/lib/material-viewer-main.nomodule.js +1 -1
  85. package/lib/{pixotron-710676a0.nomodule.js → pixotron-82119b18.nomodule.js} +2 -2
  86. package/lib/{pixotron-710676a0.nomodule.js.map → pixotron-82119b18.nomodule.js.map} +1 -1
  87. package/lib/{pixotron-636f369f.js → pixotron-9f139c75.js} +2 -2
  88. package/lib/{pixotron-636f369f.js.map → pixotron-9f139c75.js.map} +1 -1
  89. package/lib/{planner-40982a1a.js → planner-186d14e1.js} +2 -2
  90. package/lib/{planner-40982a1a.js.map → planner-186d14e1.js.map} +1 -1
  91. package/lib/{planner-8b93848e.nomodule.js → planner-81a22ec8.nomodule.js} +2 -2
  92. package/lib/{planner-8b93848e.nomodule.js.map → planner-81a22ec8.nomodule.js.map} +1 -1
  93. package/lib/planner-main-953e8696.js +2 -0
  94. package/lib/planner-main-953e8696.js.map +1 -0
  95. package/lib/planner-main.nomodule.js +1 -1
  96. package/lib/{roomle-configurator-bf767216.nomodule.js → roomle-configurator-60558432.nomodule.js} +2 -2
  97. package/lib/{roomle-configurator-bf767216.nomodule.js.map → roomle-configurator-60558432.nomodule.js.map} +1 -1
  98. package/lib/{roomle-configurator-b93f8e93.js → roomle-configurator-af533195.js} +2 -2
  99. package/lib/{roomle-configurator-b93f8e93.js.map → roomle-configurator-af533195.js.map} +1 -1
  100. package/lib/{roomle-dependency-injection-1916c1c5.js → roomle-dependency-injection-b9111746.js} +2 -2
  101. package/lib/{roomle-dependency-injection-1916c1c5.js.map → roomle-dependency-injection-b9111746.js.map} +1 -1
  102. package/lib/{roomle-dependency-injection-fd4ee18d.nomodule.js → roomle-dependency-injection-f6cc9c17.nomodule.js} +2 -2
  103. package/lib/{roomle-dependency-injection-fd4ee18d.nomodule.js.map → roomle-dependency-injection-f6cc9c17.nomodule.js.map} +1 -1
  104. package/lib/{roomle-sdk-0a2623a6.js → roomle-sdk-c950acdc.js} +2 -2
  105. package/lib/roomle-sdk-c950acdc.js.map +1 -0
  106. package/lib/roomle-sdk.nomodule.js +1 -1
  107. package/lib/{script-loader-ad588ab3.nomodule.js → script-loader-29c29641.nomodule.js} +2 -2
  108. package/lib/script-loader-29c29641.nomodule.js.map +1 -0
  109. package/lib/{script-loader-61e93b62.js → script-loader-3390ceca.js} +2 -2
  110. package/lib/script-loader-3390ceca.js.map +1 -0
  111. package/lib/static/ConfiguratorKernel-f0fd8475c9bb6ae3.wasm +0 -0
  112. package/lib/static/ConfiguratorKernelJs-733c537c978e8757.mem +0 -0
  113. package/lib/static/ConfiguratorKernelJs-94b662be35edd490.js +146 -0
  114. package/lib/static/RoomleCore-26406f45882636dc.wasm +0 -0
  115. package/lib/static/RoomleCoreJs-a667b9fb53d1da6d.js +154 -0
  116. package/lib/static/RoomleCoreJs-df5a3b5d84f74e48.mem +0 -0
  117. package/lib/static/RoomleToolsCore-03a0e982a9cbba05.wasm +0 -0
  118. package/lib/static/shaders-966e51d62bed1518.json +1 -0
  119. package/lib/{stats-helper-e36a7344.js → stats-helper-652ab243.js} +2 -2
  120. package/lib/{stats-helper-e36a7344.js.map → stats-helper-652ab243.js.map} +1 -1
  121. package/lib/{stats-helper-1d52f9e6.nomodule.js → stats-helper-66bdd451.nomodule.js} +2 -2
  122. package/lib/{stats-helper-1d52f9e6.nomodule.js.map → stats-helper-66bdd451.nomodule.js.map} +1 -1
  123. package/lib/{tools-core-6aafa419.nomodule.js → tools-core-786d3768.nomodule.js} +2 -2
  124. package/lib/tools-core-786d3768.nomodule.js.map +1 -0
  125. package/lib/{tools-core-234213f1.js → tools-core-7b6816a2.js} +2 -2
  126. package/lib/tools-core-7b6816a2.js.map +1 -0
  127. package/package.json +2 -2
  128. package/lib/component-dimensioning-a3d0fd84.nomodule.js.map +0 -1
  129. package/lib/component-dimensioning-c02017dc.js.map +0 -1
  130. package/lib/component-raycast-helper-ab2376e7.nomodule.js.map +0 -1
  131. package/lib/component-raycast-helper-fa1afd7d.js.map +0 -1
  132. package/lib/configurator-528af742.nomodule.js.map +0 -1
  133. package/lib/configurator-9a219c6c.js.map +0 -1
  134. package/lib/configurator-main-b3145ad1.js +0 -2
  135. package/lib/configurator-main-b3145ad1.js.map +0 -1
  136. package/lib/default-light-setting-4da6d23a.js.map +0 -1
  137. package/lib/default-light-setting-ee7cd0ac.nomodule.js.map +0 -1
  138. package/lib/glb-viewer-main-af7f8db5.js +0 -2
  139. package/lib/glb-viewer-main-af7f8db5.js.map +0 -1
  140. package/lib/legacy/component-dimensioning-bffb0f3b.legacy.js.map +0 -1
  141. package/lib/legacy/component-raycast-helper-9f1b4f67.legacy.js.map +0 -1
  142. package/lib/legacy/configurator-17f905eb.legacy.js.map +0 -1
  143. package/lib/legacy/default-light-setting-b4370cc1.legacy.js.map +0 -1
  144. package/lib/legacy/material-viewer-2ae5c85f.legacy.js.map +0 -1
  145. package/lib/legacy/script-loader-d596fefb.legacy.js.map +0 -1
  146. package/lib/legacy/static/ConfiguratorKernel-ae7e275bc715fd26.wasm +0 -0
  147. package/lib/legacy/static/ConfiguratorKernelJs-7c1047a033b225d4.js +0 -146
  148. package/lib/legacy/static/ConfiguratorKernelJs-d3e4f60672162604.mem +0 -0
  149. package/lib/legacy/static/RoomleCore-49461a0dcc73733f.wasm +0 -0
  150. package/lib/legacy/static/RoomleCoreJs-5893fc7ffafdc689.mem +0 -0
  151. package/lib/legacy/static/RoomleCoreJs-726cd014804a7c9c.js +0 -154
  152. package/lib/legacy/static/RoomleToolsCore-5d462fa29751217f.wasm +0 -0
  153. package/lib/legacy/static/shaders-f7602438ff124bbf.json +0 -1
  154. package/lib/legacy/tools-core-becb0fa3.legacy.js.map +0 -1
  155. package/lib/material-viewer-337773a9.nomodule.js.map +0 -1
  156. package/lib/material-viewer-aad1c1fe.js.map +0 -1
  157. package/lib/material-viewer-main-1e83e020.js +0 -2
  158. package/lib/material-viewer-main-1e83e020.js.map +0 -1
  159. package/lib/planner-main-b9d43968.js +0 -2
  160. package/lib/planner-main-b9d43968.js.map +0 -1
  161. package/lib/roomle-sdk-0a2623a6.js.map +0 -1
  162. package/lib/script-loader-61e93b62.js.map +0 -1
  163. package/lib/script-loader-ad588ab3.nomodule.js.map +0 -1
  164. package/lib/static/ConfiguratorKernel-ae7e275bc715fd26.wasm +0 -0
  165. package/lib/static/ConfiguratorKernelJs-7c1047a033b225d4.js +0 -146
  166. package/lib/static/ConfiguratorKernelJs-d3e4f60672162604.mem +0 -0
  167. package/lib/static/RoomleCore-49461a0dcc73733f.wasm +0 -0
  168. package/lib/static/RoomleCoreJs-5893fc7ffafdc689.mem +0 -0
  169. package/lib/static/RoomleCoreJs-726cd014804a7c9c.js +0 -154
  170. package/lib/static/RoomleToolsCore-5d462fa29751217f.wasm +0 -0
  171. package/lib/static/shaders-f7602438ff124bbf.json +0 -1
  172. package/lib/tools-core-234213f1.js.map +0 -1
  173. package/lib/tools-core-6aafa419.nomodule.js.map +0 -1
@@ -1,2 +1,2 @@
1
- System.register(["./query-params-helper-c231e1b8.nomodule.js","./roomle-dependency-injection-fd4ee18d.nomodule.js","./main-thread-to-worker-7283a354.nomodule.js","./roomle-configurator-bf767216.nomodule.js","./pixotron-710676a0.nomodule.js","./script-loader-ad588ab3.nomodule.js","./default-light-setting-ee7cd0ac.nomodule.js"],(function(e,t){var n,i,a,s,r,o,l,h,c,d,_,g,p,m,u,C,w,E,v,f,S,b,M,I,P,H,y,L,D,k,O,T,V,R,A,x,j,B,F,W,G,K,U,z,q,N,X,Q,Z,J;return{setters:[function(){},function(e){n=e.h,i=e._,a=e.i,s=e.a0,r=e.f,o=e.N,l=e.S,h=e.W,c=e.c,d=e.a1,_=e.k,g=e.B,p=e.Q,m=e.a2,u=e.g,C=e.w,w=e.a3,E=e.a4,v=e.n,f=e.G,S=e.a5,b=e.E,M=e.D,I=e.L,P=e.a6,H=e.R,y=e.b},function(e){L=e.d,D=e.i,k=e.m},function(e){O=e.S,T=e.C,V=e.P,R=e.G,A=e.p,x=e.a,j=e.g,B=e.R},function(e){F=e.L,W=e.B,G=e.b,K=e.C,U=e.d,z=e.e,q=e.I,N=e.T,X=e.P,Q=e.c},function(e){Z=e.S,J=e.M},function(){}],execute:function(){class Y extends F{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:2,y:1,z:2},color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),.4),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,i=new THREE.Vector3(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);i.normalize(),i.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(i),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 ${constructor(e){const{planElementViewModel:t,resetCamera:n,state:i,oldState:a}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===i?0:i,this.oldState=void 0===a?0:a}}let ee=(()=>{class e extends O{constructor(e,t,n,i){super(e,t,n,i),this._isCurrentlyDrawing=!1,this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0),this._raycastHelper.addEventListener(3,()=>{if(2===this._state)return this.resetState(),void(this.isSnappingActive&&this.planInteractionHandler.reactivateAllSnappingActivity());this._plannerSelectionHandler.cancelSelection()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(0,new $({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e})=>{this.setState(0),this.dispatchEvent(1,new $({planElementViewModel:e}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}disable(){const e=new THREE.Layers;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}get planInteractionHandler(){var e;return null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler}enable(){const e=new THREE.Layers;e.enable(3),e.enable(7),e.enable(6),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}disableWallEvents(){this._raycastHelper.getLayers().disable(9)}enableWallEvents(){this._raycastHelper.getLayers().enable(9)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}addPlanObjectHandlers(e,t){t||(t=e.getBoundingBox());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=L(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=L(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){if(!this._isCurrentlyDrawing){if(this._debug&&e.getId(),2===this._state)return this.resetState(),void(this.isSnappingActive&&this.planInteractionHandler.reactivateAllSnappingActivity());this._plannerSelectionHandler.check(e),this._setCursor()}}_hoverOn(e){this._isCurrentlyDrawing||(this._hoveredObject=e,this._setCursor())}_hoverOff(e){this._hoveredObject=null,this._setCursor()}_setCursor(){2===this._state&&this._hasSelection()?D("ew-resize"):1===this._state?D("grabbing"):this._hoveredObject&&this._plannerSelectionHandler.isSelected(this._hoveredObject.getId())?D("move"):this._hoveredObject?D("pointer"):3===this._state?D(s?"url('https://res.cloudinary.com/roomle/image/upload/v1664957371/pencil_j5vkhm.svg') 0 15, auto":"url('https://res.cloudinary.com/roomle/image/upload/v1664957371/pencil_j5vkhm.svg') 3 20, auto"):D("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 $({planElementViewModel:e})),this._setCursor())}_drag(e,t){if(!this._draggedObject||1!==this._state)return;const n=this.planInteractionHandler;if(this._plannerSelectionHandler.getSelectedIds().length>1){const e=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let i=t.sub(this._draggedObject.getPosition());this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanObject())),n.moveObjectsBy(e,r(i))}else n.moveElementTo(e.getPlanElement(),r(t));this.dispatchEvent(5,new $({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this.setState(0),this.dispatchEvent(6,new $({planElementViewModel:e})),this._dragIn&&(this.cancelSelection(),this.setDragIn(!1)),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this.planInteractionHandler,i=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),i.rotation-t)}}setState(e){const t=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new $({state:this._state,oldState:t})),this._position=null,2===this._state&&this.planInteractionHandler.deactivateAllSnappingActivity()}resetState(){this.setState(0)}_move(e){if(3!==this._state&&2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:i}=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 a=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()&&(a.push_back(n.getPlanObject()),s.expandByObject(n.getContainer()))});const o=s.getCenter(new THREE.Vector3);this.planInteractionHandler.rotateObjectsBy(a,t,r(o)),this._position.copy(new THREE.Vector3(n,i,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}selectPlanElement(e){this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(0,new $({}))}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)}enableSnapping(){this.planInteractionHandler.reactivateAllSnappingActivity(),this.isSnappingActive=!0}disableSnapping(){this.planInteractionHandler.deactivateAllSnappingActivity(),this.isSnappingActive=!1}enableWallDrawing(){this._inputManager.addEventListener(12,this._toggleDrawing,this),this._inputManager.addEventListener(5,this._createNode,this),this._inputManager.addEventListener(6,this._drawWallOnMouseMove,this),this._inputManager.addEventListener(14,this._startWallDrawing,this),this._inputManager.addEventListener(13,this._endWallDrawing,this)}cancelWallDrawing(){this._setStateAndCursor(0),this._inputManager.removeEventListener(12,this._toggleDrawing),this._inputManager.removeEventListener(5,this._createNode),this._inputManager.removeEventListener(6,this._drawWallOnMouseMove),this._inputManager.removeEventListener(14,this._startWallDrawing),this._inputManager.removeEventListener(13,this._endWallDrawing),this._raycastHelper.clear()}escapeDrawing(){this.planInteractionHandler.endInteraction(),this.planInteractionHandler.cancelDrawing(),this._isCurrentlyDrawing=!1,this._setStateAndCursor(0),this.dispatchEvent(12)}_toggleDrawing(e){this._isCurrentlyDrawing?this._endWallDrawing():this._startWallDrawing(e)}_endWallDrawing(){this._isCurrentlyDrawing&&(this._isCurrentlyDrawing=!1,this.dispatchEvent(12),this.planInteractionHandler.forceNode({x:this._point.x,y:this._point.y,z:this._point.z}),this.planInteractionHandler.cancelDrawing(),this._setStateAndCursor(0))}_startWallDrawing(e){this._isCurrentlyDrawing=!0,2===e.type&&this.planInteractionHandler.setDrawingType(0),this.planInteractionHandler.startInteraction(),this._setStateAndCursor(3),this._getIntersectPointWithScene(e),this.planInteractionHandler.beginDrawing({x:this._point.x,y:this._point.y,z:this._point.z}),this.dispatchEvent(11)}_drawWallOnMouseMove(e){this._isCurrentlyDrawing&&(this._getIntersectPointWithScene(e),this.planInteractionHandler.currentDrawingPosition({x:this._point.x,y:this._point.y,z:this._point.z}),this.dispatchEvent(10))}_createNode(e){this._isCurrentlyDrawing&&(this._getIntersectPointWithScene(e),this.planInteractionHandler.forceNode({x:this._point.x,y:this._point.y,z:this._point.z}),this._raycastHelper.clear(),this.planInteractionHandler.endInteraction())}_getIntersectPointWithScene(e){this._point=this._raycastHelper.intersectMouseOnScene(e)}_setStateAndCursor(e){this.setState(e),this._setCursor()}}return i([a],e.prototype,"_plannerSelectionHandler",void 0),i([a],e.prototype,"_plannerKernelAccess",void 0),e})(),te=(()=>{class e extends T{constructor(e,t,n,i){super(e,t,i),this._staticItemGuard=new o,this._configurableItemGuard=new o,this.currentSelection=null,this._stopRendering=!0,this._configuratorContext.baseContext="planner",this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new ee(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._onCameraMove()):(this._cameraControl.unlock(),this._onCameraIdle())},this),this._plannerSceneEventHandler.addEventListener(0,({planElementViewModel:e})=>{e instanceof l&&this._initData.debug&&e.getGLBUrl(),this._highlightPlanElement(e),this._onSelectionChange(e)},this),this._plannerSceneEventHandler.addEventListener(1,({planElementViewModel:e})=>{this._highlightPlanElement(null),this._onSelectionCancel(e),this._roomlePlannerUiCallback.onSelectionCancel()},this),this._plannerSceneEventHandler.addEventListener(4,({planElementViewModel:e})=>{this._getKernelAccess().planInteractionHandler.startInteraction(),this._cameraControl.lock(),e instanceof h&&this._sendWallDimensions(),this._environment instanceof W&&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._getKernelAccess().planInteractionHandler;t.endInteraction(),this._cameraControl.unlock(),this._environment instanceof W&&this._environment.addToScene();const n=this._getDragPosition(e.getPosition());n&&t.moveElementTo(e.getPlanElement(),r(n)),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds(!1),this._renderEverything()},this),this._getKernelAccess().addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this),this._renderListener=()=>{this._requestRender()},this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this),this.disableConfiguratorEvents(),this.enablePlannerEvents()}planCleared(){}planHistoryStateChanged(){this._sendWallDimensions()}_getViewModel(){return this._viewModel||(this._viewModel=new V(this._creator_)),this._viewModel}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new THREE.Vector3),i=e.distanceTo(n),a=t.getSize(new THREE.Vector3),s=Math.max(a.x,a.z)+3;if(i>s){const t=(new THREE.Vector3).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(s))}return null}_onSelectionChange(e){let t;const n={};if(e instanceof l&&(t="static"),e instanceof c&&(t="configuration"),e instanceof h&&(t="wall",n.wall=e.getWallDimension()),e instanceof l&&(n.item=e.getRapiItem()),e instanceof c){const t=e.getConfigurationRuntimeId();n.configurationRuntimeId=t}const i=(async()=>{const n={};if(e instanceof l&&(n.item=e.getRapiItem()),e instanceof c){const i=e.getConfigurationRuntimeId(),a=e.getPlanObject().getCatalogItemId(),s=this._getKernelAccess().kernelInstance.getHashOfConfiguration(i);let r;if(this._configuratorContext.planObjectId=i,this._configuratorContext.planElementId=e.getId(),this._configuratorContext.rootComponentId=e.getRootComponentRuntimeId(),a&&C(a)){const e=await this._rapiAccess.getItem(a);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._getKernelAccess().getConfigurationData(i),a=await this._rapiAccess.saveConfiguration(t);n.configuration=a,r=a.rootComponentId?a.rootComponentId:null}if(r){const e=await this._rapiAccess.getComponent(r);n.component=e}n.configurationRuntimeId=i,t="configuration"}return k(n)})();this.currentSelection=k(n),this._roomlePlannerUiCallback.onSelectionChange(k(this._plannerSceneEventHandler.getSelectionMode()),k(t),this.currentSelection,i)}_onSelectionCancel(e){this.resetConfiguratorContext(),this.currentSelection=null}resetConfiguratorContext(){this._configuratorContext.planObjectId=0,this._configuratorContext.planElementId=0,this._configuratorContext.rootComponentId=0,this._configuratorContext.dockingRootComponentId=0}_setupScene(e,t){super._setupScene(e,t,!0),this._lightSetting=new Y(this._scene,this._lightSetting),this._initData.moc?this._setEnvironment(new G(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND))):(this._addSky(),this._setEnvironment(new W(this._scene,this._environment)))}onBeforeRender(){this._cameraControl instanceof K&&this._plannerMeshGenerator.wallMeshes.forEach(e=>d(this._cameraControl.getCamera(),e.material))}_getInputManager(){return this._plannerInputManager}createCameraControl(e,t){this.setMode(e)}startViewing(){this._configuratorContext.baseContext="glb-viewer";const e=this._plannerSceneEventHandler.getSelectedIds();if(1===e.length){const t=this._getViewModel().getPlanObjectForId(e[0]);this._cameraControl instanceof K&&this._cameraControl.setObjectRotation(t.getPlanElement().rotation),this._getViewModel().hideAllExcept(t.getId())}this.resetCamera(),this.updateEnvironment(this.getBounds(),!0)}startConfiguring(){var e;this._configuratorContext.baseContext="configurator";const t=this._plannerSceneEventHandler.getSelectedIds();if(1===t.length&&this._cameraControl instanceof K){const e=this._getViewModel().getPlanObjectForId(t[0]);this._cameraControl.setObjectRotation(e.getPlanElement().rotation)}const{planObjectId:n,planElementId:i}=this._configuratorContext;this._getViewModel().hideAllExcept(i),this.resetCamera(),this.disablePlannerEvents(),this.enableConfiguratorEvents(),this.updateScene(),this._getKernelAccess().updatePlanObjectDependencies(n),this._getKernelAccess().requestPartListAndUpdatePricesOfParts(),this._getKernelAccess().planObjectUpdated(n),this.updateEnvironment(this.getBounds(),!0);const a=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==a||a.startInteraction()}selectPlanObject(e){if(this._plannerSceneEventHandler.getSelectedIds().includes(e))return;const t=this._getViewModel().getPlanObjectForId(e);this._plannerSceneEventHandler.selectPlanElement(t)}backToPlanner(){var e;if(this._getViewModel().showAll(),"configurator"===this._configuratorContext.baseContext){const t=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==t||t.endInteraction()}this._configuratorContext.baseContext="planner",this._cameraControl instanceof K&&this._cameraControl.setObjectRotation(0),this.resetCamera(),this.enablePlannerEvents(),this.disableConfiguratorEvents(),this.updateScene()}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart()}resetCameraToState(){this._cameraControl.resetToState()}_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._getViewModel().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._getKernelAccess().catalogItemLoaded(t),e.get(t.id).forEach(e=>{n.push(new Promise((n,i)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},i)}))})}),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=_(t);this._updateBounds(n),this.loadStaticPlanObjects()}planCompletelyLoaded(e){this._stopRendering=!1,this._renderEverything(),this.resetCamera()}handlerSwitchedPlans(e,t){if(this._getViewModel().setReference(t),this._getKernelAccess().coupleReferences(this._getViewModel(),t),this._getViewModel().setPlannerSceneEventHandler(this._plannerSceneEventHandler),this._getViewModel().setGeometriesMergedListener(()=>{this._renderEverything()}),this._plannerSceneEventHandler.setPlanViewModel(this._getViewModel()),e&&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._getViewModel().getCorePlan();if(this._pixotron){const t=_(e.getBounds());this._pixotron.getShadowPass().setShadowRecieverBBox(t)}this._roomlePlannerUiCallback.onCompletelyLoaded(),this._pixotronUtil&&this._getViewModel().materialQueue.finished(!0).then(()=>{this._pixotronUtil.unLockAdapter()}),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),g.end("loadingTime")}beginPlanConstruction(e){}addPlanMesh(e,t,n,i,a,s,r){}endPlanConstruction(e){this._renderLoopFunction=()=>{this._scene.add(this._getViewModel().getConstructionGroup()),this._scene.add(this._getViewModel().getCeilingGroup()),this._scene.add(this._getViewModel().getFloorGroup()),this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(this._getViewModel().getBoundingBox()),this._scene.remove(this._preloadScene)}}addPlanObjectToScene(e){if(e){const t=e.getContainer();p(t),this._scene.add(t),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.selectPlanElement(e),this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender()),this._roomlePlannerUiCallback.onPlanChanged(),this._roomlePlannerUiCallback.onPlanElementChanged()}setTimeout(()=>{this._zoomToBounds(!1)},0),this._renderEverything()}removePlanObjectFromScene(e){this._scene.remove(e.getContainer()),e.clear(),this.updateEnvironment(this.getBounds()),this._zoomToBounds(!0),this._renderEverything(),this._roomlePlannerUiCallback.onPlanElementChanged()}planElementChanged(e,t){this._drawingEnabled&&this._sendWallDimensions(!1),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),this._onPlanChanged(),this._roomlePlannerUiCallback.onPlanElementChanged()}exportGLB(e,t){this._scriptLoader.fetch(R,{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._getViewModel().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 Y&&this._lightSetting.updateSunPosition(.3,.25)}switchTo2D(){this._onCameraMove(),this._cameraControl instanceof U||(this._plannerMeshGenerator.wallMeshes.forEach(e=>m(e.material,!1,!1)),this._getViewModel().setCameraType("2D"),this._renderEverything(),this._changeCameraControl(new U(this._creator_,this._getInputManager(),null,this.getOrthographicOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("2D"),this._setCameraControlListeners())}switchTo3D(){this._onCameraMove(),this._cameraControl instanceof K||(this._getViewModel().setCameraType("3D"),this._renderEverything(),this._changeCameraControl(new K(this._creator_,this._getInputManager(),new THREE.Vector3(0,10,0),this.getPerspectiveOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("3D"),this._setCameraControlListeners())}_setCameraControlListeners(){this._cameraControl.addEventListener(8,()=>{this._onCameraIdle()},this),this._cameraControl.addEventListener(1,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(3,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(4,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(5,()=>{this._onCameraZoomChange()},this)}_onCameraZoomChange(){const e=this._cameraControl.getKernelZoomFactor();this._getKernelAccess().planInteractionHandler.setZoomFactor(e)}_setCeiling(){this._getViewModel()&&(this._cameraControl instanceof z?this._getViewModel().getCeilingGroup().visible=!0:this._getViewModel().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 K&&this._cameraControl.resetToState()}switchToFirstPerson(){if(this._cameraControl instanceof z)return;this._plannerMeshGenerator.wallMeshes.forEach(e=>m(e.material,!1,!1)),this._getViewModel().setCameraType("FP"),this._renderEverything();let e=new THREE.Vector3(0,0,0);this._getViewModel()&&(e=this._getViewModel().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"),this._setCameraControlListeners()}_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 K&&(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 K&&(this._cameraControl.disablePanning(),e.preventDefault()),!e.key||"Escape"!==e.key&&"Esc"!==e.key||this._drawingEnabled&&(this.escapeDrawing(),this._roomlePlannerUiCallback.onDrawCancel())}setMode(e){switch(e){case"2D":this.switchTo2D();break;case"3D":this.switchTo3D();break;case"FP":this.switchToFirstPerson()}}_highlightPlanElement(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._getViewModel().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._getViewModel().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._getViewModel().constructComponents(e)}}addMesh(e,t,n,i,a,s){}_updateBounds(e){e&&("planner"===this._configuratorContext.baseContext&&this._updateCamera(e),super._updateBounds(e))}_updateCamera(e){if(e||(e=this.getBounds()),e){if(this._cameraControl instanceof K){const t=e.getSize(new THREE.Vector3),n=Math.max(t.x,t.z),i=this._initData.moc?.5*n*-1:5,a=this._initData.moc?q:70;this._cameraControl.updateAndReset(t,e.getCenter(new THREE.Vector3),-15,a,i,!1)}this._cameraControl instanceof U&&!this._drawingEnabled&&this._cameraControl.zoomToFitBounds(e,!0)}}_zoomToBounds(e){const t=this.getBounds();this._cameraControl instanceof K&&this._cameraControl.zoomToFitBounds(t),this._cameraControl instanceof U&&!this._drawingEnabled&&this._cameraControl.zoomToFitBounds(t,e)}updateCameraOnDrawWalls(){const e=this.getBounds();this._cameraControl instanceof U&&this._cameraControl.zoomToFitBounds(e,!1,!0)}getBounds(){return this._getViewModel()?this._getViewModel().getBoundingBox():null}cancelPlanElementSelection(){this._plannerSceneEventHandler.cancelSelection(),this._highlightPlanElement(null),this._requestRender()}deletePlanElementSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelPlanElementSelection(),e.forEach(e=>{const t=this._getViewModel().getPlanObjectForId(e);t&&t.getObject()&&this._getKernelAccess().planInteractionHandler.removeElement(t.getKernelObject())})}rotatePlanElementSelection(e){const t=new(this._getKernelAccess().kernelContainer.PlanObjectPtrList),n=new THREE.Box3;this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const i=this._getViewModel().getPlanObjectForId(e);i&&i.getObject()&&(t.push_back(i.getPlanObject()),n.expandByObject(i.getContainer()))});const i=n.getCenter(new THREE.Vector3),a=this._getKernelAccess().planInteractionHandler.groupObjects(t);this._getKernelAccess().planInteractionHandler.rotateGroupBy(a,e,r(i))}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender()}planElementRemoved(e){this._onPlanChanged(),this._renderEverything()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={}){return new Promise(t=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{let n=this._calculateBoundingBoxOfAllMeshes(.1);this._lightSetting.removeFromScene();let i=await A(this._scene,null,n,e);this._lightSetting.addToScene(),this._requestRender(),t(i)})})}preparePerspectiveImage(e={}){return"configurator"===this._configuratorContext.baseContext?super.preparePerspectiveImage(e):new Promise((t,n)=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{let n;n=this._cameraControl instanceof K?this._cameraControl.getCamera().clone():this.getPerspectiveOffsetCamera();let i=this._calculateBoundingBoxOfAllMeshes();this._lightSetting.removeFromScene();const a=await x(this._scene,null,n,i,e);this._lightSetting.addToScene(),this._requestRender(),t(a)},n)})}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return j(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}enableSnapping(){this._plannerSceneEventHandler.enableSnapping()}disableSnapping(){this._plannerSceneEventHandler.disableSnapping()}dragIn(e){this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}disablePlannerEvents(){this._plannerSceneEventHandler.disable()}enablePlannerEvents(){this._plannerSceneEventHandler.enable()}_onCameraIdle(){return super._onCameraIdle()&&(this._sendWallDimensions(),this._sendPlanObjectPositions()),!0}_onCameraMove(){return super._onCameraMove()&&(this._roomlePlannerUiCallback.disableWallDimensions(),this._roomlePlannerUiCallback.cameraStartsMoving()),!0}_sendPlanObjectPositions(){if(this._cameraControl.isLocked())return;const{clientWidth:e,clientHeight:t}=this._domHelper.element,n=[];this._getViewModel().getStaticPlanObjectViewModels().forEach(i=>{const a=(new THREE.Box3).setFromObject(i.getContainer()).getCenter(new THREE.Vector3),s={planViewModel:i,position2d:u(a,this._cameraControl.getCamera(),e,t)};n.push(s)}),this._getViewModel().getConfigurablePlanObjectViewModels().forEach(i=>{const a=(new THREE.Box3).setFromObject(i.getContainer()).getCenter(new THREE.Vector3),s={planViewModel:i,position2d:u(a,this._cameraControl.getCamera(),e,t)};n.push(s)}),this._roomlePlannerUiCallback.enablePlanObjectPositions(n)}_sendWallDimensions(e=!0){if(this._cameraControl.isLocked()&&e)return;const t=[],{clientWidth:n,clientHeight:i}=this._domHelper.element;this._getViewModel().getWallPlanObjectViewModels().forEach(e=>{const a=e.getWallDimension();if(a.length>0&&(a.fromPosition2d=u(a.fromPosition3d,this._cameraControl.getCamera(),n,i),a.toPosition2d=u(a.toPosition3d,this._cameraControl.getCamera(),n,i),a.textPosition2d=u(a.textPosition3d,this._cameraControl.getCamera(),n,i),a.lengthFormatted=this._unitFormatter.formatMMValueToUnitString(a.length),t.push(a)),this._initData.debug){const e=new THREE.SphereGeometry(.1,32,16),t=new THREE.MeshBasicMaterial({color:16711680}),n=new THREE.Mesh(e,t);n.position.copy(a.fromPosition3d);const i=new THREE.Mesh(e,t);i.position.copy(a.toPosition3d);const s=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:65280}));s.position.copy(a.textPosition3d),this._scene.add(n),this._scene.add(i),this._scene.add(s)}}),this._roomlePlannerUiCallback.enableWallDimensions(t)}enableWallDrawing(){this._drawingEnabled=!0,this._plannerSceneEventHandler.enableWallDrawing(),this._plannerSceneEventHandler.addEventListener(11,this.drawingStart,this),this._plannerSceneEventHandler.addEventListener(12,this.drawingEnd,this)}disableWallDrawing(){this._drawingEnabled=!1,this._cameraControl.unlock(),this._plannerSceneEventHandler.cancelWallDrawing(),this._plannerSceneEventHandler.removeEventListener(11,this.drawingStart),this._plannerSceneEventHandler.removeEventListener(12,this.drawingEnd)}escapeDrawing(){this._plannerSceneEventHandler.escapeDrawing()}drawingStart(){this._cameraControl.lock()}drawingEnd(){this._cameraControl.unlock()}_changeCameraControl(e){super._changeCameraControl(e),e instanceof U&&this._environment instanceof W&&this._plannerSceneEventHandler.enableWallEvents(),(e instanceof K||e instanceof z)&&this._environment instanceof W&&this._plannerSceneEventHandler.disableWallEvents()}}return i([a],e.prototype,"_rapiAccess",void 0),i([a],e.prototype,"_plannerMeshGenerator",void 0),i([a],e.prototype,"_plannerInputManager",void 0),i([a],e.prototype,"_roomlePlannerUiCallback",void 0),i([a],e.prototype,"_localStorageHelper",void 0),i([a],e.prototype,"_unitFormatter",void 0),e})();const ne={left:0,top:1,right:1,bottom:0};let ie=(()=>{class e{constructor(e){this._hscInstance=null,this._glbInstance=null,this._configurator=null,this._currentMode=1,this._creator_=e,this._kernelAccessCallback.addListener(this)}deleteSelection(){this._sceneManager.deletePlanElementSelection()}rotateSelection(e){this._sceneManager.rotatePlanElementSelection(e)}cancelSelection(){this._sceneManager.cancelPlanElementSelection()}init(e,t,n){return g.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._currentMode=1,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._currentMode=1,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(w,{id:"gltf-loader"}),n=this._scriptLoader.fetch(E,{id:"draco-loader"}),i=this._scriptLoader.fetch(N,{id:"tween-js"}),a=this._scriptLoader.fetch("static/Sky-6621935ea8a523af.js",{id:"sky-js"});Promise.all([t,n,i,a]).then(()=>{this._kernelReadyCallback=e;const{dls:t,ls:n,mode:i,stats:a}=this._initData;this._sceneManager||(this._sceneManager=new te(this._creator_,ne,this,i)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId);const s=v.createDynamicLightSettingSource(t,n);a&&this.showStats(),this.enableHD(s),this._planInteractionHandler&&this._kernelReadyCallback()})})}enableHD(e){return new Promise((t,n)=>{const i=()=>{this._sceneManager.enableHD(e),t()};this._threeLoader.fetch().then(()=>Promise.all(X.map(e=>this._scriptLoader.fetch(e,{id:e})))).then(()=>{this._scriptLoader.fetch(Q,{id:"pi-js"}).then(i,n)},n)})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){g.showBenchmarks()}getConfiguratorApi(){return this._configurator||(this._configurator=new B(this._creator_),this._configurator.setOverrides(this._initData),this._configurator.initSceneManager(this._sceneManager)),this._configurator}startViewing(){this._sceneManager.startViewing()}startConfiguring(){var e,t;this._sceneManager.startConfiguring();const n=this._sceneManager.currentSelection,i=(null===(e=n.item)||void 0===e?void 0:e.id)||(null===(t=n.configuration)||void 0===t?void 0:t.id);i&&this._configurator.notifyUiAboutNewLabel(i)}selectPlanObjectById(e){this._sceneManager.selectPlanObject(e)}backToPlanner(){this._sceneManager.backToPlanner()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);t.import("./configurator-528af742.nomodule.js").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().initSceneManager(this._sceneManager),n.getApi().init(this._domHelper.element).then(()=>{this._hscInstance=n,e(this._hscInstance)})})});return this._currentMode=0,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-ab95b772.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._currentMode=2,this.cancelSelection(),e}switchToPlanner(e){e&&this.loadPlan(e),this._currentMode=1}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()}onCloseHSC(){this._sceneManager.closeHSC(),this._hscInstance&&this._hscInstance.getApi().pauseKernelCallbacks()}back(){if(2===this._currentMode&&this._glbInstance&&this._glbInstance.getApi().clearScene(),0===this._currentMode&&this._hscInstance){const e=this._hscInstance.getApi();e.cancelSelection(),e.cancelDockings(),e.hideDimensions(),e.disableMultiselect(),this._sceneManager.updateScene()}this._currentMode=1}backTo(e){console.error("backTo in planner Needs to be implemented later")}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");t&&(t=r(new THREE.Vector3(t.x,t.y,t.z)));const i=await(C(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),a=await this._plannerKernelAccess.addPlanObjectFromItem(i,t,n);return this._sceneManager.updateScene(),a}async insertItemList(e){const t=e.map(e=>C(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=[];const n=[],i=[],a=f(e.objects);await Promise.all(a.map(async e=>{const a=f(e);if(a.catalogItemId?n.push(a.catalogItemId):a.configurationHash&&i.push(a.configurationHash),a.parts){const e=a.configurationHash||a.catalogItemId,t=await this._plannerKernelAccess.addUiDataAndPriceToPartList(a.parts,e);a.parts=t}a.data=null,t.push(a)}));const[s,r]=await Promise.all([this._rapiAccess.getItems(n),this._rapiAccess.getConfigurations(i)]),o=[],l=new Map;for(const e of s)l.set(e.id,e);for(const e of r)l.set(e.id,e),o.push(e.rootComponentId);const h=await this._rapiAccess.getComponents(o),c=new Map;for(const e of h)c.set(e.id,e);for(const e of t){const t=e.catalogItemId||e.configurationHash,n=l.get(t)||null;if(n&&!n.label&&c.has(n.rootComponentId)){const e=c.get(n.rootComponentId);n.label=e.label}n&&!n.label&&(n.label=t),e.data=n}return t}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return f(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._sceneManager.enableSnapping()}disableSnapping(){this._sceneManager.disableSnapping()}async getPartlistOf(e){const t=this._plannerKernelAccess.kernelInstance.getHashOfConfiguration(e);if(!t){const e="Object has no partlist because it is not a configuration: "+t;return console.warn(e),Promise.reject(e)}const n=this._plannerKernelAccess.kernelInstance.getPartList(e);return await this._plannerKernelAccess.addUiDataAndPriceToPartList(n,t)}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}drawWalls(e,t={}){var n,i;const a=this._planInteractionHandler;a.startInteraction();const s=[];for(const t of e){const e=a.addNode(t.from),r=a.addNode(t.to),o=a.addWall(e,r);void 0!==(null===(n=t.props)||void 0===n?void 0:n.height)&&a.setWallHeight(o,t.props.height),void 0!==(null===(i=t.props)||void 0===i?void 0:i.thickness)&&a.setWallThickness(o,t.props.thickness),s.push(o)}return t.keepInteractionOpen||a.endInteraction(),this._sceneManager.updateCameraOnDrawWalls(),s}removeElements(e,t={}){const n=this._planInteractionHandler;n.startInteraction();for(const t of e)this._planInteractionHandler.removeElement(t);t.keepInteractionOpen||n.endInteraction()}hasWalls(){const e=this._planInteractionHandler,t=null==e?void 0:e.getPlan();return!(!t||t.getWallCount()<1)}enableWallDrawing(){this._sceneManager.enableWallDrawing()}disableWallDrawing(){this._sceneManager.disableWallDrawing()}getUnitFormatter(){return this._unitFormatter}}return i([a],e.prototype,"_domHelper",void 0),i([a],e.prototype,"_scriptLoader",void 0),i([a],e.prototype,"_kernelAccessCallback",void 0),i([a],e.prototype,"_plannerKernelAccess",void 0),i([a],e.prototype,"_rapiAccess",void 0),i([a],e.prototype,"_singlePromiseFactory",void 0),i([a],e.prototype,"_roomlePlannerUiCallback",void 0),i([a],e.prototype,"_lifeCycleManager",void 0),i([a],e.prototype,"_threeLoader",void 0),i([a],e.prototype,"_dataSyncer",void 0),i([a],e.prototype,"_initData",void 0),i([a],e.prototype,"_globalInitData",void 0),i([a],e.prototype,"_unitFormatter",void 0),e})();class ae{constructor(e){const{planElementViewModel:t}=e;this.planElementViewModel=t}}const se=[new M("script-loader",Z),new M("planner-input-manager",class extends S{_canDrag(e){return!0}},1),new M("logger",I),new M("planner-mesh-generator",P),new M("rapi-access",H),new M("planner-selection-handler",class extends b{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 ae({planElementViewModel:e}))})}_checkStandard(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new ae({planElementViewModel:e}));this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new ae({planElementViewModel:e}))}),this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new ae({planElementViewModel:e}))}_checkMulti(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new ae({planElementViewModel:e}));this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new ae({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 J{setupGlobals(){}setupDependencies(){y.setup(se),this.lookup("logger",this._context),this.lookup("planner-kernel-access",this._context).init(0)}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-8b93848e.nomodule.js.map
1
+ System.register(["./query-params-helper-c231e1b8.nomodule.js","./roomle-dependency-injection-f6cc9c17.nomodule.js","./main-thread-to-worker-7283a354.nomodule.js","./roomle-configurator-60558432.nomodule.js","./pixotron-82119b18.nomodule.js","./script-loader-29c29641.nomodule.js","./default-light-setting-86900b75.nomodule.js"],(function(e,t){var n,i,a,s,r,o,l,h,c,d,_,g,p,m,u,C,w,E,v,f,S,b,M,I,P,H,y,L,D,k,O,T,V,R,A,x,j,B,F,W,G,K,U,z,q,N,X,Q,Z,J;return{setters:[function(){},function(e){n=e.h,i=e._,a=e.i,s=e.a0,r=e.f,o=e.N,l=e.S,h=e.W,c=e.c,d=e.a1,_=e.k,g=e.B,p=e.Q,m=e.a2,u=e.g,C=e.w,w=e.a3,E=e.a4,v=e.n,f=e.G,S=e.a5,b=e.E,M=e.D,I=e.L,P=e.a6,H=e.R,y=e.b},function(e){L=e.d,D=e.i,k=e.m},function(e){O=e.S,T=e.C,V=e.P,R=e.G,A=e.p,x=e.a,j=e.g,B=e.R},function(e){F=e.L,W=e.B,G=e.b,K=e.C,U=e.d,z=e.e,q=e.I,N=e.T,X=e.P,Q=e.c},function(e){Z=e.S,J=e.M},function(){}],execute:function(){class Y extends F{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:2,y:1,z:2},color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),.4),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,i=new THREE.Vector3(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);i.normalize(),i.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(i),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 ${constructor(e){const{planElementViewModel:t,resetCamera:n,state:i,oldState:a}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===i?0:i,this.oldState=void 0===a?0:a}}let ee=(()=>{class e extends O{constructor(e,t,n,i){super(e,t,n,i),this._isCurrentlyDrawing=!1,this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0),this._raycastHelper.addEventListener(3,()=>{if(2===this._state)return this.resetState(),void(this.isSnappingActive&&this.planInteractionHandler.reactivateAllSnappingActivity());this._plannerSelectionHandler.cancelSelection()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(0,new $({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e})=>{this.setState(0),this.dispatchEvent(1,new $({planElementViewModel:e}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}disable(){const e=new THREE.Layers;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}get planInteractionHandler(){var e;return null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler}enable(){const e=new THREE.Layers;e.enable(3),e.enable(7),e.enable(6),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}disableWallEvents(){this._raycastHelper.getLayers().disable(9)}enableWallEvents(){this._raycastHelper.getLayers().enable(9)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}addPlanObjectHandlers(e,t){t||(t=e.getBoundingBox());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=L(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=L(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){if(!this._isCurrentlyDrawing){if(this._debug&&e.getId(),2===this._state)return this.resetState(),void(this.isSnappingActive&&this.planInteractionHandler.reactivateAllSnappingActivity());this._plannerSelectionHandler.check(e),this._setCursor()}}_hoverOn(e){this._isCurrentlyDrawing||(this._hoveredObject=e,this._setCursor())}_hoverOff(e){this._hoveredObject=null,this._setCursor()}_setCursor(){2===this._state&&this._hasSelection()?D("ew-resize"):1===this._state?D("grabbing"):this._hoveredObject&&this._plannerSelectionHandler.isSelected(this._hoveredObject.getId())?D("move"):this._hoveredObject?D("pointer"):3===this._state?D(s?"url('https://res.cloudinary.com/roomle/image/upload/v1664957371/pencil_j5vkhm.svg') 0 15, auto":"url('https://res.cloudinary.com/roomle/image/upload/v1664957371/pencil_j5vkhm.svg') 3 20, auto"):D("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 $({planElementViewModel:e})),this._setCursor())}_drag(e,t){if(!this._draggedObject||1!==this._state)return;const n=this.planInteractionHandler;if(this._plannerSelectionHandler.getSelectedIds().length>1){const e=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let i=t.sub(this._draggedObject.getPosition());this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanObject())),n.moveObjectsBy(e,r(i))}else n.moveElementTo(e.getPlanElement(),r(t));this.dispatchEvent(5,new $({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this.setState(0),this.dispatchEvent(6,new $({planElementViewModel:e})),this._dragIn&&(this.cancelSelection(),this.setDragIn(!1)),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this.planInteractionHandler,i=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),i.rotation-t)}}setState(e){const t=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new $({state:this._state,oldState:t})),this._position=null,2===this._state&&this.planInteractionHandler.deactivateAllSnappingActivity()}resetState(){this.setState(0)}_move(e){if(3!==this._state&&2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:i}=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 a=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()&&(a.push_back(n.getPlanObject()),s.expandByObject(n.getContainer()))});const o=s.getCenter(new THREE.Vector3);this.planInteractionHandler.rotateObjectsBy(a,t,r(o)),this._position.copy(new THREE.Vector3(n,i,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}selectPlanElement(e){this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(0,new $({}))}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)}enableSnapping(){this.planInteractionHandler.reactivateAllSnappingActivity(),this.isSnappingActive=!0}disableSnapping(){this.planInteractionHandler.deactivateAllSnappingActivity(),this.isSnappingActive=!1}enableWallDrawing(){this._inputManager.addEventListener(12,this._toggleDrawing,this),this._inputManager.addEventListener(5,this._createNode,this),this._inputManager.addEventListener(6,this._drawWallOnMouseMove,this),this._inputManager.addEventListener(14,this._startWallDrawing,this),this._inputManager.addEventListener(13,this._endWallDrawing,this)}cancelWallDrawing(){this._setStateAndCursor(0),this._inputManager.removeEventListener(12,this._toggleDrawing),this._inputManager.removeEventListener(5,this._createNode),this._inputManager.removeEventListener(6,this._drawWallOnMouseMove),this._inputManager.removeEventListener(14,this._startWallDrawing),this._inputManager.removeEventListener(13,this._endWallDrawing),this._raycastHelper.clear()}escapeDrawing(){this.planInteractionHandler.endInteraction(),this.planInteractionHandler.cancelDrawing(),this._isCurrentlyDrawing=!1,this._setStateAndCursor(0),this.dispatchEvent(12)}_toggleDrawing(e){this._isCurrentlyDrawing?this._endWallDrawing():this._startWallDrawing(e)}_endWallDrawing(){this._isCurrentlyDrawing&&(this._isCurrentlyDrawing=!1,this.dispatchEvent(12),this.planInteractionHandler.forceNode({x:this._point.x,y:this._point.y,z:this._point.z}),this.planInteractionHandler.cancelDrawing(),this._setStateAndCursor(0))}_startWallDrawing(e){this._isCurrentlyDrawing=!0,2===e.type&&this.planInteractionHandler.setDrawingType(0),this.planInteractionHandler.startInteraction(),this._setStateAndCursor(3),this._getIntersectPointWithScene(e),this.planInteractionHandler.beginDrawing({x:this._point.x,y:this._point.y,z:this._point.z}),this.dispatchEvent(11)}_drawWallOnMouseMove(e){this._isCurrentlyDrawing&&(this._getIntersectPointWithScene(e),this.planInteractionHandler.currentDrawingPosition({x:this._point.x,y:this._point.y,z:this._point.z}),this.dispatchEvent(10))}_createNode(e){this._isCurrentlyDrawing&&(this._getIntersectPointWithScene(e),this.planInteractionHandler.forceNode({x:this._point.x,y:this._point.y,z:this._point.z}),this._raycastHelper.clear(),this.planInteractionHandler.endInteraction())}_getIntersectPointWithScene(e){this._point=this._raycastHelper.intersectMouseOnScene(e)}_setStateAndCursor(e){this.setState(e),this._setCursor()}}return i([a],e.prototype,"_plannerSelectionHandler",void 0),i([a],e.prototype,"_plannerKernelAccess",void 0),e})(),te=(()=>{class e extends T{constructor(e,t,n,i){super(e,t,i),this._staticItemGuard=new o,this._configurableItemGuard=new o,this.currentSelection=null,this._stopRendering=!0,this._configuratorContext.baseContext="planner",this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new ee(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._onCameraMove()):(this._cameraControl.unlock(),this._onCameraIdle())},this),this._plannerSceneEventHandler.addEventListener(0,({planElementViewModel:e})=>{e instanceof l&&this._initData.debug&&e.getGLBUrl(),this._highlightPlanElement(e),this._onSelectionChange(e)},this),this._plannerSceneEventHandler.addEventListener(1,({planElementViewModel:e})=>{this._highlightPlanElement(null),this._onSelectionCancel(e),this._roomlePlannerUiCallback.onSelectionCancel()},this),this._plannerSceneEventHandler.addEventListener(4,({planElementViewModel:e})=>{this._getKernelAccess().planInteractionHandler.startInteraction(),this._cameraControl.lock(),e instanceof h&&this._sendWallDimensions(),this._environment instanceof W&&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._getKernelAccess().planInteractionHandler;t.endInteraction(),this._cameraControl.unlock(),this._environment instanceof W&&this._environment.addToScene();const n=this._getDragPosition(e.getPosition());n&&t.moveElementTo(e.getPlanElement(),r(n)),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds(!1),this._renderEverything()},this),this._getKernelAccess().addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this),this._renderListener=()=>{this._requestRender()},this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this),this.disableConfiguratorEvents(),this.enablePlannerEvents()}planCleared(){}planHistoryStateChanged(){this._sendWallDimensions()}_getViewModel(){return this._viewModel||(this._viewModel=new V(this._creator_)),this._viewModel}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new THREE.Vector3),i=e.distanceTo(n),a=t.getSize(new THREE.Vector3),s=Math.max(a.x,a.z)+3;if(i>s){const t=(new THREE.Vector3).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(s))}return null}_onSelectionChange(e){let t;const n={};if(e instanceof l&&(t="static"),e instanceof c&&(t="configuration"),e instanceof h&&(t="wall",n.wall=e.getWallDimension()),e instanceof l&&(n.item=e.getRapiItem()),e instanceof c){const t=e.getConfigurationRuntimeId();n.configurationRuntimeId=t}const i=(async()=>{const n={};if(e instanceof l&&(n.item=e.getRapiItem()),e instanceof c){const i=e.getConfigurationRuntimeId(),a=e.getPlanObject().getCatalogItemId(),s=this._getKernelAccess().kernelInstance.getHashOfConfiguration(i);let r;if(this._configuratorContext.planObjectId=i,this._configuratorContext.planElementId=e.getId(),this._configuratorContext.rootComponentId=e.getRootComponentRuntimeId(),a&&C(a)){const e=await this._rapiAccess.getItem(a);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._getKernelAccess().getConfigurationData(i),a=await this._rapiAccess.saveConfiguration(t);n.configuration=a,r=a.rootComponentId?a.rootComponentId:null}if(r){const e=await this._rapiAccess.getComponent(r);n.component=e}n.configurationRuntimeId=i,t="configuration"}return k(n)})();this.currentSelection=k(n),this._roomlePlannerUiCallback.onSelectionChange(k(this._plannerSceneEventHandler.getSelectionMode()),k(t),this.currentSelection,i)}_onSelectionCancel(e){this.resetConfiguratorContext(),this.currentSelection=null}resetConfiguratorContext(){this._configuratorContext.planObjectId=0,this._configuratorContext.planElementId=0,this._configuratorContext.rootComponentId=0,this._configuratorContext.dockingRootComponentId=0}_setupScene(e,t){super._setupScene(e,t,!0),this._lightSetting=new Y(this._scene,this._lightSetting),this._initData.moc?this._setEnvironment(new G(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND))):(this._addSky(),this._setEnvironment(new W(this._scene,this._environment)))}onBeforeRender(){this._cameraControl instanceof K&&this._plannerMeshGenerator.wallMeshes.forEach(e=>d(this._cameraControl.getCamera(),e.material))}_getInputManager(){return this._plannerInputManager}createCameraControl(e,t){this.setMode(e)}startViewing(){this._configuratorContext.baseContext="glb-viewer";const e=this._plannerSceneEventHandler.getSelectedIds();if(1===e.length){const t=this._getViewModel().getPlanObjectForId(e[0]);this._cameraControl instanceof K&&this._cameraControl.setObjectRotation(t.getPlanElement().rotation),this._getViewModel().hideAllExcept(t.getId())}this.resetCamera(),this.updateEnvironment(this.getBounds(),!0)}startConfiguring(){var e;this._configuratorContext.baseContext="configurator";const t=this._plannerSceneEventHandler.getSelectedIds();if(1===t.length&&this._cameraControl instanceof K){const e=this._getViewModel().getPlanObjectForId(t[0]);this._cameraControl.setObjectRotation(e.getPlanElement().rotation)}const{planObjectId:n,planElementId:i}=this._configuratorContext;this._getViewModel().hideAllExcept(i),this.resetCamera(),this.disablePlannerEvents(),this.enableConfiguratorEvents(),this.updateScene(),this._getKernelAccess().updatePlanObjectDependencies(n),this._getKernelAccess().requestPartListAndUpdatePricesOfParts(),this._getKernelAccess().planObjectUpdated(n),this.updateEnvironment(this.getBounds(),!0);const a=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==a||a.startInteraction()}selectPlanObject(e){if(this._plannerSceneEventHandler.getSelectedIds().includes(e))return;const t=this._getViewModel().getPlanObjectForId(e);this._plannerSceneEventHandler.selectPlanElement(t)}backToPlanner(){var e;if(this._getViewModel().showAll(),"configurator"===this._configuratorContext.baseContext){const t=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==t||t.endInteraction()}this._configuratorContext.baseContext="planner",this._cameraControl instanceof K&&this._cameraControl.setObjectRotation(0),this.resetCamera(),this.enablePlannerEvents(),this.disableConfiguratorEvents(),this.updateScene()}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart()}resetCameraToState(){this._cameraControl.resetToState()}_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._getViewModel().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._getKernelAccess().catalogItemLoaded(t),e.get(t.id).forEach(e=>{n.push(new Promise((n,i)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},i)}))})}),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=_(t);this._updateBounds(n),this.loadStaticPlanObjects()}planCompletelyLoaded(e){this._stopRendering=!1,this._renderEverything(),this.resetCamera()}handlerSwitchedPlans(e,t){if(this._getViewModel().setReference(t),this._getKernelAccess().coupleReferences(this._getViewModel(),t),this._getViewModel().setPlannerSceneEventHandler(this._plannerSceneEventHandler),this._getViewModel().setGeometriesMergedListener(()=>{this._renderEverything()}),this._plannerSceneEventHandler.setPlanViewModel(this._getViewModel()),e&&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._getViewModel().getCorePlan();if(this._pixotron){const t=_(e.getBounds());this._pixotron.getShadowPass().setShadowRecieverBBox(t)}this._roomlePlannerUiCallback.onCompletelyLoaded(),this._pixotronUtil&&this._getViewModel().materialQueue.finished(!0).then(()=>{this._pixotronUtil.unLockAdapter()}),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),g.end("loadingTime")}beginPlanConstruction(e){}addPlanMesh(e,t,n,i,a,s,r){}endPlanConstruction(e){this._renderLoopFunction=()=>{this._scene.add(this._getViewModel().getConstructionGroup()),this._scene.add(this._getViewModel().getCeilingGroup()),this._scene.add(this._getViewModel().getFloorGroup()),this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(this._getViewModel().getBoundingBox()),this._scene.remove(this._preloadScene)}}addPlanObjectToScene(e){if(e){const t=e.getContainer();p(t),this._scene.add(t),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.selectPlanElement(e),this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender()),this._roomlePlannerUiCallback.onPlanChanged(),this._roomlePlannerUiCallback.onPlanElementChanged()}setTimeout(()=>{this._zoomToBounds(!1)},0),this._renderEverything()}removePlanObjectFromScene(e){this._scene.remove(e.getContainer()),e.clear(),this.updateEnvironment(this.getBounds()),this._zoomToBounds(!0),this._renderEverything(),this._roomlePlannerUiCallback.onPlanElementChanged()}planElementChanged(e,t){this._drawingEnabled&&this._sendWallDimensions(!1),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),this._onPlanChanged(),this._roomlePlannerUiCallback.onPlanElementChanged()}exportGLB(e,t){this._scriptLoader.fetch(R,{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._getViewModel().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 Y&&this._lightSetting.updateSunPosition(.3,.25)}switchTo2D(){this._onCameraMove(),this._cameraControl instanceof U||(this._plannerMeshGenerator.wallMeshes.forEach(e=>m(e.material,!1,!1)),this._getViewModel().setCameraType("2D"),this._renderEverything(),this._changeCameraControl(new U(this._creator_,this._getInputManager(),null,this.getOrthographicOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("2D"),this._setCameraControlListeners())}switchTo3D(){this._onCameraMove(),this._cameraControl instanceof K||(this._getViewModel().setCameraType("3D"),this._renderEverything(),this._changeCameraControl(new K(this._creator_,this._getInputManager(),new THREE.Vector3(0,10,0),this.getPerspectiveOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("3D"),this._setCameraControlListeners())}_setCameraControlListeners(){this._cameraControl.addEventListener(8,()=>{this._onCameraIdle()},this),this._cameraControl.addEventListener(1,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(3,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(4,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(5,()=>{this._onCameraZoomChange()},this)}_onCameraZoomChange(){const e=this._cameraControl.getKernelZoomFactor();this._getKernelAccess().planInteractionHandler.setZoomFactor(e)}_setCeiling(){this._getViewModel()&&(this._cameraControl instanceof z?this._getViewModel().getCeilingGroup().visible=!0:this._getViewModel().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 K&&this._cameraControl.resetToState()}switchToFirstPerson(){if(this._cameraControl instanceof z)return;this._plannerMeshGenerator.wallMeshes.forEach(e=>m(e.material,!1,!1)),this._getViewModel().setCameraType("FP"),this._renderEverything();let e=new THREE.Vector3(0,0,0);this._getViewModel()&&(e=this._getViewModel().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"),this._setCameraControlListeners()}_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 K&&(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 K&&(this._cameraControl.disablePanning(),e.preventDefault()),!e.key||"Escape"!==e.key&&"Esc"!==e.key||this._drawingEnabled&&(this.escapeDrawing(),this._roomlePlannerUiCallback.onDrawCancel())}setMode(e){switch(e){case"2D":this.switchTo2D();break;case"3D":this.switchTo3D();break;case"FP":this.switchToFirstPerson()}}_highlightPlanElement(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._getViewModel().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._getViewModel().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._getViewModel().constructComponents(e)}}addMesh(e,t,n,i,a,s){}_updateBounds(e){e&&("planner"===this._configuratorContext.baseContext&&this._updateCamera(e),super._updateBounds(e))}_updateCamera(e){if(e||(e=this.getBounds()),e){if(this._cameraControl instanceof K){const t=e.getSize(new THREE.Vector3),n=Math.max(t.x,t.z),i=this._initData.moc?.5*n*-1:5,a=this._initData.moc?q:70;this._cameraControl.updateAndReset(t,e.getCenter(new THREE.Vector3),-15,a,i,!1)}this._cameraControl instanceof U&&!this._drawingEnabled&&this._cameraControl.zoomToFitBounds(e,!0)}}_zoomToBounds(e){const t=this.getBounds();this._cameraControl instanceof K&&this._cameraControl.zoomToFitBounds(t),this._cameraControl instanceof U&&!this._drawingEnabled&&this._cameraControl.zoomToFitBounds(t,e)}updateCameraOnDrawWalls(){const e=this.getBounds();this._cameraControl instanceof U&&this._cameraControl.zoomToFitBounds(e,!1,!0)}getBounds(){return this._getViewModel()?this._getViewModel().getBoundingBox():null}cancelPlanElementSelection(){this._plannerSceneEventHandler.cancelSelection(),this._highlightPlanElement(null),this._requestRender()}deletePlanElementSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelPlanElementSelection(),e.forEach(e=>{const t=this._getViewModel().getPlanObjectForId(e);t&&t.getObject()&&this._getKernelAccess().planInteractionHandler.removeElement(t.getKernelObject())})}rotatePlanElementSelection(e){const t=new(this._getKernelAccess().kernelContainer.PlanObjectPtrList),n=new THREE.Box3;this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const i=this._getViewModel().getPlanObjectForId(e);i&&i.getObject()&&(t.push_back(i.getPlanObject()),n.expandByObject(i.getContainer()))});const i=n.getCenter(new THREE.Vector3),a=this._getKernelAccess().planInteractionHandler.groupObjects(t);this._getKernelAccess().planInteractionHandler.rotateGroupBy(a,e,r(i))}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender()}planElementRemoved(e){this._onPlanChanged(),this._renderEverything()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={}){return new Promise(t=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{let n=this._calculateBoundingBoxOfAllMeshes(.1);this._lightSetting.removeFromScene();let i=await A(this._scene,null,n,e);this._lightSetting.addToScene(),this._requestRender(),t(i)})})}preparePerspectiveImage(e={}){return"configurator"===this._configuratorContext.baseContext?super.preparePerspectiveImage(e):new Promise((t,n)=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{let n;n=this._cameraControl instanceof K?this._cameraControl.getCamera().clone():this.getPerspectiveOffsetCamera();let i=this._calculateBoundingBoxOfAllMeshes();this._lightSetting.removeFromScene();const a=await x(this._scene,null,n,i,e);this._lightSetting.addToScene(),this._requestRender(),t(a)},n)})}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return j(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}enableSnapping(){this._plannerSceneEventHandler.enableSnapping()}disableSnapping(){this._plannerSceneEventHandler.disableSnapping()}dragIn(e){this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}disablePlannerEvents(){this._plannerSceneEventHandler.disable()}enablePlannerEvents(){this._plannerSceneEventHandler.enable()}_onCameraIdle(){return super._onCameraIdle()&&(this._sendWallDimensions(),this._sendPlanObjectPositions()),!0}_onCameraMove(){return super._onCameraMove()&&(this._roomlePlannerUiCallback.disableWallDimensions(),this._roomlePlannerUiCallback.cameraStartsMoving()),!0}_sendPlanObjectPositions(){if(this._cameraControl.isLocked())return;const{clientWidth:e,clientHeight:t}=this._domHelper.element,n=[];this._getViewModel().getStaticPlanObjectViewModels().forEach(i=>{const a=(new THREE.Box3).setFromObject(i.getContainer()).getCenter(new THREE.Vector3),s={planViewModel:i,position2d:u(a,this._cameraControl.getCamera(),e,t)};n.push(s)}),this._getViewModel().getConfigurablePlanObjectViewModels().forEach(i=>{const a=(new THREE.Box3).setFromObject(i.getContainer()).getCenter(new THREE.Vector3),s={planViewModel:i,position2d:u(a,this._cameraControl.getCamera(),e,t)};n.push(s)}),this._roomlePlannerUiCallback.enablePlanObjectPositions(n)}_sendWallDimensions(e=!0){if(this._cameraControl.isLocked()&&e)return;const t=[],{clientWidth:n,clientHeight:i}=this._domHelper.element;this._getViewModel().getWallPlanObjectViewModels().forEach(e=>{const a=e.getWallDimension();if(a.length>0&&(a.fromPosition2d=u(a.fromPosition3d,this._cameraControl.getCamera(),n,i),a.toPosition2d=u(a.toPosition3d,this._cameraControl.getCamera(),n,i),a.textPosition2d=u(a.textPosition3d,this._cameraControl.getCamera(),n,i),a.lengthFormatted=this._unitFormatter.formatMMValueToUnitString(a.length),t.push(a)),this._initData.debug){const e=new THREE.SphereGeometry(.1,32,16),t=new THREE.MeshBasicMaterial({color:16711680}),n=new THREE.Mesh(e,t);n.position.copy(a.fromPosition3d);const i=new THREE.Mesh(e,t);i.position.copy(a.toPosition3d);const s=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:65280}));s.position.copy(a.textPosition3d),this._scene.add(n),this._scene.add(i),this._scene.add(s)}}),this._roomlePlannerUiCallback.enableWallDimensions(t)}enableWallDrawing(){this._drawingEnabled=!0,this._plannerSceneEventHandler.enableWallDrawing(),this._plannerSceneEventHandler.addEventListener(11,this.drawingStart,this),this._plannerSceneEventHandler.addEventListener(12,this.drawingEnd,this)}disableWallDrawing(){this._drawingEnabled=!1,this._cameraControl.unlock(),this._plannerSceneEventHandler.cancelWallDrawing(),this._plannerSceneEventHandler.removeEventListener(11,this.drawingStart),this._plannerSceneEventHandler.removeEventListener(12,this.drawingEnd)}escapeDrawing(){this._plannerSceneEventHandler.escapeDrawing()}drawingStart(){this._cameraControl.lock()}drawingEnd(){this._cameraControl.unlock()}_changeCameraControl(e){super._changeCameraControl(e),e instanceof U&&this._environment instanceof W&&this._plannerSceneEventHandler.enableWallEvents(),(e instanceof K||e instanceof z)&&this._environment instanceof W&&this._plannerSceneEventHandler.disableWallEvents()}}return i([a],e.prototype,"_rapiAccess",void 0),i([a],e.prototype,"_plannerMeshGenerator",void 0),i([a],e.prototype,"_plannerInputManager",void 0),i([a],e.prototype,"_roomlePlannerUiCallback",void 0),i([a],e.prototype,"_localStorageHelper",void 0),i([a],e.prototype,"_unitFormatter",void 0),e})();const ne={left:0,top:1,right:1,bottom:0};let ie=(()=>{class e{constructor(e){this._hscInstance=null,this._glbInstance=null,this._configurator=null,this._currentMode=1,this._creator_=e,this._kernelAccessCallback.addListener(this)}deleteSelection(){this._sceneManager.deletePlanElementSelection()}rotateSelection(e){this._sceneManager.rotatePlanElementSelection(e)}cancelSelection(){this._sceneManager.cancelPlanElementSelection()}init(e,t,n){return g.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._currentMode=1,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._currentMode=1,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(w,{id:"gltf-loader"}),n=this._scriptLoader.fetch(E,{id:"draco-loader"}),i=this._scriptLoader.fetch(N,{id:"tween-js"}),a=this._scriptLoader.fetch("static/Sky-6621935ea8a523af.js",{id:"sky-js"});Promise.all([t,n,i,a]).then(()=>{this._kernelReadyCallback=e;const{dls:t,ls:n,mode:i,stats:a}=this._initData;this._sceneManager||(this._sceneManager=new te(this._creator_,ne,this,i)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId);const s=v.createDynamicLightSettingSource(t,n);a&&this.showStats(),this.enableHD(s),this._planInteractionHandler&&this._kernelReadyCallback()})})}enableHD(e){return new Promise((t,n)=>{const i=()=>{this._sceneManager.enableHD(e),t()};this._threeLoader.fetch().then(()=>Promise.all(X.map(e=>this._scriptLoader.fetch(e,{id:e})))).then(()=>{this._scriptLoader.fetch(Q,{id:"pi-js"}).then(i,n)},n)})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){g.showBenchmarks()}getConfiguratorApi(){return this._configurator||(this._configurator=new B(this._creator_),this._configurator.setOverrides(this._initData),this._configurator.initSceneManager(this._sceneManager)),this._configurator}startViewing(){this._sceneManager.startViewing()}startConfiguring(){var e,t;this._sceneManager.startConfiguring();const n=this._sceneManager.currentSelection,i=(null===(e=n.item)||void 0===e?void 0:e.id)||(null===(t=n.configuration)||void 0===t?void 0:t.id);i&&this._configurator.notifyUiAboutNewLabel(i)}selectPlanObjectById(e){this._sceneManager.selectPlanObject(e)}backToPlanner(){this._sceneManager.backToPlanner()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);t.import("./configurator-3815d8dc.nomodule.js").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().initSceneManager(this._sceneManager),n.getApi().init(this._domHelper.element).then(()=>{this._hscInstance=n,e(this._hscInstance)})})});return this._currentMode=0,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-2d08a55b.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._currentMode=2,this.cancelSelection(),e}switchToPlanner(e){e&&this.loadPlan(e),this._currentMode=1}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()}onCloseHSC(){this._sceneManager.closeHSC(),this._hscInstance&&this._hscInstance.getApi().pauseKernelCallbacks()}back(){if(2===this._currentMode&&this._glbInstance&&this._glbInstance.getApi().clearScene(),0===this._currentMode&&this._hscInstance){const e=this._hscInstance.getApi();e.cancelSelection(),e.cancelDockings(),e.hideDimensions(),e.disableMultiselect(),this._sceneManager.updateScene()}this._currentMode=1}backTo(e){console.error("backTo in planner Needs to be implemented later")}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");t&&(t=r(new THREE.Vector3(t.x,t.y,t.z)));const i=await(C(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),a=await this._plannerKernelAccess.addPlanObjectFromItem(i,t,n);return this._sceneManager.updateScene(),a}async insertItemList(e){const t=e.map(e=>C(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=[];const n=[],i=[],a=f(e.objects);await Promise.all(a.map(async e=>{const a=f(e);if(a.catalogItemId?n.push(a.catalogItemId):a.configurationHash&&i.push(a.configurationHash),a.parts){const e=a.configurationHash||a.catalogItemId,t=await this._plannerKernelAccess.addUiDataAndPriceToPartList(a.parts,e);a.parts=t}a.data=null,t.push(a)}));const[s,r]=await Promise.all([this._rapiAccess.getItems(n),this._rapiAccess.getConfigurations(i)]),o=[],l=new Map;for(const e of s)l.set(e.id,e);for(const e of r)l.set(e.id,e),o.push(e.rootComponentId);const h=await this._rapiAccess.getComponents(o),c=new Map;for(const e of h)c.set(e.id,e);for(const e of t){const t=e.catalogItemId||e.configurationHash,n=l.get(t)||null;if(n&&!n.label&&c.has(n.rootComponentId)){const e=c.get(n.rootComponentId);n.label=e.label}n&&!n.label&&(n.label=t),e.data=n}return t}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return f(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._sceneManager.enableSnapping()}disableSnapping(){this._sceneManager.disableSnapping()}async getPartlistOf(e){const t=this._plannerKernelAccess.kernelInstance.getHashOfConfiguration(e);if(!t){const e="Object has no partlist because it is not a configuration: "+t;return console.warn(e),Promise.reject(e)}const n=this._plannerKernelAccess.kernelInstance.getPartList(e);return await this._plannerKernelAccess.addUiDataAndPriceToPartList(n,t)}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}drawWalls(e,t={}){var n,i;const a=this._planInteractionHandler;a.startInteraction();const s=[];for(const t of e){const e=a.addNode(t.from),r=a.addNode(t.to),o=a.addWall(e,r);void 0!==(null===(n=t.props)||void 0===n?void 0:n.height)&&a.setWallHeight(o,t.props.height),void 0!==(null===(i=t.props)||void 0===i?void 0:i.thickness)&&a.setWallThickness(o,t.props.thickness),s.push(o)}return t.keepInteractionOpen||a.endInteraction(),this._sceneManager.updateCameraOnDrawWalls(),s}removeElements(e,t={}){const n=this._planInteractionHandler;n.startInteraction();for(const t of e)this._planInteractionHandler.removeElement(t);t.keepInteractionOpen||n.endInteraction()}hasWalls(){const e=this._planInteractionHandler,t=null==e?void 0:e.getPlan();return!(!t||t.getWallCount()<1)}enableWallDrawing(){this._sceneManager.enableWallDrawing()}disableWallDrawing(){this._sceneManager.disableWallDrawing()}getUnitFormatter(){return this._unitFormatter}}return i([a],e.prototype,"_domHelper",void 0),i([a],e.prototype,"_scriptLoader",void 0),i([a],e.prototype,"_kernelAccessCallback",void 0),i([a],e.prototype,"_plannerKernelAccess",void 0),i([a],e.prototype,"_rapiAccess",void 0),i([a],e.prototype,"_singlePromiseFactory",void 0),i([a],e.prototype,"_roomlePlannerUiCallback",void 0),i([a],e.prototype,"_lifeCycleManager",void 0),i([a],e.prototype,"_threeLoader",void 0),i([a],e.prototype,"_dataSyncer",void 0),i([a],e.prototype,"_initData",void 0),i([a],e.prototype,"_globalInitData",void 0),i([a],e.prototype,"_unitFormatter",void 0),e})();class ae{constructor(e){const{planElementViewModel:t}=e;this.planElementViewModel=t}}const se=[new M("script-loader",Z),new M("planner-input-manager",class extends S{_canDrag(e){return!0}},1),new M("logger",I),new M("planner-mesh-generator",P),new M("rapi-access",H),new M("planner-selection-handler",class extends b{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 ae({planElementViewModel:e}))})}_checkStandard(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new ae({planElementViewModel:e}));this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new ae({planElementViewModel:e}))}),this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new ae({planElementViewModel:e}))}_checkMulti(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new ae({planElementViewModel:e}));this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new ae({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 J{setupGlobals(){}setupDependencies(){y.setup(se),this.lookup("logger",this._context),this.lookup("planner-kernel-access",this._context).init(0)}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-81a22ec8.nomodule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-8b93848e.nomodule.js","sources":["../../node_modules/three/examples/js/objects/Sky.js"],"sourcesContent":["export default \"static/Sky-6621935ea8a523af.js\""],"names":[],"mappings":"28sCAAe"}
1
+ {"version":3,"file":"planner-81a22ec8.nomodule.js","sources":["../../node_modules/three/examples/js/objects/Sky.js"],"sourcesContent":["export default \"static/Sky-6621935ea8a523af.js\""],"names":[],"mappings":"28sCAAe"}
@@ -0,0 +1,2 @@
1
+ import"./query-params-helper-a271f9dc.js";import"./roomle-dependency-injection-b9111746.js";import"./main-thread-to-worker-681bab1a.js";import"./roomle-configurator-af533195.js";import{Planner}from"./planner-186d14e1.js";import"./pixotron-9f139c75.js";import"./script-loader-3390ceca.js";import"./default-light-setting-a373e78e.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-953e8696.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-main-953e8696.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- System.register(["./query-params-helper-c231e1b8.nomodule.js","./roomle-dependency-injection-fd4ee18d.nomodule.js","./main-thread-to-worker-7283a354.nomodule.js","./roomle-configurator-bf767216.nomodule.js","./planner-8b93848e.nomodule.js","./pixotron-710676a0.nomodule.js","./script-loader-ad588ab3.nomodule.js","./default-light-setting-ee7cd0ac.nomodule.js"],(function(){var e;return{setters:[function(){},function(){},function(){},function(){},function(n){e=n.Planner},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","./roomle-dependency-injection-f6cc9c17.nomodule.js","./main-thread-to-worker-7283a354.nomodule.js","./roomle-configurator-60558432.nomodule.js","./planner-81a22ec8.nomodule.js","./pixotron-82119b18.nomodule.js","./script-loader-29c29641.nomodule.js","./default-light-setting-86900b75.nomodule.js"],(function(){var e;return{setters:[function(){},function(){},function(){},function(){},function(n){e=n.Planner},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