@roomle/embedding-lib 0.0.0-dev-a4754cb

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 (54) hide show
  1. package/.releaserc.json +60 -0
  2. package/README.md +13 -0
  3. package/browser-BxG7yIaK.mjs +16 -0
  4. package/browser-CW9o-dtT.mjs +18 -0
  5. package/comlink-B2Kj_5Ge.mjs +206 -0
  6. package/comlink-B5lV2OWp.mjs +226 -0
  7. package/drag-ghost-BOwjMbG3.mjs +65 -0
  8. package/drag-ghost-BQ8r6NVo.mjs +60 -0
  9. package/drag-in-BP_E53zb.mjs +102 -0
  10. package/drag-in-QhL3zGC0.mjs +108 -0
  11. package/embedding-plugins.d.ts +2 -0
  12. package/embedding-plugins.js +2 -0
  13. package/embedding-plugins.min.js +2 -0
  14. package/from-custom-view-BM_zRJCf.mjs +227 -0
  15. package/from-custom-view-D2Z1YmCx.mjs +226 -0
  16. package/from-website-CPVeVVMI.mjs +123 -0
  17. package/from-website-DlklVbxU.mjs +118 -0
  18. package/hi-mcp-server-BtrPxgNY.mjs +5278 -0
  19. package/hi-mcp-server-ukmMIPNu.mjs +4866 -0
  20. package/hi.d.ts +2 -0
  21. package/hi.js +182 -0
  22. package/hi.min.js +167 -0
  23. package/package.json +50 -0
  24. package/packages/embedding-lib/src/connector.d.ts +44 -0
  25. package/packages/embedding-lib/src/embedding-plugins.d.ts +9 -0
  26. package/packages/embedding-lib/src/hi.d.ts +22 -0
  27. package/packages/embedding-lib/src/homag-intelligence/hi-callbacks.d.ts +3 -0
  28. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/agent-facing.d.ts +35 -0
  29. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/hi-mcp-server.d.ts +3 -0
  30. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/mcp-tool.d.ts +69 -0
  31. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/plan-history.d.ts +33 -0
  32. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/planner-api.d.ts +32 -0
  33. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/skills.d.ts +23 -0
  34. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/tool-executors.d.ts +4 -0
  35. package/packages/embedding-lib/src/homag-intelligence/hi-mcp-tools.d.ts +11 -0
  36. package/packages/embedding-lib/src/homag-intelligence/hi-order-manager.d.ts +3 -0
  37. package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +55 -0
  38. package/packages/embedding-lib/src/homag-intelligence/hi-requests.d.ts +35 -0
  39. package/packages/embedding-lib/src/homag-intelligence/hi-setup.d.ts +6 -0
  40. package/packages/embedding-lib/src/homag-intelligence/hi-utils.d.ts +8 -0
  41. package/packages/embedding-lib/src/plugins/constants.d.ts +19 -0
  42. package/packages/embedding-lib/src/plugins/drag-in.d.ts +32 -0
  43. package/packages/embedding-lib/src/plugins/strategy/drag-phase.d.ts +25 -0
  44. package/packages/embedding-lib/src/plugins/strategy/from-custom-view.d.ts +39 -0
  45. package/packages/embedding-lib/src/plugins/strategy/from-website.d.ts +45 -0
  46. package/packages/embedding-lib/src/plugins/strategy/types.d.ts +14 -0
  47. package/packages/embedding-lib/src/plugins/types.d.ts +35 -0
  48. package/packages/embedding-lib/src/roomle-embedding-lib.d.ts +82 -0
  49. package/packages/embedding-lib/src/utils.d.ts +35 -0
  50. package/roomle-embedding-lib.d.ts +6 -0
  51. package/roomle-embedding-lib.js +396 -0
  52. package/roomle-embedding-lib.min.js +366 -0
  53. package/utils-DxJ3PcKe.mjs +131 -0
  54. package/utils-wJ80awOA.mjs +123 -0
