@roomle/embedding-lib 5.25.0-alpha.1 → 5.25.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,32 +1,7 @@
1
- ## [5.25.0-alpha.1](https://github.com/roomle-dev/roomle-ui/compare/embedding-lib-v5.24.0...embedding-lib-v5.25.0-alpha.1) (2025-07-22)
1
+ ## [5.25.0-alpha.2](https://github.com/roomle-dev/roomle-ui/compare/embedding-lib-v5.25.0-alpha.1...embedding-lib-v5.25.0-alpha.2) (2025-07-23)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
- * collection of light sources in component ([39d0c6d](https://github.com/roomle-dev/roomle-ui/commit/39d0c6d4457c7e36a6ab24146d4b6b2381145a7c))
7
- * COLOR parameter type ([5b5a656](https://github.com/roomle-dev/roomle-ui/commit/5b5a6564faa9a1cddb556979f2f6ac3f42066b7b))
8
- * component area light ([6ca94ab](https://github.com/roomle-dev/roomle-ui/commit/6ca94ab66f30d793b7a3e37be912388ac611e355))
9
- * component point light ([2d8ed76](https://github.com/roomle-dev/roomle-ui/commit/2d8ed76db76a313263df448934e55c278f4cc878))
10
- * core api - Editor3dChangedLightSource ([f83bb0c](https://github.com/roomle-dev/roomle-ui/commit/f83bb0ccb12dd5acc27d095743b21a5900958299))
11
- * core api - Editor3dChangedLightSource ([3cc6a47](https://github.com/roomle-dev/roomle-ui/commit/3cc6a47daa49626d3f22f2612e3bfd1762d22c9b))
12
- * core upgrade to version 2.57.0-alpha.1 ([7894089](https://github.com/roomle-dev/roomle-ui/commit/7894089e552d63d700deb44791d31bdcb1ea3772))
13
- * core upgrade to version 2.57.0-alpha.2 ([8ef08a9](https://github.com/roomle-dev/roomle-ui/commit/8ef08a90dda72f5d30d445badd97f4a77e2c27c1))
14
- * core upgrade to version 2.57.0-alpha.3 ([f6f1459](https://github.com/roomle-dev/roomle-ui/commit/f6f14594242c9c0d6a28bf27a0f7dfe1e3fa9583))
15
- * drag insert object animation ([180b17b](https://github.com/roomle-dev/roomle-ui/commit/180b17b640ae40a0c64f4ccb1815f576bd210b77))
16
- * migration of the light source implementation from innovation day ([c9b554b](https://github.com/roomle-dev/roomle-ui/commit/c9b554bc7cfa929affdb5f065237aa71a6b0813a))
17
- * update light source attributes ([b4f080c](https://github.com/roomle-dev/roomle-ui/commit/b4f080c059acfb21cedaf6e770b4301887770ad5))
18
- * **SDK:** upgrade to version 2.105.0 ([#1758](https://github.com/roomle-dev/roomle-ui/issues/1758)) ([d259718](https://github.com/roomle-dev/roomle-ui/commit/d2597182081e18dccaba8c8309c6ac371b317e1b))
19
- * **core:** upgrade to version 2.57.0-alpha.4 ([55d0d2e](https://github.com/roomle-dev/roomle-ui/commit/55d0d2edab851fe2da418907663ecf347272201b))
20
- * **core:** upgrade to version 2.57.0-alpha.5 ([7729b50](https://github.com/roomle-dev/roomle-ui/commit/7729b50ad6ebcb8265dd6f66f005206acb2b457c))
21
- * **core:** upgrade to version 2.57.0-alpha.5 ([b5f4127](https://github.com/roomle-dev/roomle-ui/commit/b5f412743d68be2640ecfebdeba27bbc4ecdd18b))
22
-
23
-
24
- ### Bug Fixes
25
-
26
- * await mock setup for threejs utils ([4582f37](https://github.com/roomle-dev/roomle-ui/commit/4582f3762e1f2f606bac52fff901d7593ce032ae))
27
- * Build workers in sdk folder when running npm run dev ([8f717d6](https://github.com/roomle-dev/roomle-ui/commit/8f717d6b6fd01bac863873f8f2f9001ce55c8603))
28
- * lamp light intensity ([da960a0](https://github.com/roomle-dev/roomle-ui/commit/da960a0dbb8a6d0272a3172aff839d0e32ee7a20))
29
- * parse font json instead of loading it from url ([940e57e](https://github.com/roomle-dev/roomle-ui/commit/940e57e2ca86b73131de7578f4433065c40c81fc))
30
- * remove duplicate member (resolve merge conflict) ([4973406](https://github.com/roomle-dev/roomle-ui/commit/4973406c472f2572b9292cef13956ba267d64317))
31
- * remove tween object after completing or stopping the animation ([5e87d17](https://github.com/roomle-dev/roomle-ui/commit/5e87d17d26a9635ee60818fec67c26d0be2e68f9))
32
- * use import for tween.js instead of script loader ([c248fc3](https://github.com/roomle-dev/roomle-ui/commit/c248fc34c293f130cdd9b19d382c46eb66765b43))
6
+ * cancel dragin on esc ([cb73cfa](https://github.com/roomle-dev/roomle-ui/commit/cb73cfa13bf25a7a95833d66bb5193e24273b01c))
7
+ * **core:** upgrade to version 2.57.0-alpha.6 ([c82dd49](https://github.com/roomle-dev/roomle-ui/commit/c82dd49d34db1baede3314a569cdcafe8408651f))
@@ -45,7 +45,7 @@ class G extends I {
45
45
  async init() {
46
46
  if (await super.init(), this._mode === "website")
47
47
  try {
48
- const { DragInFromWebsiteStrategy: t } = await import("./from-website-B3kPg18n.mjs");
48
+ const { DragInFromWebsiteStrategy: t } = await import("./from-website-BAX9bdN9.mjs");
49
49
  this._strategy = new t(
50
50
  this._instance,
51
51
  this._mainDomElement,
@@ -56,9 +56,10 @@ class G extends I {
56
56
  }
57
57
  else if (this._mode === "custom-view")
58
58
  try {
59
- const { DragInFromCustomViewStrategy: t } = await import("./from-custom-view-BcXfK7VI.mjs");
59
+ const { DragInFromCustomViewStrategy: t } = await import("./from-custom-view-V503ai3X.mjs");
60
60
  this._strategy = new t(
61
61
  this._instance,
62
+ this._mainDomElement,
62
63
  this.options,
63
64
  this._viewName
64
65
  );
@@ -1 +1 @@
1
- var t=Object.defineProperty,e=(e,s,a)=>((e,s,a)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[s]=a)(e,"symbol"!=typeof s?s+"":s,a);class s{constructor(t,s,a,i){e(this,"_mainDomElement"),e(this,"_instance"),e(this,"_mode","website"),e(this,"_viewName","main"),this._instance=t,this._mainDomElement=s,this._mode=a,this._viewName=i}async init(){return Promise.resolve()}}const a="rml-drag-in-styles",i="rml-drag-in-drag-element",r="rml-drag-in-overlay",n="rml-drag-in-drag-ghost",o="rml-drag-in-fade-in",d="rml-drag-in-fade-out",m={DISPLAY_NONE:"rml-display-none"},g="250ms",l="forwards",c=`@keyframes ${o} {from{opacity: 0;}to {opacity: 0.5;}}`,h=`@keyframes ${d} {from{opacity: 0.5;}to {opacity: 0;}}`,u=`${o} ${g} ${l}`,p=`${d} ${g} ${l}`,_="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",y=112,b=112,f=Object.freeze(Object.defineProperty({__proto__:null,DragIn:class extends s{constructor(t,s,a,i){super(t,s,a,i),e(this,"options",{}),e(this,"_customDragSignal",new AbortController),this._mainDomElement=s,this._injectStyles(),this._initializeDragGhost()}_injectStyles(){if(!document.getElementById(a)){const t=document.createElement("style");t.type="text/css",t.id=a,t.innerHTML=`\n .${m.DISPLAY_NONE}{display:none}\n .${r}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${n}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${c}\n ${h}\n `,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+n);e||(e=document.createElement("div"),e.classList.add(n),e.innerText=" ",t.appendChild(e))}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await import("./from-website-DR93OSJD.mjs");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 import("./from-custom-view-DRAqJ-yY.mjs");this._strategy=new t(this._instance,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:a}){a&&this._strategy.beforeUpdateGhost(a);const i=this._customDragSignal.signal,r=e=>{"true"===e.target.getAttribute("data-rml-draggable")&&t(e)},n=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",r,{signal:i}),document.addEventListener("mouseup",n,{signal:i}),document.addEventListener("mousemove",o,{signal:i}),document.addEventListener("mouseleave",n,{signal:i}),document.addEventListener("touchstart",r,{signal:i}),document.addEventListener("touchend",n,{signal:i}),document.addEventListener("touchmove",o,{signal:i})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}},Symbol.toStringTag,{value:"Module"}));export{i as R,a,c as b,h as c,_ as d,y as e,b as f,u as g,p as h,r as i,m as j,n as k,f as l};
1
+ var t=Object.defineProperty,e=(e,s,a)=>((e,s,a)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[s]=a)(e,"symbol"!=typeof s?s+"":s,a);class s{constructor(t,s,a,i){e(this,"_mainDomElement"),e(this,"_instance"),e(this,"_mode","website"),e(this,"_viewName","main"),this._instance=t,this._mainDomElement=s,this._mode=a,this._viewName=i}async init(){return Promise.resolve()}}const a="rml-drag-in-styles",i="rml-drag-in-drag-element",r="rml-drag-in-overlay",n="rml-drag-in-drag-ghost",o="rml-drag-in-fade-in",d="rml-drag-in-fade-out",m={DISPLAY_NONE:"rml-display-none"},g="250ms",l="forwards",c=`@keyframes ${o} {from{opacity: 0;}to {opacity: 0.5;}}`,h=`@keyframes ${d} {from{opacity: 0.5;}to {opacity: 0;}}`,u=`${o} ${g} ${l}`,p=`${d} ${g} ${l}`,_="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",y=112,b=112,f=Object.freeze(Object.defineProperty({__proto__:null,DragIn:class extends s{constructor(t,s,a,i){super(t,s,a,i),e(this,"options",{}),e(this,"_customDragSignal",new AbortController),this._mainDomElement=s,this._injectStyles(),this._initializeDragGhost()}_injectStyles(){if(!document.getElementById(a)){const t=document.createElement("style");t.type="text/css",t.id=a,t.innerHTML=`\n .${m.DISPLAY_NONE}{display:none}\n .${r}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${n}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${c}\n ${h}\n `,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+n);e||(e=document.createElement("div"),e.classList.add(n),e.innerText=" ",t.appendChild(e))}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await import("./from-website-DsBWpkdv.mjs");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 import("./from-custom-view-Bg3_d6Sp.mjs");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:a}){a&&this._strategy.beforeUpdateGhost(a);const i=this._customDragSignal.signal,r=e=>{"true"===e.target.getAttribute("data-rml-draggable")&&t(e)},n=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",r,{signal:i}),document.addEventListener("mouseup",n,{signal:i}),document.addEventListener("mousemove",o,{signal:i}),document.addEventListener("mouseleave",n,{signal:i}),document.addEventListener("touchstart",r,{signal:i}),document.addEventListener("touchend",n,{signal:i}),document.addEventListener("touchmove",o,{signal:i})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}},Symbol.toStringTag,{value:"Module"}));export{i as R,a,c as b,h as c,_ as d,y as e,b as f,u as g,p as h,r as i,m as j,n as k,f as l};
@@ -0,0 +1 @@
1
+ var t=Object.defineProperty,e=(e,s,r)=>((e,s,r)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r)(e,"symbol"!=typeof s?s+"":s,r);import{C as s,e as r,i as a,T as i,b as n,c as h,d as o}from"./touch-drag-BEct6jbW.mjs";import{d as g,e as _,f as l}from"./drag-in-ltdVSMsI.mjs";const u=t=>{t.preventDefault(),t.stopPropagation()};class c{constructor({onCustomDragStart:t},r={}){e(this,"_startX",0),e(this,"_startY",0),e(this,"_lastX",0),e(this,"_lastY",0),e(this,"_epsilon"),e(this,"_isWaiting",!1),e(this,"_onCustomDragStart"),this._epsilon="number"==typeof r.epsilon?r.epsilon:s,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&((t,e)=>{const s=this._lastX-t,r=this._lastY-e;return Math.sqrt(s*s+r*r)})(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 d="data-rml-old-draggable",m=(t,e)=>{const r=a(t),i={delay:r?n:h,epsilon:r?o:s};if(!e)return i;if(!(r||t instanceof MouseEvent))return i;const{delayKey:g,epsilonKey:_}=r?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof e[g]&&(i.delay=e.touchDragDelay),"number"==typeof e[_]&&(i.epsilon=e.touchDragEpsilon),i};class p{constructor(t,s,r){var a;e(this,"_options",{}),e(this,"_instance"),e(this,"_mainDomElement"),e(this,"_viewName"),e(this,"_currentCustomDrag",null),e(this,"_currentBb",null),e(this,"_startTarget",null),e(this,"_onBeforeUpdateDrag",()=>({})),e(this,"isDragging",!1),this._instance=t,this._options=s||{},this._viewName=r,this._mainDomElement=mainDomElement,null==(a=this._mainDomElement.parentElement)||a.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,e,s="rml_id"){var a;this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(d,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",u),this._startTarget.addEventListener("dragstart",u)),this._currentBb=await this._instance.getBoundingClientRect((a=this._viewName,`[data-rml-custom-view="${a}"]`));const{clientX:i,clientY:n}=r(e),h=this._currentBb.x+i,o=this._currentBb.y+n;this.isDragging=!0,this._instance.dragInObject(t,h,o,s)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:s}=r(t),{url:a,width:i,height:n}=(t=>{let e="",s=_,r=l;if(!t)return{url:g,width:s,height:r};const a=t;if(a instanceof HTMLElement){const t=a.getBoundingClientRect(),i=a.getAttribute("data-rml-ghost-url"),n=a.getAttribute("data-rml-ghost-width"),h=a.getAttribute("data-rml-ghost-height");i?e=i:!i&&a instanceof HTMLImageElement&&a.src&&(e=a.src),e?(s=t.width,r=t.height):e=g,s=n?parseInt(n,10):s,r=h?parseInt(h,10):r}return{url:e||g,width:s,height:r}})(this._startTarget),h=this._currentBb.x+e,o=this._currentBb.y+s,u=this._options||{},c={ghost:{visibleIn:{x:this._currentBb.x-(u.dragInOverlapX||0),y:this._currentBb.y+(u.dragInOverlapY||0),width:this._currentBb.width+(u.dragInOverlapX||0),height:this._currentBb.height+(u.dragInOverlapY||0)},url:a,width:i,height:n},mode:"custom-view"},{x:d,y:m,options:p}=this._onBeforeUpdateDrag(h,o,c),b="number"==typeof d?d:h,D="number"==typeof m?m:o,y=p||c;this._instance.updateDrag(b,D,y)}_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=a(e)?new i(void 0,{onTouchDragStart:(e,r)=>{this._dragStart(t,r,s)}},m(e,this._options)):new c({onCustomDragStart:e=>this._dragStart(t,e,s)},m(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(d),this._startTarget.removeAttribute(d),this._startTarget.removeEventListener("dragstart",u))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}export{p as DragInFromCustomViewStrategy};
@@ -1,13 +1,13 @@
1
- var A = Object.defineProperty;
2
- var O = (e, t, s) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var i = (e, t, s) => O(e, typeof t != "symbol" ? t + "" : t, s);
4
- import { C as T, e as m, i as b, T as v, b as B, c as I, d as L } from "./touch-drag-DNDPwZ-_.mjs";
5
- import { d as c, e as Y, f as X } from "./drag-in-D5QSQ86J.mjs";
6
- const G = (e) => `[data-rml-custom-view="${e}"]`, l = (e) => {
7
- e.preventDefault(), e.stopPropagation();
8
- }, w = (e, t, s, r) => {
9
- const a = s - e, n = r - t;
10
- return Math.sqrt(a * a + n * n);
1
+ var v = Object.defineProperty;
2
+ var A = (a, t, s) => t in a ? v(a, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[t] = s;
3
+ var i = (a, t, s) => A(a, typeof t != "symbol" ? t + "" : t, s);
4
+ import { C as T, e as p, i as b, T as I, b as O, c as B, d as L } from "./touch-drag-DNDPwZ-_.mjs";
5
+ import { d as c, e as Y, f as X } from "./drag-in-CqBNfbIX.mjs";
6
+ const G = (a) => `[data-rml-custom-view="${a}"]`, l = (a) => {
7
+ a.preventDefault(), a.stopPropagation();
8
+ }, w = (a, t, s, e) => {
9
+ const r = s - a, n = e - t;
10
+ return Math.sqrt(r * r + n * n);
11
11
  };
12
12
  class U {
13
13
  constructor({ onCustomDragStart: t }, s = {}) {
@@ -38,62 +38,66 @@ class U {
38
38
  this._startX = 0, this._startY = 0, this._lastX = 0, this._lastY = 0, this._isWaiting = !1;
39
39
  }
40
40
  }
41
- const u = "data-rml-old-draggable", R = void 0, f = (e, t) => {
42
- const s = b(e), r = {
43
- delay: s ? B : I,
41
+ const u = "data-rml-old-draggable", R = void 0, f = (a, t) => {
42
+ const s = b(a), e = {
43
+ delay: s ? O : B,
44
44
  epsilon: s ? L : T
45
45
  };
46
46
  if (!t)
47
- return r;
48
- if (!s && !(e instanceof MouseEvent))
47
+ return e;
48
+ if (!s && !(a instanceof MouseEvent))
49
49
  return console.warn(
50
50
  "Unsupported event! It is not TouchEvent and also not MouseEvent"
51
- ), r;
51
+ ), e;
52
52
  const {
53
- delayKey: a,
53
+ delayKey: r,
54
54
  epsilonKey: n
55
55
  } = s ? { delayKey: "touchDragDelay", epsilonKey: "touchDragEpsilon" } : { delayKey: "customDragDelay", epsilonKey: "customDragEpsilon" };
56
- return typeof t[a] == "number" && (r.delay = t.touchDragDelay), typeof t[n] == "number" && (r.epsilon = t.touchDragEpsilon), r;
57
- }, M = (e) => {
58
- let t = "", s = Y, r = X;
59
- if (!e)
60
- return { url: c, width: s, height: r };
61
- const a = e;
62
- if (a instanceof HTMLElement) {
63
- const n = a.getBoundingClientRect(), o = a.getAttribute("data-rml-ghost-url"), h = a.getAttribute("data-rml-ghost-width"), g = a.getAttribute("data-rml-ghost-height");
64
- o ? t = o : !o && a instanceof HTMLImageElement && a.src && (t = a.src), t ? (s = n.width, r = n.height) : t = c, s = h ? parseInt(h, 10) : s, r = g ? parseInt(g, 10) : r;
65
- }
66
- return { url: t || c, width: s, height: r };
56
+ return typeof t[r] == "number" && (e.delay = t.touchDragDelay), typeof t[n] == "number" && (e.epsilon = t.touchDragEpsilon), e;
57
+ }, M = (a) => {
58
+ let t = "", s = Y, e = X;
59
+ if (!a)
60
+ return { url: c, width: s, height: e };
61
+ const r = a;
62
+ if (r instanceof HTMLElement) {
63
+ const n = r.getBoundingClientRect(), o = r.getAttribute("data-rml-ghost-url"), h = r.getAttribute("data-rml-ghost-width"), g = r.getAttribute("data-rml-ghost-height");
64
+ o ? t = o : !o && r instanceof HTMLImageElement && r.src && (t = r.src), t ? (s = n.width, e = n.height) : t = c, s = h ? parseInt(h, 10) : s, e = g ? parseInt(g, 10) : e;
65
+ }
66
+ return { url: t || c, width: s, height: e };
67
67
  };
68
68
  class N {
69
- constructor(t, s, r) {
69
+ constructor(t, s, e) {
70
70
  i(this, "_options", {});
71
71
  i(this, "_instance");
72
+ i(this, "_mainDomElement");
72
73
  i(this, "_viewName");
73
74
  i(this, "_currentCustomDrag", null);
74
75
  i(this, "_currentBb", null);
75
76
  i(this, "_startTarget", null);
76
77
  i(this, "_onBeforeUpdateDrag", () => ({}));
77
78
  i(this, "isDragging", !1);
78
- this._instance = t, this._options = s || {}, this._viewName = r;
79
+ var r;
80
+ this._instance = t, this._options = s || {}, this._viewName = e, this._mainDomElement = mainDomElement, (r = this._mainDomElement.parentElement) == null || r.addEventListener("dragleave", () => {
81
+ this._instance.cancelDragIn();
82
+ });
79
83
  }
80
84
  beforeUpdateGhost(t) {
81
85
  this._onBeforeUpdateDrag = t;
82
86
  }
83
- async _dragStart(t, s, r = "rml_id") {
87
+ async _dragStart(t, s, e = "rml_id") {
84
88
  this._startTarget && (this._startTarget.style.pointerEvents = "none", this._startTarget.style.userSelect = "none", this._startTarget.setAttribute(
85
89
  u,
86
90
  this._startTarget.draggable.toString()
87
91
  ), this._startTarget.draggable = !1, this._startTarget.removeEventListener("dragstart", l), this._startTarget.addEventListener("dragstart", l)), this._currentBb = await this._instance.getBoundingClientRect(
88
92
  G(this._viewName)
89
93
  );
90
- const { clientX: a, clientY: n } = m(s), o = this._currentBb.x + a, h = this._currentBb.y + n;
91
- this.isDragging = !0, this._instance.dragInObject(t, o, h, r);
94
+ const { clientX: r, clientY: n } = p(s), o = this._currentBb.x + r, h = this._currentBb.y + n;
95
+ this.isDragging = !0, this._instance.dragInObject(t, o, h, e);
92
96
  }
93
97
  _dragUpdate(t) {
94
98
  if (document.body.focus(), this._currentCustomDrag && this._currentCustomDrag.onMove(t), !this._currentBb || !this.isDragging)
95
99
  return;
96
- const { clientX: s, clientY: r } = m(t), { url: a, width: n, height: o } = M(this._startTarget), h = this._currentBb.x + s, g = this._currentBb.y + r, _ = this._options || {}, d = {
100
+ const { clientX: s, clientY: e } = p(t), { url: r, width: n, height: o } = M(this._startTarget), h = this._currentBb.x + s, g = this._currentBb.y + e, _ = this._options || {}, d = {
97
101
  ghost: {
98
102
  visibleIn: {
99
103
  x: this._currentBb.x - (_.dragInOverlapX || 0),
@@ -101,35 +105,35 @@ class N {
101
105
  width: this._currentBb.width + (_.dragInOverlapX || 0),
102
106
  height: this._currentBb.height + (_.dragInOverlapY || 0)
103
107
  },
104
- url: a,
108
+ url: r,
105
109
  width: n,
106
110
  height: o
107
111
  },
108
112
  mode: "custom-view"
109
113
  }, {
110
- x: D,
111
- y: p,
114
+ x: m,
115
+ y: D,
112
116
  options: E
113
- } = this._onBeforeUpdateDrag(h, g, d), y = typeof D == "number" ? D : h, C = typeof p == "number" ? p : g, S = E || d;
117
+ } = this._onBeforeUpdateDrag(h, g, d), y = typeof m == "number" ? m : h, C = typeof D == "number" ? D : g, S = E || d;
114
118
  this._instance.updateDrag(y, C, S);
115
119
  }
116
120
  _dragEnd() {
117
121
  this._currentCustomDrag && this._currentCustomDrag.onEnd(), this._currentCustomDrag = null, this.isDragging = !1, this._currentBb = null, this._resetStartTarget(), this._instance.enableEvents(), this._instance.dragInObjectEnd();
118
122
  }
119
- dragStart(t, s, r) {
123
+ dragStart(t, s, e) {
120
124
  this._instance.disableEvents(), this._startTarget = s.target;
121
- const a = (n, o) => {
122
- this._dragStart(t, o, r);
125
+ const r = (n, o) => {
126
+ this._dragStart(t, o, e);
123
127
  };
124
- this._currentCustomDrag = b(s) ? new v(
128
+ this._currentCustomDrag = b(s) ? new I(
125
129
  R,
126
130
  {
127
- onTouchDragStart: a
131
+ onTouchDragStart: r
128
132
  },
129
133
  f(s, this._options)
130
134
  ) : new U(
131
135
  {
132
- onCustomDragStart: (n) => this._dragStart(t, n, r)
136
+ onCustomDragStart: (n) => this._dragStart(t, n, e)
133
137
  },
134
138
  f(s, this._options)
135
139
  ), this._currentCustomDrag.onStart(s);
@@ -140,8 +144,8 @@ class N {
140
144
  dragUpdate(t) {
141
145
  this._dragUpdate(t);
142
146
  }
143
- touchStart(t, s, r = "rml_id") {
144
- this.dragStart(t, s, r);
147
+ touchStart(t, s, e = "rml_id") {
148
+ this.dragStart(t, s, e);
145
149
  }
146
150
  touchMove(t) {
147
151
  this.dragUpdate(t);
@@ -1,12 +1,12 @@
1
1
  var F = Object.defineProperty;
2
2
  var M = (r, e, t) => e in r ? F(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var l = (r, e, t) => M(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { g as C, e as G, a as E, i as N, T as O } from "./touch-drag-DNDPwZ-_.mjs";
5
- import { R as f, a as p, b as w, c as B, d as Y, e as L, f as b, g as x, h as S, i as A, j as R, k as H } from "./drag-in-D5QSQ86J.mjs";
4
+ import { g as C, e as E, a as G, i as N, T as O } from "./touch-drag-DNDPwZ-_.mjs";
5
+ import { R as f, a as p, b as w, c as B, d as Y, e as v, f as L, g as x, h as S, i as A, j as R, k as H } from "./drag-in-CqBNfbIX.mjs";
6
6
  const T = (r, e, t = 0, n = 0) => {
7
7
  const s = e.x + e.width + t, i = e.x - t, a = e.y + e.height + n, d = e.y - n, { x: o, y: h } = r;
8
8
  return o >= i && o <= s && h >= d && h <= a;
9
- }, v = (r, e, t, n = 0, s = 0) => {
9
+ }, b = (r, e, t, n = 0, s = 0) => {
10
10
  if (!(!t || !t.hiddenIn && !t.visibleIn))
11
11
  return t.visibleIn ? T(
12
12
  { x: r, y: e },
@@ -35,9 +35,9 @@ const T = (r, e, t = 0, n = 0) => {
35
35
  n.appendChild(t.ghost.element);
36
36
  else {
37
37
  const g = document.createElement("img");
38
- g.src = ((i = t.ghost) == null ? void 0 : i.url) || Y, g.width = ((a = t.ghost) == null ? void 0 : a.width) || L, g.height = ((d = t.ghost) == null ? void 0 : d.height) || b, n.appendChild(g);
38
+ g.src = ((i = t.ghost) == null ? void 0 : i.url) || Y, g.width = ((a = t.ghost) == null ? void 0 : a.width) || v, g.height = ((d = t.ghost) == null ? void 0 : d.height) || L, n.appendChild(g);
39
39
  }
40
- n.id = f, 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", v(
40
+ n.id = f, 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", b(
41
41
  r,
42
42
  e,
43
43
  t.ghost || {},
@@ -51,9 +51,9 @@ const T = (r, e, t = 0, n = 0) => {
51
51
  if (!n)
52
52
  return;
53
53
  let s = (o = t.ghost) == null ? void 0 : o.width, i = (h = t.ghost) == null ? void 0 : h.height;
54
- typeof s > "u" && (s = n.getBoundingClientRect().width || L), typeof i > "u" && (i = n.getBoundingClientRect().height || b);
54
+ typeof s > "u" && (s = n.getBoundingClientRect().width || v), typeof i > "u" && (i = n.getBoundingClientRect().height || L);
55
55
  const a = r - s / 2, d = e - i / 2;
56
- n.style.transform = `translate3d(${a}px, ${d}px, 0)`, t.ghost && (v(
56
+ n.style.transform = `translate3d(${a}px, ${d}px, 0)`, t.ghost && (b(
57
57
  r,
58
58
  e,
59
59
  t.ghost,
@@ -100,7 +100,10 @@ class z {
100
100
  const t = e || window.event;
101
101
  this._firefoxDragPosition.x = t.pageX || 0, this._firefoxDragPosition.y = t.pageY || 0;
102
102
  });
103
- this._instance = e, this._mainDomElement = t, this._options = n || {}, this._firefoxFallback = this._firefoxFallback.bind(this), document.addEventListener("dragover", this._firefoxFallback);
103
+ var s;
104
+ this._instance = e, this._mainDomElement = t, this._options = n || {}, this._firefoxFallback = this._firefoxFallback.bind(this), document.addEventListener("dragover", this._firefoxFallback), (s = this._mainDomElement.parentElement) == null || s.addEventListener("dragleave", () => {
105
+ this._instance.cancelDragIn();
106
+ });
104
107
  }
105
108
  beforeUpdateGhost(e) {
106
109
  this._onBeforeUpdateDrag = e;
@@ -126,12 +129,12 @@ class z {
126
129
  this._currentDrag.event = t;
127
130
  const h = t.target, g = h.cloneNode(!0), c = h.getBoundingClientRect();
128
131
  g.style.width = `${c.width}px`, g.style.height = `${c.height}px`, this._currentDrag.ghost = new k(g), this._currentDrag.offset || (this._currentDrag.offset = { x: 0, y: 0 });
129
- const { clientX: _, clientY: D } = G(
132
+ const { clientX: _, clientY: D } = E(
130
133
  t,
131
134
  this._firefoxDragPosition
132
135
  );
133
136
  this._currentDrag.offset.x = _ - c.left, this._currentDrag.offset.y = D - c.top, t instanceof DragEvent && t.dataTransfer && t.dataTransfer.setDragImage && t.dataTransfer.setDragImage(o, 0, 0);
134
- const { x: y, y: u } = E(
137
+ const { x: y, y: u } = G(
135
138
  s,
136
139
  this._currentDrag.event || t,
137
140
  this._firefoxDragPosition
@@ -140,7 +143,7 @@ class z {
140
143
  }
141
144
  dragUpdate(e) {
142
145
  var u;
143
- const t = this._mainDomElement.parentNode, { x: n, y: s } = E(t, e, this._firefoxDragPosition);
146
+ const t = this._mainDomElement.parentNode, { x: n, y: s } = G(t, e, this._firefoxDragPosition);
144
147
  if (n === 0 && s === 0)
145
148
  return;
146
149
  const i = Math.max(1, n), a = Math.max(1, s);
@@ -159,7 +162,7 @@ class z {
159
162
  _.ghost || (_.ghost = {}), _.ghost.visibleIn && _.ghost.hiddenIn || (_.ghost.hiddenIn = this._mainDomElement.getBoundingClientRect());
160
163
  const D = typeof h == "number" ? h : d, y = typeof g == "number" ? g : o;
161
164
  if (this._currentDrag.ghost) {
162
- const { clientX: m, clientY: I } = G(
165
+ const { clientX: m, clientY: I } = E(
163
166
  e,
164
167
  this._firefoxDragPosition
165
168
  );
@@ -0,0 +1 @@
1
+ var t=Object.defineProperty,e=(e,n,i)=>((e,n,i)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i)(e,"symbol"!=typeof n?n+"":n,i);import{g as n,e as i,a as s,i as o,T as a}from"./touch-drag-BEct6jbW.mjs";import{R as r,a as h,b as l,c as d,d as g,e as m,f as c,g as u,h as _,i as f,j as p,k as v}from"./drag-in-ltdVSMsI.mjs";const D=(t,e,n=0,i=0)=>{const s=e.x+e.width+n,o=e.x-n,a=e.y+e.height+i,r=e.y-i,{x:h,y:l}=t;return h>=o&&h<=s&&l>=r&&l<=a},y=(t,e,n,i=0,s=0)=>{if(n&&(n.hiddenIn||n.visibleIn))return n.visibleIn?D({x:t,y:e},n.visibleIn,i,s):!!n.hiddenIn&&!D({x:t,y:e},n.hiddenIn,-i,-s)};class x{constructor(t=null){e(this,"_dragGhostAnimationFrameId",null),e(this,"_dragGhostRemoveAnimationFrameId",null),e(this,"_dragGhostElement",null),this._dragGhostElement=t}updateDragGhost(t,e,n){var i;this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),(null==(i=n.ghost)||!i.external)&&n.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById(h)){const t=document.createElement("style");t.type="text/css",t.id=h,t.innerHTML=`\n ${l}\n ${d}\n `,document.head.appendChild(t)}})();const i={x:t,y:e};!n.ghost&&this._dragGhostElement&&(n.ghost={}),n.ghost&&!n.ghost.element&&this._dragGhostElement&&(n.ghost.element=this._dragGhostElement),(({x:t,y:e},n)=>{var i,s,o,a,h,l;let d=document.getElementById(r);if(!d){if(d=document.createElement("div"),null!=(i=n.ghost)&&i.element)d.appendChild(n.ghost.element);else{const t=document.createElement("img");t.src=(null==(s=n.ghost)?void 0:s.url)||g,t.width=(null==(o=n.ghost)?void 0:o.width)||m,t.height=(null==(a=n.ghost)?void 0:a.height)||c,d.appendChild(t)}d.id=r,d.style.position="fixed",d.style.top="0",d.style.left="0",d.style.willChange="transform",d.style.transform="translate3d(0, 0, 0)",d.style.zIndex="9999",d.style.opacity="0.5",y(t,e,n.ghost||{},null==(h=n.settings)?void 0:h.dragInOverlapX,null==(l=n.settings)?void 0:l.dragInOverlapY)||(d.style.display="none"),d.style.pointerEvents="none",document.body.appendChild(d)}})(i,n),(({x:t,y:e},n)=>{var i,s,o,a;const h=document.getElementById(r);if(!h)return;let l=null==(i=n.ghost)?void 0:i.width,d=null==(s=n.ghost)?void 0:s.height;typeof l>"u"&&(l=h.getBoundingClientRect().width||m),typeof d>"u"&&(d=h.getBoundingClientRect().height||c);const g=t-l/2,f=e-d/2;h.style.transform=`translate3d(${g}px, ${f}px, 0)`,n.ghost&&(y(t,e,n.ghost,null==(o=n.settings)?void 0:o.dragInOverlapX,null==(a=n.settings)?void 0:a.dragInOverlapY)?h.style.animation!=u&&(h.style.animation=u):h.style.animation!=_&&(h.style.animation=_))})(i,n),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(r);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}class I{constructor(t,n,i){var s;e(this,"_options",{}),e(this,"_instance"),e(this,"_mainDomElement"),e(this,"_currentDrag",{}),e(this,"_currentTouch",null),e(this,"_firefoxDragPosition",{x:0,y:0}),e(this,"_onBeforeUpdateDrag",()=>({})),e(this,"isDragging",!1),e(this,"_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}),this._instance=t,this._mainDomElement=n,this._options=i||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),null==(s=this._mainDomElement.parentElement)||s.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(t,e,o="rml_id"){const a=this._mainDomElement.parentNode;if("relative"!==n(a).position)return;this._mainDomElement.style.pointerEvents="none";let r=a.querySelector("."+f);r||(r=document.createElement("div"),r.classList.add(f),a.appendChild(r)),r.classList.remove(p.DISPLAY_NONE),e.target.getAttribute("draggable");const h=a.querySelector("."+v);this._currentDrag.event=e;const l=e.target,d=l.cloneNode(!0),g=l.getBoundingClientRect();d.style.width=`${g.width}px`,d.style.height=`${g.height}px`,this._currentDrag.ghost=new x(d),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:m,clientY:c}=i(e,this._firefoxDragPosition);this._currentDrag.offset.x=m-g.left,this._currentDrag.offset.y=c-g.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(h,0,0);const{x:u,y:_}=s(a,this._currentDrag.event||e,this._firefoxDragPosition),D=Math.max(1,u),y=Math.max(1,_);this.isDragging=!0,this._instance.dragInObject(t,D,y,o)}dragUpdate(t){var e;const n=this._mainDomElement.parentNode,{x:a,y:r}=s(n,t,this._firefoxDragPosition);if(0===a&&0===r)return;const h=Math.max(1,a),l=Math.max(1,r);if(1===h&&1===l)return;let d=h,g=l;if(o(t)){const t=(null==(e=this._options.settings)?void 0:e.fingerSize)||0;d=Math.max(2,h+t),g=Math.max(2,l-t)}const{x:m,y:c,options:u}=this._onBeforeUpdateDrag(d,g,{}),_=u||{settings:{},ghost:{}};_.ghost||(_.ghost={}),_.ghost.visibleIn&&_.ghost.hiddenIn||(_.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const f="number"==typeof m?m:d,p="number"==typeof c?c:g;if(this._currentDrag.ghost){const{clientX:e,clientY:n}=i(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(e,n,_)}this._instance.updateDrag(f,p,{})}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("."+f);e&&e.classList.add(p.DISPLAY_NONE)}touchStart(t,e,n="rml_id"){var i,s,o,r;e.preventDefault();const h={};"number"==typeof(null==(s=null==(i=this._options)?void 0:i.settings)?void 0:s.touchDragDelay)&&(h.delay=this._options.settings.touchDragDelay),null!=(r=null==(o=this._options)?void 0:o.settings)&&r.touchDragEpsilon&&(h.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new a(void 0,{onTouchDragStart:(e,i)=>{this.dragStart(t,i,n)}},h),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){}}export{I as DragInFromWebsiteStrategy};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomle/embedding-lib",
3
- "version": "5.25.0-alpha.1",
3
+ "version": "5.25.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",
@@ -8,6 +8,7 @@ import { OnBeforeUpdateDragGhost } from '../../../../common/src/utils/drag';
8
8
  export declare class DragInFromCustomViewStrategy implements DragInStrategy {
9
9
  private _options;
10
10
  private _instance;
11
+ private _mainDomElement;
11
12
  private _viewName;
12
13
  private _currentCustomDrag;
13
14
  private _currentBb;
@@ -78,6 +78,7 @@ export default class InputManager extends EventDispatcher<InputEvent> implements
78
78
  constructor(creator: string);
79
79
  enableDragIn(dragEvent?: DragEvent): void;
80
80
  isMouseUp(): boolean;
81
+ forceMouseUp(): void;
81
82
  private _dragM;
82
83
  private _dragE;
83
84
  addEvents(element: HTMLElement): void;
@@ -1,6 +1,3 @@
1
- export { default as ENV_MAP_FILE_NAME } from '../../public/textures/env/roomle.envmap?url';
2
- export { default as ENV_32_MAP_FILE_NAME } from '../../public/textures/env/roomle32.envmap?url';
3
- export { default as ENV_64_MAP_FILE_NAME } from '../../public/textures/env/roomle64.envmap?url';
4
1
  export { default as ENV_HDR_256_FILE_NAME } from '../../public/textures/env/default_256.exr?url';
5
2
  export { default as ENV_HDR_1K_FILE_NAME } from '../../public/textures/env/default_1k.exr?url';
6
3
  export { default as ENV_LEGACY } from '../../public/textures/env/legacy_env.exr?url';
@@ -263,6 +263,11 @@ export default class RoomlePlanner<P extends readonly PluginName[] = readonly []
263
263
  disableMultiselect(): void;
264
264
  private _insertExternalObject;
265
265
  dragInObject(idOrSerializedConfigString: string, dragEvent: DragEvent, type?: ID_TYPE): Promise<RuntimeId>;
266
+ /**
267
+ * Will remove an element that was dragged into the scene while still dragging it.
268
+ * This is mainly used in the context of pressing ESC while dragging or dragging the element away from the scene again.
269
+ */
270
+ cancelDragIn(): void;
266
271
  /**
267
272
  * enable snapping of object to object and object to wall
268
273
  */
@@ -184,6 +184,7 @@ export default class PlannerSceneManager extends ConfiguratorSceneManager implem
184
184
  enableWallDrawing(): void;
185
185
  disableWallDrawing(): void;
186
186
  escapeDrawing(cancelDrawing: boolean): void;
187
+ cancelDragIn(): void;
187
188
  setSceneEvents(sceneEvents: SceneEvents): void;
188
189
  /**
189
190
  * called by kernel
@@ -300,7 +300,7 @@ class M {
300
300
  typeof r == "string" && r === "dragIn" ? this.pluginsLoaded.push(
301
301
  new Promise((n, a) => {
302
302
  try {
303
- import("./drag-in-D5QSQ86J.mjs").then((i) => i.l).then(
303
+ import("./drag-in-CqBNfbIX.mjs").then((i) => i.l).then(
304
304
  ({ DragIn: i }) => {
305
305
  const l = new i(
306
306
  this.ui,
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,s,r)=>((t,s,r)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r)(t,"symbol"!=typeof s?s+"":s,r);class s{constructor(e,s,r,i){t(this,"_side"),t(this,"_incomingMessageBus",null),t(this,"_outgoingMessageBus",null),t(this,"_execMessage",null),this._side=e,this._incomingMessageBus=s,this._outgoingMessageBus=r,this._execMessage=i,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 i=new MessageChannel;i.port1.onmessage=e=>{if(!e||!e.data)return i.port1.close(),i.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 i.port1.close(),i.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),i.port1.close(),i.port2.close()};let n="";try{n=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(n,"*",[i.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(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 r=["127.0.0.1","localhost","0.0.0.0"],i=["language","browserLanguage","userLanguage","systemLanguage"],n=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=n(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var a=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(a||{}),o={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const l={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[a.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},c=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&&c(t),Array.isArray(t))for(const e of t)c(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},u=()=>/(android)/i.test(navigator.userAgent);class g{constructor(){t(this,"_messageHandler",null),t(this,"isSetupDone",!1),t(this,"viewName","main"),t(this,"plugins",{}),t(this,"pluginsLoaded",[]),t(this,"ui",{callbacks:null}),t(this,"extended",{callbacks:null}),t(this,"configurator",{callbacks:null}),t(this,"analytics",{callbacks:{}}),t(this,"rapi",{callbacks:{}}),t(this,"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],i=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][i]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split("."),r=s[0],i=s[1],n=3===s.length?s[2]:null;if(n&&this[r][i][n]){const e=this[r][i][n](...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-BWioG4OL.mjs").then(e=>e.l).then(({DragIn:i})=>{const n=new i(this.ui,t,s,this.viewName);n.init().then(()=>{this.plugins.dragIn=n,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,i)=>{try{r.loader().then(n=>{const a=new n(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins[r.name]=a,e()},i)})}catch(e){i(e)}}))}}const h=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},d=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=null!=e&&e.mute?e.value:e}})},m=()=>.01*window.innerHeight+"px",p=e=>{e&&setTimeout(()=>e.style.setProperty(_,m()),0)},f="rml-styles",_="--rml-full-height",w="rml-container",b="rml-fill",y="rml-pos",v="rml-android-height",M="rml-overflow-hidden",S=new Map;class P extends g{constructor(e,r,i,n,a){if(super(),t(this,"_waitForIframe"),t(this,"_container"),t(this,"_configuratorSettings"),t(this,"_initData",{}),t(this,"_iframe"),!e||"string"!=typeof e.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(S.has(r))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(f)){const e=i.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=f;const s="transition:all ease-in-out 450ms;",r=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,n=m();t.innerHTML=`\n .${w}{${_}:${n};}\n .${y}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${r}}\n .${b}{width:100%;height:100%;opacity:1}\n .${v}{height:calc(var(${_},1vh)*100)}\n .${M}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const o=new s("website",window,null,this._executeMessage);this.setMessageHandler(o),this._onResize=this._onResize.bind(this),u()&&window.addEventListener("resize",this._onResize),this._container=r,this._initData=i,this._configuratorSettings=e;const l=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(l),this._iframe=l,this.setupPlugins(n,this._iframe),S.set(r,!0)}static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(e,t=[]){const r=new g;r.viewName=e;const{resolve:i,promise:n}=h(),{resolve:a,promise:o}=h(),l=new s("custom-view-"+e,window,window.parent,({message:e,args:t})=>{switch(e){case"registerCustomViewDone":i();break;case"returnMethods":r.handleSetup(t[0]),a();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(l);const c=[e];return l.sendMessage("registerCustomView",c),await n,l.sendMessage("getMethods",c),await o,r.setupPlugins(t,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 async _create(e,t,s,a){return new Promise(async(u,g)=>{try{const g=n((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(l);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=i.length;e<s;e++){const s=t[i[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=>!!(r.includes(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com")))(t)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=o.VITE_RAPI_URL,e.emails=!1,e})(),(c(h=s),null!=h&&h.customApiUrl&&(h.customApiUrl=decodeURIComponent(h.customApiUrl)),h.shareUrl&&(h.deeplink=h.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),h));(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)})(g);const d=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,i=s+"/configurators/"+e,n="roomle_portal_v2",a="03-"+window.btoa((new Date).toISOString()+";anonymous;"+n),o=new Request(i,{method:"GET",headers:new Headers({apiKey:n,currentTenant:r,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})(e,g);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 n(s,t)})(s,t)})(d,g);const m=new this(d,t,s,a,u);return await Promise.allSettled(m.pluginsLoaded),m}catch(e){return g(e)}var h})}teardown(){this._container&&S.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=(null==(e=this._configuratorSettings)?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(w),t.classList.add(b),t}_onResize(){p(this._iframe)}_onUseFullPage(){this._iframe.classList.add(y),document.documentElement.classList.add(M),window.document.body.classList.add(M),u()&&(p(this._iframe),this._iframe.classList.add(v))}_onBackToWebsite(){this._iframe.classList.remove(y),this._iframe.classList.remove(v),document.documentElement.classList.remove(M),window.document.body.classList.remove(M)}_executeMessage({message:e,args:t},s){var r;if(s.source&&s.source===(null==(r=this._iframe)?void 0:r.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]),d(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),d(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{P as default};
1
+ var e=Object.defineProperty,t=(t,s,r)=>((t,s,r)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r)(t,"symbol"!=typeof s?s+"":s,r);class s{constructor(e,s,r,i){t(this,"_side"),t(this,"_incomingMessageBus",null),t(this,"_outgoingMessageBus",null),t(this,"_execMessage",null),this._side=e,this._incomingMessageBus=s,this._outgoingMessageBus=r,this._execMessage=i,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 i=new MessageChannel;i.port1.onmessage=e=>{if(!e||!e.data)return i.port1.close(),i.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 i.port1.close(),i.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),i.port1.close(),i.port2.close()};let n="";try{n=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(n,"*",[i.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(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 r=["127.0.0.1","localhost","0.0.0.0"],i=["language","browserLanguage","userLanguage","systemLanguage"],n=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=n(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var a=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(a||{}),o={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const l={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[a.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},c=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&&c(t),Array.isArray(t))for(const e of t)c(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},u=()=>/(android)/i.test(navigator.userAgent);class g{constructor(){t(this,"_messageHandler",null),t(this,"isSetupDone",!1),t(this,"viewName","main"),t(this,"plugins",{}),t(this,"pluginsLoaded",[]),t(this,"ui",{callbacks:null}),t(this,"extended",{callbacks:null}),t(this,"configurator",{callbacks:null}),t(this,"analytics",{callbacks:{}}),t(this,"rapi",{callbacks:{}}),t(this,"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],i=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][i]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split("."),r=s[0],i=s[1],n=3===s.length?s[2]:null;if(n&&this[r][i][n]){const e=this[r][i][n](...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-ltdVSMsI.mjs").then(e=>e.l).then(({DragIn:i})=>{const n=new i(this.ui,t,s,this.viewName);n.init().then(()=>{this.plugins.dragIn=n,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,i)=>{try{r.loader().then(n=>{const a=new n(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins[r.name]=a,e()},i)})}catch(e){i(e)}}))}}const h=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},d=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=null!=e&&e.mute?e.value:e}})},m=()=>.01*window.innerHeight+"px",p=e=>{e&&setTimeout(()=>e.style.setProperty(_,m()),0)},f="rml-styles",_="--rml-full-height",w="rml-container",b="rml-fill",y="rml-pos",v="rml-android-height",M="rml-overflow-hidden",S=new Map;class P extends g{constructor(e,r,i,n,a){if(super(),t(this,"_waitForIframe"),t(this,"_container"),t(this,"_configuratorSettings"),t(this,"_initData",{}),t(this,"_iframe"),!e||"string"!=typeof e.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(S.has(r))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(f)){const e=i.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=f;const s="transition:all ease-in-out 450ms;",r=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,n=m();t.innerHTML=`\n .${w}{${_}:${n};}\n .${y}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${r}}\n .${b}{width:100%;height:100%;opacity:1}\n .${v}{height:calc(var(${_},1vh)*100)}\n .${M}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const o=new s("website",window,null,this._executeMessage);this.setMessageHandler(o),this._onResize=this._onResize.bind(this),u()&&window.addEventListener("resize",this._onResize),this._container=r,this._initData=i,this._configuratorSettings=e;const l=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(l),this._iframe=l,this.setupPlugins(n,this._iframe),S.set(r,!0)}static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(e,t=[]){const r=new g;r.viewName=e;const{resolve:i,promise:n}=h(),{resolve:a,promise:o}=h(),l=new s("custom-view-"+e,window,window.parent,({message:e,args:t})=>{switch(e){case"registerCustomViewDone":i();break;case"returnMethods":r.handleSetup(t[0]),a();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(l);const c=[e];return l.sendMessage("registerCustomView",c),await n,l.sendMessage("getMethods",c),await o,r.setupPlugins(t,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 async _create(e,t,s,a){return new Promise(async(u,g)=>{try{const g=n((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(l);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=i.length;e<s;e++){const s=t[i[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=>!!(r.includes(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com")))(t)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=o.VITE_RAPI_URL,e.emails=!1,e})(),(c(h=s),null!=h&&h.customApiUrl&&(h.customApiUrl=decodeURIComponent(h.customApiUrl)),h.shareUrl&&(h.deeplink=h.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),h));(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)})(g);const d=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,i=s+"/configurators/"+e,n="roomle_portal_v2",a="03-"+window.btoa((new Date).toISOString()+";anonymous;"+n),o=new Request(i,{method:"GET",headers:new Headers({apiKey:n,currentTenant:r,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})(e,g);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 n(s,t)})(s,t)})(d,g);const m=new this(d,t,s,a,u);return await Promise.allSettled(m.pluginsLoaded),m}catch(e){return g(e)}var h})}teardown(){this._container&&S.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=(null==(e=this._configuratorSettings)?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(w),t.classList.add(b),t}_onResize(){p(this._iframe)}_onUseFullPage(){this._iframe.classList.add(y),document.documentElement.classList.add(M),window.document.body.classList.add(M),u()&&(p(this._iframe),this._iframe.classList.add(v))}_onBackToWebsite(){this._iframe.classList.remove(y),this._iframe.classList.remove(v),document.documentElement.classList.remove(M),window.document.body.classList.remove(M)}_executeMessage({message:e,args:t},s){var r;if(s.source&&s.source===(null==(r=this._iframe)?void 0:r.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]),d(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),d(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{P as default};
@@ -1,17 +1,17 @@
1
- (function(_,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(_=typeof globalThis<"u"?globalThis:_||self,_["roomle-embedding-lib"]=_["roomle-embedding-lib"]||{},_["roomle-embedding-lib"].umd=_["roomle-embedding-lib"].umd||{},_["roomle-embedding-lib"].umd.js=p())})(this,function(){"use strict";var ee=Object.defineProperty;var se=(_,p,D)=>p in _?ee(_,p,{enumerable:!0,configurable:!0,writable:!0,value:D}):_[p]=D;var a=(_,p,D)=>se(_,typeof p!="symbol"?p+"":p,D);class _{constructor(e,t,s,n){a(this,"_side");a(this,"_incomingMessageBus",null);a(this,"_outgoingMessageBus",null);a(this,"_execMessage",null);this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=n,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,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=c=>{if(!c||!c.data)return i.port1.close(),i.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let l;try{l=JSON.parse(c.data)}catch(u){return i.port1.close(),i.port2.close(),this._prepareError(u),n(u)}l.error?n(l.error):l.result!==void 0?s(l.result):s(void 0),i.port1.close(),i.port2.close()};let o="";try{o=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(o,"*",[i.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 n=this._execMessage(s,e);if(n===void 0)return;n.then((i={})=>{let o,c;typeof i=="object"&&i!==null&&(o=i.error,c=i.result),o?t.postMessage(JSON.stringify({error:o})):c!==void 0?t.postMessage(JSON.stringify({result:c})):t.postMessage(JSON.stringify({result:i}))},i=>{t.postMessage(JSON.stringify({error:this._prepareError(i)}))})}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 p=".",D={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},w={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},pt=async(r,e)=>{if(typeof r!="string")throw new Error('Configurator ID is not a string type: "'+typeof r+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",s=e.overrideTenant||9,n=t+"/configurators/"+r,i="roomle_portal_v2",o="03-"+window.btoa(new Date().toISOString()+";anonymous;"+i),c=()=>{const d={apiKey:i,currentTenant:s,locale:"en",language:"en",device:1,token:o,platform:"web"};return new Headers(d)},l=new Request(n,{method:"GET",headers:c(),mode:"cors",cache:"default"}),u=await fetch(l),{configurator:h}=await u.json();return h},yt=()=>{try{return window.self!==window.top}catch{return!0}},Dt=["127.0.0.1","localhost","0.0.0.0"],Et=()=>{const r=yt();let e=window.location.href;if(r){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},Tt=r=>!!(Dt.includes(r)||r.endsWith("roomle.com")||r.endsWith("gitlab.io")||r.endsWith("gitlab.com")),k=["language","browserLanguage","userLanguage","systemLanguage"],St=(r=null)=>{const e=window.navigator;if(r)return r.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,s=k.length;t<s;t++){const n=e[k[t]];if(n)return n.substr(0,2)}return"en"},It=(r,e)=>{const t=JSON.parse(JSON.stringify(r));return C(t,e)},C=(r,e)=>{for(const t in e)try{e[t].constructor===Object?r[t]=C(r[t],e[t]):r[t]=e[t]}catch{r[t]=e[t]}return r};var z=(r=>(r.BOTTOM_BAR="bottom_bar",r.PARTLIST_BOUNDS="partlist_bounds",r.INTERACTION_NOTES="interaction_notes",r.PARAMETER_GROUPS="parameter_groups",r))(z||{});const wt=r=>JSON.parse(JSON.stringify(r));var At={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const bt={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[z.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},Ot="(idle)",vt=r=>(L(r),r!=null&&r.customApiUrl&&(r.customApiUrl=decodeURIComponent(r.customApiUrl)),r.shareUrl&&(r.deeplink=r.shareUrl.replace(Ct,Lt)),r),L=r=>{if(!r)return;const e=Object.keys(r);for(const t of e){const s=r[t];if(!Array.isArray(s)&&typeof s=="object"&&s!==null&&L(s),Array.isArray(s))for(const n of s)L(n);(s==="true"||s==="false")&&(r[t]=s==="true")}},Rt=(r,e)=>{e.configuratorId=r.id;const t=r.settings||{};return!e.overrideTenant&&r.tenant&&(e.overrideTenant=r.tenant),It(t,e)},Mt=()=>{const r=wt(bt);r.locale||(r.locale=St()),r.id===Ot&&delete r.id;const e=Et();return e&&Tt(e)&&(r.configuratorId="demoConfigurator"),r.customApiUrl=At.VITE_RAPI_URL,r.emails=!1,r},Ct="<CONF_ID>",Lt="#CONFIGURATIONID#",Nt=r=>{r.featureFlags||(r.featureFlags={}),typeof r.featureFlags.realPartList!="boolean"&&(r.featureFlags.realPartList=!0),typeof r.featureFlags.globalCallbacks!="boolean"&&(r.featureFlags.globalCallbacks=!0),typeof r.featureFlags.mocAr!="boolean"&&(r.featureFlags.mocAr=!1)},V=()=>/(android)/i.test(navigator.userAgent);class q{constructor(){a(this,"_messageHandler",null);a(this,"isSetupDone",!1);a(this,"viewName","main");a(this,"plugins",{});a(this,"pluginsLoaded",[]);a(this,"ui",{callbacks:null});a(this,"extended",{callbacks:null});a(this,"configurator",{callbacks:null});a(this,"analytics",{callbacks:{}});a(this,"rapi",{callbacks:{}});a(this,"global",{callbacks:{}})}setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(n=>{const i=n.split(p),o=i[0],c=i[1];this[o]||(this[o]={}),this[o][c]=(function(){if(!this._messageHandler){console.error("MessageHandler not set");return}return this._messageHandler.sendMessage(n,[...arguments])}).bind(this)}),s.forEach(n=>{const i=n.split(p),o=i[0],c=i[1],l=i[2];this[o]||(this[o]={}),this[o][c]||(this[o][c]={}),this[o][c][l]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split(p),n=s[0],i=s[1],o=s.length===3?s[2]:null;if(o&&this[n][i][o]){const c=this[n][i][o](...t);return c instanceof Promise?c.then(l=>({result:l})):c!==void 0?Promise.resolve({result:c}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const n of e)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((i,o)=>{try{Promise.resolve().then(()=>Ht).then(({DragIn:c})=>{const l=new c(this.ui,t,s,this.viewName);l.init().then(()=>{this.plugins.dragIn=l,i()},o)})}catch(c){o(c)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((i,o)=>{try{n.loader().then(c=>{const l=new c(this.ui,t,s,this.viewName);l.init().then(()=>{this.plugins[n.name]=l,i()},o)})}catch(c){o(c)}}))}}const K=()=>{let r,e;return{promise:new Promise((s,n)=>{r=s,e=n}),resolve:r,reject:e}},J=(r,e,t)=>{let s=null;Object.defineProperty(r,e,{get(){return s||t},set(n){n!=null&&n.mute?s=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 }"),s=n)}})},j=()=>window.innerHeight*.01+"px",Q=r=>{r&&setTimeout(()=>r.style.setProperty(N,j()),0)},Z="rml-styles",xt=450,N="--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"},x=new Map;class Gt extends q{constructor(t,s,n,i,o){super();a(this,"_waitForIframe");a(this,"_container");a(this,"_configuratorSettings");a(this,"_initData",{});a(this,"_iframe");if(!t||typeof t.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(x.has(s))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(Z)){const h=n.zIndex||9999999,d=document.createElement("style");d.type="text/css",d.id=Z;const g="transition:all ease-in-out "+xt+"ms;",f=["-webkit-","-o-"].reduce((E,y)=>E+=y+g,"")+g,S=j();d.innerHTML=`
1
+ (function(_,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(_=typeof globalThis<"u"?globalThis:_||self,_["roomle-embedding-lib"]=_["roomle-embedding-lib"]||{},_["roomle-embedding-lib"].umd=_["roomle-embedding-lib"].umd||{},_["roomle-embedding-lib"].umd.js=p())})(this,function(){"use strict";var ee=Object.defineProperty;var se=(_,p,E)=>p in _?ee(_,p,{enumerable:!0,configurable:!0,writable:!0,value:E}):_[p]=E;var a=(_,p,E)=>se(_,typeof p!="symbol"?p+"":p,E);class _{constructor(e,t,s,n){a(this,"_side");a(this,"_incomingMessageBus",null);a(this,"_outgoingMessageBus",null);a(this,"_execMessage",null);this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=n,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,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=c=>{if(!c||!c.data)return i.port1.close(),i.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let l;try{l=JSON.parse(c.data)}catch(d){return i.port1.close(),i.port2.close(),this._prepareError(d),n(d)}l.error?n(l.error):l.result!==void 0?s(l.result):s(void 0),i.port1.close(),i.port2.close()};let o="";try{o=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(o,"*",[i.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 n=this._execMessage(s,e);if(n===void 0)return;n.then((i={})=>{let o,c;typeof i=="object"&&i!==null&&(o=i.error,c=i.result),o?t.postMessage(JSON.stringify({error:o})):c!==void 0?t.postMessage(JSON.stringify({result:c})):t.postMessage(JSON.stringify({result:i}))},i=>{t.postMessage(JSON.stringify({error:this._prepareError(i)}))})}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 p=".",E={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},w={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},pt=async(r,e)=>{if(typeof r!="string")throw new Error('Configurator ID is not a string type: "'+typeof r+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",s=e.overrideTenant||9,n=t+"/configurators/"+r,i="roomle_portal_v2",o="03-"+window.btoa(new Date().toISOString()+";anonymous;"+i),c=()=>{const u={apiKey:i,currentTenant:s,locale:"en",language:"en",device:1,token:o,platform:"web"};return new Headers(u)},l=new Request(n,{method:"GET",headers:c(),mode:"cors",cache:"default"}),d=await fetch(l),{configurator:h}=await d.json();return h},yt=()=>{try{return window.self!==window.top}catch{return!0}},Et=["127.0.0.1","localhost","0.0.0.0"],Dt=()=>{const r=yt();let e=window.location.href;if(r){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},Tt=r=>!!(Et.includes(r)||r.endsWith("roomle.com")||r.endsWith("gitlab.io")||r.endsWith("gitlab.com")),k=["language","browserLanguage","userLanguage","systemLanguage"],St=(r=null)=>{const e=window.navigator;if(r)return r.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,s=k.length;t<s;t++){const n=e[k[t]];if(n)return n.substr(0,2)}return"en"},It=(r,e)=>{const t=JSON.parse(JSON.stringify(r));return C(t,e)},C=(r,e)=>{for(const t in e)try{e[t].constructor===Object?r[t]=C(r[t],e[t]):r[t]=e[t]}catch{r[t]=e[t]}return r};var z=(r=>(r.BOTTOM_BAR="bottom_bar",r.PARTLIST_BOUNDS="partlist_bounds",r.INTERACTION_NOTES="interaction_notes",r.PARAMETER_GROUPS="parameter_groups",r))(z||{});const wt=r=>JSON.parse(JSON.stringify(r));var At={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const bt={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[z.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},Ot="(idle)",vt=r=>(L(r),r!=null&&r.customApiUrl&&(r.customApiUrl=decodeURIComponent(r.customApiUrl)),r.shareUrl&&(r.deeplink=r.shareUrl.replace(Ct,Lt)),r),L=r=>{if(!r)return;const e=Object.keys(r);for(const t of e){const s=r[t];if(!Array.isArray(s)&&typeof s=="object"&&s!==null&&L(s),Array.isArray(s))for(const n of s)L(n);(s==="true"||s==="false")&&(r[t]=s==="true")}},Rt=(r,e)=>{e.configuratorId=r.id;const t=r.settings||{};return!e.overrideTenant&&r.tenant&&(e.overrideTenant=r.tenant),It(t,e)},Mt=()=>{const r=wt(bt);r.locale||(r.locale=St()),r.id===Ot&&delete r.id;const e=Dt();return e&&Tt(e)&&(r.configuratorId="demoConfigurator"),r.customApiUrl=At.VITE_RAPI_URL,r.emails=!1,r},Ct="<CONF_ID>",Lt="#CONFIGURATIONID#",Nt=r=>{r.featureFlags||(r.featureFlags={}),typeof r.featureFlags.realPartList!="boolean"&&(r.featureFlags.realPartList=!0),typeof r.featureFlags.globalCallbacks!="boolean"&&(r.featureFlags.globalCallbacks=!0),typeof r.featureFlags.mocAr!="boolean"&&(r.featureFlags.mocAr=!1)},V=()=>/(android)/i.test(navigator.userAgent);class q{constructor(){a(this,"_messageHandler",null);a(this,"isSetupDone",!1);a(this,"viewName","main");a(this,"plugins",{});a(this,"pluginsLoaded",[]);a(this,"ui",{callbacks:null});a(this,"extended",{callbacks:null});a(this,"configurator",{callbacks:null});a(this,"analytics",{callbacks:{}});a(this,"rapi",{callbacks:{}});a(this,"global",{callbacks:{}})}setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(n=>{const i=n.split(p),o=i[0],c=i[1];this[o]||(this[o]={}),this[o][c]=(function(){if(!this._messageHandler){console.error("MessageHandler not set");return}return this._messageHandler.sendMessage(n,[...arguments])}).bind(this)}),s.forEach(n=>{const i=n.split(p),o=i[0],c=i[1],l=i[2];this[o]||(this[o]={}),this[o][c]||(this[o][c]={}),this[o][c][l]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split(p),n=s[0],i=s[1],o=s.length===3?s[2]:null;if(o&&this[n][i][o]){const c=this[n][i][o](...t);return c instanceof Promise?c.then(l=>({result:l})):c!==void 0?Promise.resolve({result:c}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const n of e)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((i,o)=>{try{Promise.resolve().then(()=>Ht).then(({DragIn:c})=>{const l=new c(this.ui,t,s,this.viewName);l.init().then(()=>{this.plugins.dragIn=l,i()},o)})}catch(c){o(c)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((i,o)=>{try{n.loader().then(c=>{const l=new c(this.ui,t,s,this.viewName);l.init().then(()=>{this.plugins[n.name]=l,i()},o)})}catch(c){o(c)}}))}}const K=()=>{let r,e;return{promise:new Promise((s,n)=>{r=s,e=n}),resolve:r,reject:e}},J=(r,e,t)=>{let s=null;Object.defineProperty(r,e,{get(){return s||t},set(n){n!=null&&n.mute?s=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 }"),s=n)}})},j=()=>window.innerHeight*.01+"px",Q=r=>{r&&setTimeout(()=>r.style.setProperty(N,j()),0)},Z="rml-styles",xt=450,N="--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"},x=new Map;class Gt extends q{constructor(t,s,n,i,o){super();a(this,"_waitForIframe");a(this,"_container");a(this,"_configuratorSettings");a(this,"_initData",{});a(this,"_iframe");if(!t||typeof t.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(x.has(s))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(Z)){const h=n.zIndex||9999999,u=document.createElement("style");u.type="text/css",u.id=Z;const g="transition:all ease-in-out "+xt+"ms;",f=["-webkit-","-o-"].reduce((D,y)=>D+=y+g,"")+g,S=j();u.innerHTML=`
2
2
  .${m.CONTAINER}{${N}:${S};}
3
3
  .${m.POSITION}{position:fixed;top:0;left:0;z-index:${h};opacity:0}
4
4
  .${m.TRANSITION}{${f}}
5
5
  .${m.FILL}{width:100%;height:100%;opacity:1}
6
6
  .${m.ANDROID_HEIGHT}{height:calc(var(${N},1vh)*100)}
7
7
  .${m.OVERFLOW_HIDDEN}{overflow:hidden}
8
- `,document.head.appendChild(d)}this._executeMessage=this._executeMessage.bind(this);const l=new _("website",window,null,this._executeMessage);this.setMessageHandler(l),this._onResize=this._onResize.bind(this),V()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=n,this._configuratorSettings=t;const u=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=o,this._container.appendChild(u),this._iframe=u,this.setupPlugins(i,this._iframe),x.set(s,!0)}static createPlanner(t,s,n,i=[]){return this._create(t,s,n,i)}static async connect(t,s=[]){const n=new q;n.viewName=t;const{resolve:i,promise:o}=K(),{resolve:c,promise:l}=K(),u=({message:g,args:f})=>{switch(g){case w.REGISTER_CUSTOM_VIEW_DONE:i();break;case w.RETURN_METHODS:n.handleSetup(f[0]),c();break;default:if(n.isSetupDone)return n.executeMessage({message:g,args:f})}},h=new _("custom-view-"+t,window,window.parent,u);n.setMessageHandler(h);const d=[t];return h.sendMessage(w.REGISTER_CUSTOM_VIEW,d),await o,h.sendMessage(w.GET_METHODS,d),await l,n.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(n.pluginsLoaded),n}static createConfigurator(t,s,n,i=[]){return this._create(t,s,n,i)}static create(t,s,n,i){return this._create(t,s,n,i)}static createViewer(t,s,n,i=[]){return this._create(t,s,n,i)}static async _create(t,s,n,i){return new Promise(async(o,c)=>{try{const l=C(Mt(),vt(n));Nt(l);const u=await pt(t,l);n=Rt(u,l);const h=new this(u,s,n,i,o);return await Promise.allSettled(h.pluginsLoaded),h}catch(l){return c(l)}})}teardown(){this._container&&x.delete(this._container);const t=this._container.querySelector("iframe");t&&this._container.removeChild(t),window.removeEventListener("resize",this._onResize)}_createIframe(){var n;const t=document.createElement("iframe");let s=((n=this._configuratorSettings)==null?void 0:n.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(){Q(this._iframe)}_onUseFullPage(){this._iframe.classList.add(m.POSITION),document.documentElement.classList.add(m.OVERFLOW_HIDDEN),window.document.body.classList.add(m.OVERFLOW_HIDDEN),V()&&(Q(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:t,args:s},n){var i;if(n.source&&n.source===((i=this._iframe)==null?void 0:i.contentWindow))return t===D.REQUEST_BOOT?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(n.source),Promise.resolve({result:this._initData})):(console.error("MessageHandler not set"),Promise.resolve({error:"MessageHandler not set"})):t===D.SETUP?(this.handleSetup(s[0]),J(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),J(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{if(!this._messageHandler){console.error("MessageHandler not set");return}this._messageHandler.sendMessage(D.WEBSITE_READY)},0),Promise.resolve({result:null})):this.executeMessage({message:t,args:s})}}class Ft{constructor(e,t,s,n){a(this,"_mainDomElement");a(this,"_instance");a(this,"_mode","website");a(this,"_viewName","main");this._instance=e,this._mainDomElement=t,this._mode=s,this._viewName=n}async init(){return Promise.resolve()}}const A="rml-drag-in-styles",b="rml-drag-in-drag-element",O="rml-drag-in-overlay",v="rml-drag-in-drag-ghost",tt="rml-drag-in-fade-in",et="rml-drag-in-fade-out",G={DISPLAY_NONE:"rml-display-none"},st=.5,rt="250ms",nt="forwards",it=`@keyframes ${tt} {from{opacity: 0;}to {opacity: ${st};}}`,ot=`@keyframes ${et} {from{opacity: ${st};}to {opacity: 0;}}`,at=`${tt} ${rt} ${nt}`,ct=`${et} ${rt} ${nt}`,R="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",F=112,P=112;class Pt extends Ft{constructor(t,s,n,i){super(t,s,n,i);a(this,"options",{});a(this,"_customDragSignal",new AbortController);this._mainDomElement=s,this._injectStyles(),this._initializeDragGhost()}_injectStyles(){if(!!!document.getElementById(A)){const s=document.createElement("style");s.type="text/css",s.id=A,s.innerHTML=`
8
+ `,document.head.appendChild(u)}this._executeMessage=this._executeMessage.bind(this);const l=new _("website",window,null,this._executeMessage);this.setMessageHandler(l),this._onResize=this._onResize.bind(this),V()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=n,this._configuratorSettings=t;const d=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=o,this._container.appendChild(d),this._iframe=d,this.setupPlugins(i,this._iframe),x.set(s,!0)}static createPlanner(t,s,n,i=[]){return this._create(t,s,n,i)}static async connect(t,s=[]){const n=new q;n.viewName=t;const{resolve:i,promise:o}=K(),{resolve:c,promise:l}=K(),d=({message:g,args:f})=>{switch(g){case w.REGISTER_CUSTOM_VIEW_DONE:i();break;case w.RETURN_METHODS:n.handleSetup(f[0]),c();break;default:if(n.isSetupDone)return n.executeMessage({message:g,args:f})}},h=new _("custom-view-"+t,window,window.parent,d);n.setMessageHandler(h);const u=[t];return h.sendMessage(w.REGISTER_CUSTOM_VIEW,u),await o,h.sendMessage(w.GET_METHODS,u),await l,n.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(n.pluginsLoaded),n}static createConfigurator(t,s,n,i=[]){return this._create(t,s,n,i)}static create(t,s,n,i){return this._create(t,s,n,i)}static createViewer(t,s,n,i=[]){return this._create(t,s,n,i)}static async _create(t,s,n,i){return new Promise(async(o,c)=>{try{const l=C(Mt(),vt(n));Nt(l);const d=await pt(t,l);n=Rt(d,l);const h=new this(d,s,n,i,o);return await Promise.allSettled(h.pluginsLoaded),h}catch(l){return c(l)}})}teardown(){this._container&&x.delete(this._container);const t=this._container.querySelector("iframe");t&&this._container.removeChild(t),window.removeEventListener("resize",this._onResize)}_createIframe(){var n;const t=document.createElement("iframe");let s=((n=this._configuratorSettings)==null?void 0:n.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(){Q(this._iframe)}_onUseFullPage(){this._iframe.classList.add(m.POSITION),document.documentElement.classList.add(m.OVERFLOW_HIDDEN),window.document.body.classList.add(m.OVERFLOW_HIDDEN),V()&&(Q(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:t,args:s},n){var i;if(n.source&&n.source===((i=this._iframe)==null?void 0:i.contentWindow))return t===E.REQUEST_BOOT?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(n.source),Promise.resolve({result:this._initData})):(console.error("MessageHandler not set"),Promise.resolve({error:"MessageHandler not set"})):t===E.SETUP?(this.handleSetup(s[0]),J(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),J(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{if(!this._messageHandler){console.error("MessageHandler not set");return}this._messageHandler.sendMessage(E.WEBSITE_READY)},0),Promise.resolve({result:null})):this.executeMessage({message:t,args:s})}}class Ft{constructor(e,t,s,n){a(this,"_mainDomElement");a(this,"_instance");a(this,"_mode","website");a(this,"_viewName","main");this._instance=e,this._mainDomElement=t,this._mode=s,this._viewName=n}async init(){return Promise.resolve()}}const A="rml-drag-in-styles",b="rml-drag-in-drag-element",O="rml-drag-in-overlay",v="rml-drag-in-drag-ghost",tt="rml-drag-in-fade-in",et="rml-drag-in-fade-out",G={DISPLAY_NONE:"rml-display-none"},st=.5,rt="250ms",nt="forwards",it=`@keyframes ${tt} {from{opacity: 0;}to {opacity: ${st};}}`,ot=`@keyframes ${et} {from{opacity: ${st};}to {opacity: 0;}}`,at=`${tt} ${rt} ${nt}`,ct=`${et} ${rt} ${nt}`,R="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",F=112,P=112;class Pt extends Ft{constructor(t,s,n,i){super(t,s,n,i);a(this,"options",{});a(this,"_customDragSignal",new AbortController);this._mainDomElement=s,this._injectStyles(),this._initializeDragGhost()}_injectStyles(){if(!!!document.getElementById(A)){const s=document.createElement("style");s.type="text/css",s.id=A,s.innerHTML=`
9
9
  .${G.DISPLAY_NONE}{display:none}
10
10
  .${O}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}
11
11
  .${v}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}
12
12
  ${it}
13
13
  ${ot}
14
- `,document.head.appendChild(s)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let s=t.querySelector("."+v);s||(s=document.createElement("div"),s.classList.add(v),s.innerText=" ",t.appendChild(s))}async init(){if(await super.init(),this._mode==="website")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 console.error('Could not load Dragin strategy "FromWebsite"'),t}else if(this._mode==="custom-view")try{const{DragInFromCustomViewStrategy:t}=await Promise.resolve().then(()=>te);this._strategy=new t(this._instance,this.options,this._viewName)}catch(t){throw console.error('Could not load Dragin strategy "FromCustomView"'),t}else throw new Error("Unsupported mode")}get isDragging(){return this._strategy.isDragging}dragStart(t,s,n="rml_id"){this._strategy.dragStart(t,s,n)}dragUpdate(t){this._strategy.dragUpdate(t)}dragEnd(){this._strategy.dragEnd()}touchStart(t,s,n="rml_id"){this._strategy.touchStart(t,s,n)}touchMove(t){this._strategy.touchMove(t)}touchEnd(){this._strategy.touchEnd()}dispose(){this._strategy.dispose()}beforeUpdateGhost(t){this._strategy.beforeUpdateGhost(t)}registerCustomDrag({customDragStart:t,customDragEnd:s,customDragUpdate:n,beforeUpdateGhost:i}){i&&this._strategy.beforeUpdateGhost(i);const o=this._customDragSignal.signal,c=h=>{h.target.getAttribute("data-rml-draggable")==="true"&&t(h)},l=h=>{this._strategy.releaseInput(h),this._strategy.isDragging&&s(h)},u=h=>{n(h)};document.querySelectorAll('[data-rml-draggable="true"]').forEach(h=>{h.draggable=!1}),document.addEventListener("mousedown",c,{signal:o}),document.addEventListener("mouseup",l,{signal:o}),document.addEventListener("mousemove",u,{signal:o}),document.addEventListener("mouseleave",l,{signal:o}),document.addEventListener("touchstart",c,{signal:o}),document.addEventListener("touchend",l,{signal:o}),document.addEventListener("touchmove",u,{signal:o})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}const Ht=Object.freeze(Object.defineProperty({__proto__:null,DragIn:Pt},Symbol.toStringTag,{value:"Module"}));class Ut{constructor(e=16){a(this,"_computedStyleCache",new Map);a(this,"_maxLifetime",16);a(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 n=getComputedStyle(e);return this._computedStyleCache.set(e,{style:n,updated:s}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(this._maxLifetime*1e3,5e3))),n}_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 T=r=>window.TouchEvent&&r instanceof window.TouchEvent;let H;const M=r=>(H||(H=new Ut),H.get(r)),lt=(r,e,t)=>{const s=parseFloat(r),n=window.devicePixelRatio||1;if(e==="px")return s;if(e==="%"){const o=t===document.documentElement?window.innerWidth:t.offsetWidth;return s/100*o}if(e==="rem"){const o=parseFloat(M(document.documentElement).fontSize);return s*o}if(e==="em"){const o=parseFloat(M(t).fontSize);return s*o}if(e==="vh"||e==="vw"||e==="vmin"||e==="vmax"){const o={vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)};return s/100*o[e]}const i={cm:37.7952755906,mm:3.77952755906,in:96};return e in i?s*i[e]*n:(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)},ht=(r,e,t={x:0,y:0})=>{const s=r.getBoundingClientRect(),i=M(r).transform;let o=0,c=0;if(i!=="none"){const g=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,f=i.match(g);f&&(o=lt(f[1],f[2],r),c=lt(f[3],f[4],r))}const{clientX:l,clientY:u}=I(e,t),h=l-s.left-o+r.scrollLeft,d=u-s.top-c+r.scrollTop;return{x:h,y:d}},I=(r,e=null)=>{const{clientX:t,clientY:s}=T(r)?Bt(r):r,n=t>0?t:e?e.x:t,i=s>0?s:e?e.y:s;return{clientX:n,clientY:i}},Bt=r=>{if(r.touches.length){let{clientX:t,clientY:s}=r.touches[0];if(r.touches.length>1){const n=r.touches[1],i=n.clientX,o=n.clientY;t=(t+i)/2,s=(s+o)/2}return{clientX:t,clientY:s}}const e=r.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},U=500,B=10,Yt=100,ut=15,Y=(r,e=0)=>T(r)?{clientX:r.touches[e].clientX,clientY:r.touches[e].clientY}:{clientX:r.clientX,clientY:r.clientY},dt=r=>r&&T(r)?r.touches.length>0:!0;class gt{constructor(e,{onTouchDragStart:t},s={}){a(this,"_touchDragTimeOut");a(this,"_onTouchDragStart");a(this,"_payload",null);a(this,"_delay",U);a(this,"_firstTouch",null);a(this,"_lastTouch",null);a(this,"_epsilon",B);this._payload=e,this._onTouchDragStart=t,this._delay=typeof s.delay=="number"?s.delay:U,this._epsilon=typeof s.epsilon=="number"?s.epsilon:B}onStart(e){dt(e)&&(this._touchDragTimeOut||(this._firstTouch=Y(e,T(e)?e.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=Y(e)),this._checkXDistance(e)()},this._delay)))}onEnd(){this._resetTouches()}onMove(e){dt(e)&&(this._lastTouch=Y(e))}_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 _t=(r,e,t=0,s=0)=>{const n=e.x+e.width+t,i=e.x-t,o=e.y+e.height+s,c=e.y-s,{x:l,y:u}=r;return l>=i&&l<=n&&u>=c&&u<=o},mt=(r,e,t,s=0,n=0)=>{if(!(!t||!t.hiddenIn&&!t.visibleIn))return t.visibleIn?_t({x:r,y:e},t.visibleIn,s,n):t.hiddenIn?!_t({x:r,y:e},t.hiddenIn,-s,-n):!1},Xt=()=>{if(!!!document.getElementById(A)){const e=document.createElement("style");e.type="text/css",e.id=A,e.innerHTML=`
14
+ `,document.head.appendChild(s)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let s=t.querySelector("."+v);s||(s=document.createElement("div"),s.classList.add(v),s.innerText=" ",t.appendChild(s))}async init(){if(await super.init(),this._mode==="website")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 console.error('Could not load Dragin strategy "FromWebsite"'),t}else if(this._mode==="custom-view")try{const{DragInFromCustomViewStrategy:t}=await Promise.resolve().then(()=>te);this._strategy=new t(this._instance,this._mainDomElement,this.options,this._viewName)}catch(t){throw console.error('Could not load Dragin strategy "FromCustomView"'),t}else throw new Error("Unsupported mode")}get isDragging(){return this._strategy.isDragging}dragStart(t,s,n="rml_id"){this._strategy.dragStart(t,s,n)}dragUpdate(t){this._strategy.dragUpdate(t)}dragEnd(){this._strategy.dragEnd()}touchStart(t,s,n="rml_id"){this._strategy.touchStart(t,s,n)}touchMove(t){this._strategy.touchMove(t)}touchEnd(){this._strategy.touchEnd()}dispose(){this._strategy.dispose()}beforeUpdateGhost(t){this._strategy.beforeUpdateGhost(t)}registerCustomDrag({customDragStart:t,customDragEnd:s,customDragUpdate:n,beforeUpdateGhost:i}){i&&this._strategy.beforeUpdateGhost(i);const o=this._customDragSignal.signal,c=h=>{h.target.getAttribute("data-rml-draggable")==="true"&&t(h)},l=h=>{this._strategy.releaseInput(h),this._strategy.isDragging&&s(h)},d=h=>{n(h)};document.querySelectorAll('[data-rml-draggable="true"]').forEach(h=>{h.draggable=!1}),document.addEventListener("mousedown",c,{signal:o}),document.addEventListener("mouseup",l,{signal:o}),document.addEventListener("mousemove",d,{signal:o}),document.addEventListener("mouseleave",l,{signal:o}),document.addEventListener("touchstart",c,{signal:o}),document.addEventListener("touchend",l,{signal:o}),document.addEventListener("touchmove",d,{signal:o})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}const Ht=Object.freeze(Object.defineProperty({__proto__:null,DragIn:Pt},Symbol.toStringTag,{value:"Module"}));class Ut{constructor(e=16){a(this,"_computedStyleCache",new Map);a(this,"_maxLifetime",16);a(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 n=getComputedStyle(e);return this._computedStyleCache.set(e,{style:n,updated:s}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(this._maxLifetime*1e3,5e3))),n}_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 T=r=>window.TouchEvent&&r instanceof window.TouchEvent;let H;const M=r=>(H||(H=new Ut),H.get(r)),lt=(r,e,t)=>{const s=parseFloat(r),n=window.devicePixelRatio||1;if(e==="px")return s;if(e==="%"){const o=t===document.documentElement?window.innerWidth:t.offsetWidth;return s/100*o}if(e==="rem"){const o=parseFloat(M(document.documentElement).fontSize);return s*o}if(e==="em"){const o=parseFloat(M(t).fontSize);return s*o}if(e==="vh"||e==="vw"||e==="vmin"||e==="vmax"){const o={vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)};return s/100*o[e]}const i={cm:37.7952755906,mm:3.77952755906,in:96};return e in i?s*i[e]*n:(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)},ht=(r,e,t={x:0,y:0})=>{const s=r.getBoundingClientRect(),i=M(r).transform;let o=0,c=0;if(i!=="none"){const g=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,f=i.match(g);f&&(o=lt(f[1],f[2],r),c=lt(f[3],f[4],r))}const{clientX:l,clientY:d}=I(e,t),h=l-s.left-o+r.scrollLeft,u=d-s.top-c+r.scrollTop;return{x:h,y:u}},I=(r,e=null)=>{const{clientX:t,clientY:s}=T(r)?Bt(r):r,n=t>0?t:e?e.x:t,i=s>0?s:e?e.y:s;return{clientX:n,clientY:i}},Bt=r=>{if(r.touches.length){let{clientX:t,clientY:s}=r.touches[0];if(r.touches.length>1){const n=r.touches[1],i=n.clientX,o=n.clientY;t=(t+i)/2,s=(s+o)/2}return{clientX:t,clientY:s}}const e=r.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},U=500,B=10,Yt=100,dt=15,Y=(r,e=0)=>T(r)?{clientX:r.touches[e].clientX,clientY:r.touches[e].clientY}:{clientX:r.clientX,clientY:r.clientY},ut=r=>r&&T(r)?r.touches.length>0:!0;class gt{constructor(e,{onTouchDragStart:t},s={}){a(this,"_touchDragTimeOut");a(this,"_onTouchDragStart");a(this,"_payload",null);a(this,"_delay",U);a(this,"_firstTouch",null);a(this,"_lastTouch",null);a(this,"_epsilon",B);this._payload=e,this._onTouchDragStart=t,this._delay=typeof s.delay=="number"?s.delay:U,this._epsilon=typeof s.epsilon=="number"?s.epsilon:B}onStart(e){ut(e)&&(this._touchDragTimeOut||(this._firstTouch=Y(e,T(e)?e.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=Y(e)),this._checkXDistance(e)()},this._delay)))}onEnd(){this._resetTouches()}onMove(e){ut(e)&&(this._lastTouch=Y(e))}_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 _t=(r,e,t=0,s=0)=>{const n=e.x+e.width+t,i=e.x-t,o=e.y+e.height+s,c=e.y-s,{x:l,y:d}=r;return l>=i&&l<=n&&d>=c&&d<=o},mt=(r,e,t,s=0,n=0)=>{if(!(!t||!t.hiddenIn&&!t.visibleIn))return t.visibleIn?_t({x:r,y:e},t.visibleIn,s,n):t.hiddenIn?!_t({x:r,y:e},t.hiddenIn,-s,-n):!1},Xt=()=>{if(!!!document.getElementById(A)){const e=document.createElement("style");e.type="text/css",e.id=A,e.innerHTML=`
15
15
  ${it}
16
16
  ${ot}
17
- `,document.head.appendChild(e)}},Wt=({x:r,y:e},t)=>{var n,i,o,c,l,u;let s=document.getElementById(b);if(!s){if(s=document.createElement("div"),(n=t.ghost)!=null&&n.element)s.appendChild(t.ghost.element);else{const h=document.createElement("img");h.src=((i=t.ghost)==null?void 0:i.url)||R,h.width=((o=t.ghost)==null?void 0:o.width)||F,h.height=((c=t.ghost)==null?void 0:c.height)||P,s.appendChild(h)}s.id=b,s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.willChange="transform",s.style.transform="translate3d(0, 0, 0)",s.style.zIndex="9999",s.style.opacity="0.5",mt(r,e,t.ghost||{},(l=t.settings)==null?void 0:l.dragInOverlapX,(u=t.settings)==null?void 0:u.dragInOverlapY)||(s.style.display="none"),s.style.pointerEvents="none",document.body.appendChild(s)}},$t=({x:r,y:e},t)=>{var l,u,h,d;const s=document.getElementById(b);if(!s)return;let n=(l=t.ghost)==null?void 0:l.width,i=(u=t.ghost)==null?void 0:u.height;typeof n>"u"&&(n=s.getBoundingClientRect().width||F),typeof i>"u"&&(i=s.getBoundingClientRect().height||P);const o=r-n/2,c=e-i/2;s.style.transform=`translate3d(${o}px, ${c}px, 0)`,t.ghost&&(mt(r,e,t.ghost,(h=t.settings)==null?void 0:h.dragInOverlapX,(d=t.settings)==null?void 0:d.dragInOverlapY)?s.style.animation!=at&&(s.style.animation=at):s.style.animation!=ct&&(s.style.animation=ct))};class kt{constructor(e=null){a(this,"_dragGhostAnimationFrameId",null);a(this,"_dragGhostRemoveAnimationFrameId",null);a(this,"_dragGhostElement",null);this._dragGhostElement=e}updateDragGhost(e,t,s){var n;this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!((n=s.ghost)!=null&&n.external)&&s.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{Xt();const i={x:e,y:t};!s.ghost&&this._dragGhostElement&&(s.ghost={}),s.ghost&&!s.ghost.element&&this._dragGhostElement&&(s.ghost.element=this._dragGhostElement),Wt(i,s),$t(i,s),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const e=document.getElementById(b);e&&document.body.removeChild(e),this._dragGhostRemoveAnimationFrameId=null}))}}class zt{constructor(e,t,s){a(this,"_options",{});a(this,"_instance");a(this,"_mainDomElement");a(this,"_currentDrag",{});a(this,"_currentTouch",null);a(this,"_firefoxDragPosition",{x:0,y:0});a(this,"_onBeforeUpdateDrag",()=>({}));a(this,"isDragging",!1);a(this,"_firefoxFallback",e=>{if(!this._currentDrag.event)return;e.preventDefault();const t=e||window.event;this._firefoxDragPosition.x=t.pageX||0,this._firefoxDragPosition.y=t.pageY||0});this._instance=e,this._mainDomElement=t,this._options=s||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback)}beforeUpdateGhost(e){this._onBeforeUpdateDrag=e}dragStart(e,t,s="rml_id"){const n=this._mainDomElement.parentNode;if(M(n).position!=="relative"){console.warn("Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly");return}this._mainDomElement.style.pointerEvents="none";let o=n.querySelector("."+O);o||(o=document.createElement("div"),o.classList.add(O),n.appendChild(o)),o.classList.remove(G.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 l=n.querySelector("."+v);this._currentDrag.event=t;const u=t.target,h=u.cloneNode(!0),d=u.getBoundingClientRect();h.style.width=`${d.width}px`,h.style.height=`${d.height}px`,this._currentDrag.ghost=new kt(h),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:g,clientY:f}=I(t,this._firefoxDragPosition);this._currentDrag.offset.x=g-d.left,this._currentDrag.offset.y=f-d.top,t instanceof DragEvent&&t.dataTransfer&&t.dataTransfer.setDragImage&&t.dataTransfer.setDragImage(l,0,0);const{x:S,y:E}=ht(n,this._currentDrag.event||t,this._firefoxDragPosition),y=Math.max(1,S),$=Math.max(1,E);this.isDragging=!0,this._instance.dragInObject(e,y,$,s)}dragUpdate(e){var E;const t=this._mainDomElement.parentNode,{x:s,y:n}=ht(t,e,this._firefoxDragPosition);if(s===0&&n===0)return;const i=Math.max(1,s),o=Math.max(1,n);if(i===1&&o===1)return;let c=i,l=o;if(T(e)){const y=((E=this._options.settings)==null?void 0:E.fingerSize)||0;c=Math.max(2,i+y),l=Math.max(2,o-y)}const{x:u,y:h,options:d}=this._onBeforeUpdateDrag(c,l,{}),g=d||{settings:{},ghost:{}};g.ghost||(g.ghost={}),g.ghost.visibleIn&&g.ghost.hiddenIn||(g.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const f=typeof u=="number"?u:c,S=typeof h=="number"?h:l;if(this._currentDrag.ghost){const{clientX:y,clientY:$}=I(e,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(y,$,g)}this._instance.updateDrag(f,S,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const e=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 t=e.querySelector("."+O);t&&t.classList.add(G.DISPLAY_NONE)}touchStart(e,t,s="rml_id"){var o,c,l,u;t.preventDefault();const n=(h,d)=>{this.dragStart(e,d,s)},i={};typeof((c=(o=this._options)==null?void 0:o.settings)==null?void 0:c.touchDragDelay)=="number"&&(i.delay=this._options.settings.touchDragDelay),(u=(l=this._options)==null?void 0:l.settings)!=null&&u.touchDragEpsilon&&(i.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new gt(void 0,{onTouchDragStart:n},i),this._currentTouch.onStart(t)}touchMove(e){this._currentTouch&&this._currentTouch.onMove(e),this._currentDrag.event&&this.dragUpdate(e)}touchEnd(){this._currentTouch&&this._currentTouch.onEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(e){}}const Vt=Object.freeze(Object.defineProperty({__proto__:null,DragInFromWebsiteStrategy:zt},Symbol.toStringTag,{value:"Module"})),qt=r=>`[data-rml-custom-view="${r}"]`,X=r=>{r.preventDefault(),r.stopPropagation()},Kt=(r,e,t,s)=>{const n=t-r,i=s-e;return Math.sqrt(n*n+i*i)};class Jt{constructor({onCustomDragStart:e},t={}){a(this,"_startX",0);a(this,"_startY",0);a(this,"_lastX",0);a(this,"_lastY",0);a(this,"_epsilon");a(this,"_isWaiting",!1);a(this,"_onCustomDragStart");this._epsilon=typeof t.epsilon=="number"?t.epsilon:ut,this._onCustomDragStart=e}onMove(e){this._lastX=e.clientX,this._lastY=e.clientY,this._isWaiting&&Kt(this._startX,this._startY,this._lastX,this._lastY)>this._epsilon&&(this._onCustomDragStart(e),this._isWaiting=!1)}onStart(e){this._startX=e.clientX,this._startY=e.clientY,this.onMove(e),this._isWaiting=!0}onEnd(){this._reset()}_reset(){this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this._isWaiting=!1}}const W="data-rml-old-draggable",jt=void 0,ft=(r,e)=>{const t=T(r),s={delay:t?U:Yt,epsilon:t?B:ut};if(!e)return s;if(!t&&!(r instanceof MouseEvent))return console.warn("Unsupported event! It is not TouchEvent and also not MouseEvent"),s;const{delayKey:n,epsilonKey:i}=t?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return typeof e[n]=="number"&&(s.delay=e.touchDragDelay),typeof e[i]=="number"&&(s.epsilon=e.touchDragEpsilon),s},Qt=r=>{let e="",t=F,s=P;if(!r)return{url:R,width:t,height:s};const n=r;if(n instanceof HTMLElement){const i=n.getBoundingClientRect(),o=n.getAttribute("data-rml-ghost-url"),c=n.getAttribute("data-rml-ghost-width"),l=n.getAttribute("data-rml-ghost-height");o?e=o:!o&&n instanceof HTMLImageElement&&n.src&&(e=n.src),e?(t=i.width,s=i.height):e=R,t=c?parseInt(c,10):t,s=l?parseInt(l,10):s}return{url:e||R,width:t,height:s}};class Zt{constructor(e,t,s){a(this,"_options",{});a(this,"_instance");a(this,"_viewName");a(this,"_currentCustomDrag",null);a(this,"_currentBb",null);a(this,"_startTarget",null);a(this,"_onBeforeUpdateDrag",()=>({}));a(this,"isDragging",!1);this._instance=e,this._options=t||{},this._viewName=s}beforeUpdateGhost(e){this._onBeforeUpdateDrag=e}async _dragStart(e,t,s="rml_id"){this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(W,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",X),this._startTarget.addEventListener("dragstart",X)),this._currentBb=await this._instance.getBoundingClientRect(qt(this._viewName));const{clientX:n,clientY:i}=I(t),o=this._currentBb.x+n,c=this._currentBb.y+i;this.isDragging=!0,this._instance.dragInObject(e,o,c,s)}_dragUpdate(e){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(e),!this._currentBb||!this.isDragging)return;const{clientX:t,clientY:s}=I(e),{url:n,width:i,height:o}=Qt(this._startTarget),c=this._currentBb.x+t,l=this._currentBb.y+s,u=this._options||{},h={ghost:{visibleIn:{x:this._currentBb.x-(u.dragInOverlapX||0),y:this._currentBb.y+(u.dragInOverlapY||0),width:this._currentBb.width+(u.dragInOverlapX||0),height:this._currentBb.height+(u.dragInOverlapY||0)},url:n,width:i,height:o},mode:"custom-view"},{x:d,y:g,options:f}=this._onBeforeUpdateDrag(c,l,h),S=typeof d=="number"?d:c,E=typeof g=="number"?g:l,y=f||h;this._instance.updateDrag(S,E,y)}_dragEnd(){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._currentCustomDrag=null,this.isDragging=!1,this._currentBb=null,this._resetStartTarget(),this._instance.enableEvents(),this._instance.dragInObjectEnd()}dragStart(e,t,s){this._instance.disableEvents(),this._startTarget=t.target;const n=(i,o)=>{this._dragStart(e,o,s)};this._currentCustomDrag=T(t)?new gt(jt,{onTouchDragStart:n},ft(t,this._options)):new Jt({onCustomDragStart:i=>this._dragStart(e,i,s)},ft(t,this._options)),this._currentCustomDrag.onStart(t)}dragEnd(){this._dragEnd()}dragUpdate(e){this._dragUpdate(e)}touchStart(e,t,s="rml_id"){this.dragStart(e,t,s)}touchMove(e){this.dragUpdate(e)}touchEnd(){this.dragEnd()}dispose(){}_resetStartTarget(){this._startTarget&&(this._startTarget.style.pointerEvents="",this._startTarget.style.userSelect="",this._startTarget.draggable=this._startTarget.getAttribute(W)==="true",this._startTarget.removeAttribute(W),this._startTarget.removeEventListener("dragstart",X))}releaseInput(e){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}const te=Object.freeze(Object.defineProperty({__proto__:null,DragInFromCustomViewStrategy:Zt},Symbol.toStringTag,{value:"Module"}));return Gt});
17
+ `,document.head.appendChild(e)}},Wt=({x:r,y:e},t)=>{var n,i,o,c,l,d;let s=document.getElementById(b);if(!s){if(s=document.createElement("div"),(n=t.ghost)!=null&&n.element)s.appendChild(t.ghost.element);else{const h=document.createElement("img");h.src=((i=t.ghost)==null?void 0:i.url)||R,h.width=((o=t.ghost)==null?void 0:o.width)||F,h.height=((c=t.ghost)==null?void 0:c.height)||P,s.appendChild(h)}s.id=b,s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.willChange="transform",s.style.transform="translate3d(0, 0, 0)",s.style.zIndex="9999",s.style.opacity="0.5",mt(r,e,t.ghost||{},(l=t.settings)==null?void 0:l.dragInOverlapX,(d=t.settings)==null?void 0:d.dragInOverlapY)||(s.style.display="none"),s.style.pointerEvents="none",document.body.appendChild(s)}},$t=({x:r,y:e},t)=>{var l,d,h,u;const s=document.getElementById(b);if(!s)return;let n=(l=t.ghost)==null?void 0:l.width,i=(d=t.ghost)==null?void 0:d.height;typeof n>"u"&&(n=s.getBoundingClientRect().width||F),typeof i>"u"&&(i=s.getBoundingClientRect().height||P);const o=r-n/2,c=e-i/2;s.style.transform=`translate3d(${o}px, ${c}px, 0)`,t.ghost&&(mt(r,e,t.ghost,(h=t.settings)==null?void 0:h.dragInOverlapX,(u=t.settings)==null?void 0:u.dragInOverlapY)?s.style.animation!=at&&(s.style.animation=at):s.style.animation!=ct&&(s.style.animation=ct))};class kt{constructor(e=null){a(this,"_dragGhostAnimationFrameId",null);a(this,"_dragGhostRemoveAnimationFrameId",null);a(this,"_dragGhostElement",null);this._dragGhostElement=e}updateDragGhost(e,t,s){var n;this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!((n=s.ghost)!=null&&n.external)&&s.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{Xt();const i={x:e,y:t};!s.ghost&&this._dragGhostElement&&(s.ghost={}),s.ghost&&!s.ghost.element&&this._dragGhostElement&&(s.ghost.element=this._dragGhostElement),Wt(i,s),$t(i,s),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const e=document.getElementById(b);e&&document.body.removeChild(e),this._dragGhostRemoveAnimationFrameId=null}))}}class zt{constructor(e,t,s){a(this,"_options",{});a(this,"_instance");a(this,"_mainDomElement");a(this,"_currentDrag",{});a(this,"_currentTouch",null);a(this,"_firefoxDragPosition",{x:0,y:0});a(this,"_onBeforeUpdateDrag",()=>({}));a(this,"isDragging",!1);a(this,"_firefoxFallback",e=>{if(!this._currentDrag.event)return;e.preventDefault();const t=e||window.event;this._firefoxDragPosition.x=t.pageX||0,this._firefoxDragPosition.y=t.pageY||0});var n;this._instance=e,this._mainDomElement=t,this._options=s||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),(n=this._mainDomElement.parentElement)==null||n.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(e){this._onBeforeUpdateDrag=e}dragStart(e,t,s="rml_id"){const n=this._mainDomElement.parentNode;if(M(n).position!=="relative"){console.warn("Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly");return}this._mainDomElement.style.pointerEvents="none";let o=n.querySelector("."+O);o||(o=document.createElement("div"),o.classList.add(O),n.appendChild(o)),o.classList.remove(G.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 l=n.querySelector("."+v);this._currentDrag.event=t;const d=t.target,h=d.cloneNode(!0),u=d.getBoundingClientRect();h.style.width=`${u.width}px`,h.style.height=`${u.height}px`,this._currentDrag.ghost=new kt(h),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:g,clientY:f}=I(t,this._firefoxDragPosition);this._currentDrag.offset.x=g-u.left,this._currentDrag.offset.y=f-u.top,t instanceof DragEvent&&t.dataTransfer&&t.dataTransfer.setDragImage&&t.dataTransfer.setDragImage(l,0,0);const{x:S,y:D}=ht(n,this._currentDrag.event||t,this._firefoxDragPosition),y=Math.max(1,S),$=Math.max(1,D);this.isDragging=!0,this._instance.dragInObject(e,y,$,s)}dragUpdate(e){var D;const t=this._mainDomElement.parentNode,{x:s,y:n}=ht(t,e,this._firefoxDragPosition);if(s===0&&n===0)return;const i=Math.max(1,s),o=Math.max(1,n);if(i===1&&o===1)return;let c=i,l=o;if(T(e)){const y=((D=this._options.settings)==null?void 0:D.fingerSize)||0;c=Math.max(2,i+y),l=Math.max(2,o-y)}const{x:d,y:h,options:u}=this._onBeforeUpdateDrag(c,l,{}),g=u||{settings:{},ghost:{}};g.ghost||(g.ghost={}),g.ghost.visibleIn&&g.ghost.hiddenIn||(g.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const f=typeof d=="number"?d:c,S=typeof h=="number"?h:l;if(this._currentDrag.ghost){const{clientX:y,clientY:$}=I(e,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(y,$,g)}this._instance.updateDrag(f,S,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const e=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 t=e.querySelector("."+O);t&&t.classList.add(G.DISPLAY_NONE)}touchStart(e,t,s="rml_id"){var o,c,l,d;t.preventDefault();const n=(h,u)=>{this.dragStart(e,u,s)},i={};typeof((c=(o=this._options)==null?void 0:o.settings)==null?void 0:c.touchDragDelay)=="number"&&(i.delay=this._options.settings.touchDragDelay),(d=(l=this._options)==null?void 0:l.settings)!=null&&d.touchDragEpsilon&&(i.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new gt(void 0,{onTouchDragStart:n},i),this._currentTouch.onStart(t)}touchMove(e){this._currentTouch&&this._currentTouch.onMove(e),this._currentDrag.event&&this.dragUpdate(e)}touchEnd(){this._currentTouch&&this._currentTouch.onEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(e){}}const Vt=Object.freeze(Object.defineProperty({__proto__:null,DragInFromWebsiteStrategy:zt},Symbol.toStringTag,{value:"Module"})),qt=r=>`[data-rml-custom-view="${r}"]`,X=r=>{r.preventDefault(),r.stopPropagation()},Kt=(r,e,t,s)=>{const n=t-r,i=s-e;return Math.sqrt(n*n+i*i)};class Jt{constructor({onCustomDragStart:e},t={}){a(this,"_startX",0);a(this,"_startY",0);a(this,"_lastX",0);a(this,"_lastY",0);a(this,"_epsilon");a(this,"_isWaiting",!1);a(this,"_onCustomDragStart");this._epsilon=typeof t.epsilon=="number"?t.epsilon:dt,this._onCustomDragStart=e}onMove(e){this._lastX=e.clientX,this._lastY=e.clientY,this._isWaiting&&Kt(this._startX,this._startY,this._lastX,this._lastY)>this._epsilon&&(this._onCustomDragStart(e),this._isWaiting=!1)}onStart(e){this._startX=e.clientX,this._startY=e.clientY,this.onMove(e),this._isWaiting=!0}onEnd(){this._reset()}_reset(){this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this._isWaiting=!1}}const W="data-rml-old-draggable",jt=void 0,ft=(r,e)=>{const t=T(r),s={delay:t?U:Yt,epsilon:t?B:dt};if(!e)return s;if(!t&&!(r instanceof MouseEvent))return console.warn("Unsupported event! It is not TouchEvent and also not MouseEvent"),s;const{delayKey:n,epsilonKey:i}=t?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return typeof e[n]=="number"&&(s.delay=e.touchDragDelay),typeof e[i]=="number"&&(s.epsilon=e.touchDragEpsilon),s},Qt=r=>{let e="",t=F,s=P;if(!r)return{url:R,width:t,height:s};const n=r;if(n instanceof HTMLElement){const i=n.getBoundingClientRect(),o=n.getAttribute("data-rml-ghost-url"),c=n.getAttribute("data-rml-ghost-width"),l=n.getAttribute("data-rml-ghost-height");o?e=o:!o&&n instanceof HTMLImageElement&&n.src&&(e=n.src),e?(t=i.width,s=i.height):e=R,t=c?parseInt(c,10):t,s=l?parseInt(l,10):s}return{url:e||R,width:t,height:s}};class Zt{constructor(e,t,s){a(this,"_options",{});a(this,"_instance");a(this,"_mainDomElement");a(this,"_viewName");a(this,"_currentCustomDrag",null);a(this,"_currentBb",null);a(this,"_startTarget",null);a(this,"_onBeforeUpdateDrag",()=>({}));a(this,"isDragging",!1);var n;this._instance=e,this._options=t||{},this._viewName=s,this._mainDomElement=mainDomElement,(n=this._mainDomElement.parentElement)==null||n.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(e){this._onBeforeUpdateDrag=e}async _dragStart(e,t,s="rml_id"){this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(W,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",X),this._startTarget.addEventListener("dragstart",X)),this._currentBb=await this._instance.getBoundingClientRect(qt(this._viewName));const{clientX:n,clientY:i}=I(t),o=this._currentBb.x+n,c=this._currentBb.y+i;this.isDragging=!0,this._instance.dragInObject(e,o,c,s)}_dragUpdate(e){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(e),!this._currentBb||!this.isDragging)return;const{clientX:t,clientY:s}=I(e),{url:n,width:i,height:o}=Qt(this._startTarget),c=this._currentBb.x+t,l=this._currentBb.y+s,d=this._options||{},h={ghost:{visibleIn:{x:this._currentBb.x-(d.dragInOverlapX||0),y:this._currentBb.y+(d.dragInOverlapY||0),width:this._currentBb.width+(d.dragInOverlapX||0),height:this._currentBb.height+(d.dragInOverlapY||0)},url:n,width:i,height:o},mode:"custom-view"},{x:u,y:g,options:f}=this._onBeforeUpdateDrag(c,l,h),S=typeof u=="number"?u:c,D=typeof g=="number"?g:l,y=f||h;this._instance.updateDrag(S,D,y)}_dragEnd(){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._currentCustomDrag=null,this.isDragging=!1,this._currentBb=null,this._resetStartTarget(),this._instance.enableEvents(),this._instance.dragInObjectEnd()}dragStart(e,t,s){this._instance.disableEvents(),this._startTarget=t.target;const n=(i,o)=>{this._dragStart(e,o,s)};this._currentCustomDrag=T(t)?new gt(jt,{onTouchDragStart:n},ft(t,this._options)):new Jt({onCustomDragStart:i=>this._dragStart(e,i,s)},ft(t,this._options)),this._currentCustomDrag.onStart(t)}dragEnd(){this._dragEnd()}dragUpdate(e){this._dragUpdate(e)}touchStart(e,t,s="rml_id"){this.dragStart(e,t,s)}touchMove(e){this.dragUpdate(e)}touchEnd(){this.dragEnd()}dispose(){}_resetStartTarget(){this._startTarget&&(this._startTarget.style.pointerEvents="",this._startTarget.style.userSelect="",this._startTarget.draggable=this._startTarget.getAttribute(W)==="true",this._startTarget.removeAttribute(W),this._startTarget.removeEventListener("dragstart",X))}releaseInput(e){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}const te=Object.freeze(Object.defineProperty({__proto__:null,DragInFromCustomViewStrategy:Zt},Symbol.toStringTag,{value:"Module"}));return Gt});
@@ -1 +1 @@
1
- var t,e;t=this,e=function(){"use strict";var t=Object.defineProperty,e=(e,s,i)=>((e,s,i)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[s]=i)(e,"symbol"!=typeof s?s+"":s,i);class s{constructor(t,s,i,n){e(this,"_side"),e(this,"_incomingMessageBus",null),e(this,"_outgoingMessageBus",null),e(this,"_execMessage",null),this._side=t,this._incomingMessageBus=s,this._outgoingMessageBus=i,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,i)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const n=new MessageChannel;n.port1.onmessage=t=>{if(!t||!t.data)return n.port1.close(),n.port2.close(),i(new Error(this._side+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return n.port1.close(),n.port2.close(),this._prepareError(t),i(t)}e.error?i(e.error):void 0!==e.result?s(e.result):s(void 0),n.port1.close(),n.port2.close()};let r="";try{r=JSON.stringify({message:t,args:e})}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(r,"*",[n.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&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 i=this._execMessage(s,t);if(void 0===i)return;i.then((t={})=>{let s,i;"object"==typeof t&&null!==t&&(s=t.error,i=t.result),s?e.postMessage(JSON.stringify({error:s})):void 0!==i?e.postMessage(JSON.stringify({result:i})):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 i=["127.0.0.1","localhost","0.0.0.0"],n=["language","browserLanguage","userLanguage","systemLanguage"],r=(t,e)=>{for(const s in e)try{e[s].constructor===Object?t[s]=r(t[s],e[s]):t[s]=e[s]}catch{t[s]=e[s]}return t};var a,o=((a=o||{}).BOTTOM_BAR="bottom_bar",a.PARTLIST_BOUNDS="partlist_bounds",a.INTERACTION_NOTES="interaction_notes",a.PARAMETER_GROUPS="parameter_groups",a),l={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const h={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[o.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!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)}},u=()=>/(android)/i.test(navigator.userAgent);class g{constructor(){e(this,"_messageHandler",null),e(this,"isSetupDone",!1),e(this,"viewName","main"),e(this,"plugins",{}),e(this,"pluginsLoaded",[]),e(this,"ui",{callbacks:null}),e(this,"extended",{callbacks:null}),e(this,"configurator",{callbacks:null}),e(this,"analytics",{callbacks:{}}),e(this,"rapi",{callbacks:{}}),e(this,"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],i=e[1];this[s]||(this[s]={}),this[s][i]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(t,[...arguments])}.bind(this)}),s.forEach(t=>{const e=t.split("."),s=e[0],i=e[1],n=e[2];this[s]||(this[s]={}),this[s][i]||(this[s][i]={}),this[s][i][n]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const s=t.split("."),i=s[0],n=s[1],r=3===s.length?s[2]:null;if(r&&this[i][n][r]){const t=this[i][n][r](...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 i of t)"string"==typeof i&&"dragIn"===i?this.pluginsLoaded.push(new Promise((t,i)=>{try{Promise.resolve().then(()=>k).then(({DragIn:n})=>{const r=new n(this.ui,e,s,this.viewName);r.init().then(()=>{this.plugins.dragIn=r,t()},i)})}catch(t){i(t)}})):i.name&&i.loader&&this.pluginsLoaded.push(new Promise((t,n)=>{try{i.loader().then(r=>{const a=new r(this.ui,e,s,this.viewName);a.init().then(()=>{this.plugins[i.name]=a,t()},n)})}catch(t){n(t)}}))}}const d=()=>{let t,e;return{promise:new Promise((s,i)=>{t=s,e=i}),resolve:t,reject:e}},m=(t,e,s)=>{let i=null;Object.defineProperty(t,e,{get:()=>i||s,set(t){i=null!=t&&t.mute?t.value:t}})},_=()=>.01*window.innerHeight+"px",p=t=>{t&&setTimeout(()=>t.style.setProperty(y,_()),0)},f="rml-styles",y="--rml-full-height",v="rml-container",b="rml-fill",w="rml-pos",D="rml-android-height",E="rml-overflow-hidden",T=new Map;class S{constructor(t,s,i,n){e(this,"_mainDomElement"),e(this,"_instance"),e(this,"_mode","website"),e(this,"_viewName","main"),this._instance=t,this._mainDomElement=s,this._mode=i,this._viewName=n}async init(){return Promise.resolve()}}const x="rml-drag-in-styles",I="rml-drag-in-drag-element",M="rml-drag-in-overlay",C="rml-drag-in-drag-ghost",A="rml-drag-in-fade-in",O="rml-drag-in-fade-out",L="rml-display-none",B="250ms",P="forwards",F=`@keyframes ${A} {from{opacity: 0;}to {opacity: 0.5;}}`,U=`@keyframes ${O} {from{opacity: 0.5;}to {opacity: 0;}}`,R=`${A} ${B} ${P}`,N=`${O} ${B} ${P}`,X="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",k=Object.freeze(Object.defineProperty({__proto__:null,DragIn:class extends S{constructor(t,s,i,n){super(t,s,i,n),e(this,"options",{}),e(this,"_customDragSignal",new AbortController),this._mainDomElement=s,this._injectStyles(),this._initializeDragGhost()}_injectStyles(){if(!document.getElementById(x)){const t=document.createElement("style");t.type="text/css",t.id=x,t.innerHTML=`\n .${L}{display:none}\n .${M}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${C}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${F}\n ${U}\n `,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+C);e||(e=document.createElement("div"),e.classList.add(C),e.innerText=" ",t.appendChild(e))}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await Promise.resolve().then(()=>et);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(()=>at);this._strategy=new t(this._instance,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:i}){i&&this._strategy.beforeUpdateGhost(i);const n=this._customDragSignal.signal,r=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",r,{signal:n}),document.addEventListener("mouseup",a,{signal:n}),document.addEventListener("mousemove",o,{signal:n}),document.addEventListener("mouseleave",a,{signal:n}),document.addEventListener("touchstart",r,{signal:n}),document.addEventListener("touchend",a,{signal:n}),document.addEventListener("touchmove",o,{signal:n})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}},Symbol.toStringTag,{value:"Module"}));class G{constructor(t=16){e(this,"_computedStyleCache",new Map),e(this,"_maxLifetime",16),e(this,"_cacheCleanInterval",null),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 i=getComputedStyle(t);return this._computedStyleCache.set(t,{style:i,updated:s}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(1e3*this._maxLifetime,5e3))),i}_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 Y=t=>window.TouchEvent&&t instanceof window.TouchEvent;let $;const j=t=>($||($=new G),$.get(t)),H=(t,e,s)=>{const i=parseFloat(t),n=window.devicePixelRatio||1;if("px"===e)return i;if("%"===e)return i/100*(s===document.documentElement?window.innerWidth:s.offsetWidth);if("rem"===e)return i*parseFloat(j(document.documentElement).fontSize);if("em"===e)return i*parseFloat(j(s).fontSize);if("vh"===e||"vw"===e||"vmin"===e||"vmax"===e)return i/100*{vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)}[e];const r={cm:37.7952755906,mm:3.77952755906,in:96};return e in r?i*r[e]*n:0},z=(t,e,s={x:0,y:0})=>{const i=t.getBoundingClientRect(),n=j(t).transform;let r=0,a=0;if("none"!==n){const e=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,s=n.match(e);s&&(r=H(s[1],s[2],t),a=H(s[3],s[4],t))}const{clientX:o,clientY:l}=W(e,s);return{x:o-i.left-r+t.scrollLeft,y:l-i.top-a+t.scrollTop}},W=(t,e=null)=>{const{clientX:s,clientY:i}=Y(t)?q(t):t;return{clientX:s>0?s:e?e.x:s,clientY:i>0?i:e?e.y:i}},q=t=>{if(t.touches.length){let{clientX:e,clientY:s}=t.touches[0];if(t.touches.length>1){const i=t.touches[1];e=(e+i.clientX)/2,s=(s+i.clientY)/2}return{clientX:e,clientY:s}}const e=t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},J=(t,e=0)=>Y(t)?{clientX:t.touches[e].clientX,clientY:t.touches[e].clientY}:{clientX:t.clientX,clientY:t.clientY},V=t=>!t||!Y(t)||t.touches.length>0;class K{constructor(t,{onTouchDragStart:s},i={}){e(this,"_touchDragTimeOut"),e(this,"_onTouchDragStart"),e(this,"_payload",null),e(this,"_delay",500),e(this,"_firstTouch",null),e(this,"_lastTouch",null),e(this,"_epsilon",10),this._payload=t,this._onTouchDragStart=s,this._delay="number"==typeof i.delay?i.delay:500,this._epsilon="number"==typeof i.epsilon?i.epsilon:10}onStart(t){V(t)&&(this._touchDragTimeOut||(this._firstTouch=J(t,Y(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=J(t)),this._checkXDistance(t)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){V(t)&&(this._lastTouch=J(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 Q=(t,e,s=0,i=0)=>{const n=e.x+e.width+s,r=e.x-s,a=e.y+e.height+i,o=e.y-i,{x:l,y:h}=t;return l>=r&&l<=n&&h>=o&&h<=a},Z=(t,e,s,i=0,n=0)=>{if(s&&(s.hiddenIn||s.visibleIn))return s.visibleIn?Q({x:t,y:e},s.visibleIn,i,n):!!s.hiddenIn&&!Q({x:t,y:e},s.hiddenIn,-i,-n)};class tt{constructor(t=null){e(this,"_dragGhostAnimationFrameId",null),e(this,"_dragGhostRemoveAnimationFrameId",null),e(this,"_dragGhostElement",null),this._dragGhostElement=t}updateDragGhost(t,e,s){var i;this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),(null==(i=s.ghost)||!i.external)&&s.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById(x)){const t=document.createElement("style");t.type="text/css",t.id=x,t.innerHTML=`\n ${F}\n ${U}\n `,document.head.appendChild(t)}})();const i={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)=>{var i,n,r,a,o,l;let h=document.getElementById(I);if(!h){if(h=document.createElement("div"),null!=(i=s.ghost)&&i.element)h.appendChild(s.ghost.element);else{const t=document.createElement("img");t.src=(null==(n=s.ghost)?void 0:n.url)||X,t.width=(null==(r=s.ghost)?void 0:r.width)||112,t.height=(null==(a=s.ghost)?void 0:a.height)||112,h.appendChild(t)}h.id=I,h.style.position="fixed",h.style.top="0",h.style.left="0",h.style.willChange="transform",h.style.transform="translate3d(0, 0, 0)",h.style.zIndex="9999",h.style.opacity="0.5",Z(t,e,s.ghost||{},null==(o=s.settings)?void 0:o.dragInOverlapX,null==(l=s.settings)?void 0:l.dragInOverlapY)||(h.style.display="none"),h.style.pointerEvents="none",document.body.appendChild(h)}})(i,s),(({x:t,y:e},s)=>{var i,n,r,a;const o=document.getElementById(I);if(!o)return;let l=null==(i=s.ghost)?void 0:i.width,h=null==(n=s.ghost)?void 0:n.height;typeof l>"u"&&(l=o.getBoundingClientRect().width||112),typeof h>"u"&&(h=o.getBoundingClientRect().height||112);const c=t-l/2,u=e-h/2;o.style.transform=`translate3d(${c}px, ${u}px, 0)`,s.ghost&&(Z(t,e,s.ghost,null==(r=s.settings)?void 0:r.dragInOverlapX,null==(a=s.settings)?void 0:a.dragInOverlapY)?o.style.animation!=R&&(o.style.animation=R):o.style.animation!=N&&(o.style.animation=N))})(i,s),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(I);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}const et=Object.freeze(Object.defineProperty({__proto__:null,DragInFromWebsiteStrategy:class{constructor(t,s,i){e(this,"_options",{}),e(this,"_instance"),e(this,"_mainDomElement"),e(this,"_currentDrag",{}),e(this,"_currentTouch",null),e(this,"_firefoxDragPosition",{x:0,y:0}),e(this,"_onBeforeUpdateDrag",()=>({})),e(this,"isDragging",!1),e(this,"_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}),this._instance=t,this._mainDomElement=s,this._options=i||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback)}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(t,e,s="rml_id"){const i=this._mainDomElement.parentNode;if("relative"!==j(i).position)return;this._mainDomElement.style.pointerEvents="none";let n=i.querySelector("."+M);n||(n=document.createElement("div"),n.classList.add(M),i.appendChild(n)),n.classList.remove(L),e.target.getAttribute("draggable");const r=i.querySelector("."+C);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 tt(o),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:h,clientY:c}=W(e,this._firefoxDragPosition);this._currentDrag.offset.x=h-l.left,this._currentDrag.offset.y=c-l.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(r,0,0);const{x:u,y:g}=z(i,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){var e;const s=this._mainDomElement.parentNode,{x:i,y:n}=z(s,t,this._firefoxDragPosition);if(0===i&&0===n)return;const r=Math.max(1,i),a=Math.max(1,n);if(1===r&&1===a)return;let o=r,l=a;if(Y(t)){const t=(null==(e=this._options.settings)?void 0:e.fingerSize)||0;o=Math.max(2,r+t),l=Math.max(2,a-t)}const{x:h,y:c,options:u}=this._onBeforeUpdateDrag(o,l,{}),g=u||{settings:{},ghost:{}};g.ghost||(g.ghost={}),g.ghost.visibleIn&&g.ghost.hiddenIn||(g.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const d="number"==typeof h?h:o,m="number"==typeof c?c:l;if(this._currentDrag.ghost){const{clientX:e,clientY:s}=W(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(e,s,g)}this._instance.updateDrag(d,m,{})}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("."+M);e&&e.classList.add(L)}touchStart(t,e,s="rml_id"){var i,n,r,a;e.preventDefault();const o={};"number"==typeof(null==(n=null==(i=this._options)?void 0:i.settings)?void 0:n.touchDragDelay)&&(o.delay=this._options.settings.touchDragDelay),null!=(a=null==(r=this._options)?void 0:r.settings)&&a.touchDragEpsilon&&(o.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new K(void 0,{onTouchDragStart:(e,i)=>{this.dragStart(t,i,s)}},o),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"})),st=t=>{t.preventDefault(),t.stopPropagation()};class it{constructor({onCustomDragStart:t},s={}){e(this,"_startX",0),e(this,"_startY",0),e(this,"_lastX",0),e(this,"_lastY",0),e(this,"_epsilon"),e(this,"_isWaiting",!1),e(this,"_onCustomDragStart"),this._epsilon="number"==typeof s.epsilon?s.epsilon:15,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&((t,e)=>{const s=this._lastX-t,i=this._lastY-e;return Math.sqrt(s*s+i*i)})(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 nt="data-rml-old-draggable",rt=(t,e)=>{const s=Y(t),i={delay:s?500:100,epsilon:s?10:15};if(!e)return i;if(!(s||t instanceof MouseEvent))return i;const{delayKey:n,epsilonKey:r}=s?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof e[n]&&(i.delay=e.touchDragDelay),"number"==typeof e[r]&&(i.epsilon=e.touchDragEpsilon),i},at=Object.freeze(Object.defineProperty({__proto__:null,DragInFromCustomViewStrategy:class{constructor(t,s,i){e(this,"_options",{}),e(this,"_instance"),e(this,"_viewName"),e(this,"_currentCustomDrag",null),e(this,"_currentBb",null),e(this,"_startTarget",null),e(this,"_onBeforeUpdateDrag",()=>({})),e(this,"isDragging",!1),this._instance=t,this._options=s||{},this._viewName=i}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(nt,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",st),this._startTarget.addEventListener("dragstart",st)),this._currentBb=await this._instance.getBoundingClientRect((()=>`[data-rml-custom-view="${this._viewName}"]`)());const{clientX:i,clientY:n}=W(e),r=this._currentBb.x+i,a=this._currentBb.y+n;this.isDragging=!0,this._instance.dragInObject(t,r,a,s)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:s}=W(t),{url:i,width:n,height:r}=(t=>{let e="",s=112,i=112;if(!t)return{url:X,width:s,height:i};const n=t;if(n instanceof HTMLElement){const t=n.getBoundingClientRect(),r=n.getAttribute("data-rml-ghost-url"),a=n.getAttribute("data-rml-ghost-width"),o=n.getAttribute("data-rml-ghost-height");r?e=r:!r&&n instanceof HTMLImageElement&&n.src&&(e=n.src),e?(s=t.width,i=t.height):e=X,s=a?parseInt(a,10):s,i=o?parseInt(o,10):i}return{url:e||X,width:s,height:i}})(this._startTarget),a=this._currentBb.x+e,o=this._currentBb.y+s,l=this._options||{},h={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:i,width:n,height:r},mode:"custom-view"},{x:c,y:u,options:g}=this._onBeforeUpdateDrag(a,o,h),d="number"==typeof c?c:a,m="number"==typeof u?u:o,_=g||h;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=Y(e)?new K(void 0,{onTouchDragStart:(e,i)=>{this._dragStart(t,i,s)}},rt(e,this._options)):new it({onCustomDragStart:e=>this._dragStart(t,e,s)},rt(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(nt),this._startTarget.removeAttribute(nt),this._startTarget.removeEventListener("dragstart",st))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}},Symbol.toStringTag,{value:"Module"}));return class extends g{constructor(t,i,n,r,a){if(super(),e(this,"_waitForIframe"),e(this,"_container"),e(this,"_configuratorSettings"),e(this,"_initData",{}),e(this,"_iframe"),!t||"string"!=typeof t.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(T.has(i))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(f)){const t=n.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id=f;const s="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((t,e)=>t+(e+s),"")+s,r=_();e.innerHTML=`\n .${v}{${y}:${r};}\n .${w}{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${i}}\n .${b}{width:100%;height:100%;opacity:1}\n .${D}{height:calc(var(${y},1vh)*100)}\n .${E}{overflow:hidden}\n `,document.head.appendChild(e)}this._executeMessage=this._executeMessage.bind(this);const o=new s("website",window,null,this._executeMessage);this.setMessageHandler(o),this._onResize=this._onResize.bind(this),u()&&window.addEventListener("resize",this._onResize),this._container=i,this._initData=n,this._configuratorSettings=t;const l=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(l),this._iframe=l,this.setupPlugins(r,this._iframe),T.set(i,!0)}static createPlanner(t,e,s,i=[]){return this._create(t,e,s,i)}static async connect(t,e=[]){const i=new g;i.viewName=t;const{resolve:n,promise:r}=d(),{resolve:a,promise:o}=d(),l=new s("custom-view-"+t,window,window.parent,({message:t,args:e})=>{switch(t){case"registerCustomViewDone":n();break;case"returnMethods":i.handleSetup(e[0]),a();break;default:if(i.isSetupDone)return i.executeMessage({message:t,args:e})}});i.setMessageHandler(l);const h=[t];return l.sendMessage("registerCustomView",h),await r,l.sendMessage("getMethods",h),await o,i.setupPlugins(e,document.body,"custom-view"),await Promise.allSettled(i.pluginsLoaded),i}static createConfigurator(t,e,s,i=[]){return this._create(t,e,s,i)}static create(t,e,s,i){return this._create(t,e,s,i)}static createViewer(t,e,s,i=[]){return this._create(t,e,s,i)}static async _create(t,e,s,a){return new Promise(async(o,u)=>{try{const u=r((()=>{const t=(t=>JSON.parse(JSON.stringify(t)))(h);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=n.length;t<s;t++){const s=e[n[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=>!!(i.includes(t)||t.endsWith("roomle.com")||t.endsWith("gitlab.io")||t.endsWith("gitlab.com")))(e)&&(t.configuratorId="demoConfigurator"),t.customApiUrl=l.VITE_RAPI_URL,t.emails=!1,t})(),(t=>(c(t),null!=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)})(u);const g=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",i=e.overrideTenant||9,n=s+"/configurators/"+t,r="roomle_portal_v2",a="03-"+window.btoa((new Date).toISOString()+";anonymous;"+r),o=new Request(n,{method:"GET",headers:new Headers({apiKey:r,currentTenant:i,locale:"en",language:"en",device:1,token:a,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:h}=await l.json();return h})(t,u);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 r(s,e)})(s,e)})(g,u);const d=new this(g,e,s,a,o);return await Promise.allSettled(d.pluginsLoaded),d}catch(t){return u(t)}})}teardown(){this._container&&T.delete(this._container);const t=this._container.querySelector("iframe");t&&this._container.removeChild(t),window.removeEventListener("resize",this._onResize)}_createIframe(){var t;const e=document.createElement("iframe");let s=(null==(t=this._configuratorSettings)?void 0:t.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),e.src=s,e.classList.add(v),e.classList.add(b),e}_onResize(){p(this._iframe)}_onUseFullPage(){this._iframe.classList.add(w),document.documentElement.classList.add(E),window.document.body.classList.add(E),u()&&(p(this._iframe),this._iframe.classList.add(D))}_onBackToWebsite(){this._iframe.classList.remove(w),this._iframe.classList.remove(D),document.documentElement.classList.remove(E),window.document.body.classList.remove(E)}_executeMessage({message:t,args:e},s){var i;if(s.source&&s.source===(null==(i=this._iframe)?void 0:i.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]),m(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),m(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";var t=Object.defineProperty,e=(e,s,i)=>((e,s,i)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[s]=i)(e,"symbol"!=typeof s?s+"":s,i);class s{constructor(t,s,i,n){e(this,"_side"),e(this,"_incomingMessageBus",null),e(this,"_outgoingMessageBus",null),e(this,"_execMessage",null),this._side=t,this._incomingMessageBus=s,this._outgoingMessageBus=i,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,i)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const n=new MessageChannel;n.port1.onmessage=t=>{if(!t||!t.data)return n.port1.close(),n.port2.close(),i(new Error(this._side+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return n.port1.close(),n.port2.close(),this._prepareError(t),i(t)}e.error?i(e.error):void 0!==e.result?s(e.result):s(void 0),n.port1.close(),n.port2.close()};let r="";try{r=JSON.stringify({message:t,args:e})}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(r,"*",[n.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&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 i=this._execMessage(s,t);if(void 0===i)return;i.then((t={})=>{let s,i;"object"==typeof t&&null!==t&&(s=t.error,i=t.result),s?e.postMessage(JSON.stringify({error:s})):void 0!==i?e.postMessage(JSON.stringify({result:i})):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 i=["127.0.0.1","localhost","0.0.0.0"],n=["language","browserLanguage","userLanguage","systemLanguage"],r=(t,e)=>{for(const s in e)try{e[s].constructor===Object?t[s]=r(t[s],e[s]):t[s]=e[s]}catch{t[s]=e[s]}return t};var a,o=((a=o||{}).BOTTOM_BAR="bottom_bar",a.PARTLIST_BOUNDS="partlist_bounds",a.INTERACTION_NOTES="interaction_notes",a.PARAMETER_GROUPS="parameter_groups",a),l={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const h={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[o.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!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)}},u=()=>/(android)/i.test(navigator.userAgent);class g{constructor(){e(this,"_messageHandler",null),e(this,"isSetupDone",!1),e(this,"viewName","main"),e(this,"plugins",{}),e(this,"pluginsLoaded",[]),e(this,"ui",{callbacks:null}),e(this,"extended",{callbacks:null}),e(this,"configurator",{callbacks:null}),e(this,"analytics",{callbacks:{}}),e(this,"rapi",{callbacks:{}}),e(this,"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],i=e[1];this[s]||(this[s]={}),this[s][i]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(t,[...arguments])}.bind(this)}),s.forEach(t=>{const e=t.split("."),s=e[0],i=e[1],n=e[2];this[s]||(this[s]={}),this[s][i]||(this[s][i]={}),this[s][i][n]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const s=t.split("."),i=s[0],n=s[1],r=3===s.length?s[2]:null;if(r&&this[i][n][r]){const t=this[i][n][r](...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 i of t)"string"==typeof i&&"dragIn"===i?this.pluginsLoaded.push(new Promise((t,i)=>{try{Promise.resolve().then(()=>k).then(({DragIn:n})=>{const r=new n(this.ui,e,s,this.viewName);r.init().then(()=>{this.plugins.dragIn=r,t()},i)})}catch(t){i(t)}})):i.name&&i.loader&&this.pluginsLoaded.push(new Promise((t,n)=>{try{i.loader().then(r=>{const a=new r(this.ui,e,s,this.viewName);a.init().then(()=>{this.plugins[i.name]=a,t()},n)})}catch(t){n(t)}}))}}const d=()=>{let t,e;return{promise:new Promise((s,i)=>{t=s,e=i}),resolve:t,reject:e}},m=(t,e,s)=>{let i=null;Object.defineProperty(t,e,{get:()=>i||s,set(t){i=null!=t&&t.mute?t.value:t}})},_=()=>.01*window.innerHeight+"px",p=t=>{t&&setTimeout(()=>t.style.setProperty(y,_()),0)},f="rml-styles",y="--rml-full-height",v="rml-container",b="rml-fill",w="rml-pos",D="rml-android-height",E="rml-overflow-hidden",T=new Map;class S{constructor(t,s,i,n){e(this,"_mainDomElement"),e(this,"_instance"),e(this,"_mode","website"),e(this,"_viewName","main"),this._instance=t,this._mainDomElement=s,this._mode=i,this._viewName=n}async init(){return Promise.resolve()}}const I="rml-drag-in-styles",x="rml-drag-in-drag-element",M="rml-drag-in-overlay",C="rml-drag-in-drag-ghost",A="rml-drag-in-fade-in",O="rml-drag-in-fade-out",L="rml-display-none",B="250ms",P="forwards",F=`@keyframes ${A} {from{opacity: 0;}to {opacity: 0.5;}}`,U=`@keyframes ${O} {from{opacity: 0.5;}to {opacity: 0;}}`,R=`${A} ${B} ${P}`,N=`${O} ${B} ${P}`,X="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",k=Object.freeze(Object.defineProperty({__proto__:null,DragIn:class extends S{constructor(t,s,i,n){super(t,s,i,n),e(this,"options",{}),e(this,"_customDragSignal",new AbortController),this._mainDomElement=s,this._injectStyles(),this._initializeDragGhost()}_injectStyles(){if(!document.getElementById(I)){const t=document.createElement("style");t.type="text/css",t.id=I,t.innerHTML=`\n .${L}{display:none}\n .${M}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${C}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${F}\n ${U}\n `,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+C);e||(e=document.createElement("div"),e.classList.add(C),e.innerText=" ",t.appendChild(e))}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await Promise.resolve().then(()=>et);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(()=>at);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:i}){i&&this._strategy.beforeUpdateGhost(i);const n=this._customDragSignal.signal,r=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",r,{signal:n}),document.addEventListener("mouseup",a,{signal:n}),document.addEventListener("mousemove",o,{signal:n}),document.addEventListener("mouseleave",a,{signal:n}),document.addEventListener("touchstart",r,{signal:n}),document.addEventListener("touchend",a,{signal:n}),document.addEventListener("touchmove",o,{signal:n})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}},Symbol.toStringTag,{value:"Module"}));class G{constructor(t=16){e(this,"_computedStyleCache",new Map),e(this,"_maxLifetime",16),e(this,"_cacheCleanInterval",null),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 i=getComputedStyle(t);return this._computedStyleCache.set(t,{style:i,updated:s}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(1e3*this._maxLifetime,5e3))),i}_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 Y=t=>window.TouchEvent&&t instanceof window.TouchEvent;let $;const j=t=>($||($=new G),$.get(t)),H=(t,e,s)=>{const i=parseFloat(t),n=window.devicePixelRatio||1;if("px"===e)return i;if("%"===e)return i/100*(s===document.documentElement?window.innerWidth:s.offsetWidth);if("rem"===e)return i*parseFloat(j(document.documentElement).fontSize);if("em"===e)return i*parseFloat(j(s).fontSize);if("vh"===e||"vw"===e||"vmin"===e||"vmax"===e)return i/100*{vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)}[e];const r={cm:37.7952755906,mm:3.77952755906,in:96};return e in r?i*r[e]*n:0},z=(t,e,s={x:0,y:0})=>{const i=t.getBoundingClientRect(),n=j(t).transform;let r=0,a=0;if("none"!==n){const e=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,s=n.match(e);s&&(r=H(s[1],s[2],t),a=H(s[3],s[4],t))}const{clientX:o,clientY:l}=W(e,s);return{x:o-i.left-r+t.scrollLeft,y:l-i.top-a+t.scrollTop}},W=(t,e=null)=>{const{clientX:s,clientY:i}=Y(t)?q(t):t;return{clientX:s>0?s:e?e.x:s,clientY:i>0?i:e?e.y:i}},q=t=>{if(t.touches.length){let{clientX:e,clientY:s}=t.touches[0];if(t.touches.length>1){const i=t.touches[1];e=(e+i.clientX)/2,s=(s+i.clientY)/2}return{clientX:e,clientY:s}}const e=t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},J=(t,e=0)=>Y(t)?{clientX:t.touches[e].clientX,clientY:t.touches[e].clientY}:{clientX:t.clientX,clientY:t.clientY},V=t=>!t||!Y(t)||t.touches.length>0;class K{constructor(t,{onTouchDragStart:s},i={}){e(this,"_touchDragTimeOut"),e(this,"_onTouchDragStart"),e(this,"_payload",null),e(this,"_delay",500),e(this,"_firstTouch",null),e(this,"_lastTouch",null),e(this,"_epsilon",10),this._payload=t,this._onTouchDragStart=s,this._delay="number"==typeof i.delay?i.delay:500,this._epsilon="number"==typeof i.epsilon?i.epsilon:10}onStart(t){V(t)&&(this._touchDragTimeOut||(this._firstTouch=J(t,Y(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=J(t)),this._checkXDistance(t)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){V(t)&&(this._lastTouch=J(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 Q=(t,e,s=0,i=0)=>{const n=e.x+e.width+s,r=e.x-s,a=e.y+e.height+i,o=e.y-i,{x:l,y:h}=t;return l>=r&&l<=n&&h>=o&&h<=a},Z=(t,e,s,i=0,n=0)=>{if(s&&(s.hiddenIn||s.visibleIn))return s.visibleIn?Q({x:t,y:e},s.visibleIn,i,n):!!s.hiddenIn&&!Q({x:t,y:e},s.hiddenIn,-i,-n)};class tt{constructor(t=null){e(this,"_dragGhostAnimationFrameId",null),e(this,"_dragGhostRemoveAnimationFrameId",null),e(this,"_dragGhostElement",null),this._dragGhostElement=t}updateDragGhost(t,e,s){var i;this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),(null==(i=s.ghost)||!i.external)&&s.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById(I)){const t=document.createElement("style");t.type="text/css",t.id=I,t.innerHTML=`\n ${F}\n ${U}\n `,document.head.appendChild(t)}})();const i={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)=>{var i,n,r,a,o,l;let h=document.getElementById(x);if(!h){if(h=document.createElement("div"),null!=(i=s.ghost)&&i.element)h.appendChild(s.ghost.element);else{const t=document.createElement("img");t.src=(null==(n=s.ghost)?void 0:n.url)||X,t.width=(null==(r=s.ghost)?void 0:r.width)||112,t.height=(null==(a=s.ghost)?void 0:a.height)||112,h.appendChild(t)}h.id=x,h.style.position="fixed",h.style.top="0",h.style.left="0",h.style.willChange="transform",h.style.transform="translate3d(0, 0, 0)",h.style.zIndex="9999",h.style.opacity="0.5",Z(t,e,s.ghost||{},null==(o=s.settings)?void 0:o.dragInOverlapX,null==(l=s.settings)?void 0:l.dragInOverlapY)||(h.style.display="none"),h.style.pointerEvents="none",document.body.appendChild(h)}})(i,s),(({x:t,y:e},s)=>{var i,n,r,a;const o=document.getElementById(x);if(!o)return;let l=null==(i=s.ghost)?void 0:i.width,h=null==(n=s.ghost)?void 0:n.height;typeof l>"u"&&(l=o.getBoundingClientRect().width||112),typeof h>"u"&&(h=o.getBoundingClientRect().height||112);const c=t-l/2,u=e-h/2;o.style.transform=`translate3d(${c}px, ${u}px, 0)`,s.ghost&&(Z(t,e,s.ghost,null==(r=s.settings)?void 0:r.dragInOverlapX,null==(a=s.settings)?void 0:a.dragInOverlapY)?o.style.animation!=R&&(o.style.animation=R):o.style.animation!=N&&(o.style.animation=N))})(i,s),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(x);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}const et=Object.freeze(Object.defineProperty({__proto__:null,DragInFromWebsiteStrategy:class{constructor(t,s,i){var n;e(this,"_options",{}),e(this,"_instance"),e(this,"_mainDomElement"),e(this,"_currentDrag",{}),e(this,"_currentTouch",null),e(this,"_firefoxDragPosition",{x:0,y:0}),e(this,"_onBeforeUpdateDrag",()=>({})),e(this,"isDragging",!1),e(this,"_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}),this._instance=t,this._mainDomElement=s,this._options=i||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),null==(n=this._mainDomElement.parentElement)||n.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(t,e,s="rml_id"){const i=this._mainDomElement.parentNode;if("relative"!==j(i).position)return;this._mainDomElement.style.pointerEvents="none";let n=i.querySelector("."+M);n||(n=document.createElement("div"),n.classList.add(M),i.appendChild(n)),n.classList.remove(L),e.target.getAttribute("draggable");const r=i.querySelector("."+C);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 tt(o),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:h,clientY:c}=W(e,this._firefoxDragPosition);this._currentDrag.offset.x=h-l.left,this._currentDrag.offset.y=c-l.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(r,0,0);const{x:u,y:g}=z(i,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){var e;const s=this._mainDomElement.parentNode,{x:i,y:n}=z(s,t,this._firefoxDragPosition);if(0===i&&0===n)return;const r=Math.max(1,i),a=Math.max(1,n);if(1===r&&1===a)return;let o=r,l=a;if(Y(t)){const t=(null==(e=this._options.settings)?void 0:e.fingerSize)||0;o=Math.max(2,r+t),l=Math.max(2,a-t)}const{x:h,y:c,options:u}=this._onBeforeUpdateDrag(o,l,{}),g=u||{settings:{},ghost:{}};g.ghost||(g.ghost={}),g.ghost.visibleIn&&g.ghost.hiddenIn||(g.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const d="number"==typeof h?h:o,m="number"==typeof c?c:l;if(this._currentDrag.ghost){const{clientX:e,clientY:s}=W(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(e,s,g)}this._instance.updateDrag(d,m,{})}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("."+M);e&&e.classList.add(L)}touchStart(t,e,s="rml_id"){var i,n,r,a;e.preventDefault();const o={};"number"==typeof(null==(n=null==(i=this._options)?void 0:i.settings)?void 0:n.touchDragDelay)&&(o.delay=this._options.settings.touchDragDelay),null!=(a=null==(r=this._options)?void 0:r.settings)&&a.touchDragEpsilon&&(o.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new K(void 0,{onTouchDragStart:(e,i)=>{this.dragStart(t,i,s)}},o),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"})),st=t=>{t.preventDefault(),t.stopPropagation()};class it{constructor({onCustomDragStart:t},s={}){e(this,"_startX",0),e(this,"_startY",0),e(this,"_lastX",0),e(this,"_lastY",0),e(this,"_epsilon"),e(this,"_isWaiting",!1),e(this,"_onCustomDragStart"),this._epsilon="number"==typeof s.epsilon?s.epsilon:15,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&((t,e)=>{const s=this._lastX-t,i=this._lastY-e;return Math.sqrt(s*s+i*i)})(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 nt="data-rml-old-draggable",rt=(t,e)=>{const s=Y(t),i={delay:s?500:100,epsilon:s?10:15};if(!e)return i;if(!(s||t instanceof MouseEvent))return i;const{delayKey:n,epsilonKey:r}=s?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof e[n]&&(i.delay=e.touchDragDelay),"number"==typeof e[r]&&(i.epsilon=e.touchDragEpsilon),i},at=Object.freeze(Object.defineProperty({__proto__:null,DragInFromCustomViewStrategy:class{constructor(t,s,i){var n;e(this,"_options",{}),e(this,"_instance"),e(this,"_mainDomElement"),e(this,"_viewName"),e(this,"_currentCustomDrag",null),e(this,"_currentBb",null),e(this,"_startTarget",null),e(this,"_onBeforeUpdateDrag",()=>({})),e(this,"isDragging",!1),this._instance=t,this._options=s||{},this._viewName=i,this._mainDomElement=mainDomElement,null==(n=this._mainDomElement.parentElement)||n.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(nt,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",st),this._startTarget.addEventListener("dragstart",st)),this._currentBb=await this._instance.getBoundingClientRect((()=>`[data-rml-custom-view="${this._viewName}"]`)());const{clientX:i,clientY:n}=W(e),r=this._currentBb.x+i,a=this._currentBb.y+n;this.isDragging=!0,this._instance.dragInObject(t,r,a,s)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:s}=W(t),{url:i,width:n,height:r}=(t=>{let e="",s=112,i=112;if(!t)return{url:X,width:s,height:i};const n=t;if(n instanceof HTMLElement){const t=n.getBoundingClientRect(),r=n.getAttribute("data-rml-ghost-url"),a=n.getAttribute("data-rml-ghost-width"),o=n.getAttribute("data-rml-ghost-height");r?e=r:!r&&n instanceof HTMLImageElement&&n.src&&(e=n.src),e?(s=t.width,i=t.height):e=X,s=a?parseInt(a,10):s,i=o?parseInt(o,10):i}return{url:e||X,width:s,height:i}})(this._startTarget),a=this._currentBb.x+e,o=this._currentBb.y+s,l=this._options||{},h={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:i,width:n,height:r},mode:"custom-view"},{x:c,y:u,options:g}=this._onBeforeUpdateDrag(a,o,h),d="number"==typeof c?c:a,m="number"==typeof u?u:o,_=g||h;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=Y(e)?new K(void 0,{onTouchDragStart:(e,i)=>{this._dragStart(t,i,s)}},rt(e,this._options)):new it({onCustomDragStart:e=>this._dragStart(t,e,s)},rt(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(nt),this._startTarget.removeAttribute(nt),this._startTarget.removeEventListener("dragstart",st))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}},Symbol.toStringTag,{value:"Module"}));return class extends g{constructor(t,i,n,r,a){if(super(),e(this,"_waitForIframe"),e(this,"_container"),e(this,"_configuratorSettings"),e(this,"_initData",{}),e(this,"_iframe"),!t||"string"!=typeof t.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(T.has(i))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(f)){const t=n.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id=f;const s="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((t,e)=>t+(e+s),"")+s,r=_();e.innerHTML=`\n .${v}{${y}:${r};}\n .${w}{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${i}}\n .${b}{width:100%;height:100%;opacity:1}\n .${D}{height:calc(var(${y},1vh)*100)}\n .${E}{overflow:hidden}\n `,document.head.appendChild(e)}this._executeMessage=this._executeMessage.bind(this);const o=new s("website",window,null,this._executeMessage);this.setMessageHandler(o),this._onResize=this._onResize.bind(this),u()&&window.addEventListener("resize",this._onResize),this._container=i,this._initData=n,this._configuratorSettings=t;const l=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(l),this._iframe=l,this.setupPlugins(r,this._iframe),T.set(i,!0)}static createPlanner(t,e,s,i=[]){return this._create(t,e,s,i)}static async connect(t,e=[]){const i=new g;i.viewName=t;const{resolve:n,promise:r}=d(),{resolve:a,promise:o}=d(),l=new s("custom-view-"+t,window,window.parent,({message:t,args:e})=>{switch(t){case"registerCustomViewDone":n();break;case"returnMethods":i.handleSetup(e[0]),a();break;default:if(i.isSetupDone)return i.executeMessage({message:t,args:e})}});i.setMessageHandler(l);const h=[t];return l.sendMessage("registerCustomView",h),await r,l.sendMessage("getMethods",h),await o,i.setupPlugins(e,document.body,"custom-view"),await Promise.allSettled(i.pluginsLoaded),i}static createConfigurator(t,e,s,i=[]){return this._create(t,e,s,i)}static create(t,e,s,i){return this._create(t,e,s,i)}static createViewer(t,e,s,i=[]){return this._create(t,e,s,i)}static async _create(t,e,s,a){return new Promise(async(o,u)=>{try{const u=r((()=>{const t=(t=>JSON.parse(JSON.stringify(t)))(h);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=n.length;t<s;t++){const s=e[n[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=>!!(i.includes(t)||t.endsWith("roomle.com")||t.endsWith("gitlab.io")||t.endsWith("gitlab.com")))(e)&&(t.configuratorId="demoConfigurator"),t.customApiUrl=l.VITE_RAPI_URL,t.emails=!1,t})(),(t=>(c(t),null!=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)})(u);const g=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",i=e.overrideTenant||9,n=s+"/configurators/"+t,r="roomle_portal_v2",a="03-"+window.btoa((new Date).toISOString()+";anonymous;"+r),o=new Request(n,{method:"GET",headers:new Headers({apiKey:r,currentTenant:i,locale:"en",language:"en",device:1,token:a,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:h}=await l.json();return h})(t,u);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 r(s,e)})(s,e)})(g,u);const d=new this(g,e,s,a,o);return await Promise.allSettled(d.pluginsLoaded),d}catch(t){return u(t)}})}teardown(){this._container&&T.delete(this._container);const t=this._container.querySelector("iframe");t&&this._container.removeChild(t),window.removeEventListener("resize",this._onResize)}_createIframe(){var t;const e=document.createElement("iframe");let s=(null==(t=this._configuratorSettings)?void 0:t.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),e.src=s,e.classList.add(v),e.classList.add(b),e}_onResize(){p(this._iframe)}_onUseFullPage(){this._iframe.classList.add(w),document.documentElement.classList.add(E),window.document.body.classList.add(E),u()&&(p(this._iframe),this._iframe.classList.add(D))}_onBackToWebsite(){this._iframe.classList.remove(w),this._iframe.classList.remove(D),document.documentElement.classList.remove(E),window.document.body.classList.remove(E)}_executeMessage({message:t,args:e},s){var i;if(s.source&&s.source===(null==(i=this._iframe)?void 0:i.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]),m(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),m(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());
@@ -41,6 +41,11 @@ export declare class ExposedApi {
41
41
  * @param id database ID of the object you want to load
42
42
  */
43
43
  loadObject(id: string): Promise<Nullable<LoadResponse>>;
44
+ /**
45
+ * Calling this method while dragging an item in from a catalog (or external catalog)
46
+ * will cancel the drag-in and remove the item from the scene.
47
+ */
48
+ cancelDragIn(): void;
44
49
  /**
45
50
  * call this method to load the configuration string you want into the 3d Scene
46
51
  * @param configurationString string of the configuration, starts with `{` and ends with `}`
@@ -1 +0,0 @@
1
- var t=Object.defineProperty,s=(s,r,e)=>((s,r,e)=>r in s?t(s,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[r]=e)(s,"symbol"!=typeof r?r+"":r,e);import{C as r,e,i as a,T as i,b as n,c as h,d as o}from"./touch-drag-BEct6jbW.mjs";import{d as g,e as _,f as u}from"./drag-in-BWioG4OL.mjs";const l=t=>{t.preventDefault(),t.stopPropagation()};class c{constructor({onCustomDragStart:t},e={}){s(this,"_startX",0),s(this,"_startY",0),s(this,"_lastX",0),s(this,"_lastY",0),s(this,"_epsilon"),s(this,"_isWaiting",!1),s(this,"_onCustomDragStart"),this._epsilon="number"==typeof e.epsilon?e.epsilon:r,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&((t,s)=>{const r=this._lastX-t,e=this._lastY-s;return Math.sqrt(r*r+e*e)})(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 d="data-rml-old-draggable",m=(t,s)=>{const e=a(t),i={delay:e?n:h,epsilon:e?o:r};if(!s)return i;if(!(e||t instanceof MouseEvent))return i;const{delayKey:g,epsilonKey:_}=e?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof s[g]&&(i.delay=s.touchDragDelay),"number"==typeof s[_]&&(i.epsilon=s.touchDragEpsilon),i};class p{constructor(t,r,e){s(this,"_options",{}),s(this,"_instance"),s(this,"_viewName"),s(this,"_currentCustomDrag",null),s(this,"_currentBb",null),s(this,"_startTarget",null),s(this,"_onBeforeUpdateDrag",()=>({})),s(this,"isDragging",!1),this._instance=t,this._options=r||{},this._viewName=e}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,s,r="rml_id"){var a;this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(d,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",l),this._startTarget.addEventListener("dragstart",l)),this._currentBb=await this._instance.getBoundingClientRect((a=this._viewName,`[data-rml-custom-view="${a}"]`));const{clientX:i,clientY:n}=e(s),h=this._currentBb.x+i,o=this._currentBb.y+n;this.isDragging=!0,this._instance.dragInObject(t,h,o,r)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:s,clientY:r}=e(t),{url:a,width:i,height:n}=(t=>{let s="",r=_,e=u;if(!t)return{url:g,width:r,height:e};const a=t;if(a instanceof HTMLElement){const t=a.getBoundingClientRect(),i=a.getAttribute("data-rml-ghost-url"),n=a.getAttribute("data-rml-ghost-width"),h=a.getAttribute("data-rml-ghost-height");i?s=i:!i&&a instanceof HTMLImageElement&&a.src&&(s=a.src),s?(r=t.width,e=t.height):s=g,r=n?parseInt(n,10):r,e=h?parseInt(h,10):e}return{url:s||g,width:r,height:e}})(this._startTarget),h=this._currentBb.x+s,o=this._currentBb.y+r,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:a,width:i,height:n},mode:"custom-view"},{x:d,y:m,options:p}=this._onBeforeUpdateDrag(h,o,c),b="number"==typeof d?d:h,D="number"==typeof m?m:o,y=p||c;this._instance.updateDrag(b,D,y)}_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,s,r){this._instance.disableEvents(),this._startTarget=s.target,this._currentCustomDrag=a(s)?new i(void 0,{onTouchDragStart:(s,e)=>{this._dragStart(t,e,r)}},m(s,this._options)):new c({onCustomDragStart:s=>this._dragStart(t,s,r)},m(s,this._options)),this._currentCustomDrag.onStart(s)}dragEnd(){this._dragEnd()}dragUpdate(t){this._dragUpdate(t)}touchStart(t,s,r="rml_id"){this.dragStart(t,s,r)}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(d),this._startTarget.removeAttribute(d),this._startTarget.removeEventListener("dragstart",l))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}export{p as DragInFromCustomViewStrategy};
@@ -1 +0,0 @@
1
- var t=Object.defineProperty,e=(e,n,i)=>((e,n,i)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i)(e,"symbol"!=typeof n?n+"":n,i);import{g as n,e as i,a as s,i as o,T as a}from"./touch-drag-BEct6jbW.mjs";import{R as r,a as h,b as l,c as d,d as g,e as m,f as c,g as u,h as _,i as f,j as p,k as v}from"./drag-in-BWioG4OL.mjs";const y=(t,e,n=0,i=0)=>{const s=e.x+e.width+n,o=e.x-n,a=e.y+e.height+i,r=e.y-i,{x:h,y:l}=t;return h>=o&&h<=s&&l>=r&&l<=a},D=(t,e,n,i=0,s=0)=>{if(n&&(n.hiddenIn||n.visibleIn))return n.visibleIn?y({x:t,y:e},n.visibleIn,i,s):!!n.hiddenIn&&!y({x:t,y:e},n.hiddenIn,-i,-s)};class x{constructor(t=null){e(this,"_dragGhostAnimationFrameId",null),e(this,"_dragGhostRemoveAnimationFrameId",null),e(this,"_dragGhostElement",null),this._dragGhostElement=t}updateDragGhost(t,e,n){var i;this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),(null==(i=n.ghost)||!i.external)&&n.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById(h)){const t=document.createElement("style");t.type="text/css",t.id=h,t.innerHTML=`\n ${l}\n ${d}\n `,document.head.appendChild(t)}})();const i={x:t,y:e};!n.ghost&&this._dragGhostElement&&(n.ghost={}),n.ghost&&!n.ghost.element&&this._dragGhostElement&&(n.ghost.element=this._dragGhostElement),(({x:t,y:e},n)=>{var i,s,o,a,h,l;let d=document.getElementById(r);if(!d){if(d=document.createElement("div"),null!=(i=n.ghost)&&i.element)d.appendChild(n.ghost.element);else{const t=document.createElement("img");t.src=(null==(s=n.ghost)?void 0:s.url)||g,t.width=(null==(o=n.ghost)?void 0:o.width)||m,t.height=(null==(a=n.ghost)?void 0:a.height)||c,d.appendChild(t)}d.id=r,d.style.position="fixed",d.style.top="0",d.style.left="0",d.style.willChange="transform",d.style.transform="translate3d(0, 0, 0)",d.style.zIndex="9999",d.style.opacity="0.5",D(t,e,n.ghost||{},null==(h=n.settings)?void 0:h.dragInOverlapX,null==(l=n.settings)?void 0:l.dragInOverlapY)||(d.style.display="none"),d.style.pointerEvents="none",document.body.appendChild(d)}})(i,n),(({x:t,y:e},n)=>{var i,s,o,a;const h=document.getElementById(r);if(!h)return;let l=null==(i=n.ghost)?void 0:i.width,d=null==(s=n.ghost)?void 0:s.height;typeof l>"u"&&(l=h.getBoundingClientRect().width||m),typeof d>"u"&&(d=h.getBoundingClientRect().height||c);const g=t-l/2,f=e-d/2;h.style.transform=`translate3d(${g}px, ${f}px, 0)`,n.ghost&&(D(t,e,n.ghost,null==(o=n.settings)?void 0:o.dragInOverlapX,null==(a=n.settings)?void 0:a.dragInOverlapY)?h.style.animation!=u&&(h.style.animation=u):h.style.animation!=_&&(h.style.animation=_))})(i,n),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(r);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}class I{constructor(t,n,i){e(this,"_options",{}),e(this,"_instance"),e(this,"_mainDomElement"),e(this,"_currentDrag",{}),e(this,"_currentTouch",null),e(this,"_firefoxDragPosition",{x:0,y:0}),e(this,"_onBeforeUpdateDrag",()=>({})),e(this,"isDragging",!1),e(this,"_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}),this._instance=t,this._mainDomElement=n,this._options=i||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback)}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(t,e,o="rml_id"){const a=this._mainDomElement.parentNode;if("relative"!==n(a).position)return;this._mainDomElement.style.pointerEvents="none";let r=a.querySelector("."+f);r||(r=document.createElement("div"),r.classList.add(f),a.appendChild(r)),r.classList.remove(p.DISPLAY_NONE),e.target.getAttribute("draggable");const h=a.querySelector("."+v);this._currentDrag.event=e;const l=e.target,d=l.cloneNode(!0),g=l.getBoundingClientRect();d.style.width=`${g.width}px`,d.style.height=`${g.height}px`,this._currentDrag.ghost=new x(d),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:m,clientY:c}=i(e,this._firefoxDragPosition);this._currentDrag.offset.x=m-g.left,this._currentDrag.offset.y=c-g.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(h,0,0);const{x:u,y:_}=s(a,this._currentDrag.event||e,this._firefoxDragPosition),y=Math.max(1,u),D=Math.max(1,_);this.isDragging=!0,this._instance.dragInObject(t,y,D,o)}dragUpdate(t){var e;const n=this._mainDomElement.parentNode,{x:a,y:r}=s(n,t,this._firefoxDragPosition);if(0===a&&0===r)return;const h=Math.max(1,a),l=Math.max(1,r);if(1===h&&1===l)return;let d=h,g=l;if(o(t)){const t=(null==(e=this._options.settings)?void 0:e.fingerSize)||0;d=Math.max(2,h+t),g=Math.max(2,l-t)}const{x:m,y:c,options:u}=this._onBeforeUpdateDrag(d,g,{}),_=u||{settings:{},ghost:{}};_.ghost||(_.ghost={}),_.ghost.visibleIn&&_.ghost.hiddenIn||(_.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const f="number"==typeof m?m:d,p="number"==typeof c?c:g;if(this._currentDrag.ghost){const{clientX:e,clientY:n}=i(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(e,n,_)}this._instance.updateDrag(f,p,{})}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("."+f);e&&e.classList.add(p.DISPLAY_NONE)}touchStart(t,e,n="rml_id"){var i,s,o,r;e.preventDefault();const h={};"number"==typeof(null==(s=null==(i=this._options)?void 0:i.settings)?void 0:s.touchDragDelay)&&(h.delay=this._options.settings.touchDragDelay),null!=(r=null==(o=this._options)?void 0:o.settings)&&r.touchDragEpsilon&&(h.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new a(void 0,{onTouchDragStart:(e,i)=>{this.dragStart(t,i,n)}},h),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){}}export{I as DragInFromWebsiteStrategy};