@roomle/web-sdk 2.101.0-alpha.8 → 2.101.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 (198) hide show
  1. package/lib/{banana-for-scale-1b2f74f2.js → banana-for-scale-2377fbb7.js} +2 -2
  2. package/lib/{banana-for-scale-1b2f74f2.js.map → banana-for-scale-2377fbb7.js.map} +1 -1
  3. package/lib/{banana-for-scale-f917b709.nomodule.js → banana-for-scale-d8a216d3.nomodule.js} +2 -2
  4. package/lib/{banana-for-scale-f917b709.nomodule.js.map → banana-for-scale-d8a216d3.nomodule.js.map} +1 -1
  5. package/lib/camera-behaviour-3f3870c5.nomodule.js +2 -0
  6. package/lib/{camera-behaviour-23bb0632.nomodule.js.map → camera-behaviour-3f3870c5.nomodule.js.map} +1 -1
  7. package/lib/{camera-behaviour-65cbf7a9.js → camera-behaviour-95239f93.js} +2 -2
  8. package/lib/{camera-behaviour-65cbf7a9.js.map → camera-behaviour-95239f93.js.map} +1 -1
  9. package/lib/{component-dimensioning-b8f3ac83.nomodule.js → component-dimensioning-2feb82dd.nomodule.js} +2 -2
  10. package/lib/component-dimensioning-2feb82dd.nomodule.js.map +1 -0
  11. package/lib/{component-dimensioning-87f955e1.js → component-dimensioning-93bbf39b.js} +2 -2
  12. package/lib/component-dimensioning-93bbf39b.js.map +1 -0
  13. package/lib/{component-raycast-helper-20b8ab65.nomodule.js → component-raycast-helper-43a600c0.nomodule.js} +2 -2
  14. package/lib/component-raycast-helper-43a600c0.nomodule.js.map +1 -0
  15. package/lib/{component-raycast-helper-5e1d9061.js → component-raycast-helper-d4163971.js} +2 -2
  16. package/lib/component-raycast-helper-d4163971.js.map +1 -0
  17. package/lib/{configurator-b7c14c7e.nomodule.js → configurator-199df83b.nomodule.js} +2 -2
  18. package/lib/configurator-199df83b.nomodule.js.map +1 -0
  19. package/lib/{configurator-39439f9f.js → configurator-8bac2428.js} +2 -2
  20. package/lib/configurator-8bac2428.js.map +1 -0
  21. package/lib/configurator-main-1ffa3c8d.js +2 -0
  22. package/lib/configurator-main-1ffa3c8d.js.map +1 -0
  23. package/lib/configurator-main.nomodule.js +1 -1
  24. package/lib/{continuous-drawing-helper-c4d81566.js → continuous-drawing-helper-9541ee0e.js} +2 -2
  25. package/lib/continuous-drawing-helper-9541ee0e.js.map +1 -0
  26. package/lib/{continuous-drawing-helper-1b153523.nomodule.js → continuous-drawing-helper-fd647ca1.nomodule.js} +2 -2
  27. package/lib/continuous-drawing-helper-fd647ca1.nomodule.js.map +1 -0
  28. package/lib/{default-light-setting-d85282ec.js → default-light-setting-04cf417f.js} +2 -2
  29. package/lib/default-light-setting-04cf417f.js.map +1 -0
  30. package/lib/{default-light-setting-d1311475.nomodule.js → default-light-setting-99ee06de.nomodule.js} +2 -2
  31. package/lib/default-light-setting-99ee06de.nomodule.js.map +1 -0
  32. package/lib/definitions/common-core/src/input/input-manager.d.ts +11 -2
  33. package/lib/definitions/common-core/src/utils/dom-helper.d.ts +1 -0
  34. package/lib/definitions/configurator-core/mock/configurator-mock-data.d.ts +2 -0
  35. package/lib/definitions/packages/common-core/src/input/input-manager.d.ts +11 -2
  36. package/lib/definitions/packages/common-core/src/utils/dom-helper.d.ts +1 -0
  37. package/lib/definitions/packages/configurator-core/mock/configurator-mock-data.d.ts +2 -0
  38. package/lib/definitions/packages/planner-core/src/view-model/wall-plan-element-view-model.d.ts +1 -0
  39. package/lib/definitions/packages/planner-core/src/webgl/planner-scene-manager.d.ts +2 -0
  40. package/lib/definitions/planner-core/src/view-model/wall-plan-element-view-model.d.ts +1 -0
  41. package/lib/definitions/planner-core/src/webgl/planner-scene-manager.d.ts +2 -0
  42. package/lib/{dimensioning-helper-5ffd8f92.nomodule.js → dimensioning-helper-4669f95d.nomodule.js} +2 -2
  43. package/lib/{dimensioning-helper-5ffd8f92.nomodule.js.map → dimensioning-helper-4669f95d.nomodule.js.map} +1 -1
  44. package/lib/{dimensioning-helper-1ee2fe98.js → dimensioning-helper-86995ec9.js} +2 -2
  45. package/lib/{dimensioning-helper-1ee2fe98.js.map → dimensioning-helper-86995ec9.js.map} +1 -1
  46. package/lib/{glb-viewer-6f2aba24.js → glb-viewer-4a91f121.js} +2 -2
  47. package/lib/{glb-viewer-6f2aba24.js.map → glb-viewer-4a91f121.js.map} +1 -1
  48. package/lib/{glb-viewer-804883de.nomodule.js → glb-viewer-51e53d51.nomodule.js} +2 -2
  49. package/lib/{glb-viewer-804883de.nomodule.js.map → glb-viewer-51e53d51.nomodule.js.map} +1 -1
  50. package/lib/{glb-viewer-camera-behaviour-70a364c0.js → glb-viewer-camera-behaviour-17fdd74b.js} +2 -2
  51. package/lib/glb-viewer-camera-behaviour-17fdd74b.js.map +1 -0
  52. package/lib/{glb-viewer-camera-behaviour-83729568.nomodule.js → glb-viewer-camera-behaviour-50f47657.nomodule.js} +2 -2
  53. package/lib/glb-viewer-camera-behaviour-50f47657.nomodule.js.map +1 -0
  54. package/lib/glb-viewer-main-debc7956.js +2 -0
  55. package/lib/glb-viewer-main-debc7956.js.map +1 -0
  56. package/lib/glb-viewer-main.nomodule.js +1 -1
  57. package/lib/{imos-ix-poc-export-helper-18ca81d2.js → imos-ix-poc-export-helper-4e81bbdf.js} +2 -2
  58. package/lib/imos-ix-poc-export-helper-4e81bbdf.js.map +1 -0
  59. package/lib/{imos-ix-poc-export-helper-363b387a.nomodule.js → imos-ix-poc-export-helper-98a0e81e.nomodule.js} +2 -2
  60. package/lib/imos-ix-poc-export-helper-98a0e81e.nomodule.js.map +1 -0
  61. package/lib/legacy/{banana-for-scale-2f6d2539.legacy.js → banana-for-scale-504f1ad6.legacy.js} +2 -2
  62. package/lib/legacy/{banana-for-scale-2f6d2539.legacy.js.map → banana-for-scale-504f1ad6.legacy.js.map} +1 -1
  63. package/lib/legacy/camera-behaviour-4b8cdc30.legacy.js +2 -0
  64. package/lib/legacy/{camera-behaviour-93d5da66.legacy.js.map → camera-behaviour-4b8cdc30.legacy.js.map} +1 -1
  65. package/lib/legacy/{component-dimensioning-7434957b.legacy.js → component-dimensioning-33ff2f3a.legacy.js} +2 -2
  66. package/lib/legacy/component-dimensioning-33ff2f3a.legacy.js.map +1 -0
  67. package/lib/legacy/{component-raycast-helper-3ee11650.legacy.js → component-raycast-helper-e33caabb.legacy.js} +2 -2
  68. package/lib/legacy/component-raycast-helper-e33caabb.legacy.js.map +1 -0
  69. package/lib/legacy/{configurator-6d986be2.legacy.js → configurator-feb0fbbe.legacy.js} +2 -2
  70. package/lib/legacy/configurator-feb0fbbe.legacy.js.map +1 -0
  71. package/lib/legacy/configurator-main.legacy.js +1 -1
  72. package/lib/legacy/{continuous-drawing-helper-a7b33c02.legacy.js → continuous-drawing-helper-4173db6d.legacy.js} +2 -2
  73. package/lib/legacy/continuous-drawing-helper-4173db6d.legacy.js.map +1 -0
  74. package/lib/legacy/{default-light-setting-313288f6.legacy.js → default-light-setting-2d13914e.legacy.js} +2 -2
  75. package/lib/legacy/default-light-setting-2d13914e.legacy.js.map +1 -0
  76. package/lib/legacy/{dimensioning-helper-efb5831f.legacy.js → dimensioning-helper-7d1badad.legacy.js} +2 -2
  77. package/lib/legacy/{dimensioning-helper-efb5831f.legacy.js.map → dimensioning-helper-7d1badad.legacy.js.map} +1 -1
  78. package/lib/legacy/{glb-viewer-a93e80f4.legacy.js → glb-viewer-54c19616.legacy.js} +2 -2
  79. package/lib/legacy/{glb-viewer-a93e80f4.legacy.js.map → glb-viewer-54c19616.legacy.js.map} +1 -1
  80. package/lib/legacy/{glb-viewer-camera-behaviour-326dd288.legacy.js → glb-viewer-camera-behaviour-bcc5faae.legacy.js} +2 -2
  81. package/lib/legacy/glb-viewer-camera-behaviour-bcc5faae.legacy.js.map +1 -0
  82. package/lib/legacy/glb-viewer-main.legacy.js +1 -1
  83. package/lib/legacy/{imos-ix-poc-export-helper-29f473ec.legacy.js → imos-ix-poc-export-helper-466840ef.legacy.js} +2 -2
  84. package/lib/legacy/imos-ix-poc-export-helper-466840ef.legacy.js.map +1 -0
  85. package/lib/legacy/{material-viewer-01dc1ff6.legacy.js → material-viewer-205cab5c.legacy.js} +2 -2
  86. package/lib/legacy/material-viewer-205cab5c.legacy.js.map +1 -0
  87. package/lib/legacy/material-viewer-main.legacy.js +1 -1
  88. package/lib/legacy/planner-e3cee8ba.legacy.js +2 -0
  89. package/lib/legacy/{planner-a87498bf.legacy.js.map → planner-e3cee8ba.legacy.js.map} +1 -1
  90. package/lib/legacy/planner-main.legacy.js +1 -1
  91. package/lib/legacy/roomle-configurator-b38e1351.legacy.js +2 -0
  92. package/lib/legacy/{roomle-configurator-0226891c.legacy.js.map → roomle-configurator-b38e1351.legacy.js.map} +1 -1
  93. package/lib/legacy/roomle-dependency-injection-ae5afa9a.legacy.js +9 -0
  94. package/lib/legacy/{roomle-dependency-injection-3f47127d.legacy.js.map → roomle-dependency-injection-ae5afa9a.legacy.js.map} +1 -1
  95. package/lib/legacy/roomle-sdk.legacy.js +1 -1
  96. package/lib/legacy/{script-loader-ad2c9b81.legacy.js → script-loader-4df671c2.legacy.js} +2 -2
  97. package/lib/legacy/script-loader-4df671c2.legacy.js.map +1 -0
  98. package/lib/legacy/static/{ConfiguratorKernel-f6bee740a3d99316.wasm → ConfiguratorKernel-7a35323bd5bc25ce.wasm} +0 -0
  99. package/lib/legacy/static/{RoomleCore-71e1c2d896d965c6.wasm → RoomleCore-741963c887f13583.wasm} +0 -0
  100. package/lib/{static/RoomleToolsCore-455b548d45396129.wasm → legacy/static/RoomleToolsCore-daa987b1e14cd78b.wasm} +0 -0
  101. package/lib/legacy/{stats-helper-c0791263.legacy.js → stats-helper-f1658191.legacy.js} +2 -2
  102. package/lib/legacy/stats-helper-f1658191.legacy.js.map +1 -0
  103. package/lib/legacy/{tools-core-86640c21.legacy.js → tools-core-b292bd7b.legacy.js} +2 -2
  104. package/lib/legacy/tools-core-b292bd7b.legacy.js.map +1 -0
  105. package/lib/{material-viewer-65e23374.js → material-viewer-48f21f88.js} +2 -2
  106. package/lib/material-viewer-48f21f88.js.map +1 -0
  107. package/lib/{material-viewer-63b07e30.nomodule.js → material-viewer-c700a0d7.nomodule.js} +2 -2
  108. package/lib/material-viewer-c700a0d7.nomodule.js.map +1 -0
  109. package/lib/material-viewer-main-c3f13949.js +2 -0
  110. package/lib/material-viewer-main-c3f13949.js.map +1 -0
  111. package/lib/material-viewer-main.nomodule.js +1 -1
  112. package/lib/planner-c3c524b4.js +2 -0
  113. package/lib/{planner-2a039e9f.js.map → planner-c3c524b4.js.map} +1 -1
  114. package/lib/planner-ce5d1586.nomodule.js +2 -0
  115. package/lib/{planner-3c57c810.nomodule.js.map → planner-ce5d1586.nomodule.js.map} +1 -1
  116. package/lib/planner-main-756e97f2.js +2 -0
  117. package/lib/planner-main-756e97f2.js.map +1 -0
  118. package/lib/planner-main.nomodule.js +1 -1
  119. package/lib/roomle-configurator-0ac5491c.js +2 -0
  120. package/lib/{roomle-configurator-e3f31c92.js.map → roomle-configurator-0ac5491c.js.map} +1 -1
  121. package/lib/roomle-configurator-bcabeac0.nomodule.js +2 -0
  122. package/lib/{roomle-configurator-14044b01.nomodule.js.map → roomle-configurator-bcabeac0.nomodule.js.map} +1 -1
  123. package/lib/roomle-dependency-injection-0bc1cf6d.js +9 -0
  124. package/lib/{roomle-dependency-injection-01a78f6e.js.map → roomle-dependency-injection-0bc1cf6d.js.map} +1 -1
  125. package/lib/roomle-dependency-injection-c8412f95.nomodule.js +9 -0
  126. package/lib/{roomle-dependency-injection-75ec793f.nomodule.js.map → roomle-dependency-injection-c8412f95.nomodule.js.map} +1 -1
  127. package/lib/{roomle-sdk-2341bf37.js → roomle-sdk-9e0df6d6.js} +2 -2
  128. package/lib/roomle-sdk-9e0df6d6.js.map +1 -0
  129. package/lib/roomle-sdk.nomodule.js +1 -1
  130. package/lib/{script-loader-0235f691.nomodule.js → script-loader-0f0f1813.nomodule.js} +2 -2
  131. package/lib/script-loader-0f0f1813.nomodule.js.map +1 -0
  132. package/lib/{script-loader-f3bb5970.js → script-loader-4c2eca55.js} +2 -2
  133. package/lib/script-loader-4c2eca55.js.map +1 -0
  134. package/lib/static/{ConfiguratorKernel-f6bee740a3d99316.wasm → ConfiguratorKernel-7a35323bd5bc25ce.wasm} +0 -0
  135. package/lib/static/{RoomleCore-71e1c2d896d965c6.wasm → RoomleCore-741963c887f13583.wasm} +0 -0
  136. package/lib/{legacy/static/RoomleToolsCore-455b548d45396129.wasm → static/RoomleToolsCore-daa987b1e14cd78b.wasm} +0 -0
  137. package/lib/{stats-helper-a179724b.js → stats-helper-004db0c3.js} +2 -2
  138. package/lib/stats-helper-004db0c3.js.map +1 -0
  139. package/lib/{stats-helper-11b1b15b.nomodule.js → stats-helper-d713330d.nomodule.js} +2 -2
  140. package/lib/stats-helper-d713330d.nomodule.js.map +1 -0
  141. package/lib/{tools-core-84d110dc.js → tools-core-d10738f6.js} +2 -2
  142. package/lib/tools-core-d10738f6.js.map +1 -0
  143. package/lib/{tools-core-0da648d5.nomodule.js → tools-core-ed473df8.nomodule.js} +2 -2
  144. package/lib/tools-core-ed473df8.nomodule.js.map +1 -0
  145. package/package.json +2 -2
  146. package/lib/camera-behaviour-23bb0632.nomodule.js +0 -2
  147. package/lib/component-dimensioning-87f955e1.js.map +0 -1
  148. package/lib/component-dimensioning-b8f3ac83.nomodule.js.map +0 -1
  149. package/lib/component-raycast-helper-20b8ab65.nomodule.js.map +0 -1
  150. package/lib/component-raycast-helper-5e1d9061.js.map +0 -1
  151. package/lib/configurator-39439f9f.js.map +0 -1
  152. package/lib/configurator-b7c14c7e.nomodule.js.map +0 -1
  153. package/lib/configurator-main-2692cc2c.js +0 -2
  154. package/lib/configurator-main-2692cc2c.js.map +0 -1
  155. package/lib/continuous-drawing-helper-1b153523.nomodule.js.map +0 -1
  156. package/lib/continuous-drawing-helper-c4d81566.js.map +0 -1
  157. package/lib/default-light-setting-d1311475.nomodule.js.map +0 -1
  158. package/lib/default-light-setting-d85282ec.js.map +0 -1
  159. package/lib/glb-viewer-camera-behaviour-70a364c0.js.map +0 -1
  160. package/lib/glb-viewer-camera-behaviour-83729568.nomodule.js.map +0 -1
  161. package/lib/glb-viewer-main-a3c87c89.js +0 -2
  162. package/lib/glb-viewer-main-a3c87c89.js.map +0 -1
  163. package/lib/imos-ix-poc-export-helper-18ca81d2.js.map +0 -1
  164. package/lib/imos-ix-poc-export-helper-363b387a.nomodule.js.map +0 -1
  165. package/lib/legacy/camera-behaviour-93d5da66.legacy.js +0 -2
  166. package/lib/legacy/component-dimensioning-7434957b.legacy.js.map +0 -1
  167. package/lib/legacy/component-raycast-helper-3ee11650.legacy.js.map +0 -1
  168. package/lib/legacy/configurator-6d986be2.legacy.js.map +0 -1
  169. package/lib/legacy/continuous-drawing-helper-a7b33c02.legacy.js.map +0 -1
  170. package/lib/legacy/default-light-setting-313288f6.legacy.js.map +0 -1
  171. package/lib/legacy/glb-viewer-camera-behaviour-326dd288.legacy.js.map +0 -1
  172. package/lib/legacy/imos-ix-poc-export-helper-29f473ec.legacy.js.map +0 -1
  173. package/lib/legacy/material-viewer-01dc1ff6.legacy.js.map +0 -1
  174. package/lib/legacy/planner-a87498bf.legacy.js +0 -2
  175. package/lib/legacy/roomle-configurator-0226891c.legacy.js +0 -2
  176. package/lib/legacy/roomle-dependency-injection-3f47127d.legacy.js +0 -9
  177. package/lib/legacy/script-loader-ad2c9b81.legacy.js.map +0 -1
  178. package/lib/legacy/stats-helper-c0791263.legacy.js.map +0 -1
  179. package/lib/legacy/tools-core-86640c21.legacy.js.map +0 -1
  180. package/lib/material-viewer-63b07e30.nomodule.js.map +0 -1
  181. package/lib/material-viewer-65e23374.js.map +0 -1
  182. package/lib/material-viewer-main-a6a7169c.js +0 -2
  183. package/lib/material-viewer-main-a6a7169c.js.map +0 -1
  184. package/lib/planner-2a039e9f.js +0 -2
  185. package/lib/planner-3c57c810.nomodule.js +0 -2
  186. package/lib/planner-main-10c68cf5.js +0 -2
  187. package/lib/planner-main-10c68cf5.js.map +0 -1
  188. package/lib/roomle-configurator-14044b01.nomodule.js +0 -2
  189. package/lib/roomle-configurator-e3f31c92.js +0 -2
  190. package/lib/roomle-dependency-injection-01a78f6e.js +0 -9
  191. package/lib/roomle-dependency-injection-75ec793f.nomodule.js +0 -9
  192. package/lib/roomle-sdk-2341bf37.js.map +0 -1
  193. package/lib/script-loader-0235f691.nomodule.js.map +0 -1
  194. package/lib/script-loader-f3bb5970.js.map +0 -1
  195. package/lib/stats-helper-11b1b15b.nomodule.js.map +0 -1
  196. package/lib/stats-helper-a179724b.js.map +0 -1
  197. package/lib/tools-core-0da648d5.nomodule.js.map +0 -1
  198. package/lib/tools-core-84d110dc.js.map +0 -1
