@roomle/embedding-lib 6.0.0 → 6.1.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.
Files changed (31) hide show
  1. package/browser-BhHw2H1M.mjs +1 -0
  2. package/browser-CUgD7zyH.mjs +21 -0
  3. package/docs/md/web/embedding/CHANGELOG.md +151 -571
  4. package/{embedding-plugins-CjNos83d.mjs → embedding-plugins-Cm7O1pKC.mjs} +2 -2
  5. package/{embedding-plugins-DePKqSKW.mjs → embedding-plugins-Dzhuj1By.mjs} +1 -1
  6. package/embedding-plugins.js +1 -1
  7. package/embedding-plugins.min.js +1 -1
  8. package/from-custom-view-5SS9UqAH.mjs +197 -0
  9. package/from-custom-view-CfMGS1-t.mjs +1 -0
  10. package/from-website-CFTjWbqp.mjs +230 -0
  11. package/from-website-ExTzmsnv.mjs +1 -0
  12. package/hi.js +52 -49
  13. package/hi.min.js +1 -1
  14. package/package.json +1 -1
  15. package/packages/embedding-lib/src/homag-intelligence/hi-setup.d.ts +3 -1
  16. package/packages/embedding-lib/src/plugins/strategy/from-custom-view.d.ts +6 -1
  17. package/packages/embedding-lib/src/plugins/strategy/from-website.d.ts +6 -1
  18. package/packages/embedding-lib/src/roomle-embedding-lib.d.ts +1 -0
  19. package/packages/embedding-lib/src/utils.d.ts +1 -0
  20. package/roomle-embedding-lib.js +123 -139
  21. package/roomle-embedding-lib.min.js +1 -1
  22. package/{touch-drag-DWISKgWm.mjs → touch-drag-CfMLD_hM.mjs} +1 -1
  23. package/{touch-drag-BzREygxc.mjs → touch-drag-TGCsdNqP.mjs} +1 -1
  24. package/utils-BqTPLNLs.mjs +1 -0
  25. package/utils-Dav4kGNW.mjs +150 -0
  26. package/from-custom-view-BAiOXktb.mjs +0 -164
  27. package/from-custom-view-Ch3rb-JF.mjs +0 -1
  28. package/from-website-B-Vh-DVX.mjs +0 -1
  29. package/from-website-BicmMNsE.mjs +0 -202
  30. package/utils-D--vltCL.mjs +0 -113
  31. package/utils-uEcN1DUR.mjs +0 -1