@@ -0,0 +1,102 @@
1
+ var e = Object.defineProperty, t = (t, n) => {
2
+ let r = {};
3
+ for (var i in t) e(r, i, {
4
+ get: t[i],
5
+ enumerable: !0
6
+ });
7
+ return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
8
+ }, n = "rml-drag-in-styles", r = "rml-drag-in-drag-element", i = "rml-drag-in-overlay", a = "rml-drag-in-drag-ghost", o = "rml-drag-in-fade-in", s = "rml-drag-in-fade-out", c = { DISPLAY_NONE: "rml-display-none" }, l = .5, u = "250ms", d = "forwards", f = `@keyframes ${o} {from{opacity: 0;}to {opacity: 0.5;}}`, p = `@keyframes ${s} {from{opacity: 0.5;}to {opacity: 0;}}`, m = `${o} ${u} ${d}`, h = `${s} ${u} ${d}`, g = "https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg", _ = 112, v = 112, y = class {
9
+ _mainDomElement;
10
+ _instance;
11
+ _mode = "website";
12
+ _viewName = "main";
13
+ constructor(e, t, n, r) {
14
+ this._instance = e, this._mainDomElement = t, this._mode = n, this._viewName = r;
15
+ }
16
+ async init() {
17
+ return Promise.resolve();
18
+ }
19
+ }, b = t({ DragIn: () => x }), x = class extends y {
20
+ options = {};
21
+ _customDragSignal = new AbortController();
22
+ _injectStyles() {
23
+ if (!document.getElementById("rml-drag-in-styles")) {
24
+ let e = document.createElement("style");
25
+ e.type = "text/css", e.id = n, e.innerHTML = `\n .${c.DISPLAY_NONE}{display:none}\n .${i}{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 ${f}\n ${p}\n `, document.head.appendChild(e);
26
+ }
27
+ }
28
+ _initializeDragGhost() {
29
+ let e = this._mainDomElement.parentNode, t = e.querySelector("." + a);
30
+ t || (t = document.createElement("div"), t.classList.add(a), t.innerText = " ", e.appendChild(t));
31
+ }
32
+ constructor(e, t, n, r) {
33
+ super(e, t, n, r), this._mainDomElement = t, this._injectStyles(), this._initializeDragGhost();
34
+ }
35
+ async init() {
36
+ if (await super.init(), this._mode === "website") try {
37
+ let { DragInFromWebsiteStrategy: e } = await import("./from-website-DlklVbxU.mjs");
38
+ this._strategy = new e(this._instance, this._mainDomElement, {
39
+ settings: this.options,
40
+ mode: "website"
41
+ });
42
+ } catch (e) {
43
+ throw e;
44
+ }
45
+ else {
46
+ if (this._mode !== "custom-view") throw Error("Unsupported mode");
47
+ try {
48
+ let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-D2Z1YmCx.mjs");
49
+ this._strategy = new e(this._instance, this._mainDomElement, this.options, this._viewName);
50
+ } catch (e) {
51
+ throw e;
52
+ }
53
+ }
54
+ }
55
+ get isDragging() {
56
+ return this._strategy.isDragging;
57
+ }
58
+ dragStart(e, t, n = "rml_id") {
59
+ this._strategy.dragStart(e, t, n);
60
+ }
61
+ dragUpdate(e) {
62
+ this._strategy.dragUpdate(e);
63
+ }
64
+ dragEnd() {
65
+ this._strategy.dragEnd();
66
+ }
67
+ touchStart(e, t, n = "rml_id") {
68
+ this._strategy.touchStart(e, t, n);
69
+ }
70
+ touchMove(e) {
71
+ this._strategy.touchMove(e);
72
+ }
73
+ touchEnd() {
74
+ this._strategy.touchEnd();
75
+ }
76
+ dispose() {
77
+ this._strategy.dispose();
78
+ }
79
+ beforeUpdateGhost(e) {
80
+ this._strategy.beforeUpdateGhost(e);
81
+ }
82
+ registerCustomDrag({ customDragStart: e, customDragEnd: t, customDragUpdate: n, beforeUpdateGhost: r }) {
83
+ r && this._strategy.beforeUpdateGhost(r);
84
+ let i = this._customDragSignal.signal, a = (e) => {
85
+ this._strategy.releaseInput(e), this._strategy.isDragging && t(e);
86
+ };
87
+ document.querySelectorAll("[data-rml-draggable=\"true\"]").forEach((e) => {
88
+ e.draggable = !1, e.style.touchAction = "none";
89
+ }), document.addEventListener("pointerdown", (t) => {
90
+ t.target.getAttribute("data-rml-draggable") === "true" && (t.target.setPointerCapture && t.target.setPointerCapture(t.pointerId), e(t));
91
+ }, { signal: i }), document.addEventListener("pointermove", (e) => {
92
+ n(e);
93
+ }, { signal: i }), document.addEventListener("pointerup", a, { signal: i }), document.addEventListener("pointercancel", a, { signal: i });
94
+ }
95
+ unregisterCustomDrag() {
96
+ this._customDragSignal.abort(), this._customDragSignal = new AbortController();
97
+ }
98
+ releaseInput(e) {
99
+ this._strategy.releaseInput(e);
100
+ }
101
+ };
102
+ export { f as a, r as c, g as d, _ as f, l as h, m as i, a as l, n as m, b as n, h as o, i as p, c as r, p as s, x as t, v as u };
@@ -0,0 +1,108 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.defineProperty, t = (t, n) => {
3
+ let r = {};
4
+ for (var i in t) e(r, i, {
5
+ get: t[i],
6
+ enumerable: !0
7
+ });
8
+ return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
+ }, n = "rml-drag-in-styles", r = "rml-drag-in-drag-element", i = "rml-drag-in-overlay", a = "rml-drag-in-drag-ghost", o = "rml-drag-in-fade-in", s = "rml-drag-in-fade-out", c = { DISPLAY_NONE: "rml-display-none" }, l = .5, u = "250ms", d = "forwards", f = `@keyframes ${o} {from{opacity: 0;}to {opacity: ${l};}}`, p = `@keyframes ${s} {from{opacity: ${l};}to {opacity: 0;}}`, m = `${o} ${u} ${d}`, h = `${s} ${u} ${d}`, g = "https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg", _ = 112, v = 112, y = class {
10
+ _mainDomElement;
11
+ _instance;
12
+ _mode = "website";
13
+ _viewName = "main";
14
+ constructor(e, t, n, r) {
15
+ this._instance = e, this._mainDomElement = t, this._mode = n, this._viewName = r;
16
+ }
17
+ async init() {
18
+ return Promise.resolve();
19
+ }
20
+ }, b = /* @__PURE__ */ t({ DragIn: () => x }), x = class extends y {
21
+ options = {};
22
+ _customDragSignal = new AbortController();
23
+ _injectStyles() {
24
+ if (!document.getElementById("rml-drag-in-styles")) {
25
+ let e = document.createElement("style");
26
+ e.type = "text/css", e.id = n, e.innerHTML = `
27
+ .${c.DISPLAY_NONE}{display:none}
28
+ .${i}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}
29
+ .${a}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}
30
+ ${f}
31
+ ${p}
32
+ `, document.head.appendChild(e);
33
+ }
34
+ }
35
+ _initializeDragGhost() {
36
+ let e = this._mainDomElement.parentNode, t = e.querySelector("." + a);
37
+ t || (t = document.createElement("div"), t.classList.add(a), t.innerText = " ", e.appendChild(t));
38
+ }
39
+ constructor(e, t, n, r) {
40
+ super(e, t, n, r), this._mainDomElement = t, this._injectStyles(), this._initializeDragGhost();
41
+ }
42
+ async init() {
43
+ if (await super.init(), this._mode === "website") try {
44
+ let { DragInFromWebsiteStrategy: e } = await import("./from-website-CPVeVVMI.mjs");
45
+ this._strategy = new e(this._instance, this._mainDomElement, {
46
+ settings: this.options,
47
+ mode: "website"
48
+ });
49
+ } catch (e) {
50
+ throw console.error("Could not load Dragin strategy \"FromWebsite\""), e;
51
+ }
52
+ else if (this._mode === "custom-view") try {
53
+ let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-BM_zRJCf.mjs");
54
+ this._strategy = new e(this._instance, this._mainDomElement, this.options, this._viewName);
55
+ } catch (e) {
56
+ throw console.error("Could not load Dragin strategy \"FromCustomView\""), e;
57
+ }
58
+ else throw Error("Unsupported mode");
59
+ }
60
+ get isDragging() {
61
+ return this._strategy.isDragging;
62
+ }
63
+ dragStart(e, t, n = "rml_id") {
64
+ this._strategy.dragStart(e, t, n);
65
+ }
66
+ dragUpdate(e) {
67
+ this._strategy.dragUpdate(e);
68
+ }
69
+ dragEnd() {
70
+ this._strategy.dragEnd();
71
+ }
72
+ touchStart(e, t, n = "rml_id") {
73
+ this._strategy.touchStart(e, t, n);
74
+ }
75
+ touchMove(e) {
76
+ this._strategy.touchMove(e);
77
+ }
78
+ touchEnd() {
79
+ this._strategy.touchEnd();
80
+ }
81
+ dispose() {
82
+ this._strategy.dispose();
83
+ }
84
+ beforeUpdateGhost(e) {
85
+ this._strategy.beforeUpdateGhost(e);
86
+ }
87
+ registerCustomDrag({ customDragStart: e, customDragEnd: t, customDragUpdate: n, beforeUpdateGhost: r }) {
88
+ r && this._strategy.beforeUpdateGhost(r);
89
+ let i = this._customDragSignal.signal, a = (t) => {
90
+ t.target.getAttribute("data-rml-draggable") === "true" && (t.target.setPointerCapture && t.target.setPointerCapture(t.pointerId), e(t));
91
+ }, o = (e) => {
92
+ this._strategy.releaseInput(e), this._strategy.isDragging && t(e);
93
+ };
94
+ document.querySelectorAll("[data-rml-draggable=\"true\"]").forEach((e) => {
95
+ e.draggable = !1, e.style.touchAction = "none";
96
+ }), document.addEventListener("pointerdown", a, { signal: i }), document.addEventListener("pointermove", (e) => {
97
+ n(e);
98
+ }, { signal: i }), document.addEventListener("pointerup", o, { signal: i }), document.addEventListener("pointercancel", o, { signal: i });
99
+ }
100
+ unregisterCustomDrag() {
101
+ this._customDragSignal.abort(), this._customDragSignal = new AbortController();
102
+ }
103
+ releaseInput(e) {
104
+ this._strategy.releaseInput(e);
105
+ }
106
+ };
107
+ //#endregion
108
+ export { f as a, r as c, g as d, _ as f, l as h, m as i, a as l, n as m, b as n, h as o, i as p, c as r, p as s, x as t, v as u };
@@ -0,0 +1,2 @@
1
+ export * from './packages/embedding-lib/src/embedding-plugins'
2
+ export {}
@@ -0,0 +1,2 @@
1
+ import { a as e, c as t, d as n, f as r, h as i, i as a, m as o, o as s, s as c, t as l, u } from "./drag-in-QhL3zGC0.mjs";
2
+ export { l as DragIn, a as RML_DRAG_GHOST_FADE_IN, e as RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS, s as RML_DRAG_GHOST_FADE_OUT, c as RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS, t as RML_DRAG_IN_DRAG_ELEMENT_ID, u as RML_DRAG_IN_FALLBACK_GHOST_HEIGHT, n as RML_DRAG_IN_FALLBACK_GHOST_URL, r as RML_DRAG_IN_FALLBACK_GHOST_WIDTH, o as RML_DRAG_IN_STYLES_ID, i as TARGET_OPACITY };
@@ -0,0 +1,2 @@
1
+ import { a as e, c as t, d as n, f as r, h as i, i as a, m as o, o as s, s as c, t as l, u } from "./drag-in-BP_E53zb.mjs";
2
+ export { l as DragIn, a as RML_DRAG_GHOST_FADE_IN, e as RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS, s as RML_DRAG_GHOST_FADE_OUT, c as RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS, t as RML_DRAG_IN_DRAG_ELEMENT_ID, u as RML_DRAG_IN_FALLBACK_GHOST_HEIGHT, n as RML_DRAG_IN_FALLBACK_GHOST_URL, r as RML_DRAG_IN_FALLBACK_GHOST_WIDTH, o as RML_DRAG_IN_STYLES_ID, i as TARGET_OPACITY };
@@ -0,0 +1,227 @@
1
+ import { d as e } from "./drag-in-QhL3zGC0.mjs";
2
+ import { a as t, c as n, n as r } from "./utils-DxJ3PcKe.mjs";
3
+ import { t as i } from "./drag-ghost-BOwjMbG3.mjs";
4
+ var a = (e, t = 0) => n(e) ? {
5
+ clientX: e.touches[t].clientX,
6
+ clientY: e.touches[t].clientY
7
+ } : {
8
+ clientX: e.clientX,
9
+ clientY: e.clientY
10
+ }, o = (e) => e && n(e) ? e.touches.length > 0 : !0, s = class {
11
+ _touchDragTimeOut;
12
+ _onTouchDragStart;
13
+ _payload = null;
14
+ _delay = 500;
15
+ _firstTouch = null;
16
+ _lastTouch = null;
17
+ _epsilon = 10;
18
+ constructor(e, { onTouchDragStart: t }, n = {}) {
19
+ this._payload = e, this._onTouchDragStart = t, this._delay = typeof n.delay == "number" ? n.delay : 500, this._epsilon = typeof n.epsilon == "number" ? n.epsilon : 10;
20
+ }
21
+ onStart(e) {
22
+ o(e) && (this._touchDragTimeOut ||= (this._firstTouch = a(e, n(e) ? e.touches.length - 1 : 0), setTimeout(() => {
23
+ this._clearTimeout(), this._lastTouch ||= a(e), this._checkXDistance(e)();
24
+ }, this._delay)));
25
+ }
26
+ onEnd() {
27
+ this._resetTouches();
28
+ }
29
+ onMove(e) {
30
+ o(e) && (this._lastTouch = a(e));
31
+ }
32
+ _clearTimeout() {
33
+ this._touchDragTimeOut &&= (clearTimeout(this._touchDragTimeOut), null);
34
+ }
35
+ _resetTouches() {
36
+ this._clearTimeout(), this._lastTouch = null, this._firstTouch = null, this._payload = null;
37
+ }
38
+ _checkXDistance(e) {
39
+ return () => {
40
+ if (!this._firstTouch || !this._lastTouch) return;
41
+ let t = !1;
42
+ t = Math.abs(this._firstTouch.clientX - this._lastTouch.clientX) < this._epsilon, t && (this._onTouchDragStart(this._payload, e), this._resetTouches());
43
+ };
44
+ }
45
+ }, c = (e) => `[data-rml-custom-view="${e}"]`, l = (e) => {
46
+ e.preventDefault(), e.stopPropagation();
47
+ }, u = (e, t, n, r) => {
48
+ let i = n - e, a = r - t;
49
+ return Math.sqrt(i * i + a * a);
50
+ }, d = class {
51
+ _startX = 0;
52
+ _startY = 0;
53
+ _lastX = 0;
54
+ _lastY = 0;
55
+ _epsilon;
56
+ _isWaiting = !1;
57
+ _onCustomDragStart;
58
+ constructor({ onCustomDragStart: e }, t = {}) {
59
+ this._epsilon = typeof t.epsilon == "number" ? t.epsilon : 15, this._onCustomDragStart = e;
60
+ }
61
+ onMove(e) {
62
+ this._lastX = e.clientX, this._lastY = e.clientY, this._isWaiting && u(this._startX, this._startY, this._lastX, this._lastY) > this._epsilon && (this._onCustomDragStart(e), this._isWaiting = !1);
63
+ }
64
+ onStart(e) {
65
+ this._startX = e.clientX, this._startY = e.clientY, this.onMove(e), this._isWaiting = !0;
66
+ }
67
+ onEnd() {
68
+ this._reset();
69
+ }
70
+ _reset() {
71
+ this._startX = 0, this._startY = 0, this._lastX = 0, this._lastY = 0, this._isWaiting = !1;
72
+ }
73
+ }, f = "data-rml-old-draggable", p = void 0, m = (e, t) => {
74
+ let r = n(e), i = {
75
+ delay: r ? 500 : 100,
76
+ epsilon: r ? 10 : 15
77
+ };
78
+ if (!t) return i;
79
+ if (!r && !(e instanceof MouseEvent)) return console.warn("Unsupported event! It is not TouchEvent and also not MouseEvent"), i;
80
+ let { delayKey: a, epsilonKey: o } = r ? {
81
+ delayKey: "touchDragDelay",
82
+ epsilonKey: "touchDragEpsilon"
83
+ } : {
84
+ delayKey: "customDragDelay",
85
+ epsilonKey: "customDragEpsilon"
86
+ };
87
+ return typeof t[a] == "number" && (i.delay = t.touchDragDelay), typeof t[o] == "number" && (i.epsilon = t.touchDragEpsilon), i;
88
+ }, h = (t) => {
89
+ let n = "", r = 112, i = 112;
90
+ if (!t) return {
91
+ url: e,
92
+ width: r,
93
+ height: i
94
+ };
95
+ let a = t;
96
+ if (a instanceof HTMLElement) {
97
+ let t = a.getBoundingClientRect(), o = a.getAttribute("data-rml-ghost-url"), s = a.getAttribute("data-rml-ghost-width"), c = a.getAttribute("data-rml-ghost-height");
98
+ o ? n = o : !o && a instanceof HTMLImageElement && a.src && (n = a.src), n ? (r = t.width, i = t.height) : n = e, r = s ? parseInt(s, 10) : r, i = c ? parseInt(c, 10) : i;
99
+ }
100
+ return {
101
+ url: n || "https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",
102
+ width: r,
103
+ height: i
104
+ };
105
+ }, g = class {
106
+ _options = {};
107
+ _instance;
108
+ _mainDomElement;
109
+ _viewName;
110
+ _currentCustomDrag = null;
111
+ _startTarget = null;
112
+ _dragGhost = null;
113
+ _onBeforeUpdateDrag = () => ({});
114
+ isDragging = !1;
115
+ _hasEnteredIframe = !1;
116
+ _pendingDragIn = null;
117
+ _phase = { kind: "idle" };
118
+ _dragGeneration = 0;
119
+ _parentWithDragLeave = null;
120
+ _parentDragLeave = () => {
121
+ this._phase.kind !== "ready" || !this._hasEnteredIframe || (this._instance.cancelDragIn(), this._hasEnteredIframe = !1);
122
+ };
123
+ constructor(e, t, n, r) {
124
+ this._instance = e, this._options = n || {}, this._viewName = r, this._mainDomElement = t, this._parentWithDragLeave = this._mainDomElement.parentElement, this._parentWithDragLeave?.addEventListener("dragleave", this._parentDragLeave);
125
+ }
126
+ beforeUpdateGhost(e) {
127
+ this._onBeforeUpdateDrag = e;
128
+ }
129
+ async _dragStart(e, t, n = "rml_id") {
130
+ let r = ++this._dragGeneration;
131
+ if (this._phase = { kind: "starting" }, this._startTarget && (this._startTarget.style.pointerEvents = "none", this._startTarget.style.userSelect = "none", this._startTarget.setAttribute(f, this._startTarget.draggable.toString()), this._startTarget.draggable = !1, this._startTarget.removeEventListener("dragstart", l), this._startTarget.addEventListener("dragstart", l)), this._startTarget) {
132
+ let e = this._startTarget.getBoundingClientRect(), t = this._startTarget.cloneNode(!0);
133
+ t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, this._dragGhost = new i(t);
134
+ } else this._dragGhost = new i();
135
+ let a = await this._instance.getBoundingClientRect(c(this._viewName)), o = await this._instance.getBoundingClientRect("canvas"), s = (await this._instance.getDrawerBoundingClientRect()).final, u = await this._instance.getBoundingClientRect(".interaction-container");
136
+ if (r === this._dragGeneration) {
137
+ if (!a) {
138
+ let e = `could not read the bounding rect of custom view "${this._viewName}"`;
139
+ this._phase = {
140
+ kind: "failed",
141
+ reason: e
142
+ }, console.warn(`Drag-in not started: ${e}`);
143
+ return;
144
+ }
145
+ this._phase = {
146
+ kind: "ready",
147
+ bounds: {
148
+ view: a,
149
+ canvas: o,
150
+ overlay: s,
151
+ interactionContainer: u
152
+ }
153
+ }, this._pendingDragIn = {
154
+ id: e,
155
+ type: n
156
+ }, this._hasEnteredIframe = !1, this.isDragging = !0;
157
+ }
158
+ }
159
+ _dragUpdate(e) {
160
+ document.body.focus(), this._currentCustomDrag && this._currentCustomDrag.onMove(e);
161
+ let { clientX: n, clientY: i } = r(e);
162
+ if (this._dragGhost) {
163
+ let { width: e, height: t } = this._mainDomElement.getBoundingClientRect();
164
+ this._dragGhost.updateDragGhost(n, i, { ghost: { visibleIn: {
165
+ x: 0,
166
+ y: 0,
167
+ width: e,
168
+ height: t
169
+ } } });
170
+ }
171
+ if (this._phase.kind !== "ready") return;
172
+ let { view: a, canvas: o, overlay: s, interactionContainer: c } = this._phase.bounds, l = a.x + n, u = a.y + i, d = t(l, u, o, s, c);
173
+ if (d && !this._hasEnteredIframe && this._pendingDragIn && (this._instance.dragInObject(this._pendingDragIn.id, l, u, this._pendingDragIn.type), this._hasEnteredIframe = !0), !d && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1), !this._hasEnteredIframe) return;
174
+ let { url: f, width: p, height: m } = h(this._startTarget), g = this._options || {}, _ = {
175
+ ghost: {
176
+ visibleIn: {
177
+ x: a.x - (g.dragInOverlapX || 0),
178
+ y: a.y + (g.dragInOverlapY || 0),
179
+ width: a.width + (g.dragInOverlapX || 0),
180
+ height: a.height + (g.dragInOverlapY || 0)
181
+ },
182
+ url: f,
183
+ width: p,
184
+ height: m
185
+ },
186
+ mode: "custom-view"
187
+ }, { x: v, y, options: b } = this._onBeforeUpdateDrag(l, u, _), x = typeof v == "number" ? v : l, S = typeof y == "number" ? y : u, C = b || _;
188
+ this._instance.updateDrag(x, S, C);
189
+ }
190
+ _dragEnd() {
191
+ this._dragGeneration++, this._currentCustomDrag && this._currentCustomDrag.onEnd(), this._currentCustomDrag = null, this.isDragging = !1, this._phase = { kind: "idle" }, this._resetStartTarget(), this._instance.enableEvents(), this._dragGhost &&= (this._dragGhost.removeDragGhost(), null), this._hasEnteredIframe && this._instance.dragInObjectEnd(), this._hasEnteredIframe = !1, this._pendingDragIn = null;
192
+ }
193
+ dragStart(e, t, r) {
194
+ this._instance.disableEvents(), this._startTarget = t.target, this._currentCustomDrag = n(t) ? new s(p, { onTouchDragStart: (t, n) => {
195
+ this._dragStart(e, n, r);
196
+ } }, {
197
+ ...m(t, this._options),
198
+ delay: 0
199
+ }) : new d({ onCustomDragStart: (t) => this._dragStart(e, t, r) }, m(t, this._options)), this._currentCustomDrag.onStart(t);
200
+ }
201
+ dragEnd() {
202
+ this._dragEnd();
203
+ }
204
+ dragUpdate(e) {
205
+ this._dragUpdate(e);
206
+ }
207
+ touchStart(e, t, n = "rml_id") {
208
+ this.dragStart(e, t, n);
209
+ }
210
+ touchMove(e) {
211
+ this.dragUpdate(e);
212
+ }
213
+ touchEnd() {
214
+ this.dragEnd();
215
+ }
216
+ dispose() {
217
+ this._parentWithDragLeave?.removeEventListener("dragleave", this._parentDragLeave), this._parentWithDragLeave = null;
218
+ }
219
+ _resetStartTarget() {
220
+ this._startTarget && (this._startTarget.style.pointerEvents = "", this._startTarget.style.userSelect = "", this._startTarget.draggable = this._startTarget.getAttribute(f) === "true", this._startTarget.removeAttribute(f), this._startTarget.removeEventListener("dragstart", l));
221
+ }
222
+ releaseInput(e) {
223
+ this._dragEnd();
224
+ }
225
+ };
226
+ //#endregion
227
+ export { g as DragInFromCustomViewStrategy };
@@ -0,0 +1,226 @@
1
+ import { d as e } from "./drag-in-BP_E53zb.mjs";
2
+ import { a as t, c as n, n as r } from "./utils-wJ80awOA.mjs";
3
+ import { t as i } from "./drag-ghost-BQ8r6NVo.mjs";
4
+ var a = (e, t = 0) => n(e) ? {
5
+ clientX: e.touches[t].clientX,
6
+ clientY: e.touches[t].clientY
7
+ } : {
8
+ clientX: e.clientX,
9
+ clientY: e.clientY
10
+ }, o = (e) => !e || !n(e) || e.touches.length > 0, s = class {
11
+ _touchDragTimeOut;
12
+ _onTouchDragStart;
13
+ _payload = null;
14
+ _delay = 500;
15
+ _firstTouch = null;
16
+ _lastTouch = null;
17
+ _epsilon = 10;
18
+ constructor(e, { onTouchDragStart: t }, n = {}) {
19
+ this._payload = e, this._onTouchDragStart = t, this._delay = typeof n.delay == "number" ? n.delay : 500, this._epsilon = typeof n.epsilon == "number" ? n.epsilon : 10;
20
+ }
21
+ onStart(e) {
22
+ o(e) && (this._touchDragTimeOut ||= (this._firstTouch = a(e, n(e) ? e.touches.length - 1 : 0), setTimeout(() => {
23
+ this._clearTimeout(), this._lastTouch ||= a(e), this._checkXDistance(e)();
24
+ }, this._delay)));
25
+ }
26
+ onEnd() {
27
+ this._resetTouches();
28
+ }
29
+ onMove(e) {
30
+ o(e) && (this._lastTouch = a(e));
31
+ }
32
+ _clearTimeout() {
33
+ this._touchDragTimeOut &&= (clearTimeout(this._touchDragTimeOut), null);
34
+ }
35
+ _resetTouches() {
36
+ this._clearTimeout(), this._lastTouch = null, this._firstTouch = null, this._payload = null;
37
+ }
38
+ _checkXDistance(e) {
39
+ return () => {
40
+ if (!this._firstTouch || !this._lastTouch) return;
41
+ let t = !1;
42
+ t = Math.abs(this._firstTouch.clientX - this._lastTouch.clientX) < this._epsilon, t && (this._onTouchDragStart(this._payload, e), this._resetTouches());
43
+ };
44
+ }
45
+ }, c = (e) => {
46
+ e.preventDefault(), e.stopPropagation();
47
+ }, l = class {
48
+ _startX = 0;
49
+ _startY = 0;
50
+ _lastX = 0;
51
+ _lastY = 0;
52
+ _epsilon;
53
+ _isWaiting = !1;
54
+ _onCustomDragStart;
55
+ constructor({ onCustomDragStart: e }, t = {}) {
56
+ this._epsilon = typeof t.epsilon == "number" ? t.epsilon : 15, this._onCustomDragStart = e;
57
+ }
58
+ onMove(e) {
59
+ this._lastX = e.clientX, this._lastY = e.clientY, this._isWaiting && ((e, t) => {
60
+ let n = this._lastX - e, r = this._lastY - t;
61
+ return Math.sqrt(n * n + r * r);
62
+ })(this._startX, this._startY) > this._epsilon && (this._onCustomDragStart(e), this._isWaiting = !1);
63
+ }
64
+ onStart(e) {
65
+ this._startX = e.clientX, this._startY = e.clientY, this.onMove(e), this._isWaiting = !0;
66
+ }
67
+ onEnd() {
68
+ this._reset();
69
+ }
70
+ _reset() {
71
+ this._startX = 0, this._startY = 0, this._lastX = 0, this._lastY = 0, this._isWaiting = !1;
72
+ }
73
+ }, u = "data-rml-old-draggable", d = (e, t) => {
74
+ let r = n(e), i = {
75
+ delay: r ? 500 : 100,
76
+ epsilon: r ? 10 : 15
77
+ };
78
+ if (!t || !(r || e instanceof MouseEvent)) return i;
79
+ let { delayKey: a, epsilonKey: o } = r ? {
80
+ delayKey: "touchDragDelay",
81
+ epsilonKey: "touchDragEpsilon"
82
+ } : {
83
+ delayKey: "customDragDelay",
84
+ epsilonKey: "customDragEpsilon"
85
+ };
86
+ return typeof t[a] == "number" && (i.delay = t.touchDragDelay), typeof t[o] == "number" && (i.epsilon = t.touchDragEpsilon), i;
87
+ }, f = class {
88
+ _options = {};
89
+ _instance;
90
+ _mainDomElement;
91
+ _viewName;
92
+ _currentCustomDrag = null;
93
+ _startTarget = null;
94
+ _dragGhost = null;
95
+ _onBeforeUpdateDrag = () => ({});
96
+ isDragging = !1;
97
+ _hasEnteredIframe = !1;
98
+ _pendingDragIn = null;
99
+ _phase = { kind: "idle" };
100
+ _dragGeneration = 0;
101
+ _parentWithDragLeave = null;
102
+ _parentDragLeave = () => {
103
+ this._phase.kind === "ready" && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1);
104
+ };
105
+ constructor(e, t, n, r) {
106
+ this._instance = e, this._options = n || {}, this._viewName = r, this._mainDomElement = t, this._parentWithDragLeave = this._mainDomElement.parentElement, this._parentWithDragLeave?.addEventListener("dragleave", this._parentDragLeave);
107
+ }
108
+ beforeUpdateGhost(e) {
109
+ this._onBeforeUpdateDrag = e;
110
+ }
111
+ async _dragStart(e, t, n = "rml_id") {
112
+ let r = ++this._dragGeneration;
113
+ if (this._phase = { kind: "starting" }, this._startTarget && (this._startTarget.style.pointerEvents = "none", this._startTarget.style.userSelect = "none", this._startTarget.setAttribute(u, this._startTarget.draggable.toString()), this._startTarget.draggable = !1, this._startTarget.removeEventListener("dragstart", c), this._startTarget.addEventListener("dragstart", c)), this._startTarget) {
114
+ let e = this._startTarget.getBoundingClientRect(), t = this._startTarget.cloneNode(!0);
115
+ t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, this._dragGhost = new i(t);
116
+ } else this._dragGhost = new i();
117
+ let a = await this._instance.getBoundingClientRect((o = this._viewName, `[data-rml-custom-view="${o}"]`));
118
+ var o;
119
+ let s = await this._instance.getBoundingClientRect("canvas"), l = (await this._instance.getDrawerBoundingClientRect()).final, d = await this._instance.getBoundingClientRect(".interaction-container");
120
+ if (r === this._dragGeneration) {
121
+ if (!a) {
122
+ this._phase = {
123
+ kind: "failed",
124
+ reason: `could not read the bounding rect of custom view "${this._viewName}"`
125
+ };
126
+ return;
127
+ }
128
+ this._phase = {
129
+ kind: "ready",
130
+ bounds: {
131
+ view: a,
132
+ canvas: s,
133
+ overlay: l,
134
+ interactionContainer: d
135
+ }
136
+ }, this._pendingDragIn = {
137
+ id: e,
138
+ type: n
139
+ }, this._hasEnteredIframe = !1, this.isDragging = !0;
140
+ }
141
+ }
142
+ _dragUpdate(n) {
143
+ document.body.focus(), this._currentCustomDrag && this._currentCustomDrag.onMove(n);
144
+ let { clientX: i, clientY: a } = r(n);
145
+ if (this._dragGhost) {
146
+ let { width: e, height: t } = this._mainDomElement.getBoundingClientRect();
147
+ this._dragGhost.updateDragGhost(i, a, { ghost: { visibleIn: {
148
+ x: 0,
149
+ y: 0,
150
+ width: e,
151
+ height: t
152
+ } } });
153
+ }
154
+ if (this._phase.kind !== "ready") return;
155
+ let { view: o, canvas: s, overlay: c, interactionContainer: l } = this._phase.bounds, u = o.x + i, d = o.y + a, f = t(u, d, s, c, l);
156
+ if (f && !this._hasEnteredIframe && this._pendingDragIn && (this._instance.dragInObject(this._pendingDragIn.id, u, d, this._pendingDragIn.type), this._hasEnteredIframe = !0), !f && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1), !this._hasEnteredIframe) return;
157
+ let { url: p, width: m, height: h } = ((t) => {
158
+ let n = "", r = 112, i = 112;
159
+ if (!t) return {
160
+ url: e,
161
+ width: r,
162
+ height: i
163
+ };
164
+ let a = t;
165
+ if (a instanceof HTMLElement) {
166
+ let t = a.getBoundingClientRect(), o = a.getAttribute("data-rml-ghost-url"), s = a.getAttribute("data-rml-ghost-width"), c = a.getAttribute("data-rml-ghost-height");
167
+ o ? n = o : !o && a instanceof HTMLImageElement && a.src && (n = a.src), n ? (r = t.width, i = t.height) : n = e, r = s ? parseInt(s, 10) : r, i = c ? parseInt(c, 10) : i;
168
+ }
169
+ return {
170
+ url: n || "https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",
171
+ width: r,
172
+ height: i
173
+ };
174
+ })(this._startTarget), g = this._options || {}, _ = {
175
+ ghost: {
176
+ visibleIn: {
177
+ x: o.x - (g.dragInOverlapX || 0),
178
+ y: o.y + (g.dragInOverlapY || 0),
179
+ width: o.width + (g.dragInOverlapX || 0),
180
+ height: o.height + (g.dragInOverlapY || 0)
181
+ },
182
+ url: p,
183
+ width: m,
184
+ height: h
185
+ },
186
+ mode: "custom-view"
187
+ }, { x: v, y, options: b } = this._onBeforeUpdateDrag(u, d, _), x = typeof v == "number" ? v : u, S = typeof y == "number" ? y : d, C = b || _;
188
+ this._instance.updateDrag(x, S, C);
189
+ }
190
+ _dragEnd() {
191
+ this._dragGeneration++, this._currentCustomDrag && this._currentCustomDrag.onEnd(), this._currentCustomDrag = null, this.isDragging = !1, this._phase = { kind: "idle" }, this._resetStartTarget(), this._instance.enableEvents(), this._dragGhost &&= (this._dragGhost.removeDragGhost(), null), this._hasEnteredIframe && this._instance.dragInObjectEnd(), this._hasEnteredIframe = !1, this._pendingDragIn = null;
192
+ }
193
+ dragStart(e, t, r) {
194
+ this._instance.disableEvents(), this._startTarget = t.target, this._currentCustomDrag = n(t) ? new s(void 0, { onTouchDragStart: (t, n) => {
195
+ this._dragStart(e, n, r);
196
+ } }, {
197
+ ...d(t, this._options),
198
+ delay: 0
199
+ }) : new l({ onCustomDragStart: (t) => this._dragStart(e, t, r) }, d(t, this._options)), this._currentCustomDrag.onStart(t);
200
+ }
201
+ dragEnd() {
202
+ this._dragEnd();
203
+ }
204
+ dragUpdate(e) {
205
+ this._dragUpdate(e);
206
+ }
207
+ touchStart(e, t, n = "rml_id") {
208
+ this.dragStart(e, t, n);
209
+ }
210
+ touchMove(e) {
211
+ this.dragUpdate(e);
212
+ }
213
+ touchEnd() {
214
+ this.dragEnd();
215
+ }
216
+ dispose() {
217
+ this._parentWithDragLeave?.removeEventListener("dragleave", this._parentDragLeave), this._parentWithDragLeave = null;
218
+ }
219
+ _resetStartTarget() {
220
+ this._startTarget && (this._startTarget.style.pointerEvents = "", this._startTarget.style.userSelect = "", this._startTarget.draggable = this._startTarget.getAttribute(u) === "true", this._startTarget.removeAttribute(u), this._startTarget.removeEventListener("dragstart", c));
221
+ }
222
+ releaseInput(e) {
223
+ this._dragEnd();
224
+ }
225
+ };
226
+ export { f as DragInFromCustomViewStrategy };