@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.
- package/.releaserc.json +60 -0
- package/README.md +13 -0
- package/browser-BxG7yIaK.mjs +16 -0
- package/browser-CW9o-dtT.mjs +18 -0
- package/comlink-B2Kj_5Ge.mjs +206 -0
- package/comlink-B5lV2OWp.mjs +226 -0
- package/drag-ghost-BOwjMbG3.mjs +65 -0
- package/drag-ghost-BQ8r6NVo.mjs +60 -0
- package/drag-in-BP_E53zb.mjs +102 -0
- package/drag-in-QhL3zGC0.mjs +108 -0
- package/embedding-plugins.d.ts +2 -0
- package/embedding-plugins.js +2 -0
- package/embedding-plugins.min.js +2 -0
- package/from-custom-view-BM_zRJCf.mjs +227 -0
- package/from-custom-view-D2Z1YmCx.mjs +226 -0
- package/from-website-CPVeVVMI.mjs +123 -0
- package/from-website-DlklVbxU.mjs +118 -0
- package/hi-mcp-server-BtrPxgNY.mjs +5278 -0
- package/hi-mcp-server-ukmMIPNu.mjs +4866 -0
- package/hi.d.ts +2 -0
- package/hi.js +182 -0
- package/hi.min.js +167 -0
- package/package.json +50 -0
- package/packages/embedding-lib/src/connector.d.ts +44 -0
- package/packages/embedding-lib/src/embedding-plugins.d.ts +9 -0
- package/packages/embedding-lib/src/hi.d.ts +22 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-callbacks.d.ts +3 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/agent-facing.d.ts +35 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/hi-mcp-server.d.ts +3 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/mcp-tool.d.ts +69 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/plan-history.d.ts +33 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/planner-api.d.ts +32 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/skills.d.ts +23 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/tool-executors.d.ts +4 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp-tools.d.ts +11 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-order-manager.d.ts +3 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +55 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-requests.d.ts +35 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-setup.d.ts +6 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-utils.d.ts +8 -0
- package/packages/embedding-lib/src/plugins/constants.d.ts +19 -0
- package/packages/embedding-lib/src/plugins/drag-in.d.ts +32 -0
- package/packages/embedding-lib/src/plugins/strategy/drag-phase.d.ts +25 -0
- package/packages/embedding-lib/src/plugins/strategy/from-custom-view.d.ts +39 -0
- package/packages/embedding-lib/src/plugins/strategy/from-website.d.ts +45 -0
- package/packages/embedding-lib/src/plugins/strategy/types.d.ts +14 -0
- package/packages/embedding-lib/src/plugins/types.d.ts +35 -0
- package/packages/embedding-lib/src/roomle-embedding-lib.d.ts +82 -0
- package/packages/embedding-lib/src/utils.d.ts +35 -0
- package/roomle-embedding-lib.d.ts +6 -0
- package/roomle-embedding-lib.js +396 -0
- package/roomle-embedding-lib.min.js +366 -0
- package/utils-DxJ3PcKe.mjs +131 -0
- package/utils-wJ80awOA.mjs +123 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { t as e } from "./browser-BxG7yIaK.mjs";
|
|
2
|
+
var t = class {
|
|
3
|
+
_side;
|
|
4
|
+
_incomingMessageBus = null;
|
|
5
|
+
_outgoingMessageBus = null;
|
|
6
|
+
_execMessage = null;
|
|
7
|
+
constructor(e, t, n, r) {
|
|
8
|
+
this._side = e, this._incomingMessageBus = t, this._outgoingMessageBus = n, this._execMessage = r, this._incomingMessageBus && this._incomingMessageBus.addEventListener("message", this._handleMessage.bind(this));
|
|
9
|
+
}
|
|
10
|
+
setOutgoingMessageBus(e) {
|
|
11
|
+
this._outgoingMessageBus = e;
|
|
12
|
+
}
|
|
13
|
+
setMessageExecution(e) {
|
|
14
|
+
this._execMessage = e;
|
|
15
|
+
}
|
|
16
|
+
sendMessage(e, t = []) {
|
|
17
|
+
return new Promise((n, r) => {
|
|
18
|
+
if (this._incomingMessageBus === this._outgoingMessageBus) return n(void 0);
|
|
19
|
+
let i = new MessageChannel();
|
|
20
|
+
i.port1.onmessage = (e) => {
|
|
21
|
+
if (!e || !e.data) return i.port1.close(), i.port2.close(), r(/* @__PURE__ */ Error(this._side + " received message but response can not be interpreted"));
|
|
22
|
+
let t;
|
|
23
|
+
try {
|
|
24
|
+
t = JSON.parse(e.data);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return i.port1.close(), i.port2.close(), this._prepareError(e), r(e);
|
|
27
|
+
}
|
|
28
|
+
t.error ? r(t.error) : t.result === void 0 ? n(void 0) : n(t.result), i.port1.close(), i.port2.close();
|
|
29
|
+
};
|
|
30
|
+
let a = "";
|
|
31
|
+
try {
|
|
32
|
+
a = JSON.stringify({
|
|
33
|
+
message: e,
|
|
34
|
+
args: t
|
|
35
|
+
});
|
|
36
|
+
} catch {
|
|
37
|
+
return r(/* @__PURE__ */ Error(this._side + ": can not create command because it is not JSON.stringify able"));
|
|
38
|
+
}
|
|
39
|
+
if (!this._outgoingMessageBus) return r(/* @__PURE__ */ Error(this._side + ": outgoing bus not set yet"));
|
|
40
|
+
this._outgoingMessageBus.postMessage(a, "*", [i.port2]);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
_handleMessage(e) {
|
|
44
|
+
let t = e.ports && Array.isArray(e.ports) && e.ports.length > 0 ? e.ports[0] : null;
|
|
45
|
+
if (e.data && (typeof e.data == "string" || e.data.type !== "connect_hi") && t) try {
|
|
46
|
+
let n = JSON.parse(e.data);
|
|
47
|
+
if (!this._execMessage) return t.postMessage(JSON.stringify({ error: this._side + " is not ready to handle messages" }));
|
|
48
|
+
Array.isArray(n.args) || (n.args = [n.args]);
|
|
49
|
+
let r = this._execMessage(n, e);
|
|
50
|
+
if (r === void 0) return;
|
|
51
|
+
r.then((e = {}) => {
|
|
52
|
+
let n, r;
|
|
53
|
+
typeof e == "object" && e && (n = e.error, r = e.result), n ? t.postMessage(JSON.stringify({ error: n })) : r === void 0 ? t.postMessage(JSON.stringify({ result: e })) : t.postMessage(JSON.stringify({ result: r }));
|
|
54
|
+
}, (e) => {
|
|
55
|
+
t.postMessage(JSON.stringify({ error: this._prepareError(e) }));
|
|
56
|
+
});
|
|
57
|
+
} catch (e) {
|
|
58
|
+
t.postMessage(JSON.stringify({ error: this._prepareError(e) }));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
_prepareError(e) {
|
|
62
|
+
return typeof e == "string" ? this._side + ": " + e : (e.message = this._side + ": " + e.message, e.message);
|
|
63
|
+
}
|
|
64
|
+
}, n = [
|
|
65
|
+
"127.0.0.1",
|
|
66
|
+
"localhost",
|
|
67
|
+
"0.0.0.0"
|
|
68
|
+
], r = (e, t) => i(JSON.parse(JSON.stringify(e)), t), i = (e, t) => {
|
|
69
|
+
for (let n in t) try {
|
|
70
|
+
t[n].constructor === Object ? e[n] = i(e[n], t[n]) : e[n] = t[n];
|
|
71
|
+
} catch {
|
|
72
|
+
e[n] = t[n];
|
|
73
|
+
}
|
|
74
|
+
return e;
|
|
75
|
+
}, a = function(e) {
|
|
76
|
+
return e.BOTTOM_BAR = "bottom_bar", e.PARTLIST_BOUNDS = "partlist_bounds", e.INTERACTION_NOTES = "interaction_notes", e.PARAMETER_GROUPS = "parameter_groups", e;
|
|
77
|
+
}({}), o = (e) => JSON.parse(JSON.stringify(e)), s = {
|
|
78
|
+
mobileLandscape: !0,
|
|
79
|
+
floorMaterialRootTag: "materials_root",
|
|
80
|
+
buttons: {
|
|
81
|
+
renderimage: !0,
|
|
82
|
+
requestproduct: !0,
|
|
83
|
+
requestplan: !0,
|
|
84
|
+
load_product: !0,
|
|
85
|
+
partlist_print: !0
|
|
86
|
+
},
|
|
87
|
+
elements: { [a.INTERACTION_NOTES]: !0 },
|
|
88
|
+
helpcenter: {
|
|
89
|
+
roomdesigner: !0,
|
|
90
|
+
configurator: !1,
|
|
91
|
+
disable: !1
|
|
92
|
+
},
|
|
93
|
+
firstPersonView: !0,
|
|
94
|
+
saveToIdb: !0,
|
|
95
|
+
enableTwoLevelCatalog: !1,
|
|
96
|
+
webGpu: !1,
|
|
97
|
+
positionInputDrawer: !1,
|
|
98
|
+
featureFlags: {
|
|
99
|
+
mocAr: !0,
|
|
100
|
+
wallAutoHeight: !1,
|
|
101
|
+
curvedWalls: !1,
|
|
102
|
+
openCloseAnimation: !0,
|
|
103
|
+
localExport3d: !1
|
|
104
|
+
},
|
|
105
|
+
configuratorZoom: !1,
|
|
106
|
+
rotationSnapDegrees: 10,
|
|
107
|
+
interactionsCollapsed: !1
|
|
108
|
+
}, c = (e) => e.trim() !== "" && Number.isFinite(Number(e.trim())), l = (e) => {
|
|
109
|
+
if (!e || typeof e != "object") return;
|
|
110
|
+
let t = Object.keys(e);
|
|
111
|
+
for (let n of t) {
|
|
112
|
+
let t = e[n];
|
|
113
|
+
if (Array.isArray(t) || typeof t != "object" || !t || l(t), Array.isArray(t)) for (let e of t) l(e);
|
|
114
|
+
t === "true" || t === "false" ? e[n] = t === "true" : typeof t == "string" && c(t) && (e[n] = Number(t));
|
|
115
|
+
}
|
|
116
|
+
}, u = () => {
|
|
117
|
+
let t = o(s);
|
|
118
|
+
t.locale ||= e(null, !0), t.id === "(idle)" && delete t.id;
|
|
119
|
+
let r = (() => {
|
|
120
|
+
let e = (() => {
|
|
121
|
+
try {
|
|
122
|
+
return window.self !== window.top;
|
|
123
|
+
} catch {
|
|
124
|
+
return !0;
|
|
125
|
+
}
|
|
126
|
+
})(), t = window.location.href;
|
|
127
|
+
if (e) {
|
|
128
|
+
if (!document.referrer) return null;
|
|
129
|
+
t = document.referrer;
|
|
130
|
+
}
|
|
131
|
+
let { hostname: n } = new URL(t);
|
|
132
|
+
return n;
|
|
133
|
+
})();
|
|
134
|
+
return r && ((e) => {
|
|
135
|
+
let t = /* @__PURE__ */ new RegExp(/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/);
|
|
136
|
+
return !!(n.includes(e) || t.test(e) || e.endsWith("roomle.com") || e.endsWith("gitlab.io") || e.endsWith("gitlab.com"));
|
|
137
|
+
})(r) && (t.configuratorId = "demoConfigurator"), t.customApiUrl = void 0, t.emails = !1, t;
|
|
138
|
+
}, d = (e) => {
|
|
139
|
+
e.featureFlags ||= {}, typeof e.featureFlags.realPartList != "boolean" && (e.featureFlags.realPartList = !0), typeof e.featureFlags.globalCallbacks != "boolean" && (e.featureFlags.globalCallbacks = !0), typeof e.featureFlags.mocAr != "boolean" && (e.featureFlags.mocAr = !1);
|
|
140
|
+
}, f = () => /(android)/i.test(navigator.userAgent), p = class {
|
|
141
|
+
_messageHandler = null;
|
|
142
|
+
isSetupDone = !1;
|
|
143
|
+
viewName = "main";
|
|
144
|
+
plugins = {};
|
|
145
|
+
pluginsLoaded = [];
|
|
146
|
+
ui = { callbacks: null };
|
|
147
|
+
extended = { callbacks: null };
|
|
148
|
+
configurator = { callbacks: null };
|
|
149
|
+
analytics = { callbacks: {} };
|
|
150
|
+
rapi = { callbacks: {} };
|
|
151
|
+
global = { callbacks: {} };
|
|
152
|
+
setMessageHandler(e) {
|
|
153
|
+
this._messageHandler = e;
|
|
154
|
+
}
|
|
155
|
+
handleSetup(e) {
|
|
156
|
+
let { methods: t, callbacks: n } = e;
|
|
157
|
+
t.forEach((e) => {
|
|
158
|
+
let t = e.split("."), n = t[0], r = t[1];
|
|
159
|
+
this[n] || (this[n] = {}), this[n][r] = function() {
|
|
160
|
+
if (this._messageHandler) return this._messageHandler.sendMessage(e, [...arguments]);
|
|
161
|
+
}.bind(this);
|
|
162
|
+
}), n.forEach((e) => {
|
|
163
|
+
let t = e.split("."), n = t[0], r = t[1], i = t[2];
|
|
164
|
+
this[n] || (this[n] = {}), this[n][r] || (this[n][r] = {}), this[n][r][i] = () => {};
|
|
165
|
+
}), this.isSetupDone = !0;
|
|
166
|
+
}
|
|
167
|
+
executeMessage({ message: e, args: t }) {
|
|
168
|
+
let n = e.split("."), r = n[0], i = n[1], a = n.length === 3 ? n[2] : null;
|
|
169
|
+
if (a && this[r][i][a]) {
|
|
170
|
+
let e = this[r][i][a](...t);
|
|
171
|
+
return e instanceof Promise ? e.then((e) => ({ result: e })) : e === void 0 ? Promise.resolve({ result: null }) : Promise.resolve({ result: e });
|
|
172
|
+
}
|
|
173
|
+
return Promise.reject("Message \"" + e + "\" is unkown");
|
|
174
|
+
}
|
|
175
|
+
setupPlugins(e, t, n = "website") {
|
|
176
|
+
for (let r of e) typeof r == "string" && r === "dragIn" ? this.pluginsLoaded.push(new Promise((e, r) => {
|
|
177
|
+
try {
|
|
178
|
+
import("./drag-in-BP_E53zb.mjs").then((e) => e.n).then(({ DragIn: i }) => {
|
|
179
|
+
let a = new i(this.ui, t, n, this.viewName);
|
|
180
|
+
a.init().then(() => {
|
|
181
|
+
this.plugins.dragIn = a, e();
|
|
182
|
+
}, r);
|
|
183
|
+
});
|
|
184
|
+
} catch (e) {
|
|
185
|
+
r(e);
|
|
186
|
+
}
|
|
187
|
+
})) : r.name && r.loader && this.pluginsLoaded.push(new Promise((e, i) => {
|
|
188
|
+
try {
|
|
189
|
+
r.loader().then((a) => {
|
|
190
|
+
let o = new a(this.ui, t, n, this.viewName);
|
|
191
|
+
o.init().then(() => {
|
|
192
|
+
this.plugins[r.name] = o, e();
|
|
193
|
+
}, i);
|
|
194
|
+
});
|
|
195
|
+
} catch (e) {
|
|
196
|
+
i(e);
|
|
197
|
+
}
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
}, m = () => {
|
|
201
|
+
let e, t;
|
|
202
|
+
return {
|
|
203
|
+
promise: new Promise((n, r) => {
|
|
204
|
+
e = n, t = r;
|
|
205
|
+
}),
|
|
206
|
+
resolve: e,
|
|
207
|
+
reject: t
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
(/* @__PURE__ */ "/items./items/{id}./items/{id}/renderings./items/{id}/conversions./items/{id}/3d-exports./items/{id}/perspectiveImage./items/{id}/perspectiveImageHD./items/{id}/topImage./items/{id}/tags./items/{id}/tagConnections./items/{id}/additionalContents./items/{id}/assetProcessings./items/{id}/3dAssets/{format}./items/{id}/3dAssets/{format}/{dummyFileName}./configurations./configurations/{id}./configurations/{id}/shares./configurations/{id}/renderings./configurations/{id}/3d-exports./configurations/{id}/3dAssets/{format}./configurations/{id}/3dAssets/{format}/{dummyFileName}./auth/signin./auth/signout./auth/reset./auth/reset/confirm./auth/change/pwd./auth/context./assets/analyze./version".split(".")).map((e) => RegExp("^" + e.replace(/\{[^}]+\}/g, "[^/]+") + "/?$"));
|
|
211
|
+
var h = /\/v[23]\/?$/, g = {
|
|
212
|
+
SDK: "extended",
|
|
213
|
+
CONFIGURATOR_SDK: "configurator",
|
|
214
|
+
CALLBACKS: "callbacks",
|
|
215
|
+
UI: "ui",
|
|
216
|
+
ANALYTICS: "analytics",
|
|
217
|
+
GLOBAL: "global",
|
|
218
|
+
RAPI: "rapi"
|
|
219
|
+
}, _ = ".", v = g.SDK + "." + g.CALLBACKS, y = {
|
|
220
|
+
REQUEST_BOOT: "requestBoot",
|
|
221
|
+
SETUP: "setup",
|
|
222
|
+
WEBSITE_READY: "websiteReady"
|
|
223
|
+
}, b = {
|
|
224
|
+
GET_METHODS: "getMethods",
|
|
225
|
+
RETURN_METHODS: "returnMethods",
|
|
226
|
+
REGISTER_CUSTOM_VIEW: "registerCustomView",
|
|
227
|
+
REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
|
|
228
|
+
}, x = ["constructor", "callbacks"], S = (e) => e[0] !== "_" && !x.includes(e), C = (e, t, n = !1) => {
|
|
229
|
+
if (!e) return [];
|
|
230
|
+
let r = Object.getOwnPropertyNames(e), i = n ? g.CALLBACKS + "." : "";
|
|
231
|
+
return r.filter(S).map((e) => t + "." + i + e);
|
|
232
|
+
}, w = async (e, t) => {
|
|
233
|
+
if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
|
|
234
|
+
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = (a = n, o = "/configurators/" + e, h.test(a) ? a.replace(h, "/v2") + o : a + o);
|
|
235
|
+
var a, o;
|
|
236
|
+
let s = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), c = new Request(i, {
|
|
237
|
+
method: "GET",
|
|
238
|
+
headers: new Headers({
|
|
239
|
+
apiKey: "roomle_portal_v2",
|
|
240
|
+
currentTenant: r,
|
|
241
|
+
locale: "en",
|
|
242
|
+
language: "en",
|
|
243
|
+
device: 1,
|
|
244
|
+
token: s,
|
|
245
|
+
platform: "web"
|
|
246
|
+
}),
|
|
247
|
+
mode: "cors",
|
|
248
|
+
cache: "default"
|
|
249
|
+
}), { configurator: l } = await (await fetch(c)).json();
|
|
250
|
+
return l;
|
|
251
|
+
}, T = "data-rml-interaction-container", E = (e, t, n) => {
|
|
252
|
+
let r = null;
|
|
253
|
+
Object.defineProperty(e, t, {
|
|
254
|
+
get: () => r || n,
|
|
255
|
+
set(e) {
|
|
256
|
+
r = e?.mute ? e.value : e;
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}, D = () => .01 * window.innerHeight + "px", O = (e) => {
|
|
260
|
+
e && setTimeout(() => e.style.setProperty(A, D()), 0);
|
|
261
|
+
}, k = "rml-styles", A = "--rml-full-height", j = "rml-container", M = "rml-fill", N = "rml-pos", P = "rml-android-height", F = "rml-overflow-hidden", I = /* @__PURE__ */ new Map(), L = class extends p {
|
|
262
|
+
static createPlanner(e, t, n, r = []) {
|
|
263
|
+
return this._create(e, t, n, r);
|
|
264
|
+
}
|
|
265
|
+
static async connect(e, n = []) {
|
|
266
|
+
let r = new p();
|
|
267
|
+
r.viewName = e;
|
|
268
|
+
let { resolve: i, promise: a } = m(), { resolve: o, promise: s } = m(), c = new t("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
|
|
269
|
+
switch (e) {
|
|
270
|
+
case b.REGISTER_CUSTOM_VIEW_DONE:
|
|
271
|
+
i();
|
|
272
|
+
break;
|
|
273
|
+
case b.RETURN_METHODS:
|
|
274
|
+
r.handleSetup(t[0]), o();
|
|
275
|
+
break;
|
|
276
|
+
default: if (r.isSetupDone) return r.executeMessage({
|
|
277
|
+
message: e,
|
|
278
|
+
args: t
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
r.setMessageHandler(c);
|
|
283
|
+
let l = [e];
|
|
284
|
+
return c.sendMessage(b.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(b.GET_METHODS, l), await s, r.setupPlugins(n, document.body, "custom-view"), await Promise.allSettled(r.pluginsLoaded), r;
|
|
285
|
+
}
|
|
286
|
+
static createConfigurator(e, t, n, r = []) {
|
|
287
|
+
return this._create(e, t, n, r);
|
|
288
|
+
}
|
|
289
|
+
static create(e, t, n, r) {
|
|
290
|
+
return this._create(e, t, n, r);
|
|
291
|
+
}
|
|
292
|
+
static createViewer(e, t, n, r = []) {
|
|
293
|
+
return this._create(e, t, n, r);
|
|
294
|
+
}
|
|
295
|
+
static async _create(e, t, n, i) {
|
|
296
|
+
return new Promise(async (a, s) => {
|
|
297
|
+
try {
|
|
298
|
+
let s = ((e) => (l(e), e?.customApiUrl && (e.customApiUrl = decodeURIComponent(e.customApiUrl)), e.shareUrl && (e.deeplink = e.shareUrl.replace("<CONF_ID>", "#CONFIGURATIONID#")), e))(n), c = u();
|
|
299
|
+
d(c);
|
|
300
|
+
let f = await w(e, r(c, s));
|
|
301
|
+
n = ((e, t) => {
|
|
302
|
+
let n = o(t), i = u();
|
|
303
|
+
d(i);
|
|
304
|
+
let a = r(r(i, e.settings || {}), n);
|
|
305
|
+
return a.configuratorId = e.id, !a.overrideTenant && e.tenant && (a.overrideTenant = e.tenant), ((e) => {
|
|
306
|
+
let t = e.featureFlags;
|
|
307
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return;
|
|
308
|
+
let n = t;
|
|
309
|
+
!("enableTwoLevelCatalog" in n) || typeof n.enableTwoLevelCatalog != "boolean" || !1 !== e.enableTwoLevelCatalog && e.enableTwoLevelCatalog !== void 0 || (e.enableTwoLevelCatalog = n.enableTwoLevelCatalog), !("webGpu" in n) || typeof n.webGpu != "boolean" || !1 !== e.webGpu && e.webGpu !== void 0 || (e.webGpu = n.webGpu);
|
|
310
|
+
})(a), a;
|
|
311
|
+
})(f, s);
|
|
312
|
+
let p = new this(f, t, n, i, a);
|
|
313
|
+
return await Promise.allSettled(p.pluginsLoaded), p;
|
|
314
|
+
} catch (e) {
|
|
315
|
+
return s(e);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
_waitForIframe;
|
|
320
|
+
_container;
|
|
321
|
+
_configuratorSettings;
|
|
322
|
+
_initData = {};
|
|
323
|
+
_iframe;
|
|
324
|
+
constructor(e, n, r, i, a) {
|
|
325
|
+
if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
|
|
326
|
+
if (I.has(n)) throw Error("There is already an instance on this DOM element");
|
|
327
|
+
if (!document.getElementById(k)) {
|
|
328
|
+
let e = r.zIndex || 9999999, t = document.createElement("style");
|
|
329
|
+
t.type = "text/css", t.id = k;
|
|
330
|
+
let n = "transition:all ease-in-out 450ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e + (t + n), "") + n;
|
|
331
|
+
t.innerHTML = `\n .${j}{${A}:${D()};}\n .${N}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${M}{width:100%;height:100%;opacity:1}\n .${P}{height:calc(var(${A},1vh)*100)}\n .${F}{overflow:hidden}\n `, document.head.appendChild(t);
|
|
332
|
+
}
|
|
333
|
+
this._executeMessage = this._executeMessage.bind(this);
|
|
334
|
+
let o = new t("website", window, null, this._executeMessage);
|
|
335
|
+
this.setMessageHandler(o), this._onResize = this._onResize.bind(this), f() && window.addEventListener("resize", this._onResize), this._container = n, this._initData = r, this._configuratorSettings = e;
|
|
336
|
+
let s = this._createIframe();
|
|
337
|
+
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe), I.set(n, !0);
|
|
338
|
+
}
|
|
339
|
+
teardown() {
|
|
340
|
+
this._container && I.delete(this._container);
|
|
341
|
+
let e = this._container.querySelector("iframe");
|
|
342
|
+
e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
|
|
343
|
+
}
|
|
344
|
+
_createIframe() {
|
|
345
|
+
let e = document.createElement("iframe"), t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
|
|
346
|
+
return this._initData.useLocalRoomle && (t = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (t = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (t = this._initData.overrideServerUrl), e.src = t, e.classList.add(j), e.classList.add(M), e;
|
|
347
|
+
}
|
|
348
|
+
_onResize() {
|
|
349
|
+
O(this._iframe);
|
|
350
|
+
}
|
|
351
|
+
_onUseFullPage() {
|
|
352
|
+
this._iframe.classList.add(N), document.documentElement.classList.add(F), window.document.body.classList.add(F), f() && (O(this._iframe), this._iframe.classList.add(P));
|
|
353
|
+
}
|
|
354
|
+
_onBackToWebsite() {
|
|
355
|
+
this._iframe.classList.remove(N), this._iframe.classList.remove(P), document.documentElement.classList.remove(F), window.document.body.classList.remove(F);
|
|
356
|
+
}
|
|
357
|
+
_executeMessage({ message: e, args: t }, n) {
|
|
358
|
+
if (n.source && n.source === this._iframe?.contentWindow) return e === y.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(n.source), Promise.resolve({ result: this._initData })) : Promise.resolve({ error: "MessageHandler not set" }) : e === y.SETUP ? (this.handleSetup(t[0]), E(this.ui.callbacks, "onUseFullPage", this._onUseFullPage), E(this.ui.callbacks, "onBackToWebsite", this._onBackToWebsite), this._waitForIframe(this), setTimeout(() => {
|
|
359
|
+
this._messageHandler && this._messageHandler.sendMessage(y.WEBSITE_READY);
|
|
360
|
+
}, 0), Promise.resolve({ result: null })) : this.executeMessage({
|
|
361
|
+
message: e,
|
|
362
|
+
args: t
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
export { y as HANDSHAKE_MESSAGES, T as INTERACTION_CONTAINER_SELECTOR, g as NAMESPACE, _ as NAMESPACE_SEPARATOR, v as SDK_CALLBACK, b as WELL_KNOWN_MESSAGES, L as default, w as getConfiguratorSettings, C as getMethodNames, S as isExposable };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
//#region packages/common/src/utils/get-computed-style-cached.ts
|
|
2
|
+
var e = class {
|
|
3
|
+
_computedStyleCache = /* @__PURE__ */ new Map();
|
|
4
|
+
_maxLifetime = 16;
|
|
5
|
+
_cacheCleanInterval = null;
|
|
6
|
+
constructor(e = 16) {
|
|
7
|
+
this._maxLifetime = e;
|
|
8
|
+
}
|
|
9
|
+
get(e) {
|
|
10
|
+
let t = this._computedStyleCache.get(e), n = Date.now();
|
|
11
|
+
if (t && n - t.updated < this._maxLifetime) return t.style;
|
|
12
|
+
let r = getComputedStyle(e);
|
|
13
|
+
return this._computedStyleCache.set(e, {
|
|
14
|
+
style: r,
|
|
15
|
+
updated: n
|
|
16
|
+
}), this._cacheCleanInterval ||= setInterval(() => this._cleanUpCache, Math.max(this._maxLifetime * 1e3, 5e3)), r;
|
|
17
|
+
}
|
|
18
|
+
_cleanUpCache() {
|
|
19
|
+
let e = Date.now();
|
|
20
|
+
for (let [t, { updated: n }] of this._computedStyleCache.entries()) e - n >= this._maxLifetime && this._computedStyleCache.delete(t);
|
|
21
|
+
this._computedStyleCache.size === 0 && this._cacheCleanInterval && (clearInterval(this._cacheCleanInterval), this._cacheCleanInterval = null);
|
|
22
|
+
}
|
|
23
|
+
}, t = (e) => window.TouchEvent && e instanceof window.TouchEvent, n, r = (t) => (n ||= new e(), n.get(t)), i = (e, t, n) => {
|
|
24
|
+
let i = parseFloat(e), a = window.devicePixelRatio || 1;
|
|
25
|
+
if (t === "px") return i;
|
|
26
|
+
if (t === "%") {
|
|
27
|
+
let e = n === document.documentElement ? window.innerWidth : n.offsetWidth;
|
|
28
|
+
return i / 100 * e;
|
|
29
|
+
}
|
|
30
|
+
if (t === "rem") return i * parseFloat(r(document.documentElement).fontSize);
|
|
31
|
+
if (t === "em") return i * parseFloat(r(n).fontSize);
|
|
32
|
+
if (t === "vh" || t === "vw" || t === "vmin" || t === "vmax") {
|
|
33
|
+
let e = {
|
|
34
|
+
vh: window.innerHeight,
|
|
35
|
+
vw: window.innerWidth,
|
|
36
|
+
vmin: Math.min(window.innerWidth, window.innerHeight),
|
|
37
|
+
vmax: Math.max(window.innerWidth, window.innerHeight)
|
|
38
|
+
};
|
|
39
|
+
return i / 100 * e[t];
|
|
40
|
+
}
|
|
41
|
+
let o = {
|
|
42
|
+
cm: 37.7952755906,
|
|
43
|
+
mm: 3.77952755906,
|
|
44
|
+
in: 96
|
|
45
|
+
};
|
|
46
|
+
return t in o ? i * o[t] * a : (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);
|
|
47
|
+
}, a = (e, t, n = {
|
|
48
|
+
x: 0,
|
|
49
|
+
y: 0
|
|
50
|
+
}) => {
|
|
51
|
+
let a = e.getBoundingClientRect(), s = r(e).transform, c = 0, l = 0;
|
|
52
|
+
if (s !== "none") {
|
|
53
|
+
let t = s.match(/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/);
|
|
54
|
+
t && (c = i(t[1], t[2], e), l = i(t[3], t[4], e));
|
|
55
|
+
}
|
|
56
|
+
let { clientX: u, clientY: d } = o(t, n);
|
|
57
|
+
return {
|
|
58
|
+
x: u - a.left - c + e.scrollLeft,
|
|
59
|
+
y: d - a.top - l + e.scrollTop
|
|
60
|
+
};
|
|
61
|
+
}, o = (e, n = null) => {
|
|
62
|
+
let { clientX: r, clientY: i } = t(e) ? s(e) : e;
|
|
63
|
+
return {
|
|
64
|
+
clientX: r > 0 ? r : n ? n.x : r,
|
|
65
|
+
clientY: i > 0 ? i : n ? n.y : i
|
|
66
|
+
};
|
|
67
|
+
}, s = (e) => {
|
|
68
|
+
if (e.touches.length) {
|
|
69
|
+
let { clientX: t, clientY: n } = e.touches[0];
|
|
70
|
+
if (e.touches.length > 1) {
|
|
71
|
+
let r = e.touches[1], i = r.clientX, a = r.clientY;
|
|
72
|
+
t = (t + i) / 2, n = (n + a) / 2;
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
clientX: t,
|
|
76
|
+
clientY: n
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
let t = e.changedTouches[0];
|
|
80
|
+
return {
|
|
81
|
+
clientX: t.clientX,
|
|
82
|
+
clientY: t.clientY
|
|
83
|
+
};
|
|
84
|
+
}, c = (e) => new Proxy(e, { get(e, t, n) {
|
|
85
|
+
let r = Reflect.get(e, t, n);
|
|
86
|
+
return r === void 0 ? (console.warn(`[Homag Intelligence Callbacks] Method '${String(t)}' is not implemented. Executing a no-op.`), (...e) => void 0) : r;
|
|
87
|
+
} }), l = (e, t, n) => e >= n.left && e <= n.right && t >= n.top && t <= n.bottom, u = (e, t, n, r, i, a) => {
|
|
88
|
+
let o = !1;
|
|
89
|
+
n && (o = a ? l(e, t, {
|
|
90
|
+
left: a.left + n.x,
|
|
91
|
+
right: a.left + n.x + n.width,
|
|
92
|
+
top: a.top + n.y,
|
|
93
|
+
bottom: a.top + n.y + n.height
|
|
94
|
+
}) : l(e, t, {
|
|
95
|
+
left: n.x,
|
|
96
|
+
right: n.x + n.width,
|
|
97
|
+
top: n.y,
|
|
98
|
+
bottom: n.y + n.height
|
|
99
|
+
}));
|
|
100
|
+
let s = !1;
|
|
101
|
+
r && (s = a ? l(e, t, {
|
|
102
|
+
left: a.left + r.x,
|
|
103
|
+
right: a.left + r.x + r.width,
|
|
104
|
+
top: a.top + r.y,
|
|
105
|
+
bottom: a.top + r.y + r.height
|
|
106
|
+
}) : l(e, t, {
|
|
107
|
+
left: r.x,
|
|
108
|
+
right: r.x + r.width,
|
|
109
|
+
top: r.y,
|
|
110
|
+
bottom: r.y + r.height
|
|
111
|
+
}));
|
|
112
|
+
let c = !1;
|
|
113
|
+
return i && (c = a ? l(e, t, {
|
|
114
|
+
left: a.left + i.x,
|
|
115
|
+
right: a.left + i.x + i.width,
|
|
116
|
+
top: a.top + i.y,
|
|
117
|
+
bottom: a.top + i.y + i.height
|
|
118
|
+
}) : l(e, t, {
|
|
119
|
+
left: i.x,
|
|
120
|
+
right: i.x + i.width,
|
|
121
|
+
top: i.y,
|
|
122
|
+
bottom: i.y + i.height
|
|
123
|
+
})), o && !s && !c;
|
|
124
|
+
}, d = (e, t, n, r) => l(e, t, n) ? r ? !l(e, t, {
|
|
125
|
+
left: r.left + n.left,
|
|
126
|
+
right: r.right + n.left,
|
|
127
|
+
top: r.top + n.top,
|
|
128
|
+
bottom: r.bottom + n.top
|
|
129
|
+
}) : !0 : !1;
|
|
130
|
+
//#endregion
|
|
131
|
+
export { u as a, t as c, a as i, o as n, d as o, r, l as s, c as t };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var e, t = class {
|
|
2
|
+
_computedStyleCache = /* @__PURE__ */ new Map();
|
|
3
|
+
_maxLifetime = 16;
|
|
4
|
+
_cacheCleanInterval = null;
|
|
5
|
+
constructor(e = 16) {
|
|
6
|
+
this._maxLifetime = e;
|
|
7
|
+
}
|
|
8
|
+
get(e) {
|
|
9
|
+
let t = this._computedStyleCache.get(e), n = Date.now();
|
|
10
|
+
if (t && n - t.updated < this._maxLifetime) return t.style;
|
|
11
|
+
let r = getComputedStyle(e);
|
|
12
|
+
return this._computedStyleCache.set(e, {
|
|
13
|
+
style: r,
|
|
14
|
+
updated: n
|
|
15
|
+
}), this._cacheCleanInterval ||= setInterval(() => this._cleanUpCache, Math.max(1e3 * this._maxLifetime, 5e3)), r;
|
|
16
|
+
}
|
|
17
|
+
_cleanUpCache() {
|
|
18
|
+
let e = Date.now();
|
|
19
|
+
for (let [t, { updated: n }] of this._computedStyleCache.entries()) e - n >= this._maxLifetime && this._computedStyleCache.delete(t);
|
|
20
|
+
this._computedStyleCache.size === 0 && this._cacheCleanInterval && (clearInterval(this._cacheCleanInterval), this._cacheCleanInterval = null);
|
|
21
|
+
}
|
|
22
|
+
}, n = (e) => window.TouchEvent && e instanceof window.TouchEvent, r = (n) => (e ||= new t(), e.get(n)), i = (e, t, n) => {
|
|
23
|
+
let i = parseFloat(e), a = window.devicePixelRatio || 1;
|
|
24
|
+
if (t === "px") return i;
|
|
25
|
+
if (t === "%") return i / 100 * (n === document.documentElement ? window.innerWidth : n.offsetWidth);
|
|
26
|
+
if (t === "rem") return i * parseFloat(r(document.documentElement).fontSize);
|
|
27
|
+
if (t === "em") return i * parseFloat(r(n).fontSize);
|
|
28
|
+
if (t === "vh" || t === "vw" || t === "vmin" || t === "vmax") return i / 100 * {
|
|
29
|
+
vh: window.innerHeight,
|
|
30
|
+
vw: window.innerWidth,
|
|
31
|
+
vmin: Math.min(window.innerWidth, window.innerHeight),
|
|
32
|
+
vmax: Math.max(window.innerWidth, window.innerHeight)
|
|
33
|
+
}[t];
|
|
34
|
+
let o = {
|
|
35
|
+
cm: 37.7952755906,
|
|
36
|
+
mm: 3.77952755906,
|
|
37
|
+
in: 96
|
|
38
|
+
};
|
|
39
|
+
return t in o ? i * o[t] * a : 0;
|
|
40
|
+
}, a = (e, t, n = {
|
|
41
|
+
x: 0,
|
|
42
|
+
y: 0
|
|
43
|
+
}) => {
|
|
44
|
+
let a = e.getBoundingClientRect(), s = r(e).transform, c = 0, l = 0;
|
|
45
|
+
if (s !== "none") {
|
|
46
|
+
let t = s.match(/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/);
|
|
47
|
+
t && (c = i(t[1], t[2], e), l = i(t[3], t[4], e));
|
|
48
|
+
}
|
|
49
|
+
let { clientX: u, clientY: d } = o(t, n);
|
|
50
|
+
return {
|
|
51
|
+
x: u - a.left - c + e.scrollLeft,
|
|
52
|
+
y: d - a.top - l + e.scrollTop
|
|
53
|
+
};
|
|
54
|
+
}, o = (e, t = null) => {
|
|
55
|
+
let { clientX: r, clientY: i } = n(e) ? s(e) : e;
|
|
56
|
+
return {
|
|
57
|
+
clientX: r > 0 ? r : t ? t.x : r,
|
|
58
|
+
clientY: i > 0 ? i : t ? t.y : i
|
|
59
|
+
};
|
|
60
|
+
}, s = (e) => {
|
|
61
|
+
if (e.touches.length) {
|
|
62
|
+
let { clientX: t, clientY: n } = e.touches[0];
|
|
63
|
+
if (e.touches.length > 1) {
|
|
64
|
+
let r = e.touches[1];
|
|
65
|
+
t = (t + r.clientX) / 2, n = (n + r.clientY) / 2;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
clientX: t,
|
|
69
|
+
clientY: n
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
let t = e.changedTouches[0];
|
|
73
|
+
return {
|
|
74
|
+
clientX: t.clientX,
|
|
75
|
+
clientY: t.clientY
|
|
76
|
+
};
|
|
77
|
+
}, c = (e) => new Proxy(e, { get(e, t, n) {
|
|
78
|
+
let r = Reflect.get(e, t, n);
|
|
79
|
+
return r === void 0 ? (...e) => {} : r;
|
|
80
|
+
} }), l = (e, t, n) => e >= n.left && e <= n.right && t >= n.top && t <= n.bottom, u = (e, t, n, r, i, a) => {
|
|
81
|
+
let o = !1;
|
|
82
|
+
n && (o = l(e, t, a ? {
|
|
83
|
+
left: a.left + n.x,
|
|
84
|
+
right: a.left + n.x + n.width,
|
|
85
|
+
top: a.top + n.y,
|
|
86
|
+
bottom: a.top + n.y + n.height
|
|
87
|
+
} : {
|
|
88
|
+
left: n.x,
|
|
89
|
+
right: n.x + n.width,
|
|
90
|
+
top: n.y,
|
|
91
|
+
bottom: n.y + n.height
|
|
92
|
+
}));
|
|
93
|
+
let s = !1;
|
|
94
|
+
r && (s = l(e, t, a ? {
|
|
95
|
+
left: a.left + r.x,
|
|
96
|
+
right: a.left + r.x + r.width,
|
|
97
|
+
top: a.top + r.y,
|
|
98
|
+
bottom: a.top + r.y + r.height
|
|
99
|
+
} : {
|
|
100
|
+
left: r.x,
|
|
101
|
+
right: r.x + r.width,
|
|
102
|
+
top: r.y,
|
|
103
|
+
bottom: r.y + r.height
|
|
104
|
+
}));
|
|
105
|
+
let c = !1;
|
|
106
|
+
return i && (c = l(e, t, a ? {
|
|
107
|
+
left: a.left + i.x,
|
|
108
|
+
right: a.left + i.x + i.width,
|
|
109
|
+
top: a.top + i.y,
|
|
110
|
+
bottom: a.top + i.y + i.height
|
|
111
|
+
} : {
|
|
112
|
+
left: i.x,
|
|
113
|
+
right: i.x + i.width,
|
|
114
|
+
top: i.y,
|
|
115
|
+
bottom: i.y + i.height
|
|
116
|
+
})), o && !s && !c;
|
|
117
|
+
}, d = (e, t, n, r) => !(!l(e, t, n) || r && l(e, t, {
|
|
118
|
+
left: r.left + n.left,
|
|
119
|
+
right: r.right + n.left,
|
|
120
|
+
top: r.top + n.top,
|
|
121
|
+
bottom: r.bottom + n.top
|
|
122
|
+
}));
|
|
123
|
+
export { u as a, n as c, a as i, o as n, d as o, r, l as s, c as t };
|