@@ -41,7 +41,7 @@ class E extends I {
41
41
  async init() {
42
42
  if (await super.init(), this._mode === "website")
43
43
  try {
44
- const { DragInFromWebsiteStrategy: t } = await import("./from-website-BicmMNsE.mjs");
44
+ const { DragInFromWebsiteStrategy: t } = await import("./from-website-CFTjWbqp.mjs");
45
45
  this._strategy = new t(
46
46
  this._instance,
47
47
  this._mainDomElement,
@@ -52,7 +52,7 @@ class E extends I {
52
52
  }
53
53
  else if (this._mode === "custom-view")
54
54
  try {
55
- const { DragInFromCustomViewStrategy: t } = await import("./from-custom-view-BAiOXktb.mjs");
55
+ const { DragInFromCustomViewStrategy: t } = await import("./from-custom-view-5SS9UqAH.mjs");
56
56
  this._strategy = new t(
57
57
  this._instance,
58
58
  this._mainDomElement,
@@ -1 +1 @@
1
- const t="rml-drag-in-styles",e="rml-drag-in-drag-element",s="rml-drag-in-overlay",a="rml-drag-in-drag-ghost",r="rml-drag-in-fade-in",i="rml-drag-in-fade-out",n={DISPLAY_NONE:"rml-display-none"},o="250ms",d="forwards",m=`@keyframes ${r} {from{opacity: 0;}to {opacity: 0.5;}}`,g=`@keyframes ${i} {from{opacity: 0.5;}to {opacity: 0;}}`,l=`${r} ${o} ${d}`,c=`${i} ${o} ${d}`,h="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",u=112,p=112;class _{_mainDomElement;_instance;_mode="website";_viewName="main";constructor(t,e,s,a){this._instance=t,this._mainDomElement=e,this._mode=s,this._viewName=a}async init(){return Promise.resolve()}}class y extends _{options={};_customDragSignal=new AbortController;_injectStyles(){if(!document.getElementById(t)){const e=document.createElement("style");e.type="text/css",e.id=t,e.innerHTML=`\n .${n.DISPLAY_NONE}{display:none}\n .${s}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${a}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${m}\n ${g}\n `,document.head.appendChild(e)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+a);e||(e=document.createElement("div"),e.classList.add(a),e.innerText=" ",t.appendChild(e))}constructor(t,e,s,a){super(t,e,s,a),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await import("./from-website-B-Vh-DVX.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-Ch3rb-JF.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 r=this._customDragSignal.signal,i=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",i,{signal:r}),document.addEventListener("mouseup",n,{signal:r}),document.addEventListener("mousemove",o,{signal:r}),document.addEventListener("mouseleave",n,{signal:r}),document.addEventListener("touchstart",i,{signal:r}),document.addEventListener("touchend",n,{signal:r}),document.addEventListener("touchmove",o,{signal:r})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}const D=Object.freeze(Object.defineProperty({__proto__:null,DragIn:y},Symbol.toStringTag,{value:"Module"}));export{y as D,e as R,t as a,m as b,g as c,h as d,u as e,p as f,l as g,c as h,s as i,n as j,a as k,D as l};
1
+ const t="rml-drag-in-styles",e="rml-drag-in-drag-element",s="rml-drag-in-overlay",a="rml-drag-in-drag-ghost",r="rml-drag-in-fade-in",i="rml-drag-in-fade-out",n={DISPLAY_NONE:"rml-display-none"},o="250ms",d="forwards",m=`@keyframes ${r} {from{opacity: 0;}to {opacity: 0.5;}}`,g=`@keyframes ${i} {from{opacity: 0.5;}to {opacity: 0;}}`,l=`${r} ${o} ${d}`,c=`${i} ${o} ${d}`,h="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",u=112,p=112;class _{_mainDomElement;_instance;_mode="website";_viewName="main";constructor(t,e,s,a){this._instance=t,this._mainDomElement=e,this._mode=s,this._viewName=a}async init(){return Promise.resolve()}}class y extends _{options={};_customDragSignal=new AbortController;_injectStyles(){if(!document.getElementById(t)){const e=document.createElement("style");e.type="text/css",e.id=t,e.innerHTML=`\n .${n.DISPLAY_NONE}{display:none}\n .${s}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${a}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${m}\n ${g}\n `,document.head.appendChild(e)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+a);e||(e=document.createElement("div"),e.classList.add(a),e.innerText=" ",t.appendChild(e))}constructor(t,e,s,a){super(t,e,s,a),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await import("./from-website-ExTzmsnv.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-CfMGS1-t.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 r=this._customDragSignal.signal,i=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",i,{signal:r}),document.addEventListener("mouseup",n,{signal:r}),document.addEventListener("mousemove",o,{signal:r}),document.addEventListener("mouseleave",n,{signal:r}),document.addEventListener("touchstart",i,{signal:r}),document.addEventListener("touchend",n,{signal:r}),document.addEventListener("touchmove",o,{signal:r})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}const D=Object.freeze(Object.defineProperty({__proto__:null,DragIn:y},Symbol.toStringTag,{value:"Module"}));export{y as D,e as R,t as a,m as b,g as c,h as d,u as e,p as f,l as g,c as h,s as i,n as j,a as k,D as l};
@@ -1,4 +1,4 @@
1
- import { D as R, g as D, b as G, h as L, c as I, R as T, f as S, d as a, e as M, a as N } from "./embedding-plugins-CjNos83d.mjs";
1
+ import { D as R, g as D, b as G, h as L, c as I, R as T, f as S, d as a, e as M, a as N } from "./embedding-plugins-Cm7O1pKC.mjs";
2
2
  export {
3
3
  R as DragIn,
4
4
  D as RML_DRAG_GHOST_FADE_IN,
@@ -1 +1 @@
1
- import{D as _,g as A,b as a,h as s,c as R,R as D,f as G,d as L,e as I,a as T}from"./embedding-plugins-DePKqSKW.mjs";export{_ as DragIn,A as RML_DRAG_GHOST_FADE_IN,a as RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS,s as RML_DRAG_GHOST_FADE_OUT,R as RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS,D as RML_DRAG_IN_DRAG_ELEMENT_ID,G as RML_DRAG_IN_FALLBACK_GHOST_HEIGHT,L as RML_DRAG_IN_FALLBACK_GHOST_URL,I as RML_DRAG_IN_FALLBACK_GHOST_WIDTH,T as RML_DRAG_IN_STYLES_ID};
1
+ import{D as _,g as A,b as a,h as s,c as R,R as D,f as G,d as L,e as I,a as T}from"./embedding-plugins-Dzhuj1By.mjs";export{_ as DragIn,A as RML_DRAG_GHOST_FADE_IN,a as RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS,s as RML_DRAG_GHOST_FADE_OUT,R as RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS,D as RML_DRAG_IN_DRAG_ELEMENT_ID,G as RML_DRAG_IN_FALLBACK_GHOST_HEIGHT,L as RML_DRAG_IN_FALLBACK_GHOST_URL,I as RML_DRAG_IN_FALLBACK_GHOST_WIDTH,T as RML_DRAG_IN_STYLES_ID};
@@ -0,0 +1,197 @@
1
+ import { e as O, b as D, i as b } from "./utils-Dav4kGNW.mjs";
2
+ import { C as v, T as A, a as L, b as w, c as Y } from "./touch-drag-CfMLD_hM.mjs";
3
+ import { f as G, e as R, d as c } from "./embedding-plugins-Cm7O1pKC.mjs";
4
+ const X = (r) => `[data-rml-custom-view="${r}"]`, g = (r) => {
5
+ r.preventDefault(), r.stopPropagation();
6
+ }, U = (r, t, s, e) => {
7
+ const a = s - r, n = e - t;
8
+ return Math.sqrt(a * a + n * n);
9
+ };
10
+ class M {
11
+ _startX = 0;
12
+ _startY = 0;
13
+ _lastX = 0;
14
+ _lastY = 0;
15
+ _epsilon;
16
+ _isWaiting = !1;
17
+ _onCustomDragStart;
18
+ constructor({ onCustomDragStart: t }, s = {}) {
19
+ this._epsilon = typeof s.epsilon == "number" ? s.epsilon : v, this._onCustomDragStart = t;
20
+ }
21
+ onMove(t) {
22
+ this._lastX = t.clientX, this._lastY = t.clientY, this._isWaiting && U(
23
+ this._startX,
24
+ this._startY,
25
+ this._lastX,
26
+ this._lastY
27
+ ) > this._epsilon && (this._onCustomDragStart(t), this._isWaiting = !1);
28
+ }
29
+ onStart(t) {
30
+ this._startX = t.clientX, this._startY = t.clientY, this.onMove(t), this._isWaiting = !0;
31
+ }
32
+ onEnd() {
33
+ this._reset();
34
+ }
35
+ _reset() {
36
+ this._startX = 0, this._startY = 0, this._lastX = 0, this._lastY = 0, this._isWaiting = !1;
37
+ }
38
+ }
39
+ const l = "data-rml-old-draggable", H = void 0, p = (r, t) => {
40
+ const s = b(r), e = {
41
+ delay: s ? w : Y,
42
+ epsilon: s ? L : v
43
+ };
44
+ if (!t)
45
+ return e;
46
+ if (!s && !(r instanceof MouseEvent))
47
+ return console.warn(
48
+ "Unsupported event! It is not TouchEvent and also not MouseEvent"
49
+ ), e;
50
+ const {
51
+ delayKey: a,
52
+ epsilonKey: n
53
+ } = s ? { delayKey: "touchDragDelay", epsilonKey: "touchDragEpsilon" } : { delayKey: "customDragDelay", epsilonKey: "customDragEpsilon" };
54
+ return typeof t[a] == "number" && (e.delay = t.touchDragDelay), typeof t[n] == "number" && (e.epsilon = t.touchDragEpsilon), e;
55
+ }, x = (r) => {
56
+ let t = "", s = R, e = G;
57
+ if (!r)
58
+ return { url: c, width: s, height: e };
59
+ const a = r;
60
+ if (a instanceof HTMLElement) {
61
+ const n = a.getBoundingClientRect(), i = a.getAttribute("data-rml-ghost-url"), h = a.getAttribute("data-rml-ghost-width"), o = a.getAttribute("data-rml-ghost-height");
62
+ i ? t = i : !i && a instanceof HTMLImageElement && a.src && (t = a.src), t ? (s = n.width, e = n.height) : t = c, s = h ? parseInt(h, 10) : s, e = o ? parseInt(o, 10) : e;
63
+ }
64
+ return { url: t || c, width: s, height: e };
65
+ };
66
+ class F {
67
+ _options = {};
68
+ _instance;
69
+ _mainDomElement;
70
+ _viewName;
71
+ _currentCustomDrag = null;
72
+ _currentBb = null;
73
+ _startTarget = null;
74
+ _onBeforeUpdateDrag = () => ({});
75
+ isDragging = !1;
76
+ _hasEnteredIframe = !1;
77
+ _pendingDragIn = null;
78
+ _canvasBb = null;
79
+ _overlayBb = null;
80
+ _interactionContainerBb = null;
81
+ constructor(t, s, e, a) {
82
+ this._instance = t, this._options = e || {}, this._viewName = a, this._mainDomElement = s, this._mainDomElement.parentElement?.addEventListener("dragleave", () => {
83
+ this._instance.cancelDragIn();
84
+ });
85
+ }
86
+ beforeUpdateGhost(t) {
87
+ this._onBeforeUpdateDrag = t;
88
+ }
89
+ async _dragStart(t, s, e = "rml_id") {
90
+ this._startTarget && (this._startTarget.style.pointerEvents = "none", this._startTarget.style.userSelect = "none", this._startTarget.setAttribute(
91
+ l,
92
+ this._startTarget.draggable.toString()
93
+ ), this._startTarget.draggable = !1, this._startTarget.removeEventListener("dragstart", g), this._startTarget.addEventListener("dragstart", g)), this._currentBb = this._instance.getBoundingClientRect(
94
+ X(this._viewName)
95
+ ), this._canvasBb = await this._instance.getBoundingClientRect("canvas"), this._overlayBb = (await this._instance.getDrawerBoundingClientRect()).final, this._interactionContainerBb = await this._instance.getBoundingClientRect(
96
+ ".interaction-container"
97
+ ), this._pendingDragIn = { id: t, type: e }, this._hasEnteredIframe = !1, this.isDragging = !0;
98
+ }
99
+ _dragUpdate(t) {
100
+ if (document.body.focus(), this._currentCustomDrag && this._currentCustomDrag.onMove(t), !this._currentBb || !this.isDragging)
101
+ return;
102
+ const { clientX: s, clientY: e } = O(t), a = s >= 0 && s <= this._currentBb.width && e >= 0 && e <= this._currentBb.height;
103
+ if (a && !this._hasEnteredIframe && this._pendingDragIn && D(
104
+ s,
105
+ e,
106
+ this._canvasBb,
107
+ this._overlayBb,
108
+ this._interactionContainerBb
109
+ )) {
110
+ const y = this._currentBb.x + s, S = this._currentBb.y + e;
111
+ this._instance.dragInObject(
112
+ this._pendingDragIn.id,
113
+ y,
114
+ S,
115
+ this._pendingDragIn.type
116
+ ), this._hasEnteredIframe = !0;
117
+ }
118
+ if (a && this._hasEnteredIframe && this._canvasBb && !D(
119
+ s,
120
+ e,
121
+ this._canvasBb,
122
+ this._overlayBb,
123
+ this._interactionContainerBb
124
+ )) {
125
+ this._instance.cancelDragIn(), this._hasEnteredIframe = !1;
126
+ return;
127
+ }
128
+ if (!this._hasEnteredIframe)
129
+ return;
130
+ const { url: n, width: i, height: h } = x(this._startTarget), o = this._currentBb.x + s, u = this._currentBb.y + e, _ = this._options || {}, d = {
131
+ ghost: {
132
+ visibleIn: {
133
+ x: this._currentBb.x - (_.dragInOverlapX || 0),
134
+ y: this._currentBb.y + (_.dragInOverlapY || 0),
135
+ width: this._currentBb.width + (_.dragInOverlapX || 0),
136
+ height: this._currentBb.height + (_.dragInOverlapY || 0)
137
+ },
138
+ url: n,
139
+ width: i,
140
+ height: h
141
+ },
142
+ mode: "custom-view"
143
+ }, {
144
+ x: m,
145
+ y: f,
146
+ options: E
147
+ } = this._onBeforeUpdateDrag(o, u, d), B = typeof m == "number" ? m : o, T = typeof f == "number" ? f : u, C = E || d;
148
+ this._instance.updateDrag(B, T, C);
149
+ }
150
+ _dragEnd() {
151
+ this._currentCustomDrag && this._currentCustomDrag.onEnd(), this._currentCustomDrag = null, this.isDragging = !1, this._currentBb = null, this._canvasBb = null, this._overlayBb = null, this._interactionContainerBb = null, this._resetStartTarget(), this._instance.enableEvents(), this._hasEnteredIframe && this._instance.dragInObjectEnd(), this._hasEnteredIframe = !1, this._pendingDragIn = null;
152
+ }
153
+ dragStart(t, s, e) {
154
+ this._instance.disableEvents(), this._startTarget = s.target;
155
+ const a = (n, i) => {
156
+ this._dragStart(t, i, e);
157
+ };
158
+ this._currentCustomDrag = b(s) ? new A(
159
+ H,
160
+ {
161
+ onTouchDragStart: a
162
+ },
163
+ p(s, this._options)
164
+ ) : new M(
165
+ {
166
+ onCustomDragStart: (n) => this._dragStart(t, n, e)
167
+ },
168
+ p(s, this._options)
169
+ ), this._currentCustomDrag.onStart(s);
170
+ }
171
+ dragEnd() {
172
+ this._dragEnd();
173
+ }
174
+ dragUpdate(t) {
175
+ this._dragUpdate(t);
176
+ }
177
+ touchStart(t, s, e = "rml_id") {
178
+ this.dragStart(t, s, e);
179
+ }
180
+ touchMove(t) {
181
+ this.dragUpdate(t);
182
+ }
183
+ touchEnd() {
184
+ this.dragEnd();
185
+ }
186
+ dispose() {
187
+ }
188
+ _resetStartTarget() {
189
+ this._startTarget && (this._startTarget.style.pointerEvents = "", this._startTarget.style.userSelect = "", this._startTarget.draggable = this._startTarget.getAttribute(l) === "true", this._startTarget.removeAttribute(l), this._startTarget.removeEventListener("dragstart", g));
190
+ }
191
+ releaseInput(t) {
192
+ this._currentCustomDrag && this._currentCustomDrag.onEnd(), this._resetStartTarget();
193
+ }
194
+ }
195
+ export {
196
+ F as DragInFromCustomViewStrategy
197
+ };
@@ -0,0 +1 @@
1
+ import{e as t,b as e,i as s}from"./utils-BqTPLNLs.mjs";import{C as r,T as a,a as i,b as n,c as h}from"./touch-drag-TGCsdNqP.mjs";import{f as o,e as g,d as _}from"./embedding-plugins-Dzhuj1By.mjs";const l=t=>{t.preventDefault(),t.stopPropagation()};class u{_startX=0;_startY=0;_lastX=0;_lastY=0;_epsilon;_isWaiting=!1;_onCustomDragStart;constructor({onCustomDragStart:t},e={}){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,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 c="data-rml-old-draggable",d=(t,e)=>{const a=s(t),o={delay:a?n:h,epsilon:a?i:r};if(!e)return o;if(!(a||t instanceof MouseEvent))return o;const{delayKey:g,epsilonKey:_}=a?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof e[g]&&(o.delay=e.touchDragDelay),"number"==typeof e[_]&&(o.epsilon=e.touchDragEpsilon),o};class m{_options={};_instance;_mainDomElement;_viewName;_currentCustomDrag=null;_currentBb=null;_startTarget=null;_onBeforeUpdateDrag=()=>({});isDragging=!1;_hasEnteredIframe=!1;_pendingDragIn=null;_canvasBb=null;_overlayBb=null;_interactionContainerBb=null;constructor(t,e,s,r){this._instance=t,this._options=s||{},this._viewName=r,this._mainDomElement=e,this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,e,s="rml_id"){this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(c,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",l),this._startTarget.addEventListener("dragstart",l)),this._currentBb=this._instance.getBoundingClientRect(`[data-rml-custom-view="${this._viewName}"]`),this._canvasBb=await this._instance.getBoundingClientRect("canvas"),this._overlayBb=(await this._instance.getDrawerBoundingClientRect()).final,this._interactionContainerBb=await this._instance.getBoundingClientRect(".interaction-container"),this._pendingDragIn={id:t,type:s},this._hasEnteredIframe=!1,this.isDragging=!0}_dragUpdate(s){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(s),!this._currentBb||!this.isDragging)return;const{clientX:r,clientY:a}=t(s),i=r>=0&&r<=this._currentBb.width&&a>=0&&a<=this._currentBb.height;if(i&&!this._hasEnteredIframe&&this._pendingDragIn&&e(r,a,this._canvasBb,this._overlayBb,this._interactionContainerBb)){const t=this._currentBb.x+r,e=this._currentBb.y+a;this._instance.dragInObject(this._pendingDragIn.id,t,e,this._pendingDragIn.type),this._hasEnteredIframe=!0}if(i&&this._hasEnteredIframe&&this._canvasBb&&!e(r,a,this._canvasBb,this._overlayBb,this._interactionContainerBb))return this._instance.cancelDragIn(),void(this._hasEnteredIframe=!1);if(!this._hasEnteredIframe)return;const{url:n,width:h,height:l}=(t=>{let e="",s=g,r=o;if(!t)return{url:_,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=_,s=n?parseInt(n,10):s,r=h?parseInt(h,10):r}return{url:e||_,width:s,height:r}})(this._startTarget),u=this._currentBb.x+r,c=this._currentBb.y+a,d=this._options||{},m={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:h,height:l},mode:"custom-view"},{x:p,y:b,options:D}=this._onBeforeUpdateDrag(u,c,m),v="number"==typeof p?p:u,y="number"==typeof b?b:c,B=D||m;this._instance.updateDrag(v,y,B)}_dragEnd(){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._currentCustomDrag=null,this.isDragging=!1,this._currentBb=null,this._canvasBb=null,this._overlayBb=null,this._interactionContainerBb=null,this._resetStartTarget(),this._instance.enableEvents(),this._hasEnteredIframe&&this._instance.dragInObjectEnd(),this._hasEnteredIframe=!1,this._pendingDragIn=null}dragStart(t,e,r){this._instance.disableEvents(),this._startTarget=e.target,this._currentCustomDrag=s(e)?new a(void 0,{onTouchDragStart:(e,s)=>{this._dragStart(t,s,r)}},d(e,this._options)):new u({onCustomDragStart:e=>this._dragStart(t,e,r)},d(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(c),this._startTarget.removeAttribute(c),this._startTarget.removeEventListener("dragstart",l))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}export{m as DragInFromCustomViewStrategy};
@@ -0,0 +1,230 @@
1
+ import { g as M, e as A, a as G, i as N } from "./utils-Dav4kGNW.mjs";
2
+ import { T as O } from "./touch-drag-CfMLD_hM.mjs";
3
+ import { R as D, a as b, b as w, c as H, d as U, e as C, f as T, g as S, h as x, i as I, j as R, k as Y } from "./embedding-plugins-Cm7O1pKC.mjs";
4
+ const v = (l, n, t = 0, e = 0) => {
5
+ const i = n.x + n.width + t, a = n.x - t, r = n.y + n.height + e, s = n.y - e, { x: o, y: h } = l;
6
+ return o >= a && o <= i && h >= s && h <= r;
7
+ }, L = (l, n, t, e = 0, i = 0) => {
8
+ if (!(!t || !t.hiddenIn && !t.visibleIn))
9
+ return t.visibleIn ? v(
10
+ { x: l, y: n },
11
+ t.visibleIn,
12
+ e,
13
+ i
14
+ ) : t.hiddenIn ? !v(
15
+ { x: l, y: n },
16
+ t.hiddenIn,
17
+ -e,
18
+ -i
19
+ ) : !1;
20
+ }, P = () => {
21
+ if (!!!document.getElementById(b)) {
22
+ const n = document.createElement("style");
23
+ n.type = "text/css", n.id = b, n.innerHTML = `
24
+ ${w}
25
+ ${H}
26
+ `, document.head.appendChild(n);
27
+ }
28
+ }, X = ({ x: l, y: n }, t) => {
29
+ let e = document.getElementById(D);
30
+ if (!e) {
31
+ if (e = document.createElement("div"), t.ghost?.element)
32
+ e.appendChild(t.ghost.element);
33
+ else {
34
+ const i = document.createElement("img");
35
+ i.src = t.ghost?.url || U, i.width = t.ghost?.width || C, i.height = t.ghost?.height || T, e.appendChild(i);
36
+ }
37
+ e.id = D, e.style.position = "fixed", e.style.top = "0", e.style.left = "0", e.style.willChange = "transform", e.style.transform = "translate3d(0, 0, 0)", e.style.zIndex = "9999", e.style.opacity = "0.5", L(
38
+ l,
39
+ n,
40
+ t.ghost || {},
41
+ t.settings?.dragInOverlapX,
42
+ t.settings?.dragInOverlapY
43
+ ) || (e.style.display = "none"), e.style.pointerEvents = "none", document.body.appendChild(e);
44
+ }
45
+ }, k = ({ x: l, y: n }, t) => {
46
+ const e = document.getElementById(D);
47
+ if (!e)
48
+ return;
49
+ let i = t.ghost?.width, a = t.ghost?.height;
50
+ typeof i > "u" && (i = e.getBoundingClientRect().width || C), typeof a > "u" && (a = e.getBoundingClientRect().height || T);
51
+ const r = l - i / 2, s = n - a / 2;
52
+ e.style.transform = `translate3d(${r}px, ${s}px, 0)`, t.ghost && (L(
53
+ l,
54
+ n,
55
+ t.ghost,
56
+ t.settings?.dragInOverlapX,
57
+ t.settings?.dragInOverlapY
58
+ ) ? e.style.animation != S && (e.style.animation = S) : e.style.animation != x && (e.style.animation = x));
59
+ };
60
+ class $ {
61
+ _dragGhostAnimationFrameId = null;
62
+ _dragGhostRemoveAnimationFrameId = null;
63
+ _dragGhostElement = null;
64
+ constructor(n = null) {
65
+ this._dragGhostElement = n;
66
+ }
67
+ updateDragGhost(n, t, e) {
68
+ this._dragGhostRemoveAnimationFrameId && (cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId), this._dragGhostRemoveAnimationFrameId = null), !e.ghost?.external && e.ghost && (this._dragGhostAnimationFrameId || (this._dragGhostAnimationFrameId = requestAnimationFrame(() => {
69
+ P();
70
+ const i = { x: n, y: t };
71
+ !e.ghost && this._dragGhostElement && (e.ghost = {}), e.ghost && !e.ghost.element && this._dragGhostElement && (e.ghost.element = this._dragGhostElement), X(i, e), k(i, e), this._dragGhostAnimationFrameId = null;
72
+ })));
73
+ }
74
+ removeDragGhost() {
75
+ this._dragGhostAnimationFrameId && (cancelAnimationFrame(this._dragGhostAnimationFrameId), this._dragGhostAnimationFrameId = null), this._dragGhostRemoveAnimationFrameId || (this._dragGhostRemoveAnimationFrameId = requestAnimationFrame(() => {
76
+ const n = document.getElementById(D);
77
+ n && document.body.removeChild(n), this._dragGhostRemoveAnimationFrameId = null;
78
+ }));
79
+ }
80
+ }
81
+ class K {
82
+ _options = {};
83
+ _instance;
84
+ _mainDomElement;
85
+ _currentDrag = {};
86
+ _currentTouch = null;
87
+ _firefoxDragPosition = { x: 0, y: 0 };
88
+ _onBeforeUpdateDrag = () => ({});
89
+ isDragging = !1;
90
+ _hasEnteredIframe = !1;
91
+ _pendingDragIn = null;
92
+ _canvasBb = null;
93
+ _overlayBb = null;
94
+ _interactionContainerBb = null;
95
+ _firefoxFallback = (n) => {
96
+ if (!this._currentDrag.event)
97
+ return;
98
+ n.preventDefault();
99
+ const t = n || window.event;
100
+ this._firefoxDragPosition.x = t.pageX || 0, this._firefoxDragPosition.y = t.pageY || 0;
101
+ };
102
+ constructor(n, t, e) {
103
+ this._instance = n, this._mainDomElement = t, this._options = e || {}, this._firefoxFallback = this._firefoxFallback.bind(this), document.addEventListener("dragover", this._firefoxFallback), this._mainDomElement.parentElement?.addEventListener("dragleave", () => {
104
+ this._instance.cancelDragIn();
105
+ });
106
+ }
107
+ beforeUpdateGhost(n) {
108
+ this._onBeforeUpdateDrag = n;
109
+ }
110
+ async dragStart(n, t, e = "rml_id") {
111
+ const i = this._mainDomElement.parentNode;
112
+ if (M(i).position !== "relative") {
113
+ console.warn(
114
+ "Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly"
115
+ );
116
+ return;
117
+ }
118
+ this._mainDomElement.style.pointerEvents = "none";
119
+ let r = i.querySelector(
120
+ "." + I
121
+ );
122
+ r || (r = document.createElement("div"), r.classList.add(I), i.appendChild(r)), r.classList.remove(R.DISPLAY_NONE), t.target.getAttribute("draggable") || console.warn(
123
+ `Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`
124
+ );
125
+ const o = i.querySelector(
126
+ "." + Y
127
+ );
128
+ this._currentDrag.event = t;
129
+ const h = t.target, g = h.cloneNode(!0), d = h.getBoundingClientRect();
130
+ g.style.width = `${d.width}px`, g.style.height = `${d.height}px`, this._currentDrag.ghost = new $(g), this._currentDrag.offset || (this._currentDrag.offset = { x: 0, y: 0 });
131
+ const { clientX: m, clientY: f } = A(
132
+ t,
133
+ this._firefoxDragPosition
134
+ );
135
+ this._currentDrag.offset.x = m - d.left, this._currentDrag.offset.y = f - d.top, t instanceof DragEvent && t.dataTransfer && t.dataTransfer.setDragImage && t.dataTransfer.setDragImage(o, 0, 0), G(i, this._currentDrag.event || t, this._firefoxDragPosition), this._pendingDragIn = { id: n, type: e }, this._hasEnteredIframe = !1, this.isDragging = !0, this._interactionContainerBb = (await this._instance.getDrawerBoundingClientRect()).final;
136
+ }
137
+ dragUpdate(n) {
138
+ const t = this._mainDomElement.parentNode, { x: e, y: i } = G(t, n, this._firefoxDragPosition);
139
+ if (e === 0 && i === 0)
140
+ return;
141
+ const a = Math.max(1, e), r = Math.max(1, i);
142
+ if (a === 1 && r === 1)
143
+ return;
144
+ const s = this._mainDomElement.getBoundingClientRect(), { clientX: o, clientY: h } = A(
145
+ n,
146
+ this._firefoxDragPosition
147
+ ), g = o >= s.left && o <= s.right && h >= s.top && h <= s.bottom, d = () => {
148
+ if (!(o >= s.left && o <= s.right && h >= s.top && h <= s.bottom))
149
+ return !1;
150
+ if (this._interactionContainerBb) {
151
+ const u = {
152
+ left: this._interactionContainerBb.left + s.left,
153
+ top: this._interactionContainerBb.top + s.top,
154
+ right: this._interactionContainerBb.right + s.left,
155
+ bottom: this._interactionContainerBb.bottom + s.top
156
+ };
157
+ return !(o >= u.left && o <= u.right && h >= u.top && h <= u.bottom);
158
+ }
159
+ return !0;
160
+ };
161
+ if (g && this._pendingDragIn) {
162
+ const _ = d();
163
+ if (_ && !this._hasEnteredIframe)
164
+ this._instance.dragInObject(
165
+ this._pendingDragIn.id,
166
+ a,
167
+ r,
168
+ this._pendingDragIn.type
169
+ ), this._hasEnteredIframe = !0;
170
+ else if (!_ && this._hasEnteredIframe) {
171
+ this._instance.cancelDragIn(), this._hasEnteredIframe = !1;
172
+ return;
173
+ }
174
+ } else if (!g && this._hasEnteredIframe) {
175
+ this._instance.cancelDragIn(), this._hasEnteredIframe = !1;
176
+ return;
177
+ }
178
+ if (!this._hasEnteredIframe)
179
+ return;
180
+ let m = a, f = r;
181
+ if (N(n)) {
182
+ const _ = this._options.settings?.fingerSize || 0;
183
+ m = Math.max(2, a + _), f = Math.max(2, r - _);
184
+ }
185
+ const {
186
+ x: y,
187
+ y: E,
188
+ options: p
189
+ } = this._onBeforeUpdateDrag(m, f, {}), c = p || { settings: {}, ghost: {} };
190
+ c.ghost || (c.ghost = {}), c.ghost.visibleIn && c.ghost.hiddenIn || (c.ghost.hiddenIn = this._mainDomElement.getBoundingClientRect());
191
+ const F = typeof y == "number" ? y : m, B = typeof E == "number" ? E : f;
192
+ this._currentDrag.ghost && this._currentDrag.ghost.updateDragGhost(o, h, c), this._instance.updateDrag(F, B, {});
193
+ }
194
+ dragEnd() {
195
+ this._mainDomElement.style.pointerEvents = "all";
196
+ const n = this._mainDomElement.parentNode;
197
+ this.isDragging = !1, this._hasEnteredIframe && this._instance.dragInObjectEnd(), this._currentDrag.ghost && (this._currentDrag.ghost.removeDragGhost(), this._currentDrag.ghost = null), this._currentDrag = {}, this._firefoxDragPosition = { x: 0, y: 0 }, this._hasEnteredIframe = !1, this._pendingDragIn = null, this._interactionContainerBb = null;
198
+ const t = n.querySelector(
199
+ "." + I
200
+ );
201
+ t && t.classList.add(R.DISPLAY_NONE);
202
+ }
203
+ touchStart(n, t, e = "rml_id") {
204
+ t.preventDefault();
205
+ const i = (r, s) => {
206
+ this.dragStart(n, s, e);
207
+ }, a = {};
208
+ typeof this._options?.settings?.touchDragDelay == "number" && (a.delay = this._options.settings.touchDragDelay), this._options?.settings?.touchDragEpsilon && (a.epsilon = this._options.settings.touchDragEpsilon), this._currentTouch = new O(
209
+ void 0,
210
+ {
211
+ onTouchDragStart: i
212
+ },
213
+ a
214
+ ), this._currentTouch.onStart(t);
215
+ }
216
+ touchMove(n) {
217
+ this._currentTouch && this._currentTouch.onMove(n), this._currentDrag.event && this.dragUpdate(n);
218
+ }
219
+ touchEnd() {
220
+ this._currentTouch && this._currentTouch.onEnd(), this._currentTouch = null, this.dragEnd();
221
+ }
222
+ dispose() {
223
+ document.removeEventListener("dragover", this._firefoxFallback);
224
+ }
225
+ releaseInput(n) {
226
+ }
227
+ }
228
+ export {
229
+ K as DragInFromWebsiteStrategy
230
+ };
@@ -0,0 +1 @@
1
+ import{g as t,e,a as n,i}from"./utils-BqTPLNLs.mjs";import{T as s}from"./touch-drag-TGCsdNqP.mjs";import{R as r,a,b as o,c as h,d as g,e as d,f as l,g as m,h as c,i as _,j as u,k as f}from"./embedding-plugins-Dzhuj1By.mjs";const p=(t,e,n=0,i=0)=>{const s=e.x+e.width+n,r=e.x-n,a=e.y+e.height+i,o=e.y-i,{x:h,y:g}=t;return h>=r&&h<=s&&g>=o&&g<=a},D=(t,e,n,i=0,s=0)=>{if(n&&(n.hiddenIn||n.visibleIn))return n.visibleIn?p({x:t,y:e},n.visibleIn,i,s):!!n.hiddenIn&&!p({x:t,y:e},n.hiddenIn,-i,-s)};class I{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(t,e,n){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!n.ghost?.external&&n.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById(a)){const t=document.createElement("style");t.type="text/css",t.id=a,t.innerHTML=`\n ${o}\n ${h}\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)=>{let i=document.getElementById(r);if(!i){if(i=document.createElement("div"),n.ghost?.element)i.appendChild(n.ghost.element);else{const t=document.createElement("img");t.src=n.ghost?.url||g,t.width=n.ghost?.width||d,t.height=n.ghost?.height||l,i.appendChild(t)}i.id=r,i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.willChange="transform",i.style.transform="translate3d(0, 0, 0)",i.style.zIndex="9999",i.style.opacity="0.5",D(t,e,n.ghost||{},n.settings?.dragInOverlapX,n.settings?.dragInOverlapY)||(i.style.display="none"),i.style.pointerEvents="none",document.body.appendChild(i)}})(i,n),(({x:t,y:e},n)=>{const i=document.getElementById(r);if(!i)return;let s=n.ghost?.width,a=n.ghost?.height;typeof s>"u"&&(s=i.getBoundingClientRect().width||d),typeof a>"u"&&(a=i.getBoundingClientRect().height||l);const o=t-s/2,h=e-a/2;i.style.transform=`translate3d(${o}px, ${h}px, 0)`,n.ghost&&(D(t,e,n.ghost,n.settings?.dragInOverlapX,n.settings?.dragInOverlapY)?i.style.animation!=m&&(i.style.animation=m):i.style.animation!=c&&(i.style.animation=c))})(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 y{_options={};_instance;_mainDomElement;_currentDrag={};_currentTouch=null;_firefoxDragPosition={x:0,y:0};_onBeforeUpdateDrag=()=>({});isDragging=!1;_hasEnteredIframe=!1;_pendingDragIn=null;_canvasBb=null;_overlayBb=null;_interactionContainerBb=null;_firefoxFallback=t=>{if(!this._currentDrag.event)return;t.preventDefault();const e=t||window.event;this._firefoxDragPosition.x=e.pageX||0,this._firefoxDragPosition.y=e.pageY||0};constructor(t,e,n){this._instance=t,this._mainDomElement=e,this._options=n||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async dragStart(i,s,r="rml_id"){const a=this._mainDomElement.parentNode;if("relative"!==t(a).position)return;this._mainDomElement.style.pointerEvents="none";let o=a.querySelector("."+_);o||(o=document.createElement("div"),o.classList.add(_),a.appendChild(o)),o.classList.remove(u.DISPLAY_NONE),s.target.getAttribute("draggable");const h=a.querySelector("."+f);this._currentDrag.event=s;const g=s.target,d=g.cloneNode(!0),l=g.getBoundingClientRect();d.style.width=`${l.width}px`,d.style.height=`${l.height}px`,this._currentDrag.ghost=new I(d),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:m,clientY:c}=e(s,this._firefoxDragPosition);this._currentDrag.offset.x=m-l.left,this._currentDrag.offset.y=c-l.top,s instanceof DragEvent&&s.dataTransfer&&s.dataTransfer.setDragImage&&s.dataTransfer.setDragImage(h,0,0),n(a,this._currentDrag.event||s,this._firefoxDragPosition),this._pendingDragIn={id:i,type:r},this._hasEnteredIframe=!1,this.isDragging=!0,this._interactionContainerBb=(await this._instance.getDrawerBoundingClientRect()).final}dragUpdate(t){const s=this._mainDomElement.parentNode,{x:r,y:a}=n(s,t,this._firefoxDragPosition);if(0===r&&0===a)return;const o=Math.max(1,r),h=Math.max(1,a);if(1===o&&1===h)return;const g=this._mainDomElement.getBoundingClientRect(),{clientX:d,clientY:l}=e(t,this._firefoxDragPosition),m=d>=g.left&&d<=g.right&&l>=g.top&&l<=g.bottom,c=()=>{if(!(d>=g.left&&d<=g.right&&l>=g.top&&l<=g.bottom))return!1;if(this._interactionContainerBb){const t={left:this._interactionContainerBb.left+g.left,top:this._interactionContainerBb.top+g.top,right:this._interactionContainerBb.right+g.left,bottom:this._interactionContainerBb.bottom+g.top};return!(d>=t.left&&d<=t.right&&l>=t.top&&l<=t.bottom)}return!0};if(m&&this._pendingDragIn){const t=c();if(t&&!this._hasEnteredIframe)this._instance.dragInObject(this._pendingDragIn.id,o,h,this._pendingDragIn.type),this._hasEnteredIframe=!0;else if(!t&&this._hasEnteredIframe)return this._instance.cancelDragIn(),void(this._hasEnteredIframe=!1)}else if(!m&&this._hasEnteredIframe)return this._instance.cancelDragIn(),void(this._hasEnteredIframe=!1);if(!this._hasEnteredIframe)return;let _=o,u=h;if(i(t)){const t=this._options.settings?.fingerSize||0;_=Math.max(2,o+t),u=Math.max(2,h-t)}const{x:f,y:p,options:D}=this._onBeforeUpdateDrag(_,u,{}),I=D||{settings:{},ghost:{}};I.ghost||(I.ghost={}),I.ghost.visibleIn&&I.ghost.hiddenIn||(I.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const y="number"==typeof f?f:_,E="number"==typeof p?p:u;this._currentDrag.ghost&&this._currentDrag.ghost.updateDragGhost(d,l,I),this._instance.updateDrag(y,E,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const t=this._mainDomElement.parentNode;this.isDragging=!1,this._hasEnteredIframe&&this._instance.dragInObjectEnd(),this._currentDrag.ghost&&(this._currentDrag.ghost.removeDragGhost(),this._currentDrag.ghost=null),this._currentDrag={},this._firefoxDragPosition={x:0,y:0},this._hasEnteredIframe=!1,this._pendingDragIn=null,this._interactionContainerBb=null;const e=t.querySelector("."+_);e&&e.classList.add(u.DISPLAY_NONE)}touchStart(t,e,n="rml_id"){e.preventDefault();const i={};"number"==typeof this._options?.settings?.touchDragDelay&&(i.delay=this._options.settings.touchDragDelay),this._options?.settings?.touchDragEpsilon&&(i.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new s(void 0,{onTouchDragStart:(e,i)=>{this.dragStart(t,i,n)}},i),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{y as DragInFromWebsiteStrategy};