@roomle/embedding-lib 5.5.0 → 5.6.0-alpha.2

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,20 +1,20 @@
1
- ## [5.5.0](https://github.com/roomle-dev/roomle-ui/compare/embedding-lib-v5.4.0...embedding-lib-v5.5.0) (2024-10-22)
1
+ ## [5.6.0-alpha.2](https://github.com/roomle-dev/roomle-ui/compare/embedding-lib-v5.6.0-alpha.1...embedding-lib-v5.6.0-alpha.2) (2024-10-29)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
- * dial points ([e15f238](https://github.com/roomle-dev/roomle-ui/commit/e15f238c05c04581f6349c84f104a8fe6ba60cc4))
7
- * **SDK:** upgrade to version 2.86.0 ([#1282](https://github.com/roomle-dev/roomle-ui/issues/1282)) ([fb599f0](https://github.com/roomle-dev/roomle-ui/commit/fb599f0680a45489a598c0e49f59ab04b1d2a23e))
8
- * **SDK:** upgrade to version 2.87.0-alpha.1 ([#1285](https://github.com/roomle-dev/roomle-ui/issues/1285)) ([fa214a9](https://github.com/roomle-dev/roomle-ui/commit/fa214a98b18edae8629f819b30ac7025508c1e96))
6
+ * enable wall auto height behind feature flag ([d74da57](https://github.com/roomle-dev/roomle-ui/commit/d74da578261639d02155c02c7bd13c5f77a0090d))
7
+ * oxlint ([796acb1](https://github.com/roomle-dev/roomle-ui/commit/796acb1f2c2aa7f64f6af11640e7fd0ccc33ba88))
8
+ * **SDK:** upgrade to version 2.88.0-alpha.2 ([#1312](https://github.com/roomle-dev/roomle-ui/issues/1312)) ([b1c8905](https://github.com/roomle-dev/roomle-ui/commit/b1c8905b358ad62b2e7c675d9de546e9281490d1))
9
+ * working eslint flat config ([03176a6](https://github.com/roomle-dev/roomle-ui/commit/03176a6dbb57f8b3ce7c95328efa9906f68151b2))
9
10
 
10
11
 
11
12
  ### Bug Fixes
12
13
 
13
- * amount of ticks ([16d4f88](https://github.com/roomle-dev/roomle-ui/commit/16d4f8884e9bca0b9d2c103ad4d038dc983b4571))
14
- * disable snapping when zero is supplied ([bb976d2](https://github.com/roomle-dev/roomle-ui/commit/bb976d2d9436d7212cbcf4936936892fd89a4bbc))
15
- * fix typescript issue in test causing tests to fail ([65fb1a3](https://github.com/roomle-dev/roomle-ui/commit/65fb1a382da215611761a3fa9739ee2dee632df9))
16
- * make sure global search for addons shows regardless of searchThreshold setting ([9cad5a0](https://github.com/roomle-dev/roomle-ui/commit/9cad5a0ba52977640f6731092a27fe2d08dc677a))
17
- * remove redundant CSS ([7b985c5](https://github.com/roomle-dev/roomle-ui/commit/7b985c5eb85363e7c15fb41adaaf93f0bd9f104d))
18
- * Room Designer - Multi selection after movement not selected ([4a6e60a](https://github.com/roomle-dev/roomle-ui/commit/4a6e60aae10719f2bd50b9753d0ae9780cef3db5))
19
- * search input showing when elements are empty ([e59f0a8](https://github.com/roomle-dev/roomle-ui/commit/e59f0a876df49caeb8c0526e6c0c36553006b214))
20
- * tests ([9eccce6](https://github.com/roomle-dev/roomle-ui/commit/9eccce6919bad8bf0748b6b3be4c66f0cea4d588))
14
+ * a couple of type errors ([2f55e03](https://github.com/roomle-dev/roomle-ui/commit/2f55e03b044fcfb9e829cf24a7b0635505ad82da))
15
+ * failing unit tests ([ba69c49](https://github.com/roomle-dev/roomle-ui/commit/ba69c491326175c424b1d6d7ee8f41a749bf39b3))
16
+ * feedback changes, vscode settings, add oxlint promises rule ([b3bb64e](https://github.com/roomle-dev/roomle-ui/commit/b3bb64e1125e994b07fc90f735eaaa53a3a6fb23))
17
+ * optional props on collectionview ([cdce94d](https://github.com/roomle-dev/roomle-ui/commit/cdce94d94261f466019792ea878c7709de11c87d))
18
+ * remaining issues ([9d6db1a](https://github.com/roomle-dev/roomle-ui/commit/9d6db1aef414950f9485dc0c6fd15ea27f783f1c))
19
+ * typescript and eslint ([6ee5c0a](https://github.com/roomle-dev/roomle-ui/commit/6ee5c0ae0938e842040ba1084c91b3f1a9d8f6b6))
20
+ * Unexpected aliasing of 'this' to local variable. in exposed-api.ts ([c5c142b](https://github.com/roomle-dev/roomle-ui/commit/c5c142b28d4b07c31ae255ceb471bbfc117e2925))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomle/embedding-lib",
3
- "version": "5.5.0",
3
+ "version": "5.6.0-alpha.2",
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",
@@ -29,7 +29,7 @@
29
29
  "npm": "8.3.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@roomle/web-sdk": "2.87.0-alpha.3"
32
+ "@roomle/web-sdk": "2.88.0-alpha.4"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",
@@ -1,13 +1,13 @@
1
1
  var M = Object.defineProperty;
2
2
  var v = (t, e, s) => e in t ? M(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var l = (t, e, s) => v(t, typeof e != "symbol" ? e + "" : e, s);
3
+ var c = (t, e, s) => v(t, typeof e != "symbol" ? e + "" : e, s);
4
4
  class P {
5
5
  constructor(e, s, r, o) {
6
- l(this, "_side");
6
+ c(this, "_side");
7
7
  // for better debugging (who handles message? iframe or website?)
8
- l(this, "_incomingMessageBus");
9
- l(this, "_outgoingMessageBus", null);
10
- l(this, "_execMessage", null);
8
+ c(this, "_incomingMessageBus");
9
+ c(this, "_outgoingMessageBus", null);
10
+ c(this, "_execMessage", null);
11
11
  this._side = e, this._incomingMessageBus = s, this._outgoingMessageBus = r, this._execMessage = o, this._incomingMessageBus.addEventListener(
12
12
  "message",
13
13
  this._handleMessage.bind(this)
@@ -29,13 +29,13 @@ class P {
29
29
  this._side + " received message but response can not be interpreted"
30
30
  )
31
31
  );
32
- let c;
32
+ let l;
33
33
  try {
34
- c = JSON.parse(n.data);
34
+ l = JSON.parse(n.data);
35
35
  } catch (a) {
36
36
  return i.port1.close(), i.port2.close(), this._prepareError(a), o(a);
37
37
  }
38
- c.error ? o(c.error) : c.result !== void 0 ? r(c.result) : r(void 0), i.port1.close(), i.port2.close();
38
+ l.error ? o(l.error) : l.result !== void 0 ? r(l.result) : r(void 0), i.port1.close(), i.port2.close();
39
39
  };
40
40
  let g = "";
41
41
  try {
@@ -124,12 +124,12 @@ const p = ".", E = {
124
124
  platform: "web"
125
125
  };
126
126
  return new Headers(u);
127
- }, c = new Request(o, {
127
+ }, l = new Request(o, {
128
128
  method: "GET",
129
129
  headers: n(),
130
130
  mode: "cors",
131
131
  cache: "default"
132
- }), a = await fetch(c), { configurator: f } = await a.json();
132
+ }), a = await fetch(l), { configurator: f } = await a.json();
133
133
  return f;
134
134
  }, H = () => {
135
135
  try {
@@ -195,21 +195,22 @@ const W = {
195
195
  firstPersonView: !0,
196
196
  saveToIdb: !0,
197
197
  featureFlags: {
198
- mocAr: !0
198
+ mocAr: !0,
199
+ wallAutoHeight: !1
199
200
  },
200
201
  rotationSnapDegrees: 10
201
- }, G = "(idle)", J = (t) => (w(t), t != null && t.customApiUrl && (t.customApiUrl = decodeURIComponent(t.customApiUrl)), t.shareUrl && (t.deeplink = t.shareUrl.replace(
202
+ }, G = "(idle)", J = (t) => (I(t), t != null && t.customApiUrl && (t.customApiUrl = decodeURIComponent(t.customApiUrl)), t.shareUrl && (t.deeplink = t.shareUrl.replace(
202
203
  z,
203
204
  Y
204
- )), t), w = (t) => {
205
+ )), t), I = (t) => {
205
206
  if (!t)
206
207
  return;
207
208
  const e = Object.keys(t);
208
209
  for (const s of e) {
209
210
  const r = t[s];
210
- if (!Array.isArray(r) && typeof r == "object" && r !== null && w(r), Array.isArray(r))
211
+ if (!Array.isArray(r) && typeof r == "object" && r !== null && I(r), Array.isArray(r))
211
212
  for (const o of r)
212
- w(o);
213
+ I(o);
213
214
  (r === "true" || r === "false") && (t[s] = r === "true");
214
215
  }
215
216
  }, V = (t, e) => {
@@ -247,40 +248,40 @@ const W = {
247
248
  TRANSITION: "rml-transition",
248
249
  ANDROID_HEIGHT: "rml-android-height",
249
250
  OVERFLOW_HIDDEN: "rml-overflow-hidden"
250
- }, I = /* @__PURE__ */ new Map();
251
+ }, w = /* @__PURE__ */ new Map();
251
252
  class Q {
252
253
  constructor(e, s, r, o, i) {
253
- l(this, "ui", {
254
+ c(this, "ui", {
254
255
  callbacks: null
255
256
  });
256
- l(this, "extended", {
257
+ c(this, "extended", {
257
258
  callbacks: null
258
259
  });
259
- l(this, "configurator", {
260
+ c(this, "configurator", {
260
261
  callbacks: null
261
262
  });
262
- l(this, "analytics", {
263
+ c(this, "analytics", {
263
264
  callbacks: {}
264
265
  });
265
- l(this, "global", {
266
+ c(this, "global", {
266
267
  callbacks: {}
267
268
  });
268
- l(this, "plugins", {});
269
- l(this, "_waitForIframe");
270
- l(this, "_container");
271
- l(this, "_messageHandler");
272
- l(this, "_configuratorSettings");
273
- l(this, "_initData", {});
274
- l(this, "_iframe");
275
- l(this, "pluginsLoaded", []);
269
+ c(this, "plugins", {});
270
+ c(this, "_waitForIframe");
271
+ c(this, "_container");
272
+ c(this, "_messageHandler");
273
+ c(this, "_configuratorSettings");
274
+ c(this, "_initData", {});
275
+ c(this, "_iframe");
276
+ c(this, "pluginsLoaded", []);
276
277
  if (!e || typeof e.id != "string")
277
278
  throw new Error(
278
279
  "Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person"
279
280
  );
280
- if (I.has(s))
281
+ if (w.has(s))
281
282
  throw new Error("There is already an instance on this DOM element");
282
283
  if (!!!document.getElementById(S)) {
283
- const c = r.zIndex || 9999999, a = document.createElement("style");
284
+ const l = r.zIndex || 9999999, a = document.createElement("style");
284
285
  a.type = "text/css", a.id = S;
285
286
  const f = "transition:all ease-in-out " + q + "ms;", u = ["-webkit-", "-o-"].reduce(
286
287
  (m, _) => m += _ + f,
@@ -288,7 +289,7 @@ class Q {
288
289
  ) + f, h = T();
289
290
  a.innerHTML = `
290
291
  .${d.CONTAINER}{${y}:${h};}
291
- .${d.POSITION}{position:fixed;top:0;left:0;z-index:${c};opacity:0}
292
+ .${d.POSITION}{position:fixed;top:0;left:0;z-index:${l};opacity:0}
292
293
  .${d.TRANSITION}{${u}}
293
294
  .${d.FILL}{width:100%;height:100%;opacity:1}
294
295
  .${d.ANDROID_HEIGHT}{height:calc(var(${y},1vh)*100)}
@@ -303,8 +304,8 @@ class Q {
303
304
  null,
304
305
  this._executeMessage
305
306
  ), this._waitForIframe = i, this._container.appendChild(n), this._iframe = n;
306
- for (const c of o)
307
- typeof c == "string" && c === "dragIn" ? this.pluginsLoaded.push(
307
+ for (const l of o)
308
+ typeof l == "string" && l === "dragIn" ? this.pluginsLoaded.push(
308
309
  new Promise((a, f) => {
309
310
  try {
310
311
  import("./drag-in-DC-05b4s.mjs").then(
@@ -317,19 +318,19 @@ class Q {
317
318
  f(u);
318
319
  }
319
320
  })
320
- ) : c.name && c.loader && this.pluginsLoaded.push(
321
+ ) : l.name && l.loader && this.pluginsLoaded.push(
321
322
  new Promise((a, f) => {
322
323
  try {
323
- c.loader().then((u) => {
324
+ l.loader().then((u) => {
324
325
  const h = new u(this._iframe);
325
- h.setInstance(this.ui), this.plugins[c.name] = h, a();
326
+ h.setInstance(this.ui), this.plugins[l.name] = h, a();
326
327
  });
327
328
  } catch (u) {
328
329
  f(u);
329
330
  }
330
331
  })
331
332
  );
332
- I.set(s, !0);
333
+ w.set(s, !0);
333
334
  }
334
335
  static createPlanner(e, s, r, o = []) {
335
336
  return this._create(
@@ -390,13 +391,13 @@ class Q {
390
391
  J(r)
391
392
  );
392
393
  n.featureFlags || (n.featureFlags = {}), typeof n.featureFlags.realPartList != "boolean" && (n.featureFlags.realPartList = !0), typeof n.featureFlags.globalCallbacks != "boolean" && (n.featureFlags.globalCallbacks = !0), typeof n.featureFlags.mocAr != "boolean" && (n.featureFlags.mocAr = !1);
393
- const c = await D(
394
+ const l = await D(
394
395
  e,
395
396
  n
396
397
  );
397
- r = V(c, n);
398
+ r = V(l, n);
398
399
  const a = new this(
399
- c,
400
+ l,
400
401
  s,
401
402
  r,
402
403
  o,
@@ -409,7 +410,7 @@ class Q {
409
410
  });
410
411
  }
411
412
  teardown() {
412
- this._container && I.delete(this._container);
413
+ this._container && w.delete(this._container);
413
414
  const e = this._container.querySelector("iframe");
414
415
  e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
415
416
  }
@@ -429,8 +430,8 @@ class Q {
429
430
  this._iframe.classList.remove(d.POSITION), this._iframe.classList.remove(d.ANDROID_HEIGHT), document.documentElement.classList.remove(d.OVERFLOW_HIDDEN), window.document.body.classList.remove(d.OVERFLOW_HIDDEN);
430
431
  }
431
432
  _executeMessage({ message: e, args: s }, r) {
432
- var c;
433
- if (!r.source || r.source !== ((c = this._iframe) == null ? void 0 : c.contentWindow))
433
+ var l;
434
+ if (!r.source || r.source !== ((l = this._iframe) == null ? void 0 : l.contentWindow))
434
435
  return;
435
436
  if (e === E.REQUEST_BOOT)
436
437
  return this._messageHandler.setOutgoingMessageBus(r.source), Promise.resolve({ result: this._initData });
@@ -1,4 +1,4 @@
1
- var R=Object.defineProperty,S=(s,e,t)=>e in s?R(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,c=(s,e,t)=>S(s,typeof e!="symbol"?e+"":e,t);class A{constructor(e,t,r,i){c(this,"_side"),c(this,"_incomingMessageBus"),c(this,"_outgoingMessageBus",null),c(this,"_execMessage",null),this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=r,this._execMessage=i,this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((r,i)=>{const n=new MessageChannel;n.port1.onmessage=o=>{if(!o||!o.data)return n.port1.close(),n.port2.close(),i(new Error(this._side+" received message but response can not be interpreted"));let a;try{a=JSON.parse(o.data)}catch(l){return n.port1.close(),n.port2.close(),this._prepareError(l),i(l)}a.error?i(a.error):a.result!==void 0?r(a.result):r(void 0),n.port1.close(),n.port2.close()};let u="";try{u=JSON.stringify({message:e,args:t})}catch{return i(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return i(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(u,"*",[n.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&t)try{const r=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const i=this._execMessage(r,e);if(i===void 0)return;i.then((n={})=>{let u,o;typeof n=="object"&&n!==null&&(u=n.error,o=n.result),u?t.postMessage(JSON.stringify({error:u})):o!==void 0?t.postMessage(JSON.stringify({result:o})):t.postMessage(JSON.stringify({result:n}))},n=>{t.postMessage(JSON.stringify({error:this._prepareError(n)}))})}catch(r){t.postMessage(JSON.stringify({error:this._prepareError(r)}))}}_prepareError(e){if(typeof e=="string"){const t=this._side+": "+e;return console.error(t),t}return e.message=this._side+": "+e.message,console.error(e),e.message}}const p=".",w={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},P=async(s,e)=>{if(typeof s!="string")throw new Error('Configurator ID is not a string type: "'+typeof s+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",r=e.overrideTenant||9,i=t+"/configurators/"+s,n="roomle_portal_v2",u="03-"+window.btoa(new Date().toISOString()+";anonymous;"+n),o=()=>{const d={apiKey:n,currentTenant:r,locale:"en",language:"en",device:1,token:u,platform:"web"};return new Headers(d)},a=new Request(i,{method:"GET",headers:o(),mode:"cors",cache:"default"}),l=await fetch(a),{configurator:g}=await l.json();return g},F=()=>{try{return window.self!==window.top}catch{return!0}},U=["127.0.0.1","localhost","0.0.0.0"],B=()=>{const s=F();let e=window.location.href;if(s){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},H=s=>!!(U.includes(s)||s.endsWith("roomle.com")||s.endsWith("gitlab.io")||s.endsWith("gitlab.com")),E=["language","browserLanguage","userLanguage","systemLanguage"],k=(s=null)=>{const e=window.navigator;if(s)return s.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=E.length;t<r;t++){const i=e[E[t]];if(i)return i.substr(0,2)}return"en"},x=(s,e)=>{const t=JSON.parse(JSON.stringify(s));return y(t,e)},y=(s,e)=>{for(const t in e)try{e[t].constructor===Object?s[t]=y(s[t],e[t]):s[t]=e[t]}catch{s[t]=e[t]}return s};var W={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const C={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0},rotationSnapDegrees:10},J="(idle)",$=s=>(b(s),s!=null&&s.customApiUrl&&(s.customApiUrl=decodeURIComponent(s.customApiUrl)),s.shareUrl&&(s.deeplink=s.shareUrl.replace(j,G)),s),b=s=>{if(!s)return;const e=Object.keys(s);for(const t of e){const r=s[t];if(!Array.isArray(r)&&typeof r=="object"&&r!==null&&b(r),Array.isArray(r))for(const i of r)b(i);(r==="true"||r==="false")&&(s[t]=r==="true")}},V=(s,e)=>{e.configuratorId=s.id;const t=s.settings||{};return!e.overrideTenant&&s.tenant&&(e.overrideTenant=s.tenant),x(t,e)},z=()=>{const s={...C};s.locale||(s.locale=k()),s.id===J&&delete s.id;const e=B();return e&&H(e)&&(s.configuratorId="demoConfigurator"),s.customApiUrl=W.VITE_RAPI_URL,s.emails=!1,s},j="<CONF_ID>",G="#CONFIGURATIONID#",v=()=>/(android)/i.test(navigator.userAgent),T=(s,e,t)=>{let r=null;Object.defineProperty(s,e,{get(){return r||t},set(i){i!=null&&i.mute?r=i.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),r=i)}})},L=()=>window.innerHeight*.01+"px",D=s=>{s&&setTimeout(()=>s.style.setProperty(I,L()),0)},M="rml-styles",q=450,I="--rml-full-height",h={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},O=new Map;class Y{constructor(e,t,r,i,n){if(c(this,"ui",{callbacks:null}),c(this,"extended",{callbacks:null}),c(this,"configurator",{callbacks:null}),c(this,"analytics",{callbacks:{}}),c(this,"global",{callbacks:{}}),c(this,"plugins",{}),c(this,"_waitForIframe"),c(this,"_container"),c(this,"_messageHandler"),c(this,"_configuratorSettings"),c(this,"_initData",{}),c(this,"_iframe"),c(this,"pluginsLoaded",[]),!e||typeof e.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(O.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(M)){const o=r.zIndex||9999999,a=document.createElement("style");a.type="text/css",a.id=M;const l="transition:all ease-in-out "+q+"ms;",g=["-webkit-","-o-"].reduce((f,m)=>f+=m+l,"")+l,d=L();a.innerHTML=`
1
+ var R=Object.defineProperty,S=(s,e,t)=>e in s?R(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,c=(s,e,t)=>S(s,typeof e!="symbol"?e+"":e,t);class A{constructor(e,t,r,i){c(this,"_side"),c(this,"_incomingMessageBus"),c(this,"_outgoingMessageBus",null),c(this,"_execMessage",null),this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=r,this._execMessage=i,this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((r,i)=>{const n=new MessageChannel;n.port1.onmessage=o=>{if(!o||!o.data)return n.port1.close(),n.port2.close(),i(new Error(this._side+" received message but response can not be interpreted"));let a;try{a=JSON.parse(o.data)}catch(l){return n.port1.close(),n.port2.close(),this._prepareError(l),i(l)}a.error?i(a.error):a.result!==void 0?r(a.result):r(void 0),n.port1.close(),n.port2.close()};let u="";try{u=JSON.stringify({message:e,args:t})}catch{return i(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return i(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(u,"*",[n.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&t)try{const r=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const i=this._execMessage(r,e);if(i===void 0)return;i.then((n={})=>{let u,o;typeof n=="object"&&n!==null&&(u=n.error,o=n.result),u?t.postMessage(JSON.stringify({error:u})):o!==void 0?t.postMessage(JSON.stringify({result:o})):t.postMessage(JSON.stringify({result:n}))},n=>{t.postMessage(JSON.stringify({error:this._prepareError(n)}))})}catch(r){t.postMessage(JSON.stringify({error:this._prepareError(r)}))}}_prepareError(e){if(typeof e=="string"){const t=this._side+": "+e;return console.error(t),t}return e.message=this._side+": "+e.message,console.error(e),e.message}}const p=".",w={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},P=async(s,e)=>{if(typeof s!="string")throw new Error('Configurator ID is not a string type: "'+typeof s+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",r=e.overrideTenant||9,i=t+"/configurators/"+s,n="roomle_portal_v2",u="03-"+window.btoa(new Date().toISOString()+";anonymous;"+n),o=()=>{const d={apiKey:n,currentTenant:r,locale:"en",language:"en",device:1,token:u,platform:"web"};return new Headers(d)},a=new Request(i,{method:"GET",headers:o(),mode:"cors",cache:"default"}),l=await fetch(a),{configurator:g}=await l.json();return g},F=()=>{try{return window.self!==window.top}catch{return!0}},U=["127.0.0.1","localhost","0.0.0.0"],H=()=>{const s=F();let e=window.location.href;if(s){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},B=s=>!!(U.includes(s)||s.endsWith("roomle.com")||s.endsWith("gitlab.io")||s.endsWith("gitlab.com")),E=["language","browserLanguage","userLanguage","systemLanguage"],k=(s=null)=>{const e=window.navigator;if(s)return s.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=E.length;t<r;t++){const i=e[E[t]];if(i)return i.substr(0,2)}return"en"},x=(s,e)=>{const t=JSON.parse(JSON.stringify(s));return y(t,e)},y=(s,e)=>{for(const t in e)try{e[t].constructor===Object?s[t]=y(s[t],e[t]):s[t]=e[t]}catch{s[t]=e[t]}return s};var W={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const C={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1},rotationSnapDegrees:10},J="(idle)",$=s=>(b(s),s!=null&&s.customApiUrl&&(s.customApiUrl=decodeURIComponent(s.customApiUrl)),s.shareUrl&&(s.deeplink=s.shareUrl.replace(j,G)),s),b=s=>{if(!s)return;const e=Object.keys(s);for(const t of e){const r=s[t];if(!Array.isArray(r)&&typeof r=="object"&&r!==null&&b(r),Array.isArray(r))for(const i of r)b(i);(r==="true"||r==="false")&&(s[t]=r==="true")}},V=(s,e)=>{e.configuratorId=s.id;const t=s.settings||{};return!e.overrideTenant&&s.tenant&&(e.overrideTenant=s.tenant),x(t,e)},z=()=>{const s={...C};s.locale||(s.locale=k()),s.id===J&&delete s.id;const e=H();return e&&B(e)&&(s.configuratorId="demoConfigurator"),s.customApiUrl=W.VITE_RAPI_URL,s.emails=!1,s},j="<CONF_ID>",G="#CONFIGURATIONID#",v=()=>/(android)/i.test(navigator.userAgent),T=(s,e,t)=>{let r=null;Object.defineProperty(s,e,{get(){return r||t},set(i){i!=null&&i.mute?r=i.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),r=i)}})},L=()=>window.innerHeight*.01+"px",D=s=>{s&&setTimeout(()=>s.style.setProperty(I,L()),0)},M="rml-styles",q=450,I="--rml-full-height",h={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},O=new Map;class Y{constructor(e,t,r,i,n){if(c(this,"ui",{callbacks:null}),c(this,"extended",{callbacks:null}),c(this,"configurator",{callbacks:null}),c(this,"analytics",{callbacks:{}}),c(this,"global",{callbacks:{}}),c(this,"plugins",{}),c(this,"_waitForIframe"),c(this,"_container"),c(this,"_messageHandler"),c(this,"_configuratorSettings"),c(this,"_initData",{}),c(this,"_iframe"),c(this,"pluginsLoaded",[]),!e||typeof e.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(O.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(M)){const o=r.zIndex||9999999,a=document.createElement("style");a.type="text/css",a.id=M;const l="transition:all ease-in-out "+q+"ms;",g=["-webkit-","-o-"].reduce((f,m)=>f+=m+l,"")+l,d=L();a.innerHTML=`
2
2
  .${h.CONTAINER}{${I}:${d};}
3
3
  .${h.POSITION}{position:fixed;top:0;left:0;z-index:${o};opacity:0}
4
4
  .${h.TRANSITION}{${g}}
@@ -1,4 +1,4 @@
1
- (function(m,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(m=typeof globalThis<"u"?globalThis:m||self,m["roomle-embedding-lib"]=m["roomle-embedding-lib"]||{},m["roomle-embedding-lib"].umd=m["roomle-embedding-lib"].umd||{},m["roomle-embedding-lib"].umd.js=p())})(this,function(){"use strict";var Te=Object.defineProperty;var Ee=(m,p,T)=>p in m?Te(m,p,{enumerable:!0,configurable:!0,writable:!0,value:T}):m[p]=T;var l=(m,p,T)=>Ee(m,typeof p!="symbol"?p+"":p,T);class m{constructor(e,t,r,n){l(this,"_side");l(this,"_incomingMessageBus");l(this,"_outgoingMessageBus",null);l(this,"_execMessage",null);this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=r,this._execMessage=n,this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((r,n)=>{const o=new MessageChannel;o.port1.onmessage=c=>{if(!c||!c.data)return o.port1.close(),o.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let u;try{u=JSON.parse(c.data)}catch(i){return o.port1.close(),o.port2.close(),this._prepareError(i),n(i)}u.error?n(u.error):u.result!==void 0?r(u.result):r(void 0),o.port1.close(),o.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}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(a,"*",[o.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&t)try{const r=JSON.parse(e.data);if(!this._execMessage)return t.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,e);if(n===void 0)return;n.then((o={})=>{let a,c;typeof o=="object"&&o!==null&&(a=o.error,c=o.result),a?t.postMessage(JSON.stringify({error:a})):c!==void 0?t.postMessage(JSON.stringify({result:c})):t.postMessage(JSON.stringify({result:o}))},o=>{t.postMessage(JSON.stringify({error:this._prepareError(o)}))})}catch(r){t.postMessage(JSON.stringify({error:this._prepareError(r)}))}}_prepareError(e){if(typeof e=="string"){const t=this._side+": "+e;return console.error(t),t}return e.message=this._side+": "+e.message,console.error(e),e.message}}const p=".",T={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},q=async(s,e)=>{if(typeof s!="string")throw new Error('Configurator ID is not a string type: "'+typeof s+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",r=e.overrideTenant||9,n=t+"/configurators/"+s,o="roomle_portal_v2",a="03-"+window.btoa(new Date().toISOString()+";anonymous;"+o),c=()=>{const h={apiKey:o,currentTenant:r,locale:"en",language:"en",device:1,token:a,platform:"web"};return new Headers(h)},u=new Request(n,{method:"GET",headers:c(),mode:"cors",cache:"default"}),i=await fetch(u),{configurator:d}=await i.json();return d},K=()=>{try{return window.self!==window.top}catch{return!0}},j=["127.0.0.1","localhost","0.0.0.0"],Q=()=>{const s=K();let e=window.location.href;if(s){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},Z=s=>!!(j.includes(s)||s.endsWith("roomle.com")||s.endsWith("gitlab.io")||s.endsWith("gitlab.com")),P=["language","browserLanguage","userLanguage","systemLanguage"],ee=(s=null)=>{const e=window.navigator;if(s)return s.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=P.length;t<r;t++){const n=e[P[t]];if(n)return n.substr(0,2)}return"en"},te=(s,e)=>{const t=JSON.parse(JSON.stringify(s));return S(t,e)},S=(s,e)=>{for(const t in e)try{e[t].constructor===Object?s[t]=S(s[t],e[t]):s[t]=e[t]}catch{s[t]=e[t]}return s};var se={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const re={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0},rotationSnapDegrees:10},ne="(idle)",oe=s=>(w(s),s!=null&&s.customApiUrl&&(s.customApiUrl=decodeURIComponent(s.customApiUrl)),s.shareUrl&&(s.deeplink=s.shareUrl.replace(ce,le)),s),w=s=>{if(!s)return;const e=Object.keys(s);for(const t of e){const r=s[t];if(!Array.isArray(r)&&typeof r=="object"&&r!==null&&w(r),Array.isArray(r))for(const n of r)w(n);(r==="true"||r==="false")&&(s[t]=r==="true")}},ie=(s,e)=>{e.configuratorId=s.id;const t=s.settings||{};return!e.overrideTenant&&s.tenant&&(e.overrideTenant=s.tenant),te(t,e)},ae=()=>{const s={...re};s.locale||(s.locale=ee()),s.id===ne&&delete s.id;const e=Q();return e&&Z(e)&&(s.configuratorId="demoConfigurator"),s.customApiUrl=se.VITE_RAPI_URL,s.emails=!1,s},ce="<CONF_ID>",le="#CONFIGURATIONID#",F=()=>/(android)/i.test(navigator.userAgent),H=(s,e,t)=>{let r=null;Object.defineProperty(s,e,{get(){return r||t},set(n){n!=null&&n.mute?r=n.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),r=n)}})},U=()=>window.innerHeight*.01+"px",Y=s=>{s&&setTimeout(()=>s.style.setProperty(A,U()),0)},k="rml-styles",ue=450,A="--rml-full-height",_={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},O=new Map;class he{constructor(e,t,r,n,o){l(this,"ui",{callbacks:null});l(this,"extended",{callbacks:null});l(this,"configurator",{callbacks:null});l(this,"analytics",{callbacks:{}});l(this,"global",{callbacks:{}});l(this,"plugins",{});l(this,"_waitForIframe");l(this,"_container");l(this,"_messageHandler");l(this,"_configuratorSettings");l(this,"_initData",{});l(this,"_iframe");l(this,"pluginsLoaded",[]);if(!e||typeof e.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(O.has(t))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(k)){const u=r.zIndex||9999999,i=document.createElement("style");i.type="text/css",i.id=k;const d="transition:all ease-in-out "+ue+"ms;",h=["-webkit-","-o-"].reduce((g,y)=>g+=y+d,"")+d,f=U();i.innerHTML=`
1
+ (function(m,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(m=typeof globalThis<"u"?globalThis:m||self,m["roomle-embedding-lib"]=m["roomle-embedding-lib"]||{},m["roomle-embedding-lib"].umd=m["roomle-embedding-lib"].umd||{},m["roomle-embedding-lib"].umd.js=p())})(this,function(){"use strict";var Te=Object.defineProperty;var Ee=(m,p,T)=>p in m?Te(m,p,{enumerable:!0,configurable:!0,writable:!0,value:T}):m[p]=T;var l=(m,p,T)=>Ee(m,typeof p!="symbol"?p+"":p,T);class m{constructor(e,t,r,n){l(this,"_side");l(this,"_incomingMessageBus");l(this,"_outgoingMessageBus",null);l(this,"_execMessage",null);this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=r,this._execMessage=n,this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((r,n)=>{const o=new MessageChannel;o.port1.onmessage=c=>{if(!c||!c.data)return o.port1.close(),o.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let u;try{u=JSON.parse(c.data)}catch(i){return o.port1.close(),o.port2.close(),this._prepareError(i),n(i)}u.error?n(u.error):u.result!==void 0?r(u.result):r(void 0),o.port1.close(),o.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}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(a,"*",[o.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&t)try{const r=JSON.parse(e.data);if(!this._execMessage)return t.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,e);if(n===void 0)return;n.then((o={})=>{let a,c;typeof o=="object"&&o!==null&&(a=o.error,c=o.result),a?t.postMessage(JSON.stringify({error:a})):c!==void 0?t.postMessage(JSON.stringify({result:c})):t.postMessage(JSON.stringify({result:o}))},o=>{t.postMessage(JSON.stringify({error:this._prepareError(o)}))})}catch(r){t.postMessage(JSON.stringify({error:this._prepareError(r)}))}}_prepareError(e){if(typeof e=="string"){const t=this._side+": "+e;return console.error(t),t}return e.message=this._side+": "+e.message,console.error(e),e.message}}const p=".",T={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},q=async(s,e)=>{if(typeof s!="string")throw new Error('Configurator ID is not a string type: "'+typeof s+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",r=e.overrideTenant||9,n=t+"/configurators/"+s,o="roomle_portal_v2",a="03-"+window.btoa(new Date().toISOString()+";anonymous;"+o),c=()=>{const h={apiKey:o,currentTenant:r,locale:"en",language:"en",device:1,token:a,platform:"web"};return new Headers(h)},u=new Request(n,{method:"GET",headers:c(),mode:"cors",cache:"default"}),i=await fetch(u),{configurator:d}=await i.json();return d},K=()=>{try{return window.self!==window.top}catch{return!0}},j=["127.0.0.1","localhost","0.0.0.0"],Q=()=>{const s=K();let e=window.location.href;if(s){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},Z=s=>!!(j.includes(s)||s.endsWith("roomle.com")||s.endsWith("gitlab.io")||s.endsWith("gitlab.com")),P=["language","browserLanguage","userLanguage","systemLanguage"],ee=(s=null)=>{const e=window.navigator;if(s)return s.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=P.length;t<r;t++){const n=e[P[t]];if(n)return n.substr(0,2)}return"en"},te=(s,e)=>{const t=JSON.parse(JSON.stringify(s));return S(t,e)},S=(s,e)=>{for(const t in e)try{e[t].constructor===Object?s[t]=S(s[t],e[t]):s[t]=e[t]}catch{s[t]=e[t]}return s};var se={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const re={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1},rotationSnapDegrees:10},ne="(idle)",oe=s=>(w(s),s!=null&&s.customApiUrl&&(s.customApiUrl=decodeURIComponent(s.customApiUrl)),s.shareUrl&&(s.deeplink=s.shareUrl.replace(ce,le)),s),w=s=>{if(!s)return;const e=Object.keys(s);for(const t of e){const r=s[t];if(!Array.isArray(r)&&typeof r=="object"&&r!==null&&w(r),Array.isArray(r))for(const n of r)w(n);(r==="true"||r==="false")&&(s[t]=r==="true")}},ie=(s,e)=>{e.configuratorId=s.id;const t=s.settings||{};return!e.overrideTenant&&s.tenant&&(e.overrideTenant=s.tenant),te(t,e)},ae=()=>{const s={...re};s.locale||(s.locale=ee()),s.id===ne&&delete s.id;const e=Q();return e&&Z(e)&&(s.configuratorId="demoConfigurator"),s.customApiUrl=se.VITE_RAPI_URL,s.emails=!1,s},ce="<CONF_ID>",le="#CONFIGURATIONID#",F=()=>/(android)/i.test(navigator.userAgent),H=(s,e,t)=>{let r=null;Object.defineProperty(s,e,{get(){return r||t},set(n){n!=null&&n.mute?r=n.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),r=n)}})},U=()=>window.innerHeight*.01+"px",Y=s=>{s&&setTimeout(()=>s.style.setProperty(A,U()),0)},k="rml-styles",ue=450,A="--rml-full-height",_={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},O=new Map;class he{constructor(e,t,r,n,o){l(this,"ui",{callbacks:null});l(this,"extended",{callbacks:null});l(this,"configurator",{callbacks:null});l(this,"analytics",{callbacks:{}});l(this,"global",{callbacks:{}});l(this,"plugins",{});l(this,"_waitForIframe");l(this,"_container");l(this,"_messageHandler");l(this,"_configuratorSettings");l(this,"_initData",{});l(this,"_iframe");l(this,"pluginsLoaded",[]);if(!e||typeof e.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(O.has(t))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(k)){const u=r.zIndex||9999999,i=document.createElement("style");i.type="text/css",i.id=k;const d="transition:all ease-in-out "+ue+"ms;",h=["-webkit-","-o-"].reduce((g,y)=>g+=y+d,"")+d,f=U();i.innerHTML=`
2
2
  .${_.CONTAINER}{${A}:${f};}
3
3
  .${_.POSITION}{position:fixed;top:0;left:0;z-index:${u};opacity:0}
4
4
  .${_.TRANSITION}{${h}}
@@ -1,14 +1,14 @@
1
- (function(_,y){typeof exports=="object"&&typeof module<"u"?module.exports=y():typeof define=="function"&&define.amd?define(y):(_=typeof globalThis<"u"?globalThis:_||self,_["roomle-embedding-lib"]=_["roomle-embedding-lib"]||{},_["roomle-embedding-lib"].umd=_["roomle-embedding-lib"].umd||{},_["roomle-embedding-lib"].umd.min=_["roomle-embedding-lib"].umd.min||{},_["roomle-embedding-lib"].umd.min.js=y())})(this,function(){"use strict";var _=Object.defineProperty,y=(i,e,t)=>e in i?_(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,l=(i,e,t)=>y(i,typeof e!="symbol"?e+"":e,t);class q{constructor(e,t,s,r){l(this,"_side"),l(this,"_incomingMessageBus"),l(this,"_outgoingMessageBus",null),l(this,"_execMessage",null),this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,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)=>{const o=new MessageChannel;o.port1.onmessage=n=>{if(!n||!n.data)return o.port1.close(),o.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let c;try{c=JSON.parse(n.data)}catch(h){return o.port1.close(),o.port2.close(),this._prepareError(h),r(h)}c.error?r(c.error):c.result!==void 0?s(c.result):s(void 0),o.port1.close(),o.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,"*",[o.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&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(r===void 0)return;r.then((o={})=>{let a,n;typeof o=="object"&&o!==null&&(a=o.error,n=o.result),a?t.postMessage(JSON.stringify({error:a})):n!==void 0?t.postMessage(JSON.stringify({result:n})):t.postMessage(JSON.stringify({result:o}))},o=>{t.postMessage(JSON.stringify({error:this._prepareError(o)}))})}catch(s){t.postMessage(JSON.stringify({error:this._prepareError(s)}))}}_prepareError(e){if(typeof e=="string"){const t=this._side+": "+e;return console.error(t),t}return e.message=this._side+": "+e.message,console.error(e),e.message}}const D=".",T={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},G=async(i,e)=>{if(typeof i!="string")throw new Error('Configurator ID is not a string type: "'+typeof i+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",s=e.overrideTenant||9,r=t+"/configurators/"+i,o="roomle_portal_v2",a="03-"+window.btoa(new Date().toISOString()+";anonymous;"+o),n=()=>{const d={apiKey:o,currentTenant:s,locale:"en",language:"en",device:1,token:a,platform:"web"};return new Headers(d)},c=new Request(r,{method:"GET",headers:n(),mode:"cors",cache:"default"}),h=await fetch(c),{configurator:u}=await h.json();return u},Q=()=>{try{return window.self!==window.top}catch{return!0}},K=["127.0.0.1","localhost","0.0.0.0"],Z=()=>{const i=Q();let e=window.location.href;if(i){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},ee=i=>!!(K.includes(i)||i.endsWith("roomle.com")||i.endsWith("gitlab.io")||i.endsWith("gitlab.com")),A=["language","browserLanguage","userLanguage","systemLanguage"],te=(i=null)=>{const e=window.navigator;if(i)return i.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,s=A.length;t<s;t++){const r=e[A[t]];if(r)return r.substr(0,2)}return"en"},ie=(i,e)=>{const t=JSON.parse(JSON.stringify(i));return E(t,e)},E=(i,e)=>{for(const t in e)try{e[t].constructor===Object?i[t]=E(i[t],e[t]):i[t]=e[t]}catch{i[t]=e[t]}return i};var se={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const re={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0},rotationSnapDegrees:10},ne="(idle)",oe=i=>(I(i),i!=null&&i.customApiUrl&&(i.customApiUrl=decodeURIComponent(i.customApiUrl)),i.shareUrl&&(i.deeplink=i.shareUrl.replace(ce,he)),i),I=i=>{if(!i)return;const e=Object.keys(i);for(const t of e){const s=i[t];if(!Array.isArray(s)&&typeof s=="object"&&s!==null&&I(s),Array.isArray(s))for(const r of s)I(r);(s==="true"||s==="false")&&(i[t]=s==="true")}},ae=(i,e)=>{e.configuratorId=i.id;const t=i.settings||{};return!e.overrideTenant&&i.tenant&&(e.overrideTenant=i.tenant),ie(t,e)},le=()=>{const i={...re};i.locale||(i.locale=te()),i.id===ne&&delete i.id;const e=Z();return e&&ee(e)&&(i.configuratorId="demoConfigurator"),i.customApiUrl=se.VITE_RAPI_URL,i.emails=!1,i},ce="<CONF_ID>",he="#CONFIGURATIONID#",F=()=>/(android)/i.test(navigator.userAgent),k=(i,e,t)=>{let s=null;Object.defineProperty(i,e,{get(){return s||t},set(r){r!=null&&r.mute?s=r.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),s=r)}})},U=()=>window.innerHeight*.01+"px",$=i=>{i&&setTimeout(()=>i.style.setProperty(x,U()),0)},H="rml-styles",ue=450,x="--rml-full-height",m={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},O=new Map;class de{constructor(e,t,s,r,o){if(l(this,"ui",{callbacks:null}),l(this,"extended",{callbacks:null}),l(this,"configurator",{callbacks:null}),l(this,"analytics",{callbacks:{}}),l(this,"global",{callbacks:{}}),l(this,"plugins",{}),l(this,"_waitForIframe"),l(this,"_container"),l(this,"_messageHandler"),l(this,"_configuratorSettings"),l(this,"_initData",{}),l(this,"_iframe"),l(this,"pluginsLoaded",[]),!e||typeof e.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(O.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(H)){const n=s.zIndex||9999999,c=document.createElement("style");c.type="text/css",c.id=H;const h="transition:all ease-in-out "+ue+"ms;",u=["-webkit-","-o-"].reduce((g,f)=>g+=f+h,"")+h,d=U();c.innerHTML=`
1
+ (function(_,y){typeof exports=="object"&&typeof module<"u"?module.exports=y():typeof define=="function"&&define.amd?define(y):(_=typeof globalThis<"u"?globalThis:_||self,_["roomle-embedding-lib"]=_["roomle-embedding-lib"]||{},_["roomle-embedding-lib"].umd=_["roomle-embedding-lib"].umd||{},_["roomle-embedding-lib"].umd.min=_["roomle-embedding-lib"].umd.min||{},_["roomle-embedding-lib"].umd.min.js=y())})(this,function(){"use strict";var _=Object.defineProperty,y=(i,e,t)=>e in i?_(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,l=(i,e,t)=>y(i,typeof e!="symbol"?e+"":e,t);class q{constructor(e,t,s,r){l(this,"_side"),l(this,"_incomingMessageBus"),l(this,"_outgoingMessageBus",null),l(this,"_execMessage",null),this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,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)=>{const o=new MessageChannel;o.port1.onmessage=n=>{if(!n||!n.data)return o.port1.close(),o.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let c;try{c=JSON.parse(n.data)}catch(h){return o.port1.close(),o.port2.close(),this._prepareError(h),r(h)}c.error?r(c.error):c.result!==void 0?s(c.result):s(void 0),o.port1.close(),o.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,"*",[o.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&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(r===void 0)return;r.then((o={})=>{let a,n;typeof o=="object"&&o!==null&&(a=o.error,n=o.result),a?t.postMessage(JSON.stringify({error:a})):n!==void 0?t.postMessage(JSON.stringify({result:n})):t.postMessage(JSON.stringify({result:o}))},o=>{t.postMessage(JSON.stringify({error:this._prepareError(o)}))})}catch(s){t.postMessage(JSON.stringify({error:this._prepareError(s)}))}}_prepareError(e){if(typeof e=="string"){const t=this._side+": "+e;return console.error(t),t}return e.message=this._side+": "+e.message,console.error(e),e.message}}const D=".",T={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},G=async(i,e)=>{if(typeof i!="string")throw new Error('Configurator ID is not a string type: "'+typeof i+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",s=e.overrideTenant||9,r=t+"/configurators/"+i,o="roomle_portal_v2",a="03-"+window.btoa(new Date().toISOString()+";anonymous;"+o),n=()=>{const d={apiKey:o,currentTenant:s,locale:"en",language:"en",device:1,token:a,platform:"web"};return new Headers(d)},c=new Request(r,{method:"GET",headers:n(),mode:"cors",cache:"default"}),h=await fetch(c),{configurator:u}=await h.json();return u},Q=()=>{try{return window.self!==window.top}catch{return!0}},K=["127.0.0.1","localhost","0.0.0.0"],Z=()=>{const i=Q();let e=window.location.href;if(i){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},ee=i=>!!(K.includes(i)||i.endsWith("roomle.com")||i.endsWith("gitlab.io")||i.endsWith("gitlab.com")),C=["language","browserLanguage","userLanguage","systemLanguage"],te=(i=null)=>{const e=window.navigator;if(i)return i.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,s=C.length;t<s;t++){const r=e[C[t]];if(r)return r.substr(0,2)}return"en"},ie=(i,e)=>{const t=JSON.parse(JSON.stringify(i));return E(t,e)},E=(i,e)=>{for(const t in e)try{e[t].constructor===Object?i[t]=E(i[t],e[t]):i[t]=e[t]}catch{i[t]=e[t]}return i};var se={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const re={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1},rotationSnapDegrees:10},ne="(idle)",oe=i=>(I(i),i!=null&&i.customApiUrl&&(i.customApiUrl=decodeURIComponent(i.customApiUrl)),i.shareUrl&&(i.deeplink=i.shareUrl.replace(ce,he)),i),I=i=>{if(!i)return;const e=Object.keys(i);for(const t of e){const s=i[t];if(!Array.isArray(s)&&typeof s=="object"&&s!==null&&I(s),Array.isArray(s))for(const r of s)I(r);(s==="true"||s==="false")&&(i[t]=s==="true")}},ae=(i,e)=>{e.configuratorId=i.id;const t=i.settings||{};return!e.overrideTenant&&i.tenant&&(e.overrideTenant=i.tenant),ie(t,e)},le=()=>{const i={...re};i.locale||(i.locale=te()),i.id===ne&&delete i.id;const e=Z();return e&&ee(e)&&(i.configuratorId="demoConfigurator"),i.customApiUrl=se.VITE_RAPI_URL,i.emails=!1,i},ce="<CONF_ID>",he="#CONFIGURATIONID#",F=()=>/(android)/i.test(navigator.userAgent),k=(i,e,t)=>{let s=null;Object.defineProperty(i,e,{get(){return s||t},set(r){r!=null&&r.mute?s=r.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),s=r)}})},U=()=>window.innerHeight*.01+"px",$=i=>{i&&setTimeout(()=>i.style.setProperty(x,U()),0)},H="rml-styles",ue=450,x="--rml-full-height",m={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},O=new Map;class de{constructor(e,t,s,r,o){if(l(this,"ui",{callbacks:null}),l(this,"extended",{callbacks:null}),l(this,"configurator",{callbacks:null}),l(this,"analytics",{callbacks:{}}),l(this,"global",{callbacks:{}}),l(this,"plugins",{}),l(this,"_waitForIframe"),l(this,"_container"),l(this,"_messageHandler"),l(this,"_configuratorSettings"),l(this,"_initData",{}),l(this,"_iframe"),l(this,"pluginsLoaded",[]),!e||typeof e.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(O.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(H)){const n=s.zIndex||9999999,c=document.createElement("style");c.type="text/css",c.id=H;const h="transition:all ease-in-out "+ue+"ms;",u=["-webkit-","-o-"].reduce((g,f)=>g+=f+h,"")+h,d=U();c.innerHTML=`
2
2
  .${m.CONTAINER}{${x}:${d};}
3
3
  .${m.POSITION}{position:fixed;top:0;left:0;z-index:${n};opacity:0}
4
4
  .${m.TRANSITION}{${u}}
5
5
  .${m.FILL}{width:100%;height:100%;opacity:1}
6
6
  .${m.ANDROID_HEIGHT}{height:calc(var(${x},1vh)*100)}
7
7
  .${m.OVERFLOW_HIDDEN}{overflow:hidden}
8
- `,document.head.appendChild(c)}this._onResize=this._onResize.bind(this),F()&&window.addEventListener("resize",this._onResize),this._container=t,this._initData=s,this._configuratorSettings=e;const a=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._executeMessage=this._executeMessage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._messageHandler=new q("website",window,null,this._executeMessage),this._waitForIframe=o,this._container.appendChild(a),this._iframe=a;for(const n of r)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((c,h)=>{try{Promise.resolve().then(()=>ye).then(({DragIn:u})=>{const d=new u(this._iframe);d.setInstance(this.ui),this.plugins.dragIn=d,c()})}catch(u){h(u)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((c,h)=>{try{n.loader().then(u=>{const d=new u(this._iframe);d.setInstance(this.ui),this.plugins[n.name]=d,c()})}catch(u){h(u)}}));O.set(t,!0)}static createPlanner(e,t,s,r=[]){return this._create(e,t,s,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 async _create(e,t,s,r){return new Promise(async(o,a)=>{try{const n=E(le(),oe(s));n.featureFlags||(n.featureFlags={}),typeof n.featureFlags.realPartList!="boolean"&&(n.featureFlags.realPartList=!0),typeof n.featureFlags.globalCallbacks!="boolean"&&(n.featureFlags.globalCallbacks=!0),typeof n.featureFlags.mocAr!="boolean"&&(n.featureFlags.mocAr=!1);const c=await G(e,n);s=ae(c,n);const h=new this(c,t,s,r,o);return console.info(h),await Promise.allSettled(h.pluginsLoaded),h}catch(n){return a(n)}})}teardown(){this._container&&O.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){var e;const t=document.createElement("iframe");let s=((e=this._configuratorSettings)==null?void 0:e.url)||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(s=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(s=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(s=this._initData.overrideServerUrl),t.src=s,t.classList.add(m.CONTAINER),t.classList.add(m.FILL),t}_onResize(){$(this._iframe)}_onUseFullPage(){this._iframe.classList.add(m.POSITION),document.documentElement.classList.add(m.OVERFLOW_HIDDEN),window.document.body.classList.add(m.OVERFLOW_HIDDEN),F()&&($(this._iframe),this._iframe.classList.add(m.ANDROID_HEIGHT))}_onBackToWebsite(){this._iframe.classList.remove(m.POSITION),this._iframe.classList.remove(m.ANDROID_HEIGHT),document.documentElement.classList.remove(m.OVERFLOW_HIDDEN),window.document.body.classList.remove(m.OVERFLOW_HIDDEN)}_executeMessage({message:e,args:t},s){var r;if(!s.source||s.source!==((r=this._iframe)==null?void 0:r.contentWindow))return;if(e===T.REQUEST_BOOT)return this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData});if(e===T.SETUP){const{methods:h,callbacks:u}=t[0];return h.forEach(d=>{const g=d.split(D),f=g[0],p=g[1];this[f]||(this[f]={}),this[f][p]=function(){return this._messageHandler.sendMessage(d,[...arguments])}.bind(this)}),u.forEach(d=>{const g=d.split(D),f=g[0],p=g[1],ve=g[2];this[f]||(this[f]={}),this[f][p]||(this[f][p]={}),this[f][p][ve]=()=>{}}),k(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),k(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>this._messageHandler.sendMessage(T.WEBSITE_READY),0),Promise.resolve({result:null})}const o=e.split(D),a=o[0],n=o[1],c=o.length===3?o[2]:null;if(c&&this[a][n][c]){const h=this[a][n][c](...t);return h instanceof Promise?h.then(u=>({result:u})):h!==void 0?Promise.resolve({result:h}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}}class ge{constructor(e=16){l(this,"_computedStyleCache",new Map),l(this,"_maxLifetime",16),l(this,"_cacheCleanInterval",null),this._maxLifetime=e}get(e){const t=this._computedStyleCache.get(e),s=Date.now();if(t&&s-t.updated<this._maxLifetime)return t.style;const r=getComputedStyle(e);return this._computedStyleCache.set(e,{style:r,updated:s}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(this._maxLifetime*1e3,5e3))),r}_cleanUpCache(){const e=Date.now();for(const[t,{updated:s}]of this._computedStyleCache.entries())e-s>=this._maxLifetime&&this._computedStyleCache.delete(t);this._computedStyleCache.size===0&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const B=i=>window.TouchEvent&&i instanceof window.TouchEvent;let S;const v=i=>(S||(S=new ge),S.get(i)),W=(i,e,t)=>{const s=parseFloat(i),r=window.devicePixelRatio||1;if(e==="px")return s;if(e==="%"){const a=t===document.documentElement?window.innerWidth:t.offsetWidth;return s/100*a}if(e==="rem"){const a=parseFloat(v(document.documentElement).fontSize);return s*a}if(e==="em"){const a=parseFloat(v(t).fontSize);return s*a}if(e==="vh"||e==="vw"||e==="vmin"||e==="vmax"){const a={vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)};return s/100*a[e]}const o={cm:37.7952755906,mm:3.77952755906,in:96};return e in o?s*o[e]*r:(console.warn("Unable to determine coordinates for drag-in. Therefore drag-in is not possible. Check the CSS that positions the iframe of Roomle"),0)},z=(i,e,t={x:0,y:0})=>{const s=i.getBoundingClientRect(),r=v(i).transform;let o=0,a=0;if(r!=="none"){const d=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,g=r.match(d);g&&(o=W(g[1],g[2],i),a=W(g[3],g[4],i))}const{clientX:n,clientY:c}=L(e,t),h=n-s.left-o+i.scrollLeft,u=c-s.top-a+i.scrollTop;return{x:h,y:u}},L=(i,e)=>{const{clientX:t,clientY:s}=B(i)?me(i):i,r=t||e.x,o=s||e.y;return{clientX:r,clientY:o}},me=i=>{if(i.touches.length){let{clientX:t,clientY:s}=i.touches[0];if(i.touches.length>1){const r=i.touches[1],o=r.clientX,a=r.clientY;t=(t+o)/2,s=(s+a)/2}return{clientX:t,clientY:s}}const e=i.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},Y=500,j=10;class fe{constructor(e,{onTouchDragStart:t},s={}){l(this,"_touchDragTimeOut"),l(this,"_onTouchDragStart"),l(this,"_payload",null),l(this,"_delay",Y),l(this,"_firstTouch",null),l(this,"_lastTouch",null),l(this,"_epsilon",j),this._payload=e,this._onTouchDragStart=t,this._delay=s.delay||Y,this._epsilon=s.epsilon||j}onTouchStart(e){var t;!e||!((t=e?.touches)!=null&&t.length)||this._touchDragTimeOut||(this._firstTouch=e.touches[e.touches.length-1],this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=e.touches[0]),this._checkXDistance(e)()},this._delay))}onTouchEnd(){this._resetTouches()}onTouchMove(e){var t;!e||!((t=e?.touches)!=null&&t.length)||(this._lastTouch=e.touches[0])}_clearTimeout(){this._touchDragTimeOut&&(clearTimeout(this._touchDragTimeOut),this._touchDragTimeOut=null)}_resetTouches(){this._clearTimeout(),this._lastTouch=null,this._firstTouch=null,this._payload=null}_checkXDistance(e){return()=>{if(!this._firstTouch||!this._lastTouch)return;let t=!1;t=Math.abs(this._firstTouch.clientX-this._lastTouch.clientX)<this._epsilon,t&&(this._onTouchDragStart(this._payload,e),this._resetTouches())}}}const X="rml-drag-in-styles",_e="rml-drag-in-drag-element",w="rml-drag-in-overlay",b="rml-drag-in-drag-ghost",M="rml-drag-in-fade-in",J="rml-drag-in-fade-out",N={DISPLAY_NONE:"rml-display-none"},V=.5,P="250ms",R="forwards",C=i=>i?!0:(console.warn("No instance set, cancel drag-in"),!1);class pe{constructor(e){l(this,"_iframe"),l(this,"_currentDrag",{}),l(this,"_currentTouch",null),l(this,"_firefoxDragPosition",{x:0,y:0}),l(this,"_instance",null),l(this,"options",{}),l(this,"_firefoxFallback",t=>{if(!this._currentDrag.event)return;const s=t||window.event;this._firefoxDragPosition.x=s.pageX||0,this._firefoxDragPosition.y=s.pageY||0}),this._iframe=e,this._injectStyles(),this._initializeDragGhost(),this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback)}_injectStyles(){if(!document.getElementById(X)){const e=document.createElement("style");e.type="text/css",e.id=X,e.innerHTML=`
8
+ `,document.head.appendChild(c)}this._onResize=this._onResize.bind(this),F()&&window.addEventListener("resize",this._onResize),this._container=t,this._initData=s,this._configuratorSettings=e;const a=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._executeMessage=this._executeMessage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._messageHandler=new q("website",window,null,this._executeMessage),this._waitForIframe=o,this._container.appendChild(a),this._iframe=a;for(const n of r)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((c,h)=>{try{Promise.resolve().then(()=>ye).then(({DragIn:u})=>{const d=new u(this._iframe);d.setInstance(this.ui),this.plugins.dragIn=d,c()})}catch(u){h(u)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((c,h)=>{try{n.loader().then(u=>{const d=new u(this._iframe);d.setInstance(this.ui),this.plugins[n.name]=d,c()})}catch(u){h(u)}}));O.set(t,!0)}static createPlanner(e,t,s,r=[]){return this._create(e,t,s,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 async _create(e,t,s,r){return new Promise(async(o,a)=>{try{const n=E(le(),oe(s));n.featureFlags||(n.featureFlags={}),typeof n.featureFlags.realPartList!="boolean"&&(n.featureFlags.realPartList=!0),typeof n.featureFlags.globalCallbacks!="boolean"&&(n.featureFlags.globalCallbacks=!0),typeof n.featureFlags.mocAr!="boolean"&&(n.featureFlags.mocAr=!1);const c=await G(e,n);s=ae(c,n);const h=new this(c,t,s,r,o);return console.info(h),await Promise.allSettled(h.pluginsLoaded),h}catch(n){return a(n)}})}teardown(){this._container&&O.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){var e;const t=document.createElement("iframe");let s=((e=this._configuratorSettings)==null?void 0:e.url)||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(s=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(s=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(s=this._initData.overrideServerUrl),t.src=s,t.classList.add(m.CONTAINER),t.classList.add(m.FILL),t}_onResize(){$(this._iframe)}_onUseFullPage(){this._iframe.classList.add(m.POSITION),document.documentElement.classList.add(m.OVERFLOW_HIDDEN),window.document.body.classList.add(m.OVERFLOW_HIDDEN),F()&&($(this._iframe),this._iframe.classList.add(m.ANDROID_HEIGHT))}_onBackToWebsite(){this._iframe.classList.remove(m.POSITION),this._iframe.classList.remove(m.ANDROID_HEIGHT),document.documentElement.classList.remove(m.OVERFLOW_HIDDEN),window.document.body.classList.remove(m.OVERFLOW_HIDDEN)}_executeMessage({message:e,args:t},s){var r;if(!s.source||s.source!==((r=this._iframe)==null?void 0:r.contentWindow))return;if(e===T.REQUEST_BOOT)return this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData});if(e===T.SETUP){const{methods:h,callbacks:u}=t[0];return h.forEach(d=>{const g=d.split(D),f=g[0],p=g[1];this[f]||(this[f]={}),this[f][p]=function(){return this._messageHandler.sendMessage(d,[...arguments])}.bind(this)}),u.forEach(d=>{const g=d.split(D),f=g[0],p=g[1],ve=g[2];this[f]||(this[f]={}),this[f][p]||(this[f][p]={}),this[f][p][ve]=()=>{}}),k(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),k(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>this._messageHandler.sendMessage(T.WEBSITE_READY),0),Promise.resolve({result:null})}const o=e.split(D),a=o[0],n=o[1],c=o.length===3?o[2]:null;if(c&&this[a][n][c]){const h=this[a][n][c](...t);return h instanceof Promise?h.then(u=>({result:u})):h!==void 0?Promise.resolve({result:h}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}}class ge{constructor(e=16){l(this,"_computedStyleCache",new Map),l(this,"_maxLifetime",16),l(this,"_cacheCleanInterval",null),this._maxLifetime=e}get(e){const t=this._computedStyleCache.get(e),s=Date.now();if(t&&s-t.updated<this._maxLifetime)return t.style;const r=getComputedStyle(e);return this._computedStyleCache.set(e,{style:r,updated:s}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(this._maxLifetime*1e3,5e3))),r}_cleanUpCache(){const e=Date.now();for(const[t,{updated:s}]of this._computedStyleCache.entries())e-s>=this._maxLifetime&&this._computedStyleCache.delete(t);this._computedStyleCache.size===0&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const B=i=>window.TouchEvent&&i instanceof window.TouchEvent;let S;const v=i=>(S||(S=new ge),S.get(i)),W=(i,e,t)=>{const s=parseFloat(i),r=window.devicePixelRatio||1;if(e==="px")return s;if(e==="%"){const a=t===document.documentElement?window.innerWidth:t.offsetWidth;return s/100*a}if(e==="rem"){const a=parseFloat(v(document.documentElement).fontSize);return s*a}if(e==="em"){const a=parseFloat(v(t).fontSize);return s*a}if(e==="vh"||e==="vw"||e==="vmin"||e==="vmax"){const a={vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)};return s/100*a[e]}const o={cm:37.7952755906,mm:3.77952755906,in:96};return e in o?s*o[e]*r:(console.warn("Unable to determine coordinates for drag-in. Therefore drag-in is not possible. Check the CSS that positions the iframe of Roomle"),0)},z=(i,e,t={x:0,y:0})=>{const s=i.getBoundingClientRect(),r=v(i).transform;let o=0,a=0;if(r!=="none"){const d=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,g=r.match(d);g&&(o=W(g[1],g[2],i),a=W(g[3],g[4],i))}const{clientX:n,clientY:c}=L(e,t),h=n-s.left-o+i.scrollLeft,u=c-s.top-a+i.scrollTop;return{x:h,y:u}},L=(i,e)=>{const{clientX:t,clientY:s}=B(i)?me(i):i,r=t||e.x,o=s||e.y;return{clientX:r,clientY:o}},me=i=>{if(i.touches.length){let{clientX:t,clientY:s}=i.touches[0];if(i.touches.length>1){const r=i.touches[1],o=r.clientX,a=r.clientY;t=(t+o)/2,s=(s+a)/2}return{clientX:t,clientY:s}}const e=i.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},Y=500,j=10;class fe{constructor(e,{onTouchDragStart:t},s={}){l(this,"_touchDragTimeOut"),l(this,"_onTouchDragStart"),l(this,"_payload",null),l(this,"_delay",Y),l(this,"_firstTouch",null),l(this,"_lastTouch",null),l(this,"_epsilon",j),this._payload=e,this._onTouchDragStart=t,this._delay=s.delay||Y,this._epsilon=s.epsilon||j}onTouchStart(e){var t;!e||!((t=e?.touches)!=null&&t.length)||this._touchDragTimeOut||(this._firstTouch=e.touches[e.touches.length-1],this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=e.touches[0]),this._checkXDistance(e)()},this._delay))}onTouchEnd(){this._resetTouches()}onTouchMove(e){var t;!e||!((t=e?.touches)!=null&&t.length)||(this._lastTouch=e.touches[0])}_clearTimeout(){this._touchDragTimeOut&&(clearTimeout(this._touchDragTimeOut),this._touchDragTimeOut=null)}_resetTouches(){this._clearTimeout(),this._lastTouch=null,this._firstTouch=null,this._payload=null}_checkXDistance(e){return()=>{if(!this._firstTouch||!this._lastTouch)return;let t=!1;t=Math.abs(this._firstTouch.clientX-this._lastTouch.clientX)<this._epsilon,t&&(this._onTouchDragStart(this._payload,e),this._resetTouches())}}}const X="rml-drag-in-styles",_e="rml-drag-in-drag-element",w="rml-drag-in-overlay",b="rml-drag-in-drag-ghost",M="rml-drag-in-fade-in",J="rml-drag-in-fade-out",N={DISPLAY_NONE:"rml-display-none"},V=.5,P="250ms",R="forwards",A=i=>i?!0:(console.warn("No instance set, cancel drag-in"),!1);class pe{constructor(e){l(this,"_iframe"),l(this,"_currentDrag",{}),l(this,"_currentTouch",null),l(this,"_firefoxDragPosition",{x:0,y:0}),l(this,"_instance",null),l(this,"options",{}),l(this,"_firefoxFallback",t=>{if(!this._currentDrag.event)return;const s=t||window.event;this._firefoxDragPosition.x=s.pageX||0,this._firefoxDragPosition.y=s.pageY||0}),this._iframe=e,this._injectStyles(),this._initializeDragGhost(),this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback)}_injectStyles(){if(!document.getElementById(X)){const e=document.createElement("style");e.type="text/css",e.id=X,e.innerHTML=`
9
9
  .${N.DISPLAY_NONE}{display:none}
10
10
  .${w}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}
11
11
  .${b}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}
12
12
  @keyframes ${M} {from{opacity: 0;}to {opacity: ${V};}}
13
13
  @keyframes ${J} {from{opacity: ${V};}to {opacity: 0;}}
14
- `,document.head.appendChild(e)}}_initializeDragGhost(){const e=this._iframe.parentNode;let t=e.querySelector("."+b);t||(t=document.createElement("div"),t.classList.add(b),t.innerText=" ",e.appendChild(t))}setInstance(e){this._instance=e}dragStart(e,t,s="rml_id"){const r=this._iframe.parentNode;if(v(r).position!=="relative"){console.warn("Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly");return}this._iframe.style.pointerEvents="none";let o=r.querySelector("."+w);o||(o=document.createElement("div"),o.classList.add(w),r.appendChild(o)),o.classList.remove(N.DISPLAY_NONE),t.target.getAttribute("draggable")||console.warn(`Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`);const a=r.querySelector("."+b);this._currentDrag.event=t;const n=t.target.cloneNode();n.style.position="fixed",n.style.pointerEvents="none",n.style.opacity="0",n.style.animation=`${M} ${P} ${R}`,n.id=_e,n.style.zIndex="9999",document.body.appendChild(n),this._currentDrag.element=n;const c=t.target.getBoundingClientRect();this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:h,clientY:u}=L(t,this._firefoxDragPosition);this._currentDrag.offset.x=h-c.left,this._currentDrag.offset.y=u-c.top,n.style.top=u+"px",n.style.left=h+"px",t instanceof DragEvent&&t.dataTransfer&&t.dataTransfer.setDragImage&&t.dataTransfer.setDragImage(a,0,0);const{x:d,y:g}=z(r,this._currentDrag.event||t,this._firefoxDragPosition),f=Math.max(1,d),p=Math.max(1,g);C(this._instance)&&this._instance.dragInObject(e,f,p,s)}dragUpdate(e){var t,s;const r=this._iframe.parentNode,{x:o,y:a}=z(r,e,this._firefoxDragPosition);if(o===0&&a===0)return;const n=Math.max(1,o),c=Math.max(1,a);if(this._currentDrag.element){const{clientX:h,clientY:u}=L(e,this._firefoxDragPosition),d=((t=this._currentDrag.offset)==null?void 0:t.x)||0,g=((s=this._currentDrag.offset)==null?void 0:s.y)||0;this._currentDrag.element.style.left=`${h-d}px`,this._currentDrag.element.style.top=`${u-g}px`;const f=(this.options.dragInOverlapX||0)+1,p=(this.options.dragInOverlapY||0)+1;n>f&&c>p?this._currentDrag.element.style.animation=`${J} ${P} ${R}`:this._currentDrag.element.style.animation=`${M} ${P} ${R}`}if(!(n===1&&c===1)&&C(this._instance)){let h=n,u=c;if(B(e)){const d=this.options.fingerSize||0;h=Math.max(2,n+d),u=Math.max(2,c-d)}this._instance.updateDrag(h,u)}}dragEnd(){this._iframe.style.pointerEvents="all";const e=this._iframe.parentNode;C(this._instance)&&this._instance.dragInObjectEnd(),this._currentDrag.element&&document.body.removeChild(this._currentDrag.element),this._currentDrag={},this._firefoxDragPosition={x:0,y:0};const t=e.querySelector("."+w);t&&t.classList.add(N.DISPLAY_NONE)}touchStart(e,t,s="rml_id"){var r,o;t.preventDefault();const a=(c,h)=>{this.dragStart(e,h,s)},n={};typeof((r=this.options)==null?void 0:r.touchDragDelay)=="number"&&(n.delay=this.options.touchDragDelay),(o=this.options)!=null&&o.touchDragEpsilon&&(n.epsilon=this.options.touchDragEpsilon),this._currentTouch=new fe(void 0,{onTouchDragStart:a},n),this._currentTouch.onTouchStart(t)}touchMove(e){this._currentTouch&&this._currentTouch.onTouchMove(e),this._currentDrag.event&&this.dragUpdate(e)}touchEnd(){this._currentTouch&&this._currentTouch.onTouchEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}}const ye=Object.freeze(Object.defineProperty({__proto__:null,DragIn:pe},Symbol.toStringTag,{value:"Module"}));return de});
14
+ `,document.head.appendChild(e)}}_initializeDragGhost(){const e=this._iframe.parentNode;let t=e.querySelector("."+b);t||(t=document.createElement("div"),t.classList.add(b),t.innerText=" ",e.appendChild(t))}setInstance(e){this._instance=e}dragStart(e,t,s="rml_id"){const r=this._iframe.parentNode;if(v(r).position!=="relative"){console.warn("Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly");return}this._iframe.style.pointerEvents="none";let o=r.querySelector("."+w);o||(o=document.createElement("div"),o.classList.add(w),r.appendChild(o)),o.classList.remove(N.DISPLAY_NONE),t.target.getAttribute("draggable")||console.warn(`Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`);const a=r.querySelector("."+b);this._currentDrag.event=t;const n=t.target.cloneNode();n.style.position="fixed",n.style.pointerEvents="none",n.style.opacity="0",n.style.animation=`${M} ${P} ${R}`,n.id=_e,n.style.zIndex="9999",document.body.appendChild(n),this._currentDrag.element=n;const c=t.target.getBoundingClientRect();this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:h,clientY:u}=L(t,this._firefoxDragPosition);this._currentDrag.offset.x=h-c.left,this._currentDrag.offset.y=u-c.top,n.style.top=u+"px",n.style.left=h+"px",t instanceof DragEvent&&t.dataTransfer&&t.dataTransfer.setDragImage&&t.dataTransfer.setDragImage(a,0,0);const{x:d,y:g}=z(r,this._currentDrag.event||t,this._firefoxDragPosition),f=Math.max(1,d),p=Math.max(1,g);A(this._instance)&&this._instance.dragInObject(e,f,p,s)}dragUpdate(e){var t,s;const r=this._iframe.parentNode,{x:o,y:a}=z(r,e,this._firefoxDragPosition);if(o===0&&a===0)return;const n=Math.max(1,o),c=Math.max(1,a);if(this._currentDrag.element){const{clientX:h,clientY:u}=L(e,this._firefoxDragPosition),d=((t=this._currentDrag.offset)==null?void 0:t.x)||0,g=((s=this._currentDrag.offset)==null?void 0:s.y)||0;this._currentDrag.element.style.left=`${h-d}px`,this._currentDrag.element.style.top=`${u-g}px`;const f=(this.options.dragInOverlapX||0)+1,p=(this.options.dragInOverlapY||0)+1;n>f&&c>p?this._currentDrag.element.style.animation=`${J} ${P} ${R}`:this._currentDrag.element.style.animation=`${M} ${P} ${R}`}if(!(n===1&&c===1)&&A(this._instance)){let h=n,u=c;if(B(e)){const d=this.options.fingerSize||0;h=Math.max(2,n+d),u=Math.max(2,c-d)}this._instance.updateDrag(h,u)}}dragEnd(){this._iframe.style.pointerEvents="all";const e=this._iframe.parentNode;A(this._instance)&&this._instance.dragInObjectEnd(),this._currentDrag.element&&document.body.removeChild(this._currentDrag.element),this._currentDrag={},this._firefoxDragPosition={x:0,y:0};const t=e.querySelector("."+w);t&&t.classList.add(N.DISPLAY_NONE)}touchStart(e,t,s="rml_id"){var r,o;t.preventDefault();const a=(c,h)=>{this.dragStart(e,h,s)},n={};typeof((r=this.options)==null?void 0:r.touchDragDelay)=="number"&&(n.delay=this.options.touchDragDelay),(o=this.options)!=null&&o.touchDragEpsilon&&(n.epsilon=this.options.touchDragEpsilon),this._currentTouch=new fe(void 0,{onTouchDragStart:a},n),this._currentTouch.onTouchStart(t)}touchMove(e){this._currentTouch&&this._currentTouch.onTouchMove(e),this._currentDrag.event&&this.dragUpdate(e)}touchEnd(){this._currentTouch&&this._currentTouch.onTouchEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}}const ye=Object.freeze(Object.defineProperty({__proto__:null,DragIn:pe},Symbol.toStringTag,{value:"Module"}));return de});