@roomle/web-sdk 2.31.0 → 2.32.0-alpha.3
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.
- package/lib/{banana-for-scale-c6030e54.nomodule.js → banana-for-scale-1dd1ee1a.nomodule.js} +2 -2
- package/lib/{banana-for-scale-c6030e54.nomodule.js.map → banana-for-scale-1dd1ee1a.nomodule.js.map} +1 -1
- package/lib/{banana-for-scale-ecc6400f.js → banana-for-scale-c1b2396c.js} +2 -2
- package/lib/{banana-for-scale-ecc6400f.js.map → banana-for-scale-c1b2396c.js.map} +1 -1
- package/lib/{component-dimensioning-c3e374eb.js → component-dimensioning-7e06900a.js} +2 -2
- package/lib/component-dimensioning-7e06900a.js.map +1 -0
- package/lib/{component-dimensioning-22c684c5.nomodule.js → component-dimensioning-c4a314fb.nomodule.js} +2 -2
- package/lib/component-dimensioning-c4a314fb.nomodule.js.map +1 -0
- package/lib/{configurator-88bbf86b.js → configurator-311b4734.js} +2 -2
- package/lib/{configurator-88bbf86b.js.map → configurator-311b4734.js.map} +1 -1
- package/lib/{configurator-0c2db2a8.nomodule.js → configurator-57593905.nomodule.js} +2 -2
- package/lib/{configurator-0c2db2a8.nomodule.js.map → configurator-57593905.nomodule.js.map} +1 -1
- package/lib/configurator-main-27d5bb6a.js +2 -0
- package/lib/configurator-main-27d5bb6a.js.map +1 -0
- package/lib/configurator-main.nomodule.js +1 -1
- package/lib/configurator-mesh-generator-6754e1da.nomodule.js +2 -0
- package/lib/configurator-mesh-generator-6754e1da.nomodule.js.map +1 -0
- package/lib/{configurator-mesh-generator-d945c432.js → configurator-mesh-generator-6fec6875.js} +2 -2
- package/lib/configurator-mesh-generator-6fec6875.js.map +1 -0
- package/lib/{default-light-setting-0d73db9a.nomodule.js → default-light-setting-3d32c156.nomodule.js} +2 -2
- package/lib/default-light-setting-3d32c156.nomodule.js.map +1 -0
- package/lib/{default-light-setting-68f26594.js → default-light-setting-ebc6f657.js} +2 -2
- package/lib/default-light-setting-ebc6f657.js.map +1 -0
- package/lib/definitions/common-core/src/cameracontrol/camera-control-2d.d.ts +2 -3
- package/lib/definitions/common-core/src/services/common-kernel-access.d.ts +1 -1
- package/lib/definitions/planner-core/src/roomle-planner.d.ts +9 -5
- package/lib/definitions/typings/kernel.d.ts +4 -1
- package/lib/definitions/typings/planner.d.ts +1 -1
- package/lib/{dimensioning-helper-5169193f.nomodule.js → dimensioning-helper-8c8cc947.nomodule.js} +2 -2
- package/lib/{dimensioning-helper-5169193f.nomodule.js.map → dimensioning-helper-8c8cc947.nomodule.js.map} +1 -1
- package/lib/{dimensioning-helper-45d0d956.js → dimensioning-helper-b7645970.js} +2 -2
- package/lib/{dimensioning-helper-45d0d956.js.map → dimensioning-helper-b7645970.js.map} +1 -1
- package/lib/{glb-viewer-f7fd754c.nomodule.js → glb-viewer-33b31a7b.nomodule.js} +2 -2
- package/lib/{glb-viewer-f7fd754c.nomodule.js.map → glb-viewer-33b31a7b.nomodule.js.map} +1 -1
- package/lib/{glb-viewer-c70beada.js → glb-viewer-e4d5132a.js} +2 -2
- package/lib/{glb-viewer-c70beada.js.map → glb-viewer-e4d5132a.js.map} +1 -1
- package/lib/glb-viewer-main-481f29f5.js +2 -0
- package/lib/glb-viewer-main-481f29f5.js.map +1 -0
- package/lib/glb-viewer-main.nomodule.js +1 -1
- package/lib/{image-renderer-90ccc20e.nomodule.js → image-renderer-0a560f5d.nomodule.js} +2 -2
- package/lib/{image-renderer-90ccc20e.nomodule.js.map → image-renderer-0a560f5d.nomodule.js.map} +1 -1
- package/lib/{image-renderer-f1b6a0cf.js → image-renderer-55bc47f0.js} +2 -2
- package/lib/{image-renderer-f1b6a0cf.js.map → image-renderer-55bc47f0.js.map} +1 -1
- package/lib/legacy/{banana-for-scale-2c7e61df.legacy.js → banana-for-scale-4e5edebc.legacy.js} +2 -2
- package/lib/legacy/{banana-for-scale-2c7e61df.legacy.js.map → banana-for-scale-4e5edebc.legacy.js.map} +1 -1
- package/lib/legacy/{component-dimensioning-30d883f2.legacy.js → component-dimensioning-dbded833.legacy.js} +2 -2
- package/lib/legacy/component-dimensioning-dbded833.legacy.js.map +1 -0
- package/lib/legacy/{configurator-3c9aa61c.legacy.js → configurator-2ef45365.legacy.js} +2 -2
- package/lib/legacy/{configurator-3c9aa61c.legacy.js.map → configurator-2ef45365.legacy.js.map} +1 -1
- package/lib/legacy/configurator-main.legacy.js +1 -1
- package/lib/legacy/{configurator-mesh-generator-1062fffa.legacy.js → configurator-mesh-generator-c93c67f0.legacy.js} +2 -2
- package/lib/legacy/configurator-mesh-generator-c93c67f0.legacy.js.map +1 -0
- package/lib/legacy/{default-light-setting-684f437b.legacy.js → default-light-setting-ed941041.legacy.js} +2 -2
- package/lib/legacy/default-light-setting-ed941041.legacy.js.map +1 -0
- package/lib/legacy/{dimensioning-helper-d3639e7d.legacy.js → dimensioning-helper-eed38423.legacy.js} +2 -2
- package/lib/legacy/{dimensioning-helper-d3639e7d.legacy.js.map → dimensioning-helper-eed38423.legacy.js.map} +1 -1
- package/lib/legacy/{glb-viewer-84c78e6f.legacy.js → glb-viewer-1c46d2b6.legacy.js} +2 -2
- package/lib/legacy/{glb-viewer-84c78e6f.legacy.js.map → glb-viewer-1c46d2b6.legacy.js.map} +1 -1
- package/lib/legacy/glb-viewer-main.legacy.js +1 -1
- package/lib/legacy/{image-renderer-526f1625.legacy.js → image-renderer-eac32d55.legacy.js} +2 -2
- package/lib/legacy/{image-renderer-526f1625.legacy.js.map → image-renderer-eac32d55.legacy.js.map} +1 -1
- package/lib/legacy/{material-viewer-004b210b.legacy.js → material-viewer-60d2353d.legacy.js} +2 -2
- package/lib/legacy/material-viewer-60d2353d.legacy.js.map +1 -0
- package/lib/legacy/material-viewer-main.legacy.js +1 -1
- package/lib/legacy/{mesh-generator-b8345f3e.legacy.js → mesh-generator-fcd58534.legacy.js} +2 -2
- package/lib/legacy/mesh-generator-fcd58534.legacy.js.map +1 -0
- package/lib/legacy/pixotron-013c13c3.legacy.js +2 -0
- package/lib/legacy/{pixotron-b7f25843.legacy.js.map → pixotron-013c13c3.legacy.js.map} +1 -1
- package/lib/legacy/planner-e7dbca90.legacy.js +2 -0
- package/lib/legacy/{planner-7cf4e52a.legacy.js.map → planner-e7dbca90.legacy.js.map} +1 -1
- package/lib/legacy/planner-main.legacy.js +1 -1
- package/lib/legacy/rapi-access-d17de02e.legacy.js +16 -0
- package/lib/legacy/{rapi-access-34b1ce17.legacy.js.map → rapi-access-d17de02e.legacy.js.map} +1 -1
- package/lib/legacy/roomle-sdk.legacy.js +1 -1
- package/lib/legacy/static/{ConfiguratorKernel-b3f9bde09ca9cb82.js → ConfiguratorKernel-740d5afc47f4a393.js} +71 -71
- package/lib/legacy/static/ConfiguratorKernel-8338b6e04f42e1bb.wasm +0 -0
- package/lib/legacy/static/ConfiguratorKernelJs-05d7ca332e0afd5c.js +143 -0
- package/lib/legacy/static/ConfiguratorKernelJs-94d09444363eb9cc.mem +0 -0
- package/lib/legacy/static/{RoomleCore-c036b1e6afc8afc5.js → RoomleCore-5bf2453bcbe354c7.js} +59 -59
- package/lib/legacy/static/RoomleCore-6d3b769c4ee59ce2.wasm +0 -0
- package/lib/legacy/static/RoomleCoreJs-6aaba29145bc7b7d.mem +0 -0
- package/lib/legacy/static/RoomleCoreJs-c7fc9ea60bea9da9.js +151 -0
- package/lib/legacy/static/shaders-404e545ed5c1f891.json +1 -0
- package/lib/legacy/{stats-helper-c509b532.legacy.js → stats-helper-10fd35ad.legacy.js} +2 -2
- package/lib/legacy/{stats-helper-c509b532.legacy.js.map → stats-helper-10fd35ad.legacy.js.map} +1 -1
- package/lib/{material-viewer-48033bdf.js → material-viewer-333412bc.js} +2 -2
- package/lib/material-viewer-333412bc.js.map +1 -0
- package/lib/{material-viewer-543e6a18.nomodule.js → material-viewer-5141a250.nomodule.js} +2 -2
- package/lib/material-viewer-5141a250.nomodule.js.map +1 -0
- package/lib/material-viewer-main-40652a50.js +2 -0
- package/lib/material-viewer-main-40652a50.js.map +1 -0
- package/lib/material-viewer-main.nomodule.js +1 -1
- package/lib/{mesh-generator-9fe4238a.js → mesh-generator-2b2e73e3.js} +2 -2
- package/lib/mesh-generator-2b2e73e3.js.map +1 -0
- package/lib/{mesh-generator-0840e6a4.nomodule.js → mesh-generator-bb30cd16.nomodule.js} +2 -2
- package/lib/mesh-generator-bb30cd16.nomodule.js.map +1 -0
- package/lib/pixotron-143b10ea.nomodule.js +2 -0
- package/lib/{pixotron-a91b119f.nomodule.js.map → pixotron-143b10ea.nomodule.js.map} +1 -1
- package/lib/pixotron-d569a6fb.js +2 -0
- package/lib/{pixotron-42da5ecd.js.map → pixotron-d569a6fb.js.map} +1 -1
- package/lib/planner-13ce5944.nomodule.js +2 -0
- package/lib/{planner-9ebb0e5a.nomodule.js.map → planner-13ce5944.nomodule.js.map} +1 -1
- package/lib/planner-4dc225a7.js +2 -0
- package/lib/{planner-77d66f6f.js.map → planner-4dc225a7.js.map} +1 -1
- package/lib/planner-main-6150ccf5.js +2 -0
- package/lib/planner-main-6150ccf5.js.map +1 -0
- package/lib/planner-main.nomodule.js +1 -1
- package/lib/rapi-access-27035346.nomodule.js +16 -0
- package/lib/{rapi-access-47da54bc.nomodule.js.map → rapi-access-27035346.nomodule.js.map} +1 -1
- package/lib/rapi-access-5a09b0fd.js +16 -0
- package/lib/{rapi-access-e495e6e8.js.map → rapi-access-5a09b0fd.js.map} +1 -1
- package/lib/{roomle-sdk-05d11281.js → roomle-sdk-9f6cf255.js} +2 -2
- package/lib/roomle-sdk-9f6cf255.js.map +1 -0
- package/lib/roomle-sdk.nomodule.js +1 -1
- package/lib/static/ConfiguratorKernel-740d5afc47f4a393.js +1 -0
- package/lib/static/ConfiguratorKernel-740d5afc47f4a393.js.map +1 -0
- package/lib/static/ConfiguratorKernel-8338b6e04f42e1bb.wasm +0 -0
- package/lib/static/ConfiguratorKernelJs-05d7ca332e0afd5c.js +143 -0
- package/lib/static/ConfiguratorKernelJs-94d09444363eb9cc.mem +0 -0
- package/lib/static/{RoomleCore-c036b1e6afc8afc5.js → RoomleCore-5bf2453bcbe354c7.js} +1 -1
- package/lib/static/RoomleCore-5bf2453bcbe354c7.js.map +1 -0
- package/lib/static/RoomleCore-6d3b769c4ee59ce2.wasm +0 -0
- package/lib/static/RoomleCoreJs-6aaba29145bc7b7d.mem +0 -0
- package/lib/static/RoomleCoreJs-c7fc9ea60bea9da9.js +151 -0
- package/lib/static/shaders-404e545ed5c1f891.json +1 -0
- package/lib/{stats-helper-8524efea.nomodule.js → stats-helper-3717425f.nomodule.js} +2 -2
- package/lib/{stats-helper-8524efea.nomodule.js.map → stats-helper-3717425f.nomodule.js.map} +1 -1
- package/lib/{stats-helper-ffd1bff9.js → stats-helper-bd0bbcf7.js} +2 -2
- package/lib/{stats-helper-ffd1bff9.js.map → stats-helper-bd0bbcf7.js.map} +1 -1
- package/package.json +2 -2
- package/lib/component-dimensioning-22c684c5.nomodule.js.map +0 -1
- package/lib/component-dimensioning-c3e374eb.js.map +0 -1
- package/lib/configurator-main-61040002.js +0 -2
- package/lib/configurator-main-61040002.js.map +0 -1
- package/lib/configurator-mesh-generator-5b153bdd.nomodule.js +0 -2
- package/lib/configurator-mesh-generator-5b153bdd.nomodule.js.map +0 -1
- package/lib/configurator-mesh-generator-d945c432.js.map +0 -1
- package/lib/default-light-setting-0d73db9a.nomodule.js.map +0 -1
- package/lib/default-light-setting-68f26594.js.map +0 -1
- package/lib/glb-viewer-main-803f6c67.js +0 -2
- package/lib/glb-viewer-main-803f6c67.js.map +0 -1
- package/lib/legacy/component-dimensioning-30d883f2.legacy.js.map +0 -1
- package/lib/legacy/configurator-mesh-generator-1062fffa.legacy.js.map +0 -1
- package/lib/legacy/default-light-setting-684f437b.legacy.js.map +0 -1
- package/lib/legacy/material-viewer-004b210b.legacy.js.map +0 -1
- package/lib/legacy/mesh-generator-b8345f3e.legacy.js.map +0 -1
- package/lib/legacy/pixotron-b7f25843.legacy.js +0 -2
- package/lib/legacy/planner-7cf4e52a.legacy.js +0 -2
- package/lib/legacy/rapi-access-34b1ce17.legacy.js +0 -16
- package/lib/legacy/static/ConfiguratorKernel-7756e36b06f7bf28.wasm +0 -0
- package/lib/legacy/static/ConfiguratorKernelJs-79cc0493453b6298.mem +0 -0
- package/lib/legacy/static/ConfiguratorKernelJs-f63bcabaeb5c2d42.js +0 -143
- package/lib/legacy/static/RoomleCore-5f8e907bc2dc0222.wasm +0 -0
- package/lib/legacy/static/RoomleCoreJs-06aa24e348172ab6.mem +0 -0
- package/lib/legacy/static/RoomleCoreJs-c5865e6e3207c3f1.js +0 -151
- package/lib/legacy/static/shaders-fae3c3c610b4a3d8.json +0 -1
- package/lib/material-viewer-48033bdf.js.map +0 -1
- package/lib/material-viewer-543e6a18.nomodule.js.map +0 -1
- package/lib/material-viewer-main-fff0bfb8.js +0 -2
- package/lib/material-viewer-main-fff0bfb8.js.map +0 -1
- package/lib/mesh-generator-0840e6a4.nomodule.js.map +0 -1
- package/lib/mesh-generator-9fe4238a.js.map +0 -1
- package/lib/pixotron-42da5ecd.js +0 -2
- package/lib/pixotron-a91b119f.nomodule.js +0 -2
- package/lib/planner-77d66f6f.js +0 -2
- package/lib/planner-9ebb0e5a.nomodule.js +0 -2
- package/lib/planner-main-25450000.js +0 -2
- package/lib/planner-main-25450000.js.map +0 -1
- package/lib/rapi-access-47da54bc.nomodule.js +0 -16
- package/lib/rapi-access-e495e6e8.js +0 -16
- package/lib/roomle-sdk-05d11281.js.map +0 -1
- package/lib/static/ConfiguratorKernel-7756e36b06f7bf28.wasm +0 -0
- package/lib/static/ConfiguratorKernel-b3f9bde09ca9cb82.js +0 -1
- package/lib/static/ConfiguratorKernel-b3f9bde09ca9cb82.js.map +0 -1
- package/lib/static/ConfiguratorKernelJs-79cc0493453b6298.mem +0 -0
- package/lib/static/ConfiguratorKernelJs-f63bcabaeb5c2d42.js +0 -143
- package/lib/static/RoomleCore-5f8e907bc2dc0222.wasm +0 -0
- package/lib/static/RoomleCore-c036b1e6afc8afc5.js.map +0 -1
- package/lib/static/RoomleCoreJs-06aa24e348172ab6.mem +0 -0
- package/lib/static/RoomleCoreJs-c5865e6e3207c3f1.js +0 -151
- package/lib/static/shaders-fae3c3c610b4a3d8.json +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./query-params-helper-8c00a872.legacy.js","./rapi-access-34b1ce17.legacy.js","./main-thread-to-worker-fb98950d.legacy.js"],(function(t,e){var i,s,a,n,o,r,h,_,d,l,c,u,m,g,p,w,E,y,v,P,S,x,b,f,C,T,R,M;return{setters:[function(t){i=t.g},function(t){s=t.r,a=t.B,n=t.I,o=t._,r=t.i,h=t.t,_=t.s,d=t.u,l=t.v,c=t.w,u=t.x,m=t.y,g=t.z,p=t.F,w=t.G,E=t.H,y=t.J,v=t.K,P=t.M,S=t.d,x=t.D,b=t.R,f=t.N},function(t){C=t.a,T=t.g,R=t.h,M=t.i}],execute:function(){t("T","static/Tween-d024b02fe34f25ab.js"),t("M",class{constructor(t){this._context=t||s.getContext(this.getContextName()),a.start("loadingTime")}_setupCommonGlobals(){window.__RML__DEBUG__||(window.__RML__DEBUG__={}),window.__RML__ENV__||(window.__RML__ENV__={},window.__RML__ENV__.assetPath||(window.__RML__ENV__.assetPath=""))}_setupCommonDependencies(){s.setup(n);const t=i();this.lookup("global-init-data").setOverrides(t),this.lookup("init-data",this._context).setOverrides(t)}_cleanUpCommonGlobals(){window.__RML__DEBUG__&&(window.__RML__DEBUG__.Kernel&&window.__RML__DEBUG__.Kernel.clearAll&&window.__RML__DEBUG__.Kernel.clearAll(),delete window.__RML__DEBUG__),delete window.__RML__ENV__;for(const t in window.THREE)if(window.THREE.hasOwnProperty(t))try{delete window.THREE[t]}catch(t){console.error(t)}window.THREE=void 0}_cleanUpCommonDependencies(){}boot(t){this._setupCommonGlobals(),this._setupCommonDependencies(),this.setupGlobals(t),this.setupDependencies(),this.bootFinished()}lookup(t,e){return window.__RML__DI__.lookup(t,e)}teardown(){this.cleanUpDependencies(),this._cleanUpCommonDependencies(),this.cleanUpGlobals(),this._cleanUpCommonGlobals(),window.__RML__DI__&&delete window.__RML__DI__}pause(){this.lookup("life-cycle-manager",this._context).pause(),window.TWEEN&&TWEEN.removeAll()}resume(t){t&&this.lookup("dom-helper",this._context).setDomElement(t),this.lookup("life-cycle-manager",this._context).resume()}destroy(){this.pause(),this.lookup("life-cycle-manager",this._context).destroy(),s.cleanUp(this._context)}getRapiAccess(){return this.lookup("rapi-access",this._context)}});class A{constructor(){this._listeners={}}_addEventListener(t,e,i){this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push({callback:e,scope:i})}addEventListener(t,e,i){this._addEventListener(t,e,i)}dispatchEvent(t,e){if(!this._listeners[t])return;const i=this._listeners[t];let s=i.length;for(let t=0;t<s;t++){const s=i[t];e?s.callback.apply(s.scope,[e]):s.callback.call(s.scope)}}removeEventListener(t,e){const i=this._listeners[t];if(i)for(let t=0,s=i.length;t<s;t++)if(i[t].callback===e)return void i.splice(t,1)}}t("E",A);const H=t("g",10);let k=t("c",(()=>{class t extends A{constructor(t,e,i){if(super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._pitch=h(H),this._yaw=h(-30),this._distance=-1,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=t,this._inputManager=e,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new THREE.Vector3,this._targetPosition=new THREE.Vector3,i?this._cameraPosition.copy(i):this._cameraPosition=new THREE.Vector3(0,.5,3),this._initData.debug){const t=this.getDebugCameraPosition();t&&this._setCurrentCameraParameters(t)}let s=this._domHelper.getClientDimensions();this._width=s.x,this._height=s.y,this._dispatchCameraIdle=C(this._dispatchCameraIdle.bind(this),16)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(t=>{this._inputManager.addEventListener(t.key,t.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(t=>{this._inputManager.removeEventListener(t.key,t.fun)}),this._inputListeners=[]}cleanUp(){this._removeInputListeners()}animateCamera(t){let e=this._cameraPosition;if(!e||_(e,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,this._dispatchCameraIdle(),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,3),this._cameraStandingStill=!1,this._lerpEnabled&&!this._tweenEnd){let i=this.getCamera().position.clone();const s=Math.min(10*t,1);i.lerp(e,s),this.getCamera().position.copy(i)}else this.getCamera().position.copy(e);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)}_areEqual(t,e){return t.yaw.toFixed(5)===e.yaw.toFixed(5)&&t.pitch.toFixed(5)===e.pitch.toFixed(5)&&t.distance.toFixed(5)===e.distance.toFixed(5)&&t.targetX===e.targetX&&t.targetY===e.targetY&&t.targetZ===e.targetZ}_tweenCameraParameter(t,e,i){return new Promise(i=>{if(e.yaw-t.yaw<=-Math.PI?t.yaw-=2*Math.PI:e.yaw-t.yaw>=Math.PI&&(t.yaw+=2*Math.PI),window.TWEEN){if(null!==this._tweenEnd&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=e,new TWEEN.Tween(t).to(e,400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,3),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._setCameraNear(),this._update(new THREE.Vector3(t.targetX,t.targetY,t.targetZ))}).onComplete(()=>{this.dispatchEvent(2,3),this._tweenEnd=null,i()}).start(),this.dispatchEvent(0,3)}})}_setCameraNear(){const t=this.getCamera();if(t instanceof THREE.PerspectiveCamera){const e=Math.max(.1,this._distance/6);t.near=e}}_getCurrentCameraParameters(){const t=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:t.x,targetY:t.y,targetZ:t.z}}_setCurrentCameraParameters(t){this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._targetPosition.copy(new THREE.Vector3(t.targetX,t.targetY,t.targetZ))}_rotateHorizontal(t){this._yaw-=t,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(t){this._pitch+=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(t){if(t||!this._stateSaved){let t=this._yaw,e=this._pitch,i=this._distance,s=this._targetPosition.clone();if(this._stateSaved={yaw:t,pitch:e,distance:i,targetX:s.x,targetY:s.y,targetZ:s.z,blockOtherTweens:!0},this._getCamera().fov){let t=this._getCamera();this._stateSaved.fov=t.fov,this._stateSaved.near=t.near,this._stateSaved.far=t.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;let t=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:t.x,targetY:t.y,targetZ:t.z},this._stateSaved,!0)}this._stateSaved=null}setToState(t,e){this._tweenCameraParameter(t,e,!0)}hasSavedState(){return null!=this._stateSaved}lock(){this._locked=!0}unlock(){this._locked=!1}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(t){const{x:e,y:i}=this._domHelper.getClientDimensions();return new THREE.Vector3(t.x/e*2-1,-t.y/i*2+1,.5)}addLightContainer(t){t.name="lights";const e=this._getCamera(),i=e.children.find(t=>"lights"===t.name);i&&e.remove(i),e.add(t)}checkNearFarDistance(t){if(!t)return;const e=this._cameraPosition.distanceTo(t),i=this._getCamera();i instanceof THREE.PerspectiveCamera&&e>i.far&&(i.far=e+1)}}return o([r],t.prototype,"_domHelper",void 0),o([r],t.prototype,"_initData",void 0),t})());class L{constructor(t,e){this.minZoom=!1,this.maxZoom=!1,this.minZoom=t,this.maxZoom=e}}class D extends k{constructor(t,e,i,s){super(t,e,i),this._bounds=new THREE.Vector3,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,3),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=h(0),this.maxPolarAngle=h(85),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,s?this._camera=s:this._initCamera(),this._targetPosition||(this._targetPosition=new THREE.Vector3(0,0,0));const{cameraRestriction:a,zoomDistance:n,minVerticalCameraAngle:o,maxVerticalCameraAngle:r,minHorizontalCameraAngle:_,maxHorizontalCameraAngle:d}=this._initData;if(n&&(this._zoomDistance=n/100),void 0!==o&&(this.minPolarAngle=h(o<0?o:-1*o)),void 0!==r&&(this.maxPolarAngle=h(r)),void 0!==_&&(this.minAzimuthAngle=h(_<0?_:-1*_)),void 0!==d&&(this.maxAzimuthAngle=h(d)),void 0!==a){let t=Math.abs(h(a));this.minAzimuthAngle=-t,this.maxAzimuthAngle=t,this.maxPolarAngle=Math.min(t,h(85))}this._update()}_getCamera(){return this._camera||this._initCamera(),this._camera}_initCamera(){this._camera=new THREE.PerspectiveCamera,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(5),this._camera.layers.enable(4)}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions();this._camera.aspect=t/e,this._camera.updateProjectionMatrix()}animateCamera(t){if(!super.animateCamera(t))return!1;let e=this._targetPosition;return!!e&&(this.getCamera().lookAt(e),!0)}_initInputListener(){this._inputListeners.push({key:3,fun:()=>{this._state=1}}),this._inputListeners.push({key:6,fun:t=>{var e,i;1!==this._state||this._locked||(this._userInteraction=!0,!(void 0!==(null===(e=t.event)||void 0===e?void 0:e.shiftKey)&&(null===(i=t.event)||void 0===i?void 0:i.shiftKey))&&this._panningEnabled&&this.disablePanning(),this._move(new THREE.Vector2(t.position.x,t.position.y),t.type))}}),this._inputListeners.push({key:11,fun:t=>{1===this._state||this._locked||(this._userInteraction=!0,this._pan(new THREE.Vector2(t.position.x,t.position.y),t.type))}}),this._inputListeners.push({key:4,fun:t=>{1===this._state&&this.dispatchEvent(2,t.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:7,fun:({event:t})=>{this._maxZoomedIn||(t&&(t.preventDefault(),t.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:8,fun:({event:t})=>{this._maxZoomedOut||(t&&(t.preventDefault(),t.stopPropagation()),this.zoomOut())}})}_panTargetPosition(t){const e=t.clone().sub(this._orbitPosition),i=this._domHelper.element,s=this._targetPosition.project(this._camera),a=Math.max(2,4*(1-this._distance/this.maxDistance));s.x=s.x-e.x/i.clientHeight*a,s.y=s.y+e.y/i.clientHeight*a,this._targetPosition.copy(s.unproject(this._camera))}_pan(t,e){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new THREE.Vector2(t.x,t.y),this.dispatchEvent(0,e)),this._panTargetPosition(t),d(this._orbitPosition,t)||this.dispatchEvent(1,e),this._orbitPosition.copy(t),this._update()}_move(t,e){this._orbitPosition||(this._orbitPosition=new THREE.Vector2(t.x,t.y),this.dispatchEvent(0,e));const i=t.clone().sub(this._orbitPosition),s=this._domHelper.element;this._panningEnabled?this._panTargetPosition(t):(this._rotateHorizontal(2*Math.PI*i.x/s.clientWidth*1),this._rotateVertical(2*Math.PI*i.y/s.clientHeight*1)),d(this._orbitPosition,t)||this.dispatchEvent(1,e),this._orbitPosition.copy(t),this._update()}setBounds(t){this._boundingBox=t}zoomToFitBounds(t){this.setBounds(t);const e=t.getSize(new THREE.Vector3);if(this._initData.debug||e.x+e.y+e.z===0)return;const i=this._getCurrentCameraParameters(),s=t.getCenter(new THREE.Vector3),a=this._setDistanceAndRangesBasedOnBounds(e);this._checkZoomDistance(t,a),this._tweenCameraParameter(i,{yaw:this._yaw,pitch:this._pitch,distance:a,targetX:s.x,targetY:s.y,targetZ:s.z},!1)}updateToBounds(t,e,i=!0,s){if(this.setBounds(t),this._initData.debug)return;const a=t.getCenter(new THREE.Vector3);this._targetPosition=s?s.clone():new THREE.Vector3(a.x,a.y,a.z);const n=this._getCurrentCameraParameters(),o=t.getSize(new THREE.Vector3);if(i){const i=this._setDistanceAndRangesBasedOnBounds(o);this._distance=i,this._checkZoomDistance(t,i),this._userInteraction?this._tweenCameraParameter(n,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},e):this._update()}else this._setDistanceAndRangesBasedOnBounds(o,!1);this._update()}_checkZoomDistance(t,e){const i=t.getBoundingSphere(new THREE.Sphere);e-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=e-i.radius)}_setDistanceAndRangesBasedOnBounds(t,e=!0){const i=this._domHelper.getClientDimensions(),s=i.x,a=i.y,n=this._camera.offset?s-s*this._camera.offset.left-s*(1-this._camera.offset.right):s,o=this._camera.offset?a-a*this._camera.offset.bottom-a*(1-this._camera.offset.top):a;this._bounds.copy(t);const{cameraSpacing:r}=this._initData;t.addScalar(r/100),this.minDistance=Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z);const h=Math.max(t.x,t.y),{x:_,y:d}=this._getMargin(n,o),c=l(t.x+_,t.y+d,t.z,this._camera.fov,n,o);return this._distance<c&&e&&(this._distance=c),this.maxDistance=c+h,this.maxDistance<2&&(this.maxDistance=2),this._camera.far=5*this.maxDistance,this._setCameraNear(),c}_getMargin(t,e){let i=this._bounds.x/2,s=this._bounds.y/2;return t>1080&&(i+=this._bounds.x<.3?.2:0,i+=this._bounds.x*(t/1080-1)),e>1080&&(i+=this._bounds.y<.3?.2:0,s+=this._bounds.y*(e/1080-1)),{x:i,y:s}}reset(t,e,i,s,a=!0){const n=t.getSize(new THREE.Vector3);if(n){if(e)this._targetPosition.copy(e);else{const e=t.getCenter(new THREE.Vector3);this._targetPosition.copy(e)}const o=this._getCurrentCameraParameters();if(i||(i=-30),s||(s=H),this._pitch=h(s),this._yaw=h(i),this._initData.debug)return this._distance=this._setDistanceAndRangesBasedOnBounds(n),this._update(this._targetPosition),void this._setDistanceAndRangesBasedOnBounds(n);this._setDistanceAndRangesBasedOnBounds(n);let r=this._targetPosition.clone();a?this._tweenCameraParameter(o,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:r.x,targetY:r.y,targetZ:r.z},!0):this._update(this._targetPosition)}else console.warn("you cant reset without bounds!")}updateAndReset(t,e,i,s,a,n=!0){const o=new THREE.Vector3(-t.x/2,0,-t.z/2),r=new THREE.Vector3(t.x/2,t.y,t.z/2);if(this._boundingBox=new THREE.Box3(o,r),a&&t.addScalar(a),e?this._targetPosition.copy(e):this._targetPosition=new THREE.Vector3(0,t.y/2,0),-1===this._distance){const e=this._setDistanceAndRangesBasedOnBounds(t);this._distance=Math.max(2,e)}const _=this._getCurrentCameraParameters();i||(i=-30),s||(s=H),this._pitch=h(s),this._yaw=h(i),this._setDistanceAndRangesBasedOnBounds(t);let d=this._targetPosition.clone();n?this._tweenCameraParameter(_,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:d.x,targetY:d.y,targetZ:d.z},!0):this._update(this._targetPosition)}_update(t){this._initData.debug?this._pitch=Math.max(h(-89),Math.min(h(89),this._pitch)):(this._yaw=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this._yaw)),this._pitch=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._pitch))),this._saveYawAndPitch();const e=new THREE.Euler(-this._pitch,this._yaw,0,"ZYX"),i=(new THREE.Quaternion).setFromEuler(e),s=new THREE.Vector3(0,0,-1);s.applyQuaternion(i),this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance)),t&&this._targetPosition.copy(t);const a=this._targetPosition.clone().sub(s.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(a),this._zoomChanged(!1,!1);else{const t=this._getCameraSphere(a);null!=this._boundingBox&&this._boundingBox.intersectsSphere(t)&&this._scale>=1?this._distance+=.1:null==this._boundingBox||this._boundingBox.intersectsSphere(t)?this._zoomChanged(!1,!0):(this._cameraPosition.copy(a),this._distance===this.maxDistance?this._zoomChanged(!0,!1):this._zoomChanged(!1,!1))}this._scale=1}_zoomChanged(t,e){let i=t+""+e;0!==this._currentZoomHash.length&&this._currentZoomHash===i||(this.dispatchEvent(5,new L(t,e)),this._currentZoomHash=i),this._maxZoomedIn=e,this._maxZoomedOut=t}zoomTo(t,e,i,s,a,n){return this._tweenCameraParameter(this._getCurrentCameraParameters(),{yaw:s,pitch:a,distance:2.725*l(t.x,t.y,t.z,this._camera.fov,e,i),targetX:n.x,targetY:n.y,targetZ:n.z,blockOtherTweens:!0},!0)}_getCameraSphere(t){const e=Math.max(this._bounds.x,this._bounds.y),i=Math.max(e/10,this._zoomDistance);return new THREE.Sphere(t,i)}zoomIn(t){this._lerpEnabled=!0,this._scale*=t?Math.pow(.95,t):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(3)}zoomOut(t){this._lerpEnabled=!0,this._scale/=t?Math.pow(.95,t):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(4)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=-1,this._targetPosition=new THREE.Vector3(0,0,0))}async moveCamera(t){return this._tweenCameraParameter(this._getCurrentCameraParameters(),t,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}}t("C",D);let z={},O={};t("b",(()=>{class t{constructor(t){this._creator_=t}fetch(t,e){return this._singlePromiseFactory.create(5,t,(i,s)=>{!function(t,e,i,s){if(-1===t.indexOf("http")&&(t=T()+t),z[t])return i();if(e.id&&O[e.id])return s(new Error('There is already a script with ID "'+e.id+'"'));const n=a.start("load_"+e.id.replace(/-/g,"_")),o=document.createElement("script");o.async=!1,o.src=t,o.id=e.id,o.onload=()=>{z[t]=!0,O[e.id]=!0,a.end(n),Object.defineProperty(i,"name",{value:"resolve-"+e.id}),i()},o.onerror=t=>{s(t)},document.body.appendChild(o)}(t,e,i,s)})}loadScripts(t){const e=[];return t.forEach(t=>{let i=this.fetch(t.name,{id:t.id});e.push(i)}),Promise.all(e)}cleanUp(){for(let t in O)if(O.hasOwnProperty(t)){const e=document.getElementById(t);e&&e.parentElement.removeChild(e)}z={},O={}}}return o([r],t.prototype,"_singlePromiseFactory",void 0),t})());const I={MOUSE_MOVE:"mousemove",MOUSE_DOWN:"mousedown",MOUSE_UP:"mouseup",MOUSE_LEAVE:"mouseleave",MOUSE_ENTER:"mouseenter",MOUSE_WHEEL:"wheel",TOUCH_MOVE:"touchmove",TOUCH_START:"touchstart",TOUCH_END:"touchend",CONTEXT_MENU:"contextmenu"};class B{constructor(t,e,i,s,a){this.position=t,this.positionRelative=e,this.type=i,this.rotation=s,this.event=a}}const U=5*window.devicePixelRatio,Q=3*window.devicePixelRatio;t("I",(()=>{class t extends A{constructor(t){super(),this._debug=!1,this._elementHit=!1,this._delta=-1,this._state=0,this._pinchDistance=-1,this._rotationAngle=-1,this._lastMouseWheelEvent=null,this._lastTouchEvent=null,this._events=Object.keys(I).map(t=>I[t]),this._creator_=t,this._downPosition={x:0,y:0},this._downPositionRelative={x:0,y:0},this._boundingClientRect=this._domHelper.element.getBoundingClientRect()}enableDragIn(t){this._setState(1),this._dragEnabled=!0,t&&(this._dragMV=this._dragM.bind(this),this._dragEV=this._dragE.bind(this),this._dragTarget=t.currentTarget||t.target,this._delta=-1,this._dragMVName="drag",this._dragEVName="dragend",window.TouchEvent&&t instanceof TouchEvent?(this._dragMVName="touchmove",this._dragEVName="touchend"):t.dataTransfer&&t.dataTransfer.setData&&t.dataTransfer.setData("text/plain"," "),this._firefoxDragPosition={x:0,y:0},document.ondragover=t=>{t=t||window.event,this._firefoxDragPosition.x=t.pageX,this._firefoxDragPosition.y=t.pageY},this._dragTarget.addEventListener(this._dragMVName,this._dragMV,!1),this._dragTarget.addEventListener(this._dragEVName,this._dragEV,!1))}_dragM(t){let e=t,i=null,s=null;window.TouchEvent&&t instanceof TouchEvent?(i=this._getTouchPosition(e),s=this._getTouchPositionRelative(e)):(i=this._getMousePosition(e),s=this._getMousePositionRelative(e)),i.x>0&&i.y>0&&this._move(i,s)}_dragE(t){let e=t;document.ondragover=null,this._firefoxDragPosition=null,this._dragTarget.removeEventListener(this._dragMVName,this._dragMV),this._dragTarget.removeEventListener(this._dragEVName,this._dragEV),window.TouchEvent&&t instanceof TouchEvent?this._onUp(this._getTouchPosition(e),this._getTouchPositionRelative(e),2):this._onUp(this._getMousePosition(e),this._getMousePositionRelative(e),1)}addEvents(t){this._events.forEach(e=>t.addEventListener(e,this,!1))}removeEvents(t){this._events.forEach(e=>t.removeEventListener(e,this,!1))}_move2(t){if(this._lastTouchEvent&&t.timeStamp-this._lastTouchEvent.timeStamp<16)return;const e=t.touches[0],i=t.touches[1],s=e.pageX-i.pageX,a=e.pageY-i.pageY,n=Math.abs(s)+Math.abs(a);this._pinchDistance>-1&&(n>this._pinchDistance+Q?(this._setState(3),this.dispatchEvent(7,new B(this._getTouchPosition(t),this._getTouchPositionRelative(t)))):n<this._pinchDistance-Q?(this._setState(3),this.dispatchEvent(8,new B(this._getTouchPosition(t),this._getTouchPositionRelative(t)))):n<=this._pinchDistance+Q&&n>=this._pinchDistance-Q&&(this._setState(5),this.dispatchEvent(11,new B(this._getTouchPosition(t),this._getTouchPositionRelative(t))))),this._pinchDistance=n,this._lastTouchEvent=t}_setState(t){this._state=t}_move(t,e,i,s){void 0===i&&(i=0),void 0===this._dragEnabled&&(this._dragEnabled=!1),1===this._state&&this._canDrag(i)&&(this._delta=this._getDelta(t),this._delta>U&&(this._setState(2),this._longClickTimer&&clearTimeout(this._longClickTimer),this.dispatchEvent(0,new B(t,e)))),2===this._state&&this.dispatchEvent(1,new B(t,e)),this._longClickTimer&&clearTimeout(this._longClickTimer),this.dispatchEvent(6,new B(t,e,i,null,s))}_longClick(){this._setState(2),this._longClickTimer&&clearTimeout(this._longClickTimer),this.dispatchEvent(0,new B(this._downPosition,this._downPositionRelative)),this.dispatchEvent(1,new B(this._downPosition,this._downPositionRelative))}_onUp(t,e,i){this.dispatchEvent(4,new B(t,e,i)),this._getDelta(t)<=U&&this.dispatchEvent(5,new B(t,e)),2===this._state&&this.dispatchEvent(2,new B(t,e)),4===this._state&&(this.dispatchEvent(10,new B(t,e)),this._rotationAngle=-1),3===this._state&&(this._pinchDistance=-1),this._lastTouchEvent=null,this._setState(0),this._dragTarget=null,this._elementHit=!1,this._longClickTimer&&clearTimeout(this._longClickTimer)}_getTouchPosition(t){if(t.touches.length){let{clientX:e,clientY:i}=t.touches[0];if(t.touches.length>1){const s=t.touches[1],a=s.clientX,n=s.clientY;e=(e+a)/2,i=(i+n)/2}return{x:e,y:i}}const e=t.changedTouches[0];return{x:e.clientX,y:e.clientY}}_getTouchPositionRelative(t){const e=this._boundingClientRect,{clientWidth:i,clientHeight:s}=this._domHelper.element;if(t.touches.length){const{clientX:a,clientY:n}=t.touches[0];return{x:(a-e.left)/i*2-1,y:-(n-e.top)/s*2+1}}const a=t.changedTouches[0];return{x:(a.clientX-e.left)/i*2-1,y:-(a.clientY-e.top)/s*2+1}}_getMousePosition(t){if(0!==t.clientX&&0!==t.clientY)return{x:t.clientX,y:t.clientY};{let{x:e,y:i}=this._getFireFoxMousePosition(t);return{x:e,y:i}}}_getFireFoxMousePosition(t){let{x:e,y:i}=this._domHelper.getClientDimensions();return{x:e-(e+t.offsetX),y:i-(i+t.offsetY)}}_getMousePositionRelative(t){const e=this._boundingClientRect;return 0!==t.clientX&&0!==t.clientY?{x:(t.clientX-e.left)/this._domHelper.element.clientWidth*2-1,y:-(t.clientY-e.top)/this._domHelper.element.clientHeight*2+1}:this._firefoxDragPosition&&0!==this._firefoxDragPosition.x&&0!==this._firefoxDragPosition.y?{x:(this._firefoxDragPosition.x-e.left)/this._domHelper.element.clientWidth*2-1,y:-(this._firefoxDragPosition.y-e.top)/this._domHelper.element.clientHeight*2+1}:(console.trace("this should not happen"),{x:0,y:0})}_getDelta(t){return Math.abs(this._downPosition.y-t.y)+Math.abs(this._downPosition.x-t.x)}setDragEnabled(t){this._dragEnabled=t}handleEvent(t){switch(this._debug&&t.type,t.type){case I.MOUSE_MOVE:this._onMouseMove(t);break;case I.MOUSE_DOWN:this._onMouseDown(t);break;case I.MOUSE_UP:this._onMouseUp(t);break;case I.MOUSE_LEAVE:this._onMouseLeave(t);break;case I.MOUSE_ENTER:this._onMouseEnter(t);break;case I.MOUSE_WHEEL:this._onMouseWheel(t);break;case I.TOUCH_MOVE:this._onTouchMove(t);break;case I.TOUCH_START:this._onTouchStart(t);break;case I.TOUCH_END:this._onTouchEnd(t);break;case I.CONTEXT_MENU:this._onContextMenu(t)}}_onMouseDown(t){t.preventDefault();let{x:e,y:i}=this._getMousePosition(t);this._downPosition={x:e,y:i},this._downPositionRelative=this._getMousePositionRelative(t),this.dispatchEvent(3,new B({x:e,y:i},this._downPositionRelative,1)),this._setState(1)}_onMouseUp(t){t.preventDefault(),this._onUp(this._getMousePosition(t),this._getMousePositionRelative(t),1)}_onMouseMove(t){t.preventDefault(),this._move(this._getMousePosition(t),this._getMousePositionRelative(t),1,t)}_onMouseLeave(t){this._delta=-1,this._onMouseUp(t)}_onMouseEnter(t){t.preventDefault()}_onMouseWheel(t){if(this._lastMouseWheelEvent&&t.timeStamp-this._lastMouseWheelEvent.timeStamp<40)return t.preventDefault(),void t.stopPropagation();t.deltaY<0?this.dispatchEvent(7,new B(this._getMousePosition(t),this._getMousePositionRelative(t),1,0,t)):this.dispatchEvent(8,new B(this._getMousePosition(t),this._getMousePositionRelative(t),1,0,t)),this._lastMouseWheelEvent=t}_onTouchMove(t){if(t.preventDefault(),!this._dragTarget)if(1===t.touches.length)this._move(this._getTouchPosition(t),this._getTouchPositionRelative(t),2);else if(2===t.touches.length)if(this._elementHit||4===this._state){const e=t.touches[0],i=t.touches[1];let s={x:e.pageX,y:e.pageY},a={x:i.pageX,y:i.pageY};const n=c(u(s,a));this._rotationAngle<0&&(this._rotationAngle=n);const o=n-this._rotationAngle;this._rotationAngle=n,this.dispatchEvent(9,new B(this._getTouchPosition(t),this._getTouchPositionRelative(t),2,h(o))),this._setState(4)}else this._move2(t)}_onTouchStart(t){if(t.preventDefault(),1===t.touches.length){let{x:e,y:i}=this._getTouchPosition(t);this._downPosition={x:e,y:i},this._downPositionRelative=this._getTouchPositionRelative(t),this.dispatchEvent(3,new B({x:e,y:i},this._downPositionRelative,2)),this._setState(1),this._longClickTimer=window.setTimeout(this._longClick.bind(this),350)}else 2===t.touches.length&&(1!==this._state&&2!==this._state||this._onUp(this._getTouchPosition(t),this._getTouchPositionRelative(t),2),this._setState(3))}_onTouchEnd(t){t.preventDefault(),t.touches.length>1&&5===this._state||3===this._state||this._onUp(this._getTouchPosition(t),this._getTouchPositionRelative(t),2)}_onContextMenu(t){t.preventDefault()}_canDrag(t){return this._dragEnabled}onElementHit(){this._elementHit=!0}updateSize(){this._boundingClientRect=this._domHelper.element.getBoundingClientRect()}}return o([r],t.prototype,"_domHelper",void 0),t})());class V{constructor(t,e){this._scene=t,e&&e.removeFromScene()}needsBounds(){return!1}updateBounds(t){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new THREE.Object3D),this._cameraContainer}}t("L",V);const F={enable:!0,shadowMapResolution:512,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4,bShadowMaterial:!0,falloff:1.5,darkness:.2,size:1.6,lightSolidAngle:40,yPosition:0};class N extends class{constructor(t,e){this._scene=t,e&&(e.removeFromScene(),e.cleanUp())}updateCamera(t){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(t,e){this._bounds=t}cleanUp(){this._scene=null}}{constructor(t,e){super(t,e),this._pixotronGuard=new m,this._params=Object.assign(F,{lightDirection:new THREE.Vector3(0,1,.5),onComplete:this._addGroundShadows.bind(this),onProgress:this._progressCallback.bind(this)})}_progressCallback(t){}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}setPixotron(t,e,i,s){t&&(this._pixotron=t,this._renderer=e,this._camera=i,this._shadowBaker||(this._shadowBaker=new window.PIXOTRON.PlaneShadowBakePass(Object.assign(this._params,s))),this._shadowBaker.enable?this._shadowBaker.startBake(this._renderer,this._scene,this._camera):this._shadowBaker.enable=!0,this._wasAAEnabled=this._pixotron.enableAA,this._pixotronGuard.resolve())}async _addGroundShadows(){await this._pixotronGuard.wait(),this._pixotron.needsUpdate=!0,this._shadowPlane=this._shadowBaker.getShadowPlane(),this._shadowPlane.name="Shadow plane",this._shadowPlane.receiveShadow=!1,0!==this._params.yPosition&&(this._shadowPlane.position.y=this._params.yPosition),this._shadowPlane.visible=!0,this.addToScene(),this._loadedCallback&&this._loadedCallback()}setLoadedCallback(t){this._loadedCallback=t}update(){const t=this._getNumberOfChildren();this._bake(),this._sceneChildren=t}updateBounds(t,e){const i=this._getNumberOfChildren();return!(g(this._bounds,t,1e-4)&&this._scene&&i===this._sceneChildren&&!e||(super.updateBounds(t),this._bake(),this._sceneChildren=i,0))}_bake(){this._pixotronGuard.wait().then(()=>{this._shadowPlane&&(this._shadowPlane.visible=!1),this._shadowBaker.startBake(this._renderer,this._scene,this._camera)})}_getNumberOfChildren(){let t=0;return this._scene.traverse(e=>{"Shadow plane"!==e.name&&t++}),t}addToScene(){this._scene&&this._shadowPlane&&(this._shadowPlane.material.needsUpdate=!0,p(this._shadowPlane),this._scene.add(this._shadowPlane))}removeFromScene(){this._shadowPlane&&(this._scene.remove(this._shadowPlane),this._pixotron&&(this._pixotron.enableAA=this._wasAAEnabled))}showGUI(){}}t("B",N);class G{constructor(t){this._innerSize=1,this._outerSize=100,this._plane=new THREE.Object3D,this._plane.rotation.x=-Math.PI/2;const e=new THREE.MeshStandardMaterial;this._innerPlaneMesh=new THREE.Mesh,this._innerPlaneMesh.layers.set(2),this._innerPlaneMesh.material=e,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new THREE.Mesh,this._outerPlaneMesh.layers.set(2),this._outerPlaneMesh.material=e,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=t,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(t){this._innerSize=t,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(t,e){const i=new THREE.Shape;i.moveTo(-t/2,-t/2),i.lineTo(-t/2,t/2),i.lineTo(t/2,t/2),i.lineTo(t/2,-t/2),i.lineTo(-t/2,-t/2);const s=new THREE.Shape;s.moveTo(-e/2,-e/2),s.lineTo(-e/2,e/2),s.lineTo(e/2,e/2),s.lineTo(e/2,-e/2),s.lineTo(-e/2,-e/2);const a=new THREE.Path;a.moveTo(-t/2,-t/2),a.lineTo(-t/2,t/2),a.lineTo(t/2,t/2),a.lineTo(t/2,-t/2),a.lineTo(-t/2,-t/2),s.holes.push(a);const n=new THREE.ShapeBufferGeometry(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=n;const o=new THREE.ShapeBufferGeometry(s);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=o;const r=n.attributes.uv.clone();n.setAttribute("uv2",r);const h=n.attributes.uv2.array;for(let t=0;t<h.length;++t)h[t]+=.5}}let j=t("F",(()=>{class t extends N{constructor(t,e,i){super(t,e),this._longestSide=2,this._bakedShadowPlane=new G(100),this._fog=i||!1,this._textureLoader=new THREE.TextureLoader,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(t){return super.updateBounds(t),this._longestSide=Math.max(t.x,t.z),this._update(),!0}updateCamera(t){this._cameraDistance=t.position.distanceTo(new THREE.Vector3(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let t=this._longestSide/2;this._scene.fog=new THREE.Fog(16185078,this._cameraDistance+t+3,this._cameraDistance+t+3+1),this._scene.background=new THREE.Color(16185078)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let t=this._width/1e3,e=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=THREE.RepeatWrapping,this._floorTexture.wrapT=THREE.RepeatWrapping,this._floorTexture.repeat.set(100/t,100/e));let i=new THREE.MeshStandardMaterial({map:this._floorTexture,side:THREE.DoubleSide});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&(this._shadowPlane&&(this._bakedShadowPlane.updateSize(this._shadowPlane.scale.x),this._bakedShadowPlane.getRootNode().position.copy(this._shadowPlane.position),this._bakedShadowPlane.getInnerPlane().material.aoMap=this._shadowPlane.material.aoMap),this._scene.add(this._bakedShadowPlane.getRootNode()))}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(t,e,i,s){return this._width=e,this._height=i,this._repeatable=s,this._floorPromise=new Promise((e,i)=>{this._textureLoader.load(t,t=>{this._floorTexture=t,e()},null,i)}),new Promise((t,e)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),t()},e)})}changeFloorMaterial(t,e){this._floorPromise=new Promise((i,s)=>{this._floorMaterial=w(t,this._environmentLoader),this._rapiAccess.getTexturesOf(t).then(t=>{if(t.length>0){let a=[];t.forEach(t=>{a.push(E(this._dataSyncer.requestAsset(t.image,!0),t,this._floorMaterial,e,1,1))}),Promise.all(a).then(()=>{setTimeout(()=>i(),0)},s)}else setTimeout(()=>i(),0)})});let i=[this._floorPromise];return new Promise((t,e)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),t()},e)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let t=y();if(!t)return;let e=t.addFolder("Floor");e.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),e.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),e.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),e.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),e.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),e.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),e.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}return o([r],t.prototype,"_rapiAccess",void 0),o([r],t.prototype,"_dataSyncer",void 0),o([r],t.prototype,"_environmentLoader",void 0),t})());class W extends N{constructor(t,e,i,s,a){if(super(t,e),this._color=i,this._oldBackground=t.background,s&&a){this._canvas=s,this._style=document.createElement("style");let t='background-image: url("'+a+'"); background-size: cover;';this._style.innerText=".rml-scene-background {"+t+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){super.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"),this._pixotron&&(this._pixotron.enableAA=!1))}removeFromScene(){super.removeFromScene(),this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove("rml-scene-background")}}t("a",W);class X extends k{constructor(t,e,i){super(t,e,i),this._scale=1,this._state=0,this._size=20,this._center=new THREE.Vector3,this._raycaster=new THREE.Raycaster,this._lastPosition=new THREE.Vector2,this._zoomPosition=new THREE.Vector3,this._lastZoom=0,this._zoomSpeed=Math.pow(.95,2),this._cameraZoom=1,this._initCamera(i||new THREE.Vector3(0,10,0));let s=new THREE.PlaneGeometry(1e3,1e3);s.rotateX(-Math.PI/2),this._plane=new THREE.Mesh(s,new THREE.MeshStandardMaterial)}_getCamera(){return this._camera||this._initCamera(new THREE.Vector3(0,10,0)),this._camera}_initCamera(t){let{x:e,y:i}=this._domHelper.getClientDimensions(),s=e/i*this._size,a=this._size;this._camera=new THREE.OrthographicCamera(s/-2,s/2,a/2,a/-2,1,1e3),this._camera.position.copy(t),this._cameraPosition=t,this._camera.lookAt(new THREE.Vector3(0,0,0))}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions(),i=t/e*this._size,s=this._size;this._camera.left=i/-2,this._camera.right=i/2,this._camera.top=s/2,this._camera.bottom=s/-2,this._camera.updateProjectionMatrix()}_initInputListener(){this._inputListeners.push({key:3,fun:t=>{this._locked||(this._state=1,this._lastPosition.set(t.position.x,t.position.y),this.dispatchEvent(0))}}),this._inputListeners.push({key:6,fun:t=>{1!==this._state||this._locked||(this._move(new THREE.Vector2(t.position.x,t.position.y),t.type),this.dispatchEvent(1))}}),this._inputListeners.push({key:4,fun:t=>{1===this._state&&this.dispatchEvent(2),this._state=0}}),this._inputListeners.push({key:7,fun:t=>{t.event&&(t.event.stopPropagation(),t.event.preventDefault()),this._scale/=this._zoomSpeed,this._zoomTo(t.position,1),this._update()}}),this._inputListeners.push({key:8,fun:t=>{t.event&&(t.event.stopPropagation(),t.event.preventDefault()),this._scale*=this._zoomSpeed,this._zoomTo(t.position,-1),this._update()}})}_zoomTo(t,e){if(Date.now()-this._lastZoom>200){if(e>0||this._cameraZoom>=1){const e=this.getInputPosition(t);this._raycaster.setFromCamera(e,this._camera);const i=this._raycaster.intersectObject(this._plane);if(i.length<=0)return;const s=i.pop().point;this._zoomPosition.copy(s)}else this._zoomPosition.copy(this._center);this._cameraPosition.x=this._zoomPosition.x,this._cameraPosition.z=this._zoomPosition.z}this._lastZoom=Date.now()}_move(t,e){let i=new THREE.Vector2;i.subVectors(this._lastPosition,t),i.divideScalar(100),this._cameraPosition.x+=i.x*(2===e?1.1:1),this._cameraPosition.z+=i.y*(2===e?1.1:1),this._lastPosition.copy(t)}updateToBounds(t,e){let{x:i,y:s}=this._domHelper.getClientDimensions(),a=i/s;this._size=Math.max(t.x,t.z);let n=this._size,o=this._size;a>1?n=this._size*a:o=this._size*(s/i),this._center.copy(e),this._camera.left=n/-2,this._camera.right=n/2,this._camera.top=o/2,this._camera.bottom=o/-2,this._camera.zoom=1,this._camera.position.set(this._center.x,10,this._center.z),this._cameraPosition.copy(this._camera.position)}_update(t){this._scale=Math.min(this._scale,5),this._scale=Math.max(this._scale,.8),this._cameraZoom=this._scale,this._camera.updateProjectionMatrix()}animateCamera(t){return!(!super.animateCamera(t)&&Math.abs(this._cameraZoom-this._camera.zoom)<=.01||(this._camera.zoom=THREE.MathUtils.lerp(this._camera.zoom,this._cameraZoom,10*t),0))}}t("e",X);const Z=Math.PI/4;class Y extends k{constructor(t,e,i,s){super(t,e,i),this._state=0,this._rotationSpeed=1,this._keyMap=new Map,this.minPolarAngle=h(-60),this.maxPolarAngle=h(60),this._camera=s||new THREE.PerspectiveCamera,this._camera.fov=70,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(5),this._camera.layers.enable(4),i?this._camera.position.set(i.x,1.5,i.z):this._camera.position.set(0,1.5,0),this._cameraPosition=new THREE.Vector3,this._cameraPosition.copy(this._camera.position),this._cameraRotation=new THREE.Quaternion,this._pitch=0,this._yaw=0;let a=new THREE.Euler(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(a),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}_gamepadConnected(t){this.startButtonPressListener()}_gamepadDisconnected(t){window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let t=navigator.getGamepads()[0];this._checkRightStick(t),this._checkLeftStick(t),this._checkButtons(t),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(t){let e=t.axes[2],i=t.axes[3];Math.abs(e)>.2&&(this._rotateHorizontal(.01*Z*e),this._update(),this.dispatchEvent(1)),Math.abs(i)>.2&&(this._rotateVertical(.01*Z*i),this._update(),this.dispatchEvent(1))}_checkLeftStick(t){let e=t.axes[0],i=t.axes[1];Math.abs(i)>.2?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):t.buttons&&t.buttons[12]&&t.buttons[12].pressed?this._keyMap.set(87,!0):t.buttons&&t.buttons[13]&&t.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(e)>.2?e<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(t){t.buttons&&t.buttons[6]&&t.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),t.buttons&&t.buttons[14]&&t.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(1)):this._keyMap.set(37,!1),t.buttons&&t.buttons[15]&&t.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(1)):this._keyMap.set(39,!1)}animateCamera(t){let e=this._cameraPosition,i=this._cameraRotation,s=this.getCamera(),a=_(e,s.position),n=v(i,s.quaternion);if(!e||a&&n)return!1;let o=this.getCamera().position.clone(),r=Math.min(10*t,1);o.lerp(e,r),this.getCamera().position.copy(o);let h=this.getCamera().quaternion.clone(),d=Math.min(5*t,1);h.slerp(i,d),this.getCamera().setRotationFromQuaternion(h);let l=!1;return this._keyMap.forEach(t=>{t&&(l=!0)}),l&&this._processKeyMap(this._keyMap,t),!0}_getCamera(){return this._camera}_initInputListener(){window.addEventListener("keyup",this._onKeyChanged.bind(this),!1),window.addEventListener("keydown",this._onKeyChanged.bind(this),!1),this._inputListeners.push({key:3,fun:t=>{this._down(t)}}),this._inputListeners.push({key:6,fun:t=>{this._move(t)}}),this._inputListeners.push({key:4,fun:t=>{this._up(t)}})}_down(t){this._downPosition=t.position,this._position=t.position,this._state=1,2===t.type&&window.setTimeout(this._onLongDown.bind(this),350),2===t.type?this._rotationSpeed=.6:this._rotationSpeed=1}_move(t){this._position=t.position,1!==this._state||this._locked||this._orbit(new THREE.Vector2(t.position.x,t.position.y)),2!==this._state||this._locked||(this._orbit(new THREE.Vector2(t.position.x,t.position.y)),this._moveForward())}_up(t){1===this._state&&this.dispatchEvent(2),2===this._state&&this._keyMap.set(87,!1),this._state=0,this._orbitPosition=null}_onLongDown(){P(this._downPosition,this._position)<U&&1===this._state&&(this._state=2,this._orbit(new THREE.Vector2(this._position.x,this._position.y)),this._moveForward())}_update(t){let e=new THREE.Euler(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(e)}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions();this._camera.aspect=t/e,this._camera.updateProjectionMatrix()}_onKeyChanged(t){this._keyMap.set(t.keyCode,"keydown"===t.type),this.dispatchEvent(6),this._processKeyMap(this._keyMap,.001)&&t.preventDefault()}_processKeyMap(t,e){e=Math.min(e,.1);let i=new THREE.Vector3(0,0,0),s=!1;return this._processUpDown(t,i,e),t.get(65)&&(i.x=-1*e),t.get(68)&&(i.x=1*e),t.get(37)&&(this._rotateHorizontal(-Z*this._rotationSpeed*e),s=!0),t.get(39)&&(this._rotateHorizontal(Z*this._rotationSpeed*e),s=!0),t.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 THREE.Vector3(i.x,0,i.z)),this._update(),0))}_processUpDown(t,e,i){(t.get(87)||t.get(38))&&(e.z=-1*i),(t.get(83)||t.get(40))&&(e.z=1*i)}_orbit(t){this._orbitPosition||(this._orbitPosition=new THREE.Vector2(t.x,t.y),this.dispatchEvent(0));let e=t.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;e.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*e.x/i.clientWidth*1),this._rotateVertical(2*Math.PI*e.y/i.clientHeight*1),d(this._orbitPosition,t)||this.dispatchEvent(1),this._orbitPosition.copy(t),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(t){let e=this._pitch+t;e>this.maxPolarAngle||e<this.minPolarAngle||(this._pitch=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}}t("f",Y);let q=(()=>{class t{parse(t,e,i,s){let a=JSON.parse(s);return a.environment?this.load(t,e,i,a):null}load(t,e,i,s){let a,n=s.environment;if(!n)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(n.type){case"color":a=new Promise(e=>e(new W(t,i,new THREE.Color(n.details.color))));break;case"image":a=new Promise(s=>s(new W(t,i,null,e,n.details.imageUrl)));break;case"floor":a=new Promise(e=>{this._rapiAccess.getMaterial(n.details.material).then(s=>{let a=void 0===n.details.fog||n.details.fog,o=new j(t,i,a);o.changeFloorMaterial(s).then(()=>{e(o)})})});break;case"baked_shadow":a=new Promise(s=>{n.details&&n.details.color?s(new W(t,i,new THREE.Color(n.details.color))):n.details&&n.details.imageUrl?s(new W(t,i,null,e,n.details.imageUrl)):s(new N(t,i))});break;default:console.warn("Could not load environment, return old environment"),a=new Promise(t=>t(i))}return a}}return o([r],t.prototype,"_rapiAccess",void 0),t})(),K=(()=>{class t extends V{constructor(t,e){super(t,e),this._lights=[]}needsBounds(){return!0}updateBounds(t){if(this._cameraLight){const e=this._cameraLight,i=new THREE.Vector3;t.getSize(i);const s=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=s,e.shadow.camera.top=s/2,e.shadow.camera.bottom=-s/2,e.shadow.camera.left=-s/2,e.shadow.camera.right=s/2,e.shadow.camera.updateProjectionMatrix()}}loadFromJSON(t){return new Promise(e=>{this._lights=this._dynamicLightSettingLoader.parse(t),this.addToScene(),e()})}loadFromObject(t){return new Promise(e=>{t.lights||e(),this._lights=this._dynamicLightSettingLoader.load(t),this._lights.forEach((t,e)=>{t.userData.movesWithCamera&&(this._cameraLight=t,this._lights.splice(e,1))}),this.addToScene(),e()})}loadFromURL(t){return new Promise((e,i)=>{fetch(new Request(t,{method:"GET"})).then(R).then(t=>this.loadFromObject(t).then(e,i))})}addToScene(){this._lights.forEach(t=>{this._scene.add(t)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(t,e){if(!this._cameraLight)return;let i=new THREE.Vector3;t.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let s=e.clone().add(i);this._cameraLight.position.copy(s)}removeFromScene(){this._lights.forEach(t=>{this._scene.remove(t)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let t=y();this._cameraLight&&this._addToGUI(t,this._cameraLight),this._lights.forEach(e=>{this._addToGUI(t,e)})}_addToGUI(t,e){t&&(e instanceof THREE.SpotLight&&this._addSpotLightToGUI(t,e),e instanceof THREE.AmbientLight&&this._addAmbientLightToGUI(t,e),e instanceof THREE.DirectionalLight&&this._addDirectionalLightToGUI(t,e),e instanceof THREE.RectAreaLight&&this._addRectAreaLightToGUI(t,e))}_addRectAreaLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString(),intensity:e.intensity*(e.width*e.height)};i.add(e,"visible"),i.add(s,"intensity").min(10).max(400).step(10).onChange(t=>{e.intensity=t/(e.width*e.height)}),i.add(e,"castShadow"),i.addColor(s,"color").onChange(t=>{e.color=new THREE.Color(t)}),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))})}_addSpotLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString(),angle:180*e.angle/Math.PI};i.add(e,"visible"),i.add(e,"intensity").min(0).max(5).step(.1),i.add(e,"penumbra").min(0).max(1).step(.1),i.addColor(s,"color").onChange(t=>{e.color=new THREE.Color(t)}),i.add(s,"angle").min(10).max(180).step(1).onChange(t=>{e.angle=t*Math.PI/180}),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))})}_addAmbientLightToGUI(t,e){let i={name:e.name,color:"#"+e.color.getHexString()},s=t.addFolder(e.name);s.add(e,"visible"),s.add(e,"intensity").min(0).max(5).step(.1),s.addColor(i,"color").onChange(t=>{e.color=new THREE.Color(t)})}_addDirectionalLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString()};i.add(e,"visible"),i.add(e,"intensity").min(0).max(5).step(.1),i.addColor(s,"color").onChange(t=>{e.color=new THREE.Color(t)}),i.add(e,"castShadow"),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))})}}return o([r],t.prototype,"_dynamicLightSettingLoader",void 0),t})();class J{constructor(){this._settings=new window.PIXOTRON.QualitySettings(5),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!0,this._settings.useHDREnv=!0,this._settings.useGBuffer=!0,this._settings.ssr=!0,this._settings.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!0},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class ${constructor(){this._settings=new window.PIXOTRON.QualitySettings(4),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!0,this._settings.useHDREnv=!0,this._settings.useGBuffer=!0,this._settings.ssr=!0,this._settings.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!0},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class tt{constructor(){this._settings=new window.PIXOTRON.QualitySettings(3),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!1,this._settings.useHDREnv=!0,this._settings.useGBuffer=!0,this._settings.ssr=!1,this._settings.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!0},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class et{constructor(){this._settings=new window.PIXOTRON.QualitySettings(2),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!1,this._settings.useHDREnv=!1,this._settings.useGBuffer=!0,this._settings.ssr=!1,this._settings.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!1},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class it{constructor(){this._settings=new window.PIXOTRON.QualitySettings(1),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!1,this._settings.useHDREnv=!1,this._settings.useGBuffer=!0,this._settings.ssr=!1,this._settings.saoQualitySettings={enabled:!1,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!1},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class st{constructor(){this._settings=new window.PIXOTRON.QualitySettings(0),this._settings.enableAA=!1,this._settings.useAreaLight=!1,this._settings.useDevicePixelRatio=!1,this._settings.useHDREnv=!1,this._settings.useGBuffer=!0,this._settings.ssr=!1,this._settings.saoQualitySettings={enabled:!1,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!1},this._settings.shadowQualitySettings={enabled:!1,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class at{constructor(t){this._sceneBoundingSphere=new THREE.Sphere,this._pixotron=t,this._initializeQualitySettings(),this._initializeQualityAdapters()}getPixotronInstance(t){const e={saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,bias:.02,accumulative:!1},shadowparams:{shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.05,nearPlane:.01,farPlane:50,fov:40,numSamples:100,side:THREE.FrontSide}};return t=t||e,new window.PIXOTRON.Pixotron(t)}showGUI(){let t=y();if(!t)return;let e=t.addFolder("Renderer");e.add(this._pixotron.getSAOPass(),"enabled"),this._pixotron.getSAOPass().smoothTransition&&e.add(this._pixotron.getSAOPass(),"smoothTransition"),e.add(this._pixotron.getSAOPass(),"occlusionWorldRadius").min(0).max(1).step(1e-4).onChange(t=>{this._adjustSaoRadius(t)}),e.add(this._pixotron.getSAOPass(),"intensity").min(.1).max(2).step(.05),e.add(this._pixotron.getSAOPass(),"bias").min(0).max(1).step(1e-4).onChange(t=>{this._adjustSaoBias(t)}),this._pixotron.getSAOPass().numSamples&&e.add(this._pixotron.getSAOPass(),"numSamples").min(10).max(3e3).step(10),void 0!==this._pixotron.getShadowPass().enabled&&e.add(this._pixotron.getShadowPass(),"enabled"),e.add(this._pixotron.getShadowPass(),"smoothTransition"),e.add(this._pixotron.getShadowPass(),"enableAccumulation"),e.add(this._pixotron.getShadowPass(),"shadowRadius").min(0).max(5).step(.1),e.add(this._pixotron.getShadowPass(),"shadowBiasMultiplier").min(0).max(3).step(.01),e.add(this._pixotron.getShadowPass(),"numSamples").min(10).max(3e3).step(10)}updateBounds(t){this._sceneBoundingSphere.copy(t);const e=.25*this._getMaxSaoRadius();this._adjustSaoRadius(e);const i=2*this._getMinSaoBias();this._adjustSaoBias(i)}_getSaoRadius(){return this._sceneBoundingSphere.radius}_adjustSaoRadius(t){const e=this._pixotron.getSAOPass(),i=this._getMinSaoRadius(),s=this._getMaxSaoRadius();e.occlusionWorldRadius=Math.min(Math.max(t,i),s)}_adjustSaoBias(t){const e=this._pixotron.getSAOPass(),i=this._getMinSaoBias(),s=this._getMaxSaoBias();e.bias=Math.min(Math.max(t,i),s)}_getMinSaoRadius(){return.001*this._getSaoRadius()}_getMaxSaoRadius(){return.6*this._getSaoRadius()}_getMinSaoBias(){return.001*this._getSaoRadius()}_getMaxSaoBias(){return.01*this._getSaoRadius()}updatePixelRatio(t){const e=new THREE.Vector2;t.getDrawingBufferSize(e),this._pixotron.setSize(Math.floor(e.width),Math.floor(e.height))}getHighPixelRatioQualitySetting(){return this._highPixelRatioQualitySetting.getSettings()}getLowestQualitySetting(){return this._lowQualitySetting.getSettings()}_initializeQualitySettings(){this._highestQualitySetting=new $,this._highPixelRatioQualitySetting=new J,this._highQualitySetting=new tt,this._midQualitySetting=new et,this._lowQualitySetting=new it,this._lowestQualitySetting=new st}_initializeQualityAdapters(){this._autoQualityAdapter=new window.PIXOTRON.AutoQualityAdapter(this._pixotron),this._autoQualityAdapter.addQuality(this._highestQualitySetting.getSettings()),this._autoQualityAdapter.addQuality(this._highQualitySetting.getSettings()),this._autoQualityAdapter.addQuality(this._midQualitySetting.getSettings()),this._autoQualityAdapter.addQuality(this._lowQualitySetting.getSettings()),this._autoQualityAdapter.addQuality(this._lowestQualitySetting.getSettings()),this._autoQualityAdapter.setDesiredFps(20),this._manualQualityAdapter=new window.PIXOTRON.ManualQualityAdapter(this._pixotron)}onAutoQualityChange(t){this._autoQualityAdapter.onQualityChange(t)}onManualQualityChange(t){this._manualQualityAdapter.onQualityChange(t)}getAutoAdapter(){return this._autoQualityAdapter}lockAdapter(){this._autoQualityAdapter.getCurrentQualitySetting().lock()}unLockAdapter(){this._autoQualityAdapter.getCurrentQualitySetting().unLock()}enablePixotronAutoQuality(){this._currentQualityAdapter||(this._currentQualityAdapter=this._autoQualityAdapter,this._pixotron.setQualityAdapter(this._autoQualityAdapter))}movingCameraStarts(){this._currentQualityAdapter&&(this._currentQualityAdapter=this._autoQualityAdapter,this._currentQualitySetting&&(this._manualQualityAdapter.setQualitySetting(this._currentQualitySetting),this._pixotron.setQualityAdapter(this._manualQualityAdapter)),this._pixotron.setQualityAdapter(this._autoQualityAdapter))}movingCameraStops(){this._currentQualityAdapter&&(this._currentQualitySetting=this._currentQualityAdapter.getCurrentQualitySetting(),this._currentQualityAdapter=this._manualQualityAdapter,this._pixotron.setQualityAdapter(this._manualQualityAdapter),this._manualQualityAdapter.setQualitySetting(this._highestQualitySetting.getSettings()))}}t("S",(()=>{class t{constructor(t,e,i,s,a){this._depthWriteMaterial=new THREE.MeshBasicMaterial({colorWrite:!1}),this._maxAnisotropy=1,this._clock=new THREE.Clock,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._forceRender=!1,this._updateShadowsAndAO=!0,this._lastChange=Date.now(),this._running=!1,this._onAfterRender=()=>{},this._creator_=t,this._canvasID=i,this.createCameraControl(s,e),this._setupScene(e,a),this._lifeCycleManager.addEventListener(this)}onBeforeRender(){}_changeCameraControl(t){this._cameraControl&&this._cameraControl.cleanUp(),t instanceof Y&&(this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener)),this._cameraControl instanceof Y&&(this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)),this._cameraControl=t,this.cameraControlChanged()}cameraControlChanged(){}_addCameraControlListener(){this._cameraControl.addEventListener(0,this._requestRender,this),this._cameraControl.addEventListener(1,this._requestRender,this),this._cameraControl.addEventListener(2,this._requestRender,this),this._cameraControl.addEventListener(6,this._requestRender,this)}_renderEverything(){this._pixotron&&(this._forceRender=!0,this._updateShadowsAndAO=!0),this._requestRender()}_renderWithoutShadowsAndAO(){this._pixotron&&(this._forceRender=!0,this._updateShadowsAndAO=!1),this._requestRender()}_requestRender(){if(!this._renderer)return;const t=()=>{var e;this._delta=this._clock.getDelta(),this._animateCamera(),this._cameraControl.getCamera().layers.mask=65535,null===(e=this._statsHelper)||void 0===e||e.updateRenderInfo(this._renderer.info),this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._pixotron&&(this._pixotron.autoShadowsClear=this._updateShadowsAndAO,this._pixotron.autoSAOClear=this._updateShadowsAndAO,this._forceRender&&(this._pixotron.needsUpdate=!0),this._pixotron.render(this._renderer,this._scene,this._cameraControl.getCamera(),this._renderTarget),this._forceRender=!1,this._updateShadowsAndAO=!0,this._pixotron.blit(),this._shouldRenderUi()&&this._renderUi()),this._onAfterRender(),window.TWEEN&&TWEEN.update(),this._lastChange+3e3<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(t))};this._lastChange=Date.now(),this._running||this._stopRendering||(this._running=!0,requestAnimationFrame(t))}_shouldRenderUi(){return this._pluginSystem&&this._pluginSystem.needsUiScene()}_renderUi(){const t=this._scene.background?this._scene.background.clone():null;this._scene.overrideMaterial=this._depthWriteMaterial,this._scene.background=null,this._renderer.render(this._scene,this._cameraControl.getCamera()),this._scene.overrideMaterial=null;const e=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this._cameraControl.getCamera()),this._renderer.autoClear=e,this._scene.background=t}_animateCamera(){this._cameraControl&&(!this._cameraControl.animateCamera(this._delta)&&this.shouldClearShadowsAndAO()&&this._pixotron&&!this._forceRender?(this._pixotron.autoShadowsClear=!1,this._pixotron.autoSAOClear=!1):(this._lightSetting instanceof K&&this._cameraControl.getCamera()instanceof THREE.PerspectiveCamera&&this._lightSetting.update(this._cameraControl.getCamera(),this._cameraControl.getTargetPosition()),this._pixotron&&(this._pixotron.needsUpdate=!0))),this._environment&&this._environment.needsCamera()&&this._cameraControl instanceof D&&this._environment.updateCamera(this._cameraControl.getCamera())}shouldClearShadowsAndAO(){return!1}_setupScene(t,e){const{x:i,y:s}=this._domHelper.getClientDimensions();this._scene=new THREE.Scene,this._uiScene=new THREE.Scene,(e=e||!1)||(this._scene.background=new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND));const a={format:THREE.RGBAFormat,minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter},n=THREE.sRGBEncoding,o=Math.floor(i*window.devicePixelRatio),r=Math.floor(s*window.devicePixelRatio);M()?this._renderTarget=new THREE.WebGLMultisampleRenderTarget(o,r,a):this._renderTarget=new THREE.WebGLRenderTarget(o,r,a),this._renderTarget.texture.encoding=n,this._renderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(i,s),this._renderer.outputEncoding=THREE.sRGBEncoding,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=THREE.PCFSoftShadowMap,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._environmentLoader.setRendererAndScene(this._renderer,this._scene),this._environmentLoader.registerEnvironmentChangedCallback(()=>this._requestRender()),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._cameraControl.getCamera().position),this._addCameraControlListener(),this.sceneChanged()}_tabVisible(){this.updateCamera(!1)}updateCamera(t=!0){const{x:e,y:i}=this._domHelper.getClientDimensions();this._renderer.setSize(e,i);const s=this._renderer.getPixelRatio();if(this._renderTarget){const t=Math.floor(e*s),a=Math.floor(i*s);this._renderTarget.setSize(t,a)}if(this._pixotron)try{this._pixotron.setSize(e,i)}catch(t){console.warn(t)}this._cameraControl.updateCamera(),this._renderEverything()}_onWindowResize(){const t=this._getInputManager();t&&t.updateSize(),this.updateCamera(),this._requestRender()}_isPartOfScene(t){return"Object3D"===t.type||"Mesh"===t.type||"GLB"===t.type||"GLTF"===t.type||"Group"===t.type}cleanUp(){this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener),this._cameraControl&&this._cameraControl.cleanUp(),this._stopRendering=!0}clearScene(){let t=[];this._scene.children.forEach(e=>{this._isPartOfScene(e)&&t.push(e)}),t.forEach(t=>{S(t),this._scene.remove(t)}),this._renderer.renderLists.dispose()}enableHD(t){this._renderer.capabilities.maxTextures>8&&t&&this.loadDynamicLightSetting(t),this._pixotron=new window.PIXOTRON.Pixotron(this.getPixotronParams()),this._pixotron.enableAA=!1,this._pixotronUtil=new at(this._pixotron),this._initData.autoQuality&&this._enableAutoQuality(),this._environment instanceof N&&(this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera(),this.getBakedShadowParams()),this._environment.setLoadedCallback(()=>setTimeout(()=>this._requestRender(),500))),this._requestRender()}_enableAutoQuality(){this._pixotronUtil.enablePixotronAutoQuality();const t=this._pixotronUtil.getAutoAdapter();this._pixotronUtil.onAutoQualityChange((e,i)=>{var s;null===(s=this._statsHelper)||void 0===s||s.updateQualityInfo(e);const a=this._pixotronUtil.getLowestQualitySetting();if(this._enableSSR(e.ssr),i&&e.getQuality()<i.getQuality()&&t.getAverageFps()<5&&t.setQualitySetting(a),this._renderer.getPixelRatio()>1&&!e.useDevicePixelRatio){this._renderer.setPixelRatio(1);const{x:t,y:e}=this._domHelper.getClientDimensions();try{this._pixotron.setSize(t,e)}catch(t){console.warn(t)}this._renderTarget&&this._renderTarget.setSize(t,e)}}),this._pixotronUtil.onManualQualityChange((t,e)=>{var i;null===(i=this._statsHelper)||void 0===i||i.updateQualityInfo(t),this._enableSSR(t.ssr)}),this._pixotronUtil.lockAdapter()}_enableSSR(t=!1){const e=void 0!==this._initData.ssr&&this._initData.ssr;this._pixotron.getSSRPass().enabled=!!e&&t}_loadGLTF(t,e,i,s,a,n,o){return new Promise((r,h)=>{this._staticItemLoader.loadGLTF(t,e,i,s,a,n,null,o).then(t=>{this._setCamera("GLTF",t),r(t)},h)})}_loadGLB(t,e,i,s,a,n,o,r){return new Promise((h,_)=>{this._staticItemLoader.loadGLB(t,e,i,s,a,n,o,r).then(t=>{this._setCamera("GLB",t),h(t)},_)})}_setCamera(t,e){if(!e)return void console.warn("could not set camera for gltf",e);const i=new THREE.Box3;i.setFromObject(e),"GLB"===t?this._cameraControl instanceof D&&this._cameraControl.updateToBounds(i,!1):"GLTF"===t&&(this._cameraControl instanceof D&&this._cameraControl.updateAndReset(i.getSize(new THREE.Vector3),i.getCenter(new THREE.Vector3),-15,70,5,!1),this._cameraControl instanceof X&&this._cameraControl.updateToBounds(i.getSize(new THREE.Vector3),i.getCenter(new THREE.Vector3))),this.updateCamera()}async showGUI(){if(this._initData.disableDebugGUI)return;const t=document.createElement("style");t.innerText=".dg.main{position:absolute;z-index:100;top:0;left:0;}",document.head.appendChild(t),await this._scriptLoader.fetch("static/dat.gui.min-b5cbb61e5c62f0bf.js",{id:"dat-gui-js"});let e=y(!1);e&&(this._domHelper.element.appendChild(e.domElement),this._guiLoaded())}_guiLoaded(){let t=y();t&&(this._lightSetting&&this._lightSetting.showGUI(),this._pixotron&&this._pixotronUtil.showGUI(),this._environment&&this._environment.showGUI(),this._addGUIListener(t))}_addGUIListener(t){let e=t.__folders;Object.keys(e).forEach(t=>{let i=e[t];i.__folders&&Object.keys(i.__folders).forEach(t=>{let i=e[t];this._addGUIListener(i)}),i.__controllers&&i.__controllers.forEach(t=>{t.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._renderEverything()}showStats(){e.import("./stats-helper-c509b532.legacy.js").then(t=>this._statsHelper=new t.default)}_onKeyDown(t){}_onKeyUp(t){}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(){let t=this._domHelper.getClientDimensions(),e=t.x,i=t.y;if(this._renderTarget){const t=Math.floor(e*window.devicePixelRatio),s=Math.floor(i*window.devicePixelRatio);this._renderTarget.setSize(t,s)}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(t){switch(t.type){case"resize":this._onWindowResize();break;case"keydown":if(t.target&&(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement))break;this._onKeyDown(t);break;case"keyup":if(t.target&&(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement))break;this._onKeyUp(t);break;case"visibilitychange":this._tabVisible()}}async loadSceneSettings(t){let e,i;return e=t.environment?new Promise(e=>{(new q).load(this._scene,this._renderer.domElement,this._environment,t).then(t=>{this._setEnvironment(t),e()})}):Promise.resolve(),t.lights?(this._lightSetting=new K(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(t)):i=Promise.resolve(),new Promise((t,s)=>{Promise.all([e,i]).then(()=>{this._renderEverything(),t()},s)})}setBackgroundColor(t){this._setEnvironment(new W(this._scene,this._environment,new THREE.Color(t)))}setBackgroundImage(t){this._setEnvironment(new W(this._scene,this._environment,null,this._renderer.domElement,t))}setBakedShadow(t,e){this._setEnvironment(new W(this._scene,this._environment,new THREE.Color(t),this._renderer.domElement,e))}_setEnvironment(t){this._environment=t,this._environment instanceof N&&(this._pixotron&&this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera()),this._environment.setLoadedCallback(()=>setTimeout(()=>this._renderEverything(),500))),this._renderEverything()}loadQualitySetting(t){this._pixotron&&(new f).set(this._pixotron,t)}async loadDynamicLightSetting(t){this._lightSetting=new K(this._scene,this._lightSetting);let e=!1;if(t.url)await this._lightSetting.loadFromURL(t.url),e=!0;else if(t.json)await this._lightSetting.loadFromJSON(t.json),e=!0;else if(t.object)await this._lightSetting.loadFromObject(t.object),e=!0;else if(t.ls){const i=x.createDynamicLightSettingSource(null,t.ls);await this._lightSetting.loadFromURL(i.url),e=!0}if(!e)throw new Error("No dynamic light setting source set");this._requestRender()}getScene(){return this._scene}updateScene(){this._updateBounds(this.getBounds()),this._renderEverything()}_updateBounds(t,e=!1){if(t){if(this.updateEnvironment(t,e),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(t),this._pixotronUtil){const e=new THREE.Sphere;t.getBoundingSphere(e),this._pixotronUtil.updateBounds(e)}this._requestRender(),this._pluginSystem.updateBounds(t)}}setCameraOffset(t){const e=this._cameraControl.getCamera();e.offset?(e.offset=t,this._renderEverything()):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){const t=this._cameraControl.getCamera();return t.offset?JSON.parse(JSON.stringify(t.offset)):{left:0,top:0,right:1,bottom:1}}getPerspectiveOffsetCamera(){const t=this._domHelper.getClientDimensions(),e=t.x,i=t.y;return b().createCamera(30,e/i,.1,20)}updateEnvironment(t,e=!1){if(t&&this._environment&&this._environment.needsBounds()){const i=t.getSize(new THREE.Vector3);i.x+i.y+i.z!==0&&this._environment.updateBounds(t.getSize(new THREE.Vector3),e)}}}return o([r],t.prototype,"_domHelper",void 0),o([r],t.prototype,"_scriptLoader",void 0),o([r],t.prototype,"_lifeCycleManager",void 0),o([r],t.prototype,"_staticItemLoader",void 0),o([r],t.prototype,"_environmentLoader",void 0),o([r],t.prototype,"_initData",void 0),o([r],t.prototype,"_pluginSystem",void 0),t})()),t("d","static/pi.min-0272f873b3a4380a.js"),t("P",["static/CopyShader-cde53240fcc3e06e.js","static/EffectComposer-1e936e5d03ff43cc.js","static/RenderPass-bc5df3810a01b2c6.js","static/ShaderPass-31f36160e0ea282d.js","static/LuminosityHighPassShader-dd5826656142421d.js","static/OutlinePass-f4bcd337cdd89b8d.js","static/RectAreaLightUniformsLib-4b74882185efd473.js","static/GammaCorrectionShader-b3b56f244f0d1e0e.js"])}}}));
|
|
2
|
-
//# sourceMappingURL=pixotron-b7f25843.legacy.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./query-params-helper-8c00a872.legacy.js","./rapi-access-34b1ce17.legacy.js","./main-thread-to-worker-fb98950d.legacy.js","./image-renderer-526f1625.legacy.js","./pixotron-b7f25843.legacy.js","./mesh-generator-b8345f3e.legacy.js","./default-light-setting-684f437b.legacy.js"],(function(e,t){var n,a,i,s,r,o,l,h,c,d,_,g,p,m,u,w,S,f,C,v,E,M,b,I,y,k,P,H,L,D,T,R,V,O,A,B,j,x,F,G,K,U,z,q,W,N,X,Q,J,Y,Z,$,ee;return{setters:[function(){},function(e){n=e.J,a=e._,i=e.i,s=e.a7,r=e.C,o=e.y,l=e.a8,h=e.k,c=e.B,d=e.F,_=e.a9,g=e.m,p=e.aa,m=e.ab,u=e.D,w=e.q,S=e.V,f=e.a4,C=e.U,v=e.e,E=e.L,M=e.f,b=e.r},function(e){I=e.d,y=e.s,k=e.l,P=e.m},function(e){H=e.S,L=e.c,D=e.d,T=e.G,R=e.b,V=e.a,O=e.g,A=e.P,B=e.C},function(e){j=e.L,x=e.S,F=e.B,G=e.a,K=e.C,U=e.e,z=e.f,q=e.g,W=e.T,N=e.P,X=e.d,Q=e.I,J=e.E,Y=e.b,Z=e.M},function(e){$=e.M},function(e){ee=e.D}],execute:function(){class te extends j{constructor(e,t){super(e,t),this._center=new THREE.Vector3(0,0,0),this._params={ambientLight:{color:"#ffffff"},hemiLight:{color:"#ffffff"},mainDirLight:{direction:{x:.03,y:1,z:.03},color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),.3),this._ambientLight.layers.set(1),this._mainDirLight=new THREE.DirectionalLight(new THREE.Color(this._params.mainDirLight.color),.5),this._mainDirLight.castShadow=!0,this._mainDirLight.shadow.camera.near=.5,this._mainDirLight.shadow.camera.far=100,this._mainDirLight.shadow.mapSize=new THREE.Vector2(1024,1024),this._mainDirLight.visible=!0,this.addToScene()}updateSunPosition(e,t){}addToScene(){this._scene.add(this._mainDirLight),this._scene.add(this._ambientLight),this._scene.add(this._mainDirLight.target)}removeFromScene(){this._scene.remove(this._mainDirLight),this._scene.remove(this._ambientLight),this._scene.remove(this._mainDirLight.target)}reload(){this.removeFromScene(),this.addToScene()}needsBounds(){return!0}updateBounds(e){this._center.copy(e.getCenter(new THREE.Vector3));const t=new THREE.Sphere;e.getBoundingSphere(t);const n=t.radius,a=new THREE.Vector3(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);a.normalize(),a.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(a),this._mainDirLight.target.position.copy(this._center),this._mainDirLight.target.updateMatrixWorld(!0),this._mainDirLight.shadow.camera.top=n,this._mainDirLight.shadow.camera.bottom=-n,this._mainDirLight.shadow.camera.left=-n,this._mainDirLight.shadow.camera.right=n,this._mainDirLight.shadow.camera.near=.01,this._mainDirLight.shadow.camera.far=2*n,this._mainDirLight.shadow.camera.updateProjectionMatrix()}showGUI(){let e=n();if(e){if(this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new THREE.Color(e))}if(this._hemiLight){let t=e.addFolder("Hemi Light");t.add(this._hemiLight,"visible"),t.add(this._hemiLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.hemiLight,"color").onChange(e=>this._hemiLight.color=new THREE.Color(e))}if(this._mainDirLight){let t=e.addFolder("Main Directional Light");t.add(this._mainDirLight,"visible"),t.add(this._mainDirLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(e=>this._mainDirLight.color=new THREE.Color(e)),t.add(this._mainDirLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center))}}}}class ne{constructor(e){const{planElementViewModel:t,resetCamera:n,state:a,oldState:i}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===a?0:a,this.oldState=void 0===i?0:i}}let ae=(()=>{class e extends H{constructor(e,t,n,a){super(e,t,n,a),this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0);const i=new THREE.Layers;i.enable(3),i.enable(6),i.enable(8),this._raycastHelper.setLayers(i),this._raycastHelper.addEventListener(3,()=>{this._plannerSelectionHandler.cancelSelection()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(0,new ne({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e})=>{this.setState(0),this.dispatchEvent(1,new ne({planElementViewModel:e}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}async addPlanObjectHandlers(e,t){t||(t=await e.getObjectAsync());const n={hasListener:!0,priority:1,roomleId:e.getId()};this._addPlanObjectHandlers(e,t,n)}addWallHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{hasListener:!0,priority:1,roomleId:e.getId()})}_addPlanObjectHandlers(e,t,n){t.userData.hasListener||(t.userData=I(t.userData,n),t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)),t.addEventListener("rotate",t=>this._rotate(e,t.attachment.rotation)))}_addPlanElementHandlers(e,t,n){t.userData.hasListener||(t.userData=I(t.userData,n),t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)))}_clickElement(e){this._debug&&e.getId(),this._plannerSelectionHandler.check(e),this._setCursor()}_hoverOn(e){this._hoveredObject=e,this._setCursor()}_hoverOff(e){this._hoveredObject=null,this._setCursor()}_setCursor(){2===this._state&&this._hasSelection()?y("ew-resize"):1===this._state?y("grabbing"):this._hoveredObject&&this._plannerSelectionHandler.isSelected(this._hoveredObject.getId())?y("move"):this._hoveredObject?y("pointer"):y("default")}setCamera(e){this._raycastHelper.setCamera(e)}setScene(e){this._raycastHelper.setScene(e)}getSelectedIds(){return this._plannerSelectionHandler.getSelectedIds()}setSelectionMode(e){this._plannerSelectionHandler.setSelectionMode(e)}setPlanViewModel(e){this._planViewModel=e}cancelSelection(){this._plannerSelectionHandler.cancelSelection()}_dragStart(e){this._plannerSelectionHandler.isSelected(e.getId())&&0===this._state&&(this._draggedObject=e,this.setState(1),this.dispatchEvent(4,new ne({planElementViewModel:e})),this._setCursor())}_drag(e,t){if(!this._draggedObject||1!==this._state)return;const n=this._plannerKernelAccess.planInteractionHandler;if(this._plannerSelectionHandler.getSelectedIds().length>1){const e=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let a=t.sub(this._draggedObject.getPosition());this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanObject())),n.moveObjectsBy(e,s(a))}else n.moveElementTo(e.getPlanElement(),s(t));this.dispatchEvent(5,new ne({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this.setState(0),this.dispatchEvent(6,new ne({planElementViewModel:e})),this._dragIn&&(this.cancelSelection(),this.setDragIn(!1)),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this._plannerKernelAccess.planInteractionHandler,a=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),a.rotation-t)}}setState(e){const t=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new ne({state:this._state,oldState:t})),this._position=null,2===this._state&&this._plannerKernelAccess.planInteractionHandler.deactivateAllSnappingActivity()}resetState(){this.setState(0)}_move(e){if(2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:a}=e.positionRelative;this._position?t=1.4*e.positionRelative.x*Math.PI-1.4*this._position.x*Math.PI:this._position=new THREE.Vector3(e.positionRelative.x,e.positionRelative.y,0);const i=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,r=new THREE.Box3;this.getSelectedIds().forEach(e=>{var t;const n=null===(t=this._planViewModel)||void 0===t?void 0:t.getPlanObjectForId(e);n&&n.getObject()&&(i.push_back(n.getPlanObject()),r.expandByObject(n.getContainer()))});const o=r.getCenter(new THREE.Vector3);this._plannerKernelAccess.planInteractionHandler.rotateObjectsBy(i,t,s(o)),this._position.copy(new THREE.Vector3(n,a,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}selectPlanElement(e){this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(0,new ne({}))}addComponentDragInHandler(e){if(!this._dragIn)return;const t=e.getBoundingBox();this._addPlanElementHandlers(e,t,{hasListener:!0,priority:1,roomleId:e.getId()}),this._raycastHelper.enableDragIn(t),this._dragStart(e)}}return a([i],e.prototype,"_plannerSelectionHandler",void 0),a([i],e.prototype,"_plannerKernelAccess",void 0),e})(),ie=(()=>{class e extends x{constructor(e,t,n,a){super(e,t,r.HSP,a),this._staticItemGuard=new o,this._configurableItemGuard=new o,this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new ae(e,this._scene,this._cameraControl.getCamera(),this._getInputManager()),this._plannerSceneEventHandler.addEventListener(2,({state:e,oldState:t})=>{2===t&&e!==t&&this._roomlePlannerUiCallback.onRotationCancel(),2===e||1===e?this._cameraControl.lock():this._cameraControl.unlock()},this),this._plannerSceneEventHandler.addEventListener(0,({planElementViewModel:e})=>{e instanceof L&&this._initData.debug&&e.getGLBUrl(),this._highlight(e),this._onSelectionChange(e)},this),this._plannerSceneEventHandler.addEventListener(1,()=>{this._highlight(null),this._roomlePlannerUiCallback.onSelectionCancel()},this),this._plannerSceneEventHandler.addEventListener(4,()=>{this._plannerKernelAccess.planInteractionHandler.startInteraction(),this._cameraControl.lock(),this._environment instanceof F&&this._environment.removeFromScene(),this._requestRender(),this._dragStartBounds=this.getBounds()},this),this._plannerSceneEventHandler.addEventListener(5,({planElementViewModel:e})=>{this._cameraControl.checkNearFarDistance(e.getPosition()),this._requestRender()},this),this._plannerSceneEventHandler.addEventListener(6,({planElementViewModel:e})=>{const t=this._plannerKernelAccess.planInteractionHandler;t.endInteraction(),this._cameraControl.unlock(),this._environment instanceof F&&this._environment.addToScene();const n=this._getDragPosition(e.getPosition());n&&t.moveElementTo(e.getPlanElement(),s(n)),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds(),this._renderEverything()},this),this._plannerKernelAccess.addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this),this._renderListener=()=>{this._requestRender()},this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new THREE.Vector3),a=e.distanceTo(n),i=t.getSize(new THREE.Vector3),s=Math.max(i.x,i.z)+3;if(a>s){const t=(new THREE.Vector3).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(s))}return null}_onSelectionChange(e){let t;e instanceof L&&(t="static"),e instanceof D&&(t="configuration");const n={};if(e instanceof L&&(n.item=e.getRapiItem()),e instanceof D){const t=e.getConfigurationRuntimeId();n.configurationRuntimeId=t}const a=(async()=>{const n={};if(e instanceof L&&(n.item=e.getRapiItem()),e instanceof D){const a=e.getConfigurationRuntimeId(),i=e.getPlanObject().getCatalogItemId(),s=this._plannerKernelAccess.kernelInstance.getHashOfConfiguration(a);let r;if(i&&g(i)){const e=await this._rapiAccess.getItem(i);n.item=e,r=e.rootComponentId?e.rootComponentId:null}else try{const e=await this._rapiAccess.getConfiguration(s);n.configuration=e,r=e.rootComponentId?e.rootComponentId:null}catch(e){console.warn("Could not get RAPI configuration for kernel hash "+s+", saving configuration...");const t=await this._plannerKernelAccess.getConfigurationData(a),i=await this._rapiAccess.saveConfiguration(t);n.configuration=i,r=i.rootComponentId?i.rootComponentId:null}if(r){const e=await this._rapiAccess.getComponent(r);n.component=e}n.configurationRuntimeId=a,t="configuration"}return k(n)})();this._roomlePlannerUiCallback.onSelectionChange(k(this._plannerSceneEventHandler.getSelectionMode()),k(t),k(n),a)}_setupScene(e,t){super._setupScene(e,t),this._initData.moc?(this._lightSetting=new ee(this._scene),this._setEnvironment(new G(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND)))):(this._lightSetting=new te(this._scene),this._addSky(),this._setEnvironment(new F(this._scene,this._environment)))}onBeforeRender(){this._cameraControl instanceof K&&this._plannerMeshGenerator.wallMeshes.forEach(e=>l(this._cameraControl.getCamera(),e.material))}_getInputManager(){return this._plannerInputManager}createCameraControl(e,t){this.setMode(e)}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart()}resetCameraToState(){this._cameraControl.resetToState()}resetCameraPositionToStart(){this._requestRender()}_getYRotationOfObject(e){let t=e.getWorldDirection(new THREE.Vector3).clone();t.y=0,t.lengthSq()<.01&&(t=new THREE.Vector3(0,1,0),t.applyQuaternion(e.quaternion),t.y=0),t.normalize();let n=Math.asin(t.x);return t.z<0&&(n=Math.PI-n),n<0&&(n+=2*Math.PI),n}loadStaticPlanObjects(){let e=new Map;this._planViewModel.getStaticPlanObjectViewModels().forEach(t=>{let n=t.getPlanObject();e.has(n.getCatalogItemId())?e.get(n.getCatalogItemId()).push(t):e.set(n.getCatalogItemId(),[t])}),this._rapiAccess.getItems(Array.from(e.keys())).then(t=>{let n=[];t.forEach(t=>{this._plannerKernelAccess.catalogItemLoaded(t),e.get(t.id).forEach(e=>{n.push(new Promise((n,a)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},a)}))})}),Promise.all(n).then(()=>this._staticItemsLoaded())})}_staticItemsLoaded(){this._requestRender(),this._staticItemGuard.resolve(),this._roomlePlannerUiCallback.onItemsLoaded()}preload(e){this._planId=e;let t=this._localStorageHelper.getItem(this._planId,"rml_plans");t&&this._loadGLTF(t).then(e=>{this._preloadScene=e,this._preloadScene&&this._scene.add(this._preloadScene),this._requestRender()})}planXMLLoaded(e){this.endPlanConstruction(e);const t=e.getBounds(),n=h(t);this._updateBounds(n),this.loadStaticPlanObjects()}planCompletelyLoaded(e){this._renderEverything()}handlerSwitchedPlans(e){if(this._planViewModel=e,this._planViewModel.setPlannerSceneEventHandler(this._plannerSceneEventHandler),this._planViewModel.setGeometriesMergedListener(()=>{this._renderEverything()}),this._plannerSceneEventHandler.setPlanViewModel(this._planViewModel),this.clearScene(),!this._initData.moc){this._addSky();let e=new THREE.PlaneGeometry(1e3,1e3);e.rotateX(-Math.PI/2);let t=new THREE.MeshStandardMaterial({color:"#f0f0f0",roughness:1,metalness:0}),n=new THREE.Mesh(e,t);n.name="Ground",n.position.y=-.01,n.receiveShadow=!0,this._scene.add(n)}this.resetCamera(),this._setCeiling(),this._staticItemGuard.reset(),this._configurableItemGuard.reset(),Promise.all([this._staticItemGuard.wait(),this._configurableItemGuard.wait()]).then(this._itemsLoaded.bind(this))}_itemsLoaded(){const e=this._planViewModel.getCorePlan();if(this._pixotron){const t=h(e.getBounds());this._pixotron.getShadowPass().setShadowRecieverBBox(t)}this._roomlePlannerUiCallback.onCompletelyLoaded(),this._pixotronUtil&&this._planViewModel.materialQueue.finished(!0).then(()=>{this._pixotronUtil.unLockAdapter()}),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),c.end("loadingTime")}beginPlanConstruction(e){}addPlanMesh(e,t,n,a,i,s,r){}endPlanConstruction(e){this._renderLoopFunction=()=>{this._scene.add(this._planViewModel.getConstructionGroup()),this._scene.add(this._planViewModel.getCeilingGroup()),this._scene.add(this._planViewModel.getFloorGroup()),this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(this._planViewModel.getBoundingBox()),this._scene.remove(this._preloadScene)}}addPlanObjectToScene(e){if(e){const t=e.getContainer();d(t),this._scene.add(t),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.selectPlanElement(e),this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender())}setTimeout(()=>{this._zoomToBounds()},0),this._renderEverything()}removePlanObjectFromScene(e){this._scene.remove(e.getContainer()),this.updateEnvironment(this.getBounds()),this._zoomToBounds(),this._renderEverything()}planElementChanged(e,t){this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),this._onPlanChanged()}exportGLB(e,t){this._scriptLoader.fetch(T,{id:"gltf-exporter"}).then(()=>{let n=new THREE.GLTFExporter;e||(e=[],this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)})),n.parse(e,e=>{let n=t||"test";this._localStorageHelper.addItem(n,JSON.stringify(e),"rml_plans")},{binary:!1,embedImages:!0,forceIndices:!0})})}importGLB(e){this._loadGLB(e).then(e=>this._scene.add(e))}clearScene(){this._plannerMeshGenerator.clear(),this._planViewModel.sceneCleared(),super.clearScene()}_addSky(){this._sky=new THREE.Sky,this._sky.name="Sky",this._sky.scale.setScalar(45e4),this._scene.add(this._sky),this._sky.material.uniforms.turbidity.value=10,this._sky.material.uniforms.rayleigh.value=2,this._sky.material.uniforms.luminance.value=1,this._sky.material.uniforms.mieCoefficient.value=.005,this._sky.material.uniforms.mieDirectionalG.value=.8;let e=new THREE.Mesh(new THREE.SphereBufferGeometry(2e4,16,8),new THREE.MeshBasicMaterial({color:16777215}));e.name="Sunsphere",e.position.y=-7e5,e.visible=!1,this._scene.add(e);let t=-.2*Math.PI,n=2*Math.PI*-.25;e.position.x=4e5*Math.cos(n),e.position.y=4e5*Math.sin(n)*Math.sin(t),e.position.z=4e5*Math.sin(n)*Math.cos(t),e.visible=!0,this._sky.material.uniforms.sunPosition.value.copy(e.position),this._lightSetting instanceof te&&this._lightSetting.updateSunPosition(.3,.25)}switchTo2D(){this._cameraControl instanceof U||(this._plannerMeshGenerator.wallMeshes.forEach(e=>_(e.material,!1,!1)),this._renderEverything(),this._changeCameraControl(new U(this._creator_,this._getInputManager())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("2D"))}switchTo3D(){this._cameraControl instanceof K||(this._renderEverything(),this._changeCameraControl(new K(this._creator_,this._getInputManager(),new THREE.Vector3(0,10,0),this.getPerspectiveOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("3D"))}_setCeiling(){this._planViewModel&&(this._cameraControl instanceof z?this._planViewModel.getCeilingGroup().visible=!0:this._planViewModel.getCeilingGroup().visible=!1)}cameraControlChanged(){super.cameraControlChanged(),this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setCamera(this._cameraControl.getCamera())}sceneChanged(){this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setScene(this._scene)}closeHSC(){this._requestRender(),this._cameraControl instanceof K&&this._cameraControl.resetToState()}switchToFirstPerson(){if(this._cameraControl instanceof z)return;this._plannerMeshGenerator.wallMeshes.forEach(e=>_(e.material,!1,!1)),this._renderEverything();let e=new THREE.Vector3(0,0,0);this._planViewModel&&(e=this._planViewModel.getBoundingBox().getCenter(new THREE.Vector3)),this._cameraControl&&this._cameraControl.cleanUp(),this._changeCameraControl(new z(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera())),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("FP")}_onKeyDown(e){super._onKeyDown(e),this._initData.debug&&this._checkNumKey(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("multiselect"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof K&&(this._cameraControl.enablePanning(),e.preventDefault())}_checkNumKey(e){e.key&&"1"===e.key&&(this.switchTo2D(),e.preventDefault()),e.key&&"2"===e.key&&(this.switchTo3D(),e.preventDefault()),e.key&&"3"===e.key&&(this.switchToFirstPerson(),e.preventDefault())}_onKeyUp(e){super._onKeyDown(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("standard"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof K&&(this._cameraControl.disablePanning(),e.preventDefault())}setMode(e){switch(e){case"2D":this.switchTo2D();break;case"3D":this.switchTo3D();break;case"FP":this.switchToFirstPerson()}}_highlight(e){let t=new Set;e&&e.getObject()&&e.getObject().children&&e.getObject().children.forEach(e=>t.add(e)),this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const n=this._planViewModel.getPlanObjectForId(e);n&&n.getObject()&&n.getObject().children&&n.getObject().children.forEach(e=>t.add(e))}),this._pixotron&&this._pixotron.highlightObjects(Array.from(t))}destroy(){super.destroy(),this._plannerMeshGenerator.removeMaterialLoadedListener(),this._planViewModel.removeGeometriesMergedListener()}getPixotronParams(){return{saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:2},shadowparams:{shadowMapResolution:1024,shadowRadius:3,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.6,nearPlane:.01,farPlane:50,fov:110,side:THREE.FrontSide,numSamples:100},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:.9,edgeThickness:2}}}getBakedShadowParams(){return{enable:!0,shadowMapResolution:1024,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4,bShadowMaterial:!0,falloff:1.8,darkness:.3,size:1.2,lightDirection:new THREE.Vector3(0,1,0),lightSolidAngle:40,yPosition:.006}}planObjectConfigurationLoaded(e,t,n){if(e&&e.extRef&&t&&t.extRef){let e=t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId();e>0&&this._planViewModel.constructComponents(e)}}addMesh(e,t,n,a,i,s){}_updateBounds(e){e&&(this._updateCamera(e),super._updateBounds(e))}_updateCamera(e){if(e||(e=this.getBounds()),e){if(this._cameraControl instanceof K){const t=e.getSize(new THREE.Vector3),n=Math.max(t.x,t.z),a=this._initData.moc?.5*n*-1:5,i=this._initData.moc?q:70;this._cameraControl.updateAndReset(t,e.getCenter(new THREE.Vector3),-15,i,a,!1)}this._cameraControl instanceof U&&this._cameraControl.updateToBounds(e.getSize(new THREE.Vector3),e.getCenter(new THREE.Vector3))}}_zoomToBounds(){const e=this.getBounds();this._cameraControl instanceof K&&this._cameraControl.zoomToFitBounds(e)}getBounds(){return this._planViewModel?this._planViewModel.getBoundingBox():null}cancelSelection(){this._plannerSceneEventHandler.cancelSelection(),this._highlight(null),this._requestRender()}deleteSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelSelection(),e.forEach(e=>{const t=this._planViewModel.getPlanObjectForId(e);t&&t.getObject()&&this._plannerKernelAccess.planInteractionHandler.removeElement(t.getKernelObject())})}rotateSelection(e){const t=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,n=new THREE.Box3;this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const a=this._planViewModel.getPlanObjectForId(e);a&&a.getObject()&&(t.push_back(a.getPlanObject()),n.expandByObject(a.getContainer()))});const a=n.getCenter(new THREE.Vector3),i=this._plannerKernelAccess.planInteractionHandler.groupObjects(t);this._plannerKernelAccess.planInteractionHandler.rotateGroupBy(i,e,s(a))}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender()}planElementRemoved(e){this._onPlanChanged(),this._renderEverything()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={}){return new Promise(t=>{this._planViewModel.materialQueue.finished(!0).then(async()=>{let n=this._calculateBoundingBoxOfAllMeshes(.1);this._lightSetting.removeFromScene();let a=await R(this._scene,null,n,e);this._lightSetting.addToScene(),this._requestRender(),t(a)})})}preparePerspectiveImage(e={}){return new Promise((t,n)=>{this._planViewModel.materialQueue.finished(!0).then(async()=>{let n;n=this._cameraControl instanceof K?this._cameraControl.getCamera().clone():this.getPerspectiveOffsetCamera();let a=this._calculateBoundingBoxOfAllMeshes();this._lightSetting.removeFromScene();const i=await V(this._scene,null,n,a,e);this._lightSetting.addToScene(),this._requestRender(),t(i)},n)})}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return O(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}dragIn(e){this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}}return a([i],e.prototype,"_plannerKernelAccess",void 0),a([i],e.prototype,"_rapiAccess",void 0),a([i],e.prototype,"_plannerMeshGenerator",void 0),a([i],e.prototype,"_plannerInputManager",void 0),a([i],e.prototype,"_roomlePlannerUiCallback",void 0),a([i],e.prototype,"_localStorageHelper",void 0),e})();const se={left:0,top:1,right:1,bottom:0};let re=(()=>{class e{constructor(e){this._hscInstance=null,this._glbInstance=null,this._creator_=e,this._kernelAccessCallback.addListener(this),this._backstack.init([r.HSP],this)}deleteSelection(){this._sceneManager.deleteSelection()}rotateSelection(e){this._sceneManager.rotateSelection(e)}cancelSelection(){this._sceneManager.cancelSelection()}init(e,t,n){return c.start("loadingTime"),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):(this._preloadPlanId=t,this.setOverrides(n),new Promise(this._initPromiseCallback.bind(this)))}loadPlanXml(e,t){return this.setOverrides(t),new Promise(n=>{this._plan=this._planInteractionHandler.loadPlanXML(e),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._backstack.bringIntoForeground(r.HSP),this._initData.moc&&(t.id?this._rapiAccess.trackView(t.id):this._rapiAccess.trackView("planXML")),n()})}loadPlan(e,t){return this.setOverrides(t),new Promise((t,n)=>{this._rapiAccess.getPlan(e).then(n=>{this._plan=this._planInteractionHandler.loadPlanXML(n.planObjects),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._backstack.bringIntoForeground(r.HSP),this._initData.moc&&this._rapiAccess.trackView(e),t()},n)})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}switch2D(){this._sceneManager.switchTo2D()}switch3D(){this._sceneManager.switchTo3D()}switchToFirstPerson(){this._sceneManager.switchToFirstPerson()}exportGLB(){this._sceneManager.exportGLB()}importGLB(e){this._sceneManager.importGLB(e)}_initPromiseCallback(e,t){this._threeLoader.fetch().then(()=>{let t=this._scriptLoader.fetch(p,{id:"gltf-loader"}),n=this._scriptLoader.fetch(m,{id:"draco-loader"}),a=this._scriptLoader.fetch(W,{id:"tween-js"}),i=this._scriptLoader.fetch("static/Sky-6621935ea8a523af.js",{id:"sky-js"});Promise.all([t,n,a,i]).then(()=>{this._kernelReadyCallback=e;const{dls:t,ls:n,mode:a,stats:i}=this._initData;this._sceneManager||(this._sceneManager=new ie(this._creator_,se,this,a)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId);const s=u.createDynamicLightSettingSource(t,n);i&&this.showStats(),this.enableHD(s),this._planInteractionHandler&&this._kernelReadyCallback()})})}enableHD(e){return new Promise((t,n)=>{const a=()=>{this._sceneManager.enableHD(e),t()};this._threeLoader.fetch().then(()=>Promise.all(N.map(e=>this._scriptLoader.fetch(e,{id:e})))).then(()=>{this._scriptLoader.fetch(X,{id:"pi-js"}).then(a,n)},n)})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){c.showBenchmarks()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);t.import("./configurator-3c9aa61c.legacy.js").then((function(e){return e.c})).then(({Configurator:t})=>{const n=new t(this._creator_);n.boot({kernelInstance:this._planInteractionHandler.getConfiguratorKernel(),kernelContainer:this._plannerKernelAccess.kernelContainer}),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._hscInstance=n,e(this._hscInstance)})})});return this._backstack.bringIntoForeground(r.HSC),this.cancelSelection(),e}async switchToViewer(){const e=await this._singlePromiseFactory.create(4,"startGLB",e=>{if(this._glbInstance)return e(this._glbInstance);t.import("./glb-viewer-84c78e6f.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._backstack.bringIntoForeground(r.GLB),this.cancelSelection(),e}switchToPlanner(e){e&&this.loadPlan(e),this._backstack.bringIntoForeground(r.HSP)}updateSize(){this._sceneManager.updateCamera()}getMain(){}update(){this.updateSize(),this._glbInstance&&this._glbInstance.getApi().updateSize(),this._hscInstance&&this._hscInstance.getApi().updateSize()}get callbacks(){return this._roomlePlannerUiCallback}set callbacks(e){this._roomlePlannerUiCallback=e}showStats(){this._sceneManager.showStats()}onBackStackChanged(e){this._roomlePlannerUiCallback.onBackStackChanged(e)}onCloseHSC(){this._sceneManager.closeHSC(),this._hscInstance&&this._hscInstance.getApi().pauseKernelCallbacks()}back(){if(this._backstack.current()===r.GLB&&this._glbInstance&&this._glbInstance.getApi().clearScene(),this._backstack.current()===r.HSC&&this._hscInstance){const e=this._hscInstance.getApi();e.cancelSelection(),e.cancelDockings(),e.hideDimensions(),e.disableMultiselect(),this._sceneManager.updateScene()}this._backstack.back()}backTo(e){this._backstack.backTo(e)}getConfigurator(){return this._hscInstance}getCurrentSkin(){return this._rapiAccess.getCurrentSkin()}getRuntimeComponentIdOfRootComponent(e){return e?this._plannerKernelAccess.planInteractionHandler?this._plannerKernelAccess.planInteractionHandler.getConfiguratorKernel().getRootPlanComponentIdFromObjectId(e):(console.warn("Can not retrieve runtime id without planInteractionHandler"),0):(console.warn("Can not retrieve runtime id without planObjectId"),0)}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}loadError(e){}getPlanInteractionHandler(){return Promise.resolve(this._planInteractionHandler)}getPlanModelViewHelper(){return Promise.resolve(this._plannerKernelAccess.planModelViewHelper)}async insertObject(e,t,n){if(!this._planInteractionHandler)throw new Error("no plan interaction handler");t&&(t=s(new THREE.Vector3(t.x,t.y,t.z)));const a=await(g(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),i=await this._plannerKernelAccess.addPlanObjectFromItem(a,t,n);return this._sceneManager.updateScene(),i}async insertItemList(e){const t=e.map(e=>g(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),n=await Promise.all(t);await this._plannerKernelAccess.insertItems(n)}async insertItems(e){await this._plannerKernelAccess.insertItems(e)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getCameraOffset(){return this._sceneManager.getCameraOffset()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}async getObjects(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);let t=[];const n=[],a=[],i=w(e.objects);await Promise.all(i.map(async e=>{const i=w(e);if(i.catalogItemId?n.push(i.catalogItemId):i.configurationHash&&a.push(i.configurationHash),i.parts){const e=i.configurationHash||i.catalogItemId,t=await this._plannerKernelAccess.addUiDataAndPriceToPartList(i.parts,e);i.parts=t}i.data=null,t.push(i)}));const[s,r]=await Promise.all([this._rapiAccess.getItems(n),this._rapiAccess.getConfigurations(a)]),o=[],l=new Map;for(const e of s)l.set(e.id,e);for(const e of r)l.set(e.id,e),o.push(e.rootComponentId);const h=await this._rapiAccess.getComponents(o),c=new Map;for(const e of h)c.set(e.id,e);for(const e of t){const t=e.catalogItemId||e.configurationHash,n=l.get(t)||null;if(n&&!n.label&&c.has(n.rootComponentId)){const e=c.get(n.rootComponentId);n.label=e.label}n&&!n.label&&(n.label=t),e.data=n}return t}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return w(e)}prepareTopImage(e={}){return this._sceneManager.prepareTopImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}enableRotation(){this._sceneManager.enableRotation()}disableRotation(){this._sceneManager.disableRotation()}async dragInObject(e,t){this._sceneManager.dragIn(t);const n=await this._rapiAccess.getItem(e);this.insertItems([n])}enableSnapping(){this._planInteractionHandler.reactivateAllSnappingActivity()}disableSnapping(){this._planInteractionHandler.deactivateAllSnappingActivity()}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){var t,n;const a=this._planInteractionHandler;a.startInteraction();for(const i of e){const e=a.addNode(i.from),s=a.addNode(i.to),r=a.addWall(e,s);void 0!==(null===(t=i.props)||void 0===t?void 0:t.height)&&a.setWallHeight(r,i.props.height),void 0!==(null===(n=i.props)||void 0===n?void 0:n.thickness)&&a.setWallThickness(r,i.props.thickness)}a.endInteraction()}}return a([i],e.prototype,"_domHelper",void 0),a([i],e.prototype,"_scriptLoader",void 0),a([i],e.prototype,"_kernelAccessCallback",void 0),a([i],e.prototype,"_plannerKernelAccess",void 0),a([i],e.prototype,"_rapiAccess",void 0),a([i],e.prototype,"_singlePromiseFactory",void 0),a([i],e.prototype,"_roomlePlannerUiCallback",void 0),a([i],e.prototype,"_lifeCycleManager",void 0),a([i],e.prototype,"_backstack",void 0),a([i],e.prototype,"_threeLoader",void 0),a([i],e.prototype,"_dataSyncer",void 0),a([i],e.prototype,"_initData",void 0),a([i],e.prototype,"_globalInitData",void 0),a([i],e.prototype,"_unitFormatter",void 0),e})(),oe=(()=>{class e{constructor(e){this._initialStack=[],this._creator_=e,this._lifeCycleManager.addEventListener(this)}_setInitialStack(e){this._initialStack=[...e]}_setCallbacks(e){this._callbacks=e}_resetCanvasStack(){this._canvasStack=[...this._initialStack]}init(e,t){this._setInitialStack(e),this._resetCanvasStack(),this._setCallbacks(t)}bringIntoForeground(e){const t=this._domHelper.element.querySelectorAll("canvas");let n=!1;t.forEach(t=>{if(t.classList.contains(e)){if(!t.classList.contains("foreground")){const t=this.current();t&&e!==t&&(this._canvasStack.push(e),n=!0),t||(n=!0)}t.classList.remove("background"),t.classList.add("foreground")}else t.classList.remove("foreground"),t.classList.add("background")}),n&&this._callbacks.onBackStackChanged(this._canvasStack)}current(){return this._canvasStack[this._canvasStack.length-1]}back(){if(1===this._canvasStack.length)return;let e=this._canvasStack.pop();this.bringIntoForeground(this.current()),e===r.HSC&&this._callbacks.onCloseHSC(),this._callbacks.onBackStackChanged(this._canvasStack)}backTo(e){if(1!==this._canvasStack.length&&this.current()!==e)for(;this._canvasStack.length>0;){let t=this.current();if(t===e){this.bringIntoForeground(t);break}t===r.HSC&&this._callbacks.onCloseHSC(),this._canvasStack.pop(),this._callbacks.onBackStackChanged(this._canvasStack)}}pause(){this._resetCanvasStack()}resume(){}destroy(){}}return a([i],e.prototype,"_domHelper",void 0),a([i],e.prototype,"_lifeCycleManager",void 0),e})();class le{constructor(e){const{planElementViewModel:t}=e;this.planElementViewModel=t}}const he=[new v("script-loader",Y),new v("planner-input-manager",class extends Q{_canDrag(e){return!0}},1),new v("planner-kernel-access",A),new v("logger",E),new v("planner-mesh-generator",class extends ${constructor(e){super(e),this._wallMeshes=[],this._defaultMaterial=new THREE.MeshStandardMaterial({color:"#ffffff",roughness:1,metalness:0,opacity:1,envMap:null}),this._environmentLoader.setEnvMap(this._defaultMaterial)}generateGeometry(e=null,t,n,a,i,s=!1){let r;return r=s?this._generateGeometry(e,t,n,a,i).clone():this._generateGeometry(e,t,n,a,i),r}generateMesh(e=null,t,n,a,i,s,r,o=!1){const l=this.generateGeometry(e,n,a,i,s,o),h=new THREE.Mesh(l,this._previewMaterial);return h.layers.set(3),!t&&r&&7!==r.value?(console.warn("material is undefined"),h):(this.setMaterial(h,t,r).then(()=>{const e=r&&3===r.value;h.castShadow=!e}),this._checkWallMaterial(h,r),h)}async setMaterial(e,t,n){if(e.userData.material=S(t,n),e.userData.materialId=t,P(t))t?await this._assignMaterial(e,t):(console.warn("Used default material because material is empty"),this.changeMaterialOfMesh(e,this._defaultMaterial));else{if(!t)return void this.changeMaterialOfMesh(e,this._defaultMaterial);2===(t=t).getSourceType().value?await this._assignMaterial(e,t.materialId):1===t.getSourceType().value?await this._assignItem(e,t.catalogItemId):3===t.getSourceType().value?await this._assignRGB(e,t.rgbValue):0===t.getSourceType().value?this.changeMaterialOfMesh(e,this._defaultMaterial):(this.changeMaterialOfMesh(e,this._defaultMaterial),1!==n.value&&7!==n.value&&3!==n.value&&console.warn("Used default material because material is not supported",t))}}set maxAnisotropy(e){this._maxAnisotropy=e}_checkWallMaterial(e,t){t&&1===t.value&&(e.renderOrder=5,this._wallMeshes.push(e))}clear(){super.clear(),this.clearWallMeshes()}clearWallMeshes(){this._wallMeshes.forEach(e=>{f(e)}),this._wallMeshes=[]}get wallMeshes(){return this._wallMeshes}}),new v("rapi-access",M),new v("roomle-planner-ui-callback",class extends C{constructor(e){super(e),this.onItemsLoaded=()=>{},this.onBackStackChanged=e=>{},this.onCameraChanged=e=>{},this.onTotalFloorAreaChanged=e=>{},this.onPlanInteractionHandlerCreated=e=>{},this.onPlannerKernelIsReady=e=>{},this.onConfiguratorKernelIsReady=(e,t)=>{},this.onSelectionChange=(e,t,n,a)=>{},this.onSelectionCancel=()=>{},this.onPlanChanged=()=>{},this.onCompletelyLoaded=()=>{},this.onRotationCancel=()=>{},this.onHistoryChange=(e,t)=>{}}}),new v("configurator-ui-callbacks",B,1),new v("backstack",oe),new v("planner-selection-handler",class extends J{constructor(){super(...arguments),this._selectionMode="standard",this._selectedPlanElementViewModels=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}cancelSelection(){0!==this._selectedPlanElementViewModels.size&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new le({planElementViewModel:e}))})}_checkStandard(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new le({planElementViewModel:e}));this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new le({planElementViewModel:e}))}),this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new le({planElementViewModel:e}))}_checkMulti(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new le({planElementViewModel:e}));this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new le({planElementViewModel:e}))}setSelectionMode(e){this._selectionMode=e}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedPlanElementViewModels.size>0}getSelectedIds(){let e=[];return this._selectedPlanElementViewModels.forEach(t=>e.push(t.getId())),e}isSelected(e){return!!this._selectedPlanElementViewModels.get(e)}})];e("Planner",class extends Z{setupGlobals(){}setupDependencies(){b.setup(he),this.lookup("logger",this._context),this.lookup("planner-kernel-access",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._planner=new re(this._context),this._planner.getMain=()=>this,window.RoomlePlanner||(window.RoomlePlanner=this._planner)}getApi(){return this._planner}getContextName(){return"planner"}})}}}));
|
|
2
|
-
//# sourceMappingURL=planner-7cf4e52a.legacy.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
System.register(["./main-thread-to-worker-fb98950d.legacy.js"],(function(e,t){var n,s,r,o,i,a,l,c,h,d,u,p;return{setters:[function(e){n=e.b,s=e.g,r=e.M,o=e.h,i=e.s,a=e.w,l=e.o,c=e.R,h=e.d,d=e.c,u=e.e,p=e.u}],execute:function(){e({R:me,_:y,i:B});class g{constructor(){this._context=new Map,this._lookups=new Map,this._singletons=new Map}getContext(e){if(this._context.has(e)){const t=this._context.get(e);return this._context.set(e,t+1),e+t}return this._context.set(e,1),e+0}addDependencyInjectionAssignments(e){e.forEach(e=>{this._lookups.set(e.className,e)})}lookup(e,t){if(!this._lookups.has(e))return null;const n=this._lookups.get(e);if(1===n.type&&void 0===t){const t="Dependency "+e+" has definition context but no context was defined!";return console.trace(t),console.error(t),null}let s=t&&1===n.type?t:"global";if(s+="_"+e,2===n.type)return new n.classDefinition;if(this._singletons.has(s))return this._singletons.get(s);const r=new n.classDefinition(t);return this._singletons.set(s,r),r}cleanUp(e){if(e){let t=[];this._singletons.forEach((n,s)=>{s.startsWith(e)&&t.push(s)}),t.forEach(e=>{this._singletons.delete(e)})}else this._singletons.clear(),this._singletons=new Map}}class m{constructor(e,t,n){this.className=e,this.classDefinition=t,this.type=void 0===n?0:n}}e("e",m);const _={JPG:".jpg",JPEG:".jpeg",PNG:".png",GIF:".gif"};class f{_base64toBlob(e,t){t=t||"";const n=atob(e),s=n.length,r=Math.ceil(s/1024),o=new Array(r);for(let e=0;e<r;++e){let t=1024*e,r=Math.min(t+1024,s);const i=new Array(r-t);for(let e=t,s=0;e<r;++s,++e)i[s]=n[e].charCodeAt(0);o[e]=new Uint8Array(i)}return new Blob(o,{type:t})}_createFormData(e,t,n,s){const r=new FormData;-1!==e.indexOf(",")&&(e=e.substr(e.indexOf(",")+1));const o=-1===Object.keys(_).map(e=>_[e]).indexOf(n)?"application":"image",i=this._base64toBlob(e,o+"/"+n.substr(1));return r.append(s,i,t+n),r}create(e,t,n,s){return this._createFormData(e,t,n,s)}}
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */function y(e,t,n,s){var r,o=arguments.length,i=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(i=(o<3?r(i):o>3?r(t,n,i):r(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i}class w{constructor(){this._size=256,this._maxLod=0,this._encoding=THREE.LinearEncoding,this._type=THREE.UnsignedByteType,this._format=THREE.RGBAFormat,this._cubeTextures=[],this._lightDirection=new THREE.Vector3,this._path=""}setPath(e){this._path=e}load(e){return new Promise(t=>{(new THREE.FileLoader).setResponseType("arraybuffer").load(this._path+e,e=>{this.parseData_(e),t(this._cubeTexture)})})}parseHeader_(e){let t=new DataView(e,0,30);this._size=t.getUint16(0),this._maxLod=t.getUint8(2),this._encoding=t.getUint16(3),this._type=t.getUint16(5),this._format=t.getUint16(7),this._lightDirection.x=t.getFloat32(9),this._lightDirection.y=t.getFloat32(13),this._lightDirection.z=t.getFloat32(17)}parseBufferData_(e,t){let n=this._size;const s=Math.log2(this._size)+1;this._cubeTextures=[];for(let r=0;r<s;r++){let s=new THREE.CubeTexture;this._cubeTextures.push(s),s.format=THREE.RGBAFormat,s.encoding=this._encoding,s.type=this._type,s.minFilter=THREE.LinearMipMapLinearFilter,s.magFilter=THREE.LinearFilter,s.generateMipmaps=!1;for(let r=0;r<6;r++){let o=new Uint8Array(e,t,4*n*n),i=new THREE.DataTexture(o,n,n);i.format=s.format,i.encoding=s.encoding,i.type=s.type,i.generateMipmaps=!1,t+=4*n*n,s.images[r]=i,i.needsUpdate=!0}s.needsUpdate=!0,n/=2}this._cubeTexture=new THREE.CubeTexture,this._cubeTexture.format=THREE.RGBAFormat,this._cubeTexture.encoding=this._encoding,this._cubeTexture.type=this._type,this._cubeTexture.minFilter=THREE.LinearMipMapLinearFilter,this._cubeTexture.magFilter=THREE.LinearFilter,this._cubeTexture.generateMipmaps=!1;for(let e=0;e<6;e++){this._cubeTexture.image[e]=this._cubeTextures[0].images[e];for(let e=1;e<s;e++)this._cubeTexture.mipmaps[e-1]=this._cubeTextures[e],this._cubeTextures[e].needsUpdate=!0}this._cubeTexture.needsUpdate=!0,this._cubeTexture.maxLod=this._maxLod-1}convertToRGBABuffer(e){let t=new Uint8Array(e,30,e.byteLength-30),n=4;this._format===THREE.RGBFormat&&(n=3);const s=4*t.length/n;let r=new ArrayBuffer(s),o=new DataView(r),i=0,a=t.length/n;if(3===n)for(let e=0;e<a;e++)o.setUint8(i++,t[e]),o.setUint8(i++,t[e+a]),o.setUint8(i++,t[e+2*a]),o.setUint8(i++,255);else for(let e=0;e<a;e++)o.setUint8(i++,t[e]),o.setUint8(i++,t[e+a]),o.setUint8(i++,t[e+2*a]),o.setUint8(i++,t[e+3*a]);return r}parseData_(e){this.parseHeader_(e);let t=30;t=0;let n=this.convertToRGBABuffer(e);this.parseBufferData_(n,0)}}const E=e("t",(function(e){return e*(Math.PI/180)})),b=(e("v",(function(e,t,n,s,r,o){e=Math.sqrt(e*e+n*n);const i=r/o,a=2*Math.atan(Math.tan(s*Math.PI/180/2)*i)*180/Math.PI,l=E(s),c=t/2/Math.tan(l/2),h=e/(2*Math.atan(Math.PI*a/360));return Math.max(c,h)})),function(e){return Math.round(1e3*e)/1e3}),M=(e("M",(function(e,t){return Math.abs(e.y-t.y)+Math.abs(e.x-t.x)})),e("x",(function(e,t){return Math.atan2(t.y-e.y,t.x-e.x)})),e("w",(function(e){let t=function(e){return e*(180/Math.PI)}(e);return t<0&&(t=180+(180+t)),t})),e("X","#DDDDDD")),v=(e("a5",1),e("a6",0),e("Z",1)),C=(e("g",(e,t,n,s)=>{if(!e||!t||0===n||0===s)return new THREE.Vector3;let r=e.clone(),o=n/2,i=s/2;return r.project(t),r.x=Math.floor(r.x*o+o),r.y=Math.floor(-r.y*i+i),r.z=e.distanceTo(t.position),r}),e("k",(e,t)=>{t||(t=new THREE.Vector3(0,0,0));let n=new THREE.Vector3(e.size.x/1e3,e.size.z/1e3,e.size.y/1e3),s=new THREE.Vector3(e.origin.x/1e3,e.origin.z/1e3,e.origin.y/-1e3),r=new THREE.Vector3(0,0,-n.z).add(s).sub(t),o=new THREE.Vector3(n.x,n.y,0).add(s).add(t);return new THREE.Box3(r,o)}));e("b",e=>(e.from=e.from/1e3,e.to=e.to/1e3,1===e.type.value?(e.type={value:2},e.from*=-1,e.to*=-1):2===e.type.value&&(e.type={value:1}),e)),e("s",(e,t)=>{let n=b(e.x),s=b(e.y),r=b(e.z),o=b(t.x),i=b(t.y),a=b(t.z);return n===o&&s===i&&r===a}),e("K",(e,t)=>{let n=b(e.w),s=b(e.x),r=b(e.y),o=b(e.z),i=b(t.w),a=b(t.x),l=b(t.y),c=b(t.z);return n===i&&s===a&&r===l&&o===c}),e("u",(e,t)=>{let n=b(e.x),s=b(e.y),r=b(t.x),o=b(t.y);return n===r&&s===o});let T=null;const P=()=>{if(T)return T;const e=new Uint8Array(4);for(let t=0;t<1;t++){const n=4*t;e[n]=255,e[n+1]=255,e[n+2]=255,e[n+3]=255}const t=new THREE.DataTexture(e,1,1,THREE.RGBAFormat);return t.needsUpdate=!0,t},R=(e,t,n,s)=>{const r=new Uint8Array(4),o=Math.floor(255*e),i=Math.floor(255*t),a=Math.floor(255*n),l=Math.floor(255*s);for(let e=0;e<4;e++){const t=4*e;r[t]=o,r[t+1]=i,r[t+2]=a,r[t+3]=l}const c=new THREE.DataTexture(r,1,1,THREE.RGBAFormat);return c.needsUpdate=!0,c},I=(e("G",(e,t)=>I(null,e,t)),e("ac",(e,t,s)=>{if(e||(e=S()),e.name=t.id?t.id.toString():"",void 0!==t.shading.metallic&&(e.metalness=1===t.shading.metallic?1:.5,e.reflectivity=n(t.shading.metallic,.5)),t.shading.transmission&&t.shading.transmission>0?(e.transmission=t.shading.transmission,e.opacity=1,e.transparent=!0,e.depthWrite=!1,e.metalness=0):void 0!==t.shading.alpha&&t.shading.alpha<1&&(e.transparent=t.shading.alpha<1,e.opacity=t.shading.alpha,e.depthWrite=t.shading.alpha>=1),e.aoMapIntensity=n(t.shading.occlusion,1),e.roughness=n(t.shading.roughness,.5),e.alphaTest=n(t.shading.alphaCutoff,0),void 0!==t.shading.basecolor){const n=new THREE.Color(t.shading.basecolor.r,t.shading.basecolor.g,t.shading.basecolor.b);e.color.copy(n.convertSRGBToLinear())}return null==s||s.setEnvMap(e),t.shading.doubleSided?e.side=THREE.DoubleSide:e.side=THREE.FrontSide,e.map||(T||(T=P()),e.map=T),e})),S=()=>new THREE.MeshPhysicalMaterial({});e("ad",e=>{let t=e.color.clone().convertLinearToSRGB(),n={alpha:e.opacity,metallic:e.reflectivity,basecolor:{r:t.r,g:t.g,b:t.b},roughness:e.roughness,doubleSided:e.side===THREE.DoubleSide,alphaCutoff:e.alphaTest,transmission:e.transmission};return 1===e.metalness?n.metallic=1:n.metallic=e.reflectivity,n});let k=null;e("H",(e,t,n,s,r,o,i=16)=>(k||(k=new THREE.TextureLoader,k.crossOrigin=""),new Promise((a,l)=>{if(!e)return console.warn("trying to add a texture without image",t),void a();k.load(e,e=>{x(e,t,n,s,r,o,i),a()},l)})));const x=e("ae",(e,t,n,s,r,o,i=16)=>{e.anisotropy=s,e.wrapS=THREE.RepeatWrapping,e.wrapT=THREE.RepeatWrapping,"ORM"===t.mapping&&i<=8?console.warn("ORM maps are not supported on devices with only "+i+" texture units"):(e.repeat.set(r,o),"XYZ"===t.mapping?(n.normalMap=e,n.map===P()&&(n.map=null)):"ORM"===t.mapping?(n.aoMap=e,n.roughnessMap=e,n.metalnessMap=e):(e.encoding=THREE.sRGBEncoding,n.map=e),"RGBA"===t.mapping&&(n.transparent=!0),n.needsUpdate=!0)}),L=(e("J",(e=!0)=>window.dat&&window.dat.GUI?(window.__RML_GUI__||(window.__RML_GUI__=new dat.GUI({autoPlace:e})),window.__RML_GUI__):null),e("a8",(e,t,n=!0)=>{let s=e.getWorldDirection(new THREE.Vector3),r=Math.abs(s.y);r<.5&&!t.transparent&&L(t,!0,n),r>.5&&t.transparent&&L(t,!1,n)}),e("a9",(e,t,n=!0)=>{if(!e.userData.tween)if(t)if(e.transparent=!0,n){let t={opacity:1};e.userData.tween=!0,new TWEEN.Tween(t).to({opacity:.2},400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{e.opacity=t.opacity}).onComplete(()=>{e.userData.tween=!1}).start()}else e.opacity=.2;else if(n){let t={opacity:.2};e.userData.tween=!0,new TWEEN.Tween(t).to({opacity:1},400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{e.opacity=t.opacity}).onComplete(()=>{e.transparent=!1,e.userData.tween=!1}).start()}else e.opacity=1,e.transparent=!1})),A=(e("Y",e=>{let t=new THREE.Color;return t.setRGB((e>>16)/255,(e>>8&255)/255,(e>>0&255)/255),t}),e("c",(e,t)=>{e.traverse(e=>{if(e instanceof THREE.Mesh&&TWEEN){const n=e.material;e.userData.tween&&e.userData.tween.stop();const s={opacity:n.opacity};t.transparent&&(n.transparent=t.transparent),e.userData.tween=new TWEEN.Tween(s).to(t,250).easing(TWEEN.Easing.Linear.None).onUpdate(()=>{n.opacity=s.opacity}).onStop(()=>{t.transparent||(n.transparent=t.transparent),n.opacity=t.opacity,n.needsUpdate=!0,e.userData.tween=void 0}).onComplete(()=>{t.transparent||(n.transparent=t.transparent),n.needsUpdate=!0,e.userData.tween=void 0}).start()}})}),e("F",e=>{e.traverse(e=>{if(e instanceof THREE.Mesh&&TWEEN){let t=e.material;if(0===t.opacity)return;let n={opacity:0,transparent:!0},s={opacity:t.opacity,transparent:t.transparent};t.transparent=n.transparent,t.opacity=n.opacity,new TWEEN.Tween(n).to(s,500).easing(TWEEN.Easing.Linear.None).onUpdate(()=>{t.opacity=n.opacity}).onComplete(()=>{t.transparent=s.transparent}).start()}})}),e("a1",(e,t)=>{let n=(new THREE.Box3).setFromObject(e),s=n.getSize(new THREE.Vector3),r=Math.min(s.x,s.y,s.z),o=!0;return r>5&&(console.warn("GLB seems to be too big ("+r+")",t),o=!1),n.min.y<-.01&&(console.warn("GLB seems to be under the floor ("+n.min.y+"): ",t),o=!1),o}),e("d",e=>{"Mesh"===e.type?D(e):A(e)}),e=>{e&&e.children&&0!==e.children.length&&e.children.forEach(e=>{D(e)})}),D=e("a4",e=>{e&&(e.material&&F(e.material),e.geometry&&H(e.geometry),e.children&&e.children.length>0&&A(e))}),H=e=>{e&&e.dispose()},F=e=>{e&&(e.map&&e.map.dispose(),e.normalMap&&e.normalMap.dispose(),e.dispose())};let O;e("W",()=>(O||(O=new THREE.MeshBasicMaterial,O.visible=!1),O)),e("$",(e,t)=>{let n=t.x/2,s=t.z/2,r=new THREE.Vector3(-n,.01,s),o=[r,new THREE.Vector3(r.x,r.y,r.z+.2),new THREE.Vector3(r.x-.2,r.y,r.z+.2),new THREE.Vector3(r.x-.2,r.y,r.z)],i=[new THREE.Face3(3,2,0),new THREE.Face3(2,1,0)],a=new THREE.Geometry;return a.vertices.push(...o),a.faces.push(...i),a.computeFaceNormals(),a.computeVertexNormals(),a}),e("a3",e=>0===e.x&&0===e.y&&0===e.z),e("V",(e,t)=>{let n="";return e.materialId&&""!==e.materialId?n=e.materialId:e.catalogItemId&&""!==e.catalogItemId?n=e.catalogItemId:e.rgbValue>0?n="rbg"+JSON.stringify(e.rgbValue):e.length>0?n=e:t&&1===t.value?n="default_wall_material_"+e.getSourceType().value:t&&7===t.value&&(n="default_ceiling_material_"+e.getSourceType().value),n}),e("z",(e,t,n=.01)=>!(!e||!t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n),e("a",e=>{let t=e.getWorldDirection(new THREE.Vector3).clone();t.y=0,t.lengthSq()<.01&&(t=new THREE.Vector3(0,1,0),t.applyQuaternion(e.quaternion),t.y=0),t.normalize();let n=Math.asin(t.x);return t.z<0&&(n=Math.PI-n),n<0&&(n+=2*Math.PI),n});const U=function(e){return e.startsWith("_")&&(e=e.substr(1)),e.replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(function(e,t){return(t>0?"-":"")+e.toLowerCase()}))};function B(e,t){const n=Symbol("property-cache");Object.defineProperty(e,t,{get(){if(!this[n]){const e=window.__RML__DI__.lookup(U(t),this._creator_);e?this[n]=e:console.error("Dependency "+U(t)+" not found! Add dependency to /utils/injectables.ts")}return this[n]}})}let j=e("af",(()=>{class e{constructor(e){this._hdrCubeUrl="static/roomle-91862a5e7f3f46e5.envmap",this._hdrCubeUrlLowres="static/roomle64-adb0f447a54b5143.envmap",this._envMapReader=new w,this._creator_=e;const t=new THREE.Color(M);this._environmentMap=((e,t,n,s)=>{const r=new THREE.CubeTexture;r.format=THREE.RGBAFormat,r.generateMipmaps=!1;for(let o=0;o<6;++o){const i=R(e,t,n,s);i.format=r.format,i.type=r.type,i.minFilter=r.minFilter,i.magFilter=r.magFilter,i.generateMipmaps=r.generateMipmaps,i.needsUpdate=!0,r.images[o]=i}return r.needsUpdate=!0,r})(t.r,t.g,t.b,v),this._envMapReader.setPath(s()),this._loadHDREnvMap(this._hdrCubeUrlLowres)}static setEnvironmentMap(e,t){e&&t&&(e.envMap=t,e.envMapIntensity=1,e.needsUpdate=!0)}getEnvironmentMap(){return this._environmentMap}_processPMREM(e){const t=new THREE.PMREMGenerator(this._renderer);let n=t.fromCubemap(e);return e.magFilter=THREE.LinearFilter,e.needsUpdate=!0,t.dispose(),n.texture}_loadHDREnvMap(e){return this._initData.disableEnvMap?Promise.resolve():new Promise(t=>{this._envMapReader.load(e).then(n=>{n.encoding=THREE.sRGBEncoding;const s=this._renderer.extensions.get("EXT_shader_texture_lod");this._environmentMap=s?this._processPMREM(n):n,e!==this._hdrCubeUrl&&(this._environmentMap.encoding=THREE.sRGBEncoding,window.requestIdleCallback(this._loadHDREnvMap.bind(this,this._hdrCubeUrl))),this._updateEnvironmentMap(),t(),this._envChangedCallback&&this._envChangedCallback()})})}setRendererAndScene(e,t){this._renderer=e,this._scene=t}registerEnvironmentChangedCallback(e){this._envChangedCallback=e}_updateEnvironmentMap(){this._initData.disableEnvMap||this._scene.traverse(t=>{t instanceof THREE.Mesh&&(t.material instanceof THREE.MeshStandardMaterial||"MeshPhysicalMaterial"===t.material.type)&&e.setEnvironmentMap(t.material,this._environmentMap)})}setEnvMap(t){this._initData.disableEnvMap||e.setEnvironmentMap(t,this.getEnvironmentMap())}}return y([B],e.prototype,"_initData",void 0),e})());const G=e("P",{SOFA:"sofa",SHELF:"shelf",SHELF_FRONT:"shelf_front",BAKED:"baked",CAMERA:"camera",EQUAL:"equal"});class V{static createDynamicLightSettingSource(e,t){let n={};if(e)n.url=e;else if(t)switch(t){case G.SHELF:n.url=s()+"static/shelf-2975dd3f2fa9c763.json";break;case G.SHELF_FRONT:n.url=s()+"static/shelf_front-8c9566a4512f0de8.json";break;case G.SOFA:n.url=s()+"static/sofa-997b116bc5f2e92e.json";break;case G.BAKED:n.url=s()+"static/baked-6485a2b1daeb69e8.json";break;case G.CAMERA:n.url=s()+"static/camera-f4cef679615485dc.json";break;case G.EQUAL:n.url=s()+"static/equal-319f6b83c827913f.json";break;default:n.url=s()+"static/camera-f4cef679615485dc.json"}else n=null;return n}parse(e){let t=JSON.parse(e);return t.lights?this.load(t):[]}load(e){let t=[];return e.lights?(e.lights.forEach(e=>{let n;switch(e.type){case"ambient":n=this._parseAmbientLight(e);break;case"rectarea":n=this._parseRectAreaLight(e);break;case"spot":n=this._parseSpotLight(e);break;case"directional":n=this._parseDirectionalLight(e)}n&&t.push(n)}),t):[]}_parseAmbientLight(e){let t=new THREE.AmbientLight;return this._parseCommon(t,e),t}_parseRectAreaLight(e){let t=new THREE.RectAreaLight;this._parseCommon(t,e);let{intensity:n,castShadow:s,target:r,width:o,height:i}=e;return t.width=o||.8,t.height=i||.8,t.castShadow=s||!1,t.matrixAutoUpdate=!0,t.intensity=(n||240)/((o||.8)*(i||.8)),t.lookAt(r?new THREE.Vector3(r.x,r.y,r.z):new THREE.Vector3(0,0,0)),t}_parseSpotLight(e){let t=new THREE.SpotLight;this._parseCommon(t,e);let{angle:n,penumbra:s,target:r,castShadow:o}=e;return t.angle=(n||100)*Math.PI/180,t.penumbra=s||.5,t.lookAt(r?new THREE.Vector3(r.x,r.y,r.z):new THREE.Vector3(0,0,0)),t.shadow.camera.near=.1,t.shadow.camera.far=10,t.shadow.mapSize=new THREE.Vector2(1024,1024),t.castShadow=o||!1,t}_parseDirectionalLight(e){let t=new THREE.DirectionalLight;this._parseCommon(t,e);let{target:n,castShadow:s}=e;return t.castShadow=s||!1,t.shadow.camera.near=.1,t.shadow.camera.far=100,t.shadow.mapSize=new THREE.Vector2(1024,1024),t.shadow.bias=-5e-5,t.lookAt(n?new THREE.Vector3(n.x,n.y,n.z):new THREE.Vector3(0,0,0)),t}_parseCommon(e,t){let{name:n,intensity:s,color:r,position:o,movesWithCamera:i}=t;e.name=n||"",e.intensity=s||1,e.color=new THREE.Color(r||"#ffffff"),e.position.copy(o?new THREE.Vector3(o.x,o.y,o.z):new THREE.Vector3(0,0,0)),e.visible=!0,e.layers.set(1),e.userData.movesWithCamera=i}}e("D",V);const N=["127.0.0.1","localhost","0.0.0.0"],z=(e("m",(function(e){return!(!e||"string"!=typeof e||e.split(":").length>2)})),e("l",e=>{if(!e||"string"!=typeof e)return null;const t=e.split(":");return t.length<2?null:t[0]})),W=({articleNr:e,componentId:t})=>e&&""!==e?t.split(":")[0]+":"+e:null,K=(e,t)=>null!=e?"string"==typeof e?"true"===e:!0===e:("string"==typeof t&&(t=parseInt(t,10)),t>=200&&t<300);class q{constructor(){this._queue=[],this._pendingRequests=0}_nextSlot(){if(this._pendingRequests-=1,!this._queue.length)return;const{request:e,resolve:t,reject:n}=this._queue.shift();this._fetch(e).then(t,n)}_fetch(e,t={}){return this._pendingRequests+=1,new Promise((n,s)=>{self.fetch(e,t).then(function(e){if(this._nextSlot(),K(e.ok,e.status))n(...arguments);else{const t=(null==e?void 0:e.url)||"URL unknown";s(new Error(e.statusText||'Http error "'+(e&&e.status?e.status:"unknown")+'", for "'+t+'"'))}}.bind(this),e=>{this._nextSlot(),s(e)})})}fetch(e,t={}){return this._pendingRequests>=40?new Promise((t,n)=>this._queue.push({request:e,resolve:t,reject:n})):this._fetch(e,t)}}class J{info(...e){console}log(...e){console}warn(...e){console.warn.apply(console,e)}error(...e){console.warn.apply(console,e)}}e("L",J);let Q=(()=>{class e extends J{constructor(e){super(),this._creator_=e}setMeta(e){this._meta=e}get meta(){return this._meta?this._meta:{}}throw(e){const t="[Kernel Exception]: "+e;this._globalCallback.onKernelMsg("exception",e,this.meta),this.error(t)}error(e){this._globalCallback.onKernelMsg("error",e,this.meta),super.error(e)}warn(e){this._globalCallback.onKernelMsg("warning",e,this.meta),super.warn(e)}}return y([B],e.prototype,"_globalCallback",void 0),e})();const Z=new Map,$=new Map,X=new Map,Y=new Map;let ee=e("h",(()=>{class e{constructor(e){this._bootCallbacks=[],this._isStarted=!1,this._isStarting=!1,this._alwaysUseCache=!1,this._creator_=e}start(e){return this._configuratorUiCallbacks.onSyncStarted(),this._startWorker().then(()=>this._handleCatalog(e)).then(()=>{const{typeChangeTag:e,floorMaterialsTag:t}=this._initData;Promise.all([this._syncFloorTag(t),this._syncTypeChangeTag(e)]).then(()=>{Y.set(e,!0),this._configuratorUiCallbacks.onSyncDone()})})}syncCatalog(e){return this._startWorker().then(()=>this._handleCatalog(e))}syncFloorTag(e){return this._startWorker().then(()=>this._syncFloorTag(e))}syncTypeChangeTag(e){return this._startWorker().then(()=>this._syncTypeChangeTag(e))}_syncFloorTag(e){const t=[];return e&&!X.get(e)?(t.push(this._handleTags([e])),this._rapiAccess.getTag(e).then(e=>{t.push(this._handleMaterialsAndTextures(e))}),this._singlePromiseFactory.create(1,e,n=>{Promise.all(t).then(()=>{X.set(e,!0),n()},e=>this._softReject(n,'_syncFloorTag error: "'+e+'"'))})):Promise.resolve()}_syncTypeChangeTag(e){const t=[];return e&&!Y.get(e)?(t.push(this._handleTags([e])),this._rapiAccess.getTag(e).then(e=>{this._rapiAccess.getItems(e.items).then(e=>{e.forEach(e=>{this.getIsCatalogSynced(e.catalog)&&t.push(this._handleCatalog(e.catalog))})})}),this._singlePromiseFactory.create(2,e,n=>{Promise.all(t).then(()=>{X.set(e,!0),n()},e=>this._softReject(n,'_syncTypeChangeTag error: "'+e+'"'))})):Promise.resolve()}getIsCatalogSynced(e){return!!$.get(e)}_startWorker(){return new Promise((e,t)=>{if(this._isStarted)return e();this._bootCallbacks.push({resolve:e,reject:t}),this._isStarting||(this._worker=new Worker(s()+"static/asset-loader.worker-796c70f59b977071.js"),this._mainThreadToWorker=new r(this,this._worker),this._isStarting=!0,this._mainThreadToWorker.sendToWorker(1))})}onCommand(e,t,n){switch(e){case 4:this._isStarted=!0,this._bootCallbacks.forEach(({resolve:e})=>e());break;case 3:this._mainThreadToWorker.resolvePromises(t,n)}}_handleCatalog(e){return this._singlePromiseFactory.create(0,e,t=>this.getIsCatalogSynced(e)?t():this._rapiAccess.getCatalog(e).then(e=>Promise.all([this._handleContentWithAssets(this._rapiAccess.getComponentsOf(e),["perspectiveImage"]),this._handleItemsAndAdditionalContents(e),this._handleMaterialsAndTextures(e),this._handleExternalMeshes(e),this._handleTags(e.tags)])).then(()=>{$.set(e,!0),t()},e=>this._softReject(t,'Catalog sync error: "'+e+'"')))}_handleTags(e){return this._handleContentWithAssets(this._rapiAccess.getTags(e),["pngIcon","svgIcon"])}_handleExternalMeshes(e){return new Promise(t=>{this._rapiAccess.getMeshesOfCatalog(e.id).then(e=>{const n=[];e.forEach(e=>{n.push(this._handleContentWithAssets(Promise.all([this._rapiAccess.getMesh(e.id)]),["url"]))}),Promise.all(n).then(t,e=>this._softReject(t,'Sync crt files error: "'+e+'"'))},e=>this._softReject(t,'getMeshesOfCatalog error: "'+e+'"'))})}_handleItemsAndAdditionalContents(e){return new Promise(t=>{this._rapiAccess.getItemsOf(e).then(e=>{const n=[];n.push(this._handleContentWithAssets(Promise.resolve(e),["perspectiveImage"])),this._rapiAccess.getAdditionalContentsOfItems(e).then(e=>{const t=e.filter(e=>-1!==[5,6,4].indexOf(e.type));n.push(this._handleContentWithAssets(Promise.resolve(t),["content"]))},e=>this._softReject(t,'getAdditionalContentsOfItems error: "'+e+'"')),Promise.all(n).then(t,e=>this._softReject(t,'AdditionalContent image sync error:"'+e+'"'))})})}_handleMaterialsAndTextures(e){return new Promise(t=>{this._rapiAccess.getMaterialsOf(e).then(e=>{const n=[];n.push(this._handleContentWithAssets(Promise.resolve(e),["thumbnail"])),e.forEach(e=>{n.push(this._handleContentWithAssets(this._rapiAccess.getTexturesOf(e),["image"]))}),Promise.all(n).then(t,e=>this._softReject(t,'getTexturesOf error: "'+e+'"'))},e=>this._softReject(t,'getMaterialsOf error: "'+e+'"'))})}_handleContentWithAssets(e,t){return new Promise(n=>e.then(e=>this._fetchAssets(e,t).then(n,e=>this._softReject(n,'_handleContentWithAssets error: "'+e+'"')),e=>this._softReject(n,'_handleContentWithAssets promise error: "'+e+'"')))}_fetchAssets(e,t){const n=[];e||(e=[]);for(let s=0,r=e.length;s<r;s++){const r=e[s];t.forEach(e=>{const t=r[e];t&&n.push(this._preCacheAsset(t))})}return Promise.all(n)}_preCacheAsset(e){return new Promise(t=>{if(Z.get(e))return t();this._assetUrlToBase64(e).then(n=>{Z.set(e,n),t()},e=>this._softReject(t,'_preCacheAsset error: "'+e+'"'))})}_assetUrlToBase64(e){return new Promise(t=>{this._mainThreadToWorker.sendToWorker(5,e,t,e=>this._softReject(t,'_assetUrlToBase64 error: "'+e+'"'))})}_softReject(e,t){this._errorHandler.softReject(e,t,2)}requestAsset(e,t=!1){return navigator.onLine&&!this._alwaysUseCache?e:Z.get(e)||(t?e:null)}setAlwaysUseCache(e){this._alwaysUseCache=e}preFillAssetCache(e,t){Z.set(e,t)}}return y([B],e.prototype,"_rapiAccess",void 0),y([B],e.prototype,"_singlePromiseFactory",void 0),y([B],e.prototype,"_errorHandler",void 0),y([B],e.prototype,"_configuratorUiCallbacks",void 0),y([B],e.prototype,"_initData",void 0),e})());class te{constructor(e){this.info=e,this._init()}_init(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}resolve(e){e&&this._resolve(e),this._resolve()}reject(e){this._reject(e)}wait(){return this._promise}reset(){this._init()}}e("y",te);var ne=e("aa","static/GLTFLoader-5b296b5fb14cfe1a.js"),se=e("ab","static/DRACOLoader-5edeeab4a8dbc0bd.js");const re={"draco_wasm_wrapper.js":"static/draco_wasm_wrapper-d775f9f135cb30ff.js","draco_decoder.wasm":"static/draco_decoder-979e668167e37c95.wasm","draco_decoder.js":"static/draco_decoder-3866672a1fa2f980.js"};let oe=(()=>{class e{constructor(e){if(this._gltfLoaderGuard=new te,this._creator_=e,THREE.GLTFLoader&&THREE.DRACOLoader)this._initLoaders();else{let e=this._scriptLoader.fetch(ne,{id:"gltf-loader"}),t=this._scriptLoader.fetch(se,{id:"draco-loader"});Promise.all([e,t]).then(()=>this._initLoaders())}}_initLoaders(){this._gltfLoader=new THREE.GLTFLoader;const e=new THREE.DRACOLoader;if("function"!=typeof e._loadLibrary)throw new Error("Can not patch draco loader! Did three.js update the DracoLoader example?");const t=e._loadLibrary.bind(e._loadLibrary);e._loadLibrary=(e,n)=>{const r=re[e];if(!r)throw new Error('Can not load draco dependency "'+e+'" did three.js update DracoLoader lib? Available files'+JSON.stringify(re));return t(s()+r,n)},this._gltfLoader.setDRACOLoader(e),this._gltfLoaderGuard.resolve(this._gltfLoader)}async loadGLB(e,t,n,s,r,o,i,a){return await this._gltfLoaderGuard.wait(),new Promise((l,c)=>{this._gltfLoader.load(e,e=>{l(this._handleGLTFScene("GLB",e,t,n,s,r,o,i))},e=>{a&&a(e.loaded/e.total)},e=>{c(e)})})}async loadGLTF(e,t,n,s,r,o,i,a){return await this._gltfLoaderGuard.wait(),new Promise((l,c)=>{this._gltfLoader.parse(e,null,e=>{l(this._handleGLTFScene("GLTF",e,t,n,s,r,o,i))},e=>{a&&a(e.loaded/e.total)},e=>{c(e)})})}_handleGLTFScene(e,t,n,s,r,o,i,a){if(!t||!t.scene||!t.scene.children||0===t.scene.children.length)return null;if(n&&t.scene.position.copy(n),s&&(t.scene.rotation.y=s),r){const e=new THREE.Box3;e.setFromObject(t.scene);const{x:n,y:s,z:o}=e.getSize(new THREE.Vector3);let i=new THREE.Vector3(r.x/n,r.y/s,r.z/o);t.scene.scale.copy(i)}return o&&t.scene.scale.multiply(o),t.scene.type=e,t.scene.traverse(e=>{if(e instanceof THREE.Mesh){if(e.layers.set(3),e.material instanceof THREE.MeshStandardMaterial){const t=e.material;if(this._environmentLoader.setEnvMap(t),a&&i&&i>0){let e=new THREE.Color(i);t.color=e.copyGammaToLinear(e),t.roughness=.5,t.metalness=.1}t.needsUpdate=!0}e.castShadow=!0,e.receiveShadow=!0}}),t.scene}}return y([B],e.prototype,"_environmentLoader",void 0),y([B],e.prototype,"_scriptLoader",void 0),e})(),ie=(()=>{class e{constructor(e){this._jsonLoaded=!1,this._creator_=e}_loadShaders(){return new Promise((e,t)=>{if(this._jsonLoaded)return e();this._networkLayer.fetch(s()+"static/shaders-fae3c3c610b4a3d8.json",{credentials:"same-origin"}).then(o,t).then(t=>{window._rsl=t,this._jsonLoaded=!0,e()},t)})}fetch(){return window._rsl||(window._rsl={}),new Promise((e,t)=>this._loadShaders().then(()=>{this._scriptLoader.fetch("static/rthree-508a6ceb9a1516ce.js",{id:"three-lib"}).then(e,t)},t))}}return y([B],e.prototype,"_scriptLoader",void 0),y([B],e.prototype,"_networkLayer",void 0),e})(),ae=(()=>{class e{constructor(e){this._context_=e}getStore(e="rml_default"){return this._localStorage.getItem(e)||{entries:[]}}saveStore(e,t){this._localStorage.setItem(e,t)}addItem(e,t,n="rml_default",s=5){const r=this.getStore(n),o=r.entries.find(t=>t.id===e);if(o?(o.payload=t,o.date=Date.now()):r.entries.push({id:e,date:Date.now(),payload:t}),r.entries.length>s)for(r.entries.sort((e,t)=>t.date-e.date);r.entries.length>s;)r.entries.pop();this.saveStore(n,r)}getItem(e,t="rml_default"){const n=this.getStore(t).entries.find(t=>t.id===e);return n?n.payload:null}}return y([B],e.prototype,"_localStorage",void 0),e})();class le{set(e,t){t&&(void 0!==t.enableAA&&(e.enableAA=t.enableAA),this._setSAOPass(e,t),this._setShadowPass(e,t),this._setGroundShadow(e,t))}_setSAOPass(e,t){if(t.SAOPass){const n=t.SAOPass;void 0!==n.enabled&&(e.getSAOPass().enabled=n.enabled),void 0!==n.smoothTransition&&(e.getSAOPass().smoothTransition=n.smoothTransition),n.occlusionWorldRadius&&(e.getSAOPass().occlusionWorldRadius=n.occlusionWorldRadius),n.intensity&&(e.getSAOPass().intensity=n.intensity),n.bias&&(e.getSAOPass().bias=n.bias),n.numSamples&&(e.getSAOPass().numSamples=n.numSamples)}}_setShadowPass(e,t){if(t.shadowPass){const n=t.shadowPass;void 0!==n.enabled&&(e.getShadowPass().enabled=n.enabled),void 0!==n.smoothTransition&&(e.getShadowPass().smoothTransition=n.smoothTransition),void 0!==n.enableAccumulation&&(e.getShadowPass().enableAccumulation=n.enableAccumulation),n.shadowRadius&&(e.getShadowPass().shadowRadius=n.shadowRadius),n.shadowBiasMultiplier&&(e.getShadowPass().shadowBiasMultiplier=n.shadowBiasMultiplier),n.numSamples&&(e.getShadowPass().numSamples=n.numSamples)}}_setGroundShadow(e,t){if(t.groundShadow){const n=t.groundShadow;void 0!==n.enable&&(e.getShadowPlanePass().enable=n.enable),void 0!==n.smoothTransition&&(e.getShadowPlanePass().smoothTransition=n.smoothTransition),n.numSamples&&(e.getShadowPlanePass().numSamples=n.numSamples),n.numSamplesPerFrame&&(e.getShadowPlanePass().numSamplesPerFrame=n.numSamplesPerFrame)}}}e("N",le);const ce=e("T",e=>new THREE.Vector3(e.x/1e3,e.z/1e3,e.y/-1e3)),he=(e("a0",e=>new THREE.Vector3(e.x/1e3,e.z/1e3,e.y/1e3)),e("a7",e=>({x:1e3*e.x,y:-1e3*e.z,z:1e3*e.y}))),de=e=>decodeURIComponent(encodeURIComponent(e)),ue=e("q",e=>{if(!e){const t=typeof e;return"number"===t||"boolean"===t?e:null}if(!e.hasOwnProperty("size")&&e.size&&"function"==typeof e.size){let t=pe(e);for(let e=0;e<t.length;e++)t[e]=ue(t[e]);return"string"==typeof t?de(t):t}if("object"==typeof e)for(let t in e)e.hasOwnProperty(t)&&(e[t]=ue(e[t]));return"string"==typeof e?de(e):e}),pe=e=>{let t=[];if(e){let n=e.size();for(let s=0;s<n;s++)t.push(e.get(s))}return t},ge=e=>{let t=new THREE.Matrix4,n=ue(e);return t.fromArray(n),t.transpose(),(e=>{let t=new THREE.Matrix4;t.set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),t.scale(new THREE.Vector3(.001,.001,.001));let n=new THREE.Matrix4;return n.set(1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1),n.scale(new THREE.Vector3(1e3,1e3,1e3)),t.multiply(e).multiply(n)})(t)};function me(){class e extends THREE.Object3D{constructor(e,t,n,s){super(),this._selected=!1,this.geometryChanged=!0,this.meshes=[],this.castShadow=!1,this.receiveShadow=!0,this._setValues(e,t,n,s)}static _generateOutline(e,t){let n=new THREE.LineSegments(new THREE.EdgesGeometry(e),new THREE.LineDashedMaterial({color:"#000000",dashSize:.03,gapSize:.01,linewidth:1}));return n.translateOnAxis(t,1),n.userData.ignoreComponentRaycast=!0,n}static cloneDockLine(e,t){let n=new THREE.LineSegments(e.geometry,e.material);return n.translateOnAxis(t.getCenter(new THREE.Vector3),1),n.name="dockline",n.layers.set(5),n.userData.ignoreComponentRaycast=!0,n}_setValues(e,t,n,s){e&&(this.runtimeId=e,this.name=e.toString()),t&&(this.roomlePosition=Object.assign({},t)),n&&(this.roomleRotation=Object.assign({},n)),s&&(this.parentObjectId=s)}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 THREE.Mesh(e.geometry,e.material))})}addMesh(e,t){e.renderOrder=2,e.userData.meshType=0,t&&e.applyMatrix4(ge(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),D(e),t<0||this.meshes.splice(t,1)}removeAllMeshes(e=!0){this.meshes.forEach(t=>{this.remove(t),e&&D(t)}),this.meshes=[],this._removeLoadingMesh(),this.remove(this._boundingBoxMesh),D(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:n}=this._kernelBoundingBox.getSize(new THREE.Vector3);let s=new THREE.BoxGeometry(e,t,n);this._loadingMesh=new THREE.Mesh(s,new THREE.MeshStandardMaterial({transparent:!0,opacity:v,color:new THREE.Color(M)})),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 THREE.Vector3),1),this._loadingMesh.renderOrder=3,this.add(this._loadingMesh)}_removeLoadingMesh(){this._loadingMesh&&(this.remove(this._loadingMesh),D(this._loadingMesh),this._loadingMesh=null)}loadingFinished(){this._removeLoadingMesh(),this._showAllMeshes()}deselect(){this._selected=!1}hoverOn(){i("pointer")}hoverOff(){i("default")}removeFromParent(){this.parent&&(this.parent.remove(this),this.removeAllMeshes())}computeBoundingBox(t,n=!1){if(this._boundingBoxMesh&&this.remove(this._boundingBoxMesh),!n&&t&&0===t.size.x&&0===t.size.y&&0===t.size.z)return;let s;if(!t||n){this._boundingBox=new THREE.Box3;let e=new THREE.Vector3;this.meshes.forEach(t=>{if(t.geometry instanceof THREE.Geometry){let n=t.geometry.vertices;for(let s=0,r=n.length;s<r;s++)e.copy(n[s]),e.applyMatrix4(t.matrix),this._boundingBox.expandByPoint(e)}else if(t.geometry instanceof THREE.BufferGeometry){let n=t.geometry.attributes.position;if(void 0!==n)for(let s=0,r=n.count;s<r;s++)e.fromBufferAttribute(n,s).applyMatrix4(t.matrix),this._boundingBox.expandByPoint(e)}}),this._kernelBoundingBox=this._boundingBox.clone();let t=this._boundingBox.max.x-this._boundingBox.min.x,n=this._boundingBox.max.y-this._boundingBox.min.y,r=this._boundingBox.max.z-this._boundingBox.min.z;s=new THREE.BoxGeometry(t,n,r)}else{this._kernelBoundingBox=C(t),this._boundingBox=this._kernelBoundingBox.clone();let{x:e,y:n,z:r}=this._boundingBox.getSize(new THREE.Vector3);s=new THREE.BoxGeometry(e,n,r)}this._boundingBoxMesh=new THREE.Mesh(s,new THREE.MeshStandardMaterial({color:"#FFFFFF",transparent:!0,opacity:0,polygonOffset:!0,polygonOffsetFactor:-1,visible:!1})),this._boundingBoxMesh.name="bounding box mesh";let r=this._boundingBox.getCenter(new THREE.Vector3);this._boundingBoxMesh.position.add(r),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,r),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(n=>{n instanceof e&&t.push(...n.recursiveMeshes())}),t}isChild(t){let n=!1;return this.children.forEach(s=>{s instanceof e&&!n&&(n=s.runtimeId===t||s.isChild(t))}),n}getKernelPosition(e){let t=this.parent.localToWorld(this.position);return he(e.worldToLocal(t))}}class t extends e{constructor(e,t){super(e,null,null,null),this.glbUrl=t}}class n extends e{constructor(e,t,n,s){super(e,t,n,s),this._stringId=null,this.receivedPointAssociation=!1,this.castShadow=!1,this.receiveShadow=!1}get stringId(){return this._stringId?this._stringId:this.runtimeId.toString()}addMesh(e,t){super.addMesh(e,t),e.material instanceof THREE.MeshStandardMaterial&&(e.material.opacity=.6,e.material.roughness=1,e.material.metalness=0,e.material.color=new THREE.Color("#DDDDDD")),e.renderOrder=1,e.castShadow=!1,e.receiveShadow=!1}hoverOn(){this.remove(this._dockline),this.meshes.forEach(({material:e})=>{e.opacity=.9,e.roughness=1,e.metalness=0,e.color=new THREE.Color("#DDDDDD")}),i("pointer")}hoverOff(){this.add(this._dockline),this.meshes.forEach(({material:e})=>{e.opacity=.6,e.roughness=1,e.metalness=0,e.color=new THREE.Color("#DDDDDD")}),i("default")}clonePreview(t){const s=new n(this.runtimeId,this.roomlePosition,this.roomleRotation,this.parentObjectId);return s._stringId=this.runtimeId+"_"+t,this.children.forEach(e=>{e instanceof THREE.Mesh&&0===e.userData.meshType&&s.meshes.push(e.clone(!0))}),s.meshes.forEach(e=>{e.material=e.material.clone(),e.geometry=e.geometry.clone(),s.add(e)}),this._dockline&&(s._dockline=e.cloneDockLine(this._dockline,this._boundingBox)),this._boundingBoxMesh&&(s._boundingBoxMesh=this._boundingBoxMesh.clone(!0)),this._boundingBox&&(s._boundingBox=this._boundingBox.clone()),s}preparePreview(){this.add(this._dockline),this.add(this._boundingBoxMesh)}}class s extends n{constructor(e,t,n,s,r){super(e,t,n,s),r&&(this._stringId=this.runtimeId+"_has_additional_dock_point_copy")}set roomleLineFrom(e){this._roomleLineFrom=e,this.lineFrom=ce(e)}get roomleLineFrom(){return this._roomleLineFrom}set roomleLineTo(e){this._roomleLineTo=e;let t=ce(e);t.equals(this.lineFrom)&&(console.warn("lineFrom and lineTo are equal!"),t.add(new THREE.Vector3(0,.01,0))),this.lineTo=t}get roomleLineTo(){return this._roomleLineTo}set roomlePositionFrom(e){this._roomlePositionFrom=e,this.positionFrom=ce(e)}get roomlePositionFrom(){return this._roomlePositionFrom}set roomlePositionTo(e){this._roomlePositionTo=e;let t=ce(e);t.equals(this.positionFrom)&&(console.warn("positionFrom and positionTo are equal!"),t.add(new THREE.Vector3(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,i("pointer")}hoverOff(){this._dockline.visible=!1,i("default")}preparePreview(){super.preparePreview(),this._dockline.visible=!1;let e=this.lineTo.clone(),t=this.lineFrom.clone();const n=(new THREE.Vector3).subVectors(e,t);let s=n.length(),r=n.normalize(),o=new THREE.ArrowHelper(r,t),i=new THREE.CylinderGeometry(.01,.01,s,16,1);this.lineMesh=new THREE.Mesh(i,new THREE.MeshStandardMaterial({color:M,transparent:!0,opacity:.4})),this.lineMesh.name="line mesh";const a=(new THREE.Quaternion).setFromEuler(o.rotation);this.lineMesh.quaternion.multiply(a),this.lineMesh.renderOrder=1;let l=(new THREE.Vector3).addVectors(e,t).multiplyScalar(.5);this.lineMesh.position.copy((new THREE.Vector3).subVectors(l,this.position.clone())),this.add(this.lineMesh);let c=this._boundingBox.getCenter(new THREE.Vector3).applyEuler(this.docklineRotation),h=null,d=0,u=Math.abs(r.x),p=Math.abs(r.y),g=Math.abs(r.z);u>=p&&u>=g?(h=new THREE.Vector3(c.x,0,0),d=Math.sqrt(c.y*c.y+c.z*c.z)):p>=u&&p>=g?(h=new THREE.Vector3(0,c.y,0),d=Math.sqrt(c.x*c.x+c.z*c.z)):g>=p&&g>=u&&(h=new THREE.Vector3(0,0,c.z),d=Math.sqrt(c.y*c.y+c.x*c.x)),d=d>0?d:.01;let m=(new THREE.Vector3).subVectors(this.positionTo.clone(),this.positionFrom.clone()).length()+h.length(),_=new THREE.CylinderGeometry(1.1*d,1.1*d,m,32,1);this.boundingLineMesh=new THREE.Mesh(_,new THREE.MeshStandardMaterial({color:"#ffffff",transparent:!0,opacity:0})),this.boundingLineMesh.name="bounding line mesh",this.boundingLineMesh.userData.ignoreComponentRaycast=!0;let f=this.positionTo.clone(),y=this.positionFrom.clone(),w=(new THREE.Vector3).subVectors(f,y).normalize(),E=new THREE.ArrowHelper(w,y);const b=(new THREE.Quaternion).setFromEuler(E.rotation);this.boundingLineMesh.quaternion.multiply(b),this.boundingLineMesh.renderOrder=3;let v=(new THREE.Vector3).addVectors(this.positionTo.clone(),this.positionFrom.clone()).multiplyScalar(.5).add(c);this.boundingLineMesh.position.copy((new THREE.Vector3).subVectors(v,this.position.clone())),this.add(this.boundingLineMesh)}clonePreviewLine(t){let n=new s(this.runtimeId,this.roomlePosition,this.roomleRotation,this.parentObjectId,this.receivedPointAssociation);return n._stringId=this.runtimeId+"_"+t,this.children.forEach(e=>{e instanceof THREE.Mesh&&0===e.userData.meshType&&n.meshes.push(e.clone(!0))}),n.meshes.forEach(e=>{e.material=e.material.clone(),e.geometry=e.geometry.clone(),n.add(e)}),this._dockline&&(n._dockline=e.cloneDockLine(this._dockline,this._boundingBox)),this._boundingBoxMesh&&(n._boundingBoxMesh=this._boundingBoxMesh.clone(!0)),this._boundingBox&&(n._boundingBox=this._boundingBox.clone()),n}getPositionForIntersectionPoint(e){let t=this._boundingBox.getCenter(new THREE.Vector3).applyEuler(this.docklineRotation),n=this.positionTo.clone().add(t),s=this.positionFrom.clone().add(t),r=new THREE.Line3(s,n).closestPointToPoint(e,!0,new THREE.Vector3);return(isNaN(r.x)||isNaN(r.y)||isNaN(r.z))&&r.copy(e),r.sub(t)}updatePreviewPosition(e){let t=this.getPositionForIntersectionPoint(e),n=this.parent.localToWorld(t);this._newPosition=this.worldToLocal(n);let s=this._boundingBox.getCenter(new THREE.Vector3).applyEuler(this.docklineRotation);this._dockline.position.copy((new THREE.Vector3).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 he(e.worldToLocal(t))}return super.getKernelPosition(e)}}class r extends THREE.PerspectiveCamera{constructor(e,t,n,s,r){super(e,t,n,s),r||(r={left:0,top:1,right:1,bottom:0}),this.offset=r}set offset(e){this._offset=e,this.updateProjectionMatrix()}get offset(){return this._offset}_calculateProjectionMatrix(){let e,t,n,s,r=this.fov*(2*Math.PI/360)/2;n=Math.tan(r),s=-n;let o=Math.atan(this.aspect*Math.tan(r));t=Math.tan(o),e=-t;let i=this._offset.left,a=this._offset.right,l=this._offset.top,c=this._offset.bottom,h=new THREE.Vector2(a-i,l-c),d=new THREE.Vector2(i+h.x/2,c+h.y/2);if(h.x<h.y){let r=(1-d.x)/(h.x/2),o=d.x/(h.x/2);t*=r,e*=o;let i=(r+o)/2;n*=i,s*=i}else{let r=(1-d.y)/(h.y/2),o=d.y/(h.y/2);n*=r,s*=o;let i=(o+r)/2;e*=i,t*=i}e*=this.near,t*=this.near,n*=this.near,s*=this.near;let u=this.near*Math.tan(Math.PI/180*.5*this.fov)/this.zoom*2,p=this.aspect*u;return this.view&&this.view.enabled&&(e+=this.view.offsetX*p/this.view.fullWidth,n-=this.view.offsetY*u/this.view.fullHeight,t+=this.view.offsetX*p/this.view.fullWidth,s-=this.view.offsetY*u/this.view.fullHeight),(new THREE.Matrix4).makePerspective(e,t,n,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,n,s,r){return new e(t,n,s,r)},createPreview:function(e,t){return new n(e,{x:0,y:0,z:0},{x:0,y:0,z:0},t)},createStatic:function(e,n){return new t(e,n)},createPreviewLine:function(e){let t=new s(e.id,e.roomlePosition,e.roomleRotation,e.parentObjectId,e.receivedPointAssociation);return e.meshes.forEach(e=>{let n=e.clone();n.material=e.material.clone(),n.geometry=e.geometry.clone(),t.addMesh(n)}),t.computeBoundingBox(),t},isPreview:function(e){return e instanceof n},isPreviewLine:function(e){return e instanceof s},createCamera:function(e,t,n,s,o){return new r(e,t,n,s,o)}}}const _e=new Map,fe=function(e,t,n){let s=_e.get(e);if(s){const r=n?[n]:void 0;s.forEach(({resolve:e,reject:n})=>t?e.apply(e,r):n.apply(n,r)),_e.delete(e)}};class ye{static finishOperation(e,t){fe(e,!0,t)}static failOperation(e,t){fe(e,!1,t)}static waitFor(e,t){return new Promise((n,s)=>{let r=_e.get(e);r||(_e.set(e,[]),r=_e.get(e)),r.push({resolve:n,reject:s}),"function"==typeof t&&t.apply(t)})}}e("n",ye);const we=new Map;class Ee{static start(e){if(!window.performance||!window.performance.getEntriesByName)return"";let t=window.performance.getEntriesByName(e).length++,n="";t<100&&(n="0"),t<10&&(n="0"+n);const s=t>0?e+"_"+n+t:e,r=s+"_start";return window.performance.mark(r),s}static addMeta(e,t){const n=Ee.getMeta(e);we.set(e,Object.assign(n,t))}static getMeta(e){return we.get(e)||{}}static end(e){}static getMeasure(e){return[]}static showBenchmarks(e){const t=window.performance.getEntriesByType("measure");t.sort((function(e,t){return e.startTime-t.startTime}));const n=[];for(let s=0,r=t.length;s<r;s++){const r=t[s];e&&-1===r.name.indexOf(e)||n.push({Start:parseFloat(r.startTime.toFixed(2)),Name:r.name,Duration:parseFloat(r.duration.toFixed(2))})}console.table(n)}}e("B",Ee);var be={isProduction:!0,isUnitTesting:!1,environment:"production",detailEnvironment:"development",features:{},APP:{RAPI:{server:"/api/v2",localReverseProxy:"https://www.roomle.com/api/v2",liveServer:"https://www.roomle.com/api/v2",testServer:"https://www.test.roomle.com/api/v2",headers:{apiKey:"roomle_portal_v2",currentTenant:9,locale:"en",language:"en",device:1,token:"anonymous",platform:"web"},itemHeaders:{assetRevision:"glb",assetFileFormat:"glb"}},SHORTENER_URL:"http://rml.co/"},environments:{PRODUCTION:"production",DEVELOPMENT:"development",TEST:"test",TEST_SERVER:"test_server",ALPHA:"alpha"}};void 0!==t&&t.exports||(window.IS_DEBUG=!0),function(e=!1){if(e){let e=JSON.parse(JSON.stringify(be));e.APP,e.features}}();const Me=JSON.parse(JSON.stringify(be));var ve=e("E",Me);const Ce=e("o",(function(e){return e.validRange&&"string"==typeof e.validRange.type})),Te=function(e){return e.validValues&&e.validValues.length>0},Pe=function(e){return"length"===e.unitType||"area"===e.unitType},Re=e("p",(function(e){return"Material"===e.type}));let Ie,Se,ke,xe,Le;const Ae={WASM:{CONFIGURATOR:{URL:"static/ConfiguratorKernel-7756e36b06f7bf28.wasm",LOADER:"static/ConfiguratorKernel-b3f9bde09ca9cb82.js"},PLANNER:{URL:"static/RoomleCore-5f8e907bc2dc0222.wasm",LOADER:"static/RoomleCore-c036b1e6afc8afc5.js"}},ASM:{CONFIGURATOR:{MEM_URL:"static/ConfiguratorKernelJs-79cc0493453b6298.mem",LOADER:"static/ConfiguratorKernelJs-f63bcabaeb5c2d42.js"},PLANNER:{MEM_URL:"static/RoomleCoreJs-06aa24e348172ab6.mem",LOADER:"static/RoomleCoreJs-c5865e6e3207c3f1.js"}}},De=!!window.WebAssembly;e("O",(()=>{class e{constructor(e,t){this._requestedMaterialIds=[],this._configuratorKernelCallbackListener=new Set,this._cachedGroupIds=[],this._waitingForGroups=!1,this._subComponentsWaiters=new Map,this._shouldWait=!0,this._creator_=e,this._setupKernelPaths(t),this._setupEmsModule(t),this._useWASM=De,this._kernelPath=De?ke:xe,window.KernelCallback={isReady:this.isReady.bind(this)},this._lifeCycleManager.addEventListener(this)}_utilityToLongArray(e){const t=new this._kernelContainer.LongArray;return e.forEach(e=>t.push_back(e)),t}get kernelContainer(){return this._kernelContainer}get kernelInstance(){return this._kernelInstance}_setupKernelPaths(e){const t=0===e?"PLANNER":"CONFIGURATOR";Ie=Ae.ASM[t].MEM_URL,Se=Ae.WASM[t].URL,ke=Ae.WASM[t].LOADER,xe=Ae.ASM[t].LOADER,Le=!0}_setupEmsModule(e){const t=this;this._kernelContainer={locateFile(t){const n=0===e?/RoomleCoreJs[\-a-z0-9]*\.js\.mem/:/ConfiguratorKernelJs[\-a-z0-9]*\.js\.mem/;return t.match(n)?s()+Ie:t},wasmBinaryFile:s()+Se,preRun:[],postRun:[],setStatus:null,print(e){t._kernelIo.log(e)},printErr(e){t._kernelIo.error(e)},quit(e){t._kernelIo.throw(e)}},Le&&De&&(this._kernelContainer.instantiateWasm=function(e,t){return((e,t,n)=>{const r="function"==typeof WebAssembly.instantiateStreaming;Ee.addMeta("kernel_is_ready",{cachedInIndexedDB:!1});let o=null;r?(Ee.start("kernel_stream_compile"),o=WebAssembly.instantiateStreaming(fetch(s()+e),t),Ee.end("kernel_stream_compile")):(Ee.start("kernel_legacy_compile"),o=fetch(s()+e).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,t))),Ee.addMeta("kernel_is_ready",{instantiateStreaming:r}),o.then(e=>{Ee.end(r?"kernel_stream_compile":"kernel_legacy_compile"),n(e.instance)},e=>console.error(e))})(Se,e,t),{}})}_passSubComponentsToKernel(e,t){const n=e.id,s=t.get(n);if(s)for(let t=0,r=s.length;t<r;t++){const{parentId:r,partId:o}=s[t];this._kernelIo.setMeta({componentId:n}),this._kernelInstance.loadedSubComponent(r,o,n,e.configuration)}}_fetchSubComponents(e){let t=[...e.keys()];t.length&&this._rapiAccess.getComponents(t).then(t=>{for(let n=0,s=t.length;n<s;n++)this._passSubComponentsToKernel(t[n],e);this._flushSubComponentsWaiters()})}_flushSubComponentsWaiters(){this._fetchSubComponents(this._subComponentsWaiters),this._subComponentsWaiters=new Map,this._shouldWait=!1}isReady(){this._kernelContainer.setExternalHelpers(this._kernelIo,{convertCObject:ue}),ve.isProduction||ve.isUnitTesting||this.addDebugInfo(),window.KernelCallback&&(window.KernelCallback=null,delete window.KernelCallback),this._unitFormatter.init(this._kernelContainer)}addDebugInfo(){const e=function(t,n=[]){const s=Object.getPrototypeOf(t),r=s?Object.getOwnPropertyNames(s):[],o=t?Object.getOwnPropertyNames(t):[];return s?e(s,[...n,...o,...r]):[...o,...r,...n]},t=e(this),n=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toString","valueOf"];[...new Set(t)].forEach(e=>{if(!e.startsWith("_")&&"function"==typeof this[e]&&-1===n.indexOf(e))try{const t=this[e].bind(this);this[e]=function(...n){return this._kernelIo.log("[ KernelCommunication ]: "+e),t(...n)}}catch(e){}})}getConfigurationData(e){return new Promise(t=>{var n;const s=this.kernelInstance.getPlanObject(e),r=(new Date).toISOString(),o=this.kernelInstance.getComponentId(e),i=z(o),a=(null===(n=s.boxForMeasurement)||void 0===n?void 0:n.size)||s.bounds;t({created:r,lastAccess:r,configuration:this.kernelInstance.getSerializedConfiguration(e),configurationHash:this.kernelInstance.getHashOfConfiguration(e),parts:JSON.stringify(this.kernelInstance.getPartList(e)),rootComponentId:o,width:a.x,height:a.z,depth:a.y,catalog:i,orderable:!1,requestable:!1})})}loadComponent(e,t,n){this._rapiAccess.getComponent(t.componentId).then(s=>{var r;let o=s.configuration;o||(o="error",null===(r=this._configuratorUiCallbacks)||void 0===r||r.onContentProblem({rapiPath:"components",ids:[t.componentId],message:t.componentId+" has no configuration"})),this._kernelIo.setMeta({componentId:t.componentId}),this._kernelInstance.loadComponent(e,o,t,n),this._flushSubComponentsWaiters()},s=>{var r;this._kernelInstance.loadComponent(e,"error",t,n),this.onLoadComponentError(s,t.componentId),null===(r=this._configuratorUiCallbacks)||void 0===r||r.onError(new Error(`Component with id "${t.componentId}" can not be loaded. "${s}"`)),this._flushSubComponentsWaiters()})}loadSubComponent(e,t,n){if(this._shouldWait){let s=this._subComponentsWaiters.get(n);s||this._subComponentsWaiters.set(n,[]),s=this._subComponentsWaiters.get(n),s.push({parentId:e,partId:t}),this._subComponentsWaiters.set(n,s)}else this._rapiAccess.getComponent(n).then(s=>{var r;let o=s.configuration;o||(o="error",null===(r=this._configuratorUiCallbacks)||void 0===r||r.onContentProblem({rapiPath:"components",ids:[n],message:"SubComponent "+n+" has no configuration"})),this._kernelIo.setMeta({componentId:n,parentId:e}),this._kernelInstance.loadedSubComponent(e,t,n,o)})}requestDeleteComponent(e){e&&this._kernelInstance.deleteComponent(e)}dockComponentWithPosition(e,t,n,s,r){var o;this._kernelInstance.dockComponentWithPosition(n,s,e,t,r);const i=this._kernelInstance.getComponentId(n),a=this._kernelInstance.getComponentId(e);null===(o=this._configuratorUiCallbacks)||void 0===o||o.onUserInitiatedDockDone(i,s,a,t,r)}Editor3dAddBakedMesh(e,t,n,s,r,o,i){this._configuratorKernelCallbackListener.forEach(a=>a.Editor3dAddBakedMesh(e,t,n,s,r,o,i))}Editor3dAddNamedMesh(e,t,n,s,r,o,i,a,l,c){this._configuratorKernelCallbackListener.forEach(h=>h.Editor3dAddNamedMesh(e,t,n,s,r,o,i,a,l,c))}Editor3ChangedNamedMesh(e,t,n,s,r){this._configuratorKernelCallbackListener.forEach(o=>o.Editor3ChangedNamedMesh(e,t,n,s,r))}Editor3dRemoveNamedMesh(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.Editor3dRemoveNamedMesh(e,t))}Editor3dBeginConstruction(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.Editor3dBeginConstruction(e,t))}Editor3dEndConstruction(e){this._configuratorKernelCallbackListener.forEach(t=>t.Editor3dEndConstruction(e))}Editor3dComponentCreated(e,t,n,s){this._configuratorKernelCallbackListener.forEach(r=>r.Editor3dComponentCreated(e,t,n,s,!1))}Editor3dComponentDocked(e,t,n,s){this._configuratorKernelCallbackListener.forEach(r=>r.Editor3dComponentDocked(e,t,n,s))}Editor3dGeometryReady(e){this._configuratorKernelCallbackListener.forEach(t=>t.Editor3dGeometryReady(e)),this.requestPlanComponentConstruction(e)}Editor3dGeometryNotReady(e){this._configuratorKernelCallbackListener.forEach(t=>t.Editor3dGeometryNotReady(e))}componentDeleted(e){this._configuratorKernelCallbackListener.forEach(t=>t.componentDeleted(e))}componentMetaUpdated(e){let t=this._kernelInstance.getComponent(e);this._configuratorKernelCallbackListener.forEach(e=>e.componentMetaUpdated(t))}sceneCleared(){this._configuratorKernelCallbackListener.forEach(e=>e.sceneCleared())}requestMaterialsInGroup(e){-1===this._cachedGroupIds.indexOf(e)&&this._cachedGroupIds.push(e),this._waitingForGroups||(this._waitingForGroups=!0,ye.waitFor(4).then(()=>{this._rapiAccess.getMaterialsByGroup(this._cachedGroupIds).then(e=>{e.forEach(e=>{const t=new this._kernelContainer.StringArray;e.materials.forEach(e=>t.push_back(e.id));const n=e.legacyId||e.id;e.legacyId||console.warn("Material group has no legacy id, please check content why this is the case"),this._kernelInstance.setMaterialsInGroup(n,t)}),this._cachedGroupIds=[]},e=>{var t;console.error(e),null===(t=this._configuratorUiCallbacks)||void 0===t||t.onError(new Error(`Material group with ids "${this._cachedGroupIds.join(",")}" can not be loaded. "${e}"`)),this._cachedGroupIds=[]})}))}requestPlanComponentConstruction(e){this._kernelInstance.requestDeltaPlanComponentConstruction(e)}addConfiguratorListener(e){this._configuratorKernelCallbackListener.add(e)}removeConfiguratorListener(e){this._configuratorKernelCallbackListener.delete(e)}cleanUpCallbacks(){"function"==typeof this._kernelContainer.unregisterConfiguratorCallback&&this._kernelContainer.unregisterConfiguratorCallback(this)}async requestMaterialProperties(e){if(this._requestedMaterialIds.push(e),await a(0),!this._requestedMaterialIds.length)return;const t=[...this._requestedMaterialIds];this._requestedMaterialIds=[],(await this._rapiAccess.getMaterials(t)).forEach(e=>{const t=new this._kernelContainer.StringStringMap,n=e.properties||{};for(let e in n)n.hasOwnProperty(e)&&t.set(e,n[e]);t.size()&&this._kernelInstance.setMaterialProperties(e.id,t)})}registerCallbacks(){this._kernelContainer.registerConfiguratorCallback(this)}pause(){this.cleanUpCallbacks()}resume(){this.cleanUpCallbacks(),this.registerCallbacks()}destroy(){}_handleCortoMesh(e,t,n){var s;try{this._kernelInstance.addMeshCorto(t,n,new Uint8Array(e))}catch(e){console.error(e),null===(s=this._configuratorUiCallbacks)||void 0===s||s.onMemoryCorruption()}}_calcPrice(){const e=new Map;if(this._initData.useRoomlePrice){let e=this._kernelInstance.getFullPartList();if(e&&e.fullList&&e.fullList.length){const t=e.fullList[0].currencySymbol,n=e.fullList.reduce((e,t)=>e+(t.count?t.count:0)*(t.price?t.price:0),0);this._configuratorUiCallbacks.onUpdatePrice(t,n)}}else if(this._initData.usePriceService){let t=this._kernelInstance.getFullPartList();if(t&&t.fullList&&t.fullList.length){const n=t.fullList.reduce((t,n)=>{const s=W(n);return s&&(e.set(s,n),t.push(s)),t},[]);return new Promise((s,r)=>{this._rapiAccess.getPrices(n).then(n=>{if(!n.length)return r(new Error("prices are empty"));const o=l(n,"priceId");let i=0;return t.fullList.forEach(e=>{const t=W(e);if(!o.has(t))return void console.warn("PriceId: "+t+" has no corresponding kernel-part");const{price:n,currencySymbol:s}=o.get(t);e.price=n,e.currencySymbol=s,i+=n*e.count}),this._configuratorUiCallbacks.onUpdatePrice(n[0].currencySymbol,i),s({totalSum:i,partMap:e})},e=>{console.error(e),r(e)})})}}return Promise.resolve({totalSum:0,partMap:e})}async addUiDataAndPriceToPartList(e,t){const{fullList:n,originPart:s}=e,r=e.perMainComponent;let o;this.addUiDataToPartList(n,t);try{const e=await this._calcPrice();o=e.partMap}catch(e){console.error(e),o=new Map}const i=this._initData.usePriceService||this._initData.useRoomlePrice,a=e=>{i||(e.price=null,e.currencySymbol=null);const t=W(e);if(!t)return;if(!o.has(t))return;const{price:n,currencySymbol:s}=o.get(t);"number"==typeof n&&(e.price=n,e.currencySymbol=s)};return n.forEach(a),r.forEach(({fullList:e,perMainComponent:n})=>{n.length>0&&console.error("Not implemented! perMainComponent is deeper than one level"),this.addUiDataToPartList(e,t),e.forEach(a)}),{fullList:n,perMainComponent:r,originPart:s}}addUiDataToPartList(e,t){const n=[];return e.forEach(e=>{const t=this._rapiAccess.peekComponent(e.componentId);!t||e.labelIsCalculated&&e.label||(e.label=t.label),e.parameters.forEach(e=>{if(this._unitFormatter.formatPartListParameter(e),Re(e)){const t=this._rapiAccess.peekMaterial(e.value);t?e.valueLabel=t.label||t.name||e.value:-1===n.indexOf(e.value)&&n.push(e.value)}})}),n.length&&this._rapiAccess.getMaterials(n).then(e=>{const n=this._lastPartListHash!==t;Array.isArray(e)&&e.length&&n&&(this._lastPartListHash=t,this.requestPartListAndUpdatePricesOfParts())}),e}async requestPartListAndUpdatePricesOfParts(e,t){let n=this._kernelInstance.getFullPartList();e||(e=this._kernelInstance.getHashOfConfiguration(this._configuratorContext.planObjectId));const s=await this.addUiDataAndPriceToPartList(n,e);this._configuratorUiCallbacks.onPartListUpdate(s,btoa(e))}}return y([B],e.prototype,"_rapiAccess",void 0),y([B],e.prototype,"_scriptLoader",void 0),y([B],e.prototype,"_kernelIo",void 0),y([B],e.prototype,"_dataSyncer",void 0),y([B],e.prototype,"_lifeCycleManager",void 0),y([B],e.prototype,"_configuratorUiCallbacks",void 0),y([B],e.prototype,"_globalCallback",void 0),y([B],e.prototype,"_initData",void 0),y([B],e.prototype,"_unitFormatter",void 0),y([B],e.prototype,"_configuratorContext",void 0),y([B],e.prototype,"_globalInitData",void 0),e})());const He=e("Q",10);e("j",9);let Fe=e("a2",(()=>{class e{constructor(e){this._mergeThreshold=3,this._componentsToMerge=new Oe,this._mergeInProgress=!1,this._components=new Map,this._previews=new Map,this._creator_=e,this._getKernelAccess().addConfiguratorListener(this),this._componentFactory=me()}get materialQueue(){return this.getMeshGenerator().materialQueue}_getKernelAccess(){return Qe.lookup("kernel-access",this._creator_)}clearReference(){this._getKernelAccess().removeConfiguratorListener(this)}_addMeshToSubPart(e,t,n,s,r,o,i,a){let l=this._generateMesh(e,t,n,r,o,i,a);s&&l.applyMatrix4(ge(s)),this._subPartObject.add(l)}_addMeshToComponent(e,t,n,s,r,o,i,a,l,c){if(this._subPartGuard&&this._subPartGuard.info===e)return void this._addMeshToSubPart(e,null,s,null,o,i,a,l);const h=this.getComponent(e);if(!h)return;const d=this._componentFactory.isPreview(h),u=this._generateMesh(e,n,d?null:s,o,i,a,l);u.userData.meshId=t,u.userData.geometryId=n,u.userData.materialId=s,r&&(u.userData.transform=ge(r),u.applyMatrix4(u.userData.transform)),d&&u.layers.set(4),h&&h.addMesh(u),h.meshes.length>this._mergeThreshold&&this._componentsToMerge.set(e,h.meshes.length)}_changeMeshOfComponent(e,t,n,s,r){const o=this.getComponent(e);if(!o)return;const i=o.getMeshById(t);i&&(i.userData.geometryId!==n&&console.warn("Geometry of mesh has changed!"),i.userData.materialId=s,this._configuratorMeshGenerator.setMaterial(i,s),r&&(i.userData.transform=ge(r),i.position.set(0,0,0),i.scale.set(1,1,1),i.rotation.set(0,0,0),i.applyMatrix4(i.userData.transform)))}_removeMeshFromComponent(e,t){const n=this.getComponent(e);n&&n.removeMeshById(t)}getComponent(e){let t=this._components.get(e);return t||(t=this._previews.get(e.toString()),t)?t:(console.warn("component not found!",e),null)}tryToMergeComponents(){this._initData.moc||this._mergeInProgress||(this._mergeInProgress=!0,this._componentsToMerge.size,this._requestMergeComponents())}_requestMergeComponents(){window.requestIdleCallback(this._mergeNextComponent.bind(this))}_mergeNextComponent(){if(this._componentsToMerge.size>0){const e=this._componentsToMerge.largestValue();this._componentsToMerge.delete(e),this._mergeComponent(e),this._requestMergeComponents()}else this._mergeInProgress=!1,this._geometriesMerged&&this._geometriesMerged(),this._components.forEach(e=>{e.loadingMesh&&console.warn("component still has loading mesh: ",e.hash)})}_mergeComponent(e){const t=this._components.get(e);if(t&&!(t.meshes.length<=this._mergeThreshold))if(this._cacheHolder.componentCache.has(t.hash)){const e=this._cacheHolder.componentCache.get(t.hash).meshes;t.replaceMeshes(e)}else{const e=new Map,n=[],s=[];t.meshes.forEach(t=>{const r=t.userData.material;if(!r)return void console.warn("mesh has no material id set");if(!e.has(r)){const s=new THREE.Mesh(new THREE.Geometry,t.material);s.userData.material=r,s.receiveShadow=!0,s.castShadow=!0,s.layers.set(3),this._setMaterial(s,r),n.push(s),e.set(r,s)}const o=e.get(r).geometry;t.userData.transform?o.merge(t.geometry,t.userData.transform):o.merge(t.geometry),s.push(t)}),n.forEach(e=>t.addMesh(e)),s.forEach(e=>t.removeMesh(e)),this._cacheHolder.componentCache.set(t.hash,t)}}_addRootComponent(e){this._listener&&this._listener.display(e)}removeDockingComponent(){this._getKernelAccess().requestDeleteComponent(this._configuratorContext.dockingRootComponentId),this._configuratorContext.dockingRootComponentId=null}dockComponent(e,t,n,s){let r=this._components.get(t),o=this._components.get(e);o&&(o.roomlePosition=n,o.roomleRotation=s,r&&r.add(o))}dockComponentWithPosition(e,t){let n,s=this._components.get(e.parentId);n=t?t.getKernelPosition(s):e.getKernelPosition(s);const r=Ee.start("dock_component_with_position_"+e.childId);this._getKernelAccess().dockComponentWithPosition(e.parentId,e.parentDockId,e.childId,e.childDockId,n),this._configuratorContext.dockingRootComponentId=null,Ee.end(r)}removePreviews(){this._previews.size>0&&(this._previews.forEach(e=>{e.removeFromParent(),e.removeAllMeshes()}),this._previews.clear())}_updatePlanObject(e){const t=this._components.get(e.rootPlanComponentId);let n=!0;t&&(n=t.geometryChanged),this._listener&&this._listener.planObjectUpdated(e,n)}Editor3dAddBakedMesh(e,t,n,s,r,o,i){this._addMeshToComponent(e,null,null,t,null,n,s,r,o,i)}Editor3dAddDockPreview(e,t){let n=this._componentFactory.createPreview(t,e);this._previews.set(t.toString(),n)}Editor3dAddNamedMesh(e,t,n,s,r,o,i,a,l,c){this._addMeshToComponent(e,t,n,s,r,o,i,a,l,c)}Editor3ChangedNamedMesh(e,t,n,s,r){this._changeMeshOfComponent(e,t,n,s,r)}Editor3dRemoveNamedMesh(e,t){this._removeMeshFromComponent(e,t)}Editor3dBeginConstruction(e,t){if(!t){const t=this._components.get(e);t&&t.removeAllMeshes()}this._subPartGuard&&e===this._subPartGuard.info&&(this._subPartObject=new THREE.Object3D)}Editor3dComponentCreated(e,t,n,s,r){r&&(this._configuratorContext.rootComponentId=e);let o=null;this._components.has(e)?(o=this._components.get(e),o.removeAllMeshes()):(o=this._componentFactory.create(e,t,n,s),o.layers.set(3)),this._components.set(e,o),r&&this._addRootComponent(o)}Editor3dComponentDocked(e,t,n,s){this.dockComponent(e,t,n,s)}Editor3dEndConstruction(e){if(this._subPartGuard&&this._subPartGuard.info===e)return void this._subPartGuard.resolve(this._subPartObject);const t=this._getKernelAccess().kernelInstance.getComponent(e),n=this._components.get(e);n&&(n.computeBoundingBox(t.boxForMeasurement),n.boundingBoxMesh&&this._listener&&this._listener.addComponentHandlers(n));let s=this._previews.get(e.toString());s&&s.computeBoundingBox(t.boxForMeasurement,!0)}Editor3dGeometryReady(e){const t=this._components.get(e);t&&t.loadingFinished()}Editor3dGeometryNotReady(e){const t=this._components.get(e);t&&t.loading()}Editor3dPlanObjectConstructionDone(e){const t=this._getKernelAccess().kernelInstance.getPlanObject(e),n=[t,this._getKernelAccess().kernelInstance.getFullPartList(),this._getKernelAccess().kernelInstance.getHashOfConfiguration(e),this._getKernelAccess().kernelInstance.getComponentId(t.rootPlanComponentId)];ye.finishOperation(2,n),this._updatePlanObject(t),this._listener&&this._listener.planObjectConstructionDone(t)}Editor3dPreviewConstructionDone(e,t){let n=!1;this._previews.forEach(e=>{null!==e.parent&&(this._listener&&(this._componentFactory.isPreviewLine(e)?this._listener.addPreviewLineHandlers(e):this._listener.addPreviewHandlers(e)),n=!0)}),this._listener&&this._listener.previewConstructionDone(this._components.get(e),n)}Editor3dSetPreviewLineAssociations(e,t){let n=this._previews.get(t.toString());if(n.clear(),!n)return;let s=this._componentFactory.createPreviewLine(n),r=this._components.get(this._configuratorContext.rootComponentId);for(let t=0;t<e.length;t++){let n;n=0===t?s:s.clonePreviewLine(t),n.name="Preview Line",n.parentDockId=e[t].parentDockId,n.parentId=e[t].parentId,n.childDockId=e[t].childDockId,n.childId=e[t].childId,n.docklineRotation=(o=e[t].rotation,new THREE.Euler(o.x,o.z,-o.y)),n.roomlePosition=e[t].position,e[t].lineFrom.x>e[t].lineTo.x||e[t].lineFrom.y>e[t].lineTo.y||e[t].lineFrom.z>e[t].lineTo.z?(n.roomleLineFrom=e[t].lineTo,n.roomleLineTo=e[t].lineFrom):(n.roomleLineFrom=e[t].lineFrom,n.roomleLineTo=e[t].lineTo),e[t].positionFrom.x>e[t].positionTo.x||e[t].positionFrom.y>e[t].positionTo.y||e[t].positionFrom.z>e[t].positionTo.z?(n.roomlePositionFrom=e[t].positionTo,n.roomlePositionTo=e[t].positionFrom):(n.roomlePositionFrom=e[t].positionFrom,n.roomlePositionTo=e[t].positionTo),r.add(n),n.preparePreview(),this._previews.set(n.stringId,n)}var o}Editor3dSetPreviewPointAssociations(e,t){let n=this._previews.get(t.toString());if(!n)return;let s=this._components.get(this._configuratorContext.rootComponentId);for(let t=0;t<e.length;t++){let r;0===t?r=n:(r=n.clonePreview(t),this._previews.set(r.stringId,r)),r.name="Preview Point",r.parentDockId=e[t].parentDockId,r.parentId=e[t].parentId,r.childDockId=e[t].childDockId,r.childId=e[t].childId,r.preparePreview(),r.receivedPointAssociation=!0,r.userData.ignoreComponentRaycast=!0,s.add(r),r.roomlePosition=e[t].position,r.roomleRotation=e[t].rotation}}componentDeleted(e){const t=this._components.get(e);t&&(this._listener&&this._listener.componentDeleted(t),t.removeFromParent(),t.removeAllMeshes(),this._components.delete(e))}componentMetaUpdated(e){const t=this._getRuntimeComponent(e.id);t&&(t.hash=e.hash,t.roomlePosition=e.position,t.roomleRotation=e.rotation,e.boxForMeasurement&&t.computeBoundingBox(e.boxForMeasurement),this._listener&&this._listener.componentUpdated(t,e))}componentConfigurationUpdated(e,t){const n=this._getRuntimeComponent(e);n&&(n.geometryChanged=t)}_getRuntimeComponent(e){let t=this._components.get(e);return t||(t=this._previews.get(e.toString()),t)?t:null}configurationLoaded(e,t,n,s,r){e===He&&(this._configuratorContext.dockingRootComponentId=n);let o=0===t;o?this._getKernelAccess().kernelInstance.requestPlanComponentConstructionRecursive(n):this._getKernelAccess().kernelInstance.requestPlanObjectConstruction(t);let i=this._getKernelAccess().kernelInstance.getComponent(n),a=this._components.get(n);a&&(a.computeBoundingBox(i.boxForMeasurement),a.hash=i.hash),this._listener&&this._listener.configurationLoaded(a,o&&void 0!==a.boundingBoxMesh)}finishParameterChange(e,t){this.materialQueue.registerCallback(e)}planObjectConfigurationUpdated(e,t,n){let s=this._getKernelAccess().kernelInstance.getPlanObject(e);this._updatePlanObject(s)}planObjectCreated(e,t){this._configuratorContext.planObjectId=t,this._listener&&this._listener.clearScene()}planObjectUpdated(e){this._updatePlanObject(e)}sceneCleared(){this._components.forEach((function(e){e.removeFromParent(),e.removeAllMeshes()})),this._components.clear(),this._previews.forEach(e=>{e.removeFromParent(),e.removeAllMeshes()}),this._previews.clear()}setListener(e){this._listener=e}getBoundingBox(){if(this._configuratorContext.planObjectId){const e=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);if(e&&e.boxForMeasurement)return C(e.boxForMeasurement)}else if(this._configuratorContext.rootComponentId){const e=this._components.get(this._configuratorContext.rootComponentId);return(new THREE.Box3).setFromObject(e)}return null}getBoundingBoxWithPreviews(){const e=this._components.get(this._configuratorContext.rootComponentId);return e?(new THREE.Box3).setFromObject(e):null}hasPreviews(){return this._previews.size>0}clearRootComponent(){var e;null===(e=this._components.get(this._configuratorContext.rootComponentId))||void 0===e||e.hoverOff()}debugSceneGraph(e){e?this._components.has(e)?this._components.get(e):this._previews.has(e.toString())&&this._previews.get(e.toString()):this._configuratorContext}getComponentsForIds(e){let t=[];return e.forEach(e=>{const n=this._components.get(e);n&&t.push(n)}),t}getComponents(){return Array.from(this._components.values())}getPreviews(){return Array.from(this._previews.values())}isPreviewLine(e){return this._componentFactory.isPreviewLine(e)}isPreview(e){return this._componentFactory.isPreview(e)}setGeometriesMergedListener(e){this._geometriesMerged=e}removeGeometriesMergedListener(){this._geometriesMerged=void 0}setMergeThreshold(e){this._mergeThreshold=e}_generateMesh(e=0,t=null,n,s,r,o,i,a,l){return this._configuratorMeshGenerator.generateMesh(e,t,n,s,r,o,i)}_setMaterial(e,t,n){this._configuratorMeshGenerator.setMaterial(e,t)}constructComponents(e){this._getKernelAccess().kernelInstance.requestPlanObjectConstruction(e)}requestSubPartConstruction(e){return this._subPartGuard=new te(e),this._getKernelAccess().requestPlanComponentConstruction(e),this._subPartGuard.wait()}getMeshGenerator(){return this._configuratorMeshGenerator}}return y([B],e.prototype,"_configuratorMeshGenerator",void 0),y([B],e.prototype,"_configuratorContext",void 0),y([B],e.prototype,"_cacheHolder",void 0),y([B],e.prototype,"_initData",void 0),e})());class Oe extends Map{largestValue(){let e=this.entries().next().value[0],t=0;return this.forEach((n,s)=>{n>t&&(e=s,t=n)}),e}}class Ue{constructor(e){this.autoQuality=!0,this.colors=c,this.unit=null,this.unitStringType=null,this.meshSelection=!0,this.stats=!1,this._measureTraffic=!1,this.gammaOutput=!0,this.disableDebugGUI=!1,this.disableEnvMap=!1,this.dls=null,this.ls=null,this.cameraSpacing=0,this.transparentHighlighting=!0,this.mode="3D",this.edit=!1,this.moc=!1,this._creator_=e}setOverrides(e){h(this,e)}}e("ai",Ue);const Be=["language","browserLanguage","userLanguage","systemLanguage"];class je{constructor(e){this.locale=((e=null)=>{const t=window.navigator;if(e)return e.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,n=Be.length;e<n;e++){const n=t[Be[e]];if(n)return n.substr(0,2)}return"en"})()||"en",this.overrideCountry=null,this._creator_=e}setOverrides(e){h(this,e)}}e("ah",je);class Ge{constructor(e){return this._isMute=!1,this._creator_=e,d(this,"_isMute",{enumerable:!1,writable:!1}),d(Ge.prototype,"_setMute",{enumerable:!1,writable:!1}),d(Ge.prototype,"mute",{enumerable:!1,writable:!1}),d(Ge.prototype,"unmute",{enumerable:!1,writable:!1}),new Proxy(this,this)}_setMute(e){u(this,"_isMute",!0),this._isMute=e,u(this,"_isMute",!1)}mute(){this._setMute(!0)}unmute(){this._setMute(!1)}get(e,t){return this._isMute&&"function"==typeof this[t]&&"on"===t.substr(0,2)?()=>{}:this[t]}}e("U",Ge);class Ve extends Ge{constructor(){super(...arguments),this.onNetworkRequest=(e,t,n)=>{},this.onKernelMsg=(e,t,n={})=>{},this.onCheckExternalCache=async(e,t)=>Promise.resolve(null)}}e("ag",Ve),e("C",{HSC:"rml-hsc",HSP:"rml-hsp",GLB:"rml-glb",RMV:"rml-mv"});let Ne=(()=>{class e{constructor(e){this._creator_=e,this._lifeCycleManager.addEventListener(this)}get element(){return this._container}setDomElement(e){if(!this._container){this._container=document.createElement("div"),this._container.classList.add("rml-threejs-canvas-container"),this._container.setAttribute("ondragover","return false"),this._container.style.position="relative",this._container.style.width="100%",this._container.style.height="100%";const t=document.createElement("style");t.innerText=".rml-threejs-canvas-container canvas{position:absolute;top:0;left:0;right:0;bottom:0;}.rml-threejs-canvas-container .foreground{z-index:100; opacity:1;}.rml-threejs-canvas-container .background{z-index:-1; opacity:0;}",this._container.appendChild(t),e.appendChild(this._container)}this._element=e}getClientDimensions(){return new THREE.Vector2(this._element.clientWidth,this._element.clientHeight)}_removeDomElement(e){if(!e)return;const t=e.parentElement;t&&t.removeChild(e)}reset(){this._element=null,this._removeDomElement(this._container),this._container=null}pause(){this.reset()}resume(){}destroy(){}}return y([B],e.prototype,"_lifeCycleManager",void 0),e})(),ze={InchFeet:null,MM:null,CM:null},We={NoUnitString:null,LongUnitString:null,ShortUnitString:null},Ke=(()=>{class e{constructor(e){this._formatter=null,this._precision=0,this._creator_=e}init(e){const t=new e.UnitMeasureFormatter;ze=e.Unit,We=e.UnitStringType,this._initActualUnit(),this._initActualUnitStringType();const{precisionCm:n,precisionInch:s}=this._initData;this._actualUnit===ze.InchFeet?this._precision=void 0!==s?parseInt(s,10):2:this._actualUnit===ze.CM&&(this._precision=void 0!==n?parseInt(n,10):1),t.init("mm","cm","'","ft",'"',"inch","m²","sqft",!0,this._precision),this._formatter=t}_initActualUnit(){const{unit:e}=this._initData;switch(e){case"cm":this._actualUnit=ze.CM;break;case"mm":this._actualUnit=ze.MM;break;case"inchfeet":this._actualUnit=ze.InchFeet;break;default:this._actualUnit=ze.CM}}_initActualUnitStringType(){const{unitStringType:e}=this._initData;switch(e){case"none":this._actualUnitStringType=We.NoUnitString;break;case"long":this._actualUnitStringType=We.LongUnitString;break;case"short":this._actualUnitStringType=We.ShortUnitString;break;default:this._actualUnitStringType=We.ShortUnitString}}_isFormatterReady(){return!!this._formatter||(console.warn("Formatter is not ready..."),!1)}formatAngleValueToUnitString(e,t){const n="Integer"===t.type?0:2;return e.toFixed(n)+"°"}parseAngleValueFromUnitString(e){return e.replace("°","").replace(/\s/g,"")}parseValue(e,t){return null===t.unitType||"unknown"===t.unitType||"count"===t.unitType?e:"length"===t.unitType?this.parseMMValueFromUnitString(e,t.unitType):"angle"===t.unitType||"area"===t.unitType?this.parseAngleValueFromUnitString(e):e}formatValueToUnitString(e,t){return null===t.unitType||"unknown"===t.unitType||"count"===t.unitType?"Integer"===t.type?e.toString():parseFloat(e.toString()).toFixed(2):"length"===t.unitType?this.formatMMValueToUnitString(e,t.unitType):"angle"===t.unitType?this.formatAngleValueToUnitString(e,t):"area"===t.unitType?this.formatSquareMMValueToUnitString(e):e}isParseableNumber(e){return this._isFormatterReady()?this._formatter.isParseableNumber(e):null}isParseableUnitString(e,t){return this._isFormatterReady()?"angle"===t.unitType?this._formatter.isParseableUnitString(this.parseAngleValueFromUnitString(e),this._actualUnit):this._formatter.isParseableUnitString(e,this._actualUnit):null}parseMMValueFromUnitString(e,t){return this._isFormatterReady()?"count"===t?parseFloat(e):this._formatter.parseMMValueFromUnitString(e,this._actualUnit):null}parseNumber(e){return this._isFormatterReady()?this._formatter.parseNumber(e):null}formatNumber(e,t=0){return this._isFormatterReady()?this._formatter.formatNumber(e,t):null}formatSquareMMValueToUnitString(e){return this._isFormatterReady()?this._formatter.formatSquareMMValueToUnitString(e,this._actualUnit):null}formatMMValueToUnitString(e,t){return this._isFormatterReady()?"count"===t?e.toString():this._formatter.formatMMValueToUnitString(e,this._actualUnit,this._actualUnitStringType):null}formatMMValueWithReqMaxLength(e,t){return this._isFormatterReady()?this._formatter.formatMMValueWithReqMaxLength(e,this._actualUnit,t):null}_formatParameterValue(e,t){return"length"===t?this.formatMMValueToUnitString(parseFloat(e)):"area"===t?this.formatSquareMMValueToUnitString(parseFloat(e)):e}formatPartListParameter(e){Pe(e)&&(e.valueLabel=this._formatParameterValue(e.value,e.unitType))}formatParameter(e){if(Pe(e)&&Array.isArray(e.validValues)&&e.validValues.forEach(({value:t},n)=>{e.validValues[n].label=this._formatParameterValue(t,e.unitType)}),e.valueLabel=this._formatParameterValue(e.value,e.unitType),Re(e))e.uiType="Material";else if(function(e){return"Boolean"===e.type}(e))e.uiType="Boolean";else if(Ce(e)){e.uiType="Range";const t=null!==e.validRange.valueFrom?e.validRange.valueFrom:Number.MIN_SAFE_INTEGER,n=null!==e.validRange.valueTo?e.validRange.valueTo:Number.MAX_SAFE_INTEGER;e.validRangeLabels={valueFrom:this._formatParameterValue(t.toString(),e.unitType),valueTo:this._formatParameterValue(n.toString(),e.unitType),type:e.validRange.type}}else Te(e)?(e.uiType="Options",function(e){return!!Te(e)&&Array.isArray(e.validValues)&&e.validValues.length>0&&"string"==typeof e.validValues[0].thumbnail}(e)&&(e.uiType="Thumbnails")):(console.error("Could not detect uiType of param"),e.uiType=null)}isInch(){return this._actualUnit===ze.InchFeet}getPrecision(){return this._precision}getAllowedDelta(){const e=1/Math.pow(10,this._precision);return this.isInch()?25.4*e:e}}return y([B],e.prototype,"_initData",void 0),e})();e("aj",class{constructor(e){this._creator_=e}setScene(e){}setUiScene(e){}updateBounds(e){}clearScene(e,t){}moveCameraEnd(e){}moveCameraStart(e){}needsUiScene(){return!1}});let qe=(()=>{class e{constructor(e){this._plugins=[],this._creator_=e}async init(e,n,s){this._scene=e,this._uiScene=n,this._cameraPosition=s;const{bananaForScale:r}=this._initData;r&&await t.import("./banana-for-scale-2c7e61df.legacy.js").then(({default:e})=>this._plugins.push(new e(this._creator_))),this._plugins.forEach(e=>e.setScene(this._scene)),this._plugins.forEach(e=>e.setUiScene(this._uiScene)),this._plugins.forEach(e=>e.updateBounds(this._bounds)),this._plugins.forEach(e=>e.moveCameraEnd(this._cameraPosition))}addPlugin(e){this._plugins.push(e),e.setScene(this._scene),e.setUiScene(this._uiScene),e.updateBounds(this._bounds),e.moveCameraEnd(this._cameraPosition)}updateBounds(e){this._bounds=e,this._plugins.forEach(t=>t.updateBounds(e))}clearScene(e,t){this._plugins.forEach(n=>n.clearScene(e,t))}getActivePlugins(){return this._plugins}getPlugin(e){for(let t of this._plugins)if(t instanceof e)return t;return null}moveCameraEnd(e){this._cameraPosition=e,this._plugins.forEach(t=>t.moveCameraEnd(e))}moveCameraStart(e){this._cameraPosition=e,this._plugins.forEach(t=>t.moveCameraStart(e))}needsUiScene(){return this._plugins.map(e=>e.needsUiScene()).reduce((e,t)=>e||t,!1)}}return y([B],e.prototype,"_initData",void 0),e})();const Je=e("I",[new m("error-handler",class{constructor(){this._listeners={}}_subscribe(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}subscribe(e,t){this._subscribe(e,t)}dispatch(e,t){if(!this._listeners[e])return;const n=this._listeners[e];let s=n.length;for(let e=0;e<s;e++){const s=n[e];s.apply(s,t)}}unsubscribe(e,t){if(!this._listeners[e])return;const n=this._listeners[e];let s=n.length;for(let e=0;e<s;e++)if(n[e]===t)return n.splice(e,1),s--,void e--}softReject(e,t,n){return this.dispatch(n,[t]),e()}}),new m("form-data-util",f),new m("environment-loader",j),new m("static-item-loader",oe,0),new m("form-data-util",f),new m("single-promise-factory",class{constructor(e){this._promises=new Map,this._creator_=e}create(e,t,n){return new Promise((s,r)=>{let o=this._promises.get(e),i=!0;if(!o){const t=new Map;this._promises.set(e,t),o=this._promises.get(e),i=!1}o.get(t)||(o.set(t,[]),i=!1);const a=o.get(t);a.push({resolve:s,reject:r}),o.set(t,a);const l=()=>{o.delete(t),0===o.size&&this._promises.delete(e)};i||new Promise(n).then(e=>{o.get(t).forEach(({resolve:t})=>t(e)),l()},e=>{o.get(t).forEach(({reject:t})=>t(e)),l()})})}},1),new m("dynamic-light-setting-loader",V),new m("dynamic-quality-setting-loader",le),new m("network-layer",q),new m("local-storage",class{constructor(e){this._context_=e}get _localStorage(){let e=null;try{e=window.localStorage}catch(e){console.error(e)}return e}getItem(e){if(!this._localStorage)return null;const t=this._localStorage.getItem(e);try{return JSON.parse(t)}catch(e){return t}}setItem(e,t){if(this._localStorage)try{const n=JSON.stringify(t);this._localStorage.setItem(e,n)}catch(e){console.error(e)}}}),new m("network-layer",q),new m("kernel-io",Q,0),new m("data-syncer",ee),new m("memory-manager",class{constructor(){this._configurationStringSet=new Set,this._singleLoadCounter=0}loadingConfigurationString(){this._singleLoadCounter+=1}loadingConfiguration(e){this._configurationStringSet.add(e),this._singleLoadCounter+=1}shouldHardReset(){return this._configurationStringSet.size>=15||this._singleLoadCounter>=30}executedHardReset(){this._configurationStringSet.clear(),this._singleLoadCounter=0}}),new m("life-cycle-manager",class{constructor(){this._listeners=[]}addEventListener(e){this._listeners.push(e)}removeEventListener(e){const t=this._listeners;let n=t.length;if(n)for(let s=0;s<n;s++)t[s]===e&&(t.splice(s,1),s--,n--)}pause(){this._listeners.forEach(e=>e.pause())}resume(){this._listeners.forEach(e=>e.resume())}destroy(){this._listeners.forEach(e=>e.destroy())}},1),new m("three-loader",ie),new m("local-storage-helper",ae),new m("cache-holder",class{constructor(){this._componentCache=new Map,this._geometryCache=new Map,this._materialCache=new Map}get componentCache(){return this._componentCache}get geometryCache(){return this._geometryCache}get materialCache(){return this._materialCache}clear(){for(const e of this._componentCache.values())A(e);for(const e of this._materialCache.values())F(e);for(const e of this._geometryCache.values())H(e);this._componentCache.clear(),this._geometryCache.clear(),this._materialCache.clear()}},0),new m("kernel-access-callback",class{constructor(e){this._callbackListener=new Set,this._creator_=e}addListener(e){this._callbackListener.add(e)}removeListener(e){this._callbackListener.delete(e)}isReady(){this._callbackListener.forEach(e=>e.isReady())}loadError(e){this._callbackListener.forEach(t=>t.loadError(e))}},1),new m("configurator-kernel-access-callback",class{constructor(e){this._callbackListener=new Set,this._creator_=e}addListener(e){this._callbackListener.add(e)}removeListener(e){this._callbackListener.delete(e)}isReady(){this._callbackListener.forEach(e=>e.isReady())}updatePossibleChildren(e,t,n){this._callbackListener.forEach(s=>s.updatePossibleChildren(e,t,n))}updateParameters(e,t,n,s){this._callbackListener.forEach(r=>r.updateParameters(e,t,n,s))}loadError(e){this._callbackListener.forEach(t=>t.loadError(e))}},1),new m("configurator-view-model",Fe,1),new m("configurator-context",class{constructor(){this.rootComponentParametersAsGlobal=!1,this.lastLoadedRapiId=null,this.selectedRuntimeComponentIds=[],this.selectionMode="standard"}get selectedRuntimeComponentId(){return this.selectedRuntimeComponentIds.length>0?this.selectedRuntimeComponentIds[0]:null}},1),new m("init-data",Ue,1),new m("global-init-data",je,0),new m("global-callback",Ve,0),new m("dom-helper",Ne,1),new m("unit-formatter",Ke,0),new m("plugin-system",qe,1)]);class Qe{static _ensureContainer(){window.__RML__DI__||(window.__RML__DI__=new g,window.__RML__DI__.addDependencyInjectionAssignments(Je))}static setup(e){Qe.addToContainer(e)}static lookup(e,t){return window.__RML__DI__?window.__RML__DI__.lookup(e,t):null}static getContext(e){return Qe._ensureContainer(),window.__RML__DI__.getContext(e)}static cleanUp(e){return window.__RML__DI__?window.__RML__DI__.cleanUp(e):null}static addToContainer(e){Qe._ensureContainer(),window.__RML__DI__.addDependencyInjectionAssignments(e)}}e("r",Qe);let Ze=e("A",(()=>{class e{static init(t={}){const{kernelInstance:n,kernelContainer:s,planObjectId:r}=t;e.kernelInstance=n,e.kernelContainer=s,e.planObjectId=r}static cleanUp(){e.useHDGeometry=!1,e.kernelInstance=null,e.kernelContainer=null,e.planObjectId=null}}return e.useHDGeometry=!1,e.kernelInstance=null,e.kernelContainer=null,e.planObjectId=null,e})());const{APP:$e}=ve,{RAPI:Xe}=$e,Ye=Xe.headers,et=Xe.itemHeaders,tt=Ye.token,nt=e("S","crt"),st=p();let rt=new Map,ot=new Map,it=new Map,at=new Map,lt=new Map,ct=new Map,ht=new Map,dt=new Map,ut=new Map;const pt=e=>rt.get(e)||rt.get(st+e),gt=e=>e&&e.tags&&e.tags.length,mt=e=>!gt(e)&&e.group;e("f",(()=>{class e{constructor(e){this._itemLoaded=!1,this._currentToken=null,this._creator_=e,window.addEventListener("online",this._flushOfflineQueue.bind(this))}getPreloadForItem(e){return this._getPreload(e,!0)}getPreloadForConfiguration(e){return this._getPreload(e,!1)}_getPreload(e,t){return new Promise((n,s)=>{if(!navigator.onLine)return n();if(this._dataSyncer.getIsCatalogSynced(z(e)))return n();if(ht.get(e))return n();const r=t?"?itemId=":"?configurationId=";this._get("/preloads/components/"+r+e,"preloads/components").then(t=>{if(ht.get(e))return n();t.forEach(e=>{this._prepareData(e,"components")}),ht.set(e,!0),n()},s)})}changeUseOfHDGeometry(){const e=at.get("components");ht.clear(),ct.clear(),e&&at.delete("components")}getHSCPackage(e){return new Promise((t,n)=>{if(ct.get(e))return t();this._get("/catalogs/"+e+"/package","package").then(n=>{if(ct.get(e))return t(n);n.components.forEach(e=>{this._prepareData(e,"components")}),n.materials.forEach(e=>{this._prepareData(e,"materials"),this._prepareGroups(e)}),n.textures.forEach(e=>{this._prepareData(e,"textures")}),ct.set(e,!0),t(n)},n)})}getComponent(e){return this._getById(e,"components")}getConfiguration(e){return this._getById(e,"configurations")}getConfigurations(e){return this._getByIds(e,"configurations")}getItem(e){return this._getById(e,"items",{additionalHeaders:et})}getComponents(e){return this._getByIds(e,"components")}getItems(e){return this._getByIds(e,"items",{additionalHeaders:et})}getTag(e){return this._getById(e,"tags")}getTags(e){return this._getByIds(e,"tags")}getTexture(e){return this._getById(e,"textures")}getCatalog(e){return this._getById(e,"catalogs")}getMesh(e,t=nt,n=50){return this._getById(e,"meshes",{pathSuffix:"/data?format="+t+"&targetQuality="+n.toString()})}getMeshesOfCatalog(e){return new Promise((t,n)=>{const s=lt.get(e);s?t(s):this._get("/meshes?catalog="+e,"catalogMeshes").then(n=>{lt.set(e,n),t(n)},n)})}getTexturesOf(e){return this._getRelationData(e,{rapiPath:"textures"})}getItemsOf(e){return this._getRelationData(e,{rapiPath:"items"})}async getMaterialsOf(e){return(await this._getRelationData(e,{rapiPath:"materials"},{embed:["textures"]})).filter(e=>e.active)}getComponentsOf(e){return this._getRelationData(e,{rapiPath:"components"})}getAdditionalContentsOfItems(e){const t=[],n=[];return e.forEach(e=>{const s=ot.get(e.id.toString());s?n.push(...s):t.push(e.id.toString())}),new Promise((e,s)=>{0!==t.length?this._getByIdsPackets(t,"itemAdditionalContents",{filterKey:"itemIds"}).then(t=>{t.forEach(e=>{let t=ot.get(e.itemId);t||(t=[]);for(let n=0,s=t.length;n<s;n++)if(t[n].id===e.id)return;t.push(e),ot.set(e.itemId,t)}),e([...t,...n])},s):e(n)})}getMaterial(e){return this._getById(e,"materials",{embed:["textures"]})}peekMaterial(e){return this._peekData(e,"materials")}peekComponent(e){return this._peekData(e,"components")}async getMaterials(e){return(await this._getByIds(e,"materials",{embed:["textures"]})).filter(e=>e.active)}getPlan(e){return this._getById(e,"plans")}static clearCaches(){rt=new Map,it=new Map,at=new Map,ct=new Map,ht=new Map,dt=new Map,ot=new Map}cleanUp(){e.clearCaches()}getMaterialsByGroup(e){const t=e.slice(),n=[];let s=t.length;for(let e=0;e<s;e++){const r=pt(t[e]);if(r){const o=r.length;for(let e=0;e<o;e++){const t=this._getCache("materials").get(r[e]);n.push(t)}t.splice(e,1),s--,e--}}return new Promise((e,s)=>{0!==t.length&&navigator.onLine?this._getByIdsPackets(t,"materials",{filterKey:"groups",embed:["textures"]}).then(t=>{e(this.combineMaterialsToGroups([...t,...n]))},s):e(this.combineMaterialsToGroups(n))})}_flushOfflineQueue(){return new Promise((e,t)=>{const n=this._localStorage.getItem("hsc_configurations_offline_queue_v1"),s=[];for(let e in n)if(n.hasOwnProperty(e)){const t=n[e];s.push(new Promise((e,n)=>{this.saveConfiguration(t.data).then(s=>{const r=[];t.perspectiveImage&&!s.perspectiveImage&&r.push(this.savePerspectiveImage(s,t.perspectiveImage)),t.topImage&&!s.topImage&&r.push(this.savePerspectiveImage(s,t.topImage)),Promise.all(r).then(e,n)},n)}))}Promise.all(s).then(()=>{this._localStorage.setItem("hsc_configurations_offline_queue_v1",{}),e()},t)})}_setQueuedConfiguration(e,t={}){const n=e.configurationHash,{perspectiveImage:s,topImage:r}=t;let o=this._localStorage.getItem("hsc_configurations_offline_queue_v1")||{},i=o[n]||{};i.data=e,i.perspectiveImage=s,i.topImage=r,o[n]=i,this._localStorage.setItem("hsc_configurations_offline_queue_v1",o)}async saveConfiguration(e){return navigator.onLine?await this._save("/configurations",{configuration:e},"configurations",{accept:"application/json",contentType:"application/json; charset=UTF-8"}):(e.perspectiveImage=null,e.topImage=null,this._setQueuedConfiguration(e),this._markConfigurationAsLocally(e),Promise.resolve(e))}saveTopImage(e,t){return this._saveConfigurationImage(e,t,"topImage")}savePerspectiveImage(e,t){return this._saveConfigurationImage(e,t,"perspectiveImage")}getShortUrl(e,t){return new Promise((n,s)=>this._fetchJson("/shortIds","shortIds",{method:"POST",resolve:n,reject:s,data:JSON.stringify({shortId:{type:t,referencedId:e}}),accept:"application/json",contentType:"application/json; charset=UTF-8"}))}_peekData(e,t){const n=at.get(t);return n&&n.get(e)||null}_saveConfigurationImage(e,t,n){if(!navigator.onLine){const s={};return s[n]=t,this._setQueuedConfiguration(e,s),this._markConfigurationAsLocally(e),e[n]=t.image,Promise.resolve(e)}const s=this._formDataUtil.create(t.image,e.configurationHash,_.PNG,n);return this._save("/configurations/"+e.id+"/"+n,s,"configurations",{accept:"application/json"})}_markConfigurationAsLocally(e){e.isLocally=!0,e.id=e.configurationHash}_save(e,t,n,s={}){const r=t instanceof FormData?t:JSON.stringify(t);return new Promise((t,o)=>{const i={method:s.method||"POST",data:r,resolve:t,reject:o};s.contentType&&(i.contentType=s.contentType),s.accept&&(i.accept=s.accept),this._fetchJson(e,n,i)})}combineMaterialsToGroups(e){return new Promise((t,n)=>{const s=new Map,r={id:null,label:null,materials:[]},o=[];for(let t=0,n=e.length;t<n;t++){const n=e[t],i=n.tags&&n.tags.length?n.tags.map(e=>({isTag:!0,id:e})):[];n.group&&i.push({isTag:!1,id:st+n.group,legacyId:n.group}),i.length||i.push({isTag:!1,id:null}),n.tags&&n.tags.length&&n.tags.forEach(e=>-1===o.indexOf(e)?o.push(e):null),i.forEach(({isTag:e,id:t,legacyId:o})=>{const i=n.id;let a=t?pt(t):[];a||(rt.set(t,[]),a=pt(t)),-1===a.indexOf(i.toString())&&a.push(i.toString());const l=gt(n),c=l&&e,h=mt(n);if(c||h&&!e||!l&&!h&&!t){let e=t?s.get(t):r;e||(s.set(t,{id:t,label:n.groupLabel,legacyId:o,materials:[]}),e=s.get(t)),e.materials.push(n)}})}const i=r.materials.length?[r]:[];this.getTags(o).then(e=>{const n=e.reduce((e,t)=>(e[t.id]=t,e),{});return s.forEach((e,t)=>{i.push({id:t,label:n[t]?n[t].label:e.label,materials:e.materials,legacyId:e.legacyId,sort:n[t]?n[t].sort:void 0})}),t(i)},n)})}_getByIds(e,t,n={}){const s=this._getCache(t),r=this._getErrorCache(t),o=[],i=[...new Set(e)];let a=i.length;if(s&&s.size){const e=(new Date).getTime();for(let t=0;t<a;t++){const n=i[t],l=s.get(n),c=r.get(n);let h=!1;null!=l?(o.push(l),h=!0):h=void 0!==c&&(e-c.timestamp<6e4||!1===navigator.onLine),h&&(i.splice(t,1),a--,t--)}}return new Promise((e,s)=>{0!==i.length&&navigator.onLine?this._getByIdsPackets(i,t,n).then(t=>{e([...t,...o])},s):e(o)})}_getByIdsPackets(e,t,n={}){const s=n.filterKey||"ids";let r,o="/"+t+"/",i="?",a=[];const l=e.length;if(!l)return new Promise(e=>e([]));let c=!0,h=[];for(r=0;r<l;r++){c=!1;const n=e[r],l=i+s+"[]="+n,d=l.length+o.length;h.push(n),i="&",d<=1500?o+=l:(d>1500&&(h.pop(),r--),a.push({url:o,ids:h}),c=!0,o="/"+t+"/",i="?",h=[])}c||a.push({url:o,ids:h});const d=[];return a.forEach(e=>d.push(this._getByIdsSingle(e.ids,e.url,t,n))),new Promise((e,t)=>{Promise.all(d).then(t=>{const n=[];t.length&&t.forEach(e=>n.push(...e)),e(n)},t)})}_getByIdsSingle(e,t,n,s={}){return new Promise((r,o)=>{this._get(t,n,s).then(t=>{for(let n=0,r=t.length;n<r;n++){const r=s&&s.cacheKey?t[n][s.cacheKey]:t[n].id,o=e.indexOf(r.toString());-1!==o&&e.splice(o,1)}const o=e.length;if(o){const t=this._getCache(n),s=this._getErrorCache(n),r=(new Date).getTime();for(let n=0;n<o;n++)s.set(e[n],{code:0,timestamp:r}),t.delete(e[n]);this._errorHandler.dispatch(2,[n,e.map(e=>'"'+e+'"').join(",")])}r(t)},o)})}_getById(e,t,n={}){if(!e||""===e||"string"!=typeof e)return console.error("no id passed to _getById"),Promise.reject(new Error("no id passed to _getById"));const s=this._getCache(t).get(e);if(s)return new Promise(e=>e(s));if(!navigator.onLine)return Promise.reject("Nothing cached but tried to fetch in offline mode");const r={...n,id:e},o=n.pathSuffix||"";return this._get("/"+t+"/"+e+o,t,r)}_get(e,t,n={}){const s=Ze.useHDGeometry?"includeGeometryHD=true":"";let r=-1===e.indexOf("?")?"?":"&";return""!==s&&(e+=r+s),n.embed&&Array.isArray(n.embed)&&n.embed.forEach(t=>{e+=r+"embed"+(t[0].toUpperCase()+t.substr(1))+"=true",r="&"}),new Promise((s,r)=>{const o=dt.get(e);Array.isArray(o)&&o.length>0?o.push({resolve:s,reject:r}):(dt.set(e,[{resolve:s,reject:r}]),this._fetchJson(e,t,n))})}_fetchJson(e,t,n={}){this._fetch(e,n).then(o.bind(this)).then(this._handleJson(e,t,n).bind(this)).catch(this._handleError(e,n).bind(this))}async _fetch(e,t){const n={method:t.method?t.method:"GET",headers:this._createHeaders(t),mode:"cors",cache:"default"};t.data&&(n.body=t.data);let s=Xe.server;const r=this._globalInitData.overrideRapi;r&&(s="live"===r?Xe.liveServer:Xe.testServer),(this._globalInitData.customApiUrl||""===this._globalInitData.customApiUrl)&&(s=this._globalInitData.customApiUrl);const o=new Request(s+e,n);this._globalCallback.onNetworkRequest(e,n,t);const i=await this._globalCallback.onCheckExternalCache(e,n);return i?{headers:{get:()=>"application/json"},json:()=>Promise.resolve(i)}:this._networkLayer.fetch(o)}_createHeaders(e={}){const t={...Ye};this._globalInitData.overrideTenant&&(t.currentTenant=this._globalInitData.overrideTenant),this._globalInitData.overrideCountry&&(t.country=this._globalInitData.overrideCountry);const n=this._globalInitData.locale||"en";t.language=n,t.locale=n;const{contentType:s,accept:r,additionalHeaders:o,data:i}=e;if(s&&(t["content-type"]=e.contentType),r&&(t.accept=e.accept),o)for(let e in o)o.hasOwnProperty(e)&&(t[e]=o[e]);this._globalInitData.configuratorId&&(t.configurator=this._globalInitData.configuratorId);const a=this._currentToken||tt;t.token="03-"+window.btoa((new Date).toISOString()+";"+a+";"+Ye.apiKey);const l=new Headers(t);return i instanceof FormData&&l.delete("content-type"),l}_handleJson(e,t,n={}){return s=>{let r=null,o=null;"number"==typeof s&&(r=s);for(let e in s)"meta"!==e&&s.hasOwnProperty(e)&&(r=s[e],o=e);if("error"===o)return this._handleError(e,n)(new Error(JSON.stringify(r)));if(!r)throw new TypeError("RAPI returned empty JSON");if(Array.isArray(r))for(let e=0,s=r.length;e<s;e++)this._prepareData(r[e],t,n),this._prepareEmbeddedData(r[e],t,n);else this._prepareData(r,t,n),this._prepareEmbeddedData(r,t,n);n.resolve?n.resolve(r):this._notifyWaiters(e,null,r)}}_prepareEmbeddedData(e,t,n={}){n.embed&&Array.isArray(n.embed)&&n.embed.forEach(s=>{const r=e[s.slice(0,-1)+"Objects"];if(Array.isArray(r)){for(let e=0,t=r.length;e<t;e++)this._prepareData(r[e],s,n);this._prepareRelationalData(t,s,e.id,r)}else r&&(this._prepareData(r,s,n),this._prepareRelationalData(t,s,e.id,[r]))})}_getCache(e){return this._getCacheFrom(e,at)}_getErrorCache(e){return this._getCacheFrom(e,ut)}_getCacheFrom(e,t){let n=t.get(e);return n||(t.set(e,new Map),n=t.get(e)),n}_setCache(e,t,n){n.set(e.toString(),t)}_prepareData(e,t,n=null){let s=this._getCache(t);const r=n&&n.cacheKey?e[n.cacheKey]:e.id;if(r||n&&n.id||"tenants/me"===t)if("tenants/me"!==t){{const t=r||n.id;this._setCache(t,e,s)}e.__rapi_path__=t}else this._setCache("0",e,s);else"shortIds"!==t&&console.error("Can not cache because there is no ID!")}_getRelationsCacheFor(e,t,n){let s=it.get(t);if(!s){const r=new Map,o=new Map;o.set(n,void 0),r.set(e,o),it.set(t,r),s=it.get(t)}let r=s.get(e);if(!r){const t=new Map;t.set(n,void 0),s.set(e,t),r=s.get(e)}return r.get(n)}_prepareGroups(e){const t=e.group,n=e.id;let s=pt(t);s||(rt.set(t,[]),s=pt(t)),-1===s.indexOf(n.toString())&&s.push(n.toString())}_handleError(e,t={}){return n=>{navigator.onLine?(n.rmlErrorCode=1,n.message='Failed to load "'+e+'" because of "'+n.message+'"',this._errorHandler.dispatch(1,[n])):(n.rmlErrorCode=0,n.message='Failed to load "'+e+'" because of "'+n.message+'"',this._errorHandler.dispatch(0,[n])),t.reject?t.reject(n):this._notifyWaiters(e,n,null)}}_getRelationData(e,t,n={}){const s=e.id;if(!s)return Promise.resolve([]);const r=e.__rapi_path__,o=t.rapiPath;let i=this._getCache(o),a=this._getRelationsCacheFor(s.toString(),r,o),l=[];return a?(a.forEach(e=>l.push(i.get(e))),new Promise(e=>e(l))):navigator.onLine?new Promise((e,t)=>{this._get("/"+r+"/"+s+"/"+o,o,n).then(t=>{this._prepareRelationalData(r,o,s,t),e(t)},t)}):Promise.resolve([])}_prepareRelationalData(e,t,n,s){it.has(e)||it.set(e,new Map);let r=it.get(e);const o=n.toString();r.has(o)||r.set(o,new Map);let i=r.get(o),a=this._getCache(t),l=[];for(let e=0,t=s.length;e<t;e++){const t=s[e],n=t.id.toString();l.push(n),a.set(n,t)}i.set(t,l)}_notifyWaiters(e,t,n){const s=dt.get(e);if(s&&s.length){for(let e=0,r=s.length;e<r;e++)t?s[e].reject(t):s[e].resolve(n);dt.delete(e)}}_tenantMe(){return new Promise((e,t)=>{const n=this._getCache("tenants/me"),s=this._globalInitData.overrideTenant?this._globalInitData.overrideTenant:n.get("0");if(s)return e(s);this._fetchJson("/tenants/me","tenants/me",{resolve:t=>e(t),reject:t})})}async getTenant(e){return e||(e=await this._tenantMe()),this._getById(e.toString(),"tenants")}getCurrentSkin(){return this._tenantMe().then(e=>this._getById(e.toString(),"tenants").then(e=>this._getById(e.skin.toString(),"skins")))}getPrices(e){return this._getByIds(e,"prices",{filterKey:"priceIds",cacheKey:"priceId"})}async getConfiguratorSettings(e){const t=await this._getById(e,"configurators");return t.allowedHosts||(t.allowedHosts=[]),t.allowedHosts&&!Array.isArray(t.allowedHosts)&&(t.allowedHosts=t.allowedHosts.split(" ")),t}sendUserAction(e){return this._save("/userActions",{userAction:e},"userActions",{accept:"application/json",contentType:"application/json; charset=UTF-8"})}shareConfiguration(e,t,n){const s="/configurations/"+e+"/shares",r=new FormData;return r.append("email",t),r.append("type",n.toString()),new Promise((e,t)=>{const n={method:"POST",data:r,resolve:e,reject:t,accept:"application/json",contentType:"application/json; charset=UTF-8"};this._fetch(s,n).then(n.resolve,n.reject)})}export3D(e,t,n,s={}){const r="/configurations/"+e+"/3d-exports",o={formats:[{file_format:n,pack_external_data:!0,...s}]},i=JSON.stringify(o),a=new FormData;return a.append("email",t),a.append("settings",i),new Promise((e,t)=>{const n={method:"POST",data:a,resolve:e,reject:t};this._fetch(r,n).then(n.resolve,n.reject)})}async trackView(e){if(this._itemLoaded||(t=(()=>{var e;const t=(()=>{if(window.__RML__ENV__&&window.__RML__ENV__.skipIframeCheck)return!1;try{return window.self!==window.top}catch(e){return!0}})();let n=null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.href;if(!n)return null;if(t){if(!document.referrer)return null;n=document.referrer}const{hostname:s}=new URL(n);return s})())&&(N.includes(t)||t.endsWith("gitlab.io")||t.endsWith("gitlab.com")||t.endsWith("codesandbox.io")||t.endsWith("stackblitz.com")||/^(admin.*.roomle.com)$/.test(t)))return;var t;const{configuratorId:n}=this._globalInitData,s={module:3,action:1,actionId:e,actionLabel:n};await this.sendUserAction(s),this._itemLoaded=!0}signinUser(e,t){return new Promise((n,s)=>{const r={method:"POST",accept:"application/json",contentType:"application/json; charset=UTF-8",data:JSON.stringify({identification:e,passwordMD5:t}),cacheKey:"token",resolve:n,reject:s};this._fetchJson("/auth/signin","auth",r)})}async signoutUser(e){const t=this._currentToken;t!==e&&this.setCurrentToken(e),await this._fetch("/auth/signout",{}),t&&t!==e?this.setCurrentToken(t):this.removeCurrentToken()}async savePlan(e){const t=e.id?"/plans/"+e.id:"/plans";return this._save(t,{plan:e},"plans",{method:e.id?"PUT":"POST",accept:"application/json",contentType:"application/json; charset=UTF-8"})}setCurrentToken(e){this._currentToken=e}removeCurrentToken(){this._currentToken=null}createNewPlan(){return{name:"",description:"",changeDate:(new Date).toISOString(),created:(new Date).toISOString(),draftId:null,thumbnail:"data:image/png;base64,missing",planObjects:null,active:!0,open:0,planDirectory:0,changed:0,version:2,floorLevel:0,visibility:9,user:null,tenant:null,assets:[],parent:null,setting:null}}}return y([B],e.prototype,"_formDataUtil",void 0),y([B],e.prototype,"_errorHandler",void 0),y([B],e.prototype,"_dataSyncer",void 0),y([B],e.prototype,"_networkLayer",void 0),y([B],e.prototype,"_localStorage",void 0),y([B],e.prototype,"_globalInitData",void 0),y([B],e.prototype,"_globalCallback",void 0),e})())}}}));
|
|
16
|
-
//# sourceMappingURL=rapi-access-34b1ce17.legacy.js.map
|
|
Binary file
|
|
Binary file
|