@@ -1,2 +0,0 @@
1
- System.register(["./roomle-dependency-injection-3f47127d.legacy.js","./main-thread-to-worker-32b45184.legacy.js"],(function(e,t){var i,s,n,a,o,r,h,l,c,d,_,m,u,g,p,v,f,y,w,x,b,M,C,P,S,L,E,I,D,k,B,R,z,T,A,O,F,U,j,H,N,q,G,Z,V,W,K,Y,X,J,Q,$,ee,te,ie,se,ne,ae,oe,re,he,le,ce,de,_e,me,ue,ge,pe,ve,fe,ye,we,xe,be,Me,Ce,Pe,Se,Le,Ee,Ie,De,ke,Be,Re,ze,Te,Ae,Oe,Fe,Ue,je,He,Ne,qe,Ge,Ze,Ve,We,Ke,Ye;return{setters:[function(e){i=e._,s=e.i,n=e.E,a=e.G,o=e.a8,r=e.a9,h=e.w,l=e.Y,c=e.$,d=e.aa,_=e.ab,m=e.ac,u=e.ad,g=e.c,p=e.y,v=e.ae,f=e.af,y=e.ag,w=e.k,x=e.z,b=e.ah,M=e.s,C=e.t,P=e.ai,S=e.m,L=e.aj,E=e.ak,I=e.n,D=e.al,k=e.am,B=e.an,R=e.ao,z=e.ap,T=e.aq,A=e.ar,O=e.as,F=e.at,U=e.au,j=e.av,H=e.V,N=e.O},function(e){q=e.a,G=e.bQ,Z=e.J,V=e.V,W=e.bS,K=e.al,Y=e.bW,X=e.Q,J=e.ao,Q=e.aK,$=e.t,ee=e.C,te=e.bX,ie=e.x,se=e.Y,ne=e.y,ae=e.b7,oe=e.bY,re=e.aY,he=e.ak,le=e.B,ce=e.bZ,de=e.b_,_e=e.O,me=e.l,ue=e.b$,ge=e.c0,pe=e.c1,ve=e.ad,fe=e.c2,ye=e.q,we=e.u,xe=e.b6,be=e.S,Me=e.A,Ce=e.D,Pe=e.R,Se=e._,Le=e.e,Ee=e.k,Ie=e.a$,De=e.a0,ke=e.h,Be=e.bi,Re=e.b8,ze=e.s,Te=e.c3,Ae=e.ax,Oe=e.aw,Fe=e.az,Ue=e.ap,je=e.ag,He=e.at,Ne=e.K,qe=e.c4,Ge=e.bV,Ze=e.bL,Ve=e.j,We=e.bw,Ke=e.bT,Ye=e.c5}],execute:function(){e("R",tt),e("T","static/Tween-d57ee5d181fce582.js");class Xe extends n{constructor(e,t,i){var s,n;super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._distance=-1,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=e,this._inputManager=t,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new q,this._targetPosition=new q,i?this.setCurrentCameraParameters(i):(this._cameraPosition=new q(0,.5,3),this._pitch=a(null!==(s=this._initData.verticalCameraAngle)&&void 0!==s?s:10),this._yaw=a(null!==(n=this._initData.horizontalCameraAngle)&&void 0!==n?n:-30));let o=this._domHelper.getClientDimensions();this._width=o.x,this._height=o.y,this._dispatchCameraIdle=G(this._dispatchCameraIdle.bind(this),32)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.addEventListener(e.key,e.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.removeEventListener(e.key,e.fun)}),this._inputListeners=[]}setUp(){this._addInputListeners()}cleanUp(){this._removeInputListeners()}animateCamera(e){let t=this._cameraPosition;if(!t||o(t,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,setTimeout(()=>this._dispatchCameraIdle(),16),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,3),this._cameraStandingStill=!1,!this._lerpEnabled||this._tweenEnd||this._globalInitData.e2e)this.getCamera().position.copy(t);else{let i=this.getCamera().position.clone();const s=Math.min(10*e,1);i.lerp(t,s),this.getCamera().position.copy(i)}return!0}getDebugCameraPosition(){return JSON.parse(localStorage.getItem("debug_camera_position"))}saveDebugCameraPosition(){localStorage.setItem("debug_camera_position",JSON.stringify(this.getCurrentCameraParameters()))}_dispatchCameraIdle(){this.dispatchEvent(8,3)}_tweenCameraParameter(e,t,i=!1){return this._globalInitData.e2e||!this._initData.animateCamera?(this.dispatchEvent(0,3),this.dispatchEvent(1,3),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._setCameraNear(),this._update(new q(t.targetX,t.targetY,t.targetZ),i),this.dispatchEvent(1,3),this.dispatchEvent(2,3),this.dispatchEvent(8,3),Promise.resolve()):new Promise(s=>{if(t.yaw-e.yaw<=-Math.PI?e.yaw-=2*Math.PI:t.yaw-e.yaw>=Math.PI&&(e.yaw+=2*Math.PI),window.TWEEN){if(null!==this._tweenEnd&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=t,new TWEEN.Tween(e).to(t,400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,3),this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._setCameraNear(),this._update(new q(e.targetX,e.targetY,e.targetZ),i,!0)}).onComplete(()=>{this.dispatchEvent(2,3),this._dispatchCameraIdle(),this._tweenEnd=null,s()}).start(),this.dispatchEvent(0,3)}})}_setCameraNear(){const e=this.getCamera();if(e instanceof Z){const t=Math.max(.1,this._distance/6);e.near=t}}getCurrentCameraParameters(){const e=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z}}setCurrentCameraParameters(e){var t,i,s;this._yaw=null!==(t=e.yaw)&&void 0!==t?t:0,this._pitch=null!==(i=e.pitch)&&void 0!==i?i:0,this._distance=null!==(s=e.distance)&&void 0!==s?s:0,this._targetPosition.copy(new q(e.targetX,e.targetY,e.targetZ)),this._update(null,!0,!0)}_rotateHorizontal(e){this._yaw-=e,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(e){this._pitch+=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(e){if(e||!this._stateSaved){let e=this._yaw,t=this._pitch,i=this._distance,s=this._targetPosition.clone();if(this._stateSaved={yaw:e,pitch:t,distance:i,targetX:s.x,targetY:s.y,targetZ:s.z,blockOtherTweens:!0},this._getCamera().fov){let e=this._getCamera();this._stateSaved.fov=e.fov,this._stateSaved.near=e.near,this._stateSaved.far=e.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;let e=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z},this._stateSaved,!0)}this._stateSaved=null}async setToState(e,t){await this._tweenCameraParameter(e,t,!0)}hasSavedState(){return null!=this._stateSaved}lock(){this._locked=!0}unlock(){this._locked=!1}isLocked(){return this._locked}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(e){const{x:t,y:i}=this._domHelper.getClientDimensions();return new q(e.x/t*2-1,-e.y/i*2+1,.5)}addLightContainer(e){e.name="lights";const t=this._getCamera(),i=t.children.find(e=>"lights"===e.name);i&&t.remove(i),t.add(e)}checkNearFarDistance(e){if(!e)return;const t=this._cameraPosition.distanceTo(e),i=this._getCamera();i instanceof Z&&t>i.far&&(i.far=t+1)}setBounds(e){this._boundingBox=e}get domHelper(){return this._domHelper}}e("a",Xe),i([s],Xe.prototype,"_domHelper",void 0),i([s],Xe.prototype,"_initData",void 0),i([s],Xe.prototype,"_globalInitData",void 0);class Je{constructor(e,t){this.minZoom=!1,this.maxZoom=!1,this.minZoom=e,this.maxZoom=t}}e("D",2.725);class Qe extends Xe{constructor(e,t,i,s){super(e,t,i),this._bounds=new q,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,3),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=a(0),this.maxPolarAngle=a(85),this._objectRotation=0,this._lookAtSide=0,this.minAzimuthAngle=Number.NEGATIVE_INFINITY,this.maxAzimuthAngle=Number.POSITIVE_INFINITY,this._zoomDistance=.1,this._userInteraction=!1,this._currentZoomHash="",this._maxZoomedIn=!1,this._maxZoomedOut=!1,this._panningEnabled=!1,this._targetPositionIsPanned=!1,s?this._camera=s:this._initCamera(),this._camera.fov=30,this._targetPosition||(this._targetPosition=new q(0,0,0),this._targetPositionIsPanned=!1);const{cameraRestriction:n,zoomDistance:o,minVerticalCameraAngle:r,maxVerticalCameraAngle:h,minHorizontalCameraAngle:l,maxHorizontalCameraAngle:c}=this._initData;if(o&&(this._zoomDistance=o/100),void 0!==r&&(this.minPolarAngle=a(r<0?r:-1*r)),void 0!==h&&(this.maxPolarAngle=a(h)),void 0!==l&&(this.minAzimuthAngle=a(l<0?l:-1*l)),void 0!==c&&(this.maxAzimuthAngle=a(c)),void 0!==n){let e=Math.abs(a(n));this.minAzimuthAngle=-e,this.maxAzimuthAngle=e,this.maxPolarAngle=Math.min(e,a(85))}this._update()}_getCamera(){return this._camera||this._initCamera(),this._camera}getCamera(){return super.getCamera()}_initCamera(){this._camera=new Z,this._camera.fov=30,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5)}setObjectRotation(e,t=0){this._objectRotation=e,this._lookAtSide=t}getObjectRotation(){return this._objectRotation}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix()}animateCamera(e){if(!super.animateCamera(e))return!1;let t=this._targetPosition;return!!t&&(this.getCamera().lookAt(t),!0)}_initInputListener(){this._inputListeners.push({key:3,fun:()=>{this._state=1}}),this._inputListeners.push({key:6,fun:e=>{var t,i;1!==this._state||this._locked||(this._userInteraction=!0,!(void 0!==(null===(t=e.event)||void 0===t?void 0:t.shiftKey)&&(null===(i=e.event)||void 0===i?void 0:i.shiftKey))&&this._panningEnabled&&this.disablePanning(),this._move(new V(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:11,fun:e=>{1===this._state||this._locked||(this._userInteraction=!0,this._pan(new V(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:4,fun:e=>{1===this._state&&this.dispatchEvent(2,e.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:7,fun:({event:e})=>{this._maxZoomedIn||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:8,fun:({event:e})=>{this._maxZoomedOut||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomOut())}})}_panTargetPosition(e){const t=e.clone().sub(this._orbitPosition),i=this._domHelper.element,s=this._targetPosition.project(this._camera),n=Math.max(2,4*(1-this._distance/this.maxDistance));s.x=s.x-t.x/i.clientHeight*n,s.y=s.y+t.y/i.clientHeight*n,this._targetPositionIsPanned=!0,this._targetPosition.copy(s.unproject(this._camera))}_pan(e,t){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new V(e.x,e.y),this.dispatchEvent(0,t)),this._panTargetPosition(e),r(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}_move(e,t){this._orbitPosition||(this._orbitPosition=new V(e.x,e.y),this.dispatchEvent(0,t));const i=e.clone().sub(this._orbitPosition),s=this._domHelper.element;this._panningEnabled?this._panTargetPosition(e):(this._rotateHorizontal(2*Math.PI*i.x/s.clientWidth*1),this._rotateVertical(2*Math.PI*i.y/s.clientHeight*1)),r(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}checkBoundsAndPlaceCamera(e,t=!0){this._boundingBox&&h(e,this._boundingBox)<=0?this.setBounds(e):this.zoomToFitBounds(e,t)}adjustToBoundsWithoutChangingDistance(e){this.setBounds(e);const t=e.getSize(new q);if(this._initData.debug||t.x+t.y+t.z===0)return;const i=this.getCurrentCameraParameters(),s=e.getCenter(new q);this._setDistanceAndRangesBasedOnBounds(t,!1);const n={yaw:i.yaw,pitch:i.pitch,distance:this._distance,targetX:s.x,targetY:s.y,targetZ:s.z};W(i,n)||this._tweenCameraParameter(i,n,!1)}zoomToFitBounds(e,t=!0){this.setBounds(e);const i=e.getSize(new q);if(this._initData.debug||i.x+i.y+i.z===0)return;const s=this.getCurrentCameraParameters(),n=e.getCenter(new q),a=this._setDistanceAndRangesBasedOnBounds(i);this._checkZoomDistance(e,a);const o={yaw:t?this._yaw:s.yaw,pitch:t?this._pitch:s.pitch,distance:a,targetX:n.x,targetY:n.y,targetZ:n.z};W(s,o)||this._tweenCameraParameter(s,o,!1)}updateToBounds(e,t,i=!0,s){if(this.setBounds(e),this._initData.debug)return;const n=e.getCenter(new q);s?(this._targetPosition=s.clone(),this._targetPositionIsPanned=!1):this._targetPositionIsPanned||(this._targetPosition=new q(n.x,n.y,n.z));const a=this.getCurrentCameraParameters(),o=e.getSize(new q);if(i){const i=this._setDistanceAndRangesBasedOnBounds(o);this._distance=i,this._checkZoomDistance(e,i),this._userInteraction?this._tweenCameraParameter(a,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},t):this._update()}else this._setDistanceAndRangesBasedOnBounds(o,!1);this._update()}_checkZoomDistance(e,t){const i=e.getBoundingSphere(new K);t-i.radius<this._zoomDistance&&(console.warn("the initial camera position is closer than the zoomDistance param, zoomDistance is set to initial camera position."),this._zoomDistance=t-i.radius)}_setDistanceAndRangesBasedOnBounds(e,t=!0){const{offsetWidth:i,offsetHeight:s}=this._getOffset();this._bounds.copy(e);const{cameraSpacing:n}=this._initData;e.addScalar(n/100),this.minDistance=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z);const a=Math.max(e.x,e.y),{x:o,y:r}=this._getMargin(i,s),h=l(e.x+o,e.y+r,e.z,this._camera.fov,i,s);return this._distance<h&&t&&(this._distance=h),this.maxDistance=h+a,this.maxDistance<2&&(this.maxDistance=2),this._camera.far=5*this.maxDistance,this._setCameraNear(),h}_getIdealDistance(){const{offsetWidth:e,offsetHeight:t}=this._getOffset(),{x:i,y:s}=this._getMargin(e,t);return l(this._bounds.x+i,this._bounds.y+s,this._bounds.z,this._camera.fov,e,t)}_getOffset(){const e=this._domHelper.getClientDimensions(),t=e.x,i=e.y;return{offsetWidth:this._camera.offset?t-t*this._camera.offset.left-t*(1-this._camera.offset.right):t,offsetHeight:this._camera.offset?i-i*this._camera.offset.bottom-i*(1-this._camera.offset.top):i}}_getMargin(e,t){const i=Math.max(this._bounds.x,this._bounds.y);let s=i>3?0:this._bounds.x/2,n=i>3?0:this._bounds.y/2;return e>1080&&(s+=i<.3?.1:0,s+=(i>3?0:this._bounds.x)*(e/1080-1)),t>1080&&(s+=i<.3?.1:0,n+=(i>3?0:this._bounds.y)*(t/1080-1)),{x:s,y:n}}reset(e,t,i,s,n=!0){var o,r;const h=e.getSize(new q);if(h){if(t)this._targetPosition.copy(t);else{const t=e.getCenter(new q);this._targetPosition.copy(t)}const l=this.getCurrentCameraParameters();if(i||(i=null!==(o=this._initData.horizontalCameraAngle)&&void 0!==o?o:-30),s||(s=null!==(r=this._initData.verticalCameraAngle)&&void 0!==r?r:10),i+=c(this._objectRotation),this._initData.debug)return this._distance=this._setDistanceAndRangesBasedOnBounds(h),this._update(this._targetPosition),void this._setDistanceAndRangesBasedOnBounds(h);const d=this._setDistanceAndRangesBasedOnBounds(h),_=a(s),m=a(i);let u=this._targetPosition.clone();n?this._tweenCameraParameter(l,{yaw:m,pitch:_,distance:d,targetX:u.x,targetY:u.y,targetZ:u.z},!0):(this._pitch=_,this._yaw=m,this._distance=d,this._update(this._targetPosition))}else console.warn("you cant reset without bounds!")}updateDistanceAndRangesBasedOnBounds(e){if(!e)return;const t=e.getSize(new q),i=e.getCenter(new q);this.setBounds(e),this._targetPosition.copy(i),this._setDistanceAndRangesBasedOnBounds(t,!1)}async updateAndReset(e,t=!0){var i,s;const n=e.getSize(new q),o=e.getCenter(new q);this.setBounds(e),this._targetPosition.copy(o),-1===this._distance&&(this._distance=this._setDistanceAndRangesBasedOnBounds(n));const r=this.getCurrentCameraParameters();this._camera.fov=30,this._pitch=a(null!==(i=this._initData.verticalCameraAngle)&&void 0!==i?i:10);const h=null!==(s=this._initData.horizontalCameraAngle)&&void 0!==s?s:-30;this._yaw=a(h*(this._lookAtSide<0?-1:1)+c(this._objectRotation)),this._setDistanceAndRangesBasedOnBounds(n);let l=this._targetPosition.clone();t?await this._tweenCameraParameter(r,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:l.x,targetY:l.y,targetZ:l.z},!0):this._update(this._targetPosition)}_update(e,t,i){i||(this._yaw=Y(this._yaw,this.minAzimuthAngle,this.maxAzimuthAngle),this._pitch=this._initData.debug?Y(this._pitch,a(-89),a(89)):Y(this._pitch,this.minPolarAngle,this.maxPolarAngle),this._saveYawAndPitch());const s=(new X).setFromEuler(new J(-this._pitch,this._yaw,0,"ZYX")),n=new q(0,0,-1).applyQuaternion(s);i||(this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance))),e&&this._targetPosition.copy(e);const o=this._targetPosition.clone().sub(n.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(o),this._zoomChanged(!1,!1);else if(t)this._cameraPosition.copy(o);else{const e=this._getCameraSphere(o);null!=this._boundingBox&&this._boundingBox.intersectsSphere(e)&&this._scale>=1?this._distance+=.1:null==this._boundingBox||this._boundingBox.intersectsSphere(e)?this._zoomChanged(!1,!0):(this._cameraPosition.copy(o),this._zoomChanged(this._distance===this.maxDistance,!1))}this._scale=1}_zoomChanged(e,t){var i;let s=e+""+t;0===(null===(i=this._currentZoomHash)||void 0===i?void 0:i.length)||this._currentZoomHash!==s?(this.dispatchEvent(5,new Je(e,t)),this._currentZoomHash=s):e||t||this.dispatchEvent(5,new Je(e,t)),this._maxZoomedIn=t,this._maxZoomedOut=e}zoomTo(e){return this._tweenCameraParameter(this.getCurrentCameraParameters(),e,!0)}_getCameraSphere(e){const t=Math.max(this._bounds.x,this._bounds.y),i=Math.max(t/10,this._zoomDistance);return new K(e,i)}zoomIn(e){this._lerpEnabled=!0,this._scale*=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(3)}zoomOut(e){this._lerpEnabled=!0,this._scale/=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(4)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=-1,this._targetPosition=new q(0,0,0),this._targetPositionIsPanned=!1)}async moveCamera(e){const{x:t,y:i,z:s}=this._boundingBox.getCenter(new q);e.targetX=e.targetX||t,e.targetY=e.targetY||i,e.targetZ=e.targetZ||s,e.distance=e.distance||this._getIdealDistance();const n=this.getCurrentCameraParameters(),a=Q(JSON.parse(JSON.stringify(n)),e);return this._tweenCameraParameter(n,a,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}getKernelZoomFactor(){const e=this.maxDistance;return 1-this._distance/(e-2)+.2}}e("C",Qe);const $e=e("c",1500),et=e("P",5);function tt(){class e extends se{static _generateOutline(e,t){let i=new ne(new ae(e),new oe({color:"#000000",dashSize:.03,gapSize:.01,linewidth:1}));return i.translateOnAxis(t,1),i.userData.ignoreComponentRaycast=!0,i}static cloneDockLine(e,t){let i=new ne(e.geometry,e.material);return i.translateOnAxis(t.getCenter(new q),1),i.name="dockline",i.layers.set(5),i.userData.ignoreComponentRaycast=!0,i}_setValues(e,t,i,s,n){e&&(this.runtimeId=e,this.name=e.toString()),t&&(this.roomlePosition=Object.assign({},t)),i&&(this.roomleRotation=Object.assign({},i)),s&&(this.parentObjectId=s),n&&(this.isRootComponent=n)}constructor(e,t,i,s,n){super(),this._selected=!1,this.isChildPlanObject=!1,this.geometryChanged=!0,this.meshes=[],this.castShadow=!1,this.receiveShadow=!0,this._setValues(e,t,i,s,n)}get loadingMesh(){return this._loadingMesh}get boundingBoxMesh(){return this._boundingBoxMesh}get boundingBox(){return this._boundingBox}set roomlePosition(e){this._roomlePosition=e,e&&this.position.set(e.x/1e3,e.z/1e3,e.y/-1e3)}get roomlePosition(){return this._roomlePosition}set roomleRotation(e){this._roomleRotation=e,e&&this.rotation.set(e.x,e.z,-e.y)}get roomleRotation(){return this._roomleRotation}replaceMeshes(e){this.removeAllMeshes(),e.forEach(e=>{this.addMesh(new ie(e.geometry,e.material))})}addMesh(e,t){e.renderOrder=2,e.userData.meshType=0,t&&e.applyMatrix4(g(t)),this.add(e),this.meshes.push(e)}getMeshById(e){return this.meshes.find(t=>t.userData.meshId===e)}removeMeshById(e){const t=this.getMeshById(e);t?this.removeMesh(t):console.warn("Could not remove mesh with id "+e,this.runtimeId,this.meshes)}removeMesh(e){const t=this.meshes.indexOf(e);this.remove(e),p(e),t<0||this.meshes.splice(t,1)}removeAllMeshes(e=!0){this.meshes.forEach(t=>{this.remove(t),e&&p(t)}),this.meshes=[],this._removeLoadingMesh(),this.remove(this._boundingBoxMesh),p(this._boundingBoxMesh),this._boundingBoxMesh=null}_hideAllMeshes(){this.meshes.forEach(e=>e.visible=!1)}_showAllMeshes(){this.meshes.forEach(e=>e.visible=!0)}select(){this._selected=!0}loading(){if(!this._kernelBoundingBox)return void console.warn("Bounding box (box for measurements) for component "+this.runtimeId+" not set, can not show external mesh loading box!");this._removeLoadingMesh(),this._hideAllMeshes();const{x:e,y:t,z:i}=this._kernelBoundingBox.getSize(new q);let s=new re(e,t,i);this._loadingMesh=new ie(s,v.createMeshStandardMaterial({transparent:!0,opacity:f,color:new ee(y)})),this._loadingMesh.name="loading mesh",this._loadingMesh.receiveShadow=!1,this._loadingMesh.castShadow=!1,this._loadingMesh.layers.set(5),this._loadingMesh.translateOnAxis(this._kernelBoundingBox.getCenter(new q),1),this._loadingMesh.renderOrder=3,this.add(this._loadingMesh)}_removeLoadingMesh(){this._loadingMesh&&(this.remove(this._loadingMesh),p(this._loadingMesh),this._loadingMesh=null)}loadingFinished(){this._removeLoadingMesh(),this._showAllMeshes()}deselect(){this._selected=!1}hoverOn(){te("pointer")}hoverOff(){te("default")}computeBoundingBox(t,i=!1){if(this._boundingBoxMesh&&this.remove(this._boundingBoxMesh),!i&&t&&0===t.size.x&&0===t.size.y&&0===t.size.z)return;let s;if(!t||i){this._boundingBox=new he;let e=new q;this.meshes.forEach(t=>{if(t.geometry instanceof le){let i=t.geometry.attributes.position;if(void 0!==i)for(let s=0,n=i.count;s<n;s++)e.fromBufferAttribute(i,s).applyMatrix4(t.matrix),this._boundingBox.expandByPoint(e)}}),this._kernelBoundingBox=this._boundingBox.clone();let t=this._boundingBox.max.x-this._boundingBox.min.x,i=this._boundingBox.max.y-this._boundingBox.min.y,n=this._boundingBox.max.z-this._boundingBox.min.z;s=new re(t,i,n)}else{this._kernelBoundingBox=w(t),this._boundingBox=this._kernelBoundingBox.clone();let{x:e,y:i,z:n}=this._boundingBox.getSize(new q);s=new re(e,i,n)}this._boundingBoxMesh=new ie(s,v.createMeshStandardMaterial({color:"#FFFFFF",transparent:!0,opacity:0,polygonOffset:!0,polygonOffsetFactor:-1,visible:!1})),this._boundingBoxMesh.name="bounding box mesh";let n=this._boundingBox.getCenter(new q);this._boundingBoxMesh.position.add(n),this._boundingBoxMesh.layers.set(5),this._boundingBoxMesh.renderOrder=3,this._boundingBoxMesh.castShadow=!1,this._boundingBoxMesh.receiveShadow=!1,this.add(this._boundingBoxMesh),this._dockline=e._generateOutline(s,n),this._dockline.name="bounding box outline",this._dockline.layers.set(5),this._selected&&this.add(this._dockline)}recursiveMeshes(){let t=this.meshes.slice();return this.children.forEach(i=>{i instanceof e&&t.push(...i.recursiveMeshes())}),t}isChild(t){let i=!1;return this.children.forEach(s=>{s instanceof e&&!i&&(i=s.runtimeId===t||s.isChild(t))}),i}getKernelPosition(e){let t=this.parent.localToWorld(this.position);return x(e.worldToLocal(t))}animateMeshes(e,t,i,s=!0,n){this.meshes.forEach(a=>{var o;const r=null===(o=a.userData)||void 0===o?void 0:o.animationMatrixMap;if(r){const o=null==r?void 0:r.get(`${e}:${t}`),h=null==r?void 0:r.get(`${e}:${i}`);this._animateMesh(a,o,h,s,n)}})}_animateMesh(e,t,i,s=!0,n){var a;const o=null===(a=e.userData)||void 0===a?void 0:a.transform;if(!o||!t&&!i)return;let r=o.clone(),h=o.clone();(null==t?void 0:t.matrix)&&r.multiply(t.matrix),(null==i?void 0:i.matrix)&&h.multiply(i.matrix),s?b(e,r,h,n):(M(e,h),void 0!==(null==i?void 0:i.visible)&&(e.visible=i.visible),n&&n())}}class t extends e{constructor(e,t){super(e,null,null,null,!1),this.glbUrl=t}}class n extends e{constructor(e,t,i,s,n,a){super(t,i,s,n,a),this._stringId=null,this.receivedPointAssociation=!1,this.castShadow=!1,this.receiveShadow=!1,this._creator_=e}get stringId(){return this._stringId?this._stringId:this.runtimeId.toString()}addMesh(e,t){super.addMesh(e,t),e.material instanceof $&&(e.material.opacity=d,e.material.roughness=_,e.material.metalness=m,e.material.color=new ee(this._initData.colors.PREVIEW_DOCKING_COLOR)),e.renderOrder=1,e.castShadow=!1,e.receiveShadow=!1}startPulsating(){var e,t;if(null===(t=null===(e=this._initData)||void 0===e?void 0:e.featureFlags)||void 0===t?void 0:t.pulsePreview)for(const e of this.meshes){const t={opacity:d},i={opacity:.3};new TWEEN.Tween(t).to(i,$e).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{e.material.opacity=t.opacity}).yoyo(!0).repeat(et).start()}}hoverOn(){this.remove(this._dockline),this.meshes.forEach(({material:e})=>{e.opacity=u,e.roughness=_,e.metalness=m,e.color=new ee(this._initData.colors.PREVIEW_DOCKING_COLOR)}),te("pointer")}hoverOff(){this.add(this._dockline),this.meshes.forEach(({material:e})=>{e.opacity=d,e.roughness=_,e.metalness=m,e.color=new ee(this._initData.colors.PREVIEW_DOCKING_COLOR)}),te("default")}clonePreview(t){const i=new n(this._creator_,this.runtimeId,this.roomlePosition,this.roomleRotation,this.parentObjectId,this.isRootComponent);return i._stringId=this.runtimeId+"_"+t,this.children.forEach(e=>{e instanceof ie&&0===e.userData.meshType&&i.meshes.push(e.clone(!0))}),i.meshes.forEach(e=>{e.material=e.material.clone(),e.geometry=e.geometry.clone(),i.add(e)}),this._dockline&&(i._dockline=e.cloneDockLine(this._dockline,this._boundingBox)),this._boundingBoxMesh&&(i._boundingBoxMesh=this._boundingBoxMesh.clone(!0)),this._boundingBox&&(i._boundingBox=this._boundingBox.clone()),i}preparePreview(){this.add(this._dockline),this.add(this._boundingBoxMesh)}}i([s],n.prototype,"_initData",void 0);class a extends n{constructor(e,t,i,s,n,a){super(e,t,i,s,n,!1),this.lineSegments=[],a&&(this._stringId=this.runtimeId+"_has_additional_dock_point_copy")}set roomleLineFrom(e){this._roomleLineFrom=e,this.lineFrom=C(e)}get roomleLineFrom(){return this._roomleLineFrom}set roomleLineTo(e){this._roomleLineTo=e;let t=C(e);t.equals(this.lineFrom)&&(console.warn("lineFrom and lineTo are equal!"),t.add(new q(0,.01,0))),this.lineTo=t}get roomleLineTo(){return this._roomleLineTo}set roomlePositionFrom(e){this._roomlePositionFrom=e,this.positionFrom=C(e)}get roomlePositionFrom(){return this._roomlePositionFrom}set roomlePositionTo(e){this._roomlePositionTo=e;let t=C(e);t.equals(this.positionFrom)&&(console.warn("positionFrom and positionTo are equal!"),t.add(new q(0,.01,0))),this.positionTo=t}get roomlePositionTo(){return this._roomlePositionTo}addMesh(e,t){super.addMesh(e,t),e.visible=!1,e.renderOrder=3}hoverOn(){this._dockline.visible=!0,te("pointer")}hoverOff(){this._dockline.visible=!1,te("default")}preparePreview(){super.preparePreview(),this._dockline.visible=!1;let e=this.lineTo.clone(),t=this.lineFrom.clone();const i=(new q).subVectors(e,t);let s=i.length(),n=i.normalize();this._createLineMesh(.01,s,this.lineSegments);const a=(new X).setFromUnitVectors(new q(0,1,0),n);this.lineMesh.quaternion.multiply(a),this.lineMesh.renderOrder=1;let o=(new q).addVectors(e,t).multiplyScalar(.5);this.lineMesh.position.copy((new q).subVectors(o,this.position.clone())),this.add(this.lineMesh);let r=this._boundingBox.getCenter(new q).applyEuler(this.docklineRotation),h=null,l=0,c=Math.abs(n.x),d=Math.abs(n.y),_=Math.abs(n.z);c>=d&&c>=_?(h=new q(r.x,0,0),l=Math.sqrt(r.y*r.y+r.z*r.z)):d>=c&&d>=_?(h=new q(0,r.y,0),l=Math.sqrt(r.x*r.x+r.z*r.z)):_>=d&&_>=c&&(h=new q(0,0,r.z),l=Math.sqrt(r.y*r.y+r.x*r.x)),l=l>0?l:.01;let m=(new q).subVectors(this.positionTo.clone(),this.positionFrom.clone()).length()+h.length();this._createBoundingLineMesh(1.1*l,m,this.lineSegments);let u=this.positionTo.clone(),g=this.positionFrom.clone(),p=(new q).subVectors(u,g).normalize();const v=(new X).setFromUnitVectors(new q(0,1,0),p);this.boundingLineMesh.quaternion.multiply(v),this.boundingLineMesh.renderOrder=3;let f=(new q).addVectors(this.positionTo.clone(),this.positionFrom.clone()).multiplyScalar(.5).add(r);this.boundingLineMesh.position.copy((new q).subVectors(f,this.position.clone())),this.add(this.boundingLineMesh)}_createLineMesh(e,t,i){this.lineMesh=this._createPreviewMesh(e,t,i,16,v.createMeshStandardMaterial({color:y,transparent:!0,opacity:P})),this.lineMesh.name="line mesh"}_createBoundingLineMesh(e,t,i){this.boundingLineMesh=this._createPreviewMesh(e,t,i,32,v.createMeshStandardMaterial({color:"#ffffff",transparent:!0,opacity:0})),this.boundingLineMesh.name="bounding line mesh",this.boundingLineMesh.userData.ignoreComponentRaycast=!0,this.boundingLineMesh.layers.set(5)}_createPreviewMesh(e,t,i,s,n){let a;if(0===i.length)a=new ce(e,e,t,s,1);else{const n=[];for(const a of i){const i=a.to-a.from,o=(a.from+a.to)/2,r=new ce(e,e,i,s,1);r.translate(0,o-t/2,0),n.push(r)}a=S(n,!1)}return new ie(a,n)}clonePreviewLine(t){let i=new a(this._creator_,this.runtimeId,this.roomlePosition,this.roomleRotation,this.parentObjectId,this.receivedPointAssociation);return i._stringId=this.runtimeId+"_"+t,this.children.forEach(e=>{e instanceof ie&&0===e.userData.meshType&&i.meshes.push(e.clone(!0))}),i.meshes.forEach(e=>{e.material=e.material.clone(),e.geometry=e.geometry.clone(),i.add(e)}),this._dockline&&(i._dockline=e.cloneDockLine(this._dockline,this._boundingBox)),this._boundingBoxMesh&&(i._boundingBoxMesh=this._boundingBoxMesh.clone(!0)),this._boundingBox&&(i._boundingBox=this._boundingBox.clone()),i}getPositionForIntersectionPoint(e){let t=this._boundingBox.getCenter(new q).applyEuler(this.docklineRotation),i=this.positionTo.clone().add(t),s=this.positionFrom.clone().add(t),n=new de(s,i).closestPointToPoint(e,!0,new q);return(isNaN(n.x)||isNaN(n.y)||isNaN(n.z))&&n.copy(e),n.sub(t)}updatePreviewPosition(e){let t=this.getPositionForIntersectionPoint(e),i=this.parent.localToWorld(t);this._newPosition=this.worldToLocal(i);let s=this._boundingBox.getCenter(new q).applyEuler(this.docklineRotation);this._dockline.position.copy((new q).addVectors(this._newPosition,s)),this._dockline.rotation.copy(this.docklineRotation)}hideSelectionLine(){this._dockline.visible=!1}getKernelPosition(e){if(this._newPosition){let t=this.localToWorld(this._newPosition);return x(e.worldToLocal(t))}return super.getKernelPosition(e)}}class o extends _e{constructor(e,t,i,s,n,a,o){super(e,t,i,s,n,a),o||(o={left:0,top:1,right:1,bottom:0}),this.offset=o}set offset(e){this._offset=e,this.updateProjectionMatrix()}get offset(){return this._offset}resetOffset(){this._offset={left:0,top:1,right:1,bottom:0}}updateProjectionMatrix(){this._offset?(this.projectionMatrix=this._calculateProjectionMatrix(),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()):super.updateProjectionMatrix()}_calculateProjectionMatrix(){const e=this._calculate2DPlanes();if(this._offset.left>=this._offset.right||this._offset.bottom>this._offset.top)return(new me).makeOrthographic(e.left,e.right,e.top,e.bottom,this.near,this.far);const t=this._scaleRange(e.left,e.right,this._offset.left,this._offset.right);let i=t.from,s=t.to;const n=this._scaleRange(e.bottom,e.top,this._offset.bottom,this._offset.top);let a=n.from,o=n.to;const r=(e.right-e.left)/(e.top-e.bottom),h=(s-i)/(o-a);if(h>r){const e=(a+o)/2,t=(o-a)*h/r;a=e-t/2,o=e+t/2}else{const e=(i+s)/2,t=(s-i)*r/h;i=e-t/2,s=e+t/2}return(new me).makeOrthographic(i,s,o,a,this.near,this.far)}_scaleRange(e,t,i,s){const n=(t-e)/(s-i);return{from:e-n*i,to:t+n*(1-s)}}_calculate2DPlanes(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let n=i-e,a=i+e,o=s+t,r=s-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=e*this.view.offsetX,a=n+e*this.view.width,o-=t*this.view.offsetY,r=o-t*this.view.height}return{left:n,right:a,top:o,bottom:r}}}class r extends Z{constructor(e,t,i,s,n){super(e,t,i,s),n||(n={left:0,top:1,right:1,bottom:0}),this.offset=n}copy(e,t){return super.copy(e,t),this._offset=e._offset,this}set offset(e){this._offset=e,this.updateProjectionMatrix()}get offset(){return this._offset}resetOffset(){this._offset={left:0,top:1,right:1,bottom:0}}_calculateProjectionMatrix(){let e,t,i,s,n=this.fov*(2*Math.PI/360)/2;i=Math.tan(n),s=-i;let a=Math.atan(this.aspect*Math.tan(n));t=Math.tan(a),e=-t;let o=this._offset.left,r=this._offset.right,h=this._offset.top,l=this._offset.bottom,c=new V(r-o,h-l),d=new V(o+c.x/2,l+c.y/2);if(c.x<c.y){let n=(1-d.x)/(c.x/2),a=d.x/(c.x/2);t*=n,e*=a;let o=(n+a)/2;i*=o,s*=o}else{let n=(1-d.y)/(c.y/2),a=d.y/(c.y/2);i*=n,s*=a;let o=(a+n)/2;e*=o,t*=o}e*=this.near,t*=this.near,i*=this.near,s*=this.near;let _=this.near*Math.tan(Math.PI/180*.5*this.fov)/this.zoom*2,m=this.aspect*_;return this.view&&this.view.enabled&&(e+=this.view.offsetX*m/this.view.fullWidth,i-=this.view.offsetY*_/this.view.fullHeight,t+=this.view.offsetX*m/this.view.fullWidth,s-=this.view.offsetY*_/this.view.fullHeight),(new me).makePerspective(e,t,i,s,this.near,this.far)}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){this._offset?(this.projectionMatrix=this._calculateProjectionMatrix(),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()):super.updateProjectionMatrix()}}return{create:function(t,i,s,n,a){return new e(t,i,s,n,a)},createPreview:function(e,t,i){return new n(i,e,{x:0,y:0,z:0},{x:0,y:0,z:0},t,!1)},createStatic:function(e,i){return new t(e,i)},createPreviewLine:function(e,t){let i=new a(t,e.id,e.roomlePosition,e.roomleRotation,e.parentObjectId,e.receivedPointAssociation);return e.meshes.forEach(e=>{let t=e.clone();t.material=e.material.clone(),t.geometry=e.geometry.clone(),i.addMesh(t)}),i.computeBoundingBox(),i},isPreview:function(e){return e instanceof n},isPreviewLine:function(e){return e instanceof a},createPerspectiveCamera:function(e,t,i,s,n){return new r(e,t,i,s,n)},createOrthographicCamera:function(e,t,i,s,n,a,r){return new o(e,t,i,s,n,a,r)}}}class it{constructor(e,t){this._scene=e,t&&(t.removeFromScene(),t.cleanUp())}updateCamera(e){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(e,t){this._bounds=e}cleanUp(){this._scene=null}}class st{constructor(e){this._innerSize=1,this._outerSize=100,this._plane=new se,this._plane.rotation.x=-Math.PI/2;const t=v.createMeshStandardMaterial({});this._innerPlaneMesh=new ie,this._innerPlaneMesh.layers.set(2),this._innerPlaneMesh.material=t,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new ie,this._outerPlaneMesh.layers.set(2),this._outerPlaneMesh.material=t,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=e,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(e){this._innerSize=e,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(e,t){const i=new ue;i.moveTo(-e/2,-e/2),i.lineTo(-e/2,e/2),i.lineTo(e/2,e/2),i.lineTo(e/2,-e/2),i.lineTo(-e/2,-e/2);const s=new ue;s.moveTo(-t/2,-t/2),s.lineTo(-t/2,t/2),s.lineTo(t/2,t/2),s.lineTo(t/2,-t/2),s.lineTo(-t/2,-t/2);const n=new ge;n.moveTo(-e/2,-e/2),n.lineTo(-e/2,e/2),n.lineTo(e/2,e/2),n.lineTo(e/2,-e/2),n.lineTo(-e/2,-e/2),s.holes.push(n);const a=new pe(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=a;const o=new pe(s);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=o;const r=a.attributes.uv.clone();a.setAttribute("uv2",r);const h=a.attributes.uv2.array;for(let e=0;e<h.length;++e)h[e]+=.5}}class nt extends it{constructor(e,t,i){super(e,t),this._longestSide=2,this._bakedShadowPlane=new st(100),this._fog=i||!1,this._textureLoader=new ve,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(e){return super.updateBounds(e),this._longestSide=Math.max(e.x,e.z),this._update(),!0}updateCamera(e){this._cameraDistance=e.position.distanceTo(new q(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let e=this._longestSide/2;this._scene.fog=new fe(16185078,this._cameraDistance+e+3,this._cameraDistance+e+3+1),this._scene.background=new ee(16185078)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let e=this._width/1e3,t=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=ye,this._floorTexture.wrapT=ye,this._floorTexture.repeat.set(100/e,100/t));let i=v.createMeshStandardMaterial({map:this._floorTexture,side:we});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&this._scene.add(this._bakedShadowPlane.getRootNode())}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(e,t,i,s){return this._width=t,this._height=i,this._repeatable=s,this._floorPromise=new Promise((t,i)=>{this._textureLoader.load(e,e=>{this._floorTexture=e,t()},null,i)}),new Promise((e,t)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),e()},t)})}changeFloorMaterial(e,t){this._floorPromise=new Promise((i,s)=>{this._floorMaterial=L(e),this._rapiAccess.getTexturesOf(e).then(e=>{if(e.length>0){let n=[];e.forEach(e=>{n.push(E(this._dataSyncer.requestAsset(e.image,!0),e,this._floorMaterial,t,1,1))}),Promise.all(n).then(()=>{setTimeout(()=>i(),0)},s)}else setTimeout(()=>i(),0)})});let i=[this._floorPromise];return new Promise((e,t)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),e()},t)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let e=I();if(!e)return;let t=e.addFolder("Floor");t.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),t.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),t.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}e("F",nt),i([s],nt.prototype,"_rapiAccess",void 0),i([s],nt.prototype,"_dataSyncer",void 0);const at=Math.PI/4;class ot extends Xe{constructor(e,t,i,s){super(e,t,i),this._state=0,this._cameraRotation=new X,this._rotationSpeed=1,this._keyMap=new Map,this.minPolarAngle=a(-60),this.maxPolarAngle=a(60),this._camera=s||new Z,this._camera.fov=75,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5),i||this._camera.position.set(0,1.5,0),this._cameraPosition=new q,this._cameraPosition.copy(this._camera.position),this._pitch=0,this._yaw=0;let n=new J(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(n),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}setUp(){super.setUp(),this._camera.fov=75,this._initInputListener()}_gamepadConnected(e){this.startButtonPressListener()}_gamepadDisconnected(e){window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let e=navigator.getGamepads()[0];this._checkRightStick(e),this._checkLeftStick(e),this._checkButtons(e),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(e){let t=e.axes[2],i=e.axes[3];Math.abs(t)>.2&&(this._rotateHorizontal(.01*at*t),this._update(),this.dispatchEvent(1)),Math.abs(i)>.2&&(this._rotateVertical(.01*at*i),this._update(),this.dispatchEvent(1))}_checkLeftStick(e){let t=e.axes[0],i=e.axes[1];Math.abs(i)>.2?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):e.buttons&&e.buttons[12]&&e.buttons[12].pressed?this._keyMap.set(87,!0):e.buttons&&e.buttons[13]&&e.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(t)>.2?t<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(e){e.buttons&&e.buttons[6]&&e.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),e.buttons&&e.buttons[14]&&e.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(1)):this._keyMap.set(37,!1),e.buttons&&e.buttons[15]&&e.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(1)):this._keyMap.set(39,!1)}animateCamera(e){let t=this._cameraPosition,i=this._cameraRotation,s=this.getCamera(),n=o(t,s.position),a=D(i,s.quaternion);if(!t||n&&a)return!1;let r=this.getCamera().position.clone(),h=Math.min(10*e,1);r.lerp(t,h),this.getCamera().position.copy(r);let l=this.getCamera().quaternion.clone(),c=Math.min(5*e,1);l.slerp(i,c),this.getCamera().setRotationFromQuaternion(l);let d=!1;return this._keyMap.forEach(e=>{e&&(d=!0)}),d&&this._processKeyMap(this._keyMap,e),!0}_getCamera(){return this._camera}_initInputListener(){this._onKeyChanged=this._onKeyChanged.bind(this),window.addEventListener("keyup",this._onKeyChanged,!1),window.addEventListener("keydown",this._onKeyChanged,!1),this._inputListeners.push({key:3,fun:e=>{this._down(e)}}),this._inputListeners.push({key:6,fun:e=>{this._move(e)}}),this._inputListeners.push({key:4,fun:e=>{this._up(e)}})}_removeInputListener(){window.removeEventListener("keyup",this._onKeyChanged,!1),window.removeEventListener("keydown",this._onKeyChanged,!1)}_down(e){this._downPosition=e.position,this._position=e.position,this._state=1,2===e.type&&window.setTimeout(this._onLongDown.bind(this),350),2===e.type?this._rotationSpeed=.1:this._rotationSpeed=1}_move(e){this._position=e.position,1!==this._state||this._locked||this._orbit(new V(e.position.x,e.position.y)),2!==this._state||this._locked||(this._orbit(new V(e.position.x,e.position.y)),this._moveForward())}_up(e){1===this._state&&this.dispatchEvent(2),2===this._state&&this._keyMap.set(87,!1),this._state=0,this._orbitPosition=null}_onLongDown(){k(this._downPosition,this._position)<B&&1===this._state&&(this._state=2,this._orbit(new V(this._position.x,this._position.y)),this._moveForward())}_update(e){var t;let i=new J(-this._pitch,this._yaw,0,"ZYX");null===(t=this._cameraRotation)||void 0===t||t.setFromEuler(i)}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix(),this._camera.near=.1,this._camera.far=100}_onKeyChanged(e){this._keyMap.set(e.keyCode,"keydown"===e.type),this.dispatchEvent(6),this._processKeyMap(this._keyMap,.001)&&e.preventDefault()}_processKeyMap(e,t){t=Math.min(t,.1);let i=new q(0,0,0),s=!1;return this._processUpDown(e,i,t),e.get(65)&&(i.x=-1.5*t),e.get(68)&&(i.x=1.5*t),e.get(37)&&(this._rotateHorizontal(-at*this._rotationSpeed*t),s=!0),e.get(39)&&(this._rotateHorizontal(at*this._rotationSpeed*t),s=!0),e.get(16)&&(i.x*=3,i.z*=3),!(0===i.x&&0===i.y&&0===i.z&&!s||(i.applyQuaternion(this.getCamera().quaternion),this._cameraPosition.add(new q(i.x,0,i.z)),this._update(),0))}_processUpDown(e,t,i){(e.get(87)||e.get(38))&&(t.z=-1.5*i),(e.get(83)||e.get(40))&&(t.z=1.5*i)}_orbit(e){this._orbitPosition||(this._orbitPosition=new V(e.x,e.y),this.dispatchEvent(0));let t=e.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;t.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*t.x/i.clientWidth*1),this._rotateVertical(2*Math.PI*t.y/i.clientHeight*1),r(this._orbitPosition,e)||this.dispatchEvent(1),this._orbitPosition.copy(e),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(e){let t=this._pitch+e;t>this.maxPolarAngle||t<this.minPolarAngle||(this._pitch=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}getKernelZoomFactor(){return this._camera.zoom}cleanUp(){this._removeInputListener()}}e("e",ot);class rt extends it{constructor(e,t,i,s,n){if(super(e,t),this._color=i,this._oldBackground=e.background,s&&n){this._canvas=s,this._style=document.createElement("style");let e='background-image: url("'+n+'"); background-size: cover;';this._style.innerText=".rml-scene-background {"+e+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._color&&(this._scene.background=this._color),this._canvas&&this._canvas.classList&&(this._scene.background=null,this._canvas.classList.add("rml-scene-background"))}removeFromScene(){this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove("rml-scene-background")}showGUI(){}}e("B",rt);class ht{parse(e,t,i,s,n){let a=JSON.parse(s);return a.environment?this.load(e,t,i,a,n):null}load(e,t,i,s,n){let a,o=s.environment;if(!o)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(o.type){case"color":a=new Promise(t=>t(new rt(e,i,new ee(o.details.color))));break;case"image":a=new Promise(s=>s(new rt(e,i,null,t,o.details.imageUrl)));break;case"floor":a=new Promise(t=>{this._rapiAccess.getMaterial(o.details.material).then(s=>{let a=void 0===o.details.fog||o.details.fog,r=new nt(e,i,a);r.changeFloorMaterial(s,n).then(()=>{t(r)})})});break;default:console.warn("Could not load environment, return old environment"),a=new Promise(e=>e(i))}return a}}i([s],ht.prototype,"_rapiAccess",void 0);class lt{constructor(e,t){this._scene=e,t&&t.removeFromScene()}needsBounds(){return!1}updateBounds(e){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new se),this._cameraContainer}}e("L",lt);class ct extends lt{constructor(e,t){super(e,t),this._lights=[]}needsBounds(){return!0}updateBounds(e){if(this._cameraLight){const t=this._cameraLight,i=new q;e.getSize(i);const s=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=s,t.shadow.camera.top=s/2,t.shadow.camera.bottom=-s/2,t.shadow.camera.left=-s/2,t.shadow.camera.right=s/2,t.shadow.camera.updateProjectionMatrix()}}loadFromJSON(e){return new Promise(t=>{this._lights=this._dynamicLightSettingLoader.parse(e),this.addToScene(),t()})}loadFromObject(e){return new Promise(t=>{(null==e?void 0:e.lights)||t(),this._lights=this._dynamicLightSettingLoader.load(e),this._lights.forEach((e,t)=>{e.userData.movesWithCamera&&(this._cameraLight=e,this._lights.splice(t,1))}),this.addToScene(),t()})}loadFromURL(e){return new Promise((t,i)=>{fetch(new Request(e,{method:"GET"})).then(xe).then(e=>this.loadFromObject(e).then(t,i))})}addToScene(){this._lights.forEach(e=>{this._scene.add(e)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(e,t){if(!this._cameraLight)return;let i=new q;e.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let s=t.clone().add(i);this._cameraLight.position.copy(s)}removeFromScene(){this._lights.forEach(e=>{this._scene.remove(e)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=I();this._cameraLight&&this._addToGUI(e,this._cameraLight),this._lights.forEach(t=>{this._addToGUI(e,t)})}_addToGUI(e,t){e&&(t instanceof be&&this._addSpotLightToGUI(e,t),t instanceof Me&&this._addAmbientLightToGUI(e,t),t instanceof Ce&&this._addDirectionalLightToGUI(e,t),t instanceof Pe&&this._addRectAreaLightToGUI(e,t))}_addRectAreaLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString(),intensity:t.intensity*(t.width*t.height)};i.add(t,"visible"),i.add(s,"intensity").min(10).max(400).step(10).onChange(e=>{t.intensity=e/(t.width*t.height)}),i.add(t,"castShadow"),i.addColor(s,"color").onChange(e=>{t.color=new ee(e)}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new q(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new q(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new q(0,0,0))})}_addSpotLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString(),angle:180*t.angle/Math.PI};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.add(t,"penumbra").min(0).max(1).step(.1),i.addColor(s,"color").onChange(e=>{t.color=new ee(e)}),i.add(s,"angle").min(10).max(180).step(1).onChange(e=>{t.angle=e*Math.PI/180}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new q(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new q(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new q(0,0,0))})}_addAmbientLightToGUI(e,t){let i={name:t.name,color:"#"+t.color.getHexString()},s=e.addFolder(t.name);s.add(t,"visible"),s.add(t,"intensity").min(0).max(5).step(.1),s.addColor(i,"color").onChange(e=>{t.color=new ee(e)})}_addDirectionalLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString()};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.addColor(s,"color").onChange(e=>{t.color=new ee(e)}),i.add(t,"castShadow"),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new q(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new q(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new q(0,0,0))})}}i([s],ct.prototype,"_dynamicLightSettingLoader",void 0);var dt=function(e){function t(e,i,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:128;if(Ee(this,t),i<=0||s<=0||n<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");var a=new Ie(s,2*n,n);a.scale(1,1,-1);for(var o=a.getAttribute("position"),r=new q,h=0;h<o.count;++h)if(r.fromBufferAttribute(o,h),r.y<0){var l=3*-i/2,c=r.y<l?-i/r.y:1-r.y*r.y/(3*l*l);r.multiplyScalar(c),r.toArray(o.array,3*h)}return o.needsUpdate=!0,De(this,t,[a,new ke({map:e,depthWrite:!1})])}return Se(t,e),Le(t)}(ie);class _t extends it{constructor(e,t,i){super(e,t),this.updateEnvironmentTexture(i)}updateEnvironmentTexture(e){e&&(this._environmentTexture=e,this._skybox=new dt(this._environmentTexture,15,100),this._skybox.name="Ground projected skybox",this._skybox.scale.setScalar(100)),this.reload()}needsBounds(){return!1}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._skybox&&this._scene.add(this._skybox)}removeFromScene(){this._scene&&this._skybox&&this._scene.remove(this._skybox)}showGUI(e){let t=I();if(!t)return;let i=t.addFolder("Ground Projected Environment");i.add(this._skybox,"height").min(10).max(100).step(.1).onChange(e),i.add(this._skybox,"radius").min(20).max(200).step(.1).onChange(e)}}class mt{constructor(e){this._lightSourceDetector=e}static createPlane(e,t){const i=new Be(2,1),s=null!=t?t:new ke({color:12632256,side:we}),n=new ie(i,s);return n.position.z=-.1,e.add(n),n}createDebugScene(e,t){this._scene=e,this._createLightGraphInMap(this._lightSourceDetector.sampleUVs,this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph,t)}_createLightGraphInMap(e,t,i,s){const n=[],a=[];for(let e=0;e<this._lightSourceDetector.lightGraph.noOfNodes;++e)0===i.adjacent[e].length?n.push(t[e]):a.push(t[e]);const o=n.map(e=>e.uv),r=a.map(e=>e.uv),h=e.filter(e=>!o.includes(e)&&!r.includes(e));this._createSamplePointsInMap(h,.005,16711680),this._createSamplePointsInMap(o,.01,255),this._createSamplePointsInMap(r,.01,65280),this._createClusterLinesInMap(this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph.edges,128);const l=this._lightSourceDetector.lightSources.map(e=>e.uv);this._createSamplePointsInMap(l,.015,16776960);let c=this._lightSourceDetector.lightSources;void 0!==s&&s>=0&&s<c.length&&(c=c.slice(0,s)),this._createCirclesInMap(c,8421376)}_createSamplePointsInMap(e,t,i){const s=new Re(t,8,4),n=new ke({color:i});e.forEach(e=>{var t;const i=new ie(s,n);i.position.copy(this._uvToMapPosition(e)),i.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(i)})}_createCirclesInMap(e,t){const i=new ke({color:t,transparent:!0,opacity:.5});e.forEach(e=>{var t;const s=new Re(e.size,8,4),n=new ie(s,i);n.position.copy(this._uvToMapPosition(e.uv)),n.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(n)})}_createClusterLinesInMap(e,t,i){var s;const n=new ze({color:i}),a=[];t.forEach(t=>{for(let i=1;i<t.length;i++){const s=e[t[0]].uv,n=e[t[i]].uv;if(a.push(this._uvToMapPosition(s)),Math.abs(s.x-n.x)>.5){const e=(s.y+n.y)/2,t=s.x<n.x?0:1;a.push(this._uvToMapPosition(new V(t,e))),a.push(this._uvToMapPosition(new V(1-t,e)))}a.push(this._uvToMapPosition(n))}});const o=(new le).setFromPoints(a),r=new ne(o,n);r.name="clusterLine",null===(s=this._scene)||void 0===s||s.add(r)}_uvToMapPosition(e){return new q(2*e.x-1,e.y-.5,0)}}class ut extends Te{constructor(e){super(e),this._extendedEquirectMaterial=this._createEquirectMaterial()}fromEquirectangularTexture(e,t){var i,s;const n=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,a=null!==(s=null==t?void 0:t.intensity)&&void 0!==s?s:1;return this._extendedEquirectMaterial.uniforms.intensity.value=a,this._extendedEquirectMaterial.uniforms.rotationMatrix.value.set(Math.cos(n),0,-Math.sin(n),0,1,0,Math.sin(n),0,Math.cos(n)),super.fromEquirectangular(e)}_createEquirectMaterial(){const e=new Ae({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},intensity:{value:1},rotationMatrix:{value:new Oe}},vertexShader:gt,fragmentShader:pt,blending:Fe,depthTest:!1,depthWrite:!1});return this._equirectMaterial=e,e}}const gt="\nprecision mediump float;\nprecision mediump int;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nuniform mat3 rotationMatrix;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection( vec2 uv, float face ) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3( uv, 1.0 );\n if ( face == 0.0 ) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if ( face == 1.0 ) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if ( face == 2.0 ) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if ( face == 3.0 ) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if ( face == 4.0 ) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if ( face == 5.0 ) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = rotationMatrix * getDirection(uv, faceIndex);\n gl_Position = vec4(position, 1.0);\n}\n",pt="\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform float intensity;\n\n#include <common>\n\nvoid main() { \n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv(outputDirection);\n gl_FragColor = vec4(texture2D(envMap, uv).rgb * intensity, 1.0);\n}\n";class vt{}class ft{get lightSources(){return this._lightSources}set rotation(e){this._rotation!==e&&(this._rotation=e,this.needsUpdate=!0)}set intensity(e){this._intensity!==e&&(this._intensity=e,this.needsUpdate=!0)}set maxNoOfLightSources(e){this._maxNoOfLightSources!==e&&(this._maxNoOfLightSources=e,this.needsUpdate=!0)}get maxNoOfLightSources(){return this._maxNoOfLightSources}constructor(e,t){var i,s;this.needsUpdate=!0,this._lightSources=[],e instanceof vt?this.environmentSceneGenerator=e:e instanceof Ue?this.cubeTexture=e:e instanceof je&&(this.equirectangularTexture=e),(null==t?void 0:t.textureData)&&(this.textureData=null==t?void 0:t.textureData),this._rotation=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,this._intensity=null!==(s=null==t?void 0:t.intensity)&&void 0!==s?s:1,void 0!==(null==t?void 0:t.maxNoOfLightSources)&&(this._maxNoOfLightSources=t.maxNoOfLightSources),this._parameters=t,this._environment=e}clone(){return new ft(this._environment,this._parameters)}createNewEnvironment(e){const t=this._createPmremTexture(e),i=this._detectLightSources(e,t);return this._lightSources=i.lightSources,null!=t?t:null}_getTextureOffset(){const e=this._rotation/(2*Math.PI)%1;return new V(e,0)}_createPmremTexture(e){const t=new ut(e);let i;if(this.equirectangularTexture)this.equirectangularTexture.offset.copy(this._getTextureOffset()),i=t.fromEquirectangularTexture(this.equirectangularTexture,{rotation:this._rotation,intensity:this._intensity});else if(this.cubeTexture)i=t.fromCubemap(this.cubeTexture);else if(this.environmentSceneGenerator){const e=this.environmentSceneGenerator.generateScene(this._intensity,this._rotation);i=t.fromScene(e,.04)}return this._debugScene=void 0,this.needsUpdate=!1,null==i?void 0:i.texture}_detectLightSources(e,t){const i=new R;return this.equirectangularTexture&&0===this.rotation?i.detectLightSources(e,this.equirectangularTexture,this.textureData):t&&i.detectLightSources(e,t),i}createDebugScene(e,t,i){const s=null!=i?i:-1;if(this._debugScene&&s===this._debugScene.userData.maximumNumberOfLightSources)return this._debugScene;this._debugScene=new He;const n=new z(!0,!1);n.setSourceTexture(t.environment),mt.createPlane(this._debugScene,n);const a=this._detectLightSources(e,t.environment);return new mt(a).createDebugScene(this._debugScene,s),this._debugScene.userData.maximumNumberOfLightSources=s,this._debugScene}}class yt extends vt{constructor(e={}){super(),this._parameters={},this._parameters=e}generateScene(e,t){const i=new wt({...this._parameters,lightIntensity:e*(this._parameters.lightIntensity||1),topLightIntensity:e*(this._parameters.topLightIntensity||1),sidLightIntensity:e*(this._parameters.sidLightIntensity||1)});return i.rotation.y=t,i}}class wt extends He{constructor(e={}){var t;super(),this._type=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:"all_around",this._topLightIntensity=(null==e?void 0:e.topLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideLightIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideReflectorIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1;const i="front"===this._type?.3:0;this._ambientLightIntensity=(null==e?void 0:e.ambientLightIntensity)||i,this._colorVariation=(null==e?void 0:e.colorVariation)||.5,this._lightGeometry=new re,this._lightGeometry.deleteAttribute("uv"),this._reflectorLightGeometry=new ce(.7,.4,2,32),this._reflectorLightGeometry.deleteAttribute("uv"),this.generateScene(this)}generateScene(e){switch(this._type){default:case"all_around":this._createAllAroundSceneLight(e);break;case"front":this._createFrontSceneLight(e)}}dispose(){const e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(const t of e)t.dispose()}_createAllAroundSceneLight(e){const t=this._ambientLightIntensity;this.background=new ee(t,t,t),this._createTopLight(e,6,1);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);t%2==0?this._createReflector(e,new V(s,n),3,1,.8,.2):this._createSideLight(e,new V(s,n),(t-1)/2,15,1.1,.33,1)}}_createFrontSceneLight(e){const t=this._ambientLightIntensity;this.background=new ee(t,t,t),this._createTopLight(e,6,.7);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);if(0===t){this._createReflector(e,new V(s,n),1.1,.6,.8,-.4);for(let i=0;i<2;i++){const s=(t-.3+.6*i)*Math.PI*2/6,n=Math.sin(s),a=Math.cos(s);this._createSideLight(e,new V(n,a),(t-1)/2,50,1.2,.7,.8)}}else this._createReflector(e,new V(s,n),1.1,.7,1.4,0)}}_createAreaLightMaterial(e,t,i){const s=new ke;return s.color.set(e,null!=t?t:e,null!=i?i:e),s}_createTopLight(e,t,i){const s=new ie(this._lightGeometry,this._createAreaLightMaterial(t*this._topLightIntensity));s.position.set(0,20,0),s.scale.set(5*i,.1,5*i),e.add(s)}_createSideLight(e,t,i,s,n,a,o){for(let r=0;r<3;r++){const h=s*this._sideLightIntensity,l=new ie(this._lightGeometry,this._createAreaLightMaterial((r+i)%3==0?h:h*(1-this._colorVariation),(r+i)%3==1?h:h*(1-this._colorVariation),(r+i)%3==2?h:h*(1-this._colorVariation))),c=(1===r?-t.y:2===r?t.y:0)/Math.sqrt(2),d=0===r?0:1,_=(1===r?t.x:2===r?-t.x:0)/Math.sqrt(2);l.position.set(t.x*o*15+1.1*c*n,15*a+1.1*d*n,t.y*o*15+1.1*_*n),l.rotation.set(0,Math.atan2(t.x,t.y),0),l.scale.setScalar(n),e.add(l)}}_createReflector(e,t,i,s,n,a){const o=new ie(this._reflectorLightGeometry,this._createAreaLightMaterial(i*this._sideReflectorIntensity));o.position.set(15*t.x,10*a,15*t.y),o.scale.set(10*s,10*n,10*s),e.add(o)}}class xt extends Xe{constructor(e,t,i,s){super(e,t,i),this._scale=1,this._cameraZoom=1,this._state=0,this._size=5,this._lastPosition=new V,this._zoomPosition=new q,this._lastZoom=0,this._zoomSpeed=Math.pow(.95,2),s?(this._camera=s,this._cameraPosition=(new q).copy(this._camera.position)):this._initCamera(i?new q(i.targetX,10,i.targetZ):new q(0,10,0)),this._lerpEnabled=!1}_getCamera(){return this._camera||this._initCamera(new q(0,10,0)),this._camera}_initCamera(e){let{x:t,y:i}=this._domHelper.getClientDimensions(),s=(t/i||1)*this._size,n=this._size;this._camera=new _e(s/-2,s/2,n/2,n/-2,1,1e3),this._camera.position.copy(e),this._cameraPosition=e,this._camera.lookAt(new q(0,0,0))}updateCamera(){let e=this._domHelper.getAspectRatio()*this._size,t=this._size;this._camera.left=e/-2,this._camera.right=e/2,this._camera.top=t/2,this._camera.bottom=t/-2,this._camera.updateProjectionMatrix()}_initInputListener(){this._inputListeners.push({key:3,fun:e=>{this._locked||(this._state=1,this._lastPosition.set(e.positionRelative.x,e.positionRelative.y),this.dispatchEvent(0))}}),this._inputListeners.push({key:6,fun:e=>{this._lastPosition.x===e.positionRelative.x&&this._lastPosition.y===e.positionRelative.y||1!==this._state||this._locked||(this._move(new V(e.positionRelative.x,e.positionRelative.y),e.type),this.dispatchEvent(1))}}),this._inputListeners.push({key:4,fun:e=>{1===this._state&&this.dispatchEvent(2),this._state=0}}),this._inputListeners.push({key:7,fun:e=>{e.event&&(e.event.stopPropagation(),e.event.preventDefault()),this.dispatchEvent(3),this._scale/=this._zoomSpeed,this._zoomTo(e.positionRelative),this._update()}}),this._inputListeners.push({key:8,fun:e=>{e.event&&(e.event.stopPropagation(),e.event.preventDefault()),this.dispatchEvent(4),this._scale*=this._zoomSpeed,this._zoomTo(e.positionRelative),this._update()}})}_zoomTo(e){if(Date.now()-this._lastZoom>200){let t=new q(e.x,e.y,0);t.unproject(this._camera),this._zoomPosition.copy(t)}this._lastZoom=Date.now()}_move(e,t){let i=new q,s=new q(this._lastPosition.x,this._lastPosition.y,0),n=new q(e.x,e.y,0);s.unproject(this._camera),n.unproject(this._camera),i.subVectors(n,s),this._cameraPosition.x-=i.x*(2===t?1.1:1),this._cameraPosition.z-=i.z*(2===t?1.1:1),this._lastPosition.copy(e)}zoomToFitBounds(e,t,i){if(h(e,this._boundingBox)<0&&!i)return void this.setBounds(e);this.setBounds(e);const s=e.getSize(new q),n=e.getCenter(new q),a=s.x/-2/this._camera.left,o=s.z/-2/this._camera.bottom,r=1/Math.max(a,o);(r<this._cameraZoom||t)&&(this._scale=r,this._cameraZoom=r,this._cameraPosition.x=n.x,this._cameraPosition.z=n.z)}_update(e,t,i){this._scale=Math.min(this._scale,5),this._scale=Math.max(this._scale,.1);let s=(new q).subVectors(this._zoomPosition,this._cameraPosition).multiplyScalar((this._scale-this._cameraZoom)/this._scale);this._cameraPosition.x+=s.x,this._cameraPosition.z+=s.z,this._cameraZoom!==this._scale&&this.dispatchEvent(5,new Je(.1===this._scale,5===this._scale)),this._cameraZoom=this._scale,this._camera.updateProjectionMatrix()}animateCamera(e){const t=Math.abs(this._cameraZoom-this._camera.zoom)>.01;if(this._lerpEnabled=t,!super.animateCamera(e)&&!t)return!1;this._lerpEnabled=!1;const i=Math.min(10*e,1);return this._camera.zoom=Ne.lerp(this._camera.zoom,this._cameraZoom,i),!0}getKernelZoomFactor(){const e=1e3*(this._camera.right-this._camera.left);return this._domHelper.element.clientWidth/e*this._camera.zoom}}e("d",xt);const bt=e("f",.35),Mt=e("I",1.16);class Ct{get cameraBehaviour(){return this._cameraBehaviour}onBeforeRender(){}constructor(e,t,i,s){this._depthWriteMaterial=new ke({colorWrite:!1}),this._maxAnisotropy=1,this._clock=new qe,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._roomleRenderer=null,this._forceRender=!1,this._lastChange=Date.now(),this._running=!1,this._isInteriorLightActive=!1,this._perspectiveOffsetCamera=null,this._orthographicOffsetCamera=null,this._onAfterRender=()=>{},this._creator_=e,this._canvasID=i,this._isInteriorLightActive=this._initData.featureFlags.interiorLights,this._renderListener=()=>{this._requestRender()},this.createCameraControl(Ge(s),t),this._setupScene(t,this._initData.transparentBackground),this._lifeCycleManager.addEventListener(this)}addEventListener(e){throw new Error("Method not implemented.")}removeEventListener(e){throw new Error("Method not implemented.")}_changeCameraBehaviour(e){this._cameraBehaviour&&this.cameraBehaviour.cameraControl instanceof ot&&(this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener)),this._cameraBehaviour=e,this._cameraBehaviour.setCameraChangeListener(this.onCameraChanged.bind(this)),e.cameraControl instanceof ot&&(this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)),this.cameraBehaviourChanged()}onCameraChanged(){}cameraBehaviourChanged(){this.cameraBehaviour.cameraControl instanceof Qe&&this.cameraBehaviour.cameraControl.updateDistanceAndRangesBasedOnBounds(this.getBounds())}_addCameraControlListener(){this.cameraBehaviour.cameraControl.addEventListener(0,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStarts(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(1,this._requestRender,this),this.cameraBehaviour.cameraControl.addEventListener(2,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStops(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(6,this._requestRender,this)}_renderEverything(){this._roomleRenderer&&(this._forceRender=!0,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}_renderWithoutShadowsAndAO(){this._roomleRenderer&&(this._forceRender=!0),this._requestRender()}_requestRender(){if(!this._renderer||this._stopRendering)return;const e=()=>{var t,i;if(this._delta=this._clock.getDelta(),this._animateCamera(),this.cameraBehaviour.cameraControl.getCamera().layers.mask=65535,this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._globalInitData.e2e&&window.TWEEN){const e=TWEEN.getAll();for(const t of e)t.end()}if(this._roomleRenderer)null===(t=this._statsHelper)||void 0===t||t.updateRenderInfo(this._roomleRenderer.renderer.info),this._roomleRenderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._forceRender=!1,this._shouldRenderUi()&&this._renderUi();else{null===(i=this._statsHelper)||void 0===i||i.updateRenderInfo(this._renderer.info);const e=this.cameraBehaviour.cameraControl.getCamera();e.updateMatrixWorld(),e.updateProjectionMatrix(),this._renderer.render(this._scene,e)}this._onAfterRender(),window.TWEEN&&TWEEN.update(),this._lastChange+3e3<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(e))};this._lastChange=Date.now(),this._running||this._stopRendering||(this._running=!0,requestAnimationFrame(e))}_shouldRenderUi(){var e;return null===(e=this._pluginSystem)||void 0===e?void 0:e.needsUiScene()}_renderUi(){const e=this._scene.background?this._scene.background.clone():null;this._scene.overrideMaterial=this._depthWriteMaterial,this._scene.background=null,this._renderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._scene.overrideMaterial=null;const t=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this.cameraBehaviour.cameraControl.getCamera()),this._renderer.autoClear=t,this._scene.background=e}_animateCamera(){this.cameraBehaviour.cameraControl&&(this.cameraBehaviour.cameraControl.animateCamera(this._delta)||!this.shouldClearShadowsAndAO()||this._forceRender)&&this._lightSetting instanceof ct&&this.cameraBehaviour.cameraControl.getCamera()instanceof Z&&this._lightSetting.update(this.cameraBehaviour.cameraControl.getCamera(),this.cameraBehaviour.cameraControl.getTargetPosition()),this._environment&&this._environment.needsCamera()&&this.cameraBehaviour.cameraControl instanceof Qe&&this._environment.updateCamera(this.cameraBehaviour.cameraControl.getCamera())}shouldClearShadowsAndAO(){return!1}_setupScene(e,t){var i,s;const{x:n,y:a}=this._domHelper.getClientDimensions();this._scene=new He,this._uiScene=new He,(t=t||!1)||(this._scene.background=this._initData.colors.DEFAULT_BACKGROUND),this._renderer=new Ze({antialias:!this._globalInitData.e2e,alpha:!0});const o=this._initData.autoQuality?Math.min(window.devicePixelRatio,1.5):window.devicePixelRatio;this._renderer.setPixelRatio(o),this._renderer.setSize(n,a),this._renderer.outputColorSpace=Ve,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=We,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._globalInitData.e2e||(this._roomleRenderer=new T(this._renderer,n,a,null!==(i=this._initData.linearAoFilter)&&void 0!==i&&i),this._initData.debug&&this._roomleRenderer.sceneRenderer.loadLutImages(A),this._roomleRenderer.setQualityMap(O),this._roomleRenderer.setAutoQuality(this._initData.autoQuality),this._roomleRenderer.setShadingType(this._initData.shading),this._roomleRenderer.setCustomShadingParameters(this._initData.customShading,this._initData.customShadingMoc),null===(s=this._roomleRenderer)||void 0===s||s.setSize(n,a),this._roomleRenderer.sceneRenderer.outlineRenderer.parameters.hiddenEdgeColor=this._initData.colors.SELECTION.getHex(),this._roomleRenderer.sceneRenderer.outlineRenderer.parameters.visibleEdgeColor=this._initData.colors.SELECTION.getHex(),this._roomleRenderer.sceneRenderer.outlineRenderer.applyParameters()),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._hdrEnvironmentLoader.registerEnvironmentChangedCallback(e=>{this._setEnvMap(e)}),this._initData.legacyLight?this.loadEnvMap("static/legacy_env-d5810ec5057d4716.exr"):this._initData.sceneLight?this._setDefaultEnvironmentScene():this.loadEnvMap(this._initData.envMapUrl),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._pluginSystem.init(this._scene,this._uiScene,this.cameraBehaviour.cameraControl.getCamera().position),this._addCameraControlListener(),this.sceneChanged()}async loadEnvMap(e){await this._hdrEnvironmentLoader.loadUrl(this._renderer,e)}_getEnvMapIntensityAndRotation(){let e=this._initData.envMapIntensity,t=this._initData.envMapRotation;return e===F&&this._isInteriorLightActive&&(e=bt),t===U&&this._isInteriorLightActive&&(t=Mt),{intensity:e,rotation:t}}_setDefaultEnvironmentScene(){const e=this._initData.sceneLight,{intensity:t,rotation:i}=this._getEnvMapIntensityAndRotation();this._scene.userData.environmentDefinition=new ft(new yt({type:e}),{rotation:i,intensity:t,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!0,this._requestRender()}_setEnvMap(e){const{url:t,environmentMap:i}=e,{intensity:s,rotation:n}=this._getEnvMapIntensityAndRotation();this._scene.environment=i,this._scene.userData.environmentDefinition=new ft(i,{rotation:n,intensity:this._initData.legacyLight?.9:s,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!this._initData.legacyLight,this._environment instanceof _t&&this._environment.updateEnvironmentTexture(i),t!==j||this._globalInitData.e2e||window.requestIdleCallback(this.loadEnvMap.bind(this,"static/default_1k-2aa6d42244d30fb1.exr")),this._requestRender()}_tabVisible(){this.updateCamera(!1)}_releaseKeystrokeStates(){const e=["Shift","Meta","Control","Escape"];for(const t of e){const e=new KeyboardEvent("keyup",{key:t});this._onKeyUp(e,!0)}}updateCamera(e=!0){var t;const{x:i,y:s}=this._domHelper.getClientDimensions();null===(t=this._roomleRenderer)||void 0===t||t.setSize(i,s),this.cameraBehaviour.cameraControl.updateCamera(),this._renderEverything()}_onWindowResize(){const e=this._getInputManager();e&&e.updateSize(),this.updateCamera(),this._requestRender()}_isPartOfScene(e){return"Object3D"===e.type||"Mesh"===e.type||"GLB"===e.type||"GLTF"===e.type||"Group"===e.type}cleanUp(){this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener),this.cameraBehaviour.cameraControl&&this.cameraBehaviour.cameraControl.cleanUp(),this._stopRendering=!0}clearScene(){let e=[];this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)}),e.forEach(e=>{H(e),this._scene.remove(e)}),this._renderer.renderLists.dispose()}enableHD(e){this._renderer.capabilities.maxTextures>8&&e&&this.loadDynamicLightSetting(e),this._requestRender()}_loadGLTF(e,t,i,s,n,a,o){return new Promise((r,h)=>{this._staticItemLoader.loadGLTF(e,t,i,s,n,a,null,o).then(e=>{r(e.scene)},h)})}_loadGLB(e,t,i,s,n,a,o,r){return new Promise((h,l)=>{this._staticItemLoader.loadGLB(e,t,i,s,n,a,o,r).then(e=>{h(e.scene)},l)})}showGUI(){if(this._initData.disableDebugGUI)return;const e=document.createElement("style");e.innerText=".dg.main{position:absolute;z-index:999;top:0;left:0;}",document.head.appendChild(e);let t=I(!1);t&&(this._domHelper.element.appendChild(t.domElement),t.domElement.style.zIndex="999",t.domElement.style.overflowY="auto",t.domElement.style.maxHeight=this._domHelper.element.clientHeight+"px",this._guiLoaded())}_guiLoaded(){let e=I();if(!e)return;const t=e.addFolder("Scene Parameter"),i={intensity:this._initData.envMapIntensity,rotation:this._initData.envMapRotation};t.add(i,"intensity",0,4,.01).name("env map intensity").onChange(e=>{this.changeEnvironmentMapIntensity(e),this._requestRender()}),t.add(i,"rotation",0,2*Math.PI,.01).name("env map rotation").onChange(e=>{this._scene.userData.environmentDefinition.rotation=e,this._requestRender()}),this._lightSetting&&this._lightSetting.showGUI(),this._roomleRenderer&&this._roomleRenderer.showGUI(()=>this._requestRender()),this._environment&&this._environment.showGUI(()=>this._requestRender()),this._addGUIListener(e)}_addGUIListener(e){let t=e.__folders;Object.keys(t).forEach(e=>{let i=t[e];i.__folders&&Object.keys(i.__folders).forEach(e=>{let t=i.__folders[e];this._addGUIListener(t)}),i.__controllers&&i.__controllers.forEach(e=>{e.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._renderEverything()}showStats(){t.import("./stats-helper-c0791263.legacy.js").then(e=>this._statsHelper=new e.default)}_onKeyDown(e){}_onKeyUp(e,t=!1){}pause(){this._getInputManager().removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1),document.removeEventListener("visibilitychange",this)}resume(){this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this.updateCamera()}destroy(){this.pause(),this.cleanUp()}handleEvent(e){switch(e.type){case"resize":this._onWindowResize();break;case"keydown":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyDown(e);break;case"keyup":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyUp(e);break;case"visibilitychange":this._tabVisible(),this._releaseKeystrokeStates()}}async loadSceneSettings(e){let t,i;return t=e.environment?new Promise(t=>{(new ht).load(this._scene,this._renderer.domElement,this._environment,e,this._maxAnisotropy).then(e=>{this._setEnvironment(e),t()})}):Promise.resolve(),e.lights?(this._lightSetting=new ct(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(e)):i=Promise.resolve(),new Promise((e,s)=>{Promise.all([t,i]).then(()=>{this._renderEverything(),e()},s)})}setBackgroundColor(e){this._setEnvironment(new rt(this._scene,this._environment,new ee(e)))}setBackgroundImage(e){this._setEnvironment(new rt(this._scene,this._environment,null,this._renderer.domElement,e))}_setEnvironment(e){this._environment=e,this._renderEverything()}async loadDynamicLightSetting(e){this._lightSetting=new ct(this._scene,this._lightSetting);let t=!1;if(e.url)await this._lightSetting.loadFromURL(e.url),t=!0;else if(e.json)await this._lightSetting.loadFromJSON(e.json),t=!0;else if(e.object)await this._lightSetting.loadFromObject(e.object),t=!0;else if(e.ls){const i=N.createDynamicLightSettingSource(null,e.ls);await this._lightSetting.loadFromURL(i.url),t=!0}if(!t)throw new Error("No dynamic light setting source set");this._requestRender()}getScene(){return this._scene}updateScene(){var e;this._updateBounds(this.getBounds(),this.getGeometryBounds()),null===(e=this._roomleRenderer)||void 0===e||e.forceShadowUpdates(!0),this._renderEverything()}_updateBounds(e,t,i=!1){var s;if(!e)return;const n=null!=t?t:e;this.updateEnvironment(n,i),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(e),null===(s=this._roomleRenderer)||void 0===s||s.updateBounds(n),this._requestRender(),this._pluginSystem.updateBounds(e)}setCameraOffset(e){const t=this.cameraBehaviour.cameraControl.getCamera(),i=t||t;(null==i?void 0:i.offset)?(i.offset=e,this._renderEverything()):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){var e,t;const i=null===(t=null===(e=this.cameraBehaviour)||void 0===e?void 0:e.cameraControl)||void 0===t?void 0:t.getCamera(),s=i||i;return(null==s?void 0:s.offset)?JSON.parse(JSON.stringify(s.offset)):{left:0,top:0,right:1,bottom:1}}getOrthographicOffsetCamera(){if(!this._orthographicOffsetCamera){const e=this.getCameraOffset(),t=5;let i=this._domHelper.getAspectRatio()*t,s=t;const n=tt();this._orthographicOffsetCamera=n.createOrthographicCamera(i/-2,i/2,s/2,s/-2,1,1e3,e),this._orthographicOffsetCamera.position.set(0,10,0),this._orthographicOffsetCamera.lookAt(new q(0,0,0))}return this._orthographicOffsetCamera}getPerspectiveOffsetCamera(){if(!this._perspectiveOffsetCamera){const e=this.getCameraOffset(),t=this._domHelper.getClientDimensions(),i=t.x,s=t.y,n=tt();this._perspectiveOffsetCamera=n.createPerspectiveCamera(30,i/s,.1,20,e)}return this._perspectiveOffsetCamera}updateEnvironment(e,t=!1){var i;if(e&&this._environment&&this._environment.needsBounds()){const i=e.getSize(new q);(i.x+i.y+i.z!==0||t)&&this._environment.updateBounds(e.getSize(new q),t)}null===(i=this._roomleRenderer)||void 0===i||i.updateBounds(e)}_onCameraIdle(){return!0}_onCameraMove(){return!0}_waitForAssets(){return Promise.resolve()}async exportCanvasScreenshot(e=1){return await this._waitForAssets(),new Promise(t=>{this._onAfterRender=()=>{const i=this._renderer.domElement.toDataURL(this._initData.transparentBackground?"image/png":"image/jpeg",e);t(i),this._onAfterRender=()=>{}},this._requestRender()})}async exportImageFromCamera(e,t=!1){return t&&await this._waitForAssets(),new Promise((t,i)=>{this._onAfterRender=()=>{this._onAfterRender=()=>{};const s=this._renderer.domElement.toDataURL("image/jpeg",1),{left:n,right:a,top:o,bottom:r}=this.getCameraOffset(),h=a-n,l=o-r;if(1===h&&1===l)return Ke(e,s),void t();const c=new Image;c.src=s,c.onload=()=>{const{naturalWidth:i,naturalHeight:s}=c,a=document.createElement("canvas");a.width=i*h,a.height=s*l;const r=a.getContext("2d"),d=i*n*-1,_=s*(1-o)*-1;r.drawImage(c,d,_),r.save(),Ke(e,a.toDataURL("image/jpeg",1)),t()},c.onerror=i},this._requestRender()})}changeEnvironmentMapIntensity(e){this._scene.userData.environmentDefinition.intensity=e}lockCamera(){this.cameraBehaviour.cameraControl.lock()}unlockCamera(){this.cameraBehaviour.cameraControl.unlock()}setEnvironmentMap(e,t,i,s){void 0!==e&&this._hdrEnvironmentLoader.loadUrl(this._renderer,e),void 0!==t&&(this._scene.userData.environmentDefinition.intensity=t),void 0!==i&&(this._scene.userData.environmentDefinition.rotation=i),void 0!==s&&(this._scene.userData.environmentDefinition.maxNoOfLightSources=s,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}_getCameraControl3D(e){return this._cameraControl3D?e&&this._cameraControl3D.setCurrentCameraParameters(e):this._cameraControl3D=new Qe(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera()),this._cameraControl3D}_getCameraControl2D(){return this._cameraControl2D||(this._cameraControl2D=new xt(this._creator_,this._getInputManager(),null,this.getOrthographicOffsetCamera())),this._cameraControl2D}_getCameraControlFirstPerson(){return this._cameraControlFirstPerson||(this._cameraControlFirstPerson=new ot(this._creator_,this._getInputManager(),null,this.getPerspectiveOffsetCamera())),this._cameraControlFirstPerson}}e("S",Ct),i([s],Ct.prototype,"_domHelper",void 0),i([s],Ct.prototype,"_scriptLoader",void 0),i([s],Ct.prototype,"_lifeCycleManager",void 0),i([s],Ct.prototype,"_staticItemLoader",void 0),i([s],Ct.prototype,"_hdrEnvironmentLoader",void 0),i([s],Ct.prototype,"_initData",void 0),i([s],Ct.prototype,"_globalInitData",void 0),i([s],Ct.prototype,"_globalCallback",void 0),i([s],Ct.prototype,"_idbManager",void 0),i([s],Ct.prototype,"_pluginSystem",void 0),i([s],Ct.prototype,"_imageRenderer",void 0),i([s],Ct.prototype,"_cameraBehaviourState",void 0),e("b",class{constructor(e,t){var i;return this._state=null,this._cameraChangeListener=null,this._cameraControl=e,this._state=t,(null===(i=window.__RML__DEBUG__)||void 0===i?void 0:i.camera)?Ye(this,"CameraBehaviour"):this}get state(){return this._state}setCameraChangeListener(e){this._cameraChangeListener=e}removeCameraChangeListener(){this._cameraChangeListener=null}_onCameraChanged(){this._cameraChangeListener&&this._cameraChangeListener()}})}}}));
2
- //# sourceMappingURL=camera-behaviour-93d5da66.legacy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component-dimensioning-7434957b.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"component-raycast-helper-3ee11650.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"configurator-6d986be2.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"continuous-drawing-helper-a7b33c02.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"default-light-setting-313288f6.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"glb-viewer-camera-behaviour-326dd288.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"imos-ix-poc-export-helper-29f473ec.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"material-viewer-01dc1ff6.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- System.register(["./script-loader-ad2c9b81.legacy.js","./roomle-dependency-injection-3f47127d.legacy.js","./camera-behaviour-93d5da66.legacy.js","./main-thread-to-worker-32b45184.legacy.js","./roomle-configurator-0226891c.legacy.js","./glb-viewer-camera-behaviour-326dd288.legacy.js","./external-objects-01d5a216.legacy.js","./query-params-helper-ad6b6b64.legacy.js","./Object3D-1f141c55.legacy.js","./default-light-setting-313288f6.legacy.js"],(function(e,t){var n,a,i,r,s,o,l,c,h,d,g,m,u,_,p,C,v,f,w,b,P,M,E,I,S,O,y,D,j,H,L,A,x,B,R,k,V,T,F,W,K,U,G,N,z,Z,q,X,J,Q,$,Y,ee,te,ne,ae,ie,re,se,oe,le,ce,he,de,ge,me,ue,_e,pe,Ce,ve,fe,we,be,Pe,Me,Ee,Ie,Se,Oe,ye,De,je,He,Le,Ae,xe,Be,Re,ke,Ve,Te,Fe,We,Ke,Ue,Ge,Ne,ze,Ze,qe,Xe,Je,Qe,$e,Ye,et,tt,nt,at,it,rt,st,ot;return{setters:[function(e){n=e.S,a=e.M},function(e){i=e.n,r=e.E,s=e.q,o=e.F,l=e._,c=e.i,h=e.ax,d=e.z,g=e.M,m=e.N,u=e.ay,_=e.t,p=e.o,C=e.S,v=e.az,f=e.aA,w=e.aB,b=e.p,P=e.C,M=e.aC,E=e.H,I=e.W,S=e.aD,O=e.a6,y=e.aE,D=e.aF,j=e.j,H=e.aG,L=e.aH,A=e.Z,x=e.aI,B=e.aJ,R=e.ae,k=e.k,V=e.aK,T=e.aL,F=e.aM,W=e.aN,K=e.T,U=e.U,G=e.V,N=e.aO,z=e.aP,Z=e.aQ,q=e.aR,X=e.aS,J=e.au,Q=e.at,$=e.a2,Y=e.B,ee=e.aT,te=e.aU,ne=e.O,ae=e.$,ie=e.G,re=e.aV,se=e.D,oe=e.L,le=e.aW,ce=e.R,he=e.b},function(e){de=e.L,ge=e.b,me=e.d,ue=e.B,_e=e.C,pe=e.e,Ce=e.I,ve=e.f,fe=e.T},function(e){we=e.a,be=e.A,Pe=e.C,Me=e.D,Ee=e.V,Ie=e.al,Se=e.bK,Oe=e.aK,ye=e.bi,De=e.h,je=e.x,He=e.bX,Le=e.b1,Ae=e.aM,xe=e.ak,Be=e.H,Re=e._,ke=e.e,Ve=e.k,Te=e.ax,Fe=e.ay,We=e.bq,Ke=e.a0,Ue=e.aY,Ge=e.ad,Ne=e.q,ze=e.a$,Ze=e.c9,qe=e.aN,Xe=e.ca,Je=e.K,Qe=e.aZ},function(e){$e=e.S,Ye=e.b,et=e.C,tt=e.P,nt=e.c,at=e.G,it=e.R},function(e){rt=e.G},function(e){st=e.i,ot=e.a},function(){},function(){},function(){}],execute:function(){class lt extends de{constructor(e,t){super(e,t),this._center=new we(0,0,0),this._params={ambientLight:{color:"#ffffff"},hemiLight:{color:"#ffffff"},mainDirLight:{direction:{x:2,y:1,z:2},color:"#ffffff"}},this._ambientLight=new be(new Pe(this._params.ambientLight.color),.4),this._ambientLight.layers.set(1),this._mainDirLight=new Me(new Pe(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 Ee(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 we));const t=new Ie;e.getBoundingSphere(t);const n=t.radius,a=new we(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);a.normalize(),a.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(a),this._mainDirLight.target.position.copy(this._center),this._mainDirLight.target.updateMatrixWorld(!0),this._mainDirLight.shadow.camera.top=n,this._mainDirLight.shadow.camera.bottom=-n,this._mainDirLight.shadow.camera.left=-n,this._mainDirLight.shadow.camera.right=n,this._mainDirLight.shadow.camera.near=.01,this._mainDirLight.shadow.camera.far=2*n,this._mainDirLight.shadow.camera.updateProjectionMatrix()}showGUI(){let e=i();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 Pe(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 Pe(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 Pe(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))}}}}const ct=e=>e instanceof s||e instanceof o;class ht{constructor(e){const{planElementViewModel:t,planElementViewModels:n,selectionMode:a,reason:i}=e;this.planElementViewModel=t,this.planElementViewModels=n,this.selectionMode=a,this.reason=i}}class dt{constructor(e){const{planElementViewModel:t,resetCamera:n,state:a,oldState:i,reason:r}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===a?0:a,this.oldState=void 0===i?0:i,this.reason=r}}class gt extends $e{constructor(e,t,n,a){super(e,t,n,a),this._isDrawingEnabled=!1,this._isCurrentlyDrawing=!1,this._isMeasurementLineDrawActive=!1,this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0),this._raycastHelper.addEventListener(0,()=>{2!==this._state?this._plannerSelectionHandler.cancelSelection("click_outside"):this.resetState()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(this.isDragIn()?19:0,new dt({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(2,({planElementViewModels:e})=>{this._roomlePlannerUiCallback.onMultiSelectionChange(e)},this),this._plannerSelectionHandler.addEventListener(3,({selectionMode:e})=>{"multiselect"===e&&this._hoveredObject&&this._hoverOnMultiSelect(this._hoveredObject),this._roomlePlannerUiCallback.onSelectionModeChange(e),this._checkRaycasterSnapping()},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e,reason:t})=>{1!==this._state&&this.setState(0),this.dispatchEvent(1,new dt({planElementViewModel:e,reason:t}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}disable(){const e=new Se;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}get hoveredObjectId(){var e;return(null===(e=this._hoveredObject)||void 0===e?void 0:e.getPlanElement())?this._hoveredObject.getId():null}get isCurrentlyDrawing(){return this._isCurrentlyDrawing}enable(){const e=new Se;e.disableAll(),e.enable(3),e.enable(7),e.enable(6),e.enable(9),e.enable(2),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}enableConstructionEvents(e){e?this._raycastHelper.getLayers().enable(9):this._raycastHelper.getLayers().disable(9)}enableObjectEvents(e){e?this._raycastHelper.getLayers().enable(6):this._raycastHelper.getLayers().disable(6)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}addConstructionPlanObjectHandlers(e,t){t||(t=e.getBoundingBox());const n={planElementName:e.getName(),hasListener:!0,priority:Ye.CONSTRUCTION,roomleId:e.getId(),snapToWall:!0};this._addPlanObjectHandlers(e,t,n)}addPlanObjectHandlers(e,t){t||(t=e.getBoundingBox());const n={planElementName:e.getName(),hasListener:!0,priority:Ye.DEFAULT,roomleId:e.getId()};this._addPlanObjectHandlers(e,t,n)}addWallHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{planElementName:e.getName(),hasListener:!0,priority:Ye.WALL,roomleId:e.getId()})}addWallAtticHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{planElementName:e.getName(),hasListener:!0,priority:Ye.WALL,roomleId:e.getId()})}addMeasurementLineHandlers(e){const t={planElementName:e.getName(),hasListener:!0,priority:Ye.DEFAULT,roomleId:e.getId()};this._addMeasurementLinePlanElementHandlers(e,e.getPoint1DraggableBoundingBox(),t,h.POINT1),this._addMeasurementLinePlanElementHandlers(e,e.getPoint2DraggableBoundingBox(),t,h.POINT2),this._addMeasurementLinePlanElementHandlers(e,e.getBoundingBox(),t,null)}addFloorHandlers(e){this._addFloorElementHandlers(e,e.getObject(),{planElementName:e.getName(),hasListener:!0,priority:Ye.FLOOR,roomleId:e.getId()})}addNodeHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{planElementName:e.getName(),hasListener:!0,priority:Ye.DEFAULT,roomleId:e.getId()})}_addPlanObjectHandlers(e,t,n){t.userData.hasListener||(t.userData=Oe(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)))}_addFloorElementHandlers(e,t,n){this._addElementHandlers(e,t,n)}_addElementHandlers(e,t,n){t.userData.hasListener||(t.userData=Oe(t.userData,n),t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("double_click",t=>{var n;this._doubleClickElement(e,t.attachment.type,null===(n=t.attachment.intersection)||void 0===n?void 0:n.point)}),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)))}_addPlanElementHandlers(e,t,n){t.userData.hasListener||(this._addElementHandlers(e,t,n),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)))}_addMeasurementLinePlanElementHandlers(e,t,n,a){if(t.userData.hasListener)return;t.userData=Oe(t.userData,n);const i=()=>{e.currentPoint=a};t.addEventListener("select",()=>{this._clickElement(e),i()}),t.addEventListener("drag_start",()=>{i(),e.selectPointOnDragStart(e),this._dragStart(e)}),t.addEventListener("drag",t=>{i(),e.hideDraggablePointsOnDragStart(e,a),this._drag(e,t.attachment.position)}),t.addEventListener("drag_end",t=>{e.showDraggablePointsOnDragEnd(e,a),this._dragEnd(e,t.attachment.position),e.showDraggableNodes(),i()}),t.addEventListener("hover_on",()=>{i(),e.showDraggablePointsOnHoverOn(e),this._hoverOn(e)}),t.addEventListener("hover_off",()=>{i(),e.showDraggablePointsOnHoverOff(e),this._hoverOff(e)})}_createFloorMeshWithHandler(){const e=new ye(1e3,1e3,8,8),t=new De;t.visible=!1;const n=new je(e,t);n.name="2D raycaster floor mesh",n.rotation.set(-Math.PI/2,0,0),n.layers.enable(2),n.userData.ignoreElementHit=!0;const a={planElementName:"2D raycaster floor mesh",hasListener:!0,priority:Ye.RAYCASTER_FLOOR,roomleId:void 0};return n.userData=Oe(n.userData,a),n.addEventListener("double_click",e=>{this._doubleClickOnPlane(d(e.attachment.intersection.point),e.attachment.type)}),n.addEventListener("select",e=>{const t=d(e.attachment.intersection.point);this._isCurrentlyDrawing?this._clickOnPlane(t):this._plannerSelectionHandler.cancelSelection("click_outside")}),n}_clickOnPlane(e){this._createNode(null,e)}_doubleClickOnPlane(e,t=0){this._isMeasurementLineDrawActive||(this._closeToPoint(e)?this.stopDrawing():this._toggleDrawing(null,e,t))}_closeToPoint(e){let t=!1;for(const n of this._planViewModel.getNodePlanObjectViewModels())this._close(n.getPlanElement().getCenter(),e)&&(t=!0);return t}_close(e,t){return Math.abs(e.x-t.x)<500&&Math.abs(e.y-t.y)<500&&Math.abs(e.z-t.z)<500}_clickElement(e){St(e,this._initData)?this._plannerSelectionHandler.cancelSelection("click_outside"):this._isCurrentlyDrawing||(e instanceof g&&e.handleDraggablePointsSelection(e),this._debug&&e.getId(),2!==this._state?(this._plannerSelectionHandler.check(e),this._roomlePlannerUiCallback.onClickElement(e),this._setCursor()):this.resetState())}_doubleClickElement(e,t=0,n){if(!this._isDrawingEnabled||!(e instanceof m||e instanceof s))return;let a;this._debug&&e.getId(),e instanceof s&&this._plannerSelectionHandler.cancelSelection("double_click_wall"),e instanceof m?a=e.getPlanElement().getCenter():n&&(a=d(new we(n.x,0,n.z))),this._isCurrentlyDrawing?this.endWallDrawing(null,a):this._startWallDrawing(null,a,t)}_hoverOn(e){e instanceof g&&e.showDraggablePointsOnHoverOn(e),this._isCurrentlyDrawing||("multiselect"===this._plannerSelectionHandler.getSelectionMode()?this._hoverOnMultiSelect(e):this._hoverOnStandard(e))}_hoverOnMultiSelect(e){ct(this._hoveredObject)||ct(e)?(this._hoveredObject=null,He("default")):this._hoverOnStandard(e)}_hoverOnStandard(e){e.hoverOn(),this._hoveredObject=e,this.dispatchEvent(3,new dt({planElementViewModel:e})),this._interaction(),this._setCursor()}_hoverOff(e){e.hoverOff(),e instanceof g&&e.showDraggablePointsOnHoverOff(e),this.dispatchEvent(4,new dt({planElementViewModel:e})),this._interaction(),this._hoveredObject=null,this._setCursor()}_isHoveredObjectNonDraggable(){return this._hoveredObject instanceof o}_setCursor(){4===this._state?He("crosshair"):2===this._state&&this._hasSelection()?He("ew-resize"):1===this._state?He("grabbing"):!this._isHoveredObjectNonDraggable&&this._plannerSelectionHandler.isSelected(this.hoveredObjectId)?He("move"):this._hoveredObject?St(this._hoveredObject,this._initData)?He("default"):He("pointer"):3===this._state?He(u?"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"):He("default")}setCamera(e){this._raycastHelper.setCamera(e)}setObject(e){this._raycastHelper.setObject(e)}getSelectedIds(){return this._plannerSelectionHandler.getSelectedIds()}setSelectionMode(e){this._plannerSelectionHandler.setSelectionMode(e),"multiselect"===e&&this._roomlePlannerUiCallback.onMultiSelectionChange(this._plannerSelectionHandler.getSelectedPlanElementViewModels())}setPlanViewModel(e){this._planViewModel=e}cancelSelection(e){this.isDragIn()&&"dock_component"===e||this._plannerSelectionHandler.cancelSelection(e)}removeSelection(){this._plannerSelectionHandler.removeSelection()}_dragStart(e){this._isMeasurementLineDrawActive||((this._plannerSelectionHandler.isSelected(e.getId())||this._dragIn)&&0===this._state||this._isDrawingEnabled)&&(this.dispatchEvent(8),Le(w.DRAG).then(()=>{if(this._inputManager.isMouseUp())return this.setState(0),He("pointer"),void this.dispatchEvent(12);this._draggedObject=e,this.setState(1),this._roomlePlannerUiCallback.onDragElementStart(e.getId()),this.dispatchEvent(9,new dt({planElementViewModel:e}))}))}_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;this._lastDragPosition||(this._lastDragPosition=t);let a=t.clone().sub(this._lastDragPosition);this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanElement()));const i=d(a);this._plannerSelectionHandler.hasMultiSelection()&&(i.z=0),n.moveObjectsBy(e,i),this._lastDragPosition.copy(t)}else e instanceof g?this._dragMeasurementLine(e,t):((e instanceof m||e instanceof s||this._planViewModel.cameraType===Ae.CAMERA_2D)&&(t.y=_(e.getPlanElement().getCenter()).y),n.moveElementTo(e.getPlanElement(),d(t)));this.dispatchEvent(10,new dt({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this._lastDragPosition=null,this.setState(0),this.dispatchEvent(11,new dt({planElementViewModel:e})),this._dragIn&&this.setDragIn(!1),this._roomlePlannerUiCallback.onDragElementEnd(),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this.planInteractionHandler,a=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),a.rotation-t)}}setState(e){var t,n;const a=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new dt({state:this._state,oldState:a})),this._position=null,2===this._state?null===(t=this.planInteractionHandler)||void 0===t||t.deactivateAllSnappingActivity():2===a&&(null===(n=this.planInteractionHandler)||void 0===n||n.reactivateAllSnappingActivity())}resetState(){this.setState(0)}_move(e){if(3!==this._state&&4!==this._state&&2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:a}=e.positionRelative;this._position?t=1.4*e.positionRelative.x*Math.PI-1.4*this._position.x*Math.PI:this._position=new we(e.positionRelative.x,e.positionRelative.y,0);const i=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,r=new xe;this.getSelectedIds().forEach(e=>{var t;const n=null===(t=this._planViewModel)||void 0===t?void 0:t.getPlanObjectForId(e);n&&n.getObject()&&(i.push_back(n.getPlanElement()),r.expandByObject(n.getContainer()))});const s=r.getCenter(new we);this.planInteractionHandler.rotateObjectsBy(i,t,d(s)),this._position.copy(new we(n,a,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}async selectPlanElement(e){(e instanceof p||e instanceof C)&&await e.isInitDone(),this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(13,new dt({}))}addComponentDragInHandler(e){if(!this._dragIn)return;const t=e.getBoundingBox(),n=e instanceof b||e instanceof P;this._addPlanElementHandlers(e,t,{planElementName:e.getName(),hasListener:!0,priority:Ye.DEFAULT,roomleId:e.getId(),snapToWall:n}),this._raycastHelper.enableDragIn(t),this._dragStart(e)}enableSnapping(){this.planInteractionHandler.enableSnap=!0,this._checkRaycasterSnapping()}disableSnapping(){this.planInteractionHandler.enableSnap=!1,this._checkRaycasterSnapping()}enableAdvancedDocking(){this.planInteractionHandler.dockWhenSnap=!0}disableAdvancedDocking(){this.planInteractionHandler.dockWhenSnap=!1}showsChildrenOfPlanObject(e){return this.planInteractionHandler.getShowChildrenOfPlanObject(e).value!==v.OFF}enableShowChildrenOfPlanObject(e){this.planInteractionHandler.setShowChildrenOfPlanObject(e,{value:v.GROUND_COMPONENTS},!1)}disableShowChildrenOfPlanObject(e){this.planInteractionHandler.setShowChildrenOfPlanObject(e,{value:v.OFF},!1)}_checkRaycasterSnapping(){const e=this.planInteractionHandler.enableSnap,t="multiselect"===this.getSelectionMode();e&&!t?this._raycastHelper.enableOnWallSnapping():this._raycastHelper.disableOnWallSnapping()}enableWallDrawing(){return this._isDrawingEnabled=!0,this._drawingGroup=new Be,this._drawingGroup.name="Drawing",this._drawingGroup.add(this._createFloorMeshWithHandler()),this._inputManager.addEventListener(6,this._drawWallOnMouseMove,this),this._inputManager.addEventListener(13,this.endWallDrawing,this),this._drawingGroup}cancelWallDrawing(){return this._isDrawingEnabled=!1,this._setStateAndCursor(0),this._inputManager.removeEventListener(6,this._drawWallOnMouseMove),this._inputManager.removeEventListener(13,this.endWallDrawing),this._raycastHelper.clear(),this._drawingGroup}stopDrawing(e=!0){var t;this.planInteractionHandler.endInteraction(),e&&this.planInteractionHandler.cancelDrawing(),this._raycastHelper.getLayers().enable(9),this._isCurrentlyDrawing=!1,this._setStateAndCursor(0),this.dispatchEvent(7),null===(t=this._continuousDrawingHelper)||void 0===t||t.endDrawing(),this._roomlePlannerUiCallback.onDrawingStateChanged(!1)}startDrawing(){var e;this._isCurrentlyDrawing||(this._isCurrentlyDrawing=!0,this._raycastHelper.getLayers().disable(9),this.dispatchEvent(6),this._setStateAndCursor(3),null===(e=this._continuousDrawingHelper)||void 0===e||e.update(),this._roomlePlannerUiCallback.onDrawingStateChanged(!0))}_toggleDrawing(e,t,n){this._isCurrentlyDrawing?this.endWallDrawing(e,t):this._startWallDrawing(e,t,n)}endWallDrawing(e,t){if(this._isCurrentlyDrawing){if(this.planInteractionHandler.getContinuousDrawingManager().shouldShowCircle()&&this.planInteractionHandler.getContinuousDrawingManager().shouldShowCircle())this.planInteractionHandler.cancelDrawing();else{const{x:n,y:a}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.endDrawing({x:n,y:a,z:0})}this.stopDrawing(!1)}}async _startWallDrawing(e,t,n){var a,i;(e&&2===e.type||2===n)&&(await this._initMobileDrawing(),this._continuousDrawingHelper.update()),this.planInteractionHandler.startInteraction();const{x:r,y:s}=t||this._getIntersectionPointWithScene(e),o=(null===(i=null===(a=this._initData)||void 0===a?void 0:a.featureFlags)||void 0===i?void 0:i.drawPreviewMode)===f.VECTOR;this.planInteractionHandler.beginDrawing({x:r,y:s,z:0},o),this.startDrawing()}async _initMobileDrawing(){if(this.planInteractionHandler.setDrawingType(0),this.planInteractionHandler.setSnapFeedbackWhileDrawing(!0),!this._continuousDrawingHelper){const{default:e}=await t.import("./continuous-drawing-helper-a7b33c02.legacy.js");this._continuousDrawingHelper=new e,this._continuousDrawingHelper.init(this._drawingGroup,this.planInteractionHandler.getContinuousDrawingManager(),this._kernelZoomFactor)}}_drawWallOnMouseMove(e){var t;if(!this._isCurrentlyDrawing||this._isMeasurementLineDrawActive)return;const{x:n,y:a}=this._getIntersectionPointWithScene(e);this.planInteractionHandler.currentDrawingPosition({x:n,y:a,z:0}),null===(t=this._continuousDrawingHelper)||void 0===t||t.update(),this.dispatchEvent(5)}_createNode(e,t){if(!this._isCurrentlyDrawing)return;const{x:n,y:a}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.forceNode({x:n,y:a,z:0}),this._raycastHelper.clear()}_getIntersectionPointWithScene(e){return this._raycastHelper.intersectMouseOnScene(e)}_setStateAndCursor(e){this.setState(e),this._setCursor()}setKernelZoomFactor(e){var t;this._kernelZoomFactor=e,null===(t=this._continuousDrawingHelper)||void 0===t||t.setKernelZoomFactor(e)}enableMeasurementLineDrawing(){this._setStateAndCursor(4),this._isMeasurementLineDrawActive=!0,this._enableDrawingListeners()}disableMeasurementLineDrawing(){this._disableDrawingListeners(),this.dispatchEvent(17),this.setState(0),this._isMeasurementLineDrawActive=!1,this._currentPlanMeasure=null}_handleMeasurementLineDrawingEvent(e){return 6===e?this._drawMeasurementLineOnMouseMove:5===e||14===e||13===e?this._createPlanMeasure:null}_enableDrawingListeners(){[5,6,14,13].forEach(e=>{this._inputManager.addEventListener(e,this._handleMeasurementLineDrawingEvent(e),this)})}_disableDrawingListeners(){[5,6,14,13].forEach(e=>{this._inputManager.removeEventListener(e,this._handleMeasurementLineDrawingEvent(e))})}_drawMeasurementLineOnMouseMove(e){if(!this._currentPlanMeasure)return;4!==this._state&&this._setStateAndCursor(4);const{x:t,y:n}=this._getIntersectionPointWithScene(e);this.planInteractionHandler.setMeasurePoint2(this._currentPlanMeasure,{x:t,y:n,z:0},!0,!0)}_updateMeasurementLineViewModels(e){"hide_dragged_node"===e?this._planViewModel.getMeasurementLineObjectViewModels().forEach(e=>{this._currentPlanMeasure.getId()===e.getId()&&e.hidePoint2DraggableNode()}):"showDraggableNodes"===e&&this._planViewModel.getMeasurementLineObjectViewModels().forEach(e=>{this._currentPlanMeasure.getId()===e.getId()&&(e.showDraggableNodes(),e.showDraggablePointsOnDragEnd(e,"point2"))})}_createPlanMeasure(e){const{x:t,y:n}=this._getIntersectionPointWithScene(e),a={x:t,y:n,z:0};if(!this._currentPlanMeasure)return this.dispatchEvent(16),this._currentPlanMeasure=this.planInteractionHandler.addMeasure(a,a),void this._updateMeasurementLineViewModels("hide_dragged_node");this.planInteractionHandler.setMeasurePoint2(this._currentPlanMeasure,a,!0,!0),this._updateMeasurementLineViewModels("showDraggableNodes"),this.disableMeasurementLineDrawing()}_dragMeasurementLine(e,t){const n=e.getPlanElement();if(!e.currentPoint){if(!this._lastDragPosition)return void(this._lastDragPosition=t.clone());const a=t.clone().sub(this._lastDragPosition),i=_(n.getCenter()).add(a);return this.planInteractionHandler.moveElementTo(n,d(i)),this._lastDragPosition.copy(t),e.update(),void this.dispatchEvent(18)}e.currentPoint===h.POINT1&&this.planInteractionHandler.setMeasurePoint1(n,d(t),!0,!0),e.currentPoint===h.POINT2&&this.planInteractionHandler.setMeasurePoint2(n,d(t),!0,!0)}setMeasurementLineLength(e,t,n){if(!e)return void console.error("Measurement line not found");const a=t/1e3,i="left"===n.toLowerCase(),r=i?e.getPoint2Draggable().position.clone():e.getPoint1Draggable().position.clone(),s=(new we).subVectors(e.getPoint2Draggable().position,e.getPoint1Draggable().position).normalize().multiplyScalar(a),o=i?r.sub(s):r.add(s);i?this.planInteractionHandler.setMeasurePoint1(e.getPlanElement(),d(o),!1,!1):this.planInteractionHandler.setMeasurePoint2(e.getPlanElement(),d(o),!1,!1)}}l([c],gt.prototype,"_plannerSelectionHandler",void 0),l([c],gt.prototype,"_plannerKernelAccess",void 0),l([c],gt.prototype,"_roomlePlannerUiCallback",void 0),l([c],gt.prototype,"_initData",void 0);const mt=(e,t,n,a)=>{const i=(new xe).setFromObject(e.getContainer()).getCenter(new we);return{runtimeIds:[e.getId()],position2d:M(E(i,t,n,a))}},ut=e=>{if(e instanceof C){const t=e.getPlanObject().getObjectType();return"door"!==t&&"window"!==t?"static":t}return e instanceof p?"configuration":e instanceof s?"wall":e instanceof o?"floor":e instanceof g?"measure":e instanceof I?"attic":"unknown"};var _t=function(e){function t(){var e;Ve(this,t);var n=t.SkyShader,a=new Te({name:n.name,uniforms:Fe.clone(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:We,depthWrite:!1});return(e=Ke(this,t,[new Ue(1,1,1),a])).isSky=!0,e}return Re(t,e),ke(t)}(je);_t.SkyShader={name:"SkyShader",uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new we},up:{value:new we(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calculation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorption + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPosition );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\n\t\t}"};const pt=async(e,t,n)=>{const{objects:a,itemIds:i,configurationIds:r}=await(async(e,t)=>{const n=[],a=[],i=[];return await Promise.all(e.map(async e=>{var r;if((null===(r=e.configurationType)||void 0===r?void 0:r.value)!==S.EXTERNAL){const r=O(e);if(r.configurationHash?i.push(r.configurationHash):r.catalogItemId&&a.push(r.catalogItemId),r.parts){const e=r.configurationHash||r.catalogItemId;r.parts=await t.addUiDataAndPriceToPartList(r.parts,e)}if(r.configuration){const e=await t.getConfigurationData(r.runtimeId);r.configuration=e.configuration}r.data=null,n.push(r)}})),{objects:n,itemIds:a,configurationIds:i}})(e,t),{data:s,rootComponentIds:o}=await(async(e=[],t=[],n)=>{const[a,i]=await Promise.allSettled([n.getItems(e),n.getConfigurations(t)]),r=[],s=new Map;if("fulfilled"===a.status)for(const e of a.value)s.set(e.id,e);if("fulfilled"===i.status)for(const e of i.value)s.set(e.id,e),r.push(e.rootComponentId);else console.warn("Could not fetch configuration for data property. This happens when a configuration has not been saved yet");return{data:s,rootComponentIds:r}})(i,r,n),l=await n.getComponents(o),c=new Map;for(const e of l)c.set(e.id,e);for(const e of a){const t=e.catalogItemId||e.configurationHash,n=s.get(e.catalogItemId)||s.get(e.configurationHash)||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 a};class Ct extends je{constructor(){const e=new ye(1e3,1e3,8,8);e.rotateX(-Math.PI/2);const t=new De;(new Ge).load("static/paper_background-119811362010cc9d.png",e=>{e.wrapS=Ne,e.wrapT=Ne,e.repeat.set(200,200),t.map=e,t.alphaTest=.3,t.transparent=!0}),super(e,t),this.name="2d paper background",this.position.set(0,-.1,0),this.layers.set(2),this.userData.ignoreElementHit=!0}}class vt extends ge{get cameraControl(){return this._cameraControl}}class ft extends vt{get cameraControl(){return this._cameraControl}resetCameraOnPlanCompletelyLoaded(e){this.cameraControl.zoomToFitBounds(y(e,this.cameraControl.domHelper.element.clientWidth,this.cameraControl.domHelper.element.clientHeight,1.1),!0)}externalApiResetCameraPosition(e){this.cameraControl.zoomToFitBounds(y(e,this.cameraControl.domHelper.element.clientWidth,this.cameraControl.domHelper.element.clientHeight,1.1),!0)}resetCameraOnSwitchTo2d(e){this.cameraControl.zoomToFitBounds(y(e,this.cameraControl.domHelper.element.clientWidth,this.cameraControl.domHelper.element.clientHeight,1.1),!0)}updateCameraOnDrawWalls(e){this.cameraControl.zoomToFitBounds(e,!1,!0)}updateCameraOnPlanElementInsertedOutsideCurrentCameraView(e){this.cameraControl.zoomToFitBounds(e,!1,!0)}updateCameraOnPlanElementInsertedInsideCurrentCameraView(e){}updateCameraOnPlanElementDraggedOutsidePlanBounds(e){this.cameraControl.zoomToFitBounds(e,!1,!0)}updateCameraOnPlanElementRemoved(e){}updateCameraOnBackToPlanner(e,t,n){this.cameraControl.zoomToFitBounds(e,!1,!0)}resetCameraOnEnableWallDrawing(e){this.cameraControl.zoomToFitBounds(e,!1,!0)}}class wt extends vt{get cameraControl(){return this._cameraControl}resetCameraOnPlanCompletelyLoaded(e){this.cameraControl.updateAndReset(e,!0)}externalApiResetCameraPosition(e){this.cameraControl.updateAndReset(e,!0)}resetCameraOnSwitchTo3d(e){this.cameraControl.updateAndReset(e,!1)}disablePanningOnShiftRelease(){this.cameraControl.disablePanning()}enablePanningOnShiftClick(){this.cameraControl.enablePanning()}updateCameraOnDrawWalls(e){this.cameraControl.zoomToFitBounds(e,!0)}updateCameraOnPlanElementInsertedOutsideCurrentCameraView(e){this.cameraControl.zoomToFitBounds(e,!1)}updateCameraOnPlanElementDraggedOutsidePlanBounds(e){this.cameraControl.adjustToBoundsWithoutChangingDistance(e)}updateCameraOnPlanElementInsertedInsideCurrentCameraView(e){this.cameraControl.adjustToBoundsWithoutChangingDistance(e)}updateCameraOnPlanElementRemoved(e){this.cameraControl.adjustToBoundsWithoutChangingDistance(e)}async updateCameraOnBackToPlanner(e,t,n){n&&(this.cameraControl.setObjectRotation(0),await this._cameraControl.setToState(t,n))}resetCameraOnEnableWallDrawing(e){this.cameraControl.updateAndReset(e,!0)}async externalApiMoveCamera(e){await this.cameraControl.moveCamera(e),this._onCameraChanged()}}class bt extends vt{get cameraControl(){return this._cameraControl}resetCameraOnPlanCompletelyLoaded(e){this.cameraControl.updateCamera()}externalApiResetCameraPosition(e){this.cameraControl.updateCamera()}updateCameraOnDrawWalls(e){this.cameraControl.updateCamera()}updateCameraOnPlanElementInsertedOutsideCurrentCameraView(e){this.cameraControl.updateCamera()}updateCameraOnPlanElementInsertedInsideCurrentCameraView(e){this.cameraControl.updateCamera()}updateCameraOnPlanElementDraggedOutsidePlanBounds(e){this.cameraControl.updateCamera()}updateCameraOnPlanElementRemoved(e){this.cameraControl.updateCamera()}updateCameraOnBackToPlanner(e,t,n){this.cameraControl.updateCamera()}resetCameraOnEnableWallDrawing(e){this.cameraControl.updateCamera()}resetCameraOnSwitchToFirstPerson(){this.cameraControl.updateCamera()}}class Pt{constructor(e,t,n){this._sceneEventHandler=e,this._roomleRenderer=t,this._planViewModel=n}_processViewModel(e,t){var n,a,i;e instanceof s&&(null===(a=(n=e.getKernelObject()).getAttachedAttics)||void 0===a?void 0:a.call(n).size())>0?e.getBoundingBox().children.forEach(e=>{e.isChildPlanObject||t.add(e)}):((e instanceof b||e instanceof P)&&e.getTopViewContainer()&&t.add(e.getTopViewContainer()),(null===(i=e.getObject())||void 0===i?void 0:i.children)&&e.getObject().children.forEach(e=>{e.isChildPlanObject||t.add(e)}))}_processSelectedPlanElementIds(e){var t;((null===(t=this._sceneEventHandler)||void 0===t?void 0:t.getSelectedIds())||[]).forEach(t=>{const n=this._planViewModel.getPlanObjectForId(t);n&&this._processViewModel(n,e)})}_highlightPlanElementsBase(e,t){var n;let a=new Set;t&&this._processViewModel(t,a),null==e||e.forEach(e=>{const t=this._planViewModel.getPlanObjectForId(e);t&&this._processViewModel(t,a)}),this._processSelectedPlanElementIds(a),null===(n=this._roomleRenderer)||void 0===n||n.highlightObjects(Array.from(a))}highlightPlanElements(e){this._highlightPlanElementsBase(e)}highlightPlanElement(e){this._highlightPlanElementsBase(void 0,e)}clearHighlighting(){this._highlightPlanElementsBase()}}function Mt(e,t,n,a){e.fromPosition2d=E(e.fromPosition3d,t,n,a),e.toPosition2d=E(e.toPosition3d,t,n,a),e.textPosition2d=E(e.textPosition3d,t,n,a),e.fromWithoutPadding=E(e.fromWithoutPadding,t,n,a),e.toWithoutPadding=E(e.toWithoutPadding,t,n,a)}function Et(e,t,n,a){e.textPosition2d=e.fromPosition3d?E(e.textPosition3d,t,n,a):void 0,e.fromPosition2d=e.fromPosition3d?E(e.fromPosition3d,t,n,a):void 0,e.toPosition2d=e.toPosition3d?E(e.toPosition3d,t,n,a):void 0,e.atticCenterPosition2d=e.atticCenterPosition3d?E(e.atticCenterPosition3d,t,n,a):void 0,e.wallCenterPosition2d=E(e.wallCenterPosition3d,t,n,a),e.labelCPosition2d=E(e.labelCPosition3d,t,n,a),e.labelHeightPosition2d=E(e.labelHeightPosition3d,t,n,a),e.shiftedWallCenter2d=E(e.shiftedWallCenter3d,t,n,a),e.heightAt2mPosition2d=E(e.heightAt2mPosition3d,t,n,a),e.attic2mCornerFrom2d=E(e.attic2mCornerFrom3d,t,n,a),e.attic2mCornerto2d=E(e.attic2mCornerto3d,t,n,a)}function It(e,t){const n=new ze(.1,32,16),a=new De({color:16711680}),i=new je(n,a);i.position.copy(e.fromPosition3d);const r=new je(n,a);r.position.copy(e.toPosition3d);const s=new je(n,new De({color:65280}));if(s.position.copy(e.textPosition3d),t.wallPoints.add(i),t.wallPoints.add(r),t.wallPoints.add(s),e.attic){const a=new je(n,new De({color:255}));e.attic.fromPosition3d&&a.position.copy(e.attic.fromPosition3d);const i=new je(n,new De({color:16711935}));e.attic.toPosition3d&&i.position.copy(e.attic.toPosition3d);const r=new je(n,new De({color:16776960}));e.attic.atticCenterPosition3d&&r.position.copy(e.attic.atticCenterPosition3d),t.wallPoints.add(a),t.wallPoints.add(i),t.wallPoints.add(r)}}function St(e,t){const n=ut(e),a=null==t?void 0:t.lockPlan,i=e&&"getPlanElement"in e&&e.getPlanElement()&&"getAttachedWall"in e.getPlanElement();return!(!a||"wall"!==n&&"floor"!==n&&!i)}const Ot=e=>"Meta"===e.key||"Control"===e.key,yt=(e,t=!1)=>{const n=!1===t?t:Ot(e);return e.key&&(e.metaKey||e.ctrlKey||n)},Dt=e=>["altKey","ctrlKey","shiftKey","metaKey"].reduce((t,n)=>(e[n]&&t++,t),0);class jt extends et{constructor(e,t,n,a){var i;super(e,t,a),this._itemsLoadingStatePromises=[],this._staticItemGuard=new j,this._completelyLoaded=!1,this._configurableItemGuard=new j,this._planCompletelyLoadedGuard=new j,this.currentSelection=null,this._paperBackground=null,this._cameraState=null,this._debugSpheres={wallPoints:new Be,constructionElementsPoints:new Be,floorPoints:new Be},this._stopRendering=!0,this._configureInRoom=this._initData.configureInRoom,this._configuratorContext.baseContext="planner",this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new gt(e,this._scene,this.cameraBehaviour.cameraControl.getCamera(),this._getInputManager()),null===(i=this._roomleRenderer)||void 0===i||i.switchToPlanner(H.Mode3D),this._imageRenderer.switchToPlannerSettings(),this._planElementHighlighter=new Pt(this._plannerSceneEventHandler,this._roomleRenderer,this._getViewModel()),this._plannerSceneEventHandler.addEventListener(2,({state:e,oldState:t})=>{2===t&&e!==t&&this._roomlePlannerUiCallback.onRotationCancel(),2===e||1===e||4===e||3===e?(this.cameraBehaviour.cameraControl.lock(),this._onCameraMove()):(this.cameraBehaviour.cameraControl.unlock(),this._onCameraIdle())},this),this._plannerSceneEventHandler.addEventListener(13,()=>this._renderWithoutShadowsAndAO(),this),this._plannerSceneEventHandler.addEventListener(19,e=>this._activateElement(e),this),this._plannerSceneEventHandler.addEventListener(0,e=>{this._activateElement(e);const t=e.planElementViewModel;this._sendElementMeasurements(),t instanceof C&&this._initData.debug&&t.getGLBUrl(),St(t,this._initData)||this._planElementHighlighter.highlightPlanElement(t),this._onSelectionChange(t),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(1,({planElementViewModel:e,reason:t})=>{this._planElementHighlighter.clearHighlighting(),this._onSelectionCancel(e,t),this._roomlePlannerUiCallback.onSelectionCancel(t),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(8,()=>{this.cameraBehaviour.cameraControl.lock()},this),this._plannerSceneEventHandler.addEventListener(9,({planElementViewModel:e})=>{this._getKernelAccess().planInteractionHandler.startInteraction(),this._sendElementMeasurements(),e instanceof s&&this._sendWallDimensions(),this._requestRender(),this._dragStartBounds=this.getBounds()},this),this._plannerSceneEventHandler.addEventListener(10,({planElementViewModel:e})=>{this.cameraBehaviour.cameraControl.checkNearFarDistance(e.getPosition()),this._requestRender()},this),this._plannerSceneEventHandler.addEventListener(11,async({planElementViewModel:e})=>{const t=this._getKernelAccess().planInteractionHandler;t.endInteraction(),this.cameraBehaviour.cameraControl.unlock();const n=this._getDragPosition(e.getPosition());n&&t.moveElementTo(e.getPlanElement(),d(n)),this.updateEnvironment(this.getBounds(),!0),this._renderEverything();const a=this.getPlanObject(e.getId());let i;a&&(i=await pt([a],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(L.MOVED,i.length?i[0]:{...a,data:null});const r=e instanceof s||e instanceof g||e instanceof m;this._cameraBehaviourState.isWithinPlanBounds(e.getPosition(),this.getBounds())||r||this.plannerCameraBehaviour.updateCameraOnPlanElementDraggedOutsidePlanBounds(this.getBounds())},this),this._plannerSceneEventHandler.addEventListener(12,()=>{this.cameraBehaviour.cameraControl.unlock()},this),this._plannerSceneEventHandler.addEventListener(16,()=>{this.cameraBehaviour.cameraControl.lock()},this),this._plannerSceneEventHandler.addEventListener(18,()=>{this._roomlePlannerUiCallback.onUpdateMeasurementLineDimensions([])},this),this._plannerSceneEventHandler.addEventListener(17,()=>{this.cameraBehaviour.cameraControl.unlock(),this._roomlePlannerUiCallback.onMeasurementLineStateChange(!1)},this),this._plannerSceneEventHandler.addEventListener(6,()=>{var e;this._setKernelZoomFactor(),this._renderWithoutShadowsAndAO(),null===(e=this._roomleRenderer)||void 0===e||e.setGroundShadow(!1)},this),this._plannerSceneEventHandler.addEventListener(5,()=>this._renderWithoutShadowsAndAO(),this),this._plannerSceneEventHandler.addEventListener(7,()=>{var e;this._renderWithoutShadowsAndAO(),null===(e=this._roomleRenderer)||void 0===e||e.setGroundShadow(!0)},this),this._getKernelAccess().addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this),this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this),this.disableConfiguratorEvents(),a!==Ae.CAMERA_FP&&this.enablePlannerEvents(),setTimeout(()=>this._updatePaperBackground(),0),this._initData.debug&&(this._debugSpheres.wallPoints.name="Walls debug points",this._debugSpheres.constructionElementsPoints.name="Construction elements debug points",this._debugSpheres.floorPoints.name="Floor debug points",this._scene.add(this._debugSpheres.wallPoints),this._scene.add(this._debugSpheres.constructionElementsPoints),this._scene.add(this._debugSpheres.floorPoints))}get configuratorContext(){return this._configuratorContext}get hasSingleRoom(){const e=this._getViewModel().getFloorPlanObjectViewModels();return 1===new Set(e.map(e=>e.getId())).size}_activateElement({planElementViewModel:e},t=(()=>{})){const n=this._plannerSceneEventHandler.isDragIn()?e:null;this._sendElementMeasurements(n),e instanceof C&&this._initData.debug&&e.getGLBUrl(),St(e,this._initData)||this._planElementHighlighter.highlightPlanElement(e),t(),this._renderWithoutShadowsAndAO()}planCleared(){}planHistoryStateChanged(){var e,t;if(this._sendRoomMeasurements(),this._completelyLoaded){const{configuratorId:n}=this._globalInitData,a=null===(t=(null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler).getPlan())||void 0===t?void 0:t.getPlanXML(!1,2),i=this._idbManager.getKey(A(),n,this._initData.id);this._idbManager.setValue(i,a,this._idbManager.configStore)}}_getViewModel(){return this._viewModel||(this._viewModel=new tt(this._creator_),this._viewModel.setRequestRenderCallback(()=>this._renderEverything()),this._viewModel.setRequestRenderSceneUpdateCallback(()=>{var e;return null===(e=this._roomleRenderer)||void 0===e?void 0:e.clearCache()}),this._viewModel.setInvalidateRenderCallback(()=>{var e;return null===(e=this._roomleRenderer)||void 0===e?void 0:e.forceShadowUpdates(!0)})),this._viewModel}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new we),a=e.distanceTo(n),i=t.getSize(new we),r=Math.max(i.x,i.z)+3;if(a>r){const t=(new we).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(r))}return null}_hideAllMeasurementsNodeOnElementChange(e){this._getViewModel().getMeasurementLineObjectViewModels().forEach(e=>e.hideDraggableNodes()),e instanceof g&&e.showDraggableNodes()}_onSelectionChange(e){this._hideAllMeasurementsNodeOnElementChange(e);const t={};if(e instanceof C&&(t.item=e.getRapiItem(),t.staticItemRuntimeId=e.getPlanElement().getId(),this._configuratorUiCallbacks.onUpdateParameters([])),e instanceof P&&(t.staticItemRuntimeId=e.getPlanElement().getId()),e instanceof p){const n=e.getId(),a=this.getRootPlanObjectId(n),i=this._getViewModel().getPlanObjectForId(a);t.configurationRuntimeId=i.getConfigurationRuntimeId()}if(e instanceof s){const n=this.cameraBehaviour.cameraControl.getKernelZoomFactor(),{clientWidth:a,clientHeight:i}=this._domHelper.element;t.wall=e.getWallDimension(n,a,i)}e instanceof g&&(t.measurementLine=e.getMeasurementLineDimension()),e instanceof o&&(t.staticItemRuntimeId=e.getPlanElement().getId());let n=ut(e);const a=(async()=>{const t={};if(e instanceof C&&(t.item=e.getRapiItem(),t.staticItemRuntimeId=e.getPlanElement().getId()),e instanceof p){await e.isInitDone();const a=e.getConfigurationRuntimeId();this._getKernelAccess().updatePlanObjectDependencies(a);const i=e.getPlanObject().getCatalogItemId();let r=i;r||(r=this._getKernelAccess().kernelInstance.getHashOfConfiguration(a));const s=this._getKernelAccess().kernelInstance.isExternalPlanObject(a);if(s){const t=this.getRootPlanObjectId(e.getId()),n=this._getViewModel().getPlanObjectForId(t);this._planObjectSelectionChanged(n.getConfigurationRuntimeId(),e.getRootComponentRuntimeId())}let o;if(this._configuratorContext.planObjectId=a,this._configuratorContext.planElementId=e.getId(),this._configuratorContext.rootComponentId=e.getRootComponentRuntimeId(),!s)if(i&&$(i)){const e=await this._rapiAccess.getItem(i);t.item=e,o=e.rootComponentId?e.rootComponentId:null}else try{const e=await this._rapiAccess.getConfiguration(r);t.configuration=e,o=e.rootComponentId?e.rootComponentId:null}catch(e){console.warn("Could not get RAPI configuration for kernel hash "+r+", saving configuration...");const n=await this._getKernelAccess().getConfigurationData(a),i=await this._rapiAccess.saveConfiguration(n);t.configuration=i,o=i.rootComponentId?i.rootComponentId:null}if(o){const e=await this._rapiAccess.getComponent(o);t.component=e}t.configurationRuntimeId=a,n="configuration"}return t.planElementId=e.getId(),Ze(t)})();if(this.currentSelection=Ze(t),this._sendElementMeasurements(),this._sendPlanObjectPositions(),e instanceof p){const a=e.getConfigurationRuntimeId();a&&-1!==a&&this._getKernelAccess().kernelInstance.isExternalPlanObject(a)&&(n="external-configuration",t.externalConfigurationType="tc-config")}this._roomlePlannerUiCallback.onSelectionChange(Ze(this._plannerSceneEventHandler.getSelectionMode()),Ze(n),Ze(t),a,e),(e instanceof s||e instanceof m)&&(this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.show()),this._updateNodeSize()),this._renderWithoutShadowsAndAO()}_onSelectionCancel(e,t){this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.hide()),this._renderWithoutShadowsAndAO(),this.resetConfiguratorContext(t),this.cancelComponentSelection(!1,t),this._handleMeasurementLineDraggablePoints(e),this.currentSelection=null}_handleMeasurementLineDraggablePoints(e){this._getViewModel().getMeasurementLineObjectViewModels().forEach(e=>{e.hideDraggableNodes(),e.deselectAllDraggablePoints()}),e instanceof g&&(e.deselectAllDraggablePoints(),e.currentPoint=null)}resetConfiguratorContext(e){var t;try{this._configuratorContext.planObjectId&&(null===(t=this.getPlanObject(this._configuratorContext.planElementId).configurationType)||void 0===t?void 0:t.value)===S.EXTERNAL&&this.notifyPlannerOnComponentSelectionCancel(!0,e)}catch(e){console.error(e)}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._initData.legacyLight&&(this._lightSetting=new lt(this._scene,this._lightSetting)),this._initData.moc||this._addSky(),t||this._setEnvironment(new ue(this._scene,this._environment,qe(this._initData.colors.DEFAULT_BACKGROUND)))}onBeforeRender(){var e;this.cameraBehaviour.cameraControl instanceof _e&&x(this.cameraBehaviour.cameraControl.getCamera(),this._getViewModel().getWallPlanObjectViewModels())&&(null===(e=this._roomleRenderer)||void 0===e||e.forceShadowUpdates(!0))}_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._setCameraPosition();const n=this.cameraBehaviour.cameraControl.getCurrentCameraParameters();this._changeCameraBehaviour(new rt(this._getCameraControl3D(n),this._cameraBehaviourState)),this.cameraBehaviour.cameraControl instanceof _e&&this.cameraBehaviour.cameraControl.setObjectRotation(t.getPlanElement().rotation),this._configureInRoom||this._getViewModel().hideAllExcept(t.getId()),this.cameraBehaviour.updateCameraOnItemLoaded(this.getBounds()).then(()=>{this.updateEnvironment(this.getBounds(),!0)})}this.disablePlannerEvents(),this.updateScene()}startConfiguring(){var e,t,n;this._configuratorContext.baseContext="configurator";let{planElementId:a}=this._configuratorContext;a=this.getRootPlanObjectId(a),this._configuratorContext.planElementId!==a&&this.selectPlanObject(a),this._selectExternalObjectModule();const i=this._getViewModel().getPlanObjectForId(a);this._getViewModel().toggleCeilingLights(!1,this._isInteriorLightActive),this._setCameraPosition();const r=this.cameraBehaviour.cameraControl.getCurrentCameraParameters();this._changeCameraBehaviour(new nt(this._getCameraControl3D(r),this._cameraBehaviourState));let s=0,o=0;if(i){this.setRootComponentId(i.getRootComponentRuntimeId());const t=i.getPlanElement().getRotationToPreferredFront();s=t.rotationRoundTo90deg,o=t.lookAtSide.value===B.LEFT?-1:1,null===(e=this._componentRaycastHelper)||void 0===e||e.setObject(i.getObject())}const l=null==i?void 0:i.getConfigurationRuntimeId();this._configuratorContext.planObjectId!==l&&(this._configuratorContext.planObjectId=l),this._plannerSceneEventHandler.removeSelection(),this._planElementHighlighter.clearHighlighting(),this._configureInRoom||this._getViewModel().hideAllExcept(a),this.configuratorCameraBehaviour.resetCameraOnStartConfiguring(this.getBounds(),r,s,o).then(()=>{this.updateEnvironment(this.getBounds(),!0)}),this.setEventHandlerObject(i.getContainer()),this.disablePlannerEvents(),this.enableConfiguratorEvents(),null===(t=this._roomleRenderer)||void 0===t||t.switchToConfigurator(),this._imageRenderer.switchToConfiguratorSettings(),this.updateScene(),this._getKernelAccess().updatePlanObjectDependencies(l),this._getKernelAccess().requestPartListAndUpdatePricesOfParts(),this._getKernelAccess().planObjectUpdated(l,!1);const c=null===(n=this._plannerKernelAccess)||void 0===n?void 0:n.planInteractionHandler;null==c||c.startInteraction()}_setCameraPosition(){this._cameraState=this.cameraBehaviour.cameraControl.getCurrentCameraParameters()}_resetCameraPosition(e){if(this.cameraBehaviour.cameraControl instanceof _e){if(!this._cameraState)return;this.plannerCameraBehaviour.updateCameraOnBackToPlanner(this.getBounds(),e,this._cameraState)}}async selectPlanObject(e){if(this._plannerSceneEventHandler.getSelectedIds().includes(e))return;e=this.getRootPlanObjectId(e);const t=this._getViewModel().getPlanObjectForId(e);await this._plannerSceneEventHandler.selectPlanElement(t)}backToPlanner(){var e,t,n,a,i;if("planner"===this._configuratorContext.baseContext)return;if("configurator"===this._configuratorContext.baseContext){const i=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==i||i.endInteraction(),(null===(a=this._getKernelAccess().kernelInstance.getPlanObject(null!==(n=null===(t=this.currentSelection)||void 0===t?void 0:t.configurationRuntimeId)&&void 0!==n?n:0))||void 0===a?void 0:a.externalObject)&&this.notifyPlannerOnComponentSelectionCancel(!0,"isolation_mode_cancelled")}this._configuratorContext.baseContext="planner",this._getViewModel().toggleCeilingLights(!0,this._isInteriorLightActive);const r=this.cameraBehaviour.cameraControl.getCurrentCameraParameters(),s=this._getViewModel().cameraType;this._changeCameraBehaviour(s===Ae.CAMERA_3D||s===Ae.CAMERA_FP?new wt(this._getCameraControl3D(r),this._cameraBehaviourState):new ft(this._getCameraControl2D(),this._cameraBehaviourState)),this._resetCameraPosition(r),this._getViewModel().showAll(),this.setEventHandlerObject(this._scene),this.enablePlannerEvents();const o=this.cameraBehaviour.cameraControl instanceof _e||this.cameraBehaviour.cameraControl instanceof pe;this._getViewModel().setCameraType(o?Ae.CAMERA_3D:Ae.CAMERA_2D),this.disableConfiguratorEvents(),null===(i=this._roomleRenderer)||void 0===i||i.switchToPlanner(this.cameraBehaviour.cameraControl instanceof _e?H.Mode3D:H.Mode2D),this._imageRenderer.switchToPlannerSettings(),this.updateScene()}_getYRotationOfObject(e){let t=e.getWorldDirection(new we).clone();t.y=0,t.lengthSq()<.01&&(t=new we(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,a)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},a)}))})}),Promise.all(n).then(()=>this._staticItemsLoaded())})}requestCatalogItem(e){this._rapiAccess.getItem(e).then(e=>{this._getKernelAccess().catalogItemLoaded(e)})}_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),this.loadStaticPlanObjects()}_activateCeilingLight(){this._getViewModel().handleInitialLights(this._renderer.capabilities.maxTextures,this._roomleRenderer.sceneRenderer.getQualityLevel()),this._getViewModel().handleCeilingLights()}planCompletelyLoaded(e){this._stopRendering=!1,this._renderEverything(),setTimeout(()=>this._planCompletelyLoadedGuard.resolve(),0),this._isInteriorLightActive&&this._activateCeilingLight(),this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.hide()),this._getViewModel().getMeasurementLineObjectViewModels().forEach(e=>e.hideDraggableNodes())}handlerSwitchedPlans(e,t){if(this._completelyLoaded=!1,this._roomlePlannerUiCallback.onHandlerSwitchedPlans(),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 ye(1e3,1e3);e.rotateX(-Math.PI/2);let t=R.createMeshStandardMaterial({color:"#f0f0f0",roughness:1,metalness:0,depthWrite:!1}),n=new je(e,t);n.name="Ground",n.position.y=-.01,n.userData.isFloor=!0,this._scene.add(n)}this._setCeiling(),this._staticItemGuard.reset(),this._configurableItemGuard.reset(),this._planCompletelyLoadedGuard.reset();const n=this._plannerMeshGenerator.materialQueue.length>0?this._configurableItemGuard.wait():Promise.resolve();Promise.all([this._staticItemGuard.wait(),n,this._planCompletelyLoadedGuard.wait()]).then(this._itemsLoaded.bind(this))}async _itemsLoaded(){const e=this._getViewModel().getCorePlan();if(this._roomleRenderer){const t=k(e.getBounds());this._roomleRenderer.updateBounds(t),this._imageRenderer.updateBounds(t)}await Promise.allSettled(this._itemsLoadingStatePromises),this._roomlePlannerUiCallback.onCompletelyLoaded(),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),"planner"===this._configuratorContext.baseContext&&this.plannerCameraBehaviour.resetCameraOnPlanCompletelyLoaded(this.getBounds()),this._completelyLoaded=!0,this._readyForRender()}beginPlanConstruction(e){}addPlanMesh(e,t,n,a,i,r,s){}endPlanConstruction(e){this._renderLoopFunction=()=>{var e;this._scene.add(this._getViewModel().getConstructionGroup()),this._scene.add(this._getViewModel().getCeilingGroup()),this._scene.add(this._getViewModel().getFloorGroup()),this._scene.add(this._getViewModel().getMeasurementLineGroup()),this._scene.add(this._getViewModel().getWallAtticsGroup()),this._isInteriorLightActive&&this._createCeilingLightGroup(),(null===(e=this._lightSetting)||void 0===e?void 0:e.needsBounds())&&this._lightSetting.updateBounds(this._getViewModel().getBoundingBox()),this._scene.remove(this._preloadScene)}}async addPlanObjectToScene(e){if(!e)return Promise.resolve();let t,n;try{const a=new Promise((e,a)=>(t=e,n=a));this._itemsLoadingStatePromises.push(a);const i=e.getContainer();V(i),this._scene.add(i),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender()),this._roomlePlannerUiCallback.onPlanChanged(),await e.isInitDone(),this.updateEnvironment(this.getBounds()),this._renderEverything();const r=this.getPlanObject(e.getId());let s;r&&(s=await pt([r],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(L.ADDED,s.length?s[0]:{...r,data:null});const o=e instanceof p||e instanceof C;this._initData.featureFlags.interiorLights&&((e,t,n)=>{var a,i,r;const s=null===(a=e.getRapiItem)||void 0===a?void 0:a.call(e);if(s&&("lamp_ceiling"===s.detailType||"lamp_standing"===s.detailType))if("brands_15:flos_aim"===(null==s?void 0:s.id)){const a={x:-.45,y:-.37,z:.35},i={x:.38,y:.31,z:-.17};t.handleLampLight(e,{targetPos:a,lightPos:i,active:n})}else if("brands_26:diesel_with_foscarini_fork"===(null==s?void 0:s.id)){const a={x:0,y:-.56,z:-.49},i={x:.01,y:1.62,z:0};t.handleLampLight(e,{targetPos:a,lightPos:i,color:16768955,decay:0,active:n})}if("brands_26:diesel_with_foscarini_duii"===(null==s?void 0:s.id)){const a={x:-1.4,y:-.74,z:-.07},i={x:.07,y:.59,z:0};t.handleLampLight(e,{targetPos:a,lightPos:i,color:16777215,decay:2,active:n})}if("nobilia_minifabrik:mr_StorageunitSingle:439FAD244CEF57D8E7B4330EE43E9C1847ECC6C152EED0F1838B49FC69B9783C"===e.getObject().hash){const a={width:2.45,height:.03},i={x:0,y:1.571,z:.01};t.handleRectLampLight(e,{dimensions:a,lightPos:i,color:16777215,active:n});const r={width:.03,height:2.17},s={x:1.195,y:1.033,z:1.033};t.handleRectLampLight(e,{dimensions:r,lightPos:s,color:16777215,active:n})}if("roomle_white_furniture:Lighting_Pendant_lamp_02"===(null===(r=null===(i=e.getRapiItem)||void 0===i?void 0:i.call(e))||void 0===r?void 0:r.id)){const a={x:0,y:-99,z:0},i={x:0,y:.15,z:0};t.handleLampLight(e,{targetPos:a,lightPos:i,color:16445391,decay:1,intensity:1,active:n})}})(e,this._getViewModel(),this._isInteriorLightActive),o&&!this._plannerSceneEventHandler.isDragIn()&&this.cameraBehaviour instanceof vt&&(T(this.cameraBehaviour.cameraControl.getCamera(),e.getBounds())?this.plannerCameraBehaviour.updateCameraOnPlanElementInsertedInsideCurrentCameraView(this.getBounds()):this.plannerCameraBehaviour.updateCameraOnPlanElementInsertedOutsideCurrentCameraView(this.getBounds()))}catch(e){console.error(e),n()}t()}removePlanObjectFromScene(e){(e instanceof s||e instanceof m)&&this._sendWallDimensions(),e instanceof g&&this._sendMeasurementLineDimension(),this._scene.remove(e.getContainer()),e.clear(),this.updateEnvironment(this.getBounds(),!0),e instanceof s||e instanceof g||e instanceof m||"planner"!==this._configuratorContext.baseContext||this.plannerCameraBehaviour.updateCameraOnPlanElementRemoved(this.getBounds()),this._renderEverything()}planElementChanged(e,t){this._drawingEnabled&&this._sendWallDimensions(!1);const n=this._plannerSceneEventHandler.isDragIn()?t:null;if(this._sendElementMeasurements(n),this._sendRoomAreaData(),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),this._onPlanChanged(),!this._plannerSceneEventHandler.isDragIn()){const e=this.getPlanObject(t.getId());this._roomlePlannerUiCallback.onPlanElementChanged(L.MOVED,{...e,data:null})}t instanceof s&&e.extRef&&e.extRef.jsObject&&this._isInteriorLightActive&&e.extRef.jsObject.handleCeilingLights()}exportGLB(e,t){}importGLB(e){this._loadGLB(e).then(e=>this._scene.add(e))}clearScene(){this._plannerMeshGenerator.clear(),this._getViewModel().sceneCleared(),super.clearScene()}_addSky(){if(!this._sky){this._sky=new _t,this._sky.name="Sky",this._sky.scale.setScalar(45e4),this._sky.frustumCulled=!1,this._scene.add(this._sky),this._sky.material.uniforms.turbidity.value=10,this._sky.material.uniforms.rayleigh.value=2,this._sky.material.uniforms.mieCoefficient.value=.005,this._sky.material.uniforms.mieDirectionalG.value=.8;let e=F(4e5,0,.6);this._sky.material.uniforms.sunPosition.value.copy(e);let t=new je(new ze(2e4,16,8),new De({color:16777215}));t.name="Sunsphere",t.position.y=-7e5,t.visible=!1,t.position.set(e.x,-e.z,e.y)}this._lightSetting instanceof lt&&this._lightSetting.updateSunPosition(.6,0)}toggleConfigureInRoom(){this._configureInRoom=!this._configureInRoom,this._roomleRenderer.isConfiguring&&(this._configureInRoom?this._getViewModel().showAll():this._hideAllExceptSelectedElement(),this._renderEverything(),this.updateScene())}switchTo2D(){var e,t,n,a,i;if(!((null===(e=this.cameraBehaviour)||void 0===e?void 0:e.cameraControl)instanceof me)){(null===(t=this.cameraBehaviour)||void 0===t?void 0:t.cameraControl)instanceof pe&&this._getCameraControlFirstPerson().cleanUp(),null===(n=this._roomleRenderer)||void 0===n||n.setCameraType(Ae.CAMERA_2D),null===(a=this._plannerSceneEventHandler)||void 0===a||a.enable();for(const e of this._getViewModel().getWallPlanObjectViewModels())e.show();this._getViewModel().setCameraType(Ae.CAMERA_2D).then(()=>this._planElementHighlighter.highlightPlanElement()),null===(i=this._roomleRenderer)||void 0===i||i.switchToPlanner(H.Mode2D),this._renderEverything(),this._changeCameraBehaviour(new ft(this._getCameraControl2D(),this._cameraBehaviourState)),this._onCameraMove(),this.plannerCameraBehaviour.resetCameraOnSwitchTo2d(this.getBounds()),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(Ae.CAMERA_2D),this._setKernelZoomFactor(),this._onCameraMove(),this._sendRoomMeasurements()}}switchTo3D(){var e,t,n,a,i;(null===(e=this.cameraBehaviour)||void 0===e?void 0:e.cameraControl)instanceof _e||((null===(t=this.cameraBehaviour)||void 0===t?void 0:t.cameraControl)instanceof pe&&this._getCameraControlFirstPerson().cleanUp(),null===(n=this._roomleRenderer)||void 0===n||n.setCameraType(Ae.CAMERA_3D),null===(a=this._plannerSceneEventHandler)||void 0===a||a.enable(),this._getViewModel().setCameraType(Ae.CAMERA_3D),null===(i=this._roomleRenderer)||void 0===i||i.switchToPlanner(H.Mode3D),this._renderEverything(),this._changeCameraBehaviour(new wt(this._getCameraControl3D(),this._cameraBehaviourState)),this._onCameraMove(),this.plannerCameraBehaviour.resetCameraOnSwitchTo3d(this.getBounds()),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(Ae.CAMERA_3D))}switchToFirstPerson(){var e,t,n;(null===(e=this.cameraBehaviour)||void 0===e?void 0:e.cameraControl)instanceof pe||(null===(t=this._roomleRenderer)||void 0===t||t.setCameraType(Ae.CAMERA_FP),null===(n=this._plannerSceneEventHandler)||void 0===n||n.disable(),this._plannerMeshGenerator.wallMeshes.forEach(e=>W(e.material,!1,!1)),this._getViewModel().getWallPlanObjectViewModels().forEach(e=>{e.show()}),this._getViewModel().setCameraType(Ae.CAMERA_FP),this._renderEverything(),this._changeCameraBehaviour(new bt(this._getCameraControlFirstPerson(),this._cameraBehaviourState)),this._getCameraControlFirstPerson().cleanUp(),this._getCameraControlFirstPerson().setUp(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(Ae.CAMERA_FP),this.plannerCameraBehaviour.resetCameraOnSwitchToFirstPerson())}onCameraChanged(){}_setCameraControlListeners(){super._setCameraControlListeners(),this.cameraBehaviour instanceof vt&&(this.cameraBehaviour.cameraControl.addEventListener(8,()=>{this._onCameraIdle()},this),this.cameraBehaviour.cameraControl.addEventListener(1,()=>{this._onCameraMove()},this),this.cameraBehaviour.cameraControl.addEventListener(7,()=>{this._onCameraMove()},this),this.cameraBehaviour.cameraControl.addEventListener(3,()=>{this._onCameraMove()},this),this.cameraBehaviour.cameraControl.addEventListener(4,()=>{this._onCameraMove()},this),this.cameraBehaviour.cameraControl.addEventListener(5,()=>{this._onCameraZoomChange()},this))}_onCameraZoomChange(){this._setKernelZoomFactor()}_setKernelZoomFactor(){var e,t;const n=this.cameraBehaviour.cameraControl.getKernelZoomFactor();n&&isFinite(n)&&n>=0&&(null===(e=this._getKernelAccess().planInteractionHandler)||void 0===e||e.setZoomFactor(n)),null===(t=this._plannerSceneEventHandler)||void 0===t||t.setKernelZoomFactor(n)}_setCeiling(){this._getViewModel()&&(this.cameraBehaviour.cameraControl instanceof pe?this._getViewModel().getCeilingGroup().visible=!0:this._getViewModel().getCeilingGroup().visible=!1)}cameraBehaviourChanged(){var e;super.cameraBehaviourChanged(),null===(e=this._plannerSceneEventHandler)||void 0===e||e.setCamera(this.cameraBehaviour.cameraControl.getCamera()),this._updatePaperBackground()}_updatePaperBackground(){var e,t;this.cameraBehaviour.cameraControl instanceof me?(this._paperBackground||(this._paperBackground=new Ct),null===(e=this._scene)||void 0===e||e.add(this._paperBackground),this._requestRender()):this._paperBackground&&(null===(t=this._scene)||void 0===t||t.remove(this._paperBackground))}sceneChanged(){this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setObject(this._scene)}_onKeyDown(e){if(super._onKeyDown(e),this._initData.debug&&this._checkNumKey(e),yt(e)){const t=Dt(e),n=e.metaKey&&"Meta"===e.key||e.ctrlKey&&"Control"===e.key,a=t>1?"standard":n?"multiselect":"standard";this._plannerSceneEventHandler.setSelectionMode(a)}e.key&&e.key.includes("Shift")&&this.cameraBehaviour.cameraControl instanceof _e&&(this.cameraBehaviour.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,t=!1){if(super._onKeyUp(e,t),yt(e,!0)){const t=Dt(e);let n="standard";Ot(e)||1!==t||(n="multiselect"),this._plannerSceneEventHandler.setSelectionMode(n),e.preventDefault()}e.key&&e.key.includes("Shift")&&this.cameraBehaviour.cameraControl instanceof _e&&(this.cameraBehaviour.cameraControl.disablePanning(),e.preventDefault()),!e.key||"Escape"!==e.key&&"Esc"!==e.key||this._drawingEnabled&&(this.escapeDrawing(!0),this._roomlePlannerUiCallback.onDrawCancel())}setMode(e){switch(e){case Ae.CAMERA_2D:this.switchTo2D();break;case Ae.CAMERA_3D:this.switchTo3D();break;case Ae.CAMERA_FP:this.switchToFirstPerson()}}_clearHighlighting(){this._planElementHighlighter.clearHighlighting(),this._renderWithoutShadowsAndAO()}highlightPlanElementsById(e){null!==e?this._planElementHighlighter.highlightPlanElements(e):this._clearHighlighting()}highlightPlanElementById(e){if(null===e)return void this._clearHighlighting();e=this.getRootPlanObjectId(e);const t=this._getViewModel().getPlanObjectForId(e);this._planElementHighlighter.highlightPlanElement(t)}destroy(){super.destroy(),this._plannerMeshGenerator.removeMaterialLoadedListener(),this._getViewModel().removeGeometriesMergedListener()}planObjectConfigurationLoaded(e,t,n){if(n||console.error("Plan object configuration loading failed",t.getCatalogItemId()||t.getConfigurationHash()),e&&e.extRef&&t&&t.extRef){let e=t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId();e>0&&this._getViewModel().constructComponents(e)}}async planObjectConfigurationChanged(e,t){const n=this.getPlanObject(t.getId());let a;!n||t instanceof p||t instanceof P||(a=await pt([n],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(L.CHANGED,(null==a?void 0:a.length)?a[0]:{...n,data:null})}addMesh(e,t,n,a,i,r){}updateCameraOnDrawWalls(){this.plannerCameraBehaviour.updateCameraOnDrawWalls(this.getBounds())}getBounds(){return this._getViewModel()?this._getViewModel().getBoundingBox():null}getGeometryBounds(){return"configurator"===this._configuratorContext.baseContext?super.getGeometryBounds():this.getBounds()}getPlanObject(e){const t=this._getKernelAccess().planInteractionHandler,n=this._plannerKernelAccess.planModelViewHelper,a=t.getPlan();return n.getPlanObject(a,e)}getRootPlanObjectId(e){var t;if(!(null===(t=this._plannerKernelAccess)||void 0===t?void 0:t.kernelContainer))return e;const n=this._getKernelAccess().planInteractionHandler,a=this._plannerKernelAccess.planModelViewHelper,i=n.getPlan();return a.getRootPlanObjectId(i,e)}cancelPlanElementSelection(e){this._plannerSceneEventHandler.cancelSelection(e),this._planElementHighlighter.clearHighlighting(),this._requestRender()}async deletePlanElementSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelPlanElementSelection("delete_object");const t=this._getKernelAccess().planInteractionHandler;t.startInteraction(),await this.deletePlanElementByIds(e),t.endInteraction()}async deletePlanElementByIds(e){for(const t of e){const e=this._getViewModel().getPlanObjectForId(t);if(e&&e.getObject()){const t=this.getPlanObject(e.getId());let n;t&&(n=await pt([t],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(L.REMOVED,n.length?n[0]:{...t,data:null}),this._getKernelAccess().planInteractionHandler.removeElement(e.getKernelObject())}}}rotatePlanElementSelection(e){const t=new(this._getKernelAccess().kernelContainer.PlanObjectPtrList),n=new xe;let a={x:0,y:0,z:0};if(this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const i=this._getViewModel().getPlanObjectForId(e);i&&i.getObject()&&(a=i.getPlanElement().getCenter(),t.push_back(i.getPlanElement()),n.expandByObject(i.getContainer()))}),t.size()>1){const e=n.getCenter(new we);a=d(e)}this._getKernelAccess().planInteractionHandler.rotateObjectsBy(t,e,a)}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender()}planElementRemoved(e){this._configuratorContext.planElementId===e.getId()&&(this._roomlePlannerUiCallback.onSelectionCancel("delete_object"),this._configuratorContext.planElementId=0),this._onPlanChanged(),this._renderEverything()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={},t){return"configurator"===this._configuratorContext.baseContext&&t?super.preparePerspectiveImage(e):new Promise(t=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{var n,a,i;let r=e.runtimeIds?K.getCameraTargetForBBox(this._getViewModel().getBoundingBoxFromRuntimeIds(e.runtimeIds),.1):this._calculateBoundingBoxOfAllMeshes(.1);null===(n=this._lightSetting)||void 0===n||n.removeFromScene(),this.cameraBehaviour.cameraControl instanceof _e&&(await this._getViewModel().setCameraType(Ae.CAMERA_2D),this._getViewModel().setNodeVisibility(!1)),e.runtimeIds&&this._getViewModel().hideAllExceptRuntimeIds(e.runtimeIds);let s=await this._imageRenderer.prepareTopImage(this._scene,null,r,e);e.runtimeIds&&this._getViewModel().showAll(),this.cameraBehaviour.cameraControl instanceof _e&&await this._getViewModel().setCameraType(Ae.CAMERA_3D),null===(a=this._lightSetting)||void 0===a||a.addToScene(),null===(i=this._roomleRenderer)||void 0===i||i.clearCache(),this._requestRender(),t(s)})})}preparePerspectiveImageOf(e,t={}){const n=this._getViewModel().getPlanObjectForId(e);if(!n){const t="Object with runtimeId "+e+" not found";throw console.warn(t),new Error(t)}return this._preparePerspectiveImage({...t,object:n.getObject().clone()})}async _waitForAssets(){await super._waitForAssets(),await this._getViewModel().materialQueue.finished(!0)}_preparePerspectiveImage(e={},t){if("configurator"===this._configuratorContext.baseContext&&t)return super.preparePerspectiveImage(e);const n=this._handlePlannerIsolationModeState(t);return new Promise((t,a)=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{var a,i,r;let s;this.cameraBehaviour.cameraControl instanceof _e?s=this.cameraBehaviour.cameraControl.getCamera().clone():(s=this.getPerspectiveOffsetCamera().clone(),this._getViewModel().getCeilingGroup().visible=!1,s.layers.enableAll(),this._getViewModel().setCameraType(Ae.CAMERA_3D)),s.resetOffset();let o=e.object?K.getCameraTargetForBBox((new xe).setFromObject(e.object)):e.runtimeIds?K.getCameraTargetForBBox(this._getViewModel().getBoundingBoxFromRuntimeIds(e.runtimeIds)):this._calculateBoundingBoxOfAllMeshes();null===(a=this._lightSetting)||void 0===a||a.removeFromScene();let l=e.object?U(this._scene):this._scene;e.object&&l.add(e.object),e.runtimeIds&&this._getViewModel().hideAllExceptRuntimeIds(e.runtimeIds);const c=await this._imageRenderer.preparePerspectiveImage(l,null,s,o,e,void 0,e=>{x(e,this._getViewModel().getWallPlanObjectViewModels())});G(s),e.runtimeIds&&this._getViewModel().showAll(),e.object&&G(l),this.cameraBehaviour.cameraControl instanceof me?(this._getViewModel().setCameraType(Ae.CAMERA_2D),this._getViewModel().getWallPlanObjectViewModels().forEach(e=>e.show())):x(this.cameraBehaviour.cameraControl.getCamera(),this._getViewModel().getWallPlanObjectViewModels()),null===(i=this._lightSetting)||void 0===i||i.addToScene(),null===(r=this._roomleRenderer)||void 0===r||r.clearCache(),this._requestRender(),this._setCeiling(),n(),t(c)},a)})}_handlePlannerIsolationModeState(e){if(!e){const e=this._configuratorContext.baseContext;return this._getViewModel().showAll(),this._configuratorContext.baseContext="planner",()=>{this._configuratorContext.baseContext=e,"configurator"===e&&(this._configureInRoom||this._hideAllExceptSelectedElement())}}return()=>null}_hideAllExceptSelectedElement(){const{planElementId:e}=this._configuratorContext,t=this.getRootPlanObjectId(e);this._getViewModel().hideAllExcept(t)}preparePerspectiveImage(e={},t){return this._preparePerspectiveImage(e,t)}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return K.getCameraTargetForBBox(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}enableSnapping(){this._plannerSceneEventHandler.enableSnapping()}disableSnapping(){this._plannerSceneEventHandler.disableSnapping()}enableAdvancedDocking(){this._plannerSceneEventHandler.enableAdvancedDocking()}disableAdvancedDocking(){this._plannerSceneEventHandler.disableAdvancedDocking()}showsChildrenOfPlanObject(e){if(e instanceof p){const t=e.getKernelObject();return this._plannerSceneEventHandler.showsChildrenOfPlanObject(t)}return!1}enableShowChildrenOfPlanObject(e){if(e instanceof p){const t=e.getKernelObject();this._plannerSceneEventHandler.enableShowChildrenOfPlanObject(t)}}disableShowChildrenOfPlanObject(e){if(e instanceof p){const t=e.getKernelObject();this._plannerSceneEventHandler.disableShowChildrenOfPlanObject(t)}}dragIn(e){this._plannerSceneEventHandler.getSelectedIds().length>0&&this._plannerSceneEventHandler.cancelSelection("dragIn"),this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}disablePlannerEvents(){this._plannerSceneEventHandler.disable()}enablePlannerEvents(){this._plannerSceneEventHandler.enable()}_onCameraIdle(){return super._onCameraIdle()&&(this._sendRoomMeasurements(),this._sendPlanObjectPositions(),this._roomlePlannerUiCallback.onCameraIdle(),this._sendElementMeasurements(),this._hideAllNodeIfThereAreNoSelections()),!0}_hideAllNodeIfThereAreNoSelections(){this.currentSelection||this.getPlannerSceneEventHandler().isCurrentlyDrawing||(this._getViewModel().getMeasurementLineObjectViewModels().forEach(e=>e.hideDraggableNodes()),this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.hide()))}_onCameraMove(){return super._onCameraMove()&&(this._roomlePlannerUiCallback.disableWallDimensions(),this._roomlePlannerUiCallback.cameraStartsMoving()),this._updateNodeSize(),this._renderEverything(),!0}_showWallNodes(){this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.show())}_updateNodeSize(){if(this.cameraBehaviour.cameraControl instanceof me){const e=1/this.cameraBehaviour.cameraControl.getCamera().zoom;this._getViewModel().setNodeZoom(e)}}_sendPlanObjectPositions(){if(this.cameraBehaviour.cameraControl.isLocked())return;const{clientWidth:e,clientHeight:t}=this._domHelper.element,n=this.cameraBehaviour.cameraControl.getCamera(),a=this._plannerSceneEventHandler.getSelectedIds();a.length>1?this._sendMultiSelectionPosition(a,n,e,t):this._sendSelectedPlanObjectPositions(n,e,t)}_sendMultiSelectionPosition(e,t,n,a){const i=new xe;for(const t of e){const e=this._getViewModel().getPlanObjectForId(t);e&&i.expandByObject(e.getContainer())}const r=i.getCenter(new we),s=M(E(r,t,n,a));this._roomlePlannerUiCallback.onUpdatePlanObjectPositions([{runtimeIds:e,position2d:s}])}_sendSelectedPlanObjectPositions(e,t,n){const a=this._getViewModel(),i=[],r=[...a.getStaticPlanObjectViewModels(),...a.getConfigurablePlanObjectViewModels(),...a.getConfigurableConstructionPlanObjectViewModels(),...a.getConstructionPlanObjectViewModels(),...a.getWallPlanObjectViewModels(),...a.getFloorPlanObjectViewModels(),...a.getNodePlanObjectViewModels()];for(const a of r)i.push(mt(a,e,t,n));this._roomlePlannerUiCallback.onUpdatePlanObjectPositions(i)}_sendRoomAreaData(){const e=this._getViewModel().getFloorPlanObjectViewModels(),t=this.cameraBehaviour.cameraControl.getCamera(),{clientWidth:n,clientHeight:a}=this._domHelper.element,i=[],r=this.cameraBehaviour.cameraControl.getKernelZoomFactor();this._initData.debug&&this._debugSpheres.floorPoints.children.length&&this._debugSpheres.floorPoints.clear();for(const s of e){const e=s.getFloorData(r);if(!e||!e.textPosition3d)return;if(e.roomLabel=s.getKernelObject().getLabelObject(),e.formattedArea=this._unitFormatter.formatSquareMMValueToUnitString(e.area),e.textPosition2d=E(e.textPosition3d,t,n,a),i.push(N(e)),this._initData.debug){const t=new ze(.1,32,16),n=new De({color:255}),a=new je(t,n);a.position.copy(e.textPosition3d),this._debugSpheres.floorPoints.add(a)}}i.length>0&&this._roomlePlannerUiCallback.onFloorPlanAreasUpdated(i)}_updateMeasurementPositions(e,t,n,a){return e.fromPosition3d&&(e.fromPosition2d=E(e.fromPosition3d,t,n,a)),e.toPosition3d&&(e.toPosition2d=E(e.toPosition3d,t,n,a)),e.textPosition3d&&(e.textPosition2d=E(e.textPosition3d,t,n,a)),e}_sendElementMeasurements(e){this.cameraBehaviour.cameraControl instanceof me&&(this._sendConstructionElementDimensions(e),this._sendObjectMeasurements(e),this._sendMeasurementLineDimension())}_sendRoomMeasurements(){this.cameraBehaviour.cameraControl instanceof me&&(this._sendWallDimensions(),this._sendRoomAreaData())}_sendMeasurementLineDimension(){if(!(this.cameraBehaviour.cameraControl instanceof me))return;const e=this.cameraBehaviour.cameraControl.getCamera(),{clientWidth:t,clientHeight:n}=this._domHelper.element,a=[],i=this._getViewModel().getMeasurementLineObjectViewModels();for(const r of i){const i=r.getMeasurementLineDimension();i.fromPosition2d=E(i.fromPosition3d,e,t,n),i.toPosition2d=E(i.toPosition3d,e,t,n),i.textPosition2d=E(i.textPosition3d,e,t,n),i.lengthFormatted=this._unitFormatter.formatMMValueToUnitString(i.length),a.push(z(i))}this._roomlePlannerUiCallback.onUpdateMeasurementLineDimensions(a)}_sendObjectMeasurements(e){if(!(this.cameraBehaviour.cameraControl instanceof me))return;if(!this.currentSelection&&!e)return;const t=this._plannerSceneEventHandler.getSelectedIds();if(0===t.length&&!e)return;const n=e||this._getViewModel().getPlanObjectForId(t[0]);if(!n||n instanceof b||n instanceof P||!(n instanceof C)&&!(n instanceof p))return;const a=this.cameraBehaviour.cameraControl.getCamera(),{clientWidth:i,clientHeight:r}=this._domHelper.element,s=this.cameraBehaviour.cameraControl.getKernelZoomFactor(),o=n.getObjectMeasurements(s,i,r),l=this.transformMeasurements(o.rectMeasurements,a,i,r),c=this.transformMeasurements(o.objectMeasurements,a,i,r),h=this.transformMeasurements(o.objectToWallsMeasurements,a,i,r);this._roomlePlannerUiCallback.onUpdateObjectMeasurements({rectMeasurements:l,objectMeasurements:c,objectToWallsMeasurements:h})}transformMeasurements(e,t,n,a){return e.map(e=>{const i=E(e.fromPosition3d,t,n,a),r=E(e.toPosition3d,t,n,a),s=E(e.textPosition3d,t,n,a);return Z({...e,fromPosition2d:i,toPosition2d:r,textPosition2d:s})})}_sendConstructionElementDimensions(e){if(!this.currentSelection&&!e)return;const t=e||this._getViewModel().getPlanObjectForId(this.currentSelection.staticItemRuntimeId||this.currentSelection.configurationRuntimeId);if(!t||!(t instanceof b||t instanceof P))return;this._initData.debug&&this._debugSpheres.constructionElementsPoints.children.length>0&&this._debugSpheres.constructionElementsPoints.clear();const n=this.cameraBehaviour.cameraControl.getCamera(),{clientWidth:a,clientHeight:i}=this._domHelper.element,r=this.cameraBehaviour.cameraControl.getKernelZoomFactor(),s=t.getConstructionElementMeasurements(r,a,i);if(!s)return;if(this._initData.debug){const e=new De({color:16711680}),t=new De({color:65280}),n=new De({color:255}),a=new ze(.1,32,16),i=new je(a,e);i.position.copy(s.leftMeasurement.fromPosition3d),i.position.y=5;const r=new je(a,e);r.position.copy(s.leftMeasurement.toPosition3d),r.position.y=5;const o=new je(a,t);o.position.copy(s.rightMeasurement.fromPosition3d),o.position.y=5;const l=new je(a,t);l.position.copy(s.rightMeasurement.toPosition3d),l.position.y=5;const c=new je(a,n);c.position.copy(s.elementRange.fromPosition3d),c.position.y=5;const h=new je(a,n);h.position.copy(s.elementRange.toPosition3d),h.position.y=5,this._debugSpheres.constructionElementsPoints.add(i),this._debugSpheres.constructionElementsPoints.add(r),this._debugSpheres.constructionElementsPoints.add(o),this._debugSpheres.constructionElementsPoints.add(l),this._debugSpheres.constructionElementsPoints.add(c),this._debugSpheres.constructionElementsPoints.add(h)}s.leftMeasurement=this._updateMeasurementPositions(s.leftMeasurement,n,a,i),s.rightMeasurement=this._updateMeasurementPositions(s.rightMeasurement,n,a,i),s.elementRange=this._updateMeasurementPositions(s.elementRange,n,a,i);const o={leftMeasurement:{...q(s.leftMeasurement)},rightMeasurement:{...q(s.rightMeasurement)},elementRange:{...q(s.elementRange)}};this._roomlePlannerUiCallback.onUpdateConstructionElementsMeasurements(o)}_sendWallDimensions(e=!0){this._initData.debug&&this._debugSpheres.wallPoints.children.length>0&&this._debugSpheres.wallPoints.clear(),function(e,t,n,a,i,r,s,o=!0,l=!1){if(!(t.cameraControl instanceof me))return;if(t.cameraControl.isLocked()&&o)return;const c=[],{x:h,y:d}=e.getClientDimensions(),g=i.getWallPlanObjectViewModels(),m=t.cameraControl.getKernelZoomFactor(),u=t.cameraControl.getCamera();for(const e of g){const t=e.getWallDimension(m,h,d);t.isCurrentlyDrawn=a.isCurrentlyDrawing&&e.getPlanElement().getTo().extRef.jsObject===i.latestNodePlanObjectViewModel;const{isVectorWall:n}=e.getKernelObject();t.length<=0&&!n||(Mt(t,u,h,d),t.attic&&Et(t.attic,u,h,d),t.lengthFormatted=r.formatMMValueToUnitString(t.length),l&&It(t,s),c.push(D(t)))}n.onUpdateWallDimensions(c)}(this._domHelper,this.cameraBehaviour,this._roomlePlannerUiCallback,this._plannerSceneEventHandler,this._getViewModel(),this._unitFormatter,this._debugSpheres,e,this._initData.debug)}enableWallDrawing(){if(this.cameraBehaviour.cameraControl instanceof me){const e=y(this.getBounds(),this._domHelper.element.clientWidth,this._domHelper.element.clientHeight);this.plannerCameraBehaviour.resetCameraOnEnableWallDrawing(e)}this._drawingEnabled||(this._drawingEnabled=!0,this._scene.add(this._plannerSceneEventHandler.enableWallDrawing()))}disableWallDrawing(){this._drawingEnabled=!1,this.cameraBehaviour.cameraControl.unlock(),this._scene.remove(this._plannerSceneEventHandler.cancelWallDrawing())}escapeDrawing(e){this._plannerSceneEventHandler.stopDrawing(e)}setSceneEvents(e){var t,n;this.cameraBehaviour.cameraControl instanceof pe||(void 0!==e.construction&&(null===(t=this._plannerSceneEventHandler)||void 0===t||t.enableConstructionEvents(e.construction)),void 0!==e.objects&&(null===(n=this._plannerSceneEventHandler)||void 0===n||n.enableObjectEvents(e.objects)))}startedDrawing(){this._plannerSceneEventHandler.startDrawing(),this._showWallNodes()}stoppedDrawing(){this._plannerSceneEventHandler.stopDrawing()}disableEvents(){super.disableEvents(),this.disablePlannerEvents()}enableEvents(){super.enableEvents(),"planner"!==this._configuratorContext.baseContext||this.cameraBehaviour.cameraControl instanceof pe||this.enablePlannerEvents()}resetCameraPositionToStart(){this.plannerCameraBehaviour.externalApiResetCameraPosition(this.getBounds())}async moveCamera(e){return this.plannerCameraBehaviour instanceof wt||this.plannerCameraBehaviour instanceof nt?this.plannerCameraBehaviour.externalApiMoveCamera(e):Promise.resolve()}_setInteriorOrExteriorWallMaterial(e,t){const n=this._getViewModel().getWallPlanObjectViewModels();if(!n.length)return;const a=this._getKernelAccess().planInteractionHandler,i=e=>{a.setWallLeftMaterial(e,Xe(e.leftMaterial,t))},r=e=>{a.setWallRightMaterial(e,Xe(e.rightMaterial,t))},s=n.map(e=>e.getKernelObject()),o=this._plannerKernelAccess.kernelContainer.WallType.InnerWall,l=this._plannerKernelAccess.kernelContainer.WallType.OuterWallLeft,c=this._plannerKernelAccess.kernelContainer.WallType.OuterWallRight;for(const t of s)t.wallType===o&&"interior"===e&&(i(t),r(t)),t.wallType===l&&("interior"===e?r(t):i(t)),t.wallType===c&&("exterior"===e?r(t):i(t))}changeInteriorWallsMaterial(e){this._setInteriorOrExteriorWallMaterial("interior",e)}changeExteriorWallsMaterial(e){this._setInteriorOrExteriorWallMaterial("exterior",e)}changeFloorsMaterial(e){const t=this._getViewModel().getFloorPlanObjectViewModels();if(!t.length)return;const n=this._getKernelAccess().planInteractionHandler,a=t.map(e=>e.getKernelObject());n.startInteraction();for(const t of a)n.setFloorMaterial(t,Xe(t.material,e));n.endInteraction()}getWallAngleDegrees(e){if(!(e instanceof s))return 0;const t=this.cameraBehaviour.cameraControl.getCamera(),n=new Ee(t.position.x,t.position.z),a=new Ee(e.getPosition().x,e.getPosition().z).clone().sub(n).normalize(),i=e.getKernelObject(),r=new Ee(Math.sin(i.getAngle()),Math.cos(i.getAngle())),o=a.angle()-r.angle();return Je.radToDeg(o)}moveElementPosition(e,t){const n=this._getKernelAccess().planInteractionHandler;n.setObjectFixedZ(e.getPlanElement(),!0);const a=e.getPlanElement().getCenter(),i=_(t).sub(_(a));n.moveElementBy(e.getPlanElement(),d(i)),this._sendPlanObjectPositions()}moveElementsPosition(e,t){const n=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let a=_(t).sub(e[e.length-1].getPosition());e.forEach(e=>n.push_back(e.getPlanElement()));const i=d(a);this._getKernelAccess().planInteractionHandler.moveObjectsBy(n,i),this._sendPlanObjectPositions()}get plannerCameraBehaviour(){return this.cameraBehaviour}enableMeasurementLineDrawing(){this._roomlePlannerUiCallback.onMeasurementLineStateChange(!0),this._plannerSceneEventHandler.enableMeasurementLineDrawing()}disableMeasurementLineDrawing(){this._plannerSceneEventHandler.disableMeasurementLineDrawing()}setCompletelyLoaded(e){this._completelyLoaded=e}enablePanning(){this.plannerCameraBehaviour instanceof wt&&this.plannerCameraBehaviour.enablePanningOnShiftClick()}disablePanning(){this.plannerCameraBehaviour instanceof wt&&this.plannerCameraBehaviour.disablePanningOnShiftRelease()}setObjectToWallMeasurementLength(e,t,n){const a=this._getViewModel().getPlanObjectForId(e),i=a.getPlanElement(),r=X(i.getWallDistances()).find(e=>Qe(e.angle+"_"+e.length)===t);if(!r)return;const s=_(r.startPoint),o=_(r.endPoint),l=s.clone().sub(o).normalize(),c=(n-r.length)/1e3,h=a.getPosition().clone().add(l.multiplyScalar(c));this._getKernelAccess().planInteractionHandler.moveElementTo(i,d(h)),this._sendObjectMeasurements()}setWallMeasurementLength(e,t,n){const a=this.getPlannerSceneEventHandler().isCurrentlyDrawing,i=this._getKernelAccess().planInteractionHandler;let r=this._getViewModel().getPlanObjectForId(e);const s=i.isVectorPreviewModeEnabled();if(a&&!s){const e=this._getViewModel().latestNodePlanObjectViewModel,t=d(e.getPosition());i.endDrawing(t),this.escapeDrawing(!1),r=this._getViewModel().latestWallPlanObjectViewModel}if(r){const e=r.getKernelObject();i.startInteraction(),i.setLengthOfWall(e,t,e.getPreferredSide(),n,!0),i.endInteraction()}if(a&&!s){i.startInteraction();const e=this._getViewModel().latestNodePlanObjectViewModel,t=d(e.getPosition());i.beginDrawing(t,!1),this._plannerSceneEventHandler.startDrawing()}}setMeasurementLineLength(e,t,n){const a=this._getViewModel().getPlanObjectForId(e);this._plannerSceneEventHandler.setMeasurementLineLength(a,t,n)}setEventHandlerObject(e){super.setEventHandlerObject(e),this._plannerSceneEventHandler.setObject(e)}_readyForRender(){this._roomlePlannerUiCallback.onReadyForRender(),this._globalCallback.onReadyForRender()}notifyPlannerOnComponentSelectionCancel(e,t){var n;if(e)if("configurator"===this.configuratorContext.baseContext){if("click_outside"===t){let e=this.getObjectComponent(null!==(n=this.configuratorContext.rootComponentId)&&void 0!==n?n:this.configuratorContext.planObjectId);this._roomlePlannerUiCallback.onExternalObjectModuleSelected(e.externalObjectGroupId,null,null)}}else this._roomlePlannerUiCallback.onExternalObjectSelectionCancel(t);else this._roomlePlannerUiCallback.onComponentSelectionCancel()}_planObjectSelectionChanged(e,t){var n,a;const i=this.getObjectComponent(null!=t?t:e);if((null===(n=null==i?void 0:i.configurationType)||void 0===n?void 0:n.value)!==S.EXTERNAL)return;let r=this.getObjectComponent(null!==(a=this.configuratorContext.selectedRuntimeComponentId)&&void 0!==a?a:this.configuratorContext.planObjectId);r.externalRootModuleId===i.externalRootModuleId&&r.externalSubModuleId===i.externalSubModuleId||this._getKernelAccess().planObjectSelectionChanged(e,t)}highlightExternalObject(e){this.highlightPlanElementById(e.runtimeId),this._renderWithoutShadowsAndAO()}_selectExternalObjectModule(){var e,t;(null===(e=this._getKernelAccess())||void 0===e?void 0:e.kernelContainer)&&!this._configuratorContext.selectedRuntimeComponentId&&(null===(t=this.getPlanObject(this._configuratorContext.planElementId).configurationType)||void 0===t?void 0:t.value)===S.EXTERNAL&&this.selectComponent(this._configuratorContext.rootComponentId)}getObjectComponent(e){const t=this._getKernelAccess().planInteractionHandler.getPlan();return this._getKernelAccess().planModelViewHelper.getObjectComponent(t,e)}getCameraParameters3d(){return this._getViewModel().cameraType===Ae.CAMERA_3D?this.cameraBehaviour3d.cameraControl.getCurrentCameraParameters():null}_createCeilingLightGroup(){this._scene.children.find(e=>e.name===at)||this._scene.add(this._getViewModel().getCeilingLightsGroup())}toggleInteriorLightsSceneSettings(e){this._isInteriorLightActive=e;const t=this.getScene();t.userData.environmentDefinition.rotation=e?Ce:J,t.userData.environmentDefinition.intensity=e?ve:Q,this._isInteriorLightActive&&(this._createCeilingLightGroup(),this._activateCeilingLight()),this._renderEverything()}}l([c],jt.prototype,"_rapiAccess",void 0),l([c],jt.prototype,"_plannerMeshGenerator",void 0),l([c],jt.prototype,"_plannerInputManager",void 0),l([c],jt.prototype,"_roomlePlannerUiCallback",void 0),l([c],jt.prototype,"_localStorageHelper",void 0),l([c],jt.prototype,"_unitFormatter",void 0);const Ht="Could not retrieve configuration for external object! Did you implement onGetConfigurationForExternalObject?",Lt={left:0,top:1,right:1,bottom:0};class At{constructor(e,t){this._hscInstance=null,this._glbInstance=null,this._configurator=null,this._currentMode=1,this._creator_=e,this._activePlugins=t||[],this._kernelAccessCallback.addListener(this)}setEnvironmentMap(e){const{url:t,intensity:n,rotation:a,maxLightSources:i}=e;this._sceneManager.setEnvironmentMap(t,n,a,i)}deleteSelection(){this._sceneManager.deletePlanElementSelection()}rotateSelection(e){this._sceneManager.rotatePlanElementSelection(e)}cancelSelection(e="unknown"){this._sceneManager.cancelPlanElementSelection(e)}init(e,t,n){return Y.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)))}async createPlanFromObject(e,t,n){if(!this._planInteractionHandler)throw new Error("no plan interaction handler");t&&(t=d(new we(t.x,t.y,t.z)));const a=await($(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e));this._plan=this._plannerKernelAccess.createPlanFromObject(a,t,n),this._sceneManager.planXMLLoaded(this._plan),this._sceneManager.updateScene(),this.resetCameraPosition();const i=O(this._plan.getPlanObjects());return(null==i?void 0:i.length)?i[0].getId():-1}loadPlanXml(e,t){return this._sceneManager.setCompletelyLoaded(!1),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,ee.ROOM_DESIGNER):this._rapiAccess.trackView("planXML",ee.ROOM_DESIGNER)),n()})}loadPlan(e,t){return this.setOverrides(t),new Promise((t,n)=>{const a=te(e);(a?this._rapiAccess.getPlanSnapshot(e):this._rapiAccess.getPlan(e)).then(n=>{this._sceneManager.setCompletelyLoaded(!1);const i=a?n.plan:n.planObjects;this._plan=this._planInteractionHandler.loadPlanXML(i),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._configuratorContext.lastLoadedPlanId=e,this._currentMode=1,this._initData.moc&&this._rapiAccess.trackView(e,ee.ROOM_DESIGNER),t(n)},n)})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}toggleConfigureInRoom(){this._sceneManager.toggleConfigureInRoom()}switch2D(){this._sceneManager.switchTo2D()}switch3D(){this._sceneManager.switchTo3D()}switchToFirstPerson(){this._sceneManager.switchToFirstPerson()}resetCameraPosition(){this._sceneManager.resetCameraPositionToStart()}exportGLB(){this._sceneManager.exportGLB()}importGLB(e){this._sceneManager.importGLB(e)}_initPromiseCallback(e,t){Promise.all([this._scriptLoader.fetch(fe,{id:"tween-js"})]).then(()=>{this._kernelReadyCallback=e;const{dls:t,ls:n,mode:a,stats:i}=this._initData;this._sceneManager||(this._sceneManager=new jt(this._creator_,Lt,this,a)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId);const r=ne.createDynamicLightSettingSource(t,n);i&&this.showStats(),this._sceneManager.enableHD(r),this._planInteractionHandler&&this._kernelReadyCallback()})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){Y.showBenchmarks()}getConfiguratorApi(){return this._configurator||(this._configurator=new it(this._creator_,this._activePlugins),this._configurator.setOverrides(this._initData),this._configurator.initSceneManager(this._sceneManager)),this._configurator}startViewing(){this._sceneManager.startViewing(),this._roomlePlannerUiCallback.onContextChanged("glb-viewer")}startConfiguring(){var e,t;const n=this._sceneManager.currentSelection,a=(null===(e=n.item)||void 0===e?void 0:e.id)||(null===(t=n.configuration)||void 0===t?void 0:t.id);this._sceneManager.startConfiguring(),a&&this._configurator.notifyUiAboutNewLabel(a),this._roomlePlannerUiCallback.onContextChanged("configurator")}async selectPlanObjectById(e){return this._sceneManager.selectPlanObject(e)}highlightPlanElements(e){null===e?this._sceneManager.highlightPlanElementsById(null):Array.isArray(e)?this._sceneManager.highlightPlanElementsById(e):this._sceneManager.highlightPlanElementById(e)}backToPlanner(){this._sceneManager.backToPlanner(),this._roomlePlannerUiCallback.onContextChanged("planner")}showGUI(){this._sceneManager.showGUI()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);t.import("./configurator-6d986be2.legacy.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("isolation_mode_started"),e}async switchToViewer(){const e=await this._singlePromiseFactory.create(4,"startGLB",e=>{if(this._glbInstance)return e(this._glbInstance);t.import("./glb-viewer-a93e80f4.legacy.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("isolation_mode_started"),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}get hasSingleRoom(){return this._sceneManager.hasSingleRoom}showStats(){this._sceneManager.showStats()}onCloseHSC(){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({reason:"isolation_mode_cancelled"}),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");if(t&&(t=d(new we(t.x,t.y,t.z))),st(e)){if(t||n)throw new Error("External objects do not support position and rotation");return this._insertExternalObject(e)}const a=await($(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),i=await this._plannerKernelAccess.addPlanObjectFromItem(a,t,n);return this._sceneManager.updateScene(),i}async insertItemList(e){if(0===e.length)return[];const t=e.map((e,t)=>({id:e,index:t})),n=async(e,t)=>({runtimeId:await this._insertExternalObject(e),originalIndex:t}),a=[],i=[];for(const{index:e,id:r}of t)st(r)?a.push(n(r,e)):i.push({index:e,id:r});const r=(async e=>{const t=e.map(({id:e})=>$(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),n=await Promise.all(t);return(await this._plannerKernelAccess.insertItems(n)).map((t,n)=>({runtimeId:t,originalIndex:e[n].index}))})(i),[s,o]=await Promise.all([Promise.all(a),r]),l=[...s,...o];return l.sort((e,t)=>e.originalIndex-t.originalIndex),l.map(e=>e.runtimeId)}async insertItems(e){if(0===e.length)return[];const t=e.map(e=>"string"==typeof e?e:e.id);return this.insertItemList(t)}duplicateItems(e){return this._plannerKernelAccess.duplicateItems(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),t=O(e.objects);return pt(t,this._plannerKernelAccess,this._rapiAccess)}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return O(e)}prepareTopImage(e={}){return this._sceneManager.prepareTopImage(e)}preparePerspectiveImage(e={},t=!1){return this._sceneManager.preparePerspectiveImage(e,t)}enableRotation(){this._sceneManager.enableRotation()}disableRotation(){this._sceneManager.disableRotation()}enableMultiselect(){this._sceneManager.getPlannerSceneEventHandler().setSelectionMode("multiselect"),this._configuratorContext.selectionMode="multiselect"}disableMultiselect(){this._sceneManager.getPlannerSceneEventHandler().setSelectionMode("standard"),this._configuratorContext.selectionMode="standard"}async _insertExternalObject(e,t={}){var n,a,i;let r=e;if(st(e)&&(r=await this._roomlePlannerUiCallback.onGetConfigurationForExternalObject(e),!r))throw new Error(Ht);if(ot(e)&&(null===(n=e.externalMeta)||void 0===n?void 0:n.refresh)&&(r=await this._roomlePlannerUiCallback.onGetConfigurationForExternalObject(e.id),!r))throw new Error(Ht);const s=null===(a=t.findFreeSpaceInPlan)||void 0===a||a,o=null!==(i=t.dragIn)&&void 0!==i&&i;return await this._loadExternalObjectGroup(r,s,o,!1),-1}async dragInObject(e,t,n="rml_id"){if("rml_serialized"===n)throw new Error("dragInObject is not supported for tc_id or rml_serialized");if(this._sceneManager.dragIn(t),"rml_id"===n){const t=$(e)?await this._rapiAccess.getItem(e):await this._rapiAccess.getConfiguration(e),n=await this.insertItems([t]);if(1!==n.length)throw new Error("More than one object added, abort");return n[0]}if("tc_id"===n||"tc_serialized"===n)return this._insertExternalObject(e,{dragIn:!0});throw new Error("dragInObject is not supported for "+n)}enableSnapping(){this._sceneManager.enableSnapping()}disableSnapping(){this._sceneManager.disableSnapping()}enableAdvancedDocking(){this._sceneManager.enableAdvancedDocking()}disableAdvancedDocking(){this._sceneManager.disableAdvancedDocking()}showsChildrenOfPlanObject(e){return this._sceneManager.showsChildrenOfPlanObject(e)}enableShowChildrenOfPlanObject(e){this._sceneManager.enableShowChildrenOfPlanObject(e)}disableShowChildrenOfPlanObject(e){this._sceneManager.disableShowChildrenOfPlanObject(e)}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,a;const i=this._planInteractionHandler;i.startInteraction();const r=[];for(const t of e){const e=i.addNode(t.from),s=i.addNode(t.to),o=i.addWall(e,s);void 0!==(null===(n=t.props)||void 0===n?void 0:n.height)&&i.setWallHeight(o,t.props.height),void 0!==(null===(a=t.props)||void 0===a?void 0:a.thickness)&&i.setWallThickness(o,t.props.thickness),r.push(o)}return t.keepInteractionOpen||i.endInteraction(),this._sceneManager.updateCameraOnDrawWalls(),this._sceneManager.updateScene(),r}async removeElements(e,t={}){this._sceneManager.lockCamera();const n=this._planInteractionHandler;for(const t of e){const e=this._sceneManager.getPlanObject(t.getId());let n;e&&(n=await pt([e],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(L.REMOVED,(null==n?void 0:n.length)?n[0]:{...e,data:null}),this._planInteractionHandler.removeElement(t)}t.keepInteractionOpen||n.endInteraction(),this._sceneManager.unlockCamera()}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}getStorage(){return this._idbManager}getConfiguratorContext(){return this._configuratorContext}get PlannerCoreTypes(){return this._plannerKernelAccess.kernelContainer}setSceneEvents(e){this._sceneManager.setSceneEvents(e)}async saveExternalObjectSnapshot(e){const t=await this.getPlanModelViewHelper(),n=this._planInteractionHandler.getPlan(),a=O(t.getExternalObjectGroups(n));if(0===a.length)return null;const i=await this._savePlanSnapshotExternalObjects(e,a);return{...i,glb:`https://api.roomle.com/v2/planSnapshots/${i.id}/3dAssets/glTF/plan.glb`,usdz:`https://api.roomle.com/v2/planSnapshots/${i.id}/3dAssets/usdz/plan.usdz`}}async _savePlanSnapshotExternalObjects(e,t){const n=t.map(e=>e.uniqueId),a=t.map(e=>e.runtimeId),i=await this.getPlanModelViewHelper(),r=this._planInteractionHandler.getPlan(),s=i.getPlanOverview(r),o={parentId:e||null,planObjects:[],combinedIds:[],plan:r.createPlanXmlWithObjects(n,!1,2)},l=s.objects,c=l.size();for(let e=0;e<c;e++){const t=l.get(e),n=t.configurationHash||t.catalogItemId;if(a.includes(t.runtimeId)){const{center:e,dimensions:a,rotation:i,rootComponentCenter:r}=t,s=JSON.stringify({center:e,dimensions:a,rotation:i,rootComponentCenter:r});o.planObjects.push({combinedId:n,position:s})}}const h=await this._rapiAccess.savePlanSnapshot(o);this._plannerKernelAccess.planSnapshotCreated(h);const d=new Promise((e,t)=>{Promise.allSettled([this.preparePerspectiveImage({runtimeIds:a}),this.prepareTopImage({runtimeIds:a})]).then(async([n,a])=>{if("rejected"!==n.status&&"rejected"!==a.status)try{const t=await this._rapiAccess.savePlanSnapshotImage(h,n.value,"perspectiveImage",a.value,"topImage");e({...t})}catch(e){t(e)}else t("Could not generate images of plan snapshot")})});try{return await d}catch(e){return console.error(e),h}}async saveCurrentPlanSnapshot(e,t){const n=await this.getPlanModelViewHelper(),a=this._planInteractionHandler.getPlan(),i=n.getPlanOverview(a),r={parentId:e||null,planObjects:[],combinedIds:[],plan:t?a.createPlanXmlWithObjects(t,!1,2):a.getPlanXML(!1,2)},s=i.objects,o=s.size();for(let e=0;e<o;e++){const n=s.get(e),a=n.configurationHash||n.catalogItemId;if(!t||a===t){const{center:e,dimensions:t,rotation:i,rootComponentCenter:s}=n,o=JSON.stringify({center:e,dimensions:t,rotation:i,rootComponentCenter:s});r.planObjects.push({combinedId:a,position:o})}}const l=await this._rapiAccess.savePlanSnapshot(r);this._plannerKernelAccess.planSnapshotCreated(l);const c=new Promise((e,t)=>{Promise.allSettled([this.preparePerspectiveImage(),this.prepareTopImage()]).then(async([n,a])=>{if("rejected"!==n.status&&"rejected"!==a.status)try{const t=await this._rapiAccess.savePlanSnapshotImage(l,n.value,"perspectiveImage",a.value,"topImage");e({...t})}catch(e){t(e)}else t("Could not generate images of plan snapshot")})});try{return await c}catch(e){return console.error(e),l}}getPlanXmlFrom(e){return e?te(e.id)?e.plan:e.planObjects:null}async moveCamera(e){return this._sceneManager.moveCamera(e)}async createNewSerializedConfiguration(e){return Promise.resolve(this._plannerKernelAccess.createNewSerializedConfiguration(e))}changeInteriorWallsMaterial(e){this._sceneManager.changeInteriorWallsMaterial(e)}changeExteriorWallsMaterial(e){this._sceneManager.changeExteriorWallsMaterial(e)}changeFloorsMaterial(e){this._sceneManager.changeFloorsMaterial(e)}getWallAngleDegrees(e){return this._sceneManager.getWallAngleDegrees(e)}calcPartsPriceSum(e){return this._plannerKernelAccess.calcPartsPriceSum(e)}async swapObject(e,t){const n=e.getPosition(),a=e.getRotation();return await this._sceneManager.deletePlanElementByIds([e.getPlanElement().getId()]),this.cancelSelection("swap_object"),await this.insertObject(t,n,a)}exportImageFromCamera(e="image",t=!1){return this._sceneManager.exportImageFromCamera(e,t)}exportCanvasScreenshot(e){return this._sceneManager.exportCanvasScreenshot(e)}moveElementPosition(e,t){this._sceneManager.moveElementPosition(e,t)}moveElementsPosition(e,t){this._sceneManager.moveElementsPosition(e,t)}preparePerspectiveImageOf(e,t={}){return this._sceneManager.preparePerspectiveImageOf(e,t)}async generateTCExport(e=[]){try{const t=new this._plannerKernelAccess.kernelContainer.StringArray;for(const n of e)t.push(n);return Promise.resolve(JSON.parse(this._planInteractionHandler.generateTCExport(t)))}catch(e){return console.error(e),Promise.reject("Could not create Blue Ocean MVP JSON")}}enableMeasurementLineDrawing(){this._sceneManager.enableMeasurementLineDrawing()}disableMeasurementLineDrawing(){this._sceneManager.disableMeasurementLineDrawing()}setObjectToWallMeasurementLength(e,t,n){this._sceneManager.setObjectToWallMeasurementLength(e,t,n)}setWallMeasurementLength(e,t,n){this._sceneManager.setWallMeasurementLength(e,t,n)}setMeasurementLineLength(e,t,n){this._sceneManager.setMeasurementLineLength(e,t,n)}escapeDrawing(e){this._sceneManager.escapeDrawing(e),this._roomlePlannerUiCallback.onDrawCancel()}isCurrentlyDrawing(){return this._sceneManager.getPlannerSceneEventHandler().isCurrentlyDrawing}async resolveShortUrl(e){const[,,,t]=e.split("/"),n=await this._rapiAccess.resolveShortUrl(t);if(!n)throw new Error("Failed to resolve short URL");const{url:a}=n;return a}enableEvents(){this._sceneManager.enableEvents()}disableEvents(){this._sceneManager.disableEvents()}async downloadHomagIxExportPoC(){const{downloadHomagIxExportPoC:e}=await t.import("./imos-ix-poc-export-helper-29f473ec.legacy.js");return e((await this.getPlanModelViewHelper()).getPlanOverview(this._plan),this._plannerKernelAccess.configurationExporter,this._plannerKernelAccess.kernelInstance)}async configureExternalObjectApi(e){let t="string"==typeof e?JSON.parse(e):e;await this._plannerKernelAccess.configureExternalObjectApi(t)}loadExternalObjectLibrary(e){const t=this._planInteractionHandler.getConfiguratorKernel(),n="string"==typeof e?e:JSON.stringify(e);t.loadExternalAttributeDefinition(n),this.updateScene()}async loadExternalObjectGroup(e,t,n=!1,a=[]){return this._loadExternalObjectGroup(e,t,!1,n,a)}async _loadExternalObjectGroup(e,t,n,a,i=[]){"configurator"===this.getConfiguratorContext().baseContext?await this._loadExternalObjectGroupInConfigurator(e,t,n,a,i):await this._loadExternalObjectGroupInPlanner(e,t,n,a,i)}async _loadExternalObjectGroupInConfigurator(e,t,n,a,i=[]){await this._loadOrUpdateExternalObjectGroup(e,t,n,a,i,!0),this.updateScene()}async _loadExternalObjectGroupInPlanner(e,t,n,a,i=[]){var r;const s=this.getConfiguratorContext(),o=this._sceneManager.getPlanObject(s.planElementId);if(await this._loadOrUpdateExternalObjectGroup(e,t,n,a,i,!1),(null===(r=o.configurationType)||void 0===r?void 0:r.value)===S.EXTERNAL)if(i.includes(o.configurationHash)){const t=this._createSerializedGroupCollection(e),n=JSON.parse(t[0]).id;await this._selectExternalObjectGroup(n,!1)}else await this._selectExternalObjectGroup(o.configurationHash,!1);this.updateScene()}async _loadOrUpdateExternalObjectGroup(e,t,n,a,i,r){const s=this._createSerializedGroupCollection(e);n?this._planInteractionHandler.startInteraction():this._planInteractionHandler.resumeInteraction();const o=n&&!r?this._getFaceTheCameraAngle(90):0,l={findFreeSpaceInPlan:t,applyGlobalChildMode:!1,isVisible:!n,correctArrangement:a},c=this._planInteractionHandler.addOrUpdateExternalPlanObjects(s,{x:0,y:0,z:0},o,l,i);n||this._planInteractionHandler.endInteraction();const h=this._planInteractionHandler.getPlan().extRef.jsObject,d=[];for(const e of c)e.hasConfiguration()&&d.push(h.getConfigurablePlanObjectForId(e.getId()));await Promise.all(d.map(async e=>{await e.isInitDone()}))}_createSerializedGroupCollection(e){const t=Array.isArray(e)?e:[e],n=[];for(const e of t){const t="string"==typeof e?e:JSON.stringify(e);n.push(t)}return n}_getFaceTheCameraAngle(e){const t=this._sceneManager.getCameraParameters3d();if(!(null==t?void 0:t.yaw))return 0;const n=ae(t.yaw),a=Math.round(n/e)*e;return ie(a)}async renderImagesOfExternalObjectGroup(e){const t=Array.isArray(e)?e:[e],n={},a=this._initData.animateCamera;this._initData.animateCamera=!1;for(const e of t){try{await this._loadExternalObjectGroup(e,!1,!1,!1),await this._selectExternalObjectModule(e.id,null,!0,!0,!1,!1),this.preparePerspectiveImage(),await this._sceneManager.waitForMaterialQueue(),this.updateScene();const t=await this.exportCanvasScreenshot();n[e.id]=t}catch(e){console.error(e)}this.backToPlanner()}for(const e of t)await this.removeExternalObjectGroup(e.id,!1);return this._initData.animateCamera=a,n}async removeExternalObjectGroup(e,t=!1){const n=await this.getPlanModelViewHelper(),a=this._planInteractionHandler.getPlan(),i=n.getExternalObjectComponent(a,e,"");this.getConfiguratorContext().planElementId===i.runtimeId&&this._sceneManager.cancelPlanElementSelection("delete_object"),0!==i.runtimeId&&(t?(this._planInteractionHandler.resumeInteraction(),this._planInteractionHandler.removeObjectWithId(e),this._planInteractionHandler.endInteraction()):(this._planInteractionHandler.startInteraction(),this._sceneManager.deletePlanElementByIds([i.runtimeId]),this._planInteractionHandler.endInteraction())),this.updateScene()}removeExternalObjectRootModule(e){this._planInteractionHandler.startInteraction(),this._planInteractionHandler.removeObjectWithId(e),this._planInteractionHandler.endInteraction(),this.updateScene()}async selectExternalObjectGroup(e){"configurator"===this.getConfiguratorContext().baseContext||this._planInteractionHandler.setShowChildrenOfExternalObject(e,{value:v.OFF},!1),await this._selectExternalObjectGroup(e,!0),this.updateScene()}async selectExternalObjectRootModule(e){const t="configurator"===this.getConfiguratorContext().baseContext;t||this._planInteractionHandler.setShowChildrenOfExternalObject(e,{value:v.GROUND_COMPONENTS},!1),await this._selectExternalObjectModule(e,null,!t,t,!0,!0),this.updateScene()}async selectExternalObjectSubModule(e,t){const n="configurator"!==this.getConfiguratorContext().baseContext;await this._selectExternalObjectModule(e,t,n,!0,!0,!0),this.updateScene()}async openOrCloseGeometryOfExternalObject(e,t,n,a){const i=await this.getPlanModelViewHelper(),r=this._planInteractionHandler.getPlan(),s=i.getExternalObjectComponent(r,e,"");if(null==s?void 0:s.configurationRuntimeId){const e=n?"open":"close";this._sceneManager.animateElement(s.configurationRuntimeId,"openClose",e,!0,a),this.updateScene()}}async _selectKernelComponent(e){e.configurationHash&&e.configurationType.value===S.EXTERNAL&&await this._selectExternalObjectModule(e.configurationHash,e.componentId,!0,!0,!0,!1),this.updateScene()}async _selectExternalObjectGroup(e,t){const n=await this.getPlanModelViewHelper(),a=this._planInteractionHandler.getPlan(),i=n.getExternalObjectComponent(a,e,"");0!==i.runtimeId&&(t&&await this._roomlePlannerUiCallback.onBackToPlanner(),await this._sceneManager.selectPlanObject(i.runtimeId))}async _selectExternalObjectModule(e,t,n,a,i,r){const s=await this.getPlanModelViewHelper(),o=this._planInteractionHandler.getPlan(),l=s.getExternalObjectComponent(o,e,null!=t?t:"");if(0===l.runtimeId)return;const c="configurator"===this.getConfiguratorContext().baseContext,h=this._getSelectedPlanObjectComponent();let d=!1,g=n;c&&(d=(null==h?void 0:h.configurationRuntimeId)===l.configurationRuntimeId,g=!d,d||this._sceneManager.backToPlanner()),g&&await this._selectPlanObject(l),a&&!d&&await this._roomlePlannerUiCallback.onStartConfiguring(),0!==l.planComponentRuntimeId&&i&&this._sceneManager.selectComponent(l.planComponentRuntimeId,!1),r&&!c&&this._sceneManager.highlightExternalObject(l)}async _selectPlanObject(e){let t=e.runtimeId;const n=O(this._plan.getPlanObjects());for(const a of n)if(a.getConfigurationRuntimeId()===e.planComponentRuntimeId){t=a.getId();break}await this._sceneManager.selectPlanObject(t)}_getSelectedPlanObjectComponent(){var e;const t=this.getConfiguratorContext(),n=null!==(e=t.selectedRuntimeComponentId)&&void 0!==e?e:t.planObjectId;return this._sceneManager.getObjectComponent(n)}async getExternalObjectGroups(){const e=await this.getPlanModelViewHelper(),t=this._planInteractionHandler.getPlan(),n=[],a=O(e.getExternalObjectGroups(t));for(const e of a)n.push(JSON.parse(e.serializedDefinition));return n}get globalCallbacks(){return this._globalCallback}_executeWithInteraction(e){const t=this._plannerKernelAccess.planInteractionHandler;t.startInteraction();const n=e();return t.endInteraction(),n}addAtticToWall(e,t,n,a){return this._executeWithInteraction(()=>this._plannerKernelAccess.planInteractionHandler.addAttic(e,t,n,a)||null)}removeAttic(e){this._executeWithInteraction(()=>this._plannerKernelAccess.planInteractionHandler.removeElement(e))}setAtticSide(e,t){this._executeWithInteraction(()=>this._plannerKernelAccess.planInteractionHandler.setAtticSide(e,t))}getAttachedAttic(e){const t=e.getAttachedAttics();return t.size()>0?t.get(0):null}updateAtticKneeHeight(e,t){this._executeWithInteraction(()=>this._plannerKernelAccess.planInteractionHandler.setAtticKneeHeight(e,t))}updateAtticWidth(e,t){this._executeWithInteraction(()=>this._plannerKernelAccess.planInteractionHandler.setAtticWidth(e,t))}async executeWithInteraction(e){const t=this._plannerKernelAccess.planInteractionHandler;t.startInteraction();try{const n=e();return n instanceof Promise?await n:n}finally{t.endInteraction()}}pauseInputListeners(){return this._sceneManager.pause()}resumeInputListeners(){return this._sceneManager.resume()}turnLightsOn(){var e,t;const n=null===(t=null===(e=this._planInteractionHandler.getPlan())||void 0===e?void 0:e.extRef)||void 0===t?void 0:t.jsObject;null==n||n.turnLightsOnOrOff(!0),this._sceneManager.toggleInteriorLightsSceneSettings(!0)}turnLightsOff(){var e,t;const n=null===(t=null===(e=this._planInteractionHandler.getPlan())||void 0===e?void 0:e.extRef)||void 0===t?void 0:t.jsObject;null==n||n.turnLightsOnOrOff(!1),this._sceneManager.toggleInteriorLightsSceneSettings(!1)}}l([c],At.prototype,"_configuratorContext",void 0),l([c],At.prototype,"_domHelper",void 0),l([c],At.prototype,"_scriptLoader",void 0),l([c],At.prototype,"_kernelAccessCallback",void 0),l([c],At.prototype,"_plannerKernelAccess",void 0),l([c],At.prototype,"_rapiAccess",void 0),l([c],At.prototype,"_singlePromiseFactory",void 0),l([c],At.prototype,"_roomlePlannerUiCallback",void 0),l([c],At.prototype,"_lifeCycleManager",void 0),l([c],At.prototype,"_dataSyncer",void 0),l([c],At.prototype,"_initData",void 0),l([c],At.prototype,"_idbManager",void 0),l([c],At.prototype,"_globalInitData",void 0),l([c],At.prototype,"_globalCallback",void 0),l([c],At.prototype,"_unitFormatter",void 0);const xt=[new se("script-loader",n),new se("planner-input-manager",class extends re{_canDrag(e){return!0}},1),new se("logger",oe),new se("planner-mesh-generator",le),new se("rapi-access",ce),new se("planner-selection-handler",class extends r{constructor(){super(...arguments),this._selectionMode="standard",this._selectedPlanElementViewModels=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}removeSelection(){this._selectedPlanElementViewModels.clear()}cancelSelection(e){0!==this._selectedPlanElementViewModels.size&&this._selectedPlanElementViewModels.forEach((t,n)=>{this._selectedPlanElementViewModels.delete(n),t.deselect(),this.dispatchEvent(1,new ht({planElementViewModel:t,reason:e}))})}_checkStandard(e){const t=e.getId();this._selectedPlanElementViewModels.has(t)&&this._selectedPlanElementViewModels.get(t)||(this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),e.deselect(),this.dispatchEvent(1,new ht({planElementViewModel:e,reason:"select_other"}))}),this._selectedPlanElementViewModels.set(e.getId(),e),e.select(),this.dispatchEvent(0,new ht({planElementViewModel:e})))}_checkMulti(e){ct(e)||this._selectedPlanElementViewModels.has(e.getId())||(this._selectedPlanElementViewModels.set(e.getId(),e),e.select(),this.dispatchEvent(2,new ht({planElementViewModels:this.getSelectedPlanElementViewModels()})),this.dispatchEvent(0,new ht({planElementViewModel:e})))}_deselectWallAndFloorElements(){this._selectedPlanElementViewModels.forEach((e,t)=>{ct(e)&&(this._selectedPlanElementViewModels.delete(t),e.deselect(),this.dispatchEvent(1,new ht({planElementViewModel:e,reason:"selection_mode_changed"})))})}setSelectionMode(e){this._selectionMode!==e&&("multiselect"===e&&this._deselectWallAndFloorElements(),this._selectionMode=e,this.dispatchEvent(3,new ht({selectionMode:e})))}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedPlanElementViewModels.size>0}hasMultiSelection(){return this._selectedPlanElementViewModels.size>1}getSelectedPlanElementViewModels(){return[...this._selectedPlanElementViewModels].map(([e,t])=>t)}getSelectedIds(){let e=[];return this._selectedPlanElementViewModels.forEach(t=>e.push(t.getId())),e}isSelected(e){return!!this._selectedPlanElementViewModels.get(e)}})];e("Planner",class extends a{constructor(e,t){super(e),this._activePlugins=t||[]}setupGlobals(){}setupDependencies(){he.setup(xt),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 At(this._context,this._activePlugins),this._planner.getMain=()=>this,window.RoomlePlanner||(this._activePlugins.length,window.RoomlePlanner=this._planner)}getApi(){return this._planner}getContextName(){return"planner"}})}}}));
2
- //# sourceMappingURL=planner-a87498bf.legacy.js.map