@roomle/embedding-lib 5.28.0-alpha.4 → 5.28.0-alpha.6

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.
@@ -1,15 +1,13 @@
1
- ## [5.28.0-alpha.4](https://github.com/roomle-dev/roomle-ui/compare/embedding-lib-v5.28.0-alpha.3...embedding-lib-v5.28.0-alpha.4) (2025-09-16)
1
+ ## [5.28.0-alpha.6](https://github.com/roomle-dev/roomle-ui/compare/embedding-lib-v5.28.0-alpha.5...embedding-lib-v5.28.0-alpha.6) (2025-09-17)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
- * add color picker to color parameters ([fde2fc9](https://github.com/roomle-dev/roomle-ui/commit/fde2fc9ccd09302e8db8d9e58809a4ebca8ca69f))
7
- * core api moveElementToIn2d ([b0878b0](https://github.com/roomle-dev/roomle-ui/commit/b0878b05f0f27698c05cce361d1a2de8831124c0))
8
- * **core:** upgrade to version 2.60.0-alpha.3 ([85bbd4e](https://github.com/roomle-dev/roomle-ui/commit/85bbd4e8ff35675bc2c4e35e741df13ff8753c09))
6
+ * external material key and thumbnail ([326c587](https://github.com/roomle-dev/roomle-ui/commit/326c5878f9d65f3b86602d7b55bb6d984ba2994b))
7
+ * **core:** upgrade to version 2.60.0-alpha.4 ([8f07a97](https://github.com/roomle-dev/roomle-ui/commit/8f07a9792e1b1ad2870bf55365c7c664306c4c37))
9
8
 
10
9
 
11
10
  ### Bug Fixes
12
11
 
13
- * do not rerender productsettings when trying to edit color, range slider. ([e224e69](https://github.com/roomle-dev/roomle-ui/commit/e224e6905baa8563757b2da237be7b13dc2c81ee))
14
- * homag intelligence example ([87b495a](https://github.com/roomle-dev/roomle-ui/commit/87b495a1cd98110a7dd4c940c24b0d129ef1dd96))
15
- * typescript errors ([6f3f20b](https://github.com/roomle-dev/roomle-ui/commit/6f3f20bf195698c0e3c6ab82e7bc185753d04fd2))
12
+ * expanding material parameters on collapsed view ([ab85d68](https://github.com/roomle-dev/roomle-ui/commit/ab85d6841976fbac48162d90c037a6813aa28c2e))
13
+ * guard onExpand call to avoid errors when not a function ([b2bce20](https://github.com/roomle-dev/roomle-ui/commit/b2bce209bbd5a6c48e53e2ebcb3fb05834620230))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomle/embedding-lib",
3
- "version": "5.28.0-alpha.4",
3
+ "version": "5.28.0-alpha.6",
4
4
  "description": "This is a small library which can be used to communicate with the Roomle Configurator",
5
5
  "type": "module",
6
6
  "main": "./roomle-embedding-lib.umd.js",
@@ -12,10 +12,7 @@ declare const _default: {
12
12
  materialConfiguration: {
13
13
  defaultMaterial: string;
14
14
  replaceUnmappedMaterialsWithDefault: boolean;
15
- materialMapping: {
16
- materialName: string;
17
- materialId: string;
18
- }[];
15
+ materialMapping: any[];
19
16
  };
20
17
  debugConfiguration: {
21
18
  createDebugGeometry: boolean;
@@ -55,7 +55,7 @@ class H {
55
55
  }
56
56
  _handleMessage(t) {
57
57
  const s = t.ports && Array.isArray(t.ports) && t.ports.length > 0 ? t.ports[0] : null;
58
- if (t.data && t.data.type !== "connect_hi" && s)
58
+ if (t.data && (typeof t.data == "string" || t.data.type !== "connect_hi") && s)
59
59
  try {
60
60
  const r = JSON.parse(t.data);
61
61
  if (!this._execMessage)
@@ -1 +1 @@
1
- class e{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(e,t,s,r){this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((s,r)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const n=new MessageChannel;n.port1.onmessage=e=>{if(!e||!e.data)return n.port1.close(),n.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let t;try{t=JSON.parse(e.data)}catch(e){return n.port1.close(),n.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),n.port1.close(),n.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return r(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return r(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[n.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&"connect_hi"!==e.data.type&&t)try{const s=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const r=this._execMessage(s,e);if(void 0===r)return;r.then((e={})=>{let s,r;"object"==typeof e&&null!==e&&(s=e.error,r=e.result),s?t.postMessage(JSON.stringify({error:s})):void 0!==r?t.postMessage(JSON.stringify({result:r})):t.postMessage(JSON.stringify({result:e}))},e=>{t.postMessage(JSON.stringify({error:this._prepareError(e)}))})}catch(e){t.postMessage(JSON.stringify({error:this._prepareError(e)}))}}_prepareError(e){return"string"==typeof e?this._side+": "+e:(e.message=this._side+": "+e.message,e.message)}}const t=Symbol("Comlink.proxy"),s=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),i=e=>"object"==typeof e&&null!==e||"function"==typeof e,o=new Map([["proxy",{canHandle:e=>i(e)&&e[t],serialize(e){const{port1:t,port2:s}=new MessageChannel;return l(e,t),[s,[s]]},deserialize:e=>(e.start(),function(e){const t=new Map;return e.addEventListener("message",function(e){const{data:s}=e;if(!s||!s.id)return;const r=t.get(s.id);if(r)try{r(s)}finally{t.delete(s.id)}}),m(e,t,[],void 0)}(e))}],["throw",{canHandle:e=>i(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function l(e,s=globalThis,r=["*"]){s.addEventListener("message",function i(o){if(!o||!o.data)return;if(!function(e,t){for(const s of e)if(t===s||"*"===s||s instanceof RegExp&&s.test(t))return!0;return!1}(r,o.origin))return;const{id:u,type:g,path:d}=Object.assign({path:[]},o.data),h=(o.data.argumentList||[]).map(y);let m;try{const s=d.slice(0,-1).reduce((e,t)=>e[t],e),r=d.reduce((e,t)=>e[t],e);switch(g){case"GET":m=r;break;case"SET":s[d.slice(-1)[0]]=y(o.data.value),m=!0;break;case"APPLY":m=r.apply(s,h);break;case"CONSTRUCT":m=function(e){return Object.assign(e,{[t]:!0})}(new r(...h));break;case"ENDPOINT":{const{port1:t,port2:s}=new MessageChannel;l(e,s),m=function(e,t){return w.set(e,t),e}(t,[t])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[a]:0}}Promise.resolve(m).catch(e=>({value:e,[a]:0})).then(t=>{const[r,a]=_(t);s.postMessage(Object.assign(Object.assign({},r),{id:u}),a),"RELEASE"===g&&(s.removeEventListener("message",i),c(s),n in e&&"function"==typeof e[n]&&e[n]())}).catch(e=>{const[t,r]=_({value:new TypeError("Unserializable return value"),[a]:0});s.postMessage(Object.assign(Object.assign({},t),{id:u}),r)})}),s.start&&s.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function g(e){return b(e,new Map,{type:"RELEASE"}).then(()=>{c(e)})}const d=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(d.get(e)||0)-1;d.set(e,t),0===t&&g(e)});function m(e,t,n=[],a=function(){}){let i=!1;const o=new Proxy(a,{get(s,a){if(u(i),a===r)return()=>{(function(e){h&&h.unregister(e)})(o),g(e),t.clear(),i=!0};if("then"===a){if(0===n.length)return{then:()=>o};const s=b(e,t,{type:"GET",path:n.map(e=>e.toString())}).then(y);return s.then.bind(s)}return m(e,t,[...n,a])},set(s,r,a){u(i);const[o,l]=_(a);return b(e,t,{type:"SET",path:[...n,r].map(e=>e.toString()),value:o},l).then(y)},apply(r,a,o){u(i);const l=n[n.length-1];if(l===s)return b(e,t,{type:"ENDPOINT"}).then(y);if("bind"===l)return m(e,t,n.slice(0,-1));const[c,g]=f(o);return b(e,t,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:c},g).then(y)},construct(s,r){u(i);const[a,o]=f(r);return b(e,t,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:a},o).then(y)}});return function(e,t){const s=(d.get(t)||0)+1;d.set(t,s),h&&h.register(e,t,e)}(o,e),o}function p(e){return Array.prototype.concat.apply([],e)}function f(e){const t=e.map(_);return[t.map(e=>e[0]),p(t.map(e=>e[1]))]}const w=new WeakMap;function _(e){for(const[t,s]of o)if(s.canHandle(e)){const[r,n]=s.serialize(e);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:e},w.get(e)||[]]}function y(e){switch(e.type){case"HANDLER":return o.get(e.name).deserialize(e.value);case"RAW":return e.value}}function b(e,t,s,r){return new Promise(n=>{const a=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(a,n),e.start&&e.start(),e.postMessage(Object.assign({id:a},s),r)})}const v=["127.0.0.1","localhost","0.0.0.0"],M=["language","browserLanguage","userLanguage","systemLanguage"],E=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=E(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var S=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(S||{});const P={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[S.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},O=e=>{if(!e)return;const t=Object.keys(e);for(const s of t){const t=e[s];if(!Array.isArray(t)&&"object"==typeof t&&null!==t&&O(t),Array.isArray(t))for(const e of t)O(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},L=()=>/(android)/i.test(navigator.userAgent);class T{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(e=>{const t=e.split("."),s=t[0],r=t[1];this[s]||(this[s]={}),this[s][r]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(e,[...arguments])}.bind(this)}),s.forEach(e=>{const t=e.split("."),s=t[0],r=t[1],n=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][n]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split("."),r=s[0],n=s[1],a=3===s.length?s[2]:null;if(a&&this[r][n][a]){const e=this[r][n][a](...t);return e instanceof Promise?e.then(e=>({result:e})):void 0!==e?Promise.resolve({result:e}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const r of e)"string"==typeof r&&"dragIn"===r?this.pluginsLoaded.push(new Promise((e,r)=>{try{import("./drag-in-BmoiEqfA.mjs").then(e=>e.l).then(({DragIn:n})=>{const a=new n(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins.dragIn=a,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,n)=>{try{r.loader().then(a=>{const i=new a(this.ui,t,s,this.viewName);i.init().then(()=>{this.plugins[r.name]=i,e()},n)})}catch(e){n(e)}}))}}const A=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},k=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},N=()=>.01*window.innerHeight+"px",R=e=>{e&&setTimeout(()=>e.style.setProperty(I,N()),0)},C="rml-styles",I="--rml-full-height",x="rml-container",B="rml-fill",D="rml-pos",U="rml-android-height",F="rml-overflow-hidden",H=new Map;class j extends T{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(t,s=[]){const r=new T;r.viewName=t;const{resolve:n,promise:a}=A(),{resolve:i,promise:o}=A(),l=new e("custom-view-"+t,window,window.parent,({message:e,args:t})=>{switch(e){case"registerCustomViewDone":n();break;case"returnMethods":r.handleSetup(t[0]),i();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(l);const c=[t];return l.sendMessage("registerCustomView",c),await a,l.sendMessage("getMethods",c),await o,r.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(e,t,s,r=[]){return this._create(e,t,s,r)}static create(e,t,s,r){return this._create(e,t,s,r)}static createViewer(e,t,s,r=[]){return this._create(e,t,s,r)}static setupHi(e){window.addEventListener("message",t=>{if("connect_hi"===t.data.type&&t.data.port){const s=t.data.port;s.start?.(),l(e,s)}})}static async _create(e,t,s,r){return new Promise(async(n,a)=>{try{const a=E((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(P);e.locale||(e.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,s=M.length;e<s;e++){const s=t[M[e]];if(s)return s.substr(0,2)}return"en"})()),"(idle)"===e.id&&delete e.id;const t=(()=>{const e=(()=>{try{return window.self!==window.top}catch{return!0}})();let t=window.location.href;if(e){if(!document.referrer)return null;t=document.referrer}const{hostname:s}=new URL(t);return s})();return t&&(e=>!!(v.includes(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com")))(t)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(O(i=s),i?.customApiUrl&&(i.customApiUrl=decodeURIComponent(i.customApiUrl)),i.shareUrl&&(i.deeplink=i.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),i));(e=>{e.featureFlags||(e.featureFlags={}),"boolean"!=typeof e.featureFlags.realPartList&&(e.featureFlags.realPartList=!0),"boolean"!=typeof e.featureFlags.globalCallbacks&&(e.featureFlags.globalCallbacks=!0),"boolean"!=typeof e.featureFlags.mocAr&&(e.featureFlags.mocAr=!1)})(a);const o=await(async(e,t)=>{if("string"!=typeof e)throw new Error('Configurator ID is not a string type: "'+typeof e+'"');const s=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,n=s+"/configurators/"+e,a="roomle_portal_v2",i="03-"+window.btoa((new Date).toISOString()+";anonymous;"+a),o=new Request(n,{method:"GET",headers:new Headers({apiKey:a,currentTenant:r,locale:"en",language:"en",device:1,token:i,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c})(e,a);s=((e,t)=>{t.configuratorId=e.id;const s=e.settings||{};return!t.overrideTenant&&e.tenant&&(t.overrideTenant=e.tenant),((e,t)=>{const s=JSON.parse(JSON.stringify(e));return E(s,t)})(s,t)})(o,a);const l=new this(o,t,s,r,n);return await Promise.allSettled(l.pluginsLoaded),l}catch(e){return a(e)}var i})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,s,r,n,a){if(super(),!t||"string"!=typeof t.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(H.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(C)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=C;const s="transition:all ease-in-out 450ms;",n=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,a=N();t.innerHTML=`\n .${x}{${I}:${a};}\n .${D}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${n}}\n .${B}{width:100%;height:100%;opacity:1}\n .${U}{height:calc(var(${I},1vh)*100)}\n .${F}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const i=new e("website",window,null,this._executeMessage);this.setMessageHandler(i),this._onResize=this._onResize.bind(this),L()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=r,this._configuratorSettings=t;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(o),this._iframe=o,this.setupPlugins(n,this._iframe),H.set(s,!0)}teardown(){this._container&&H.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){const e=document.createElement("iframe");let t=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(t=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(t=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(t=this._initData.overrideServerUrl),e.src=t,e.classList.add(x),e.classList.add(B),e}_onResize(){R(this._iframe)}_onUseFullPage(){this._iframe.classList.add(D),document.documentElement.classList.add(F),window.document.body.classList.add(F),L()&&(R(this._iframe),this._iframe.classList.add(U))}_onBackToWebsite(){this._iframe.classList.remove(D),this._iframe.classList.remove(U),document.documentElement.classList.remove(F),window.document.body.classList.remove(F)}_executeMessage({message:e,args:t},s){if(s.source&&s.source===this._iframe?.contentWindow)return"requestBoot"===e?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):"setup"===e?(this.handleSetup(t[0]),k(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),k(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage("websiteReady")},0),Promise.resolve({result:null})):this.executeMessage({message:e,args:t})}}export{j as default};
1
+ class e{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(e,t,s,r){this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((s,r)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const n=new MessageChannel;n.port1.onmessage=e=>{if(!e||!e.data)return n.port1.close(),n.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let t;try{t=JSON.parse(e.data)}catch(e){return n.port1.close(),n.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),n.port1.close(),n.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return r(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return r(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[n.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&("string"==typeof e.data||"connect_hi"!==e.data.type)&&t)try{const s=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const r=this._execMessage(s,e);if(void 0===r)return;r.then((e={})=>{let s,r;"object"==typeof e&&null!==e&&(s=e.error,r=e.result),s?t.postMessage(JSON.stringify({error:s})):void 0!==r?t.postMessage(JSON.stringify({result:r})):t.postMessage(JSON.stringify({result:e}))},e=>{t.postMessage(JSON.stringify({error:this._prepareError(e)}))})}catch(e){t.postMessage(JSON.stringify({error:this._prepareError(e)}))}}_prepareError(e){return"string"==typeof e?this._side+": "+e:(e.message=this._side+": "+e.message,e.message)}}const t=Symbol("Comlink.proxy"),s=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),i=e=>"object"==typeof e&&null!==e||"function"==typeof e,o=new Map([["proxy",{canHandle:e=>i(e)&&e[t],serialize(e){const{port1:t,port2:s}=new MessageChannel;return l(e,t),[s,[s]]},deserialize:e=>(e.start(),function(e){const t=new Map;return e.addEventListener("message",function(e){const{data:s}=e;if(!s||!s.id)return;const r=t.get(s.id);if(r)try{r(s)}finally{t.delete(s.id)}}),m(e,t,[],void 0)}(e))}],["throw",{canHandle:e=>i(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function l(e,s=globalThis,r=["*"]){s.addEventListener("message",function i(o){if(!o||!o.data)return;if(!function(e,t){for(const s of e)if(t===s||"*"===s||s instanceof RegExp&&s.test(t))return!0;return!1}(r,o.origin))return;const{id:u,type:g,path:d}=Object.assign({path:[]},o.data),h=(o.data.argumentList||[]).map(y);let m;try{const s=d.slice(0,-1).reduce((e,t)=>e[t],e),r=d.reduce((e,t)=>e[t],e);switch(g){case"GET":m=r;break;case"SET":s[d.slice(-1)[0]]=y(o.data.value),m=!0;break;case"APPLY":m=r.apply(s,h);break;case"CONSTRUCT":m=function(e){return Object.assign(e,{[t]:!0})}(new r(...h));break;case"ENDPOINT":{const{port1:t,port2:s}=new MessageChannel;l(e,s),m=function(e,t){return w.set(e,t),e}(t,[t])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[a]:0}}Promise.resolve(m).catch(e=>({value:e,[a]:0})).then(t=>{const[r,a]=_(t);s.postMessage(Object.assign(Object.assign({},r),{id:u}),a),"RELEASE"===g&&(s.removeEventListener("message",i),c(s),n in e&&"function"==typeof e[n]&&e[n]())}).catch(e=>{const[t,r]=_({value:new TypeError("Unserializable return value"),[a]:0});s.postMessage(Object.assign(Object.assign({},t),{id:u}),r)})}),s.start&&s.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function g(e){return b(e,new Map,{type:"RELEASE"}).then(()=>{c(e)})}const d=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(d.get(e)||0)-1;d.set(e,t),0===t&&g(e)});function m(e,t,n=[],a=function(){}){let i=!1;const o=new Proxy(a,{get(s,a){if(u(i),a===r)return()=>{(function(e){h&&h.unregister(e)})(o),g(e),t.clear(),i=!0};if("then"===a){if(0===n.length)return{then:()=>o};const s=b(e,t,{type:"GET",path:n.map(e=>e.toString())}).then(y);return s.then.bind(s)}return m(e,t,[...n,a])},set(s,r,a){u(i);const[o,l]=_(a);return b(e,t,{type:"SET",path:[...n,r].map(e=>e.toString()),value:o},l).then(y)},apply(r,a,o){u(i);const l=n[n.length-1];if(l===s)return b(e,t,{type:"ENDPOINT"}).then(y);if("bind"===l)return m(e,t,n.slice(0,-1));const[c,g]=f(o);return b(e,t,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:c},g).then(y)},construct(s,r){u(i);const[a,o]=f(r);return b(e,t,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:a},o).then(y)}});return function(e,t){const s=(d.get(t)||0)+1;d.set(t,s),h&&h.register(e,t,e)}(o,e),o}function p(e){return Array.prototype.concat.apply([],e)}function f(e){const t=e.map(_);return[t.map(e=>e[0]),p(t.map(e=>e[1]))]}const w=new WeakMap;function _(e){for(const[t,s]of o)if(s.canHandle(e)){const[r,n]=s.serialize(e);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:e},w.get(e)||[]]}function y(e){switch(e.type){case"HANDLER":return o.get(e.name).deserialize(e.value);case"RAW":return e.value}}function b(e,t,s,r){return new Promise(n=>{const a=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(a,n),e.start&&e.start(),e.postMessage(Object.assign({id:a},s),r)})}const v=["127.0.0.1","localhost","0.0.0.0"],M=["language","browserLanguage","userLanguage","systemLanguage"],E=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=E(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var S=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(S||{});const P={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[S.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},O=e=>{if(!e)return;const t=Object.keys(e);for(const s of t){const t=e[s];if(!Array.isArray(t)&&"object"==typeof t&&null!==t&&O(t),Array.isArray(t))for(const e of t)O(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},L=()=>/(android)/i.test(navigator.userAgent);class T{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(e=>{const t=e.split("."),s=t[0],r=t[1];this[s]||(this[s]={}),this[s][r]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(e,[...arguments])}.bind(this)}),s.forEach(e=>{const t=e.split("."),s=t[0],r=t[1],n=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][n]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split("."),r=s[0],n=s[1],a=3===s.length?s[2]:null;if(a&&this[r][n][a]){const e=this[r][n][a](...t);return e instanceof Promise?e.then(e=>({result:e})):void 0!==e?Promise.resolve({result:e}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const r of e)"string"==typeof r&&"dragIn"===r?this.pluginsLoaded.push(new Promise((e,r)=>{try{import("./drag-in-BmoiEqfA.mjs").then(e=>e.l).then(({DragIn:n})=>{const a=new n(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins.dragIn=a,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,n)=>{try{r.loader().then(a=>{const i=new a(this.ui,t,s,this.viewName);i.init().then(()=>{this.plugins[r.name]=i,e()},n)})}catch(e){n(e)}}))}}const A=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},k=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},N=()=>.01*window.innerHeight+"px",R=e=>{e&&setTimeout(()=>e.style.setProperty(I,N()),0)},C="rml-styles",I="--rml-full-height",x="rml-container",B="rml-fill",D="rml-pos",U="rml-android-height",F="rml-overflow-hidden",H=new Map;class j extends T{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(t,s=[]){const r=new T;r.viewName=t;const{resolve:n,promise:a}=A(),{resolve:i,promise:o}=A(),l=new e("custom-view-"+t,window,window.parent,({message:e,args:t})=>{switch(e){case"registerCustomViewDone":n();break;case"returnMethods":r.handleSetup(t[0]),i();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(l);const c=[t];return l.sendMessage("registerCustomView",c),await a,l.sendMessage("getMethods",c),await o,r.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(e,t,s,r=[]){return this._create(e,t,s,r)}static create(e,t,s,r){return this._create(e,t,s,r)}static createViewer(e,t,s,r=[]){return this._create(e,t,s,r)}static setupHi(e){window.addEventListener("message",t=>{if("connect_hi"===t.data.type&&t.data.port){const s=t.data.port;s.start?.(),l(e,s)}})}static async _create(e,t,s,r){return new Promise(async(n,a)=>{try{const a=E((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(P);e.locale||(e.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,s=M.length;e<s;e++){const s=t[M[e]];if(s)return s.substr(0,2)}return"en"})()),"(idle)"===e.id&&delete e.id;const t=(()=>{const e=(()=>{try{return window.self!==window.top}catch{return!0}})();let t=window.location.href;if(e){if(!document.referrer)return null;t=document.referrer}const{hostname:s}=new URL(t);return s})();return t&&(e=>!!(v.includes(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com")))(t)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(O(i=s),i?.customApiUrl&&(i.customApiUrl=decodeURIComponent(i.customApiUrl)),i.shareUrl&&(i.deeplink=i.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),i));(e=>{e.featureFlags||(e.featureFlags={}),"boolean"!=typeof e.featureFlags.realPartList&&(e.featureFlags.realPartList=!0),"boolean"!=typeof e.featureFlags.globalCallbacks&&(e.featureFlags.globalCallbacks=!0),"boolean"!=typeof e.featureFlags.mocAr&&(e.featureFlags.mocAr=!1)})(a);const o=await(async(e,t)=>{if("string"!=typeof e)throw new Error('Configurator ID is not a string type: "'+typeof e+'"');const s=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,n=s+"/configurators/"+e,a="roomle_portal_v2",i="03-"+window.btoa((new Date).toISOString()+";anonymous;"+a),o=new Request(n,{method:"GET",headers:new Headers({apiKey:a,currentTenant:r,locale:"en",language:"en",device:1,token:i,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c})(e,a);s=((e,t)=>{t.configuratorId=e.id;const s=e.settings||{};return!t.overrideTenant&&e.tenant&&(t.overrideTenant=e.tenant),((e,t)=>{const s=JSON.parse(JSON.stringify(e));return E(s,t)})(s,t)})(o,a);const l=new this(o,t,s,r,n);return await Promise.allSettled(l.pluginsLoaded),l}catch(e){return a(e)}var i})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,s,r,n,a){if(super(),!t||"string"!=typeof t.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(H.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(C)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=C;const s="transition:all ease-in-out 450ms;",n=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,a=N();t.innerHTML=`\n .${x}{${I}:${a};}\n .${D}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${n}}\n .${B}{width:100%;height:100%;opacity:1}\n .${U}{height:calc(var(${I},1vh)*100)}\n .${F}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const i=new e("website",window,null,this._executeMessage);this.setMessageHandler(i),this._onResize=this._onResize.bind(this),L()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=r,this._configuratorSettings=t;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(o),this._iframe=o,this.setupPlugins(n,this._iframe),H.set(s,!0)}teardown(){this._container&&H.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){const e=document.createElement("iframe");let t=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(t=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(t=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(t=this._initData.overrideServerUrl),e.src=t,e.classList.add(x),e.classList.add(B),e}_onResize(){R(this._iframe)}_onUseFullPage(){this._iframe.classList.add(D),document.documentElement.classList.add(F),window.document.body.classList.add(F),L()&&(R(this._iframe),this._iframe.classList.add(U))}_onBackToWebsite(){this._iframe.classList.remove(D),this._iframe.classList.remove(U),document.documentElement.classList.remove(F),window.document.body.classList.remove(F)}_executeMessage({message:e,args:t},s){if(s.source&&s.source===this._iframe?.contentWindow)return"requestBoot"===e?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):"setup"===e?(this.handleSetup(t[0]),k(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),k(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage("websiteReady")},0),Promise.resolve({result:null})):this.executeMessage({message:e,args:t})}}export{j as default};
@@ -1,4 +1,4 @@
1
- (function(_,D){typeof exports=="object"&&typeof module<"u"?module.exports=D():typeof define=="function"&&define.amd?define(D):(_=typeof globalThis<"u"?globalThis:_||self,_["roomle-embedding-lib"]=_["roomle-embedding-lib"]||{},_["roomle-embedding-lib"].umd=_["roomle-embedding-lib"].umd||{},_["roomle-embedding-lib"].umd.js=D())})(this,function(){"use strict";class _{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(t,e,r,n){this._side=t,this._incomingMessageBus=e,this._outgoingMessageBus=r,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(t){this._outgoingMessageBus=t}setMessageExecution(t){this._execMessage=t}sendMessage(t,e=[]){return new Promise((r,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return r(void 0);const i=new MessageChannel;i.port1.onmessage=a=>{if(!a||!a.data)return i.port1.close(),i.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let c;try{c=JSON.parse(a.data)}catch(l){return i.port1.close(),i.port2.close(),this._prepareError(l),n(l)}c.error?n(c.error):c.result!==void 0?r(c.result):r(void 0),i.port1.close(),i.port2.close()};let o="";try{o=JSON.stringify({message:t,args:e})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(o,"*",[i.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&t.data.type!=="connect_hi"&&e)try{const r=JSON.parse(t.data);if(!this._execMessage)return e.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const n=this._execMessage(r,t);if(n===void 0)return;n.then((i={})=>{let o,a;typeof i=="object"&&i!==null&&(o=i.error,a=i.result),o?e.postMessage(JSON.stringify({error:o})):a!==void 0?e.postMessage(JSON.stringify({result:a})):e.postMessage(JSON.stringify({result:i}))},i=>{e.postMessage(JSON.stringify({error:this._prepareError(i)}))})}catch(r){e.postMessage(JSON.stringify({error:this._prepareError(r)}))}}_prepareError(t){if(typeof t=="string"){const e=this._side+": "+t;return console.error(e),e}return t.message=this._side+": "+t.message,console.error(t),t.message}}/**
1
+ (function(_,D){typeof exports=="object"&&typeof module<"u"?module.exports=D():typeof define=="function"&&define.amd?define(D):(_=typeof globalThis<"u"?globalThis:_||self,_["roomle-embedding-lib"]=_["roomle-embedding-lib"]||{},_["roomle-embedding-lib"].umd=_["roomle-embedding-lib"].umd||{},_["roomle-embedding-lib"].umd.js=D())})(this,function(){"use strict";class _{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(t,e,r,n){this._side=t,this._incomingMessageBus=e,this._outgoingMessageBus=r,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(t){this._outgoingMessageBus=t}setMessageExecution(t){this._execMessage=t}sendMessage(t,e=[]){return new Promise((r,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return r(void 0);const i=new MessageChannel;i.port1.onmessage=a=>{if(!a||!a.data)return i.port1.close(),i.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let c;try{c=JSON.parse(a.data)}catch(l){return i.port1.close(),i.port2.close(),this._prepareError(l),n(l)}c.error?n(c.error):c.result!==void 0?r(c.result):r(void 0),i.port1.close(),i.port2.close()};let o="";try{o=JSON.stringify({message:t,args:e})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(o,"*",[i.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&(typeof t.data=="string"||t.data.type!=="connect_hi")&&e)try{const r=JSON.parse(t.data);if(!this._execMessage)return e.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const n=this._execMessage(r,t);if(n===void 0)return;n.then((i={})=>{let o,a;typeof i=="object"&&i!==null&&(o=i.error,a=i.result),o?e.postMessage(JSON.stringify({error:o})):a!==void 0?e.postMessage(JSON.stringify({result:a})):e.postMessage(JSON.stringify({result:i}))},i=>{e.postMessage(JSON.stringify({error:this._prepareError(i)}))})}catch(r){e.postMessage(JSON.stringify({error:this._prepareError(r)}))}}_prepareError(t){if(typeof t=="string"){const e=this._side+": "+t;return console.error(e),e}return t.message=this._side+": "+t.message,console.error(t),t.message}}/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
@@ -1 +1 @@
1
- var t,e;t=this,e=function(){"use strict";class t{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(t,e,s,n){this._side=t,this._incomingMessageBus=e,this._outgoingMessageBus=s,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(t){this._outgoingMessageBus=t}setMessageExecution(t){this._execMessage=t}sendMessage(t,e=[]){return new Promise((s,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const r=new MessageChannel;r.port1.onmessage=t=>{if(!t||!t.data)return r.port1.close(),r.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return r.port1.close(),r.port2.close(),this._prepareError(t),n(t)}e.error?n(e.error):void 0!==e.result?s(e.result):s(void 0),r.port1.close(),r.port2.close()};let i="";try{i=JSON.stringify({message:t,args:e})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(i,"*",[r.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&"connect_hi"!==t.data.type&&e)try{const s=JSON.parse(t.data);if(!this._execMessage)return e.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const n=this._execMessage(s,t);if(void 0===n)return;n.then((t={})=>{let s,n;"object"==typeof t&&null!==t&&(s=t.error,n=t.result),s?e.postMessage(JSON.stringify({error:s})):void 0!==n?e.postMessage(JSON.stringify({result:n})):e.postMessage(JSON.stringify({result:t}))},t=>{e.postMessage(JSON.stringify({error:this._prepareError(t)}))})}catch(t){e.postMessage(JSON.stringify({error:this._prepareError(t)}))}}_prepareError(t){return"string"==typeof t?this._side+": "+t:(t.message=this._side+": "+t.message,t.message)}}const e=Symbol("Comlink.proxy"),s=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),r=Symbol("Comlink.finalizer"),i=Symbol("Comlink.thrown"),a=t=>"object"==typeof t&&null!==t||"function"==typeof t,o={canHandle:t=>a(t)&&t[e],serialize(t){const{port1:e,port2:s}=new MessageChannel;return h(t,e),[s,[s]]},deserialize:t=>(t.start(),function(t){const e=new Map;return t.addEventListener("message",function(t){const{data:s}=t;if(!s||!s.id)return;const n=e.get(s.id);if(n)try{n(s)}finally{e.delete(s.id)}}),p(t,e,[],void 0)}(t))},l={canHandle:t=>a(t)&&i in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},c=new Map([["proxy",o],["throw",l]]);function h(t,s=globalThis,n=["*"]){s.addEventListener("message",function a(o){if(!o||!o.data)return;if(!function(t,e){for(const s of t)if(e===s||"*"===s||s instanceof RegExp&&s.test(e))return!0;return!1}(n,o.origin))return;const{id:l,type:c,path:g}=Object.assign({path:[]},o.data),d=(o.data.argumentList||[]).map(w);let m;try{const s=g.slice(0,-1).reduce((t,e)=>t[e],t),n=g.reduce((t,e)=>t[e],t);switch(c){case"GET":m=n;break;case"SET":s[g.slice(-1)[0]]=w(o.data.value),m=!0;break;case"APPLY":m=n.apply(s,d);break;case"CONSTRUCT":m=function(t){return Object.assign(t,{[e]:!0})}(new n(...d));break;case"ENDPOINT":{const{port1:e,port2:s}=new MessageChannel;h(t,s),m=function(t,e){return b.set(t,e),t}(e,[e])}break;case"RELEASE":m=void 0;break;default:return}}catch(t){m={value:t,[i]:0}}Promise.resolve(m).catch(t=>({value:t,[i]:0})).then(e=>{const[n,i]=v(e);s.postMessage(Object.assign(Object.assign({},n),{id:l}),i),"RELEASE"===c&&(s.removeEventListener("message",a),u(s),r in t&&"function"==typeof t[r]&&t[r]())}).catch(t=>{const[e,n]=v({value:new TypeError("Unserializable return value"),[i]:0});s.postMessage(Object.assign(Object.assign({},e),{id:l}),n)})}),s.start&&s.start()}function u(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function g(t){if(t)throw new Error("Proxy has been released and is not useable")}function d(t){return D(t,new Map,{type:"RELEASE"}).then(()=>{u(t)})}const m=new WeakMap,_="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(m.get(t)||0)-1;m.set(t,e),0===e&&d(t)});function p(t,e,r=[],i=function(){}){let a=!1;const o=new Proxy(i,{get(s,i){if(g(a),i===n)return()=>{(function(t){_&&_.unregister(t)})(o),d(t),e.clear(),a=!0};if("then"===i){if(0===r.length)return{then:()=>o};const s=D(t,e,{type:"GET",path:r.map(t=>t.toString())}).then(w);return s.then.bind(s)}return p(t,e,[...r,i])},set(s,n,i){g(a);const[o,l]=v(i);return D(t,e,{type:"SET",path:[...r,n].map(t=>t.toString()),value:o},l).then(w)},apply(n,i,o){g(a);const l=r[r.length-1];if(l===s)return D(t,e,{type:"ENDPOINT"}).then(w);if("bind"===l)return p(t,e,r.slice(0,-1));const[c,h]=y(o);return D(t,e,{type:"APPLY",path:r.map(t=>t.toString()),argumentList:c},h).then(w)},construct(s,n){g(a);const[i,o]=y(n);return D(t,e,{type:"CONSTRUCT",path:r.map(t=>t.toString()),argumentList:i},o).then(w)}});return function(t,e){const s=(m.get(e)||0)+1;m.set(e,s),_&&_.register(t,e,t)}(o,t),o}function f(t){return Array.prototype.concat.apply([],t)}function y(t){const e=t.map(v);return[e.map(t=>t[0]),f(e.map(t=>t[1]))]}const b=new WeakMap;function v(t){for(const[e,s]of c)if(s.canHandle(t)){const[n,r]=s.serialize(t);return[{type:"HANDLER",name:e,value:n},r]}return[{type:"RAW",value:t},b.get(t)||[]]}function w(t){switch(t.type){case"HANDLER":return c.get(t.name).deserialize(t.value);case"RAW":return t.value}}function D(t,e,s,n){return new Promise(r=>{const i=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(i,r),t.start&&t.start(),t.postMessage(Object.assign({id:i},s),n)})}const E=["127.0.0.1","localhost","0.0.0.0"],T=["language","browserLanguage","userLanguage","systemLanguage"],S=(t,e)=>{for(const s in e)try{e[s].constructor===Object?t[s]=S(t[s],e[s]):t[s]=e[s]}catch{t[s]=e[s]}return t};var x,I=((x=I||{}).BOTTOM_BAR="bottom_bar",x.PARTLIST_BOUNDS="partlist_bounds",x.INTERACTION_NOTES="interaction_notes",x.PARAMETER_GROUPS="parameter_groups",x);const M={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[I.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},C=t=>{if(!t)return;const e=Object.keys(t);for(const s of e){const e=t[s];if(!Array.isArray(e)&&"object"==typeof e&&null!==e&&C(e),Array.isArray(e))for(const t of e)C(t);("true"===e||"false"===e)&&(t[s]="true"===e)}},A=()=>/(android)/i.test(navigator.userAgent);class L{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(t){this._messageHandler=t}handleSetup(t){const{methods:e,callbacks:s}=t;e.forEach(t=>{const e=t.split("."),s=e[0],n=e[1];this[s]||(this[s]={}),this[s][n]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(t,[...arguments])}.bind(this)}),s.forEach(t=>{const e=t.split("."),s=e[0],n=e[1],r=e[2];this[s]||(this[s]={}),this[s][n]||(this[s][n]={}),this[s][n][r]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const s=t.split("."),n=s[0],r=s[1],i=3===s.length?s[2]:null;if(i&&this[n][r][i]){const t=this[n][r][i](...e);return t instanceof Promise?t.then(t=>({result:t})):void 0!==t?Promise.resolve({result:t}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}setupPlugins(t,e,s="website"){for(const n of t)"string"==typeof n&&"dragIn"===n?this.pluginsLoaded.push(new Promise((t,n)=>{try{Promise.resolve().then(()=>it).then(({DragIn:r})=>{const i=new r(this.ui,e,s,this.viewName);i.init().then(()=>{this.plugins.dragIn=i,t()},n)})}catch(t){n(t)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((t,r)=>{try{n.loader().then(i=>{const a=new i(this.ui,e,s,this.viewName);a.init().then(()=>{this.plugins[n.name]=a,t()},r)})}catch(t){r(t)}}))}}const O=()=>{let t,e;return{promise:new Promise((s,n)=>{t=s,e=n}),resolve:t,reject:e}},P=(t,e,s)=>{let n=null;Object.defineProperty(t,e,{get:()=>n||s,set(t){n=t?.mute?t.value:t}})},B=()=>.01*window.innerHeight+"px",F=t=>{t&&setTimeout(()=>t.style.setProperty(N,B()),0)},k="rml-styles",N="--rml-full-height",R="rml-container",U="rml-fill",G="rml-pos",X="rml-android-height",j="rml-overflow-hidden",Y=new Map;class z{_mainDomElement;_instance;_mode="website";_viewName="main";constructor(t,e,s,n){this._instance=t,this._mainDomElement=e,this._mode=s,this._viewName=n}async init(){return Promise.resolve()}}const $="rml-drag-in-styles",H="rml-drag-in-drag-element",W="rml-drag-in-overlay",q="rml-drag-in-drag-ghost",J="rml-drag-in-fade-in",K="rml-drag-in-fade-out",V="rml-display-none",Q="250ms",Z="forwards",tt=`@keyframes ${J} {from{opacity: 0;}to {opacity: 0.5;}}`,et=`@keyframes ${K} {from{opacity: 0.5;}to {opacity: 0;}}`,st=`${J} ${Q} ${Z}`,nt=`${K} ${Q} ${Z}`,rt="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",it=Object.freeze(Object.defineProperty({__proto__:null,DragIn:class extends z{options={};_customDragSignal=new AbortController;_injectStyles(){if(!document.getElementById($)){const t=document.createElement("style");t.type="text/css",t.id=$,t.innerHTML=`\n .${V}{display:none}\n .${W}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${q}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${tt}\n ${et}\n `,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+q);e||(e=document.createElement("div"),e.classList.add(q),e.innerText=" ",t.appendChild(e))}constructor(t,e,s,n){super(t,e,s,n),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await Promise.resolve().then(()=>vt);this._strategy=new t(this._instance,this._mainDomElement,{settings:this.options,mode:"website"})}catch(t){throw t}else{if("custom-view"!==this._mode)throw new Error("Unsupported mode");try{const{DragInFromCustomViewStrategy:t}=await Promise.resolve().then(()=>St);this._strategy=new t(this._instance,this._mainDomElement,this.options,this._viewName)}catch(t){throw t}}}get isDragging(){return this._strategy.isDragging}dragStart(t,e,s="rml_id"){this._strategy.dragStart(t,e,s)}dragUpdate(t){this._strategy.dragUpdate(t)}dragEnd(){this._strategy.dragEnd()}touchStart(t,e,s="rml_id"){this._strategy.touchStart(t,e,s)}touchMove(t){this._strategy.touchMove(t)}touchEnd(){this._strategy.touchEnd()}dispose(){this._strategy.dispose()}beforeUpdateGhost(t){this._strategy.beforeUpdateGhost(t)}registerCustomDrag({customDragStart:t,customDragEnd:e,customDragUpdate:s,beforeUpdateGhost:n}){n&&this._strategy.beforeUpdateGhost(n);const r=this._customDragSignal.signal,i=e=>{"true"===e.target.getAttribute("data-rml-draggable")&&t(e)},a=t=>{this._strategy.releaseInput(t),this._strategy.isDragging&&e(t)},o=t=>{s(t)};document.querySelectorAll('[data-rml-draggable="true"]').forEach(t=>{t.draggable=!1}),document.addEventListener("mousedown",i,{signal:r}),document.addEventListener("mouseup",a,{signal:r}),document.addEventListener("mousemove",o,{signal:r}),document.addEventListener("mouseleave",a,{signal:r}),document.addEventListener("touchstart",i,{signal:r}),document.addEventListener("touchend",a,{signal:r}),document.addEventListener("touchmove",o,{signal:r})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}},Symbol.toStringTag,{value:"Module"}));class at{_computedStyleCache=new Map;_maxLifetime=16;_cacheCleanInterval=null;constructor(t=16){this._maxLifetime=t}get(t){const e=this._computedStyleCache.get(t),s=Date.now();if(e&&s-e.updated<this._maxLifetime)return e.style;const n=getComputedStyle(t);return this._computedStyleCache.set(t,{style:n,updated:s}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(1e3*this._maxLifetime,5e3))),n}_cleanUpCache(){const t=Date.now();for(const[e,{updated:s}]of this._computedStyleCache.entries())t-s>=this._maxLifetime&&this._computedStyleCache.delete(e);0===this._computedStyleCache.size&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const ot=t=>window.TouchEvent&&t instanceof window.TouchEvent;let lt;const ct=t=>(lt||(lt=new at),lt.get(t)),ht=(t,e,s)=>{const n=parseFloat(t),r=window.devicePixelRatio||1;if("px"===e)return n;if("%"===e)return n/100*(s===document.documentElement?window.innerWidth:s.offsetWidth);if("rem"===e)return n*parseFloat(ct(document.documentElement).fontSize);if("em"===e)return n*parseFloat(ct(s).fontSize);if("vh"===e||"vw"===e||"vmin"===e||"vmax"===e)return n/100*{vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)}[e];const i={cm:37.7952755906,mm:3.77952755906,in:96};return e in i?n*i[e]*r:0},ut=(t,e,s={x:0,y:0})=>{const n=t.getBoundingClientRect(),r=ct(t).transform;let i=0,a=0;if("none"!==r){const e=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,s=r.match(e);s&&(i=ht(s[1],s[2],t),a=ht(s[3],s[4],t))}const{clientX:o,clientY:l}=gt(e,s);return{x:o-n.left-i+t.scrollLeft,y:l-n.top-a+t.scrollTop}},gt=(t,e=null)=>{const{clientX:s,clientY:n}=ot(t)?dt(t):t;return{clientX:s>0?s:e?e.x:s,clientY:n>0?n:e?e.y:n}},dt=t=>{if(t.touches.length){let{clientX:e,clientY:s}=t.touches[0];if(t.touches.length>1){const n=t.touches[1];e=(e+n.clientX)/2,s=(s+n.clientY)/2}return{clientX:e,clientY:s}}const e=t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},mt=(t,e=0)=>ot(t)?{clientX:t.touches[e].clientX,clientY:t.touches[e].clientY}:{clientX:t.clientX,clientY:t.clientY},_t=t=>!t||!ot(t)||t.touches.length>0;class pt{_touchDragTimeOut;_onTouchDragStart;_payload=null;_delay=500;_firstTouch=null;_lastTouch=null;_epsilon=10;constructor(t,{onTouchDragStart:e},s={}){this._payload=t,this._onTouchDragStart=e,this._delay="number"==typeof s.delay?s.delay:500,this._epsilon="number"==typeof s.epsilon?s.epsilon:10}onStart(t){_t(t)&&(this._touchDragTimeOut||(this._firstTouch=mt(t,ot(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=mt(t)),this._checkXDistance(t)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){_t(t)&&(this._lastTouch=mt(t))}_clearTimeout(){this._touchDragTimeOut&&(clearTimeout(this._touchDragTimeOut),this._touchDragTimeOut=null)}_resetTouches(){this._clearTimeout(),this._lastTouch=null,this._firstTouch=null,this._payload=null}_checkXDistance(t){return()=>{if(!this._firstTouch||!this._lastTouch)return;let e=!1;e=Math.abs(this._firstTouch.clientX-this._lastTouch.clientX)<this._epsilon,e&&(this._onTouchDragStart(this._payload,t),this._resetTouches())}}}const ft=(t,e,s=0,n=0)=>{const r=e.x+e.width+s,i=e.x-s,a=e.y+e.height+n,o=e.y-n,{x:l,y:c}=t;return l>=i&&l<=r&&c>=o&&c<=a},yt=(t,e,s,n=0,r=0)=>{if(s&&(s.hiddenIn||s.visibleIn))return s.visibleIn?ft({x:t,y:e},s.visibleIn,n,r):!!s.hiddenIn&&!ft({x:t,y:e},s.hiddenIn,-n,-r)};class bt{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(t,e,s){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!s.ghost?.external&&s.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById($)){const t=document.createElement("style");t.type="text/css",t.id=$,t.innerHTML=`\n ${tt}\n ${et}\n `,document.head.appendChild(t)}})();const n={x:t,y:e};!s.ghost&&this._dragGhostElement&&(s.ghost={}),s.ghost&&!s.ghost.element&&this._dragGhostElement&&(s.ghost.element=this._dragGhostElement),(({x:t,y:e},s)=>{let n=document.getElementById(H);if(!n){if(n=document.createElement("div"),s.ghost?.element)n.appendChild(s.ghost.element);else{const t=document.createElement("img");t.src=s.ghost?.url||rt,t.width=s.ghost?.width||112,t.height=s.ghost?.height||112,n.appendChild(t)}n.id=H,n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.willChange="transform",n.style.transform="translate3d(0, 0, 0)",n.style.zIndex="9999",n.style.opacity="0.5",yt(t,e,s.ghost||{},s.settings?.dragInOverlapX,s.settings?.dragInOverlapY)||(n.style.display="none"),n.style.pointerEvents="none",document.body.appendChild(n)}})(n,s),(({x:t,y:e},s)=>{const n=document.getElementById(H);if(!n)return;let r=s.ghost?.width,i=s.ghost?.height;typeof r>"u"&&(r=n.getBoundingClientRect().width||112),typeof i>"u"&&(i=n.getBoundingClientRect().height||112);const a=t-r/2,o=e-i/2;n.style.transform=`translate3d(${a}px, ${o}px, 0)`,s.ghost&&(yt(t,e,s.ghost,s.settings?.dragInOverlapX,s.settings?.dragInOverlapY)?n.style.animation!=st&&(n.style.animation=st):n.style.animation!=nt&&(n.style.animation=nt))})(n,s),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(H);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}const vt=Object.freeze(Object.defineProperty({__proto__:null,DragInFromWebsiteStrategy:class{_options={};_instance;_mainDomElement;_currentDrag={};_currentTouch=null;_firefoxDragPosition={x:0,y:0};_onBeforeUpdateDrag=()=>({});isDragging=!1;_firefoxFallback=t=>{if(!this._currentDrag.event)return;t.preventDefault();const e=t||window.event;this._firefoxDragPosition.x=e.pageX||0,this._firefoxDragPosition.y=e.pageY||0};constructor(t,e,s){this._instance=t,this._mainDomElement=e,this._options=s||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(t,e,s="rml_id"){const n=this._mainDomElement.parentNode;if("relative"!==ct(n).position)return;this._mainDomElement.style.pointerEvents="none";let r=n.querySelector("."+W);r||(r=document.createElement("div"),r.classList.add(W),n.appendChild(r)),r.classList.remove(V),e.target.getAttribute("draggable");const i=n.querySelector("."+q);this._currentDrag.event=e;const a=e.target,o=a.cloneNode(!0),l=a.getBoundingClientRect();o.style.width=`${l.width}px`,o.style.height=`${l.height}px`,this._currentDrag.ghost=new bt(o),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:c,clientY:h}=gt(e,this._firefoxDragPosition);this._currentDrag.offset.x=c-l.left,this._currentDrag.offset.y=h-l.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(i,0,0);const{x:u,y:g}=ut(n,this._currentDrag.event||e,this._firefoxDragPosition),d=Math.max(1,u),m=Math.max(1,g);this.isDragging=!0,this._instance.dragInObject(t,d,m,s)}dragUpdate(t){const e=this._mainDomElement.parentNode,{x:s,y:n}=ut(e,t,this._firefoxDragPosition);if(0===s&&0===n)return;const r=Math.max(1,s),i=Math.max(1,n);if(1===r&&1===i)return;let a=r,o=i;if(ot(t)){const t=this._options.settings?.fingerSize||0;a=Math.max(2,r+t),o=Math.max(2,i-t)}const{x:l,y:c,options:h}=this._onBeforeUpdateDrag(a,o,{}),u=h||{settings:{},ghost:{}};u.ghost||(u.ghost={}),u.ghost.visibleIn&&u.ghost.hiddenIn||(u.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const g="number"==typeof l?l:a,d="number"==typeof c?c:o;if(this._currentDrag.ghost){const{clientX:e,clientY:s}=gt(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(e,s,u)}this._instance.updateDrag(g,d,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const t=this._mainDomElement.parentNode;this.isDragging=!1,this._instance.dragInObjectEnd(),this._currentDrag.ghost&&(this._currentDrag.ghost.removeDragGhost(),this._currentDrag.ghost=null),this._currentDrag={},this._firefoxDragPosition={x:0,y:0};const e=t.querySelector("."+W);e&&e.classList.add(V)}touchStart(t,e,s="rml_id"){e.preventDefault();const n={};"number"==typeof this._options?.settings?.touchDragDelay&&(n.delay=this._options.settings.touchDragDelay),this._options?.settings?.touchDragEpsilon&&(n.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new pt(void 0,{onTouchDragStart:(e,n)=>{this.dragStart(t,n,s)}},n),this._currentTouch.onStart(e)}touchMove(t){this._currentTouch&&this._currentTouch.onMove(t),this._currentDrag.event&&this.dragUpdate(t)}touchEnd(){this._currentTouch&&this._currentTouch.onEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(t){}}},Symbol.toStringTag,{value:"Module"})),wt=t=>{t.preventDefault(),t.stopPropagation()};class Dt{_startX=0;_startY=0;_lastX=0;_lastY=0;_epsilon;_isWaiting=!1;_onCustomDragStart;constructor({onCustomDragStart:t},e={}){this._epsilon="number"==typeof e.epsilon?e.epsilon:15,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&((t,e)=>{const s=this._lastX-t,n=this._lastY-e;return Math.sqrt(s*s+n*n)})(this._startX,this._startY)>this._epsilon&&(this._onCustomDragStart(t),this._isWaiting=!1)}onStart(t){this._startX=t.clientX,this._startY=t.clientY,this.onMove(t),this._isWaiting=!0}onEnd(){this._reset()}_reset(){this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this._isWaiting=!1}}const Et="data-rml-old-draggable",Tt=(t,e)=>{const s=ot(t),n={delay:s?500:100,epsilon:s?10:15};if(!e)return n;if(!(s||t instanceof MouseEvent))return n;const{delayKey:r,epsilonKey:i}=s?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof e[r]&&(n.delay=e.touchDragDelay),"number"==typeof e[i]&&(n.epsilon=e.touchDragEpsilon),n},St=Object.freeze(Object.defineProperty({__proto__:null,DragInFromCustomViewStrategy:class{_options={};_instance;_mainDomElement;_viewName;_currentCustomDrag=null;_currentBb=null;_startTarget=null;_onBeforeUpdateDrag=()=>({});isDragging=!1;constructor(t,e,s,n){this._instance=t,this._options=s||{},this._viewName=n,this._mainDomElement=e,this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,e,s="rml_id"){this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(Et,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",wt),this._startTarget.addEventListener("dragstart",wt)),this._currentBb=await this._instance.getBoundingClientRect((()=>`[data-rml-custom-view="${this._viewName}"]`)());const{clientX:n,clientY:r}=gt(e),i=this._currentBb.x+n,a=this._currentBb.y+r;this.isDragging=!0,this._instance.dragInObject(t,i,a,s)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:s}=gt(t),{url:n,width:r,height:i}=(t=>{let e="",s=112,n=112;if(!t)return{url:rt,width:s,height:n};const r=t;if(r instanceof HTMLElement){const t=r.getBoundingClientRect(),i=r.getAttribute("data-rml-ghost-url"),a=r.getAttribute("data-rml-ghost-width"),o=r.getAttribute("data-rml-ghost-height");i?e=i:!i&&r instanceof HTMLImageElement&&r.src&&(e=r.src),e?(s=t.width,n=t.height):e=rt,s=a?parseInt(a,10):s,n=o?parseInt(o,10):n}return{url:e||rt,width:s,height:n}})(this._startTarget),a=this._currentBb.x+e,o=this._currentBb.y+s,l=this._options||{},c={ghost:{visibleIn:{x:this._currentBb.x-(l.dragInOverlapX||0),y:this._currentBb.y+(l.dragInOverlapY||0),width:this._currentBb.width+(l.dragInOverlapX||0),height:this._currentBb.height+(l.dragInOverlapY||0)},url:n,width:r,height:i},mode:"custom-view"},{x:h,y:u,options:g}=this._onBeforeUpdateDrag(a,o,c),d="number"==typeof h?h:a,m="number"==typeof u?u:o,_=g||c;this._instance.updateDrag(d,m,_)}_dragEnd(){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._currentCustomDrag=null,this.isDragging=!1,this._currentBb=null,this._resetStartTarget(),this._instance.enableEvents(),this._instance.dragInObjectEnd()}dragStart(t,e,s){this._instance.disableEvents(),this._startTarget=e.target,this._currentCustomDrag=ot(e)?new pt(void 0,{onTouchDragStart:(e,n)=>{this._dragStart(t,n,s)}},Tt(e,this._options)):new Dt({onCustomDragStart:e=>this._dragStart(t,e,s)},Tt(e,this._options)),this._currentCustomDrag.onStart(e)}dragEnd(){this._dragEnd()}dragUpdate(t){this._dragUpdate(t)}touchStart(t,e,s="rml_id"){this.dragStart(t,e,s)}touchMove(t){this.dragUpdate(t)}touchEnd(){this.dragEnd()}dispose(){}_resetStartTarget(){this._startTarget&&(this._startTarget.style.pointerEvents="",this._startTarget.style.userSelect="",this._startTarget.draggable="true"===this._startTarget.getAttribute(Et),this._startTarget.removeAttribute(Et),this._startTarget.removeEventListener("dragstart",wt))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}},Symbol.toStringTag,{value:"Module"}));return class extends L{static createPlanner(t,e,s,n=[]){return this._create(t,e,s,n)}static async connect(e,s=[]){const n=new L;n.viewName=e;const{resolve:r,promise:i}=O(),{resolve:a,promise:o}=O(),l=new t("custom-view-"+e,window,window.parent,({message:t,args:e})=>{switch(t){case"registerCustomViewDone":r();break;case"returnMethods":n.handleSetup(e[0]),a();break;default:if(n.isSetupDone)return n.executeMessage({message:t,args:e})}});n.setMessageHandler(l);const c=[e];return l.sendMessage("registerCustomView",c),await i,l.sendMessage("getMethods",c),await o,n.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(n.pluginsLoaded),n}static createConfigurator(t,e,s,n=[]){return this._create(t,e,s,n)}static create(t,e,s,n){return this._create(t,e,s,n)}static createViewer(t,e,s,n=[]){return this._create(t,e,s,n)}static setupHi(t){window.addEventListener("message",e=>{if("connect_hi"===e.data.type&&e.data.port){const s=e.data.port;s.start?.(),h(t,s)}})}static async _create(t,e,s,n){return new Promise(async(r,i)=>{try{const i=S((()=>{const t=(t=>JSON.parse(JSON.stringify(t)))(M);t.locale||(t.locale=((t=null)=>{const e=window.navigator;if(t)return t.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,s=T.length;t<s;t++){const s=e[T[t]];if(s)return s.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const e=(()=>{const t=(()=>{try{return window.self!==window.top}catch{return!0}})();let e=window.location.href;if(t){if(!document.referrer)return null;e=document.referrer}const{hostname:s}=new URL(e);return s})();return e&&(t=>!!(E.includes(t)||t.endsWith("roomle.com")||t.endsWith("gitlab.io")||t.endsWith("gitlab.com")))(e)&&(t.configuratorId="demoConfigurator"),t.customApiUrl=void 0,t.emails=!1,t})(),(t=>(C(t),t?.customApiUrl&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(s));(t=>{t.featureFlags||(t.featureFlags={}),"boolean"!=typeof t.featureFlags.realPartList&&(t.featureFlags.realPartList=!0),"boolean"!=typeof t.featureFlags.globalCallbacks&&(t.featureFlags.globalCallbacks=!0),"boolean"!=typeof t.featureFlags.mocAr&&(t.featureFlags.mocAr=!1)})(i);const a=await(async(t,e)=>{if("string"!=typeof t)throw new Error('Configurator ID is not a string type: "'+typeof t+'"');const s=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",n=e.overrideTenant||9,r=s+"/configurators/"+t,i="roomle_portal_v2",a="03-"+window.btoa((new Date).toISOString()+";anonymous;"+i),o=new Request(r,{method:"GET",headers:new Headers({apiKey:i,currentTenant:n,locale:"en",language:"en",device:1,token:a,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c})(t,i);s=((t,e)=>{e.configuratorId=t.id;const s=t.settings||{};return!e.overrideTenant&&t.tenant&&(e.overrideTenant=t.tenant),((t,e)=>{const s=JSON.parse(JSON.stringify(t));return S(s,e)})(s,e)})(a,i);const o=new this(a,e,s,n,r);return await Promise.allSettled(o.pluginsLoaded),o}catch(t){return i(t)}})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(e,s,n,r,i){if(super(),!e||"string"!=typeof e.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(Y.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(k)){const t=n.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id=k;const s="transition:all ease-in-out 450ms;",r=["-webkit-","-o-"].reduce((t,e)=>t+(e+s),"")+s,i=B();e.innerHTML=`\n .${R}{${N}:${i};}\n .${G}{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${r}}\n .${U}{width:100%;height:100%;opacity:1}\n .${X}{height:calc(var(${N},1vh)*100)}\n .${j}{overflow:hidden}\n `,document.head.appendChild(e)}this._executeMessage=this._executeMessage.bind(this);const a=new t("website",window,null,this._executeMessage);this.setMessageHandler(a),this._onResize=this._onResize.bind(this),A()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=n,this._configuratorSettings=e;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=i,this._container.appendChild(o),this._iframe=o,this.setupPlugins(r,this._iframe),Y.set(s,!0)}teardown(){this._container&&Y.delete(this._container);const t=this._container.querySelector("iframe");t&&this._container.removeChild(t),window.removeEventListener("resize",this._onResize)}_createIframe(){const t=document.createElement("iframe");let e=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(e=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(e=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(e=this._initData.overrideServerUrl),t.src=e,t.classList.add(R),t.classList.add(U),t}_onResize(){F(this._iframe)}_onUseFullPage(){this._iframe.classList.add(G),document.documentElement.classList.add(j),window.document.body.classList.add(j),A()&&(F(this._iframe),this._iframe.classList.add(X))}_onBackToWebsite(){this._iframe.classList.remove(G),this._iframe.classList.remove(X),document.documentElement.classList.remove(j),window.document.body.classList.remove(j)}_executeMessage({message:t,args:e},s){if(s.source&&s.source===this._iframe?.contentWindow)return"requestBoot"===t?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):"setup"===t?(this.handleSetup(e[0]),P(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),P(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage("websiteReady")},0),Promise.resolve({result:null})):this.executeMessage({message:t,args:e})}}},"object"==typeof exports&&typeof module<"u"?module.exports=e():"function"==typeof define&&define.amd?define(e):((t=typeof globalThis<"u"?globalThis:t||self)["roomle-embedding-lib"]=t["roomle-embedding-lib"]||{},t["roomle-embedding-lib"].umd=t["roomle-embedding-lib"].umd||{},t["roomle-embedding-lib"].umd.min=t["roomle-embedding-lib"].umd.min||{},t["roomle-embedding-lib"].umd.min.js=e());
1
+ var t,e;t=this,e=function(){"use strict";class t{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(t,e,s,n){this._side=t,this._incomingMessageBus=e,this._outgoingMessageBus=s,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(t){this._outgoingMessageBus=t}setMessageExecution(t){this._execMessage=t}sendMessage(t,e=[]){return new Promise((s,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const r=new MessageChannel;r.port1.onmessage=t=>{if(!t||!t.data)return r.port1.close(),r.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return r.port1.close(),r.port2.close(),this._prepareError(t),n(t)}e.error?n(e.error):void 0!==e.result?s(e.result):s(void 0),r.port1.close(),r.port2.close()};let i="";try{i=JSON.stringify({message:t,args:e})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(i,"*",[r.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&("string"==typeof t.data||"connect_hi"!==t.data.type)&&e)try{const s=JSON.parse(t.data);if(!this._execMessage)return e.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const n=this._execMessage(s,t);if(void 0===n)return;n.then((t={})=>{let s,n;"object"==typeof t&&null!==t&&(s=t.error,n=t.result),s?e.postMessage(JSON.stringify({error:s})):void 0!==n?e.postMessage(JSON.stringify({result:n})):e.postMessage(JSON.stringify({result:t}))},t=>{e.postMessage(JSON.stringify({error:this._prepareError(t)}))})}catch(t){e.postMessage(JSON.stringify({error:this._prepareError(t)}))}}_prepareError(t){return"string"==typeof t?this._side+": "+t:(t.message=this._side+": "+t.message,t.message)}}const e=Symbol("Comlink.proxy"),s=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),r=Symbol("Comlink.finalizer"),i=Symbol("Comlink.thrown"),a=t=>"object"==typeof t&&null!==t||"function"==typeof t,o={canHandle:t=>a(t)&&t[e],serialize(t){const{port1:e,port2:s}=new MessageChannel;return h(t,e),[s,[s]]},deserialize:t=>(t.start(),function(t){const e=new Map;return t.addEventListener("message",function(t){const{data:s}=t;if(!s||!s.id)return;const n=e.get(s.id);if(n)try{n(s)}finally{e.delete(s.id)}}),p(t,e,[],void 0)}(t))},l={canHandle:t=>a(t)&&i in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},c=new Map([["proxy",o],["throw",l]]);function h(t,s=globalThis,n=["*"]){s.addEventListener("message",function a(o){if(!o||!o.data)return;if(!function(t,e){for(const s of t)if(e===s||"*"===s||s instanceof RegExp&&s.test(e))return!0;return!1}(n,o.origin))return;const{id:l,type:c,path:g}=Object.assign({path:[]},o.data),d=(o.data.argumentList||[]).map(w);let m;try{const s=g.slice(0,-1).reduce((t,e)=>t[e],t),n=g.reduce((t,e)=>t[e],t);switch(c){case"GET":m=n;break;case"SET":s[g.slice(-1)[0]]=w(o.data.value),m=!0;break;case"APPLY":m=n.apply(s,d);break;case"CONSTRUCT":m=function(t){return Object.assign(t,{[e]:!0})}(new n(...d));break;case"ENDPOINT":{const{port1:e,port2:s}=new MessageChannel;h(t,s),m=function(t,e){return b.set(t,e),t}(e,[e])}break;case"RELEASE":m=void 0;break;default:return}}catch(t){m={value:t,[i]:0}}Promise.resolve(m).catch(t=>({value:t,[i]:0})).then(e=>{const[n,i]=v(e);s.postMessage(Object.assign(Object.assign({},n),{id:l}),i),"RELEASE"===c&&(s.removeEventListener("message",a),u(s),r in t&&"function"==typeof t[r]&&t[r]())}).catch(t=>{const[e,n]=v({value:new TypeError("Unserializable return value"),[i]:0});s.postMessage(Object.assign(Object.assign({},e),{id:l}),n)})}),s.start&&s.start()}function u(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function g(t){if(t)throw new Error("Proxy has been released and is not useable")}function d(t){return D(t,new Map,{type:"RELEASE"}).then(()=>{u(t)})}const m=new WeakMap,_="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(m.get(t)||0)-1;m.set(t,e),0===e&&d(t)});function p(t,e,r=[],i=function(){}){let a=!1;const o=new Proxy(i,{get(s,i){if(g(a),i===n)return()=>{(function(t){_&&_.unregister(t)})(o),d(t),e.clear(),a=!0};if("then"===i){if(0===r.length)return{then:()=>o};const s=D(t,e,{type:"GET",path:r.map(t=>t.toString())}).then(w);return s.then.bind(s)}return p(t,e,[...r,i])},set(s,n,i){g(a);const[o,l]=v(i);return D(t,e,{type:"SET",path:[...r,n].map(t=>t.toString()),value:o},l).then(w)},apply(n,i,o){g(a);const l=r[r.length-1];if(l===s)return D(t,e,{type:"ENDPOINT"}).then(w);if("bind"===l)return p(t,e,r.slice(0,-1));const[c,h]=y(o);return D(t,e,{type:"APPLY",path:r.map(t=>t.toString()),argumentList:c},h).then(w)},construct(s,n){g(a);const[i,o]=y(n);return D(t,e,{type:"CONSTRUCT",path:r.map(t=>t.toString()),argumentList:i},o).then(w)}});return function(t,e){const s=(m.get(e)||0)+1;m.set(e,s),_&&_.register(t,e,t)}(o,t),o}function f(t){return Array.prototype.concat.apply([],t)}function y(t){const e=t.map(v);return[e.map(t=>t[0]),f(e.map(t=>t[1]))]}const b=new WeakMap;function v(t){for(const[e,s]of c)if(s.canHandle(t)){const[n,r]=s.serialize(t);return[{type:"HANDLER",name:e,value:n},r]}return[{type:"RAW",value:t},b.get(t)||[]]}function w(t){switch(t.type){case"HANDLER":return c.get(t.name).deserialize(t.value);case"RAW":return t.value}}function D(t,e,s,n){return new Promise(r=>{const i=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(i,r),t.start&&t.start(),t.postMessage(Object.assign({id:i},s),n)})}const E=["127.0.0.1","localhost","0.0.0.0"],T=["language","browserLanguage","userLanguage","systemLanguage"],S=(t,e)=>{for(const s in e)try{e[s].constructor===Object?t[s]=S(t[s],e[s]):t[s]=e[s]}catch{t[s]=e[s]}return t};var x,I=((x=I||{}).BOTTOM_BAR="bottom_bar",x.PARTLIST_BOUNDS="partlist_bounds",x.INTERACTION_NOTES="interaction_notes",x.PARAMETER_GROUPS="parameter_groups",x);const M={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[I.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},C=t=>{if(!t)return;const e=Object.keys(t);for(const s of e){const e=t[s];if(!Array.isArray(e)&&"object"==typeof e&&null!==e&&C(e),Array.isArray(e))for(const t of e)C(t);("true"===e||"false"===e)&&(t[s]="true"===e)}},A=()=>/(android)/i.test(navigator.userAgent);class L{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(t){this._messageHandler=t}handleSetup(t){const{methods:e,callbacks:s}=t;e.forEach(t=>{const e=t.split("."),s=e[0],n=e[1];this[s]||(this[s]={}),this[s][n]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(t,[...arguments])}.bind(this)}),s.forEach(t=>{const e=t.split("."),s=e[0],n=e[1],r=e[2];this[s]||(this[s]={}),this[s][n]||(this[s][n]={}),this[s][n][r]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const s=t.split("."),n=s[0],r=s[1],i=3===s.length?s[2]:null;if(i&&this[n][r][i]){const t=this[n][r][i](...e);return t instanceof Promise?t.then(t=>({result:t})):void 0!==t?Promise.resolve({result:t}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}setupPlugins(t,e,s="website"){for(const n of t)"string"==typeof n&&"dragIn"===n?this.pluginsLoaded.push(new Promise((t,n)=>{try{Promise.resolve().then(()=>it).then(({DragIn:r})=>{const i=new r(this.ui,e,s,this.viewName);i.init().then(()=>{this.plugins.dragIn=i,t()},n)})}catch(t){n(t)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((t,r)=>{try{n.loader().then(i=>{const a=new i(this.ui,e,s,this.viewName);a.init().then(()=>{this.plugins[n.name]=a,t()},r)})}catch(t){r(t)}}))}}const O=()=>{let t,e;return{promise:new Promise((s,n)=>{t=s,e=n}),resolve:t,reject:e}},P=(t,e,s)=>{let n=null;Object.defineProperty(t,e,{get:()=>n||s,set(t){n=t?.mute?t.value:t}})},B=()=>.01*window.innerHeight+"px",F=t=>{t&&setTimeout(()=>t.style.setProperty(N,B()),0)},k="rml-styles",N="--rml-full-height",R="rml-container",U="rml-fill",G="rml-pos",X="rml-android-height",j="rml-overflow-hidden",Y=new Map;class z{_mainDomElement;_instance;_mode="website";_viewName="main";constructor(t,e,s,n){this._instance=t,this._mainDomElement=e,this._mode=s,this._viewName=n}async init(){return Promise.resolve()}}const $="rml-drag-in-styles",H="rml-drag-in-drag-element",W="rml-drag-in-overlay",q="rml-drag-in-drag-ghost",J="rml-drag-in-fade-in",K="rml-drag-in-fade-out",V="rml-display-none",Q="250ms",Z="forwards",tt=`@keyframes ${J} {from{opacity: 0;}to {opacity: 0.5;}}`,et=`@keyframes ${K} {from{opacity: 0.5;}to {opacity: 0;}}`,st=`${J} ${Q} ${Z}`,nt=`${K} ${Q} ${Z}`,rt="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",it=Object.freeze(Object.defineProperty({__proto__:null,DragIn:class extends z{options={};_customDragSignal=new AbortController;_injectStyles(){if(!document.getElementById($)){const t=document.createElement("style");t.type="text/css",t.id=$,t.innerHTML=`\n .${V}{display:none}\n .${W}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${q}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${tt}\n ${et}\n `,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+q);e||(e=document.createElement("div"),e.classList.add(q),e.innerText=" ",t.appendChild(e))}constructor(t,e,s,n){super(t,e,s,n),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await Promise.resolve().then(()=>vt);this._strategy=new t(this._instance,this._mainDomElement,{settings:this.options,mode:"website"})}catch(t){throw t}else{if("custom-view"!==this._mode)throw new Error("Unsupported mode");try{const{DragInFromCustomViewStrategy:t}=await Promise.resolve().then(()=>St);this._strategy=new t(this._instance,this._mainDomElement,this.options,this._viewName)}catch(t){throw t}}}get isDragging(){return this._strategy.isDragging}dragStart(t,e,s="rml_id"){this._strategy.dragStart(t,e,s)}dragUpdate(t){this._strategy.dragUpdate(t)}dragEnd(){this._strategy.dragEnd()}touchStart(t,e,s="rml_id"){this._strategy.touchStart(t,e,s)}touchMove(t){this._strategy.touchMove(t)}touchEnd(){this._strategy.touchEnd()}dispose(){this._strategy.dispose()}beforeUpdateGhost(t){this._strategy.beforeUpdateGhost(t)}registerCustomDrag({customDragStart:t,customDragEnd:e,customDragUpdate:s,beforeUpdateGhost:n}){n&&this._strategy.beforeUpdateGhost(n);const r=this._customDragSignal.signal,i=e=>{"true"===e.target.getAttribute("data-rml-draggable")&&t(e)},a=t=>{this._strategy.releaseInput(t),this._strategy.isDragging&&e(t)},o=t=>{s(t)};document.querySelectorAll('[data-rml-draggable="true"]').forEach(t=>{t.draggable=!1}),document.addEventListener("mousedown",i,{signal:r}),document.addEventListener("mouseup",a,{signal:r}),document.addEventListener("mousemove",o,{signal:r}),document.addEventListener("mouseleave",a,{signal:r}),document.addEventListener("touchstart",i,{signal:r}),document.addEventListener("touchend",a,{signal:r}),document.addEventListener("touchmove",o,{signal:r})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}},Symbol.toStringTag,{value:"Module"}));class at{_computedStyleCache=new Map;_maxLifetime=16;_cacheCleanInterval=null;constructor(t=16){this._maxLifetime=t}get(t){const e=this._computedStyleCache.get(t),s=Date.now();if(e&&s-e.updated<this._maxLifetime)return e.style;const n=getComputedStyle(t);return this._computedStyleCache.set(t,{style:n,updated:s}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(1e3*this._maxLifetime,5e3))),n}_cleanUpCache(){const t=Date.now();for(const[e,{updated:s}]of this._computedStyleCache.entries())t-s>=this._maxLifetime&&this._computedStyleCache.delete(e);0===this._computedStyleCache.size&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const ot=t=>window.TouchEvent&&t instanceof window.TouchEvent;let lt;const ct=t=>(lt||(lt=new at),lt.get(t)),ht=(t,e,s)=>{const n=parseFloat(t),r=window.devicePixelRatio||1;if("px"===e)return n;if("%"===e)return n/100*(s===document.documentElement?window.innerWidth:s.offsetWidth);if("rem"===e)return n*parseFloat(ct(document.documentElement).fontSize);if("em"===e)return n*parseFloat(ct(s).fontSize);if("vh"===e||"vw"===e||"vmin"===e||"vmax"===e)return n/100*{vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)}[e];const i={cm:37.7952755906,mm:3.77952755906,in:96};return e in i?n*i[e]*r:0},ut=(t,e,s={x:0,y:0})=>{const n=t.getBoundingClientRect(),r=ct(t).transform;let i=0,a=0;if("none"!==r){const e=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,s=r.match(e);s&&(i=ht(s[1],s[2],t),a=ht(s[3],s[4],t))}const{clientX:o,clientY:l}=gt(e,s);return{x:o-n.left-i+t.scrollLeft,y:l-n.top-a+t.scrollTop}},gt=(t,e=null)=>{const{clientX:s,clientY:n}=ot(t)?dt(t):t;return{clientX:s>0?s:e?e.x:s,clientY:n>0?n:e?e.y:n}},dt=t=>{if(t.touches.length){let{clientX:e,clientY:s}=t.touches[0];if(t.touches.length>1){const n=t.touches[1];e=(e+n.clientX)/2,s=(s+n.clientY)/2}return{clientX:e,clientY:s}}const e=t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},mt=(t,e=0)=>ot(t)?{clientX:t.touches[e].clientX,clientY:t.touches[e].clientY}:{clientX:t.clientX,clientY:t.clientY},_t=t=>!t||!ot(t)||t.touches.length>0;class pt{_touchDragTimeOut;_onTouchDragStart;_payload=null;_delay=500;_firstTouch=null;_lastTouch=null;_epsilon=10;constructor(t,{onTouchDragStart:e},s={}){this._payload=t,this._onTouchDragStart=e,this._delay="number"==typeof s.delay?s.delay:500,this._epsilon="number"==typeof s.epsilon?s.epsilon:10}onStart(t){_t(t)&&(this._touchDragTimeOut||(this._firstTouch=mt(t,ot(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=mt(t)),this._checkXDistance(t)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){_t(t)&&(this._lastTouch=mt(t))}_clearTimeout(){this._touchDragTimeOut&&(clearTimeout(this._touchDragTimeOut),this._touchDragTimeOut=null)}_resetTouches(){this._clearTimeout(),this._lastTouch=null,this._firstTouch=null,this._payload=null}_checkXDistance(t){return()=>{if(!this._firstTouch||!this._lastTouch)return;let e=!1;e=Math.abs(this._firstTouch.clientX-this._lastTouch.clientX)<this._epsilon,e&&(this._onTouchDragStart(this._payload,t),this._resetTouches())}}}const ft=(t,e,s=0,n=0)=>{const r=e.x+e.width+s,i=e.x-s,a=e.y+e.height+n,o=e.y-n,{x:l,y:c}=t;return l>=i&&l<=r&&c>=o&&c<=a},yt=(t,e,s,n=0,r=0)=>{if(s&&(s.hiddenIn||s.visibleIn))return s.visibleIn?ft({x:t,y:e},s.visibleIn,n,r):!!s.hiddenIn&&!ft({x:t,y:e},s.hiddenIn,-n,-r)};class bt{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(t,e,s){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!s.ghost?.external&&s.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById($)){const t=document.createElement("style");t.type="text/css",t.id=$,t.innerHTML=`\n ${tt}\n ${et}\n `,document.head.appendChild(t)}})();const n={x:t,y:e};!s.ghost&&this._dragGhostElement&&(s.ghost={}),s.ghost&&!s.ghost.element&&this._dragGhostElement&&(s.ghost.element=this._dragGhostElement),(({x:t,y:e},s)=>{let n=document.getElementById(H);if(!n){if(n=document.createElement("div"),s.ghost?.element)n.appendChild(s.ghost.element);else{const t=document.createElement("img");t.src=s.ghost?.url||rt,t.width=s.ghost?.width||112,t.height=s.ghost?.height||112,n.appendChild(t)}n.id=H,n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.willChange="transform",n.style.transform="translate3d(0, 0, 0)",n.style.zIndex="9999",n.style.opacity="0.5",yt(t,e,s.ghost||{},s.settings?.dragInOverlapX,s.settings?.dragInOverlapY)||(n.style.display="none"),n.style.pointerEvents="none",document.body.appendChild(n)}})(n,s),(({x:t,y:e},s)=>{const n=document.getElementById(H);if(!n)return;let r=s.ghost?.width,i=s.ghost?.height;typeof r>"u"&&(r=n.getBoundingClientRect().width||112),typeof i>"u"&&(i=n.getBoundingClientRect().height||112);const a=t-r/2,o=e-i/2;n.style.transform=`translate3d(${a}px, ${o}px, 0)`,s.ghost&&(yt(t,e,s.ghost,s.settings?.dragInOverlapX,s.settings?.dragInOverlapY)?n.style.animation!=st&&(n.style.animation=st):n.style.animation!=nt&&(n.style.animation=nt))})(n,s),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(H);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}const vt=Object.freeze(Object.defineProperty({__proto__:null,DragInFromWebsiteStrategy:class{_options={};_instance;_mainDomElement;_currentDrag={};_currentTouch=null;_firefoxDragPosition={x:0,y:0};_onBeforeUpdateDrag=()=>({});isDragging=!1;_firefoxFallback=t=>{if(!this._currentDrag.event)return;t.preventDefault();const e=t||window.event;this._firefoxDragPosition.x=e.pageX||0,this._firefoxDragPosition.y=e.pageY||0};constructor(t,e,s){this._instance=t,this._mainDomElement=e,this._options=s||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(t,e,s="rml_id"){const n=this._mainDomElement.parentNode;if("relative"!==ct(n).position)return;this._mainDomElement.style.pointerEvents="none";let r=n.querySelector("."+W);r||(r=document.createElement("div"),r.classList.add(W),n.appendChild(r)),r.classList.remove(V),e.target.getAttribute("draggable");const i=n.querySelector("."+q);this._currentDrag.event=e;const a=e.target,o=a.cloneNode(!0),l=a.getBoundingClientRect();o.style.width=`${l.width}px`,o.style.height=`${l.height}px`,this._currentDrag.ghost=new bt(o),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:c,clientY:h}=gt(e,this._firefoxDragPosition);this._currentDrag.offset.x=c-l.left,this._currentDrag.offset.y=h-l.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(i,0,0);const{x:u,y:g}=ut(n,this._currentDrag.event||e,this._firefoxDragPosition),d=Math.max(1,u),m=Math.max(1,g);this.isDragging=!0,this._instance.dragInObject(t,d,m,s)}dragUpdate(t){const e=this._mainDomElement.parentNode,{x:s,y:n}=ut(e,t,this._firefoxDragPosition);if(0===s&&0===n)return;const r=Math.max(1,s),i=Math.max(1,n);if(1===r&&1===i)return;let a=r,o=i;if(ot(t)){const t=this._options.settings?.fingerSize||0;a=Math.max(2,r+t),o=Math.max(2,i-t)}const{x:l,y:c,options:h}=this._onBeforeUpdateDrag(a,o,{}),u=h||{settings:{},ghost:{}};u.ghost||(u.ghost={}),u.ghost.visibleIn&&u.ghost.hiddenIn||(u.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const g="number"==typeof l?l:a,d="number"==typeof c?c:o;if(this._currentDrag.ghost){const{clientX:e,clientY:s}=gt(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(e,s,u)}this._instance.updateDrag(g,d,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const t=this._mainDomElement.parentNode;this.isDragging=!1,this._instance.dragInObjectEnd(),this._currentDrag.ghost&&(this._currentDrag.ghost.removeDragGhost(),this._currentDrag.ghost=null),this._currentDrag={},this._firefoxDragPosition={x:0,y:0};const e=t.querySelector("."+W);e&&e.classList.add(V)}touchStart(t,e,s="rml_id"){e.preventDefault();const n={};"number"==typeof this._options?.settings?.touchDragDelay&&(n.delay=this._options.settings.touchDragDelay),this._options?.settings?.touchDragEpsilon&&(n.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new pt(void 0,{onTouchDragStart:(e,n)=>{this.dragStart(t,n,s)}},n),this._currentTouch.onStart(e)}touchMove(t){this._currentTouch&&this._currentTouch.onMove(t),this._currentDrag.event&&this.dragUpdate(t)}touchEnd(){this._currentTouch&&this._currentTouch.onEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(t){}}},Symbol.toStringTag,{value:"Module"})),wt=t=>{t.preventDefault(),t.stopPropagation()};class Dt{_startX=0;_startY=0;_lastX=0;_lastY=0;_epsilon;_isWaiting=!1;_onCustomDragStart;constructor({onCustomDragStart:t},e={}){this._epsilon="number"==typeof e.epsilon?e.epsilon:15,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&((t,e)=>{const s=this._lastX-t,n=this._lastY-e;return Math.sqrt(s*s+n*n)})(this._startX,this._startY)>this._epsilon&&(this._onCustomDragStart(t),this._isWaiting=!1)}onStart(t){this._startX=t.clientX,this._startY=t.clientY,this.onMove(t),this._isWaiting=!0}onEnd(){this._reset()}_reset(){this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this._isWaiting=!1}}const Et="data-rml-old-draggable",Tt=(t,e)=>{const s=ot(t),n={delay:s?500:100,epsilon:s?10:15};if(!e)return n;if(!(s||t instanceof MouseEvent))return n;const{delayKey:r,epsilonKey:i}=s?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof e[r]&&(n.delay=e.touchDragDelay),"number"==typeof e[i]&&(n.epsilon=e.touchDragEpsilon),n},St=Object.freeze(Object.defineProperty({__proto__:null,DragInFromCustomViewStrategy:class{_options={};_instance;_mainDomElement;_viewName;_currentCustomDrag=null;_currentBb=null;_startTarget=null;_onBeforeUpdateDrag=()=>({});isDragging=!1;constructor(t,e,s,n){this._instance=t,this._options=s||{},this._viewName=n,this._mainDomElement=e,this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,e,s="rml_id"){this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(Et,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",wt),this._startTarget.addEventListener("dragstart",wt)),this._currentBb=await this._instance.getBoundingClientRect((()=>`[data-rml-custom-view="${this._viewName}"]`)());const{clientX:n,clientY:r}=gt(e),i=this._currentBb.x+n,a=this._currentBb.y+r;this.isDragging=!0,this._instance.dragInObject(t,i,a,s)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:s}=gt(t),{url:n,width:r,height:i}=(t=>{let e="",s=112,n=112;if(!t)return{url:rt,width:s,height:n};const r=t;if(r instanceof HTMLElement){const t=r.getBoundingClientRect(),i=r.getAttribute("data-rml-ghost-url"),a=r.getAttribute("data-rml-ghost-width"),o=r.getAttribute("data-rml-ghost-height");i?e=i:!i&&r instanceof HTMLImageElement&&r.src&&(e=r.src),e?(s=t.width,n=t.height):e=rt,s=a?parseInt(a,10):s,n=o?parseInt(o,10):n}return{url:e||rt,width:s,height:n}})(this._startTarget),a=this._currentBb.x+e,o=this._currentBb.y+s,l=this._options||{},c={ghost:{visibleIn:{x:this._currentBb.x-(l.dragInOverlapX||0),y:this._currentBb.y+(l.dragInOverlapY||0),width:this._currentBb.width+(l.dragInOverlapX||0),height:this._currentBb.height+(l.dragInOverlapY||0)},url:n,width:r,height:i},mode:"custom-view"},{x:h,y:u,options:g}=this._onBeforeUpdateDrag(a,o,c),d="number"==typeof h?h:a,m="number"==typeof u?u:o,_=g||c;this._instance.updateDrag(d,m,_)}_dragEnd(){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._currentCustomDrag=null,this.isDragging=!1,this._currentBb=null,this._resetStartTarget(),this._instance.enableEvents(),this._instance.dragInObjectEnd()}dragStart(t,e,s){this._instance.disableEvents(),this._startTarget=e.target,this._currentCustomDrag=ot(e)?new pt(void 0,{onTouchDragStart:(e,n)=>{this._dragStart(t,n,s)}},Tt(e,this._options)):new Dt({onCustomDragStart:e=>this._dragStart(t,e,s)},Tt(e,this._options)),this._currentCustomDrag.onStart(e)}dragEnd(){this._dragEnd()}dragUpdate(t){this._dragUpdate(t)}touchStart(t,e,s="rml_id"){this.dragStart(t,e,s)}touchMove(t){this.dragUpdate(t)}touchEnd(){this.dragEnd()}dispose(){}_resetStartTarget(){this._startTarget&&(this._startTarget.style.pointerEvents="",this._startTarget.style.userSelect="",this._startTarget.draggable="true"===this._startTarget.getAttribute(Et),this._startTarget.removeAttribute(Et),this._startTarget.removeEventListener("dragstart",wt))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}},Symbol.toStringTag,{value:"Module"}));return class extends L{static createPlanner(t,e,s,n=[]){return this._create(t,e,s,n)}static async connect(e,s=[]){const n=new L;n.viewName=e;const{resolve:r,promise:i}=O(),{resolve:a,promise:o}=O(),l=new t("custom-view-"+e,window,window.parent,({message:t,args:e})=>{switch(t){case"registerCustomViewDone":r();break;case"returnMethods":n.handleSetup(e[0]),a();break;default:if(n.isSetupDone)return n.executeMessage({message:t,args:e})}});n.setMessageHandler(l);const c=[e];return l.sendMessage("registerCustomView",c),await i,l.sendMessage("getMethods",c),await o,n.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(n.pluginsLoaded),n}static createConfigurator(t,e,s,n=[]){return this._create(t,e,s,n)}static create(t,e,s,n){return this._create(t,e,s,n)}static createViewer(t,e,s,n=[]){return this._create(t,e,s,n)}static setupHi(t){window.addEventListener("message",e=>{if("connect_hi"===e.data.type&&e.data.port){const s=e.data.port;s.start?.(),h(t,s)}})}static async _create(t,e,s,n){return new Promise(async(r,i)=>{try{const i=S((()=>{const t=(t=>JSON.parse(JSON.stringify(t)))(M);t.locale||(t.locale=((t=null)=>{const e=window.navigator;if(t)return t.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,s=T.length;t<s;t++){const s=e[T[t]];if(s)return s.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const e=(()=>{const t=(()=>{try{return window.self!==window.top}catch{return!0}})();let e=window.location.href;if(t){if(!document.referrer)return null;e=document.referrer}const{hostname:s}=new URL(e);return s})();return e&&(t=>!!(E.includes(t)||t.endsWith("roomle.com")||t.endsWith("gitlab.io")||t.endsWith("gitlab.com")))(e)&&(t.configuratorId="demoConfigurator"),t.customApiUrl=void 0,t.emails=!1,t})(),(t=>(C(t),t?.customApiUrl&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(s));(t=>{t.featureFlags||(t.featureFlags={}),"boolean"!=typeof t.featureFlags.realPartList&&(t.featureFlags.realPartList=!0),"boolean"!=typeof t.featureFlags.globalCallbacks&&(t.featureFlags.globalCallbacks=!0),"boolean"!=typeof t.featureFlags.mocAr&&(t.featureFlags.mocAr=!1)})(i);const a=await(async(t,e)=>{if("string"!=typeof t)throw new Error('Configurator ID is not a string type: "'+typeof t+'"');const s=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",n=e.overrideTenant||9,r=s+"/configurators/"+t,i="roomle_portal_v2",a="03-"+window.btoa((new Date).toISOString()+";anonymous;"+i),o=new Request(r,{method:"GET",headers:new Headers({apiKey:i,currentTenant:n,locale:"en",language:"en",device:1,token:a,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c})(t,i);s=((t,e)=>{e.configuratorId=t.id;const s=t.settings||{};return!e.overrideTenant&&t.tenant&&(e.overrideTenant=t.tenant),((t,e)=>{const s=JSON.parse(JSON.stringify(t));return S(s,e)})(s,e)})(a,i);const o=new this(a,e,s,n,r);return await Promise.allSettled(o.pluginsLoaded),o}catch(t){return i(t)}})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(e,s,n,r,i){if(super(),!e||"string"!=typeof e.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(Y.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(k)){const t=n.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id=k;const s="transition:all ease-in-out 450ms;",r=["-webkit-","-o-"].reduce((t,e)=>t+(e+s),"")+s,i=B();e.innerHTML=`\n .${R}{${N}:${i};}\n .${G}{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${r}}\n .${U}{width:100%;height:100%;opacity:1}\n .${X}{height:calc(var(${N},1vh)*100)}\n .${j}{overflow:hidden}\n `,document.head.appendChild(e)}this._executeMessage=this._executeMessage.bind(this);const a=new t("website",window,null,this._executeMessage);this.setMessageHandler(a),this._onResize=this._onResize.bind(this),A()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=n,this._configuratorSettings=e;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=i,this._container.appendChild(o),this._iframe=o,this.setupPlugins(r,this._iframe),Y.set(s,!0)}teardown(){this._container&&Y.delete(this._container);const t=this._container.querySelector("iframe");t&&this._container.removeChild(t),window.removeEventListener("resize",this._onResize)}_createIframe(){const t=document.createElement("iframe");let e=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(e=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(e=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(e=this._initData.overrideServerUrl),t.src=e,t.classList.add(R),t.classList.add(U),t}_onResize(){F(this._iframe)}_onUseFullPage(){this._iframe.classList.add(G),document.documentElement.classList.add(j),window.document.body.classList.add(j),A()&&(F(this._iframe),this._iframe.classList.add(X))}_onBackToWebsite(){this._iframe.classList.remove(G),this._iframe.classList.remove(X),document.documentElement.classList.remove(j),window.document.body.classList.remove(j)}_executeMessage({message:t,args:e},s){if(s.source&&s.source===this._iframe?.contentWindow)return"requestBoot"===t?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):"setup"===t?(this.handleSetup(e[0]),P(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),P(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage("websiteReady")},0),Promise.resolve({result:null})):this.executeMessage({message:t,args:e})}}},"object"==typeof exports&&typeof module<"u"?module.exports=e():"function"==typeof define&&define.amd?define(e):((t=typeof globalThis<"u"?globalThis:t||self)["roomle-embedding-lib"]=t["roomle-embedding-lib"]||{},t["roomle-embedding-lib"].umd=t["roomle-embedding-lib"].umd||{},t["roomle-embedding-lib"].umd.min=t["roomle-embedding-lib"].umd.min||{},t["roomle-embedding-lib"].umd.min.js=e());