@roomle/web-sdk 2.32.0 → 2.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{banana-for-scale-7b0bca43.js → banana-for-scale-1d3127e8.js} +2 -2
- package/lib/{banana-for-scale-7b0bca43.js.map → banana-for-scale-1d3127e8.js.map} +1 -1
- package/lib/{banana-for-scale-9b85cbe2.nomodule.js → banana-for-scale-a63fb2df.nomodule.js} +2 -2
- package/lib/{banana-for-scale-9b85cbe2.nomodule.js.map → banana-for-scale-a63fb2df.nomodule.js.map} +1 -1
- package/lib/{component-dimensioning-35b54244.nomodule.js → component-dimensioning-6c0c9199.nomodule.js} +2 -2
- package/lib/component-dimensioning-6c0c9199.nomodule.js.map +1 -0
- package/lib/{component-dimensioning-8920213d.js → component-dimensioning-cd3fa46e.js} +2 -2
- package/lib/component-dimensioning-cd3fa46e.js.map +1 -0
- package/lib/{configurator-db3f58cd.js → configurator-3cf0afc7.js} +2 -2
- package/lib/{configurator-db3f58cd.js.map → configurator-3cf0afc7.js.map} +1 -1
- package/lib/{configurator-d961a636.nomodule.js → configurator-9ec75ff2.nomodule.js} +2 -2
- package/lib/{configurator-d961a636.nomodule.js.map → configurator-9ec75ff2.nomodule.js.map} +1 -1
- package/lib/configurator-main-2b41551f.js +2 -0
- package/lib/configurator-main-2b41551f.js.map +1 -0
- package/lib/configurator-main.nomodule.js +1 -1
- package/lib/{configurator-mesh-generator-6de7ffc4.js → configurator-mesh-generator-3151246c.js} +2 -2
- package/lib/configurator-mesh-generator-3151246c.js.map +1 -0
- package/lib/configurator-mesh-generator-3497564c.nomodule.js +2 -0
- package/lib/configurator-mesh-generator-3497564c.nomodule.js.map +1 -0
- package/lib/{default-light-setting-a2b9b498.nomodule.js → default-light-setting-6852d456.nomodule.js} +2 -2
- package/lib/default-light-setting-6852d456.nomodule.js.map +1 -0
- package/lib/{default-light-setting-fbb51c21.js → default-light-setting-825bb619.js} +2 -2
- package/lib/default-light-setting-825bb619.js.map +1 -0
- package/lib/definitions/common-core/src/cameracontrol/camera-control-2d.d.ts +1 -2
- package/lib/definitions/common-core/src/services/common-kernel-access.d.ts +1 -1
- package/lib/definitions/typings/kernel.d.ts +4 -1
- package/lib/{dimensioning-helper-076b0103.js → dimensioning-helper-46403799.js} +2 -2
- package/lib/{dimensioning-helper-076b0103.js.map → dimensioning-helper-46403799.js.map} +1 -1
- package/lib/{dimensioning-helper-4c1b27fb.nomodule.js → dimensioning-helper-edfc5933.nomodule.js} +2 -2
- package/lib/{dimensioning-helper-4c1b27fb.nomodule.js.map → dimensioning-helper-edfc5933.nomodule.js.map} +1 -1
- package/lib/{glb-viewer-22cf383e.nomodule.js → glb-viewer-564c48c8.nomodule.js} +2 -2
- package/lib/{glb-viewer-22cf383e.nomodule.js.map → glb-viewer-564c48c8.nomodule.js.map} +1 -1
- package/lib/{glb-viewer-0f7646e5.js → glb-viewer-67e22889.js} +2 -2
- package/lib/{glb-viewer-0f7646e5.js.map → glb-viewer-67e22889.js.map} +1 -1
- package/lib/glb-viewer-main-2dfab30f.js +2 -0
- package/lib/glb-viewer-main-2dfab30f.js.map +1 -0
- package/lib/glb-viewer-main.nomodule.js +1 -1
- package/lib/{image-renderer-422be4aa.nomodule.js → image-renderer-5394fa5b.nomodule.js} +2 -2
- package/lib/{image-renderer-422be4aa.nomodule.js.map → image-renderer-5394fa5b.nomodule.js.map} +1 -1
- package/lib/{image-renderer-54c8b361.js → image-renderer-d3652216.js} +2 -2
- package/lib/{image-renderer-54c8b361.js.map → image-renderer-d3652216.js.map} +1 -1
- package/lib/legacy/{banana-for-scale-6a47aaaa.legacy.js → banana-for-scale-2ae53764.legacy.js} +2 -2
- package/lib/legacy/{banana-for-scale-6a47aaaa.legacy.js.map → banana-for-scale-2ae53764.legacy.js.map} +1 -1
- package/lib/legacy/{component-dimensioning-4fe5ffb3.legacy.js → component-dimensioning-eeddfbe4.legacy.js} +2 -2
- package/lib/legacy/component-dimensioning-eeddfbe4.legacy.js.map +1 -0
- package/lib/legacy/{configurator-4c481dcb.legacy.js → configurator-b980d570.legacy.js} +2 -2
- package/lib/legacy/{configurator-4c481dcb.legacy.js.map → configurator-b980d570.legacy.js.map} +1 -1
- package/lib/legacy/configurator-main.legacy.js +1 -1
- package/lib/legacy/{configurator-mesh-generator-74eda1f8.legacy.js → configurator-mesh-generator-32a1a893.legacy.js} +2 -2
- package/lib/legacy/configurator-mesh-generator-32a1a893.legacy.js.map +1 -0
- package/lib/legacy/{default-light-setting-c8541f99.legacy.js → default-light-setting-0c03b9e5.legacy.js} +2 -2
- package/lib/legacy/default-light-setting-0c03b9e5.legacy.js.map +1 -0
- package/lib/legacy/{dimensioning-helper-c9f433a5.legacy.js → dimensioning-helper-82ad5e54.legacy.js} +2 -2
- package/lib/legacy/{dimensioning-helper-c9f433a5.legacy.js.map → dimensioning-helper-82ad5e54.legacy.js.map} +1 -1
- package/lib/legacy/{glb-viewer-065aba9f.legacy.js → glb-viewer-cb5014ee.legacy.js} +2 -2
- package/lib/legacy/{glb-viewer-065aba9f.legacy.js.map → glb-viewer-cb5014ee.legacy.js.map} +1 -1
- package/lib/legacy/glb-viewer-main.legacy.js +1 -1
- package/lib/legacy/{image-renderer-461e7206.legacy.js → image-renderer-5dc590d6.legacy.js} +2 -2
- package/lib/legacy/{image-renderer-461e7206.legacy.js.map → image-renderer-5dc590d6.legacy.js.map} +1 -1
- package/lib/legacy/{material-viewer-f3d50233.legacy.js → material-viewer-d7122341.legacy.js} +2 -2
- package/lib/legacy/material-viewer-d7122341.legacy.js.map +1 -0
- package/lib/legacy/material-viewer-main.legacy.js +1 -1
- package/lib/legacy/{mesh-generator-73e9bb77.legacy.js → mesh-generator-bcc95cb6.legacy.js} +2 -2
- package/lib/legacy/mesh-generator-bcc95cb6.legacy.js.map +1 -0
- package/lib/legacy/pixotron-35cea8f8.legacy.js +2 -0
- package/lib/legacy/{pixotron-3ee64fe3.legacy.js.map → pixotron-35cea8f8.legacy.js.map} +1 -1
- package/lib/legacy/planner-b9154820.legacy.js +2 -0
- package/lib/legacy/{planner-d241eda1.legacy.js.map → planner-b9154820.legacy.js.map} +1 -1
- package/lib/legacy/planner-main.legacy.js +1 -1
- package/lib/legacy/{rapi-access-3efb6c39.legacy.js → rapi-access-ab9c7de3.legacy.js} +2 -2
- package/lib/legacy/{rapi-access-3efb6c39.legacy.js.map → rapi-access-ab9c7de3.legacy.js.map} +1 -1
- package/lib/legacy/roomle-sdk.legacy.js +1 -1
- package/lib/legacy/static/ConfiguratorKernel-4153106c16b35980.wasm +0 -0
- package/lib/legacy/static/{ConfiguratorKernel-740d5afc47f4a393.js → ConfiguratorKernel-e9bbd4998a056b0b.js} +29 -28
- package/lib/legacy/static/ConfiguratorKernelJs-02aa8157cf299656.js +143 -0
- package/lib/legacy/static/ConfiguratorKernelJs-795532b819912c59.mem +0 -0
- package/lib/legacy/static/{RoomleCore-5bf2453bcbe354c7.js → RoomleCore-18f96bc7c4c9fe8e.js} +60 -59
- package/lib/legacy/static/RoomleCore-daed88a09e86faf7.wasm +0 -0
- package/lib/legacy/static/RoomleCoreJs-10b4a8ee2a89da25.mem +0 -0
- package/lib/legacy/static/RoomleCoreJs-1e5e3331b2d12a5a.js +151 -0
- package/lib/legacy/static/shaders-34f19089b7cddbfe.json +1 -0
- package/lib/legacy/{stats-helper-45166dd7.legacy.js → stats-helper-0331e2a2.legacy.js} +2 -2
- package/lib/legacy/{stats-helper-45166dd7.legacy.js.map → stats-helper-0331e2a2.legacy.js.map} +1 -1
- package/lib/{material-viewer-3f664201.js → material-viewer-840eebf7.js} +2 -2
- package/lib/material-viewer-840eebf7.js.map +1 -0
- package/lib/{material-viewer-fa16d602.nomodule.js → material-viewer-9c55d420.nomodule.js} +2 -2
- package/lib/material-viewer-9c55d420.nomodule.js.map +1 -0
- package/lib/material-viewer-main-27d70f5b.js +2 -0
- package/lib/material-viewer-main-27d70f5b.js.map +1 -0
- package/lib/material-viewer-main.nomodule.js +1 -1
- package/lib/{mesh-generator-424d7777.js → mesh-generator-7b9048c1.js} +2 -2
- package/lib/mesh-generator-7b9048c1.js.map +1 -0
- package/lib/{mesh-generator-f01aa162.nomodule.js → mesh-generator-95709715.nomodule.js} +2 -2
- package/lib/mesh-generator-95709715.nomodule.js.map +1 -0
- package/lib/pixotron-2bc1795a.nomodule.js +2 -0
- package/lib/{pixotron-f5a782c2.nomodule.js.map → pixotron-2bc1795a.nomodule.js.map} +1 -1
- package/lib/pixotron-bb62a4ac.js +2 -0
- package/lib/{pixotron-4adf7f89.js.map → pixotron-bb62a4ac.js.map} +1 -1
- package/lib/planner-625e04ba.nomodule.js +2 -0
- package/lib/{planner-7156a8f6.nomodule.js.map → planner-625e04ba.nomodule.js.map} +1 -1
- package/lib/planner-93dd1048.js +2 -0
- package/lib/{planner-da3685cf.js.map → planner-93dd1048.js.map} +1 -1
- package/lib/planner-main-3e727a01.js +2 -0
- package/lib/planner-main-3e727a01.js.map +1 -0
- package/lib/planner-main.nomodule.js +1 -1
- package/lib/{rapi-access-a38945e3.js → rapi-access-693b87b1.js} +2 -2
- package/lib/{rapi-access-a38945e3.js.map → rapi-access-693b87b1.js.map} +1 -1
- package/lib/{rapi-access-f0f589e5.nomodule.js → rapi-access-ec9bc9d3.nomodule.js} +2 -2
- package/lib/{rapi-access-f0f589e5.nomodule.js.map → rapi-access-ec9bc9d3.nomodule.js.map} +1 -1
- package/lib/{roomle-sdk-95a77ca8.js → roomle-sdk-a81664de.js} +2 -2
- package/lib/roomle-sdk-a81664de.js.map +1 -0
- package/lib/roomle-sdk.nomodule.js +1 -1
- package/lib/static/ConfiguratorKernel-4153106c16b35980.wasm +0 -0
- package/lib/static/{ConfiguratorKernel-740d5afc47f4a393.js → ConfiguratorKernel-e9bbd4998a056b0b.js} +1 -1
- package/lib/static/{ConfiguratorKernel-740d5afc47f4a393.js.map → ConfiguratorKernel-e9bbd4998a056b0b.js.map} +1 -1
- package/lib/static/ConfiguratorKernelJs-02aa8157cf299656.js +143 -0
- package/lib/static/ConfiguratorKernelJs-795532b819912c59.mem +0 -0
- package/lib/static/{RoomleCore-5bf2453bcbe354c7.js → RoomleCore-18f96bc7c4c9fe8e.js} +1 -1
- package/lib/static/RoomleCore-18f96bc7c4c9fe8e.js.map +1 -0
- package/lib/static/RoomleCore-daed88a09e86faf7.wasm +0 -0
- package/lib/static/RoomleCoreJs-10b4a8ee2a89da25.mem +0 -0
- package/lib/static/RoomleCoreJs-1e5e3331b2d12a5a.js +151 -0
- package/lib/static/shaders-34f19089b7cddbfe.json +1 -0
- package/lib/{stats-helper-0174ebc6.js → stats-helper-47b1c13e.js} +2 -2
- package/lib/{stats-helper-0174ebc6.js.map → stats-helper-47b1c13e.js.map} +1 -1
- package/lib/{stats-helper-7bde838a.nomodule.js → stats-helper-90311a20.nomodule.js} +2 -2
- package/lib/{stats-helper-7bde838a.nomodule.js.map → stats-helper-90311a20.nomodule.js.map} +1 -1
- package/package.json +2 -2
- package/lib/component-dimensioning-35b54244.nomodule.js.map +0 -1
- package/lib/component-dimensioning-8920213d.js.map +0 -1
- package/lib/configurator-main-0e641b06.js +0 -2
- package/lib/configurator-main-0e641b06.js.map +0 -1
- package/lib/configurator-mesh-generator-6de7ffc4.js.map +0 -1
- package/lib/configurator-mesh-generator-cd880edc.nomodule.js +0 -2
- package/lib/configurator-mesh-generator-cd880edc.nomodule.js.map +0 -1
- package/lib/default-light-setting-a2b9b498.nomodule.js.map +0 -1
- package/lib/default-light-setting-fbb51c21.js.map +0 -1
- package/lib/glb-viewer-main-dc4c15d2.js +0 -2
- package/lib/glb-viewer-main-dc4c15d2.js.map +0 -1
- package/lib/legacy/component-dimensioning-4fe5ffb3.legacy.js.map +0 -1
- package/lib/legacy/configurator-mesh-generator-74eda1f8.legacy.js.map +0 -1
- package/lib/legacy/default-light-setting-c8541f99.legacy.js.map +0 -1
- package/lib/legacy/material-viewer-f3d50233.legacy.js.map +0 -1
- package/lib/legacy/mesh-generator-73e9bb77.legacy.js.map +0 -1
- package/lib/legacy/pixotron-3ee64fe3.legacy.js +0 -2
- package/lib/legacy/planner-d241eda1.legacy.js +0 -2
- package/lib/legacy/static/ConfiguratorKernel-8338b6e04f42e1bb.wasm +0 -0
- package/lib/legacy/static/ConfiguratorKernelJs-05d7ca332e0afd5c.js +0 -143
- package/lib/legacy/static/ConfiguratorKernelJs-94d09444363eb9cc.mem +0 -0
- 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 +0 -151
- package/lib/legacy/static/shaders-3dcf00140faf6643.json +0 -1
- package/lib/material-viewer-3f664201.js.map +0 -1
- package/lib/material-viewer-fa16d602.nomodule.js.map +0 -1
- package/lib/material-viewer-main-5fc326d1.js +0 -2
- package/lib/material-viewer-main-5fc326d1.js.map +0 -1
- package/lib/mesh-generator-424d7777.js.map +0 -1
- package/lib/mesh-generator-f01aa162.nomodule.js.map +0 -1
- package/lib/pixotron-4adf7f89.js +0 -2
- package/lib/pixotron-f5a782c2.nomodule.js +0 -2
- package/lib/planner-7156a8f6.nomodule.js +0 -2
- package/lib/planner-da3685cf.js +0 -2
- package/lib/planner-main-8f139990.js +0 -2
- package/lib/planner-main-8f139990.js.map +0 -1
- package/lib/roomle-sdk-95a77ca8.js.map +0 -1
- package/lib/static/ConfiguratorKernel-8338b6e04f42e1bb.wasm +0 -0
- package/lib/static/ConfiguratorKernelJs-05d7ca332e0afd5c.js +0 -143
- package/lib/static/ConfiguratorKernelJs-94d09444363eb9cc.mem +0 -0
- package/lib/static/RoomleCore-5bf2453bcbe354c7.js.map +0 -1
- package/lib/static/RoomleCore-6d3b769c4ee59ce2.wasm +0 -0
- package/lib/static/RoomleCoreJs-6aaba29145bc7b7d.mem +0 -0
- package/lib/static/RoomleCoreJs-c7fc9ea60bea9da9.js +0 -151
- package/lib/static/shaders-3dcf00140faf6643.json +0 -1
|
@@ -12,5 +12,5 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */function __decorate(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 EnvMapReader{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 toRadiant=function(e){return e*(Math.PI/180)},getIdealDistance=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=toRadiant(s),c=t/2/Math.tan(l/2),h=e/(2*Math.atan(Math.PI*a/360));return Math.max(c,h)},round=function(e){return Math.round(1e3*e)/1e3},getDelta=function(e,t){return Math.abs(e.y-t.y)+Math.abs(e.x-t.x)},getAngle=function(e,t){return Math.atan2(t.y-e.y,t.x-e.x)},to360Degrees=function(e){let t=function(e){return e*(180/Math.PI)}(e);return t<0&&(t=180+(180+t)),t},PREVIEW_MATERIAL_COLOR="#DDDDDD",PREVIEW_MATERIAL_ROUGHNESS=1,PREVIEW_MATERIAL_METALNESS=0,PREVIEW_MATERIAL_OPACITY=1,getScreenXY=(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},kernelBoxToThreeBox=(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)},kernelDimensioningToThree=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),position3VectorsAreEqual=(e,t)=>{let n=round(e.x),s=round(e.y),r=round(e.z),o=round(t.x),i=round(t.y),a=round(t.z);return n===o&&s===i&&r===a},rotationQuaternionsAreEqual=(e,t)=>{let n=round(e.w),s=round(e.x),r=round(e.y),o=round(e.z),i=round(t.w),a=round(t.x),l=round(t.y),c=round(t.z);return n===i&&s===a&&r===l&&o===c},position2VectorsAreEqual=(e,t)=>{let n=round(e.x),s=round(e.y),r=round(t.x),o=round(t.y);return n===r&&s===o};let whiteTexture=null;const getWhiteTexture=()=>{if(whiteTexture)return whiteTexture;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},createColorTexture=(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},createMaterial=(e,t)=>setMaterial(null,e,t),setMaterial=(e,t,n)=>{if(e||(e=createMeshPhysicalMaterial()),e.name=t.id?t.id.toString():"",void 0!==t.shading.metallic&&(e.metalness=1===t.shading.metallic?1:.5,e.reflectivity=getValue(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=getValue(t.shading.occlusion,1),e.roughness=getValue(t.shading.roughness,.5),e.alphaTest=getValue(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==n||n.setEnvMap(e),t.shading.doubleSided?e.side=THREE.DoubleSide:e.side=THREE.FrontSide,e.map||(whiteTexture||(whiteTexture=getWhiteTexture()),e.map=whiteTexture),e},createMeshPhysicalMaterial=()=>new THREE.MeshPhysicalMaterial({}),getMaterialShading=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 textureLoader=null;const addTexture=(e,t,n,s,r,o,i=16)=>(textureLoader||(textureLoader=new THREE.TextureLoader,textureLoader.crossOrigin=""),new Promise((a,l)=>{if(!e)return console.warn("trying to add a texture without image",t),void a();textureLoader.load(e,e=>{addExistingTexture(e,t,n,s,r,o,i),a()},l)})),addExistingTexture=(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===getWhiteTexture()&&(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)},getGUI=(e=!0)=>window.dat&&window.dat.GUI?(window.__RML_GUI__||(window.__RML_GUI__=new dat.GUI({autoPlace:e})),window.__RML_GUI__):null,setWallTransparencyBasedOnCamera=(e,t,n=!0)=>{let s=e.getWorldDirection(new THREE.Vector3),r=Math.abs(s.y);r<.5&&!t.transparent&&setWallTransparency(t,!0,n),r>.5&&t.transparent&&setWallTransparency(t,!1,n)},setWallTransparency=(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},getColorFromInt=e=>{let t=new THREE.Color;return t.setRGB((e>>16)/255,(e>>8&255)/255,(e>>0&255)/255),t},transitionTransparencyOfMaterial=(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()}})},fadeIn=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()}})},checkGLB=(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},dispose=e=>{"Mesh"===e.type?disposeMesh(e):disposeObject(e)},disposeObject=e=>{e&&e.children&&0!==e.children.length&&e.children.forEach(e=>{disposeMesh(e)})},disposeMesh=e=>{e&&(e.material&&disposeMaterial(e.material),e.geometry&&disposeGeometry(e.geometry),e.children&&e.children.length>0&&disposeObject(e))},disposeGeometry=e=>{e&&e.dispose()},disposeMaterial=e=>{e&&(e.map&&e.map.dispose(),e.normalMap&&e.normalMap.dispose(),e.dispose())};let boundingBoxMaterial;const getBoundingBoxMaterial=()=>(boundingBoxMaterial||(boundingBoxMaterial=new THREE.MeshBasicMaterial,boundingBoxMaterial.visible=!1),boundingBoxMaterial),getSelectionGeometry=(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},vectorIsZero=e=>0===e.x&&0===e.y&&0===e.z,getMaterialId=(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},vectorIsEqual=(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,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},dashCase=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 inject(e,t){const n=Symbol("property-cache");Object.defineProperty(e,t,{get(){if(!this[n]){const e=window.__RML__DI__.lookup(dashCase(t),this._creator_);e?this[n]=e:console.error("Dependency "+dashCase(t)+" not found! Add dependency to /utils/injectables.ts")}return this[n]}})}let EnvironmentLoader=(()=>{class e{constructor(e){this._hdrCubeUrl="static/roomle-91862a5e7f3f46e5.envmap",this._hdrCubeUrlLowres="static/roomle64-adb0f447a54b5143.envmap",this._envMapReader=new EnvMapReader,this._creator_=e;const t=new THREE.Color("#DDDDDD");this._environmentMap=((e,t,n,s)=>{const r=new THREE.CubeTexture;r.format=THREE.RGBAFormat,r.generateMipmaps=!1;for(let s=0;s<6;++s){const o=createColorTexture(e,t,n,1);o.format=r.format,o.type=r.type,o.minFilter=r.minFilter,o.magFilter=r.magFilter,o.generateMipmaps=r.generateMipmaps,o.needsUpdate=!0,r.images[s]=o}return r.needsUpdate=!0,r})(t.r,t.g,t.b),this._envMapReader.setPath(getAssetPath()),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 __decorate([inject],e.prototype,"_initData",void 0),e})();const PREDEFINED_LIGHTSETTING={SOFA:"sofa",SHELF:"shelf",SHELF_FRONT:"shelf_front",BAKED:"baked",CAMERA:"camera",EQUAL:"equal"};class DynamicLightSettingLoader{static createDynamicLightSettingSource(e,t){let n={};if(e)n.url=e;else if(t)switch(t){case PREDEFINED_LIGHTSETTING.SHELF:n.url=getAssetPath()+"static/shelf-2975dd3f2fa9c763.json";break;case PREDEFINED_LIGHTSETTING.SHELF_FRONT:n.url=getAssetPath()+"static/shelf_front-8c9566a4512f0de8.json";break;case PREDEFINED_LIGHTSETTING.SOFA:n.url=getAssetPath()+"static/sofa-997b116bc5f2e92e.json";break;case PREDEFINED_LIGHTSETTING.BAKED:n.url=getAssetPath()+"static/baked-6485a2b1daeb69e8.json";break;case PREDEFINED_LIGHTSETTING.CAMERA:n.url=getAssetPath()+"static/camera-f4cef679615485dc.json";break;case PREDEFINED_LIGHTSETTING.EQUAL:n.url=getAssetPath()+"static/equal-319f6b83c827913f.json";break;default:n.url=getAssetPath()+"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}}const NAMES_FOR_LOCALHOST=["127.0.0.1","localhost","0.0.0.0"],isIdItemId=function(e){return!(!e||"string"!=typeof e||e.split(":").length>2)},getCatalogIdFromItemOrConfigurationId=e=>{if(!e||"string"!=typeof e)return null;const t=e.split(":");return t.length<2?null:t[0]},kernelPartToPriceId=({articleNr:e,componentId:t})=>e&&""!==e?t.split(":")[0]+":"+e:null,wasRequestSuccess=(e,t)=>null!=e?"string"==typeof e?"true"===e:!0===e:("string"==typeof t&&(t=parseInt(t,10)),t>=200&&t<300);class NetworkLayer{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(),wasRequestSuccess(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 Logger{info(...e){console}log(...e){console}warn(...e){console.warn.apply(console,e)}error(...e){console.warn.apply(console,e)}}let KernelIo=(()=>{class e extends Logger{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 __decorate([inject],e.prototype,"_globalCallback",void 0),e})();const ASSET_CACHE=new Map,SYNCED_CATALOGS=new Map,SYNCED_FLOORS_TAGS=new Map,SYNCED_TYPE_CHANGE_TAGS=new Map;let DataSyncer=(()=>{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(()=>{SYNCED_TYPE_CHANGE_TAGS.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&&!SYNCED_FLOORS_TAGS.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(()=>{SYNCED_FLOORS_TAGS.set(e,!0),n()},e=>this._softReject(n,'_syncFloorTag error: "'+e+'"'))})):Promise.resolve()}_syncTypeChangeTag(e){const t=[];return e&&!SYNCED_TYPE_CHANGE_TAGS.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(()=>{SYNCED_FLOORS_TAGS.set(e,!0),n()},e=>this._softReject(n,'_syncTypeChangeTag error: "'+e+'"'))})):Promise.resolve()}getIsCatalogSynced(e){return!!SYNCED_CATALOGS.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(getAssetPath()+"static/asset-loader.worker-796c70f59b977071.js"),this._mainThreadToWorker=new MainThreadToWorker(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(()=>{SYNCED_CATALOGS.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(ASSET_CACHE.get(e))return t();this._assetUrlToBase64(e).then(n=>{ASSET_CACHE.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:ASSET_CACHE.get(e)||(t?e:null)}setAlwaysUseCache(e){this._alwaysUseCache=e}preFillAssetCache(e,t){ASSET_CACHE.set(e,t)}}return __decorate([inject],e.prototype,"_rapiAccess",void 0),__decorate([inject],e.prototype,"_singlePromiseFactory",void 0),__decorate([inject],e.prototype,"_errorHandler",void 0),__decorate([inject],e.prototype,"_configuratorUiCallbacks",void 0),__decorate([inject],e.prototype,"_initData",void 0),e})();class AsyncGuard{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()}}var GLTF_LOADER_FILE_NAME="static/GLTFLoader-5b296b5fb14cfe1a.js",DRACO_LOADER_FILE_NAME="static/DRACOLoader-5edeeab4a8dbc0bd.js";const DRACO_LIB_FILES={"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 StaticItemLoader=(()=>{class e{constructor(e){if(this._gltfLoaderGuard=new AsyncGuard,this._creator_=e,THREE.GLTFLoader&&THREE.DRACOLoader)this._initLoaders();else{let e=this._scriptLoader.fetch("static/GLTFLoader-5b296b5fb14cfe1a.js",{id:"gltf-loader"}),t=this._scriptLoader.fetch("static/DRACOLoader-5edeeab4a8dbc0bd.js",{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 s=DRACO_LIB_FILES[e];if(!s)throw new Error('Can not load draco dependency "'+e+'" did three.js update DracoLoader lib? Available files'+JSON.stringify(DRACO_LIB_FILES));return t(getAssetPath()+s,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 __decorate([inject],e.prototype,"_environmentLoader",void 0),__decorate([inject],e.prototype,"_scriptLoader",void 0),e})(),ThreeLoader=(()=>{class e{constructor(e){this._jsonLoaded=!1,this._creator_=e}_loadShaders(){return new Promise((e,t)=>{if(this._jsonLoaded)return e();this._networkLayer.fetch(getAssetPath()+"static/shaders-3dcf00140faf6643.json",{credentials:"same-origin"}).then(handleJsonResponse,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 __decorate([inject],e.prototype,"_scriptLoader",void 0),__decorate([inject],e.prototype,"_networkLayer",void 0),e})(),LocalStorageHelper=(()=>{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 __decorate([inject],e.prototype,"_localStorage",void 0),e})();class DynamicQualitySettingLoader{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)}}}const convertToTHREE=e=>new THREE.Vector3(e.x/1e3,e.z/1e3,e.y/-1e3),convertToThreeDimensions=e=>new THREE.Vector3(e.x/1e3,e.z/1e3,e.y/1e3),convertToKernel=e=>({x:1e3*e.x,y:-1e3*e.z,z:1e3*e.y}),utilityStringToUTF16=e=>decodeURIComponent(encodeURIComponent(e)),convertCObject=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=utilityToArray(e);for(let e=0;e<t.length;e++)t[e]=convertCObject(t[e]);return"string"==typeof t?utilityStringToUTF16(t):t}if("object"==typeof e)for(let t in e)e.hasOwnProperty(t)&&(e[t]=convertCObject(e[t]));return"string"==typeof e?utilityStringToUTF16(e):e},utilityToArray=e=>{let t=[];if(e){let n=e.size();for(let s=0;s<n;s++)t.push(e.get(s))}return t},convertToThreeMatrix=e=>{let t=new THREE.Matrix4,n=convertCObject(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 RoomleComponentFactoryInitializer(){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(convertToThreeMatrix(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),disposeMesh(e),t<0||this.meshes.splice(t,1)}removeAllMeshes(e=!0){this.meshes.forEach(t=>{this.remove(t),e&&disposeMesh(t)}),this.meshes=[],this._removeLoadingMesh(),this.remove(this._boundingBoxMesh),disposeMesh(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:1,color:new THREE.Color("#DDDDDD")})),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),disposeMesh(this._loadingMesh),this._loadingMesh=null)}loadingFinished(){this._removeLoadingMesh(),this._showAllMeshes()}deselect(){this._selected=!1}hoverOn(){setCursor("pointer")}hoverOff(){setCursor("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=kernelBoxToThreeBox(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 convertToKernel(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")}),setCursor("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")}),setCursor("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=convertToTHREE(e)}get roomleLineFrom(){return this._roomleLineFrom}set roomleLineTo(e){this._roomleLineTo=e;let t=convertToTHREE(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=convertToTHREE(e)}get roomlePositionFrom(){return this._roomlePositionFrom}set roomlePositionTo(e){this._roomlePositionTo=e;let t=convertToTHREE(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,setCursor("pointer")}hoverOff(){this._dockline.visible=!1,setCursor("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:"#DDDDDD",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),_=Math.abs(r.y),p=Math.abs(r.z);u>=_&&u>=p?(h=new THREE.Vector3(c.x,0,0),d=Math.sqrt(c.y*c.y+c.z*c.z)):_>=u&&_>=p?(h=new THREE.Vector3(0,c.y,0),d=Math.sqrt(c.x*c.x+c.z*c.z)):p>=_&&p>=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 g=(new THREE.Vector3).subVectors(this.positionTo.clone(),this.positionFrom.clone()).length()+h.length(),m=new THREE.CylinderGeometry(1.1*d,1.1*d,g,32,1);this.boundingLineMesh=new THREE.Mesh(m,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(),E=this.positionFrom.clone(),y=(new THREE.Vector3).subVectors(f,E).normalize(),T=new THREE.ArrowHelper(y,E);const C=(new THREE.Quaternion).setFromEuler(T.rotation);this.boundingLineMesh.quaternion.multiply(C),this.boundingLineMesh.renderOrder=3;let w=(new THREE.Vector3).addVectors(this.positionTo.clone(),this.positionFrom.clone()).multiplyScalar(.5).add(c);this.boundingLineMesh.position.copy((new THREE.Vector3).subVectors(w,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 convertToKernel(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,_=this.aspect*u;return this.view&&this.view.enabled&&(e+=this.view.offsetX*_/this.view.fullWidth,n-=this.view.offsetY*u/this.view.fullHeight,t+=this.view.offsetX*_/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 WAITERS=new Map,_endOperation=function(e,t,n){let s=WAITERS.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)),WAITERS.delete(e)}};class AsyncHelper{static finishOperation(e,t){_endOperation(e,!0,t)}static failOperation(e,t){_endOperation(e,!1,t)}static waitFor(e,t){return new Promise((n,s)=>{let r=WAITERS.get(e);r||(WAITERS.set(e,[]),r=WAITERS.get(e)),r.push({resolve:n,reject:s}),"function"==typeof t&&t.apply(t)})}}const META_INFO=new Map;class Benchmark{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=Benchmark.getMeta(e);META_INFO.set(e,Object.assign(n,t))}static getMeta(e){return META_INFO.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)}}var defaultSettings={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"}};"undefined"!=typeof module&&module.exports||(window.IS_DEBUG=!0),function(e=!1){if(e){let e=JSON.parse(JSON.stringify(defaultSettings));e.APP,e.features}}();var Env=JSON.parse(JSON.stringify(defaultSettings));const isRange=function(e){return e.validRange&&"string"==typeof e.validRange.type},isOptions=function(e){return e.validValues&&e.validValues.length>0},hasUnits=function(e){return"length"===e.unitType||"area"===e.unitType},isMaterial=function(e){return"Material"===e.type};let MEM_URL,WASM_URL,WASM_LOADER,ASM_LOADER,CACHE_COMPILATION;const KERNEL_PATHS={WASM:{CONFIGURATOR:{URL:"static/ConfiguratorKernel-8338b6e04f42e1bb.wasm",LOADER:"static/ConfiguratorKernel-740d5afc47f4a393.js"},PLANNER:{URL:"static/RoomleCore-6d3b769c4ee59ce2.wasm",LOADER:"static/RoomleCore-5bf2453bcbe354c7.js"}},ASM:{CONFIGURATOR:{MEM_URL:"static/ConfiguratorKernelJs-94d09444363eb9cc.mem",LOADER:"static/ConfiguratorKernelJs-05d7ca332e0afd5c.js"},PLANNER:{MEM_URL:"static/RoomleCoreJs-6aaba29145bc7b7d.mem",LOADER:"static/RoomleCoreJs-c7fc9ea60bea9da9.js"}}},USE_WASM=!!window.WebAssembly;let CommonKernelAccess=(()=>{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=USE_WASM,this._kernelPath=USE_WASM?WASM_LOADER:ASM_LOADER,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";MEM_URL=KERNEL_PATHS.ASM[t].MEM_URL,WASM_URL=KERNEL_PATHS.WASM[t].URL,WASM_LOADER=KERNEL_PATHS.WASM[t].LOADER,ASM_LOADER=KERNEL_PATHS.ASM[t].LOADER,CACHE_COMPILATION=!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)?getAssetPath()+MEM_URL:t},wasmBinaryFile:getAssetPath()+WASM_URL,preRun:[],postRun:[],setStatus:null,print(e){t._kernelIo.log(e)},printErr(e){t._kernelIo.error(e)},quit(e){0!==e&&t._kernelIo.throw(e&&e.toString?e.toString():"Unknown error while C/C++ main executes")}},CACHE_COMPILATION&&USE_WASM&&(this._kernelContainer.instantiateWasm=function(e,t){return((e,t,n)=>{const s="function"==typeof WebAssembly.instantiateStreaming;Benchmark.addMeta("kernel_is_ready",{cachedInIndexedDB:!1});let r=null;s?(Benchmark.start("kernel_stream_compile"),r=WebAssembly.instantiateStreaming(fetch(getAssetPath()+e),t),Benchmark.end("kernel_stream_compile")):(Benchmark.start("kernel_legacy_compile"),r=fetch(getAssetPath()+e).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,t))),Benchmark.addMeta("kernel_is_ready",{instantiateStreaming:s}),r.then(e=>{Benchmark.end(s?"kernel_stream_compile":"kernel_legacy_compile"),n(e.instance)},e=>console.error(e))})(WASM_URL,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}),Env.isProduction||Env.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=getCatalogIdFromItemOrConfigurationId(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,AsyncHelper.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){let t=Array.isArray(e)?e:[e];if(this._requestedMaterialIds.push(...t),await wait(0),!this._requestedMaterialIds.length)return;const n=[...this._requestedMaterialIds];this._requestedMaterialIds=[];const s=await this._rapiAccess.getMaterials(n);let r=[];s.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()&&r.push({id:e.id,properties:t})}),r.length&&this._kernelInstance.setMaterialProperties(r)}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=kernelPartToPriceId(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=objectArrayToMap(n,"priceId");let i=0;return t.fullList.forEach(e=>{const t=kernelPartToPriceId(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=kernelPartToPriceId(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),isMaterial(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 __decorate([inject],e.prototype,"_rapiAccess",void 0),__decorate([inject],e.prototype,"_scriptLoader",void 0),__decorate([inject],e.prototype,"_kernelIo",void 0),__decorate([inject],e.prototype,"_dataSyncer",void 0),__decorate([inject],e.prototype,"_lifeCycleManager",void 0),__decorate([inject],e.prototype,"_configuratorUiCallbacks",void 0),__decorate([inject],e.prototype,"_globalCallback",void 0),__decorate([inject],e.prototype,"_initData",void 0),__decorate([inject],e.prototype,"_unitFormatter",void 0),__decorate([inject],e.prototype,"_configuratorContext",void 0),__decorate([inject],e.prototype,"_globalInitData",void 0),e})();const DOCKING_CONVERSATION_ID=10,DEFAULT_CONVERSATION_ID=9;let ConfiguratorViewModel=(()=>{class e{constructor(e){this._mergeThreshold=3,this._componentsToMerge=new OccurrenceMap,this._mergeInProgress=!1,this._components=new Map,this._previews=new Map,this._creator_=e,this._getKernelAccess().addConfiguratorListener(this),this._componentFactory=RoomleComponentFactoryInitializer()}get materialQueue(){return this.getMeshGenerator().materialQueue}_getKernelAccess(){return RoomleDependencyInjection.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(convertToThreeMatrix(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=convertToThreeMatrix(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=convertToThreeMatrix(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=Benchmark.start("dock_component_with_position_"+e.childId);this._getKernelAccess().dockComponentWithPosition(e.parentId,e.parentDockId,e.childId,e.childDockId,n),this._configuratorContext.dockingRootComponentId=null,Benchmark.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)];AsyncHelper.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){10===e&&(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 kernelBoxToThreeBox(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 AsyncGuard(e),this._getKernelAccess().requestPlanComponentConstruction(e),this._subPartGuard.wait()}getMeshGenerator(){return this._configuratorMeshGenerator}}return __decorate([inject],e.prototype,"_configuratorMeshGenerator",void 0),__decorate([inject],e.prototype,"_configuratorContext",void 0),__decorate([inject],e.prototype,"_cacheHolder",void 0),__decorate([inject],e.prototype,"_initData",void 0),e})();class OccurrenceMap 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 InitData{constructor(e){this.autoQuality=!0,this.colors=ROOMLE_COLORS,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){deepMerge(this,e)}}const BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN=["language","browserLanguage","userLanguage","systemLanguage"];class GlobalInitData{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=BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN.length;e<n;e++){const n=t[BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN[e]];if(n)return n.substr(0,2)}return"en"})()||"en",this.overrideCountry=null,this._creator_=e}setOverrides(e){deepMerge(this,e)}}class UiCallback{constructor(e){return this._isMute=!1,this._creator_=e,setDescriptor(this,"_isMute",{enumerable:!1,writable:!1}),setDescriptor(UiCallback.prototype,"_setMute",{enumerable:!1,writable:!1}),setDescriptor(UiCallback.prototype,"mute",{enumerable:!1,writable:!1}),setDescriptor(UiCallback.prototype,"unmute",{enumerable:!1,writable:!1}),new Proxy(this,this)}_setMute(e){setWriteable(this,"_isMute",!0),this._isMute=e,setWriteable(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]}}class GlobalCallback extends UiCallback{constructor(){super(...arguments),this.onNetworkRequest=(e,t,n)=>{},this.onKernelMsg=(e,t,n={})=>{},this.onCheckExternalCache=async(e,t)=>Promise.resolve(null)}}const CANVAS_ID={HSC:"rml-hsc",HSP:"rml-hsp",GLB:"rml-glb",RMV:"rml-mv"};let DomHelper=(()=>{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 __decorate([inject],e.prototype,"_lifeCycleManager",void 0),e})(),KERNEL_UNIT={InchFeet:null,MM:null,CM:null},KERNEL_UNIT_STRING_TYPE={NoUnitString:null,LongUnitString:null,ShortUnitString:null},UnitFormatter=(()=>{class e{constructor(e){this._formatter=null,this._precision=0,this._creator_=e}init(e){const t=new e.UnitMeasureFormatter;KERNEL_UNIT=e.Unit,KERNEL_UNIT_STRING_TYPE=e.UnitStringType,this._initActualUnit(),this._initActualUnitStringType();const{precisionCm:n,precisionInch:s}=this._initData;this._actualUnit===KERNEL_UNIT.InchFeet?this._precision=void 0!==s?parseInt(s,10):2:this._actualUnit===KERNEL_UNIT.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=KERNEL_UNIT.CM;break;case"mm":this._actualUnit=KERNEL_UNIT.MM;break;case"inchfeet":this._actualUnit=KERNEL_UNIT.InchFeet;break;default:this._actualUnit=KERNEL_UNIT.CM}}_initActualUnitStringType(){const{unitStringType:e}=this._initData;switch(e){case"none":this._actualUnitStringType=KERNEL_UNIT_STRING_TYPE.NoUnitString;break;case"long":this._actualUnitStringType=KERNEL_UNIT_STRING_TYPE.LongUnitString;break;case"short":this._actualUnitStringType=KERNEL_UNIT_STRING_TYPE.ShortUnitString;break;default:this._actualUnitStringType=KERNEL_UNIT_STRING_TYPE.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){hasUnits(e)&&(e.valueLabel=this._formatParameterValue(e.value,e.unitType))}formatParameter(e){if(hasUnits(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),isMaterial(e))e.uiType="Material";else if(function(e){return"Boolean"===e.type}(e))e.uiType="Boolean";else if(isRange(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 isOptions(e)?(e.uiType="Options",function(e){return!!isOptions(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===KERNEL_UNIT.InchFeet}getPrecision(){return this._precision}getAllowedDelta(){const e=1/Math.pow(10,this._precision);return this.isInch()?25.4*e:e}}return __decorate([inject],e.prototype,"_initData",void 0),e})();class ScenePluginDefaultImplementation{constructor(e){this._creator_=e}setScene(e){}setUiScene(e){}updateBounds(e){}clearScene(e,t){}moveCameraEnd(e){}moveCameraStart(e){}needsUiScene(){return!1}}let PluginSystem=(()=>{class e{constructor(e){this._plugins=[],this._creator_=e}async init(e,t,n){this._scene=e,this._uiScene=t,this._cameraPosition=n;const{bananaForScale:s}=this._initData;s&&await import("./banana-for-scale-7b0bca43.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 __decorate([inject],e.prototype,"_initData",void 0),e})();const INJECTABLES=[new DependencyInjectionAssignment("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 DependencyInjectionAssignment("form-data-util",FormDataUtil),new DependencyInjectionAssignment("environment-loader",EnvironmentLoader),new DependencyInjectionAssignment("static-item-loader",StaticItemLoader,0),new DependencyInjectionAssignment("form-data-util",FormDataUtil),new DependencyInjectionAssignment("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 DependencyInjectionAssignment("dynamic-light-setting-loader",DynamicLightSettingLoader),new DependencyInjectionAssignment("dynamic-quality-setting-loader",DynamicQualitySettingLoader),new DependencyInjectionAssignment("network-layer",NetworkLayer),new DependencyInjectionAssignment("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 DependencyInjectionAssignment("network-layer",NetworkLayer),new DependencyInjectionAssignment("kernel-io",KernelIo,0),new DependencyInjectionAssignment("data-syncer",DataSyncer),new DependencyInjectionAssignment("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 DependencyInjectionAssignment("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 DependencyInjectionAssignment("three-loader",ThreeLoader),new DependencyInjectionAssignment("local-storage-helper",LocalStorageHelper),new DependencyInjectionAssignment("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())disposeObject(e);for(const e of this._materialCache.values())disposeMaterial(e);for(const e of this._geometryCache.values())disposeGeometry(e);this._componentCache.clear(),this._geometryCache.clear(),this._materialCache.clear()}},0),new DependencyInjectionAssignment("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 DependencyInjectionAssignment("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 DependencyInjectionAssignment("configurator-view-model",ConfiguratorViewModel,1),new DependencyInjectionAssignment("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 DependencyInjectionAssignment("init-data",InitData,1),new DependencyInjectionAssignment("global-init-data",GlobalInitData,0),new DependencyInjectionAssignment("global-callback",GlobalCallback,0),new DependencyInjectionAssignment("dom-helper",DomHelper,1),new DependencyInjectionAssignment("unit-formatter",UnitFormatter,0),new DependencyInjectionAssignment("plugin-system",PluginSystem,1)];class RoomleDependencyInjection{static _ensureContainer(){window.__RML__DI__||(window.__RML__DI__=new Container,window.__RML__DI__.addDependencyInjectionAssignments(INJECTABLES))}static setup(e){RoomleDependencyInjection.addToContainer(e)}static lookup(e,t){return window.__RML__DI__?window.__RML__DI__.lookup(e,t):null}static getContext(e){return RoomleDependencyInjection._ensureContainer(),window.__RML__DI__.getContext(e)}static cleanUp(e){return window.__RML__DI__?window.__RML__DI__.cleanUp(e):null}static addToContainer(e){RoomleDependencyInjection._ensureContainer(),window.__RML__DI__.addDependencyInjectionAssignments(e)}}let AppContext=(()=>{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:APP$1}=Env,{RAPI}=APP$1,headers=RAPI.headers,itemHeaders=RAPI.itemHeaders,TOKEN_IDENTIFIER=headers.token,MESH_DEFAULT_FORMAT="crt",LEGACY_GROUP_INDICATOR=uuid();let RAPI_MATERIAL_GROUP_CACHE=new Map,ITEM_ADDITIONAL_CONTENT_CACHE=new Map,RAPI_RELATIONS_CACHE=new Map,RAPI_CACHE=new Map,MESHES_TO_CATALOG_CACHE=new Map,RAPI_PACKAGE_CACHE=new Map,RAPI_PRELOAD_CACHE=new Map,WAITERS_FOR_URL=new Map,RAPI_ERROR_CACHE=new Map;const getCachedMaterialGroup=e=>RAPI_MATERIAL_GROUP_CACHE.get(e)||RAPI_MATERIAL_GROUP_CACHE.get(LEGACY_GROUP_INDICATOR+e),hasMaterialTags=e=>e&&e.tags&&e.tags.length,materialHasNoTagsButGroup=e=>!hasMaterialTags(e)&&e.group;let RapiAccess=(()=>{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(getCatalogIdFromItemOrConfigurationId(e)))return n();if(RAPI_PRELOAD_CACHE.get(e))return n();const r=t?"?itemId=":"?configurationId=";this._get("/preloads/components/"+r+e,"preloads/components").then(t=>{if(RAPI_PRELOAD_CACHE.get(e))return n();t.forEach(e=>{this._prepareData(e,"components")}),RAPI_PRELOAD_CACHE.set(e,!0),n()},s)})}changeUseOfHDGeometry(){const e=RAPI_CACHE.get("components");RAPI_PRELOAD_CACHE.clear(),RAPI_PACKAGE_CACHE.clear(),e&&RAPI_CACHE.delete("components")}getHSCPackage(e){return new Promise((t,n)=>{if(RAPI_PACKAGE_CACHE.get(e))return t();this._get("/catalogs/"+e+"/package","package").then(n=>{if(RAPI_PACKAGE_CACHE.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")}),RAPI_PACKAGE_CACHE.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:itemHeaders})}getComponents(e){return this._getByIds(e,"components")}getItems(e){return this._getByIds(e,"items",{additionalHeaders:itemHeaders})}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="crt",n=50){return this._getById(e,"meshes",{pathSuffix:"/data?format="+t+"&targetQuality="+n.toString()})}getMeshesOfCatalog(e){return new Promise((t,n)=>{const s=MESHES_TO_CATALOG_CACHE.get(e);s?t(s):this._get("/meshes?catalog="+e,"catalogMeshes").then(n=>{MESHES_TO_CATALOG_CACHE.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=ITEM_ADDITIONAL_CONTENT_CACHE.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=ITEM_ADDITIONAL_CONTENT_CACHE.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),ITEM_ADDITIONAL_CONTENT_CACHE.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(){RAPI_MATERIAL_GROUP_CACHE=new Map,RAPI_RELATIONS_CACHE=new Map,RAPI_CACHE=new Map,RAPI_PACKAGE_CACHE=new Map,RAPI_PRELOAD_CACHE=new Map,WAITERS_FOR_URL=new Map,ITEM_ADDITIONAL_CONTENT_CACHE=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=getCachedMaterialGroup(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=RAPI_CACHE.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,IMAGE_FORMATS.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:LEGACY_GROUP_INDICATOR+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?getCachedMaterialGroup(t):[];a||(RAPI_MATERIAL_GROUP_CACHE.set(t,[]),a=getCachedMaterialGroup(t)),-1===a.indexOf(i.toString())&&a.push(i.toString());const l=hasMaterialTags(n),c=l&&e,h=materialHasNoTagsButGroup(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=AppContext.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=WAITERS_FOR_URL.get(e);Array.isArray(o)&&o.length>0?o.push({resolve:s,reject:r}):(WAITERS_FOR_URL.set(e,[{resolve:s,reject:r}]),this._fetchJson(e,t,n))})}_fetchJson(e,t,n={}){this._fetch(e,n).then(handleJsonResponse.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=RAPI.server;const r=this._globalInitData.overrideRapi;r&&(s="live"===r?RAPI.liveServer:RAPI.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={...headers};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||TOKEN_IDENTIFIER;t.token="03-"+window.btoa((new Date).toISOString()+";"+a+";"+headers.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,RAPI_CACHE)}_getErrorCache(e){return this._getCacheFrom(e,RAPI_ERROR_CACHE)}_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=RAPI_RELATIONS_CACHE.get(t);if(!s){const r=new Map,o=new Map;o.set(n,void 0),r.set(e,o),RAPI_RELATIONS_CACHE.set(t,r),s=RAPI_RELATIONS_CACHE.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=getCachedMaterialGroup(t);s||(RAPI_MATERIAL_GROUP_CACHE.set(t,[]),s=getCachedMaterialGroup(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){RAPI_RELATIONS_CACHE.has(e)||RAPI_RELATIONS_CACHE.set(e,new Map);let r=RAPI_RELATIONS_CACHE.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=WAITERS_FOR_URL.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);WAITERS_FOR_URL.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})())&&(NAMES_FOR_LOCALHOST.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 __decorate([inject],e.prototype,"_formDataUtil",void 0),__decorate([inject],e.prototype,"_errorHandler",void 0),__decorate([inject],e.prototype,"_dataSyncer",void 0),__decorate([inject],e.prototype,"_networkLayer",void 0),__decorate([inject],e.prototype,"_localStorage",void 0),__decorate([inject],e.prototype,"_globalInitData",void 0),__decorate([inject],e.prototype,"_globalCallback",void 0),e})();export{getSelectionGeometry as $,AppContext as A,Benchmark as B,CANVAS_ID as C,DynamicLightSettingLoader as D,Env as E,fadeIn as F,createMaterial as G,addTexture as H,INJECTABLES as I,getGUI as J,rotationQuaternionsAreEqual as K,Logger as L,getDelta as M,DynamicQualitySettingLoader as N,CommonKernelAccess as O,PREDEFINED_LIGHTSETTING as P,DOCKING_CONVERSATION_ID as Q,RoomleComponentFactoryInitializer as R,MESH_DEFAULT_FORMAT as S,convertToTHREE as T,UiCallback as U,getMaterialId as V,getBoundingBoxMaterial as W,PREVIEW_MATERIAL_COLOR as X,getColorFromInt as Y,PREVIEW_MATERIAL_OPACITY as Z,__decorate as _,getYRotationOfObject as a,convertToThreeDimensions as a0,checkGLB as a1,ConfiguratorViewModel as a2,vectorIsZero as a3,disposeMesh as a4,PREVIEW_MATERIAL_ROUGHNESS as a5,PREVIEW_MATERIAL_METALNESS as a6,convertToKernel as a7,setWallTransparencyBasedOnCamera as a8,setWallTransparency as a9,GLTF_LOADER_FILE_NAME as aa,DRACO_LOADER_FILE_NAME as ab,setMaterial as ac,getMaterialShading as ad,addExistingTexture as ae,EnvironmentLoader as af,GlobalCallback as ag,GlobalInitData as ah,InitData as ai,ScenePluginDefaultImplementation as aj,kernelDimensioningToThree as b,transitionTransparencyOfMaterial as c,dispose as d,DependencyInjectionAssignment as e,RapiAccess as f,getScreenXY as g,DataSyncer as h,inject as i,DEFAULT_CONVERSATION_ID as j,kernelBoxToThreeBox as k,getCatalogIdFromItemOrConfigurationId as l,isIdItemId as m,AsyncHelper as n,isRange as o,isMaterial as p,convertCObject as q,RoomleDependencyInjection as r,position3VectorsAreEqual as s,toRadiant as t,position2VectorsAreEqual as u,getIdealDistance as v,to360Degrees as w,getAngle as x,AsyncGuard as y,vectorIsEqual as z};
|
|
16
|
-
//# sourceMappingURL=rapi-access-
|
|
15
|
+
***************************************************************************** */function __decorate(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 EnvMapReader{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 toRadiant=function(e){return e*(Math.PI/180)},getIdealDistance=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=toRadiant(s),c=t/2/Math.tan(l/2),h=e/(2*Math.atan(Math.PI*a/360));return Math.max(c,h)},round=function(e){return Math.round(1e3*e)/1e3},getDelta=function(e,t){return Math.abs(e.y-t.y)+Math.abs(e.x-t.x)},getAngle=function(e,t){return Math.atan2(t.y-e.y,t.x-e.x)},to360Degrees=function(e){let t=function(e){return e*(180/Math.PI)}(e);return t<0&&(t=180+(180+t)),t},PREVIEW_MATERIAL_COLOR="#DDDDDD",PREVIEW_MATERIAL_ROUGHNESS=1,PREVIEW_MATERIAL_METALNESS=0,PREVIEW_MATERIAL_OPACITY=1,getScreenXY=(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},kernelBoxToThreeBox=(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)},kernelDimensioningToThree=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),position3VectorsAreEqual=(e,t)=>{let n=round(e.x),s=round(e.y),r=round(e.z),o=round(t.x),i=round(t.y),a=round(t.z);return n===o&&s===i&&r===a},rotationQuaternionsAreEqual=(e,t)=>{let n=round(e.w),s=round(e.x),r=round(e.y),o=round(e.z),i=round(t.w),a=round(t.x),l=round(t.y),c=round(t.z);return n===i&&s===a&&r===l&&o===c},position2VectorsAreEqual=(e,t)=>{let n=round(e.x),s=round(e.y),r=round(t.x),o=round(t.y);return n===r&&s===o};let whiteTexture=null;const getWhiteTexture=()=>{if(whiteTexture)return whiteTexture;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},createColorTexture=(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},createMaterial=(e,t)=>setMaterial(null,e,t),setMaterial=(e,t,n)=>{if(e||(e=createMeshPhysicalMaterial()),e.name=t.id?t.id.toString():"",void 0!==t.shading.metallic&&(e.metalness=1===t.shading.metallic?1:.5,e.reflectivity=getValue(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=getValue(t.shading.occlusion,1),e.roughness=getValue(t.shading.roughness,.5),e.alphaTest=getValue(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==n||n.setEnvMap(e),t.shading.doubleSided?e.side=THREE.DoubleSide:e.side=THREE.FrontSide,e.map||(whiteTexture||(whiteTexture=getWhiteTexture()),e.map=whiteTexture),e},createMeshPhysicalMaterial=()=>new THREE.MeshPhysicalMaterial({}),getMaterialShading=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 textureLoader=null;const addTexture=(e,t,n,s,r,o,i=16)=>(textureLoader||(textureLoader=new THREE.TextureLoader,textureLoader.crossOrigin=""),new Promise((a,l)=>{if(!e)return console.warn("trying to add a texture without image",t),void a();textureLoader.load(e,e=>{addExistingTexture(e,t,n,s,r,o,i),a()},l)})),addExistingTexture=(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===getWhiteTexture()&&(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)},getGUI=(e=!0)=>window.dat&&window.dat.GUI?(window.__RML_GUI__||(window.__RML_GUI__=new dat.GUI({autoPlace:e})),window.__RML_GUI__):null,setWallTransparencyBasedOnCamera=(e,t,n=!0)=>{let s=e.getWorldDirection(new THREE.Vector3),r=Math.abs(s.y);r<.5&&!t.transparent&&setWallTransparency(t,!0,n),r>.5&&t.transparent&&setWallTransparency(t,!1,n)},setWallTransparency=(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},getColorFromInt=e=>{let t=new THREE.Color;return t.setRGB((e>>16)/255,(e>>8&255)/255,(e>>0&255)/255),t},transitionTransparencyOfMaterial=(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()}})},fadeIn=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()}})},checkGLB=(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},dispose=e=>{"Mesh"===e.type?disposeMesh(e):disposeObject(e)},disposeObject=e=>{e&&e.children&&0!==e.children.length&&e.children.forEach(e=>{disposeMesh(e)})},disposeMesh=e=>{e&&(e.material&&disposeMaterial(e.material),e.geometry&&disposeGeometry(e.geometry),e.children&&e.children.length>0&&disposeObject(e))},disposeGeometry=e=>{e&&e.dispose()},disposeMaterial=e=>{e&&(e.map&&e.map.dispose(),e.normalMap&&e.normalMap.dispose(),e.dispose())};let boundingBoxMaterial;const getBoundingBoxMaterial=()=>(boundingBoxMaterial||(boundingBoxMaterial=new THREE.MeshBasicMaterial,boundingBoxMaterial.visible=!1),boundingBoxMaterial),getSelectionGeometry=(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},vectorIsZero=e=>0===e.x&&0===e.y&&0===e.z,getMaterialId=(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},vectorIsEqual=(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,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},dashCase=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 inject(e,t){const n=Symbol("property-cache");Object.defineProperty(e,t,{get(){if(!this[n]){const e=window.__RML__DI__.lookup(dashCase(t),this._creator_);e?this[n]=e:console.error("Dependency "+dashCase(t)+" not found! Add dependency to /utils/injectables.ts")}return this[n]}})}let EnvironmentLoader=(()=>{class e{constructor(e){this._hdrCubeUrl="static/roomle-91862a5e7f3f46e5.envmap",this._hdrCubeUrlLowres="static/roomle64-adb0f447a54b5143.envmap",this._envMapReader=new EnvMapReader,this._creator_=e;const t=new THREE.Color("#DDDDDD");this._environmentMap=((e,t,n,s)=>{const r=new THREE.CubeTexture;r.format=THREE.RGBAFormat,r.generateMipmaps=!1;for(let s=0;s<6;++s){const o=createColorTexture(e,t,n,1);o.format=r.format,o.type=r.type,o.minFilter=r.minFilter,o.magFilter=r.magFilter,o.generateMipmaps=r.generateMipmaps,o.needsUpdate=!0,r.images[s]=o}return r.needsUpdate=!0,r})(t.r,t.g,t.b),this._envMapReader.setPath(getAssetPath()),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 __decorate([inject],e.prototype,"_initData",void 0),e})();const PREDEFINED_LIGHTSETTING={SOFA:"sofa",SHELF:"shelf",SHELF_FRONT:"shelf_front",BAKED:"baked",CAMERA:"camera",EQUAL:"equal"};class DynamicLightSettingLoader{static createDynamicLightSettingSource(e,t){let n={};if(e)n.url=e;else if(t)switch(t){case PREDEFINED_LIGHTSETTING.SHELF:n.url=getAssetPath()+"static/shelf-2975dd3f2fa9c763.json";break;case PREDEFINED_LIGHTSETTING.SHELF_FRONT:n.url=getAssetPath()+"static/shelf_front-8c9566a4512f0de8.json";break;case PREDEFINED_LIGHTSETTING.SOFA:n.url=getAssetPath()+"static/sofa-997b116bc5f2e92e.json";break;case PREDEFINED_LIGHTSETTING.BAKED:n.url=getAssetPath()+"static/baked-6485a2b1daeb69e8.json";break;case PREDEFINED_LIGHTSETTING.CAMERA:n.url=getAssetPath()+"static/camera-f4cef679615485dc.json";break;case PREDEFINED_LIGHTSETTING.EQUAL:n.url=getAssetPath()+"static/equal-319f6b83c827913f.json";break;default:n.url=getAssetPath()+"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}}const NAMES_FOR_LOCALHOST=["127.0.0.1","localhost","0.0.0.0"],isIdItemId=function(e){return!(!e||"string"!=typeof e||e.split(":").length>2)},getCatalogIdFromItemOrConfigurationId=e=>{if(!e||"string"!=typeof e)return null;const t=e.split(":");return t.length<2?null:t[0]},kernelPartToPriceId=({articleNr:e,componentId:t})=>e&&""!==e?t.split(":")[0]+":"+e:null,wasRequestSuccess=(e,t)=>null!=e?"string"==typeof e?"true"===e:!0===e:("string"==typeof t&&(t=parseInt(t,10)),t>=200&&t<300);class NetworkLayer{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(),wasRequestSuccess(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 Logger{info(...e){console}log(...e){console}warn(...e){console.warn.apply(console,e)}error(...e){console.warn.apply(console,e)}}let KernelIo=(()=>{class e extends Logger{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 __decorate([inject],e.prototype,"_globalCallback",void 0),e})();const ASSET_CACHE=new Map,SYNCED_CATALOGS=new Map,SYNCED_FLOORS_TAGS=new Map,SYNCED_TYPE_CHANGE_TAGS=new Map;let DataSyncer=(()=>{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(()=>{SYNCED_TYPE_CHANGE_TAGS.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&&!SYNCED_FLOORS_TAGS.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(()=>{SYNCED_FLOORS_TAGS.set(e,!0),n()},e=>this._softReject(n,'_syncFloorTag error: "'+e+'"'))})):Promise.resolve()}_syncTypeChangeTag(e){const t=[];return e&&!SYNCED_TYPE_CHANGE_TAGS.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(()=>{SYNCED_FLOORS_TAGS.set(e,!0),n()},e=>this._softReject(n,'_syncTypeChangeTag error: "'+e+'"'))})):Promise.resolve()}getIsCatalogSynced(e){return!!SYNCED_CATALOGS.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(getAssetPath()+"static/asset-loader.worker-796c70f59b977071.js"),this._mainThreadToWorker=new MainThreadToWorker(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(()=>{SYNCED_CATALOGS.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(ASSET_CACHE.get(e))return t();this._assetUrlToBase64(e).then(n=>{ASSET_CACHE.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:ASSET_CACHE.get(e)||(t?e:null)}setAlwaysUseCache(e){this._alwaysUseCache=e}preFillAssetCache(e,t){ASSET_CACHE.set(e,t)}}return __decorate([inject],e.prototype,"_rapiAccess",void 0),__decorate([inject],e.prototype,"_singlePromiseFactory",void 0),__decorate([inject],e.prototype,"_errorHandler",void 0),__decorate([inject],e.prototype,"_configuratorUiCallbacks",void 0),__decorate([inject],e.prototype,"_initData",void 0),e})();class AsyncGuard{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()}}var GLTF_LOADER_FILE_NAME="static/GLTFLoader-5b296b5fb14cfe1a.js",DRACO_LOADER_FILE_NAME="static/DRACOLoader-5edeeab4a8dbc0bd.js";const DRACO_LIB_FILES={"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 StaticItemLoader=(()=>{class e{constructor(e){if(this._gltfLoaderGuard=new AsyncGuard,this._creator_=e,THREE.GLTFLoader&&THREE.DRACOLoader)this._initLoaders();else{let e=this._scriptLoader.fetch("static/GLTFLoader-5b296b5fb14cfe1a.js",{id:"gltf-loader"}),t=this._scriptLoader.fetch("static/DRACOLoader-5edeeab4a8dbc0bd.js",{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 s=DRACO_LIB_FILES[e];if(!s)throw new Error('Can not load draco dependency "'+e+'" did three.js update DracoLoader lib? Available files'+JSON.stringify(DRACO_LIB_FILES));return t(getAssetPath()+s,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 __decorate([inject],e.prototype,"_environmentLoader",void 0),__decorate([inject],e.prototype,"_scriptLoader",void 0),e})(),ThreeLoader=(()=>{class e{constructor(e){this._jsonLoaded=!1,this._creator_=e}_loadShaders(){return new Promise((e,t)=>{if(this._jsonLoaded)return e();this._networkLayer.fetch(getAssetPath()+"static/shaders-34f19089b7cddbfe.json",{credentials:"same-origin"}).then(handleJsonResponse,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 __decorate([inject],e.prototype,"_scriptLoader",void 0),__decorate([inject],e.prototype,"_networkLayer",void 0),e})(),LocalStorageHelper=(()=>{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 __decorate([inject],e.prototype,"_localStorage",void 0),e})();class DynamicQualitySettingLoader{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)}}}const convertToTHREE=e=>new THREE.Vector3(e.x/1e3,e.z/1e3,e.y/-1e3),convertToThreeDimensions=e=>new THREE.Vector3(e.x/1e3,e.z/1e3,e.y/1e3),convertToKernel=e=>({x:1e3*e.x,y:-1e3*e.z,z:1e3*e.y}),utilityStringToUTF16=e=>decodeURIComponent(encodeURIComponent(e)),convertCObject=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=utilityToArray(e);for(let e=0;e<t.length;e++)t[e]=convertCObject(t[e]);return"string"==typeof t?utilityStringToUTF16(t):t}if("object"==typeof e)for(let t in e)e.hasOwnProperty(t)&&(e[t]=convertCObject(e[t]));return"string"==typeof e?utilityStringToUTF16(e):e},utilityToArray=e=>{let t=[];if(e){let n=e.size();for(let s=0;s<n;s++)t.push(e.get(s))}return t},convertToThreeMatrix=e=>{let t=new THREE.Matrix4,n=convertCObject(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 RoomleComponentFactoryInitializer(){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(convertToThreeMatrix(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),disposeMesh(e),t<0||this.meshes.splice(t,1)}removeAllMeshes(e=!0){this.meshes.forEach(t=>{this.remove(t),e&&disposeMesh(t)}),this.meshes=[],this._removeLoadingMesh(),this.remove(this._boundingBoxMesh),disposeMesh(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:1,color:new THREE.Color("#DDDDDD")})),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),disposeMesh(this._loadingMesh),this._loadingMesh=null)}loadingFinished(){this._removeLoadingMesh(),this._showAllMeshes()}deselect(){this._selected=!1}hoverOn(){setCursor("pointer")}hoverOff(){setCursor("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=kernelBoxToThreeBox(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 convertToKernel(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")}),setCursor("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")}),setCursor("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=convertToTHREE(e)}get roomleLineFrom(){return this._roomleLineFrom}set roomleLineTo(e){this._roomleLineTo=e;let t=convertToTHREE(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=convertToTHREE(e)}get roomlePositionFrom(){return this._roomlePositionFrom}set roomlePositionTo(e){this._roomlePositionTo=e;let t=convertToTHREE(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,setCursor("pointer")}hoverOff(){this._dockline.visible=!1,setCursor("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:"#DDDDDD",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),_=Math.abs(r.y),p=Math.abs(r.z);u>=_&&u>=p?(h=new THREE.Vector3(c.x,0,0),d=Math.sqrt(c.y*c.y+c.z*c.z)):_>=u&&_>=p?(h=new THREE.Vector3(0,c.y,0),d=Math.sqrt(c.x*c.x+c.z*c.z)):p>=_&&p>=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 g=(new THREE.Vector3).subVectors(this.positionTo.clone(),this.positionFrom.clone()).length()+h.length(),m=new THREE.CylinderGeometry(1.1*d,1.1*d,g,32,1);this.boundingLineMesh=new THREE.Mesh(m,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(),E=this.positionFrom.clone(),y=(new THREE.Vector3).subVectors(f,E).normalize(),T=new THREE.ArrowHelper(y,E);const C=(new THREE.Quaternion).setFromEuler(T.rotation);this.boundingLineMesh.quaternion.multiply(C),this.boundingLineMesh.renderOrder=3;let w=(new THREE.Vector3).addVectors(this.positionTo.clone(),this.positionFrom.clone()).multiplyScalar(.5).add(c);this.boundingLineMesh.position.copy((new THREE.Vector3).subVectors(w,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 convertToKernel(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,_=this.aspect*u;return this.view&&this.view.enabled&&(e+=this.view.offsetX*_/this.view.fullWidth,n-=this.view.offsetY*u/this.view.fullHeight,t+=this.view.offsetX*_/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 WAITERS=new Map,_endOperation=function(e,t,n){let s=WAITERS.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)),WAITERS.delete(e)}};class AsyncHelper{static finishOperation(e,t){_endOperation(e,!0,t)}static failOperation(e,t){_endOperation(e,!1,t)}static waitFor(e,t){return new Promise((n,s)=>{let r=WAITERS.get(e);r||(WAITERS.set(e,[]),r=WAITERS.get(e)),r.push({resolve:n,reject:s}),"function"==typeof t&&t.apply(t)})}}const META_INFO=new Map;class Benchmark{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=Benchmark.getMeta(e);META_INFO.set(e,Object.assign(n,t))}static getMeta(e){return META_INFO.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)}}var defaultSettings={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"}};"undefined"!=typeof module&&module.exports||(window.IS_DEBUG=!0),function(e=!1){if(e){let e=JSON.parse(JSON.stringify(defaultSettings));e.APP,e.features}}();var Env=JSON.parse(JSON.stringify(defaultSettings));const isRange=function(e){return e.validRange&&"string"==typeof e.validRange.type},isOptions=function(e){return e.validValues&&e.validValues.length>0},hasUnits=function(e){return"length"===e.unitType||"area"===e.unitType},isMaterial=function(e){return"Material"===e.type};let MEM_URL,WASM_URL,WASM_LOADER,ASM_LOADER,CACHE_COMPILATION;const KERNEL_PATHS={WASM:{CONFIGURATOR:{URL:"static/ConfiguratorKernel-4153106c16b35980.wasm",LOADER:"static/ConfiguratorKernel-e9bbd4998a056b0b.js"},PLANNER:{URL:"static/RoomleCore-daed88a09e86faf7.wasm",LOADER:"static/RoomleCore-18f96bc7c4c9fe8e.js"}},ASM:{CONFIGURATOR:{MEM_URL:"static/ConfiguratorKernelJs-795532b819912c59.mem",LOADER:"static/ConfiguratorKernelJs-02aa8157cf299656.js"},PLANNER:{MEM_URL:"static/RoomleCoreJs-10b4a8ee2a89da25.mem",LOADER:"static/RoomleCoreJs-1e5e3331b2d12a5a.js"}}},USE_WASM=!!window.WebAssembly;let CommonKernelAccess=(()=>{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=USE_WASM,this._kernelPath=USE_WASM?WASM_LOADER:ASM_LOADER,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";MEM_URL=KERNEL_PATHS.ASM[t].MEM_URL,WASM_URL=KERNEL_PATHS.WASM[t].URL,WASM_LOADER=KERNEL_PATHS.WASM[t].LOADER,ASM_LOADER=KERNEL_PATHS.ASM[t].LOADER,CACHE_COMPILATION=!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)?getAssetPath()+MEM_URL:t},wasmBinaryFile:getAssetPath()+WASM_URL,preRun:[],postRun:[],setStatus:null,print(e){t._kernelIo.log(e)},printErr(e){t._kernelIo.error(e)},quit(e){0!==e&&t._kernelIo.throw(e&&e.toString?e.toString():"Unknown error while C/C++ main executes")}},CACHE_COMPILATION&&USE_WASM&&(this._kernelContainer.instantiateWasm=function(e,t){return((e,t,n)=>{const s="function"==typeof WebAssembly.instantiateStreaming;Benchmark.addMeta("kernel_is_ready",{cachedInIndexedDB:!1});let r=null;s?(Benchmark.start("kernel_stream_compile"),r=WebAssembly.instantiateStreaming(fetch(getAssetPath()+e),t),Benchmark.end("kernel_stream_compile")):(Benchmark.start("kernel_legacy_compile"),r=fetch(getAssetPath()+e).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,t))),Benchmark.addMeta("kernel_is_ready",{instantiateStreaming:s}),r.then(e=>{Benchmark.end(s?"kernel_stream_compile":"kernel_legacy_compile"),n(e.instance)},e=>console.error(e))})(WASM_URL,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}),Env.isProduction||Env.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=getCatalogIdFromItemOrConfigurationId(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){(Array.isArray(e)?e:[e]).forEach(e=>{-1===this._cachedGroupIds.indexOf(e)&&this._cachedGroupIds.push(e)}),this._waitingForGroups||(this._waitingForGroups=!0,AsyncHelper.waitFor(4).then(()=>{this._rapiAccess.getMaterialsByGroup(this._cachedGroupIds).then(e=>{let t=[];e.forEach(e=>{const n=[];e.materials.forEach(e=>n.push(e.id));const s=e.legacyId||e.id;e.legacyId||console.warn("Material group has no legacy id, please check content why this is the case"),t.push({group:s,materials:n})}),t.length&&this._kernelInstance.setMaterialsInGroup(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){let t=Array.isArray(e)?e:[e];if(this._requestedMaterialIds.push(...t),await wait(0),!this._requestedMaterialIds.length)return;const n=[...this._requestedMaterialIds];this._requestedMaterialIds=[];const s=await this._rapiAccess.getMaterials(n);let r=[];s.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()&&r.push({id:e.id,properties:t})}),r.length&&this._kernelInstance.setMaterialProperties(r)}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=kernelPartToPriceId(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=objectArrayToMap(n,"priceId");let i=0;return t.fullList.forEach(e=>{const t=kernelPartToPriceId(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=kernelPartToPriceId(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),isMaterial(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 __decorate([inject],e.prototype,"_rapiAccess",void 0),__decorate([inject],e.prototype,"_scriptLoader",void 0),__decorate([inject],e.prototype,"_kernelIo",void 0),__decorate([inject],e.prototype,"_dataSyncer",void 0),__decorate([inject],e.prototype,"_lifeCycleManager",void 0),__decorate([inject],e.prototype,"_configuratorUiCallbacks",void 0),__decorate([inject],e.prototype,"_globalCallback",void 0),__decorate([inject],e.prototype,"_initData",void 0),__decorate([inject],e.prototype,"_unitFormatter",void 0),__decorate([inject],e.prototype,"_configuratorContext",void 0),__decorate([inject],e.prototype,"_globalInitData",void 0),e})();const DOCKING_CONVERSATION_ID=10,DEFAULT_CONVERSATION_ID=9;let ConfiguratorViewModel=(()=>{class e{constructor(e){this._mergeThreshold=3,this._componentsToMerge=new OccurrenceMap,this._mergeInProgress=!1,this._components=new Map,this._previews=new Map,this._creator_=e,this._getKernelAccess().addConfiguratorListener(this),this._componentFactory=RoomleComponentFactoryInitializer()}get materialQueue(){return this.getMeshGenerator().materialQueue}_getKernelAccess(){return RoomleDependencyInjection.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(convertToThreeMatrix(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=convertToThreeMatrix(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=convertToThreeMatrix(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=Benchmark.start("dock_component_with_position_"+e.childId);this._getKernelAccess().dockComponentWithPosition(e.parentId,e.parentDockId,e.childId,e.childDockId,n),this._configuratorContext.dockingRootComponentId=null,Benchmark.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)];AsyncHelper.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){10===e&&(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 kernelBoxToThreeBox(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 AsyncGuard(e),this._getKernelAccess().requestPlanComponentConstruction(e),this._subPartGuard.wait()}getMeshGenerator(){return this._configuratorMeshGenerator}}return __decorate([inject],e.prototype,"_configuratorMeshGenerator",void 0),__decorate([inject],e.prototype,"_configuratorContext",void 0),__decorate([inject],e.prototype,"_cacheHolder",void 0),__decorate([inject],e.prototype,"_initData",void 0),e})();class OccurrenceMap 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 InitData{constructor(e){this.autoQuality=!0,this.colors=ROOMLE_COLORS,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){deepMerge(this,e)}}const BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN=["language","browserLanguage","userLanguage","systemLanguage"];class GlobalInitData{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=BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN.length;e<n;e++){const n=t[BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN[e]];if(n)return n.substr(0,2)}return"en"})()||"en",this.overrideCountry=null,this._creator_=e}setOverrides(e){deepMerge(this,e)}}class UiCallback{constructor(e){return this._isMute=!1,this._creator_=e,setDescriptor(this,"_isMute",{enumerable:!1,writable:!1}),setDescriptor(UiCallback.prototype,"_setMute",{enumerable:!1,writable:!1}),setDescriptor(UiCallback.prototype,"mute",{enumerable:!1,writable:!1}),setDescriptor(UiCallback.prototype,"unmute",{enumerable:!1,writable:!1}),new Proxy(this,this)}_setMute(e){setWriteable(this,"_isMute",!0),this._isMute=e,setWriteable(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]}}class GlobalCallback extends UiCallback{constructor(){super(...arguments),this.onNetworkRequest=(e,t,n)=>{},this.onKernelMsg=(e,t,n={})=>{},this.onCheckExternalCache=async(e,t)=>Promise.resolve(null)}}const CANVAS_ID={HSC:"rml-hsc",HSP:"rml-hsp",GLB:"rml-glb",RMV:"rml-mv"};let DomHelper=(()=>{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 __decorate([inject],e.prototype,"_lifeCycleManager",void 0),e})(),KERNEL_UNIT={InchFeet:null,MM:null,CM:null},KERNEL_UNIT_STRING_TYPE={NoUnitString:null,LongUnitString:null,ShortUnitString:null},UnitFormatter=(()=>{class e{constructor(e){this._formatter=null,this._precision=0,this._creator_=e}init(e){const t=new e.UnitMeasureFormatter;KERNEL_UNIT=e.Unit,KERNEL_UNIT_STRING_TYPE=e.UnitStringType,this._initActualUnit(),this._initActualUnitStringType();const{precisionCm:n,precisionInch:s}=this._initData;this._actualUnit===KERNEL_UNIT.InchFeet?this._precision=void 0!==s?parseInt(s,10):2:this._actualUnit===KERNEL_UNIT.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=KERNEL_UNIT.CM;break;case"mm":this._actualUnit=KERNEL_UNIT.MM;break;case"inchfeet":this._actualUnit=KERNEL_UNIT.InchFeet;break;default:this._actualUnit=KERNEL_UNIT.CM}}_initActualUnitStringType(){const{unitStringType:e}=this._initData;switch(e){case"none":this._actualUnitStringType=KERNEL_UNIT_STRING_TYPE.NoUnitString;break;case"long":this._actualUnitStringType=KERNEL_UNIT_STRING_TYPE.LongUnitString;break;case"short":this._actualUnitStringType=KERNEL_UNIT_STRING_TYPE.ShortUnitString;break;default:this._actualUnitStringType=KERNEL_UNIT_STRING_TYPE.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){hasUnits(e)&&(e.valueLabel=this._formatParameterValue(e.value,e.unitType))}formatParameter(e){if(hasUnits(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),isMaterial(e))e.uiType="Material";else if(function(e){return"Boolean"===e.type}(e))e.uiType="Boolean";else if(isRange(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 isOptions(e)?(e.uiType="Options",function(e){return!!isOptions(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===KERNEL_UNIT.InchFeet}getPrecision(){return this._precision}getAllowedDelta(){const e=1/Math.pow(10,this._precision);return this.isInch()?25.4*e:e}}return __decorate([inject],e.prototype,"_initData",void 0),e})();class ScenePluginDefaultImplementation{constructor(e){this._creator_=e}setScene(e){}setUiScene(e){}updateBounds(e){}clearScene(e,t){}moveCameraEnd(e){}moveCameraStart(e){}needsUiScene(){return!1}}let PluginSystem=(()=>{class e{constructor(e){this._plugins=[],this._creator_=e}async init(e,t,n){this._scene=e,this._uiScene=t,this._cameraPosition=n;const{bananaForScale:s}=this._initData;s&&await import("./banana-for-scale-1d3127e8.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 __decorate([inject],e.prototype,"_initData",void 0),e})();const INJECTABLES=[new DependencyInjectionAssignment("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 DependencyInjectionAssignment("form-data-util",FormDataUtil),new DependencyInjectionAssignment("environment-loader",EnvironmentLoader),new DependencyInjectionAssignment("static-item-loader",StaticItemLoader,0),new DependencyInjectionAssignment("form-data-util",FormDataUtil),new DependencyInjectionAssignment("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 DependencyInjectionAssignment("dynamic-light-setting-loader",DynamicLightSettingLoader),new DependencyInjectionAssignment("dynamic-quality-setting-loader",DynamicQualitySettingLoader),new DependencyInjectionAssignment("network-layer",NetworkLayer),new DependencyInjectionAssignment("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 DependencyInjectionAssignment("network-layer",NetworkLayer),new DependencyInjectionAssignment("kernel-io",KernelIo,0),new DependencyInjectionAssignment("data-syncer",DataSyncer),new DependencyInjectionAssignment("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 DependencyInjectionAssignment("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 DependencyInjectionAssignment("three-loader",ThreeLoader),new DependencyInjectionAssignment("local-storage-helper",LocalStorageHelper),new DependencyInjectionAssignment("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())disposeObject(e);for(const e of this._materialCache.values())disposeMaterial(e);for(const e of this._geometryCache.values())disposeGeometry(e);this._componentCache.clear(),this._geometryCache.clear(),this._materialCache.clear()}},0),new DependencyInjectionAssignment("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 DependencyInjectionAssignment("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 DependencyInjectionAssignment("configurator-view-model",ConfiguratorViewModel,1),new DependencyInjectionAssignment("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 DependencyInjectionAssignment("init-data",InitData,1),new DependencyInjectionAssignment("global-init-data",GlobalInitData,0),new DependencyInjectionAssignment("global-callback",GlobalCallback,0),new DependencyInjectionAssignment("dom-helper",DomHelper,1),new DependencyInjectionAssignment("unit-formatter",UnitFormatter,0),new DependencyInjectionAssignment("plugin-system",PluginSystem,1)];class RoomleDependencyInjection{static _ensureContainer(){window.__RML__DI__||(window.__RML__DI__=new Container,window.__RML__DI__.addDependencyInjectionAssignments(INJECTABLES))}static setup(e){RoomleDependencyInjection.addToContainer(e)}static lookup(e,t){return window.__RML__DI__?window.__RML__DI__.lookup(e,t):null}static getContext(e){return RoomleDependencyInjection._ensureContainer(),window.__RML__DI__.getContext(e)}static cleanUp(e){return window.__RML__DI__?window.__RML__DI__.cleanUp(e):null}static addToContainer(e){RoomleDependencyInjection._ensureContainer(),window.__RML__DI__.addDependencyInjectionAssignments(e)}}let AppContext=(()=>{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:APP$1}=Env,{RAPI}=APP$1,headers=RAPI.headers,itemHeaders=RAPI.itemHeaders,TOKEN_IDENTIFIER=headers.token,MESH_DEFAULT_FORMAT="crt",LEGACY_GROUP_INDICATOR=uuid();let RAPI_MATERIAL_GROUP_CACHE=new Map,ITEM_ADDITIONAL_CONTENT_CACHE=new Map,RAPI_RELATIONS_CACHE=new Map,RAPI_CACHE=new Map,MESHES_TO_CATALOG_CACHE=new Map,RAPI_PACKAGE_CACHE=new Map,RAPI_PRELOAD_CACHE=new Map,WAITERS_FOR_URL=new Map,RAPI_ERROR_CACHE=new Map;const getCachedMaterialGroup=e=>RAPI_MATERIAL_GROUP_CACHE.get(e)||RAPI_MATERIAL_GROUP_CACHE.get(LEGACY_GROUP_INDICATOR+e),hasMaterialTags=e=>e&&e.tags&&e.tags.length,materialHasNoTagsButGroup=e=>!hasMaterialTags(e)&&e.group;let RapiAccess=(()=>{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(getCatalogIdFromItemOrConfigurationId(e)))return n();if(RAPI_PRELOAD_CACHE.get(e))return n();const r=t?"?itemId=":"?configurationId=";this._get("/preloads/components/"+r+e,"preloads/components").then(t=>{if(RAPI_PRELOAD_CACHE.get(e))return n();t.forEach(e=>{this._prepareData(e,"components")}),RAPI_PRELOAD_CACHE.set(e,!0),n()},s)})}changeUseOfHDGeometry(){const e=RAPI_CACHE.get("components");RAPI_PRELOAD_CACHE.clear(),RAPI_PACKAGE_CACHE.clear(),e&&RAPI_CACHE.delete("components")}getHSCPackage(e){return new Promise((t,n)=>{if(RAPI_PACKAGE_CACHE.get(e))return t();this._get("/catalogs/"+e+"/package","package").then(n=>{if(RAPI_PACKAGE_CACHE.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")}),RAPI_PACKAGE_CACHE.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:itemHeaders})}getComponents(e){return this._getByIds(e,"components")}getItems(e){return this._getByIds(e,"items",{additionalHeaders:itemHeaders})}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="crt",n=50){return this._getById(e,"meshes",{pathSuffix:"/data?format="+t+"&targetQuality="+n.toString()})}getMeshesOfCatalog(e){return new Promise((t,n)=>{const s=MESHES_TO_CATALOG_CACHE.get(e);s?t(s):this._get("/meshes?catalog="+e,"catalogMeshes").then(n=>{MESHES_TO_CATALOG_CACHE.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=ITEM_ADDITIONAL_CONTENT_CACHE.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=ITEM_ADDITIONAL_CONTENT_CACHE.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),ITEM_ADDITIONAL_CONTENT_CACHE.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(){RAPI_MATERIAL_GROUP_CACHE=new Map,RAPI_RELATIONS_CACHE=new Map,RAPI_CACHE=new Map,RAPI_PACKAGE_CACHE=new Map,RAPI_PRELOAD_CACHE=new Map,WAITERS_FOR_URL=new Map,ITEM_ADDITIONAL_CONTENT_CACHE=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=getCachedMaterialGroup(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=RAPI_CACHE.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,IMAGE_FORMATS.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:LEGACY_GROUP_INDICATOR+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?getCachedMaterialGroup(t):[];a||(RAPI_MATERIAL_GROUP_CACHE.set(t,[]),a=getCachedMaterialGroup(t)),-1===a.indexOf(i.toString())&&a.push(i.toString());const l=hasMaterialTags(n),c=l&&e,h=materialHasNoTagsButGroup(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=AppContext.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=WAITERS_FOR_URL.get(e);Array.isArray(o)&&o.length>0?o.push({resolve:s,reject:r}):(WAITERS_FOR_URL.set(e,[{resolve:s,reject:r}]),this._fetchJson(e,t,n))})}_fetchJson(e,t,n={}){this._fetch(e,n).then(handleJsonResponse.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=RAPI.server;const r=this._globalInitData.overrideRapi;r&&(s="live"===r?RAPI.liveServer:RAPI.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={...headers};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||TOKEN_IDENTIFIER;t.token="03-"+window.btoa((new Date).toISOString()+";"+a+";"+headers.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,RAPI_CACHE)}_getErrorCache(e){return this._getCacheFrom(e,RAPI_ERROR_CACHE)}_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=RAPI_RELATIONS_CACHE.get(t);if(!s){const r=new Map,o=new Map;o.set(n,void 0),r.set(e,o),RAPI_RELATIONS_CACHE.set(t,r),s=RAPI_RELATIONS_CACHE.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=getCachedMaterialGroup(t);s||(RAPI_MATERIAL_GROUP_CACHE.set(t,[]),s=getCachedMaterialGroup(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){RAPI_RELATIONS_CACHE.has(e)||RAPI_RELATIONS_CACHE.set(e,new Map);let r=RAPI_RELATIONS_CACHE.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=WAITERS_FOR_URL.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);WAITERS_FOR_URL.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})())&&(NAMES_FOR_LOCALHOST.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 __decorate([inject],e.prototype,"_formDataUtil",void 0),__decorate([inject],e.prototype,"_errorHandler",void 0),__decorate([inject],e.prototype,"_dataSyncer",void 0),__decorate([inject],e.prototype,"_networkLayer",void 0),__decorate([inject],e.prototype,"_localStorage",void 0),__decorate([inject],e.prototype,"_globalInitData",void 0),__decorate([inject],e.prototype,"_globalCallback",void 0),e})();export{getSelectionGeometry as $,AppContext as A,Benchmark as B,CANVAS_ID as C,DynamicLightSettingLoader as D,Env as E,fadeIn as F,createMaterial as G,addTexture as H,INJECTABLES as I,getGUI as J,rotationQuaternionsAreEqual as K,Logger as L,getDelta as M,DynamicQualitySettingLoader as N,CommonKernelAccess as O,PREDEFINED_LIGHTSETTING as P,DOCKING_CONVERSATION_ID as Q,RoomleComponentFactoryInitializer as R,MESH_DEFAULT_FORMAT as S,convertToTHREE as T,UiCallback as U,getMaterialId as V,getBoundingBoxMaterial as W,PREVIEW_MATERIAL_COLOR as X,getColorFromInt as Y,PREVIEW_MATERIAL_OPACITY as Z,__decorate as _,getYRotationOfObject as a,convertToThreeDimensions as a0,checkGLB as a1,ConfiguratorViewModel as a2,vectorIsZero as a3,disposeMesh as a4,PREVIEW_MATERIAL_ROUGHNESS as a5,PREVIEW_MATERIAL_METALNESS as a6,convertToKernel as a7,setWallTransparencyBasedOnCamera as a8,setWallTransparency as a9,GLTF_LOADER_FILE_NAME as aa,DRACO_LOADER_FILE_NAME as ab,setMaterial as ac,getMaterialShading as ad,addExistingTexture as ae,EnvironmentLoader as af,GlobalCallback as ag,GlobalInitData as ah,InitData as ai,ScenePluginDefaultImplementation as aj,kernelDimensioningToThree as b,transitionTransparencyOfMaterial as c,dispose as d,DependencyInjectionAssignment as e,RapiAccess as f,getScreenXY as g,DataSyncer as h,inject as i,DEFAULT_CONVERSATION_ID as j,kernelBoxToThreeBox as k,getCatalogIdFromItemOrConfigurationId as l,isIdItemId as m,AsyncHelper as n,isRange as o,isMaterial as p,convertCObject as q,RoomleDependencyInjection as r,position3VectorsAreEqual as s,toRadiant as t,position2VectorsAreEqual as u,getIdealDistance as v,to360Degrees as w,getAngle as x,AsyncGuard as y,vectorIsEqual as z};
|
|
16
|
+
//# sourceMappingURL=rapi-access-693b87b1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rapi-access-
|
|
1
|
+
{"version":3,"file":"rapi-access-693b87b1.js","sources":["../../packages/common-core/public/textures/env/roomle.envmap","../../packages/common-core/public/textures/env/roomle64.envmap","../../packages/common-core/public/predefined_lightsettings/shelf.json","../../packages/common-core/public/predefined_lightsettings/shelf_front.json","../../packages/common-core/public/predefined_lightsettings/sofa.json","../../packages/common-core/public/predefined_lightsettings/baked.json","../../packages/common-core/public/predefined_lightsettings/camera.json","../../packages/common-core/public/predefined_lightsettings/equal.json","../../packages/workers/generated/asset-loader.worker.js","../../node_modules/three/examples/js/loaders/GLTFLoader.js","../../node_modules/three/examples/js/loaders/DRACOLoader.js","../../node_modules/three/examples/js/libs/draco/draco_wasm_wrapper.js","../../node_modules/three/examples/js/libs/draco/draco_decoder.wasm","../../node_modules/three/examples/js/libs/draco/draco_decoder.js","../../packages/common-core/generated/shaders.json","../../packages/common-core/generated/rthree.js","../../node_modules/roomle-core-hsc/wasm/ConfiguratorKernel.wasm","../../node_modules/roomle-core-hsc/wasm/ConfiguratorKernel.js","../../node_modules/roomle-core-hsc/wasm/RoomleCore.wasm","../../node_modules/roomle-core-hsc/wasm/RoomleCore.js","../../node_modules/roomle-core-hsc/ConfiguratorKernelJs.mem","../../node_modules/roomle-core-hsc/ConfiguratorKernelJs.js","../../node_modules/roomle-core-hsc/RoomleCoreJs.mem","../../node_modules/roomle-core-hsc/RoomleCoreJs.js"],"sourcesContent":["export default \"static/roomle-91862a5e7f3f46e5.envmap\"","export default \"static/roomle64-adb0f447a54b5143.envmap\"","export default \"static/shelf-2975dd3f2fa9c763.json\"","export default \"static/shelf_front-8c9566a4512f0de8.json\"","export default \"static/sofa-997b116bc5f2e92e.json\"","export default \"static/baked-6485a2b1daeb69e8.json\"","export default \"static/camera-f4cef679615485dc.json\"","export default \"static/equal-319f6b83c827913f.json\"","export default \"static/asset-loader.worker-796c70f59b977071.js\"","export default \"static/GLTFLoader-5b296b5fb14cfe1a.js\"","export default \"static/DRACOLoader-5edeeab4a8dbc0bd.js\"","export default \"static/draco_wasm_wrapper-d775f9f135cb30ff.js\"","export default \"static/draco_decoder-979e668167e37c95.wasm\"","export default \"static/draco_decoder-3866672a1fa2f980.js\"","export default \"static/shaders-34f19089b7cddbfe.json\"","export default \"static/rthree-508a6ceb9a1516ce.js\"","export default \"static/ConfiguratorKernel-4153106c16b35980.wasm\"","export default \"static/ConfiguratorKernel-e9bbd4998a056b0b.js\"","export default \"static/RoomleCore-daed88a09e86faf7.wasm\"","export default \"static/RoomleCore-18f96bc7c4c9fe8e.js\"","export default \"static/ConfiguratorKernelJs-795532b819912c59.mem\"","export default \"static/ConfiguratorKernelJs-02aa8157cf299656.js\"","export default \"static/RoomleCoreJs-10b4a8ee2a89da25.mem\"","export default \"static/RoomleCoreJs-1e5e3331b2d12a5a.js\""],"names":[],"mappings":";;;;;;;;;;;;;;6gXAAe,+DCAA,kqECAA,yGCAA,wGCAA,kGCAA,oGCAA,oGCAA,wEDAA,y1KEAA,6rHCAf,0BAAe,+DCAA,wFCAA,qECAA,gECAA,mPJAA,uFCAA,kmEIAA,2QCAA,6zlBCAA,yDCAA,8DCAA,iDCAA,qECAA,0DCAA,oECAA,kDCAA"}
|