@luzmo/embed 5.0.10 → 5.0.11

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.
@@ -0,0 +1,3094 @@
1
+ (function (g, f) {
2
+ var hasExports = typeof exports === 'object';
3
+ if (typeof define === "function" && define.amd) {
4
+ define([], f);
5
+ } else if (typeof module === "object" && module.exports) {
6
+ module.exports = f();
7
+ } else {
8
+ var m = hasExports ? f() : f();
9
+ var root = hasExports ? exports : g;
10
+ for(var i in m) root[i] = m[i];
11
+ }}(typeof self !== 'undefined' ? self : this, () => {
12
+ var exports = {};
13
+ var module = { exports };
14
+ "use strict";
15
+ var __defProp = Object.defineProperty;
16
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
17
+ var __getOwnPropNames = Object.getOwnPropertyNames;
18
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, { get: all[name], enumerable: true });
22
+ };
23
+ var __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") {
25
+ for (let key of __getOwnPropNames(from))
26
+ if (!__hasOwnProp.call(to, key) && key !== except)
27
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
+ }
29
+ return to;
30
+ };
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+ var __decorateClass = (decorators, target, key, kind) => {
33
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
34
+ for (var i6 = decorators.length - 1, decorator; i6 >= 0; i6--)
35
+ if (decorator = decorators[i6])
36
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
37
+ if (kind && result)
38
+ __defProp(target, key, result);
39
+ return result;
40
+ };
41
+
42
+ // libs/embed-libs/embed/src/index.libs.ts
43
+ var index_libs_exports = {};
44
+ __export(index_libs_exports, {
45
+ LuzmoDashboardWebComponent: () => LuzmoDashboardWebComponent
46
+ });
47
+ module.exports = __toCommonJS(index_libs_exports);
48
+
49
+ // node_modules/@lit/reactive-element/decorators/custom-element.js
50
+ var t = (t5) => (e7, o6) => {
51
+ void 0 !== o6 ? o6.addInitializer(() => {
52
+ customElements.define(t5, e7);
53
+ }) : customElements.define(t5, e7);
54
+ };
55
+
56
+ // node_modules/@lit/reactive-element/css-tag.js
57
+ var t2 = globalThis;
58
+ var e = t2.ShadowRoot && (void 0 === t2.ShadyCSS || t2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
59
+ var s = Symbol();
60
+ var o = /* @__PURE__ */ new WeakMap();
61
+ var n = class {
62
+ constructor(t5, e7, o6) {
63
+ if (this._$cssResult$ = true, o6 !== s)
64
+ throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
65
+ this.cssText = t5, this.t = e7;
66
+ }
67
+ get styleSheet() {
68
+ let t5 = this.o;
69
+ const s4 = this.t;
70
+ if (e && void 0 === t5) {
71
+ const e7 = void 0 !== s4 && 1 === s4.length;
72
+ e7 && (t5 = o.get(s4)), void 0 === t5 && ((this.o = t5 = new CSSStyleSheet()).replaceSync(this.cssText), e7 && o.set(s4, t5));
73
+ }
74
+ return t5;
75
+ }
76
+ toString() {
77
+ return this.cssText;
78
+ }
79
+ };
80
+ var r = (t5) => new n("string" == typeof t5 ? t5 : t5 + "", void 0, s);
81
+ var i = (t5, ...e7) => {
82
+ const o6 = 1 === t5.length ? t5[0] : e7.reduce((e8, s4, o7) => e8 + ((t6) => {
83
+ if (true === t6._$cssResult$)
84
+ return t6.cssText;
85
+ if ("number" == typeof t6)
86
+ return t6;
87
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + t6 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
88
+ })(s4) + t5[o7 + 1], t5[0]);
89
+ return new n(o6, t5, s);
90
+ };
91
+ var S = (s4, o6) => {
92
+ if (e)
93
+ s4.adoptedStyleSheets = o6.map((t5) => t5 instanceof CSSStyleSheet ? t5 : t5.styleSheet);
94
+ else
95
+ for (const e7 of o6) {
96
+ const o7 = document.createElement("style"), n6 = t2.litNonce;
97
+ void 0 !== n6 && o7.setAttribute("nonce", n6), o7.textContent = e7.cssText, s4.appendChild(o7);
98
+ }
99
+ };
100
+ var c = e ? (t5) => t5 : (t5) => t5 instanceof CSSStyleSheet ? ((t6) => {
101
+ let e7 = "";
102
+ for (const s4 of t6.cssRules)
103
+ e7 += s4.cssText;
104
+ return r(e7);
105
+ })(t5) : t5;
106
+
107
+ // node_modules/@lit/reactive-element/reactive-element.js
108
+ var { is: i2, defineProperty: e2, getOwnPropertyDescriptor: r2, getOwnPropertyNames: h, getOwnPropertySymbols: o2, getPrototypeOf: n2 } = Object;
109
+ var a = globalThis;
110
+ var c2 = a.trustedTypes;
111
+ var l = c2 ? c2.emptyScript : "";
112
+ var p = a.reactiveElementPolyfillSupport;
113
+ var d = (t5, s4) => t5;
114
+ var u = { toAttribute(t5, s4) {
115
+ switch (s4) {
116
+ case Boolean:
117
+ t5 = t5 ? l : null;
118
+ break;
119
+ case Object:
120
+ case Array:
121
+ t5 = null == t5 ? t5 : JSON.stringify(t5);
122
+ }
123
+ return t5;
124
+ }, fromAttribute(t5, s4) {
125
+ let i6 = t5;
126
+ switch (s4) {
127
+ case Boolean:
128
+ i6 = null !== t5;
129
+ break;
130
+ case Number:
131
+ i6 = null === t5 ? null : Number(t5);
132
+ break;
133
+ case Object:
134
+ case Array:
135
+ try {
136
+ i6 = JSON.parse(t5);
137
+ } catch (t6) {
138
+ i6 = null;
139
+ }
140
+ }
141
+ return i6;
142
+ } };
143
+ var f = (t5, s4) => !i2(t5, s4);
144
+ var y = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
145
+ Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
146
+ var b = class extends HTMLElement {
147
+ static addInitializer(t5) {
148
+ this._$Ei(), (this.l ??= []).push(t5);
149
+ }
150
+ static get observedAttributes() {
151
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
152
+ }
153
+ static createProperty(t5, s4 = y) {
154
+ if (s4.state && (s4.attribute = false), this._$Ei(), this.elementProperties.set(t5, s4), !s4.noAccessor) {
155
+ const i6 = Symbol(), r7 = this.getPropertyDescriptor(t5, i6, s4);
156
+ void 0 !== r7 && e2(this.prototype, t5, r7);
157
+ }
158
+ }
159
+ static getPropertyDescriptor(t5, s4, i6) {
160
+ const { get: e7, set: h3 } = r2(this.prototype, t5) ?? { get() {
161
+ return this[s4];
162
+ }, set(t6) {
163
+ this[s4] = t6;
164
+ } };
165
+ return { get() {
166
+ return e7?.call(this);
167
+ }, set(s5) {
168
+ const r7 = e7?.call(this);
169
+ h3.call(this, s5), this.requestUpdate(t5, r7, i6);
170
+ }, configurable: true, enumerable: true };
171
+ }
172
+ static getPropertyOptions(t5) {
173
+ return this.elementProperties.get(t5) ?? y;
174
+ }
175
+ static _$Ei() {
176
+ if (this.hasOwnProperty(d("elementProperties")))
177
+ return;
178
+ const t5 = n2(this);
179
+ t5.finalize(), void 0 !== t5.l && (this.l = [...t5.l]), this.elementProperties = new Map(t5.elementProperties);
180
+ }
181
+ static finalize() {
182
+ if (this.hasOwnProperty(d("finalized")))
183
+ return;
184
+ if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
185
+ const t6 = this.properties, s4 = [...h(t6), ...o2(t6)];
186
+ for (const i6 of s4)
187
+ this.createProperty(i6, t6[i6]);
188
+ }
189
+ const t5 = this[Symbol.metadata];
190
+ if (null !== t5) {
191
+ const s4 = litPropertyMetadata.get(t5);
192
+ if (void 0 !== s4)
193
+ for (const [t6, i6] of s4)
194
+ this.elementProperties.set(t6, i6);
195
+ }
196
+ this._$Eh = /* @__PURE__ */ new Map();
197
+ for (const [t6, s4] of this.elementProperties) {
198
+ const i6 = this._$Eu(t6, s4);
199
+ void 0 !== i6 && this._$Eh.set(i6, t6);
200
+ }
201
+ this.elementStyles = this.finalizeStyles(this.styles);
202
+ }
203
+ static finalizeStyles(s4) {
204
+ const i6 = [];
205
+ if (Array.isArray(s4)) {
206
+ const e7 = new Set(s4.flat(1 / 0).reverse());
207
+ for (const s5 of e7)
208
+ i6.unshift(c(s5));
209
+ } else
210
+ void 0 !== s4 && i6.push(c(s4));
211
+ return i6;
212
+ }
213
+ static _$Eu(t5, s4) {
214
+ const i6 = s4.attribute;
215
+ return false === i6 ? void 0 : "string" == typeof i6 ? i6 : "string" == typeof t5 ? t5.toLowerCase() : void 0;
216
+ }
217
+ constructor() {
218
+ super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
219
+ }
220
+ _$Ev() {
221
+ this._$ES = new Promise((t5) => this.enableUpdating = t5), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t5) => t5(this));
222
+ }
223
+ addController(t5) {
224
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(t5), void 0 !== this.renderRoot && this.isConnected && t5.hostConnected?.();
225
+ }
226
+ removeController(t5) {
227
+ this._$EO?.delete(t5);
228
+ }
229
+ _$E_() {
230
+ const t5 = /* @__PURE__ */ new Map(), s4 = this.constructor.elementProperties;
231
+ for (const i6 of s4.keys())
232
+ this.hasOwnProperty(i6) && (t5.set(i6, this[i6]), delete this[i6]);
233
+ t5.size > 0 && (this._$Ep = t5);
234
+ }
235
+ createRenderRoot() {
236
+ const t5 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
237
+ return S(t5, this.constructor.elementStyles), t5;
238
+ }
239
+ connectedCallback() {
240
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t5) => t5.hostConnected?.());
241
+ }
242
+ enableUpdating(t5) {
243
+ }
244
+ disconnectedCallback() {
245
+ this._$EO?.forEach((t5) => t5.hostDisconnected?.());
246
+ }
247
+ attributeChangedCallback(t5, s4, i6) {
248
+ this._$AK(t5, i6);
249
+ }
250
+ _$EC(t5, s4) {
251
+ const i6 = this.constructor.elementProperties.get(t5), e7 = this.constructor._$Eu(t5, i6);
252
+ if (void 0 !== e7 && true === i6.reflect) {
253
+ const r7 = (void 0 !== i6.converter?.toAttribute ? i6.converter : u).toAttribute(s4, i6.type);
254
+ this._$Em = t5, null == r7 ? this.removeAttribute(e7) : this.setAttribute(e7, r7), this._$Em = null;
255
+ }
256
+ }
257
+ _$AK(t5, s4) {
258
+ const i6 = this.constructor, e7 = i6._$Eh.get(t5);
259
+ if (void 0 !== e7 && this._$Em !== e7) {
260
+ const t6 = i6.getPropertyOptions(e7), r7 = "function" == typeof t6.converter ? { fromAttribute: t6.converter } : void 0 !== t6.converter?.fromAttribute ? t6.converter : u;
261
+ this._$Em = e7, this[e7] = r7.fromAttribute(s4, t6.type), this._$Em = null;
262
+ }
263
+ }
264
+ requestUpdate(t5, s4, i6) {
265
+ if (void 0 !== t5) {
266
+ if (i6 ??= this.constructor.getPropertyOptions(t5), !(i6.hasChanged ?? f)(this[t5], s4))
267
+ return;
268
+ this.P(t5, s4, i6);
269
+ }
270
+ false === this.isUpdatePending && (this._$ES = this._$ET());
271
+ }
272
+ P(t5, s4, i6) {
273
+ this._$AL.has(t5) || this._$AL.set(t5, s4), true === i6.reflect && this._$Em !== t5 && (this._$Ej ??= /* @__PURE__ */ new Set()).add(t5);
274
+ }
275
+ async _$ET() {
276
+ this.isUpdatePending = true;
277
+ try {
278
+ await this._$ES;
279
+ } catch (t6) {
280
+ Promise.reject(t6);
281
+ }
282
+ const t5 = this.scheduleUpdate();
283
+ return null != t5 && await t5, !this.isUpdatePending;
284
+ }
285
+ scheduleUpdate() {
286
+ return this.performUpdate();
287
+ }
288
+ performUpdate() {
289
+ if (!this.isUpdatePending)
290
+ return;
291
+ if (!this.hasUpdated) {
292
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
293
+ for (const [t7, s5] of this._$Ep)
294
+ this[t7] = s5;
295
+ this._$Ep = void 0;
296
+ }
297
+ const t6 = this.constructor.elementProperties;
298
+ if (t6.size > 0)
299
+ for (const [s5, i6] of t6)
300
+ true !== i6.wrapped || this._$AL.has(s5) || void 0 === this[s5] || this.P(s5, this[s5], i6);
301
+ }
302
+ let t5 = false;
303
+ const s4 = this._$AL;
304
+ try {
305
+ t5 = this.shouldUpdate(s4), t5 ? (this.willUpdate(s4), this._$EO?.forEach((t6) => t6.hostUpdate?.()), this.update(s4)) : this._$EU();
306
+ } catch (s5) {
307
+ throw t5 = false, this._$EU(), s5;
308
+ }
309
+ t5 && this._$AE(s4);
310
+ }
311
+ willUpdate(t5) {
312
+ }
313
+ _$AE(t5) {
314
+ this._$EO?.forEach((t6) => t6.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t5)), this.updated(t5);
315
+ }
316
+ _$EU() {
317
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
318
+ }
319
+ get updateComplete() {
320
+ return this.getUpdateComplete();
321
+ }
322
+ getUpdateComplete() {
323
+ return this._$ES;
324
+ }
325
+ shouldUpdate(t5) {
326
+ return true;
327
+ }
328
+ update(t5) {
329
+ this._$Ej &&= this._$Ej.forEach((t6) => this._$EC(t6, this[t6])), this._$EU();
330
+ }
331
+ updated(t5) {
332
+ }
333
+ firstUpdated(t5) {
334
+ }
335
+ };
336
+ b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[d("elementProperties")] = /* @__PURE__ */ new Map(), b[d("finalized")] = /* @__PURE__ */ new Map(), p?.({ ReactiveElement: b }), (a.reactiveElementVersions ??= []).push("2.0.4");
337
+
338
+ // node_modules/@lit/reactive-element/decorators/property.js
339
+ var o3 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
340
+ var r3 = (t5 = o3, e7, r7) => {
341
+ const { kind: n6, metadata: i6 } = r7;
342
+ let s4 = globalThis.litPropertyMetadata.get(i6);
343
+ if (void 0 === s4 && globalThis.litPropertyMetadata.set(i6, s4 = /* @__PURE__ */ new Map()), s4.set(r7.name, t5), "accessor" === n6) {
344
+ const { name: o6 } = r7;
345
+ return { set(r8) {
346
+ const n7 = e7.get.call(this);
347
+ e7.set.call(this, r8), this.requestUpdate(o6, n7, t5);
348
+ }, init(e8) {
349
+ return void 0 !== e8 && this.P(o6, void 0, t5), e8;
350
+ } };
351
+ }
352
+ if ("setter" === n6) {
353
+ const { name: o6 } = r7;
354
+ return function(r8) {
355
+ const n7 = this[o6];
356
+ e7.call(this, r8), this.requestUpdate(o6, n7, t5);
357
+ };
358
+ }
359
+ throw Error("Unsupported decorator location: " + n6);
360
+ };
361
+ function n3(t5) {
362
+ return (e7, o6) => "object" == typeof o6 ? r3(t5, e7, o6) : ((t6, e8, o7) => {
363
+ const r7 = e8.hasOwnProperty(o7);
364
+ return e8.constructor.createProperty(o7, r7 ? { ...t6, wrapped: true } : t6), r7 ? Object.getOwnPropertyDescriptor(e8, o7) : void 0;
365
+ })(t5, e7, o6);
366
+ }
367
+
368
+ // node_modules/@lit/reactive-element/decorators/state.js
369
+ function r4(r7) {
370
+ return n3({ ...r7, state: true, attribute: false });
371
+ }
372
+
373
+ // node_modules/@lit/reactive-element/decorators/base.js
374
+ var e3 = (e7, t5, c4) => (c4.configurable = true, c4.enumerable = true, Reflect.decorate && "object" != typeof t5 && Object.defineProperty(e7, t5, c4), c4);
375
+
376
+ // node_modules/@lit/reactive-element/decorators/query.js
377
+ function e4(e7, r7) {
378
+ return (n6, s4, i6) => {
379
+ const o6 = (t5) => t5.renderRoot?.querySelector(e7) ?? null;
380
+ if (r7) {
381
+ const { get: e8, set: r8 } = "object" == typeof s4 ? n6 : i6 ?? (() => {
382
+ const t5 = Symbol();
383
+ return { get() {
384
+ return this[t5];
385
+ }, set(e9) {
386
+ this[t5] = e9;
387
+ } };
388
+ })();
389
+ return e3(n6, s4, { get() {
390
+ let t5 = e8.call(this);
391
+ return void 0 === t5 && (t5 = o6(this), (null !== t5 || this.hasUpdated) && r8.call(this, t5)), t5;
392
+ } });
393
+ }
394
+ return e3(n6, s4, { get() {
395
+ return o6(this);
396
+ } });
397
+ };
398
+ }
399
+
400
+ // libs/embed-libs/shared-embed/src/lib/helpers/error.ts
401
+ var _handleError = (errorMessage, parameters) => {
402
+ let message = "The dashboard component encountered an error";
403
+ if (typeof parameters?.dashboardId === "string") {
404
+ message += ` for dashboard with id ${parameters.dashboardId}`;
405
+ }
406
+ if (typeof parameters?.dashboardSlug === "string") {
407
+ message += ` for dashboard with slug ${parameters.dashboardSlug}`;
408
+ }
409
+ if (typeof parameters?.container === "string") {
410
+ message += ` in container ${parameters.container}`;
411
+ }
412
+ if (errorMessage) {
413
+ message += `:
414
+ ${errorMessage}`;
415
+ console.error(message);
416
+ }
417
+ };
418
+
419
+ // libs/embed-libs/shared-embed/src/lib/helpers/browser-check.ts
420
+ var _browserCheck = (dashboardComponent) => {
421
+ let hasError = false;
422
+ let errorMessage = "";
423
+ const document_ = document.body || document.documentElement;
424
+ const style = document_.style;
425
+ const browserCheck = {
426
+ svg: !!("createElementNS" in document && document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect),
427
+ flexbox: style.webkitFlexWrap === "" || style.flexWrap === "",
428
+ postMessage: !!window.postMessage
429
+ };
430
+ const browserCheckKeys = ["svg", "flexbox", "postMessage"];
431
+ for (const key of browserCheckKeys) {
432
+ if (!browserCheck[key]) {
433
+ hasError = true;
434
+ dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
435
+ dashboardComponent.browserNotSupported.push(key);
436
+ errorMessage += `Your browser does not support: ${key}
437
+ `;
438
+ }
439
+ }
440
+ const ua = window.navigator.userAgent;
441
+ const msie = ua.includes("MSIE");
442
+ const trident = ua.includes("Trident/");
443
+ if (msie || trident) {
444
+ hasError = true;
445
+ errorMessage = "IE is not supported.";
446
+ }
447
+ if (hasError) {
448
+ _handleError(errorMessage);
449
+ }
450
+ };
451
+
452
+ // libs/embed-libs/shared-embed/src/lib/helpers/default-parameters.ts
453
+ var DEFAULT_PARAMETERS = {
454
+ appServer: "https://app.luzmo.com/",
455
+ apiHost: "https://api.luzmo.com/",
456
+ dashboardId: null,
457
+ dashboardSlug: null,
458
+ container: null,
459
+ key: null,
460
+ token: null,
461
+ language: "auto",
462
+ qeVersion: null,
463
+ editMode: null,
464
+ screenMode: null,
465
+ switchScreenModeOnResize: true,
466
+ itemId: null,
467
+ mainColor: "",
468
+ accentColor: "",
469
+ itemDimensions: {
470
+ width: "auto",
471
+ height: "auto"
472
+ },
473
+ loaderBackground: "#f9f9f9",
474
+ loaderFontColor: "#5a5a5a",
475
+ loaderSpinnerColor: "rgba(255, 165, 0, 0.7)",
476
+ loaderSpinnerBackground: "rgba(169, 169, 169, 0.14)",
477
+ timezoneId: null,
478
+ contextId: null
479
+ };
480
+
481
+ // libs/embed-libs/shared-embed/src/lib/helpers/extents.ts
482
+ var EXTENTS = [
483
+ { mode: "mobile", width: [150, 767] },
484
+ { mode: "tablet", width: [768, 1199] },
485
+ { mode: "desktop", width: [1200, 1599] },
486
+ { mode: "largeScreen", width: [1600, 9999] },
487
+ { mode: "fixed", width: [] }
488
+ ];
489
+
490
+ // libs/embed-libs/shared-embed/src/lib/helpers/translations.ts
491
+ var TRANSLATIONS = {
492
+ initializing: { en: "Initializing...", nl: "Laden...", fr: "Chargement..." },
493
+ errorDashboard: {
494
+ en: "Oops, we could not load this dashboard!",
495
+ nl: "Oeps, we konden het dashboard niet laden.",
496
+ fr: "Le chargement a echou\xE9."
497
+ },
498
+ errorItem: {
499
+ en: "Oops, we could not load this item!",
500
+ nl: "Oeps, we konden de grafiek niet laden.",
501
+ fr: "Le chargement a echou\xE9."
502
+ }
503
+ };
504
+ var translations_default = TRANSLATIONS;
505
+
506
+ // libs/embed-libs/shared-embed/src/lib/helpers/utils.ts
507
+ var addTrailingSlash = (serverUrl) => {
508
+ if (!serverUrl) {
509
+ return "";
510
+ }
511
+ return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
512
+ };
513
+ var removeTrailingSlash = (serverUrl) => {
514
+ if (!serverUrl) {
515
+ return "";
516
+ }
517
+ return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
518
+ };
519
+ var formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
520
+ const combineRights = (securable, user2) => {
521
+ const matchingUser = securable.users.find((u3) => u3.id === user2.id);
522
+ const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
523
+ flagRead: matchingUser.userAccessRight.flagRead,
524
+ flagUse: matchingUser.userAccessRight.flagUse,
525
+ flagModify: matchingUser.userAccessRight.flagModify,
526
+ flagOwn: matchingUser.userAccessRight.flagOwn
527
+ } : {
528
+ flagRead: false,
529
+ flagUse: false,
530
+ flagModify: false,
531
+ flagOwn: false
532
+ };
533
+ const groups = securable.groups.filter(
534
+ (group) => user2.userGroups.includes(group.id) || group.public === true
535
+ );
536
+ const groupsAccess = groups.map((group) => {
537
+ if (group.groupAccessRight) {
538
+ return group.groupAccessRight;
539
+ }
540
+ });
541
+ for (const groupAccess of groupsAccess) {
542
+ if (!securableAccessRights.flagRead && groupAccess.flagRead) {
543
+ securableAccessRights.flagRead = groupAccess.flagRead;
544
+ }
545
+ if (!securableAccessRights.flagUse && groupAccess.flagUse) {
546
+ securableAccessRights.flagUse = groupAccess.flagUse;
547
+ }
548
+ if (!securableAccessRights.flagModify && groupAccess.flagModify) {
549
+ securableAccessRights.flagModify = groupAccess.flagModify;
550
+ }
551
+ if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
552
+ securableAccessRights.flagOwn = groupAccess.flagOwn;
553
+ }
554
+ }
555
+ const integrationsAccess = securable.integrations?.length > 0 ? securable.integrations.map((integration) => {
556
+ if (integration.integrationAccessRight) {
557
+ return integration.integrationAccessRight;
558
+ }
559
+ }) : [];
560
+ for (const integrationAccess of integrationsAccess) {
561
+ if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
562
+ securableAccessRights.flagRead = integrationAccess.flagRead;
563
+ }
564
+ if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
565
+ securableAccessRights.flagUse = integrationAccess.flagUse;
566
+ }
567
+ if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
568
+ securableAccessRights.flagModify = integrationAccess.flagModify;
569
+ }
570
+ }
571
+ return securableAccessRights;
572
+ };
573
+ const localize = (item, locale) => {
574
+ if (item === null || item === void 0) {
575
+ return "";
576
+ }
577
+ if (typeof item !== "object" || Object.keys(item).length === 0) {
578
+ if (typeof item === "object" && Object.keys(item).length === 0) {
579
+ return "";
580
+ }
581
+ return item;
582
+ }
583
+ let localizedItem;
584
+ localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
585
+ if (localizedItem === void 0 || localizedItem === null) {
586
+ localizedItem = "";
587
+ }
588
+ return localizedItem;
589
+ };
590
+ const treatedDashboards = [];
591
+ for (const dashboard of dashboards) {
592
+ const treatedDashboard = {
593
+ accessibleBy: [],
594
+ accessRights: combineRights(dashboard, user),
595
+ id: dashboard.id,
596
+ modifiedAt: dashboard.modified_at,
597
+ name: localize(dashboard.name, dashboardComponent.language),
598
+ slug: null,
599
+ tags: dashboard.tags.map((t5) => t5.tag).sort((t1, t22) => t1.localeCompare(t22))
600
+ };
601
+ const currentIntegration = dashboard.integrations.find(
602
+ (i6) => i6.id === integrationId
603
+ );
604
+ if (currentIntegration?.integrationAccessRight?.slug) {
605
+ treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
606
+ }
607
+ const users = dashboard.users.map((u3) => ({
608
+ model: "User",
609
+ id: u3.id,
610
+ name: localize(u3.name, user.locale_id)
611
+ }));
612
+ const groups = dashboard.groups.map((g2) => ({
613
+ model: "Group",
614
+ id: g2.id,
615
+ name: localize(g2.name, user.locale_id) || {}
616
+ }));
617
+ const integrations = dashboard.integrations.map((i6) => ({
618
+ model: "Integration",
619
+ id: i6.id,
620
+ name: localize(i6.name, user.locale_id) || {}
621
+ }));
622
+ treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
623
+ treatedDashboards.push(treatedDashboard);
624
+ }
625
+ return treatedDashboards;
626
+ };
627
+ var VERSION = "0.0.0-shared-luzmo";
628
+ var sanitizeUrl = (url) => {
629
+ const invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
630
+ const ctrlCharactersRegex = /[^\u0020-\u007E]/gim;
631
+ const urlSchemeRegex = /^([^:]+):/gm;
632
+ const relativeFirstCharacters = /* @__PURE__ */ new Set([".", "/"]);
633
+ const isRelativeUrlWithoutProtocol = (relativeUrl) => relativeFirstCharacters.has(relativeUrl[0]);
634
+ if (!url) {
635
+ return "about:blank";
636
+ }
637
+ const sanitizedUrl = url.replaceAll(ctrlCharactersRegex, "").trim();
638
+ if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
639
+ return sanitizedUrl;
640
+ }
641
+ const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
642
+ if (!urlSchemeParseResults) {
643
+ return sanitizedUrl;
644
+ }
645
+ const urlScheme = urlSchemeParseResults[0];
646
+ if (invalidPrototcolRegex.test(urlScheme)) {
647
+ return "about:blank";
648
+ }
649
+ return sanitizedUrl;
650
+ };
651
+ var cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
652
+ var isObject = (o6) => o6 && typeof o6 === "object";
653
+ var defaultsDeep = (target, defaults) => {
654
+ Object.entries(defaults).forEach(([k2, v2]) => {
655
+ if (k2 in target) {
656
+ if (target[k2] === void 0) {
657
+ target[k2] = v2;
658
+ } else {
659
+ target[k2] = isObject(v2) ? defaultsDeep(
660
+ target[k2],
661
+ v2
662
+ ) : target[k2];
663
+ }
664
+ } else {
665
+ target[k2] = v2;
666
+ }
667
+ });
668
+ return target;
669
+ };
670
+ var uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c4) {
671
+ const r7 = Math.random() * 16 | 0;
672
+ const v2 = c4 == "x" ? r7 : r7 & 3 | 8;
673
+ return v2.toString(16);
674
+ });
675
+
676
+ // libs/embed-libs/shared-embed/src/lib/helpers/iframe-url.ts
677
+ var createIframeUrl = (dashboardContent) => {
678
+ const searchString = [];
679
+ const {
680
+ appServer,
681
+ language,
682
+ qeVersion,
683
+ loaderBackground,
684
+ loaderSpinnerColor,
685
+ loaderSpinnerBackground,
686
+ loaderFontColor,
687
+ screenMode,
688
+ key,
689
+ token,
690
+ timezoneId,
691
+ itemEmbedding,
692
+ itemDimensions,
693
+ dashboardId,
694
+ dashboardSlug,
695
+ itemId,
696
+ mainColor,
697
+ accentColor,
698
+ editMode
699
+ } = dashboardContent.params;
700
+ if (language && language !== "auto") {
701
+ searchString.push("language=" + language);
702
+ }
703
+ if (qeVersion) {
704
+ searchString.push(`qe_version=${qeVersion}`);
705
+ }
706
+ if (loaderBackground) {
707
+ searchString.push(`ldrbg=${loaderBackground}`);
708
+ }
709
+ if (loaderFontColor) {
710
+ searchString.push(`ldrftclr=${loaderFontColor}`);
711
+ }
712
+ if (loaderSpinnerColor) {
713
+ searchString.push(`ldrspclr=${loaderSpinnerColor}`);
714
+ }
715
+ if (loaderSpinnerBackground) {
716
+ searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
717
+ }
718
+ if (mainColor) {
719
+ searchString.push(`mainColor=${mainColor}`);
720
+ }
721
+ if (accentColor) {
722
+ searchString.push(`accentColor=${accentColor}`);
723
+ }
724
+ if (screenMode && screenMode !== "auto") {
725
+ searchString.push("screenMode=" + screenMode);
726
+ }
727
+ if (timezoneId) {
728
+ searchString.push("timezoneId=" + timezoneId);
729
+ }
730
+ if (itemEmbedding && itemDimensions && itemDimensions.width) {
731
+ searchString.push("width=" + itemDimensions.width);
732
+ }
733
+ if (itemEmbedding && itemDimensions && itemDimensions.height) {
734
+ searchString.push("height=" + itemDimensions.height);
735
+ }
736
+ if (editMode) {
737
+ searchString.push("editMode=" + editMode);
738
+ }
739
+ const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
740
+ searchString.push("version=" + (dashboardContent.VERSION || VERSION));
741
+ const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
742
+ searchString.join("&")
743
+ )}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
744
+ searchString.join("&")
745
+ )}${keyTokenUrlAnchor}`;
746
+ return sanitizeUrl(iframeUrl);
747
+ };
748
+
749
+ // libs/embed-libs/shared-embed/src/lib/helpers/get-loader.ts
750
+ var getLoader = (dashboardComponent) => {
751
+ let errorMsg;
752
+ if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
753
+ dashboardComponent.params.error = true;
754
+ if (dashboardComponent.browserNotSupported) {
755
+ errorMsg = "Browser is not supported.";
756
+ }
757
+ }
758
+ const loadingMsg = translations_default.initializing[dashboardComponent.params.language] || translations_default.initializing.en;
759
+ return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
760
+ };
761
+
762
+ // libs/embed-libs/shared-embed/src/lib/helpers/promise-dispatch.ts
763
+ function resolvePromise(dashboardComponent, requestId, data) {
764
+ if (dashboardComponent.promises[requestId]) {
765
+ dashboardComponent.promises[requestId].resolve(data);
766
+ delete dashboardComponent.promises[requestId];
767
+ }
768
+ }
769
+ function rejectPromise(dashboardComponent, requestId, data) {
770
+ if (dashboardComponent.promises[requestId]) {
771
+ dashboardComponent.promises[requestId].reject(data);
772
+ delete dashboardComponent.promises[requestId];
773
+ }
774
+ }
775
+
776
+ // libs/embed-libs/shared-embed/src/lib/helpers/styles.ts
777
+ function containerStyles(dashboardComponent) {
778
+ const styles = {};
779
+ if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
780
+ styles.background = dashboardComponent.params.loaderBackground;
781
+ }
782
+ return styles;
783
+ }
784
+ function containerLoaderStyles(dashboardComponent) {
785
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
786
+ const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
787
+ const display = dashboardComponent.iframeLoaded ? "none" : "";
788
+ return {
789
+ display,
790
+ height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
791
+ };
792
+ }
793
+ function loaderStyles(dashboardComponent) {
794
+ const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
795
+ if (dashboardComponent.params.itemEmbedding) {
796
+ dashboardComponent.loaderSize = 24;
797
+ dashboardComponent.borderWidth = 4;
798
+ dashboardComponent.minHeight = 200;
799
+ const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
800
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
801
+ const chartWidthDefined = width !== "auto";
802
+ const chartHeightDefined = height !== "auto";
803
+ return {
804
+ background,
805
+ width: chartWidthDefined ? `${width}px` : "100%",
806
+ height: `${chartHeightDefined ? height : "200"}px`,
807
+ "min-height": chartHeightDefined ? "" : "200px"
808
+ };
809
+ }
810
+ return {
811
+ background
812
+ };
813
+ }
814
+ function plStyles(dashboardComponent) {
815
+ const {
816
+ loaderSpinnerColor: defaultSpinnerColor,
817
+ loaderSpinnerBackground: defaultSpinnerBackground
818
+ } = DEFAULT_PARAMETERS;
819
+ const spinnerColorBorder = generateBorderStyle(
820
+ dashboardComponent.borderWidth,
821
+ dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
822
+ );
823
+ const spinnerBackgroundBorder = generateBorderStyle(
824
+ dashboardComponent.borderWidth,
825
+ dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
826
+ );
827
+ const size = `${dashboardComponent.loaderSize}px`;
828
+ return {
829
+ "border-top": spinnerColorBorder,
830
+ "border-right": spinnerColorBorder,
831
+ "border-bottom": spinnerBackgroundBorder,
832
+ "border-left": spinnerBackgroundBorder,
833
+ width: size,
834
+ height: size
835
+ };
836
+ }
837
+ function lcStyles(dashboardComponent) {
838
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
839
+ const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
840
+ const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
841
+ const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
842
+ return {
843
+ padding: `${verticalPadding} 16px`
844
+ };
845
+ }
846
+ function calculateIframeStyles(dashboardComponent) {
847
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
848
+ const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
849
+ if (dashboardComponent.params.itemEmbedding && height !== "auto") {
850
+ dashboardComponent.iframeHeight = `${height}px`;
851
+ } else if (dashboardComponent.params.itemEmbedding) {
852
+ dashboardComponent.iframeHeight = "200px";
853
+ } else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
854
+ dashboardComponent.iframeHeight = "100%";
855
+ } else {
856
+ dashboardComponent.iframeHeight = "400px";
857
+ }
858
+ dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
859
+ const styles = {
860
+ height: dashboardComponent.iframeHeight,
861
+ width: dashboardComponent.iframeWidth
862
+ };
863
+ if (dashboardComponent.iframeLoaded) {
864
+ styles.opacity = 1;
865
+ } else if (dashboardComponent.error) {
866
+ styles.opacity = 1;
867
+ styles.width = "100%";
868
+ styles.height = "400px";
869
+ } else {
870
+ styles.opacity = 0;
871
+ }
872
+ return styles;
873
+ }
874
+ function generateBorderStyle(borderWidth, color) {
875
+ return `${borderWidth}px solid ${color}`;
876
+ }
877
+
878
+ // libs/embed-libs/shared-embed/src/lib/helpers/update-iframe-url.ts
879
+ var updateIframeUrl = (iframe, iframeUrl) => {
880
+ if (iframe?.contentWindow) {
881
+ iframe.contentWindow.location.replace(iframeUrl);
882
+ }
883
+ };
884
+
885
+ // libs/embed-libs/shared-embed/src/lib/methods/export-dashboard.ts
886
+ var exportDashboard = (dashboardComponent, iframe, format) => {
887
+ const requestId = uuidv4();
888
+ if (iframe?.contentWindow) {
889
+ iframe.contentWindow.postMessage(
890
+ {
891
+ action: "exportDashboard",
892
+ format: format || "png",
893
+ _version: dashboardComponent.VERSION,
894
+ requestId
895
+ },
896
+ "*"
897
+ );
898
+ return new Promise((resolve, reject) => {
899
+ dashboardComponent.promises[requestId] = { resolve, reject };
900
+ setTimeout(() => {
901
+ if (dashboardComponent.promises[requestId]) {
902
+ const errorMessage = "exportDashboard request timed out.";
903
+ dashboardComponent.promises[requestId].reject(
904
+ new Error(errorMessage)
905
+ );
906
+ delete dashboardComponent.promises[requestId];
907
+ }
908
+ }, 12e5);
909
+ });
910
+ }
911
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
912
+ };
913
+
914
+ // libs/embed-libs/shared-embed/src/lib/methods/get-accessible-dashboards.ts
915
+ var getAccessibleDashboards = (dashboardComponent, iframe) => {
916
+ if ((dashboardComponent.dashboardId || dashboardComponent.dashboardSlug) && iframe?.contentWindow) {
917
+ const requestId = uuidv4();
918
+ iframe.contentWindow.postMessage(
919
+ {
920
+ action: "getAccessibleDashboards",
921
+ _version: dashboardComponent.VERSION,
922
+ requestId
923
+ },
924
+ "*"
925
+ );
926
+ return new Promise((resolve, reject) => {
927
+ dashboardComponent.promises[requestId] = { resolve, reject };
928
+ setTimeout(() => {
929
+ if (dashboardComponent.promises[requestId]) {
930
+ const errorMessage = "getAccessibleDashboards request timed out.";
931
+ dashboardComponent.promises[requestId].reject(
932
+ new Error(errorMessage)
933
+ );
934
+ delete dashboardComponent.promises[requestId];
935
+ }
936
+ }, 2e3);
937
+ });
938
+ }
939
+ const fetchUser = new Promise((resolve, reject) => {
940
+ void (() => {
941
+ try {
942
+ const responsePromise = window.fetch(
943
+ `${String(dashboardComponent.params.apiHost)}0.1.0/authorization`,
944
+ {
945
+ method: "POST",
946
+ mode: "cors",
947
+ cache: "no-cache",
948
+ headers: { "Content-Type": "application/json" },
949
+ redirect: "follow",
950
+ body: JSON.stringify({
951
+ action: "get",
952
+ version: "0.1.0",
953
+ key: dashboardComponent.authKey,
954
+ token: dashboardComponent.authToken,
955
+ find: {
956
+ where: { id: dashboardComponent.authKey },
957
+ attributes: ["id", "integration_id"],
958
+ include: [
959
+ {
960
+ model: "User",
961
+ attributes: ["id", "name", "locale_id"],
962
+ include: [{ model: "Group" }]
963
+ }
964
+ ]
965
+ }
966
+ })
967
+ }
968
+ );
969
+ responsePromise.then((response) => response.json()).then((data) => {
970
+ if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user || !data.rows[0].integration_id) {
971
+ reject();
972
+ } else {
973
+ data.rows[0].user.userGroups = data.rows[0].user.groups.map(
974
+ (group) => group.id
975
+ );
976
+ delete data.rows[0].user.groups;
977
+ resolve({
978
+ integrationId: data.rows[0].integration_id,
979
+ user: data.rows[0].user
980
+ });
981
+ }
982
+ });
983
+ } catch (error) {
984
+ reject(error);
985
+ }
986
+ })();
987
+ });
988
+ return new Promise((resolve, reject) => void (() => {
989
+ try {
990
+ fetchUser.then((authorizationData) => {
991
+ const responsePromise = window.fetch(
992
+ `${String(dashboardComponent.params.apiHost)}0.1.0/securable`,
993
+ {
994
+ method: "POST",
995
+ mode: "cors",
996
+ cache: "no-cache",
997
+ headers: { "Content-Type": "application/json" },
998
+ redirect: "follow",
999
+ body: JSON.stringify({
1000
+ action: "get",
1001
+ version: "0.1.0",
1002
+ key: dashboardComponent.authKey,
1003
+ token: dashboardComponent.authToken,
1004
+ find: {
1005
+ where: { type: "dashboard", is_variant: false },
1006
+ attributes: ["id", "name", "modified_at"],
1007
+ order: [["modified_at", "desc"]],
1008
+ include: [
1009
+ { model: "Tag", attributes: ["tag"] },
1010
+ { model: "User", attributes: ["id", "name"] },
1011
+ {
1012
+ model: "Group",
1013
+ attributes: ["id", "name", "public"]
1014
+ },
1015
+ { model: "Integration", attributes: ["id", "name"] }
1016
+ ]
1017
+ }
1018
+ })
1019
+ }
1020
+ );
1021
+ responsePromise.then((response) => response.json()).then((data) => {
1022
+ const dashboardList = data.rows.length > 0 ? formatDashboardList(
1023
+ data.rows,
1024
+ authorizationData.integrationId,
1025
+ authorizationData.user,
1026
+ dashboardComponent
1027
+ ) : [];
1028
+ resolve(dashboardList);
1029
+ });
1030
+ }).catch((error) => {
1031
+ reject(error);
1032
+ });
1033
+ } catch (error) {
1034
+ reject(error);
1035
+ }
1036
+ })());
1037
+ };
1038
+
1039
+ // libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
1040
+ var getData = (dashboardComponent, iframe, itemId) => {
1041
+ if (iframe?.contentWindow) {
1042
+ const requestId = uuidv4();
1043
+ iframe.contentWindow.postMessage(
1044
+ {
1045
+ action: "getData",
1046
+ id: itemId,
1047
+ _version: dashboardComponent.VERSION,
1048
+ requestId
1049
+ },
1050
+ "*"
1051
+ );
1052
+ return new Promise((resolve, reject) => {
1053
+ dashboardComponent.promises[requestId] = { resolve, reject };
1054
+ setTimeout(() => {
1055
+ if (dashboardComponent.promises[requestId]) {
1056
+ const errorMessage = "getData request timed out.";
1057
+ dashboardComponent.promises[requestId].reject(
1058
+ new Error(errorMessage)
1059
+ );
1060
+ delete dashboardComponent.promises[requestId];
1061
+ }
1062
+ }, 2e3);
1063
+ });
1064
+ }
1065
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1066
+ };
1067
+
1068
+ // libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
1069
+ var getFilters = (dashboardComponent, iframe) => {
1070
+ if (iframe?.contentWindow) {
1071
+ const requestId = uuidv4();
1072
+ iframe.contentWindow.postMessage(
1073
+ { action: "getFilters", _version: dashboardComponent.VERSION, requestId },
1074
+ "*"
1075
+ );
1076
+ return new Promise((resolve, reject) => {
1077
+ dashboardComponent.promises[requestId] = { resolve, reject };
1078
+ setTimeout(() => {
1079
+ if (dashboardComponent.promises[requestId]) {
1080
+ const errorMessage = "getFilters request timed out.";
1081
+ dashboardComponent.promises[requestId].reject(
1082
+ new Error(errorMessage)
1083
+ );
1084
+ delete dashboardComponent.promises[requestId];
1085
+ }
1086
+ }, 2e3);
1087
+ });
1088
+ }
1089
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1090
+ };
1091
+
1092
+ // libs/embed-libs/shared-embed/src/lib/methods/refresh-data.ts
1093
+ var refreshData = (dashboardComponent, iframe, itemId) => {
1094
+ if (iframe) {
1095
+ iframe.contentWindow.postMessage(
1096
+ {
1097
+ action: "refreshData",
1098
+ id: itemId ?? null,
1099
+ _version: dashboardComponent.VERSION
1100
+ },
1101
+ "*"
1102
+ );
1103
+ return Promise.resolve();
1104
+ }
1105
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1106
+ };
1107
+
1108
+ // libs/embed-libs/shared-embed/src/lib/methods/reload-dashboard.ts
1109
+ var reloadDashboard = (dashboardComponent, iframe) => {
1110
+ if (iframe) {
1111
+ iframe.contentWindow.postMessage(
1112
+ { action: "reloadDashboard", _version: dashboardComponent.VERSION },
1113
+ "*"
1114
+ );
1115
+ return Promise.resolve();
1116
+ }
1117
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1118
+ };
1119
+
1120
+ // libs/embed-libs/shared-embed/src/lib/methods/set-authorization.ts
1121
+ var setAuthorization = (dashboardComponent, iframe, key, token) => {
1122
+ if (iframe) {
1123
+ iframe.contentWindow.postMessage(
1124
+ {
1125
+ action: "setAuthorization",
1126
+ key,
1127
+ token,
1128
+ _version: dashboardComponent.VERSION
1129
+ },
1130
+ "*"
1131
+ );
1132
+ return Promise.resolve();
1133
+ }
1134
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1135
+ };
1136
+
1137
+ // libs/embed-libs/shared-embed/src/lib/methods/set-edit-mode.ts
1138
+ var setEditMode = (dashboardComponent, iframe, editMode) => {
1139
+ if (iframe && iframe.contentWindow) {
1140
+ const requestId = uuidv4();
1141
+ if (dashboardComponent.params.editMode === editMode) {
1142
+ return Promise.reject(
1143
+ new Error("editMode parameter is currently already set to " + editMode)
1144
+ );
1145
+ } else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
1146
+ return Promise.reject(
1147
+ new Error(
1148
+ "The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
1149
+ )
1150
+ );
1151
+ }
1152
+ iframe.contentWindow.postMessage(
1153
+ {
1154
+ action: "setEditMode",
1155
+ editMode,
1156
+ _version: dashboardComponent.VERSION,
1157
+ requestId
1158
+ },
1159
+ "*"
1160
+ );
1161
+ return new Promise((resolve, reject) => {
1162
+ dashboardComponent.promises[requestId] = { resolve, reject };
1163
+ });
1164
+ }
1165
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1166
+ };
1167
+
1168
+ // libs/embed-libs/shared-embed/src/lib/methods/set-filters.ts
1169
+ var setFilters = (dashboardComponent, iframe, itemId, filters) => {
1170
+ if (iframe) {
1171
+ const requestId = uuidv4();
1172
+ iframe.contentWindow.postMessage(
1173
+ {
1174
+ action: "setFilters",
1175
+ itemId,
1176
+ filters,
1177
+ _version: dashboardComponent.VERSION,
1178
+ requestId
1179
+ },
1180
+ "*"
1181
+ );
1182
+ return new Promise((resolve, reject) => {
1183
+ dashboardComponent.promises[requestId] = { resolve, reject };
1184
+ setTimeout(() => {
1185
+ if (dashboardComponent.promises[requestId]) {
1186
+ const errorMessage = "setFilters request timed out.";
1187
+ dashboardComponent.promises[requestId].reject(
1188
+ new Error(errorMessage)
1189
+ );
1190
+ delete dashboardComponent.promises[requestId];
1191
+ }
1192
+ }, 2e3);
1193
+ });
1194
+ }
1195
+ return Promise.reject();
1196
+ };
1197
+
1198
+ // libs/embed-libs/shared-embed/src/lib/methods/set-preview.ts
1199
+ var setPreview = (dashboardComponent, iframe, preview) => {
1200
+ if (iframe) {
1201
+ const requestId = uuidv4();
1202
+ iframe.contentWindow.postMessage(
1203
+ {
1204
+ action: "setPreview",
1205
+ preview,
1206
+ requestId,
1207
+ _version: dashboardComponent.VERSION
1208
+ },
1209
+ "*"
1210
+ );
1211
+ return new Promise((resolve, reject) => {
1212
+ dashboardComponent.promises[requestId] = { resolve, reject };
1213
+ setTimeout(() => {
1214
+ if (dashboardComponent.promises[requestId]) {
1215
+ const errorMessage = "setPreview request timed out.";
1216
+ dashboardComponent.promises[requestId].reject(
1217
+ new Error(errorMessage)
1218
+ );
1219
+ delete dashboardComponent.promises[requestId];
1220
+ }
1221
+ }, 2e3);
1222
+ });
1223
+ }
1224
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1225
+ };
1226
+
1227
+ // libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
1228
+ var _setCalculatedDimensions = (dashboardComponent) => {
1229
+ if (!dashboardComponent.dimensions) {
1230
+ dashboardComponent.params.error = true;
1231
+ _handleError("Got no valid dimensions.", dashboardComponent.params);
1232
+ return;
1233
+ }
1234
+ const dashboardDimensionKeys = Object.keys(
1235
+ dashboardComponent.dimensions
1236
+ );
1237
+ const availableScreenModeExtents = [];
1238
+ let currentMode;
1239
+ let currentWidth = 0;
1240
+ let currentHeight = 0;
1241
+ if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
1242
+ dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
1243
+ }
1244
+ if (dashboardComponent.dimensions && dashboardDimensionKeys?.[0] === "fixed") {
1245
+ currentMode = "fixed";
1246
+ currentWidth = dashboardComponent.dimensions.fixed[0];
1247
+ currentHeight = dashboardComponent.dimensions.fixed[1];
1248
+ } else {
1249
+ const screenModes = [
1250
+ "mobile",
1251
+ "tablet",
1252
+ "desktop",
1253
+ "largeScreen"
1254
+ ];
1255
+ if (dashboardComponent.params.itemEmbedding) {
1256
+ const [firstMatch] = dashboardDimensionKeys;
1257
+ let match = cloneDeep(firstMatch);
1258
+ for (const screenMode of screenModes) {
1259
+ const found = dashboardDimensionKeys.find((key) => key === screenMode);
1260
+ if (found) {
1261
+ match = cloneDeep(found);
1262
+ } else {
1263
+ dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
1264
+ }
1265
+ }
1266
+ }
1267
+ for (const key of dashboardDimensionKeys) {
1268
+ if (screenModes.includes(key)) {
1269
+ const screenMode = EXTENTS.find((extent) => extent.mode === key);
1270
+ availableScreenModeExtents.push({
1271
+ ...screenMode,
1272
+ height: dashboardComponent.dimensions[key][1] || 50
1273
+ });
1274
+ }
1275
+ }
1276
+ if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
1277
+ dashboardComponent.params.screenMode = "auto";
1278
+ }
1279
+ if (dashboardComponent.params.screenMode === "auto") {
1280
+ availableScreenModeExtents.sort(
1281
+ (a3, b3) => screenModes.indexOf(a3.mode) - screenModes.indexOf(b3.mode)
1282
+ );
1283
+ for (const screenModeExtent of availableScreenModeExtents) {
1284
+ const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
1285
+ if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
1286
+ if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
1287
+ currentMode = screenModeExtent.mode;
1288
+ currentWidth = Number.parseInt(
1289
+ dashboardComponent.params.itemDimensions.width,
1290
+ 10
1291
+ );
1292
+ currentHeight = dashboardComponent.dimensions[currentMode][1];
1293
+ }
1294
+ } else {
1295
+ if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
1296
+ currentMode = screenModeExtent.mode;
1297
+ if (dashboardComponent.params.itemEmbedding) {
1298
+ currentWidth = dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto" ? Number.parseInt(
1299
+ dashboardComponent.params.itemDimensions.width,
1300
+ 10
1301
+ ) : Math.min(
1302
+ dashboardComponent.containerWidth,
1303
+ screenModeExtentMaxWidth
1304
+ );
1305
+ currentHeight = dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto" ? Number.parseInt(
1306
+ dashboardComponent.params.itemDimensions.height,
1307
+ 10
1308
+ ) : dashboardComponent.dimensions[currentMode][1];
1309
+ if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
1310
+ currentWidth = Number.parseInt(
1311
+ dashboardComponent.params.itemDimensions.width,
1312
+ 10
1313
+ );
1314
+ currentHeight = dashboardComponent.dimensions[currentMode][1];
1315
+ }
1316
+ } else {
1317
+ currentWidth = Math.max(
1318
+ Math.min(
1319
+ screenModeExtentMaxWidth,
1320
+ dashboardComponent.containerWidth
1321
+ ),
1322
+ screenModeExtentMinWidth
1323
+ );
1324
+ currentHeight = screenModeExtent.height;
1325
+ }
1326
+ }
1327
+ }
1328
+ }
1329
+ } else {
1330
+ const {
1331
+ height: chosenModeHeight,
1332
+ width: [chosenModeMinWidth, chosenModeMaxWidth]
1333
+ } = availableScreenModeExtents.find(
1334
+ (d3) => d3.mode === dashboardComponent.params.screenMode
1335
+ );
1336
+ currentMode = dashboardComponent.params.screenMode;
1337
+ currentWidth = Math.max(
1338
+ Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
1339
+ chosenModeMinWidth
1340
+ );
1341
+ currentHeight = chosenModeHeight;
1342
+ if (dashboardComponent.params.itemEmbedding) {
1343
+ if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
1344
+ currentWidth = Number.parseInt(
1345
+ dashboardComponent.params.itemDimensions.width,
1346
+ 10
1347
+ );
1348
+ }
1349
+ if (dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto") {
1350
+ currentHeight = Number.parseInt(
1351
+ dashboardComponent.params.itemDimensions.height,
1352
+ 10
1353
+ );
1354
+ }
1355
+ }
1356
+ }
1357
+ if (!currentMode && availableScreenModeExtents.length > 0) {
1358
+ const [lowestModeExtent] = availableScreenModeExtents;
1359
+ currentMode = lowestModeExtent.mode;
1360
+ currentWidth = lowestModeExtent.width[0];
1361
+ currentHeight = lowestModeExtent.height;
1362
+ }
1363
+ }
1364
+ dashboardComponent.currentScreenMode = currentMode;
1365
+ const style = {
1366
+ height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
1367
+ width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
1368
+ opacity: 1
1369
+ };
1370
+ const dashboardEditModes = ["editFull", "editLimited"];
1371
+ if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
1372
+ style.height = "100%";
1373
+ style.width = "100%";
1374
+ } else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
1375
+ style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
1376
+ "px",
1377
+ ""
1378
+ )}px`;
1379
+ style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
1380
+ "px",
1381
+ ""
1382
+ )}px`;
1383
+ } else {
1384
+ style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
1385
+ style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
1386
+ }
1387
+ dashboardComponent.currentScreenMode = currentMode;
1388
+ dashboardComponent.iframeStyle = style;
1389
+ };
1390
+
1391
+ // libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
1392
+ var _extendAndValidate = (dashboardContent) => {
1393
+ const defaultKeys = Object.keys(
1394
+ DEFAULT_PARAMETERS
1395
+ );
1396
+ const errorMessages = [];
1397
+ const requiredStringParams = [
1398
+ "appServer",
1399
+ "language",
1400
+ "apiHost"
1401
+ ];
1402
+ const requiredStringOrEmptyParams = [
1403
+ "key",
1404
+ "token",
1405
+ "screenMode",
1406
+ "timezoneId",
1407
+ "itemId",
1408
+ "container",
1409
+ "loaderBackground",
1410
+ "loaderFontColor",
1411
+ "loaderSpinnerColor",
1412
+ "loaderSpinnerBackground"
1413
+ ];
1414
+ const objectParams = ["itemDimensions"];
1415
+ const screenModes = [
1416
+ "mobile",
1417
+ "tablet",
1418
+ "desktop",
1419
+ "largeScreen",
1420
+ "fixed",
1421
+ "auto"
1422
+ ];
1423
+ for (const key of defaultKeys) {
1424
+ if (dashboardContent.params[key] === null) {
1425
+ delete dashboardContent.params[key];
1426
+ }
1427
+ }
1428
+ dashboardContent.params = defaultsDeep(
1429
+ dashboardContent.params,
1430
+ DEFAULT_PARAMETERS
1431
+ );
1432
+ if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
1433
+ delete dashboardContent.params.dashboardId;
1434
+ delete dashboardContent.params.dashboardSlug;
1435
+ }
1436
+ for (const key of requiredStringParams) {
1437
+ if (typeof dashboardContent.params[key] !== "string") {
1438
+ delete dashboardContent.params[key];
1439
+ errorMessages.push(`${key} needs to be of type string.`);
1440
+ }
1441
+ }
1442
+ for (const key of requiredStringOrEmptyParams) {
1443
+ if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
1444
+ delete dashboardContent.params[key];
1445
+ errorMessages.push(`${key} needs to be of type string or empty.`);
1446
+ }
1447
+ }
1448
+ if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
1449
+ const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
1450
+ errorMessages.push(
1451
+ `"screenMode" needs should be one of these types: ${validTypesString}`
1452
+ );
1453
+ dashboardContent.params.screenMode = "auto";
1454
+ }
1455
+ if (dashboardContent.params.itemId) {
1456
+ dashboardContent.params.itemEmbedding = true;
1457
+ }
1458
+ for (const key of objectParams) {
1459
+ if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
1460
+ delete dashboardContent.params[key];
1461
+ errorMessages.push(`${key} needs to be of type object or empty.`);
1462
+ }
1463
+ }
1464
+ if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
1465
+ errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
1466
+ dashboardContent.params.switchScreenModeOnResize = true;
1467
+ }
1468
+ if (dashboardContent.params.itemDimensions) {
1469
+ const itemDimensionsKeys = [
1470
+ "width",
1471
+ "height"
1472
+ ];
1473
+ for (const key of itemDimensionsKeys) {
1474
+ if (!["string", "number"].includes(
1475
+ typeof dashboardContent.params.itemDimensions[key]
1476
+ ) && dashboardContent.params.itemDimensions[key] !== null) {
1477
+ errorMessages.push(
1478
+ `itemDimensions ${key} needs to be of type string, number or empty.`
1479
+ );
1480
+ }
1481
+ }
1482
+ }
1483
+ dashboardContent.params = defaultsDeep(
1484
+ dashboardContent.params,
1485
+ DEFAULT_PARAMETERS
1486
+ );
1487
+ if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
1488
+ dashboardContent.params.switchScreenModeOnResize = false;
1489
+ }
1490
+ if (dashboardContent.params.itemDimensions.width !== "auto") {
1491
+ dashboardContent.params.itemDimensions.width = Number.parseInt(
1492
+ `${dashboardContent.params.itemDimensions.width}`.replace("px", ""),
1493
+ 10
1494
+ ) || "auto";
1495
+ }
1496
+ if (dashboardContent.params.itemDimensions.height !== "auto") {
1497
+ dashboardContent.params.itemDimensions.height = Number.parseInt(
1498
+ `${dashboardContent.params.itemDimensions.height}`.replace("px", ""),
1499
+ 10
1500
+ ) || "auto";
1501
+ }
1502
+ dashboardContent.params.itemEmbedding = !!dashboardContent.params.itemId;
1503
+ if (dashboardContent.params.error || errorMessages.length > 0) {
1504
+ _handleError(errorMessages.join("\n"), dashboardContent.params);
1505
+ }
1506
+ };
1507
+
1508
+ // libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
1509
+ var luzmoEmbedContainerClass = "luzmo-embed-container";
1510
+
1511
+ // libs/embed-libs/shared-embed/src/lib/helpers/remote-federation.ts
1512
+ var remotesMap = {
1513
+ // "remote_app": { url: "http://localhost:4201/remoteEntry.mjs", format: "esm", from: "vite" },
1514
+ };
1515
+ var loadJS = async (url, fn) => {
1516
+ const resolvedUrl = typeof url === "function" ? await url() : url;
1517
+ const script = document.createElement("script");
1518
+ script.type = "text/javascript";
1519
+ script.addEventListener("load", fn);
1520
+ script.src = resolvedUrl;
1521
+ document.querySelectorAll("head")[0].append(script);
1522
+ };
1523
+ var wrapShareModule = (remoteFrom) => ({});
1524
+ async function __federationMethodEnsure(remoteId) {
1525
+ const remote = remotesMap[remoteId];
1526
+ if (remote.inited) {
1527
+ return remote.lib;
1528
+ }
1529
+ if (remote.format === "var") {
1530
+ return new Promise((resolve) => {
1531
+ const callback = () => {
1532
+ if (!remote.inited) {
1533
+ remote.lib = window[remoteId];
1534
+ remote.lib.init(wrapShareModule(remote.from));
1535
+ remote.inited = true;
1536
+ }
1537
+ resolve(remote.lib);
1538
+ };
1539
+ return loadJS(remote.url, callback);
1540
+ });
1541
+ } else if (["esm", "systemjs"].includes(remote.format)) {
1542
+ return new Promise((resolve, reject) => {
1543
+ const getUrl = typeof remote.url === "function" ? remote.url : () => Promise.resolve(remote.url);
1544
+ getUrl().then((url) => {
1545
+ import(
1546
+ /* @vite-ignore */
1547
+ /* webpackIgnore: true */
1548
+ url
1549
+ ).then((lib) => {
1550
+ if (!remote.inited) {
1551
+ const shareScope = wrapShareModule(remote.from);
1552
+ lib.init(shareScope);
1553
+ remote.lib = lib;
1554
+ remote.lib.init(shareScope);
1555
+ remote.inited = true;
1556
+ }
1557
+ resolve(remote.lib);
1558
+ }).catch(reject);
1559
+ });
1560
+ });
1561
+ }
1562
+ }
1563
+ function __federationMethodWrapDefault(module2, need) {
1564
+ if (!(module2 == null ? void 0 : module2.default) && need) {
1565
+ const obj = /* @__PURE__ */ Object.create(null);
1566
+ obj.default = module2;
1567
+ obj.__esModule = true;
1568
+ return obj;
1569
+ }
1570
+ return module2;
1571
+ }
1572
+ async function __federationMethodGetRemote(remoteName, componentName) {
1573
+ return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
1574
+ }
1575
+
1576
+ // node_modules/lit-html/lit-html.js
1577
+ var t3 = globalThis;
1578
+ var i3 = t3.trustedTypes;
1579
+ var s2 = i3 ? i3.createPolicy("lit-html", { createHTML: (t5) => t5 }) : void 0;
1580
+ var e5 = "$lit$";
1581
+ var h2 = `lit$${(Math.random() + "").slice(9)}$`;
1582
+ var o4 = "?" + h2;
1583
+ var n4 = `<${o4}>`;
1584
+ var r5 = document;
1585
+ var l2 = () => r5.createComment("");
1586
+ var c3 = (t5) => null === t5 || "object" != typeof t5 && "function" != typeof t5;
1587
+ var a2 = Array.isArray;
1588
+ var u2 = (t5) => a2(t5) || "function" == typeof t5?.[Symbol.iterator];
1589
+ var d2 = "[ \n\f\r]";
1590
+ var f2 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
1591
+ var v = /-->/g;
1592
+ var _ = />/g;
1593
+ var m = RegExp(`>|${d2}(?:([^\\s"'>=/]+)(${d2}*=${d2}*(?:[^
1594
+ \f\r"'\`<>=]|("|')|))|$)`, "g");
1595
+ var p2 = /'/g;
1596
+ var g = /"/g;
1597
+ var $ = /^(?:script|style|textarea|title)$/i;
1598
+ var y2 = (t5) => (i6, ...s4) => ({ _$litType$: t5, strings: i6, values: s4 });
1599
+ var x = y2(1);
1600
+ var b2 = y2(2);
1601
+ var w = Symbol.for("lit-noChange");
1602
+ var T = Symbol.for("lit-nothing");
1603
+ var A = /* @__PURE__ */ new WeakMap();
1604
+ var E = r5.createTreeWalker(r5, 129);
1605
+ function C(t5, i6) {
1606
+ if (!Array.isArray(t5) || !t5.hasOwnProperty("raw"))
1607
+ throw Error("invalid template strings array");
1608
+ return void 0 !== s2 ? s2.createHTML(i6) : i6;
1609
+ }
1610
+ var P = (t5, i6) => {
1611
+ const s4 = t5.length - 1, o6 = [];
1612
+ let r7, l3 = 2 === i6 ? "<svg>" : "", c4 = f2;
1613
+ for (let i7 = 0; i7 < s4; i7++) {
1614
+ const s5 = t5[i7];
1615
+ let a3, u3, d3 = -1, y3 = 0;
1616
+ for (; y3 < s5.length && (c4.lastIndex = y3, u3 = c4.exec(s5), null !== u3); )
1617
+ y3 = c4.lastIndex, c4 === f2 ? "!--" === u3[1] ? c4 = v : void 0 !== u3[1] ? c4 = _ : void 0 !== u3[2] ? ($.test(u3[2]) && (r7 = RegExp("</" + u3[2], "g")), c4 = m) : void 0 !== u3[3] && (c4 = m) : c4 === m ? ">" === u3[0] ? (c4 = r7 ?? f2, d3 = -1) : void 0 === u3[1] ? d3 = -2 : (d3 = c4.lastIndex - u3[2].length, a3 = u3[1], c4 = void 0 === u3[3] ? m : '"' === u3[3] ? g : p2) : c4 === g || c4 === p2 ? c4 = m : c4 === v || c4 === _ ? c4 = f2 : (c4 = m, r7 = void 0);
1618
+ const x2 = c4 === m && t5[i7 + 1].startsWith("/>") ? " " : "";
1619
+ l3 += c4 === f2 ? s5 + n4 : d3 >= 0 ? (o6.push(a3), s5.slice(0, d3) + e5 + s5.slice(d3) + h2 + x2) : s5 + h2 + (-2 === d3 ? i7 : x2);
1620
+ }
1621
+ return [C(t5, l3 + (t5[s4] || "<?>") + (2 === i6 ? "</svg>" : "")), o6];
1622
+ };
1623
+ var V = class _V {
1624
+ constructor({ strings: t5, _$litType$: s4 }, n6) {
1625
+ let r7;
1626
+ this.parts = [];
1627
+ let c4 = 0, a3 = 0;
1628
+ const u3 = t5.length - 1, d3 = this.parts, [f3, v2] = P(t5, s4);
1629
+ if (this.el = _V.createElement(f3, n6), E.currentNode = this.el.content, 2 === s4) {
1630
+ const t6 = this.el.content.firstChild;
1631
+ t6.replaceWith(...t6.childNodes);
1632
+ }
1633
+ for (; null !== (r7 = E.nextNode()) && d3.length < u3; ) {
1634
+ if (1 === r7.nodeType) {
1635
+ if (r7.hasAttributes())
1636
+ for (const t6 of r7.getAttributeNames())
1637
+ if (t6.endsWith(e5)) {
1638
+ const i6 = v2[a3++], s5 = r7.getAttribute(t6).split(h2), e7 = /([.?@])?(.*)/.exec(i6);
1639
+ d3.push({ type: 1, index: c4, name: e7[2], strings: s5, ctor: "." === e7[1] ? k : "?" === e7[1] ? H : "@" === e7[1] ? I : R }), r7.removeAttribute(t6);
1640
+ } else
1641
+ t6.startsWith(h2) && (d3.push({ type: 6, index: c4 }), r7.removeAttribute(t6));
1642
+ if ($.test(r7.tagName)) {
1643
+ const t6 = r7.textContent.split(h2), s5 = t6.length - 1;
1644
+ if (s5 > 0) {
1645
+ r7.textContent = i3 ? i3.emptyScript : "";
1646
+ for (let i6 = 0; i6 < s5; i6++)
1647
+ r7.append(t6[i6], l2()), E.nextNode(), d3.push({ type: 2, index: ++c4 });
1648
+ r7.append(t6[s5], l2());
1649
+ }
1650
+ }
1651
+ } else if (8 === r7.nodeType)
1652
+ if (r7.data === o4)
1653
+ d3.push({ type: 2, index: c4 });
1654
+ else {
1655
+ let t6 = -1;
1656
+ for (; -1 !== (t6 = r7.data.indexOf(h2, t6 + 1)); )
1657
+ d3.push({ type: 7, index: c4 }), t6 += h2.length - 1;
1658
+ }
1659
+ c4++;
1660
+ }
1661
+ }
1662
+ static createElement(t5, i6) {
1663
+ const s4 = r5.createElement("template");
1664
+ return s4.innerHTML = t5, s4;
1665
+ }
1666
+ };
1667
+ function N(t5, i6, s4 = t5, e7) {
1668
+ if (i6 === w)
1669
+ return i6;
1670
+ let h3 = void 0 !== e7 ? s4._$Co?.[e7] : s4._$Cl;
1671
+ const o6 = c3(i6) ? void 0 : i6._$litDirective$;
1672
+ return h3?.constructor !== o6 && (h3?._$AO?.(false), void 0 === o6 ? h3 = void 0 : (h3 = new o6(t5), h3._$AT(t5, s4, e7)), void 0 !== e7 ? (s4._$Co ??= [])[e7] = h3 : s4._$Cl = h3), void 0 !== h3 && (i6 = N(t5, h3._$AS(t5, i6.values), h3, e7)), i6;
1673
+ }
1674
+ var S2 = class {
1675
+ constructor(t5, i6) {
1676
+ this._$AV = [], this._$AN = void 0, this._$AD = t5, this._$AM = i6;
1677
+ }
1678
+ get parentNode() {
1679
+ return this._$AM.parentNode;
1680
+ }
1681
+ get _$AU() {
1682
+ return this._$AM._$AU;
1683
+ }
1684
+ u(t5) {
1685
+ const { el: { content: i6 }, parts: s4 } = this._$AD, e7 = (t5?.creationScope ?? r5).importNode(i6, true);
1686
+ E.currentNode = e7;
1687
+ let h3 = E.nextNode(), o6 = 0, n6 = 0, l3 = s4[0];
1688
+ for (; void 0 !== l3; ) {
1689
+ if (o6 === l3.index) {
1690
+ let i7;
1691
+ 2 === l3.type ? i7 = new M(h3, h3.nextSibling, this, t5) : 1 === l3.type ? i7 = new l3.ctor(h3, l3.name, l3.strings, this, t5) : 6 === l3.type && (i7 = new L(h3, this, t5)), this._$AV.push(i7), l3 = s4[++n6];
1692
+ }
1693
+ o6 !== l3?.index && (h3 = E.nextNode(), o6++);
1694
+ }
1695
+ return E.currentNode = r5, e7;
1696
+ }
1697
+ p(t5) {
1698
+ let i6 = 0;
1699
+ for (const s4 of this._$AV)
1700
+ void 0 !== s4 && (void 0 !== s4.strings ? (s4._$AI(t5, s4, i6), i6 += s4.strings.length - 2) : s4._$AI(t5[i6])), i6++;
1701
+ }
1702
+ };
1703
+ var M = class _M {
1704
+ get _$AU() {
1705
+ return this._$AM?._$AU ?? this._$Cv;
1706
+ }
1707
+ constructor(t5, i6, s4, e7) {
1708
+ this.type = 2, this._$AH = T, this._$AN = void 0, this._$AA = t5, this._$AB = i6, this._$AM = s4, this.options = e7, this._$Cv = e7?.isConnected ?? true;
1709
+ }
1710
+ get parentNode() {
1711
+ let t5 = this._$AA.parentNode;
1712
+ const i6 = this._$AM;
1713
+ return void 0 !== i6 && 11 === t5?.nodeType && (t5 = i6.parentNode), t5;
1714
+ }
1715
+ get startNode() {
1716
+ return this._$AA;
1717
+ }
1718
+ get endNode() {
1719
+ return this._$AB;
1720
+ }
1721
+ _$AI(t5, i6 = this) {
1722
+ t5 = N(this, t5, i6), c3(t5) ? t5 === T || null == t5 || "" === t5 ? (this._$AH !== T && this._$AR(), this._$AH = T) : t5 !== this._$AH && t5 !== w && this._(t5) : void 0 !== t5._$litType$ ? this.$(t5) : void 0 !== t5.nodeType ? this.T(t5) : u2(t5) ? this.k(t5) : this._(t5);
1723
+ }
1724
+ S(t5) {
1725
+ return this._$AA.parentNode.insertBefore(t5, this._$AB);
1726
+ }
1727
+ T(t5) {
1728
+ this._$AH !== t5 && (this._$AR(), this._$AH = this.S(t5));
1729
+ }
1730
+ _(t5) {
1731
+ this._$AH !== T && c3(this._$AH) ? this._$AA.nextSibling.data = t5 : this.T(r5.createTextNode(t5)), this._$AH = t5;
1732
+ }
1733
+ $(t5) {
1734
+ const { values: i6, _$litType$: s4 } = t5, e7 = "number" == typeof s4 ? this._$AC(t5) : (void 0 === s4.el && (s4.el = V.createElement(C(s4.h, s4.h[0]), this.options)), s4);
1735
+ if (this._$AH?._$AD === e7)
1736
+ this._$AH.p(i6);
1737
+ else {
1738
+ const t6 = new S2(e7, this), s5 = t6.u(this.options);
1739
+ t6.p(i6), this.T(s5), this._$AH = t6;
1740
+ }
1741
+ }
1742
+ _$AC(t5) {
1743
+ let i6 = A.get(t5.strings);
1744
+ return void 0 === i6 && A.set(t5.strings, i6 = new V(t5)), i6;
1745
+ }
1746
+ k(t5) {
1747
+ a2(this._$AH) || (this._$AH = [], this._$AR());
1748
+ const i6 = this._$AH;
1749
+ let s4, e7 = 0;
1750
+ for (const h3 of t5)
1751
+ e7 === i6.length ? i6.push(s4 = new _M(this.S(l2()), this.S(l2()), this, this.options)) : s4 = i6[e7], s4._$AI(h3), e7++;
1752
+ e7 < i6.length && (this._$AR(s4 && s4._$AB.nextSibling, e7), i6.length = e7);
1753
+ }
1754
+ _$AR(t5 = this._$AA.nextSibling, i6) {
1755
+ for (this._$AP?.(false, true, i6); t5 && t5 !== this._$AB; ) {
1756
+ const i7 = t5.nextSibling;
1757
+ t5.remove(), t5 = i7;
1758
+ }
1759
+ }
1760
+ setConnected(t5) {
1761
+ void 0 === this._$AM && (this._$Cv = t5, this._$AP?.(t5));
1762
+ }
1763
+ };
1764
+ var R = class {
1765
+ get tagName() {
1766
+ return this.element.tagName;
1767
+ }
1768
+ get _$AU() {
1769
+ return this._$AM._$AU;
1770
+ }
1771
+ constructor(t5, i6, s4, e7, h3) {
1772
+ this.type = 1, this._$AH = T, this._$AN = void 0, this.element = t5, this.name = i6, this._$AM = e7, this.options = h3, s4.length > 2 || "" !== s4[0] || "" !== s4[1] ? (this._$AH = Array(s4.length - 1).fill(new String()), this.strings = s4) : this._$AH = T;
1773
+ }
1774
+ _$AI(t5, i6 = this, s4, e7) {
1775
+ const h3 = this.strings;
1776
+ let o6 = false;
1777
+ if (void 0 === h3)
1778
+ t5 = N(this, t5, i6, 0), o6 = !c3(t5) || t5 !== this._$AH && t5 !== w, o6 && (this._$AH = t5);
1779
+ else {
1780
+ const e8 = t5;
1781
+ let n6, r7;
1782
+ for (t5 = h3[0], n6 = 0; n6 < h3.length - 1; n6++)
1783
+ r7 = N(this, e8[s4 + n6], i6, n6), r7 === w && (r7 = this._$AH[n6]), o6 ||= !c3(r7) || r7 !== this._$AH[n6], r7 === T ? t5 = T : t5 !== T && (t5 += (r7 ?? "") + h3[n6 + 1]), this._$AH[n6] = r7;
1784
+ }
1785
+ o6 && !e7 && this.j(t5);
1786
+ }
1787
+ j(t5) {
1788
+ t5 === T ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t5 ?? "");
1789
+ }
1790
+ };
1791
+ var k = class extends R {
1792
+ constructor() {
1793
+ super(...arguments), this.type = 3;
1794
+ }
1795
+ j(t5) {
1796
+ this.element[this.name] = t5 === T ? void 0 : t5;
1797
+ }
1798
+ };
1799
+ var H = class extends R {
1800
+ constructor() {
1801
+ super(...arguments), this.type = 4;
1802
+ }
1803
+ j(t5) {
1804
+ this.element.toggleAttribute(this.name, !!t5 && t5 !== T);
1805
+ }
1806
+ };
1807
+ var I = class extends R {
1808
+ constructor(t5, i6, s4, e7, h3) {
1809
+ super(t5, i6, s4, e7, h3), this.type = 5;
1810
+ }
1811
+ _$AI(t5, i6 = this) {
1812
+ if ((t5 = N(this, t5, i6, 0) ?? T) === w)
1813
+ return;
1814
+ const s4 = this._$AH, e7 = t5 === T && s4 !== T || t5.capture !== s4.capture || t5.once !== s4.once || t5.passive !== s4.passive, h3 = t5 !== T && (s4 === T || e7);
1815
+ e7 && this.element.removeEventListener(this.name, this, s4), h3 && this.element.addEventListener(this.name, this, t5), this._$AH = t5;
1816
+ }
1817
+ handleEvent(t5) {
1818
+ "function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t5) : this._$AH.handleEvent(t5);
1819
+ }
1820
+ };
1821
+ var L = class {
1822
+ constructor(t5, i6, s4) {
1823
+ this.element = t5, this.type = 6, this._$AN = void 0, this._$AM = i6, this.options = s4;
1824
+ }
1825
+ get _$AU() {
1826
+ return this._$AM._$AU;
1827
+ }
1828
+ _$AI(t5) {
1829
+ N(this, t5);
1830
+ }
1831
+ };
1832
+ var Z = t3.litHtmlPolyfillSupport;
1833
+ Z?.(V, M), (t3.litHtmlVersions ??= []).push("3.1.2");
1834
+ var j = (t5, i6, s4) => {
1835
+ const e7 = s4?.renderBefore ?? i6;
1836
+ let h3 = e7._$litPart$;
1837
+ if (void 0 === h3) {
1838
+ const t6 = s4?.renderBefore ?? null;
1839
+ e7._$litPart$ = h3 = new M(i6.insertBefore(l2(), t6), t6, void 0, s4 ?? {});
1840
+ }
1841
+ return h3._$AI(t5), h3;
1842
+ };
1843
+
1844
+ // node_modules/lit-element/lit-element.js
1845
+ var s3 = class extends b {
1846
+ constructor() {
1847
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
1848
+ }
1849
+ createRenderRoot() {
1850
+ const t5 = super.createRenderRoot();
1851
+ return this.renderOptions.renderBefore ??= t5.firstChild, t5;
1852
+ }
1853
+ update(t5) {
1854
+ const i6 = this.render();
1855
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t5), this._$Do = j(i6, this.renderRoot, this.renderOptions);
1856
+ }
1857
+ connectedCallback() {
1858
+ super.connectedCallback(), this._$Do?.setConnected(true);
1859
+ }
1860
+ disconnectedCallback() {
1861
+ super.disconnectedCallback(), this._$Do?.setConnected(false);
1862
+ }
1863
+ render() {
1864
+ return w;
1865
+ }
1866
+ };
1867
+ s3._$litElement$ = true, s3["finalized", "finalized"] = true, globalThis.litElementHydrateSupport?.({ LitElement: s3 });
1868
+ var r6 = globalThis.litElementPolyfillSupport;
1869
+ r6?.({ LitElement: s3 });
1870
+ (globalThis.litElementVersions ??= []).push("4.0.4");
1871
+
1872
+ // node_modules/lit-html/directive.js
1873
+ var t4 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
1874
+ var e6 = (t5) => (...e7) => ({ _$litDirective$: t5, values: e7 });
1875
+ var i4 = class {
1876
+ constructor(t5) {
1877
+ }
1878
+ get _$AU() {
1879
+ return this._$AM._$AU;
1880
+ }
1881
+ _$AT(t5, e7, i6) {
1882
+ this._$Ct = t5, this._$AM = e7, this._$Ci = i6;
1883
+ }
1884
+ _$AS(t5, e7) {
1885
+ return this.update(t5, e7);
1886
+ }
1887
+ update(t5, e7) {
1888
+ return this.render(...e7);
1889
+ }
1890
+ };
1891
+
1892
+ // node_modules/lit-html/directives/style-map.js
1893
+ var n5 = "important";
1894
+ var i5 = " !" + n5;
1895
+ var o5 = e6(class extends i4 {
1896
+ constructor(t5) {
1897
+ if (super(t5), t5.type !== t4.ATTRIBUTE || "style" !== t5.name || t5.strings?.length > 2)
1898
+ throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
1899
+ }
1900
+ render(t5) {
1901
+ return Object.keys(t5).reduce((e7, r7) => {
1902
+ const s4 = t5[r7];
1903
+ return null == s4 ? e7 : e7 + `${r7 = r7.includes("-") ? r7 : r7.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s4};`;
1904
+ }, "");
1905
+ }
1906
+ update(e7, [r7]) {
1907
+ const { style: s4 } = e7.element;
1908
+ if (void 0 === this.ft)
1909
+ return this.ft = new Set(Object.keys(r7)), this.render(r7);
1910
+ for (const t5 of this.ft)
1911
+ null == r7[t5] && (this.ft.delete(t5), t5.includes("-") ? s4.removeProperty(t5) : s4[t5] = null);
1912
+ for (const t5 in r7) {
1913
+ const e8 = r7[t5];
1914
+ if (null != e8) {
1915
+ this.ft.add(t5);
1916
+ const r8 = "string" == typeof e8 && e8.endsWith(i5);
1917
+ t5.includes("-") || r8 ? s4.setProperty(t5, r8 ? e8.slice(0, -11) : e8, r8 ? n5 : "") : s4[t5] = e8;
1918
+ }
1919
+ }
1920
+ return w;
1921
+ }
1922
+ });
1923
+
1924
+ // libs/embed-libs/embed/package.json
1925
+ var version = "5.0.11";
1926
+
1927
+ // libs/embed-libs/embed/src/lib/luzmo-service.ts
1928
+ var LuzmoService = class {
1929
+ constructor() {
1930
+ this._components = [];
1931
+ }
1932
+ };
1933
+ var luzmo_service_default = new LuzmoService();
1934
+
1935
+ // libs/embed-libs/embed/src/lib/helper/event-bus-handler.ts
1936
+ var _setEventHandler = () => {
1937
+ if (typeof window.__luzmoMessageHandler === "function") {
1938
+ return;
1939
+ }
1940
+ window.__luzmoMessageHandler = (event) => {
1941
+ const dashboardComponent = luzmo_service_default._components.find(
1942
+ (c4) => event.data.name === c4._iframeId
1943
+ );
1944
+ if (!dashboardComponent) {
1945
+ return;
1946
+ }
1947
+ switch (event.data?.type) {
1948
+ case "load": {
1949
+ dashboardComponent.dispatchEvent(
1950
+ new CustomEvent("load", { detail: { data: event.data } })
1951
+ );
1952
+ if (dashboardComponent._loadTimeoutHandle) {
1953
+ clearTimeout(dashboardComponent._loadTimeoutHandle);
1954
+ dashboardComponent._loadTimeoutHandle = void 0;
1955
+ }
1956
+ dashboardComponent.iframeLoaded = true;
1957
+ dashboardComponent.dimensions = event.data.dimensions;
1958
+ dashboardComponent._calculateDimAfterDashboardLoaded();
1959
+ break;
1960
+ }
1961
+ case "error": {
1962
+ dashboardComponent.dashboardError = true;
1963
+ if (dashboardComponent._loadTimeoutHandle) {
1964
+ clearTimeout(dashboardComponent._loadTimeoutHandle);
1965
+ dashboardComponent._loadTimeoutHandle = void 0;
1966
+ }
1967
+ dashboardComponent.iframeLoaded = true;
1968
+ dashboardComponent._displayError();
1969
+ break;
1970
+ }
1971
+ case "data": {
1972
+ resolvePromise(
1973
+ dashboardComponent,
1974
+ event.data.requestId,
1975
+ event.data.data
1976
+ );
1977
+ break;
1978
+ }
1979
+ case "filters": {
1980
+ resolvePromise(
1981
+ dashboardComponent,
1982
+ event.data.requestId,
1983
+ event.data.filters
1984
+ );
1985
+ break;
1986
+ }
1987
+ case "getAccessibleDashboards": {
1988
+ resolvePromise(
1989
+ dashboardComponent,
1990
+ event.data.requestId,
1991
+ event.data.accessibleDashboards
1992
+ );
1993
+ break;
1994
+ }
1995
+ case "dashboardAction": {
1996
+ dashboardComponent.dispatchEvent(
1997
+ new CustomEvent("dashboardAction", { detail: { data: event.data } })
1998
+ );
1999
+ break;
2000
+ }
2001
+ case "export": {
2002
+ if (event.data.error) {
2003
+ rejectPromise(
2004
+ dashboardComponent,
2005
+ event.data.requestId,
2006
+ event.data
2007
+ );
2008
+ } else {
2009
+ dashboardComponent.dispatchEvent(
2010
+ new CustomEvent("exported", { detail: { data: event.data } })
2011
+ );
2012
+ resolvePromise(
2013
+ dashboardComponent,
2014
+ event.data.requestId,
2015
+ event.data
2016
+ );
2017
+ }
2018
+ break;
2019
+ }
2020
+ case "changedFilters": {
2021
+ dashboardComponent.dispatchEvent(
2022
+ new CustomEvent("changedFilters", { detail: { data: event.data } })
2023
+ );
2024
+ break;
2025
+ }
2026
+ case "customEvent": {
2027
+ dashboardComponent.dispatchEvent(
2028
+ new CustomEvent("customEvent", { detail: { data: event.data } })
2029
+ );
2030
+ break;
2031
+ }
2032
+ case "chartsRendered":
2033
+ case "itemsRendered": {
2034
+ event.data.type = "itemsRendered";
2035
+ dashboardComponent.dispatchEvent(
2036
+ new CustomEvent("itemsRendered", { detail: { data: event.data } })
2037
+ );
2038
+ break;
2039
+ }
2040
+ case "setEditMode": {
2041
+ if (event.data.error) {
2042
+ rejectPromise(
2043
+ dashboardComponent,
2044
+ event.data.requestId,
2045
+ event.data
2046
+ );
2047
+ } else {
2048
+ resolvePromise(
2049
+ dashboardComponent,
2050
+ event.data.requestId,
2051
+ event.data
2052
+ );
2053
+ dashboardComponent.params.editMode = event.data.editMode;
2054
+ dashboardComponent._containerStyle = containerStyles(dashboardComponent);
2055
+ if (dashboardComponent.dimensions) {
2056
+ _setCalculatedDimensions(dashboardComponent);
2057
+ }
2058
+ }
2059
+ break;
2060
+ }
2061
+ case "setFilters": {
2062
+ event.data.error ? rejectPromise(
2063
+ dashboardComponent,
2064
+ event.data.requestId,
2065
+ event.data
2066
+ ) : resolvePromise(
2067
+ dashboardComponent,
2068
+ event.data.requestId,
2069
+ event.data
2070
+ );
2071
+ break;
2072
+ }
2073
+ case "setPreview": {
2074
+ event.data.error ? rejectPromise(
2075
+ dashboardComponent,
2076
+ event.data.requestId,
2077
+ event.data
2078
+ ) : resolvePromise(
2079
+ dashboardComponent,
2080
+ event.data.requestId,
2081
+ event.data
2082
+ );
2083
+ break;
2084
+ }
2085
+ }
2086
+ };
2087
+ window.addEventListener("message", window.__luzmoMessageHandler, false);
2088
+ };
2089
+
2090
+ // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-styles.ts
2091
+ var dashboardStyles = i`
2092
+ :host {
2093
+ display: block;
2094
+ }
2095
+
2096
+ @-webkit-keyframes spin {
2097
+ 0% {
2098
+ -webkit-transform: rotate(0deg);
2099
+ transform: rotate(0deg);
2100
+ }
2101
+ 100% {
2102
+ -webkit-transform: rotate(360deg);
2103
+ transform: rotate(360deg);
2104
+ }
2105
+ }
2106
+
2107
+ @keyframes spin {
2108
+ 0% {
2109
+ -webkit-transform: rotate(0deg);
2110
+ transform: rotate(0deg);
2111
+ }
2112
+ 100% {
2113
+ -webkit-transform: rotate(360deg);
2114
+ transform: rotate(360deg);
2115
+ }
2116
+ }
2117
+ :host {
2118
+ position: relative;
2119
+ width: 100%;
2120
+ }
2121
+
2122
+ .luzmo-embed-dashboard {
2123
+ background: transparent;
2124
+ padding: 0;
2125
+ border: 0;
2126
+ }
2127
+
2128
+ .luzmo-embed-container-ede {
2129
+ width: 100%;
2130
+ height: 100%;
2131
+ }
2132
+
2133
+ .luzmo-container-loader {
2134
+ width: 100%;
2135
+ position: relative;
2136
+ }
2137
+
2138
+ .luzmo-lc {
2139
+ margin: 0 auto;
2140
+ }
2141
+
2142
+ .luzmo-loading-message {
2143
+ width: 100%;
2144
+ height: 20px;
2145
+ text-align: center;
2146
+ margin-bottom: 16px;
2147
+ font-family: Helvetica, Arial, sans-serif;
2148
+ font-size: 14px;
2149
+ }
2150
+
2151
+ .luzmo-loading-circle {
2152
+ box-sizing: border-box;
2153
+ margin: 16px auto;
2154
+ position: relative;
2155
+ text-indent: -9999em;
2156
+ animation: spin 0.6s infinite linear;
2157
+ }
2158
+
2159
+ .luzmo-loading-circle,
2160
+ .luzmo-loading-circle:after {
2161
+ border-radius: 50%;
2162
+ width: 32px;
2163
+ height: 32px;
2164
+ }
2165
+
2166
+ .itemEmbedding:after {
2167
+ width: 24px;
2168
+ height: 24px;
2169
+ }
2170
+
2171
+ .luzmo-error {
2172
+ background: transparent;
2173
+ padding: 48px 0;
2174
+ margin: 0 auto;
2175
+ width: 80%;
2176
+ border: 0;
2177
+ text-align: center;
2178
+ min-height: 192px;
2179
+ }
2180
+
2181
+ .dashboard-error {
2182
+ font-size: 30px;
2183
+ background: transparent;
2184
+ padding: 48px 0;
2185
+ margin: 0 auto;
2186
+ width: 80%;
2187
+ border: 0;
2188
+ text-align: center;
2189
+ min-height: 192px;
2190
+ }
2191
+
2192
+ .luzmo-loader {
2193
+ top: 0;
2194
+ left: 0;
2195
+ width: 100%;
2196
+ min-height: 400px;
2197
+ position: absolute;
2198
+ transition-duration: 0.3s;
2199
+ }
2200
+ `;
2201
+
2202
+ // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
2203
+ var LuzmoDashboard = class extends s3 {
2204
+ constructor(inputParameters) {
2205
+ super();
2206
+ this.language = "auto";
2207
+ this.screenMode = "auto";
2208
+ this.switchScreenModeOnResize = true;
2209
+ this.editMode = "view";
2210
+ this.experimental = false;
2211
+ this.iframeStyle = {};
2212
+ this._containerStyle = {};
2213
+ this._loaderStyle = {};
2214
+ this._lcStyle = {};
2215
+ this._loadingCircleStyle = {};
2216
+ this._containerLoaderStyle = {};
2217
+ this._loaderMsg = "";
2218
+ this._itemEmbedding = false;
2219
+ this.browserError = false;
2220
+ this.browserErrorMsg = "";
2221
+ this.dashboardError = false;
2222
+ this.browserNotSupported = [];
2223
+ this.VERSION = version + "-wc-luzmo";
2224
+ this.isLibraryLoaded = false;
2225
+ this.attributesMap = {
2226
+ dashboardId: "dashboard-id",
2227
+ dashboardSlug: "dashboard-slug",
2228
+ itemId: "item-id",
2229
+ language: "language",
2230
+ qeVersion: "qe-version",
2231
+ screenMode: "screen-mode",
2232
+ switchScreenModeOnResize: "switch-screen-mode-on-resize",
2233
+ authKey: "auth-key",
2234
+ authToken: "auth-token",
2235
+ editMode: "edit-mode",
2236
+ mainColor: "main-color",
2237
+ accentColor: "accent-color",
2238
+ loaderBackground: "loader-background",
2239
+ loaderFontColor: "loader-font-color",
2240
+ loaderSpinnerColor: "loader-spinner-color",
2241
+ loaderSpinnerBackground: "loader-spinner-background",
2242
+ appServer: "app-server",
2243
+ apiHost: "api-host",
2244
+ itemDimensions: "item-dimensions",
2245
+ timezoneId: "timezone-id"
2246
+ };
2247
+ this.loaderSize = 32;
2248
+ this.borderWidth = 3;
2249
+ this.minHeight = 400;
2250
+ this._containerId = uuidv4();
2251
+ this._iframeId = `luzmo-dashboard-${this._containerId}`;
2252
+ this.iframeLoaded = false;
2253
+ this.promises = {};
2254
+ this.setInputParameters(inputParameters);
2255
+ this.params = this._setOptions();
2256
+ this._onResize = () => {
2257
+ if (this.shadowRoot?.querySelector(".dashboard-container")) {
2258
+ this.containerWidth = this.luzmoEmbedContainer.offsetWidth;
2259
+ if (this.params.switchScreenModeOnResize && this.params.screenMode === "auto") {
2260
+ for (const d3 of EXTENTS) {
2261
+ if (d3.width[0] <= window.innerWidth && window.innerWidth <= d3.width[1]) {
2262
+ this.currentScreenMode = d3.mode;
2263
+ }
2264
+ }
2265
+ }
2266
+ if (this.iframeLoaded) {
2267
+ this._calculateDimAfterDashboardLoaded();
2268
+ } else {
2269
+ if (this.dimensions) {
2270
+ this.containerWidth = this.luzmoEmbedContainer.offsetWidth;
2271
+ _setCalculatedDimensions(this);
2272
+ }
2273
+ }
2274
+ }
2275
+ };
2276
+ this._resizeObserver = new ResizeObserver((entries) => {
2277
+ window.requestAnimationFrame(() => {
2278
+ if (!Array.isArray(entries) || entries.length === 0) {
2279
+ return;
2280
+ }
2281
+ this._onResize();
2282
+ });
2283
+ });
2284
+ }
2285
+ loadLibrary(appServer) {
2286
+ if (remotesMap[appServer]) {
2287
+ return Promise.resolve(remotesMap[appServer].module);
2288
+ }
2289
+ remotesMap[appServer] = {
2290
+ url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
2291
+ format: "esm",
2292
+ from: "vite",
2293
+ module: void 0
2294
+ };
2295
+ return __federationMethodGetRemote(appServer, "./DashboardApp").then((module2) => {
2296
+ const wrappedModule = __federationMethodWrapDefault(module2, true);
2297
+ remotesMap[appServer].module = wrappedModule;
2298
+ return wrappedModule;
2299
+ });
2300
+ }
2301
+ setInputParameters(inputParameters) {
2302
+ if (!inputParameters) {
2303
+ return;
2304
+ }
2305
+ const params = [
2306
+ "dashboardId",
2307
+ "dashboardSlug",
2308
+ "itemId",
2309
+ "language",
2310
+ "qeVersion",
2311
+ "screenMode",
2312
+ "switchScreenModeOnResize",
2313
+ "accentColor",
2314
+ "mainColor",
2315
+ "authToken",
2316
+ "authKey",
2317
+ "editMode",
2318
+ "loaderBackground",
2319
+ "loaderFontColor",
2320
+ "loaderSpinnerColor",
2321
+ "loaderSpinnerBackground",
2322
+ "timezoneId",
2323
+ "itemDimensions",
2324
+ "apiHost"
2325
+ ];
2326
+ for (const key of params) {
2327
+ const value = inputParameters[key];
2328
+ if (value) {
2329
+ this[key] = value;
2330
+ }
2331
+ }
2332
+ if (inputParameters.experimental) {
2333
+ this.experimental = inputParameters.experimental;
2334
+ }
2335
+ if (inputParameters.appServer) {
2336
+ this.appServer = addTrailingSlash(inputParameters.appServer);
2337
+ }
2338
+ }
2339
+ // Set resize event listener
2340
+ connectedCallback() {
2341
+ super.connectedCallback();
2342
+ }
2343
+ // Set resize event listener
2344
+ disconnectedCallback() {
2345
+ super.disconnectedCallback();
2346
+ this._resizeObserver.disconnect();
2347
+ for (const promiseKey of Object.keys(this.promises)) {
2348
+ this.promises[promiseKey].reject(
2349
+ new Error("Dashboard component was removed")
2350
+ );
2351
+ }
2352
+ }
2353
+ firstUpdated() {
2354
+ this._loaderMsg = getLoader(this)?.loadingMsg;
2355
+ this._loaderStyles();
2356
+ luzmo_service_default._components.push(this);
2357
+ this.initComponent();
2358
+ if (this.luzmoEmbedContainer) {
2359
+ this._resizeObserver.observe(this.luzmoEmbedContainer);
2360
+ }
2361
+ }
2362
+ initComponent() {
2363
+ this.params = this._setOptions();
2364
+ if (this.getIsViewMode()) {
2365
+ this.loadLibrary(this.params.appServer).then(async () => {
2366
+ this.isLibraryLoaded = true;
2367
+ await this.updateComplete;
2368
+ const oldReference = this.renderRoot.querySelector("dashboard-component");
2369
+ this.dashboardReference = oldReference.cloneNode(true);
2370
+ oldReference.replaceWith(this.dashboardReference);
2371
+ this.dashboardReference.addEventListener("load", (payload) => {
2372
+ setTimeout(() => {
2373
+ this.containerWidth = this.dashboardReference.offsetWidth;
2374
+ this.dimensions = payload.detail.dimensions;
2375
+ _setCalculatedDimensions(this);
2376
+ });
2377
+ this.dispatchEvent(new CustomEvent("load", payload));
2378
+ });
2379
+ this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
2380
+ this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
2381
+ this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
2382
+ this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
2383
+ this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
2384
+ this.setAllAttributes();
2385
+ });
2386
+ } else {
2387
+ this.containerWidth = this.container?.clientWidth;
2388
+ _extendAndValidate(this);
2389
+ _browserCheck(this);
2390
+ this._setupLoader();
2391
+ if (!this.params.error) {
2392
+ this._loaderStyles();
2393
+ _setEventHandler();
2394
+ this._iframeUrl = createIframeUrl(this);
2395
+ this.iframe?.setAttribute("src", this._iframeUrl);
2396
+ this.iframeStyle = calculateIframeStyles(this);
2397
+ }
2398
+ }
2399
+ }
2400
+ setAllAttributes() {
2401
+ if (this.dashboardReference) {
2402
+ for (const key in this.attributesMap) {
2403
+ if (!["authKey", "authToken", "apiHost", "itemDimensions"].includes(key) && this.params[key]) {
2404
+ this.dashboardReference.setAttribute(this.attributesMap[key], this.params[key]);
2405
+ }
2406
+ if (this.params.itemDimensions) {
2407
+ this.dashboardReference.setAttribute("item-dimensions", JSON.stringify(this.params.itemDimensions));
2408
+ }
2409
+ if (this.params.apiHost) {
2410
+ this.dashboardReference.setAttribute("api-host", removeTrailingSlash(this.params.apiHost));
2411
+ }
2412
+ if (this.params.key) {
2413
+ this.dashboardReference.setAttribute("auth-key", this.params.key);
2414
+ }
2415
+ if (this.params.token) {
2416
+ this.dashboardReference.setAttribute("auth-token", this.params.token);
2417
+ }
2418
+ }
2419
+ }
2420
+ }
2421
+ // Reload dashboard when triggerproperty changes
2422
+ updated(changedProperties) {
2423
+ const triggerProperties = /* @__PURE__ */ new Set([
2424
+ "dashboardId",
2425
+ "dashboardSlug",
2426
+ "itemId",
2427
+ "language",
2428
+ "qeVersion",
2429
+ "editMode",
2430
+ "screenMode",
2431
+ "switchScreenModeOnResize",
2432
+ "authToken",
2433
+ "authKey",
2434
+ "appServer",
2435
+ "timezoneId",
2436
+ "itemDimensions"
2437
+ ]);
2438
+ if (this.getIsViewMode()) {
2439
+ if (this.dashboardReference) {
2440
+ for (const [propertyName] of changedProperties.entries()) {
2441
+ if (propertyName === "appSever") {
2442
+ this.loadLibrary(changedProperties[propertyName]).then(async () => {
2443
+ this.isLibraryLoaded = true;
2444
+ await this.updateComplete;
2445
+ this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
2446
+ this.setAllAttributes();
2447
+ });
2448
+ } else if (this.attributesMap[propertyName]) {
2449
+ const mappedAttributeName = this.attributesMap[propertyName] ?? propertyName;
2450
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() || this[propertyName];
2451
+ this.dashboardReference.setAttribute(mappedAttributeName, attributeValue);
2452
+ }
2453
+ }
2454
+ }
2455
+ } else {
2456
+ for (const [propertyName] of changedProperties.entries()) {
2457
+ if (triggerProperties.has(propertyName) && propertyName !== "editMode") {
2458
+ this.iframeLoaded = false;
2459
+ if (this._loadTimeoutHandle) {
2460
+ clearTimeout(this._loadTimeoutHandle);
2461
+ }
2462
+ this._loadTimeoutHandle = setTimeout(() => {
2463
+ console.error(
2464
+ "Failed to load dashboard, appServer is likely down or unreachable."
2465
+ );
2466
+ }, 15 * 1e3);
2467
+ this.params = this._setOptions();
2468
+ _extendAndValidate(this);
2469
+ this._setupLoader();
2470
+ this._loaderStyles();
2471
+ this._iframeUrl = createIframeUrl(this);
2472
+ if (this.iframe) {
2473
+ this._updateIframeUrl();
2474
+ }
2475
+ this.iframeStyle = calculateIframeStyles(this);
2476
+ } else if (triggerProperties.has(propertyName) && propertyName === "editMode") {
2477
+ if (this.iframeLoaded) {
2478
+ this.setEditMode(this.editMode);
2479
+ }
2480
+ this.params = this._setOptions();
2481
+ }
2482
+ }
2483
+ }
2484
+ }
2485
+ // Set params
2486
+ _setOptions() {
2487
+ const defaultParameters = {
2488
+ dashboardId: this.dashboardId,
2489
+ dashboardSlug: this.dashboardSlug
2490
+ };
2491
+ if (this.itemId) {
2492
+ defaultParameters.itemId = this.itemId;
2493
+ this._itemEmbedding = true;
2494
+ } else {
2495
+ this._itemEmbedding = false;
2496
+ }
2497
+ if (this.language) {
2498
+ defaultParameters.language = this.language;
2499
+ }
2500
+ if (this.qeVersion) {
2501
+ defaultParameters.qeVersion = this.qeVersion;
2502
+ }
2503
+ if (this.screenMode) {
2504
+ defaultParameters.screenMode = this.screenMode;
2505
+ }
2506
+ defaultParameters.switchScreenModeOnResize = this.switchScreenModeOnResize;
2507
+ if (this.authToken) {
2508
+ defaultParameters.token = this.authToken;
2509
+ }
2510
+ if (this.authKey) {
2511
+ defaultParameters.key = this.authKey;
2512
+ }
2513
+ if (this.editMode) {
2514
+ defaultParameters.editMode = this.editMode;
2515
+ }
2516
+ if (this.mainColor) {
2517
+ defaultParameters.mainColor = this.mainColor;
2518
+ }
2519
+ if (this.accentColor) {
2520
+ defaultParameters.accentColor = this.accentColor;
2521
+ }
2522
+ if (this.loaderBackground) {
2523
+ defaultParameters.loaderBackground = this.loaderBackground;
2524
+ }
2525
+ if (this.loaderFontColor) {
2526
+ defaultParameters.loaderFontColor = this.loaderFontColor;
2527
+ }
2528
+ if (this.loaderSpinnerColor) {
2529
+ defaultParameters.loaderSpinnerColor = this.loaderSpinnerColor;
2530
+ }
2531
+ if (this.loaderSpinnerBackground) {
2532
+ defaultParameters.loaderSpinnerBackground = this.loaderSpinnerBackground;
2533
+ }
2534
+ if (this.timezoneId) {
2535
+ defaultParameters.timezoneId = this.timezoneId;
2536
+ }
2537
+ if (this.itemDimensions) {
2538
+ defaultParameters.itemDimensions = this.itemDimensions;
2539
+ }
2540
+ if (this.appServer) {
2541
+ this.appServer = this.getIsViewMode() ? removeTrailingSlash(this.appServer) : addTrailingSlash(this.appServer);
2542
+ defaultParameters.appServer = this.appServer;
2543
+ } else {
2544
+ this.appServer = addTrailingSlash(
2545
+ DEFAULT_PARAMETERS.appServer
2546
+ );
2547
+ defaultParameters.appServer = this.appServer;
2548
+ }
2549
+ if (this.apiHost) {
2550
+ this.apiHost = this.getIsViewMode() ? removeTrailingSlash(this.apiHost) : addTrailingSlash(this.apiHost);
2551
+ defaultParameters.apiHost = this.apiHost;
2552
+ } else {
2553
+ this.apiHost = this.appServer.includes("luzmo.com") ? this.appServer.replace("app", "api") : this.appServer;
2554
+ defaultParameters.apiHost = this.apiHost;
2555
+ }
2556
+ return defaultParameters;
2557
+ }
2558
+ _updateIframeUrl() {
2559
+ updateIframeUrl(this.iframe, this._iframeUrl);
2560
+ }
2561
+ // Setup loader / browser error
2562
+ _setupLoader() {
2563
+ const data = getLoader(this);
2564
+ this._loaderMsg = data.loadingMsg;
2565
+ if (data.errorMsg) {
2566
+ this.browserError = true;
2567
+ this.browserErrorMsg = data.errorMsg;
2568
+ this._displayError();
2569
+ }
2570
+ }
2571
+ _displayError() {
2572
+ if (this.dashboardError) {
2573
+ this._loaderStyles();
2574
+ this.iframeStyle.opacity = 1;
2575
+ }
2576
+ if (this.browserError) {
2577
+ this._containerStyle.display = "none";
2578
+ }
2579
+ }
2580
+ _calculateDimAfterDashboardLoaded() {
2581
+ this.dashboardError = false;
2582
+ this._loaderStyles();
2583
+ _setCalculatedDimensions(this);
2584
+ }
2585
+ // Set loader styles
2586
+ _loaderStyles() {
2587
+ this._containerStyle = containerStyles(this);
2588
+ this._loaderStyle = loaderStyles(this);
2589
+ this._loadingCircleStyle = plStyles(this);
2590
+ this._containerLoaderStyle = containerLoaderStyles(this);
2591
+ this._lcStyle = lcStyles(this);
2592
+ }
2593
+ static get styles() {
2594
+ return [dashboardStyles];
2595
+ }
2596
+ render() {
2597
+ let toBeRenderedHTML;
2598
+ const loader = x`
2599
+ <div
2600
+ class="luzmo-container-loader"
2601
+ id="luzmo-container-loader-${this._containerId}"
2602
+ style=${o5(
2603
+ this._containerLoaderStyle
2604
+ )}
2605
+ >
2606
+ <div
2607
+ class="luzmo-loader"
2608
+ id="luzmo-loader-${this._containerId}"
2609
+ style=${o5(this._loaderStyle)}
2610
+ >
2611
+ <div
2612
+ class="luzmo-lc"
2613
+ style=${o5(this._lcStyle)}
2614
+ >
2615
+ <div
2616
+ class="luzmo-loading-circle"
2617
+ style=${o5(
2618
+ this._loadingCircleStyle
2619
+ )}
2620
+ ></div>
2621
+ ${this._itemEmbedding ? "" : x`
2622
+ <div
2623
+ class="luzmo-loading-message"
2624
+ style=${o5({ color: this.loaderFontColor })}
2625
+ >
2626
+ ${this._loaderMsg}
2627
+ </div>
2628
+ `}
2629
+ </div>
2630
+ </div>
2631
+ </div>
2632
+ `;
2633
+ if (this.getIsViewMode()) {
2634
+ toBeRenderedHTML = this.isLibraryLoaded ? x`
2635
+ ${this.dashboardId || this.dashboardSlug ? x`
2636
+ <dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}"
2637
+ api-host="${this.params.apiHost}"></dashboard-component>` : x`
2638
+ <div id="luzmo-error-${this._containerId}">
2639
+ <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
2640
+ </div>
2641
+ `}
2642
+ ` : x`${loader}`;
2643
+ } else {
2644
+ toBeRenderedHTML = x`
2645
+ ${this.dashboardId || this.dashboardSlug ? x`
2646
+ ${loader}
2647
+ <iframe
2648
+ class="luzmo-embed-dashboard"
2649
+ id="${this._iframeId}"
2650
+ name="${this._iframeId}"
2651
+ style=${o5(this.iframeStyle)}
2652
+ src="${this._iframeUrl}"
2653
+ frameborder="0"
2654
+ ></iframe>
2655
+ ` : x`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
2656
+ ${this.browserError ? x`
2657
+ <div id="luzmo-error-${this._containerId}">
2658
+ <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
2659
+ </div>
2660
+ ` : ""}
2661
+ `;
2662
+ }
2663
+ return x`
2664
+ <div class="${luzmoEmbedContainerClass} ${!this.getIsViewMode() ? `${luzmoEmbedContainerClass}-ede` : ""}">
2665
+ <div
2666
+ class="dashboard-container"
2667
+ style=${o5(Object.assign({}, this._containerStyle, {
2668
+ width: this.iframeStyle.width ?? "100%",
2669
+ height: this.iframeStyle.height ?? "100%"
2670
+ }))}
2671
+ >
2672
+ ${toBeRenderedHTML}
2673
+ </div>
2674
+ </div>
2675
+
2676
+ `;
2677
+ }
2678
+ getDashboards() {
2679
+ return new Promise(
2680
+ (resolve) => resolve(luzmo_service_default._components)
2681
+ );
2682
+ }
2683
+ // Public methods
2684
+ getData(itemId) {
2685
+ if (this.getIsViewMode() && this.dashboardReference) {
2686
+ return this.dashboardReference.getData(itemId);
2687
+ }
2688
+ if (!this.getIsViewMode()) {
2689
+ return getData(this, this.iframe, itemId);
2690
+ }
2691
+ return Promise.reject();
2692
+ }
2693
+ getFilters() {
2694
+ if (this.getIsViewMode() && this.dashboardReference) {
2695
+ return this.dashboardReference.getFilters();
2696
+ }
2697
+ if (!this.getIsViewMode()) {
2698
+ return getFilters(this, this.iframe);
2699
+ }
2700
+ return Promise.reject();
2701
+ }
2702
+ setFilters(itemId, filters) {
2703
+ if (this.getIsViewMode() && this.dashboardReference) {
2704
+ return this.dashboardReference.setFilters(itemId, filters);
2705
+ }
2706
+ if (!this.getIsViewMode()) {
2707
+ return setFilters(this, this.iframe, itemId, filters);
2708
+ }
2709
+ return Promise.reject();
2710
+ }
2711
+ setAuthorization(key, token) {
2712
+ if (this.getIsViewMode() && this.dashboardReference) {
2713
+ return this.dashboardReference.setAuthorization(key, token);
2714
+ }
2715
+ if (!this.getIsViewMode()) {
2716
+ return setAuthorization(this, this.iframe, key, token);
2717
+ }
2718
+ return Promise.reject();
2719
+ }
2720
+ refreshData(itemId) {
2721
+ if (this.getIsViewMode() && this.dashboardReference) {
2722
+ return this.dashboardReference.refreshData(itemId);
2723
+ }
2724
+ if (!this.getIsViewMode()) {
2725
+ return itemId ? refreshData(this, this.iframe, itemId) : refreshData(this, this.iframe);
2726
+ }
2727
+ return Promise.reject();
2728
+ }
2729
+ reloadDashboard() {
2730
+ if (this.getIsViewMode() && this.dashboardReference) {
2731
+ return this.dashboardReference.reloadDashboard();
2732
+ }
2733
+ if (!this.getIsViewMode()) {
2734
+ return reloadDashboard(this, this.iframe);
2735
+ }
2736
+ return Promise.reject();
2737
+ }
2738
+ exportDashboard(format) {
2739
+ if (this.getIsViewMode() && this.dashboardReference) {
2740
+ return this.dashboardReference.exportDashboard(format);
2741
+ }
2742
+ if (!this.getIsViewMode()) {
2743
+ return format ? exportDashboard(this, this.iframe, format) : exportDashboard(this, this.iframe);
2744
+ }
2745
+ return Promise.reject();
2746
+ }
2747
+ getAccessibleDashboards() {
2748
+ if (!this.getIsViewMode()) {
2749
+ return getAccessibleDashboards(this, this.iframe);
2750
+ }
2751
+ if (this.getIsViewMode() && this.dashboardReference) {
2752
+ return this.dashboardReference.getAccessibleDashboards();
2753
+ }
2754
+ return Promise.reject();
2755
+ }
2756
+ addFilters(itemId, filters) {
2757
+ return this.dashboardReference.addFilters(itemId, filters);
2758
+ }
2759
+ setEditMode(editMode) {
2760
+ if (this.dashboardReference && editMode === "view") {
2761
+ this.editMode = "view";
2762
+ this.params.editMode = "view";
2763
+ this.initComponent();
2764
+ return Promise.resolve({
2765
+ type: "setEditMode",
2766
+ editMode
2767
+ });
2768
+ }
2769
+ if (this.dashboardReference && ["editFull", "editLimited"].includes(editMode)) {
2770
+ this.editMode = editMode;
2771
+ this.params.editMode = editMode;
2772
+ this.initComponent();
2773
+ return Promise.resolve({
2774
+ type: "setEditMode",
2775
+ editMode
2776
+ });
2777
+ }
2778
+ if (this.getIsViewMode() && this.dashboardReference) {
2779
+ return this.dashboardReference.setEditMode(editMode);
2780
+ }
2781
+ if (!this.getIsViewMode()) {
2782
+ return setEditMode(this, this.iframe, editMode);
2783
+ }
2784
+ return Promise.reject();
2785
+ }
2786
+ setPreview(preview) {
2787
+ if (this.getIsViewMode() && this.dashboardReference) {
2788
+ return this.dashboardReference.setPreview(preview);
2789
+ }
2790
+ return setPreview(this, this.iframe, preview);
2791
+ }
2792
+ getIsViewMode() {
2793
+ return this.experimental && this.params.editMode === "view" || this.params.editMode === void 0;
2794
+ }
2795
+ };
2796
+ __decorateClass([
2797
+ e4(".dashboard-container")
2798
+ ], LuzmoDashboard.prototype, "container", 2);
2799
+ __decorateClass([
2800
+ e4(`.${luzmoEmbedContainerClass}`)
2801
+ ], LuzmoDashboard.prototype, "luzmoEmbedContainer", 2);
2802
+ __decorateClass([
2803
+ e4("iframe")
2804
+ ], LuzmoDashboard.prototype, "iframe", 2);
2805
+ __decorateClass([
2806
+ n3()
2807
+ ], LuzmoDashboard.prototype, "dashboardId", 2);
2808
+ __decorateClass([
2809
+ n3()
2810
+ ], LuzmoDashboard.prototype, "dashboardSlug", 2);
2811
+ __decorateClass([
2812
+ n3()
2813
+ ], LuzmoDashboard.prototype, "itemId", 2);
2814
+ __decorateClass([
2815
+ n3()
2816
+ ], LuzmoDashboard.prototype, "language", 2);
2817
+ __decorateClass([
2818
+ n3()
2819
+ ], LuzmoDashboard.prototype, "qeVersion", 2);
2820
+ __decorateClass([
2821
+ n3()
2822
+ ], LuzmoDashboard.prototype, "screenMode", 2);
2823
+ __decorateClass([
2824
+ n3({
2825
+ converter: {
2826
+ fromAttribute: (value) => value === "true",
2827
+ toAttribute: String
2828
+ }
2829
+ })
2830
+ ], LuzmoDashboard.prototype, "switchScreenModeOnResize", 2);
2831
+ __decorateClass([
2832
+ n3()
2833
+ ], LuzmoDashboard.prototype, "editMode", 2);
2834
+ __decorateClass([
2835
+ n3()
2836
+ ], LuzmoDashboard.prototype, "mainColor", 2);
2837
+ __decorateClass([
2838
+ n3()
2839
+ ], LuzmoDashboard.prototype, "accentColor", 2);
2840
+ __decorateClass([
2841
+ n3()
2842
+ ], LuzmoDashboard.prototype, "authToken", 2);
2843
+ __decorateClass([
2844
+ n3()
2845
+ ], LuzmoDashboard.prototype, "authKey", 2);
2846
+ __decorateClass([
2847
+ n3()
2848
+ ], LuzmoDashboard.prototype, "loaderBackground", 2);
2849
+ __decorateClass([
2850
+ n3()
2851
+ ], LuzmoDashboard.prototype, "loaderFontColor", 2);
2852
+ __decorateClass([
2853
+ n3()
2854
+ ], LuzmoDashboard.prototype, "loaderSpinnerColor", 2);
2855
+ __decorateClass([
2856
+ n3()
2857
+ ], LuzmoDashboard.prototype, "loaderSpinnerBackground", 2);
2858
+ __decorateClass([
2859
+ n3()
2860
+ ], LuzmoDashboard.prototype, "appServer", 2);
2861
+ __decorateClass([
2862
+ n3()
2863
+ ], LuzmoDashboard.prototype, "timezoneId", 2);
2864
+ __decorateClass([
2865
+ n3()
2866
+ ], LuzmoDashboard.prototype, "apiHost", 2);
2867
+ __decorateClass([
2868
+ n3({ type: Object })
2869
+ ], LuzmoDashboard.prototype, "itemDimensions", 2);
2870
+ __decorateClass([
2871
+ n3({
2872
+ converter: {
2873
+ fromAttribute: (value) => value === "true",
2874
+ toAttribute: String
2875
+ }
2876
+ })
2877
+ ], LuzmoDashboard.prototype, "experimental", 2);
2878
+ __decorateClass([
2879
+ n3({ attribute: false })
2880
+ ], LuzmoDashboard.prototype, "_containerId", 2);
2881
+ __decorateClass([
2882
+ n3({ attribute: false })
2883
+ ], LuzmoDashboard.prototype, "_iframeId", 2);
2884
+ __decorateClass([
2885
+ n3({ attribute: false })
2886
+ ], LuzmoDashboard.prototype, "params", 2);
2887
+ __decorateClass([
2888
+ n3({ attribute: false })
2889
+ ], LuzmoDashboard.prototype, "_iframeUrl", 2);
2890
+ __decorateClass([
2891
+ n3({ attribute: false })
2892
+ ], LuzmoDashboard.prototype, "iframeLoaded", 2);
2893
+ __decorateClass([
2894
+ n3({ attribute: false })
2895
+ ], LuzmoDashboard.prototype, "promises", 2);
2896
+ __decorateClass([
2897
+ n3({ attribute: false })
2898
+ ], LuzmoDashboard.prototype, "iframeStyle", 2);
2899
+ __decorateClass([
2900
+ n3({ attribute: false })
2901
+ ], LuzmoDashboard.prototype, "_containerStyle", 2);
2902
+ __decorateClass([
2903
+ n3({ attribute: false })
2904
+ ], LuzmoDashboard.prototype, "_loaderStyle", 2);
2905
+ __decorateClass([
2906
+ n3({ attribute: false })
2907
+ ], LuzmoDashboard.prototype, "_lcStyle", 2);
2908
+ __decorateClass([
2909
+ n3({ attribute: false })
2910
+ ], LuzmoDashboard.prototype, "_loadingCircleStyle", 2);
2911
+ __decorateClass([
2912
+ n3({ attribute: false })
2913
+ ], LuzmoDashboard.prototype, "_containerLoaderStyle", 2);
2914
+ __decorateClass([
2915
+ n3({ attribute: false })
2916
+ ], LuzmoDashboard.prototype, "_loaderMsg", 2);
2917
+ __decorateClass([
2918
+ n3({ attribute: false })
2919
+ ], LuzmoDashboard.prototype, "containerWidth", 2);
2920
+ __decorateClass([
2921
+ n3({ attribute: false })
2922
+ ], LuzmoDashboard.prototype, "dimensions", 2);
2923
+ __decorateClass([
2924
+ n3({ attribute: false })
2925
+ ], LuzmoDashboard.prototype, "currentScreenMode", 2);
2926
+ __decorateClass([
2927
+ n3({ attribute: false })
2928
+ ], LuzmoDashboard.prototype, "_itemEmbedding", 2);
2929
+ __decorateClass([
2930
+ n3({ attribute: false })
2931
+ ], LuzmoDashboard.prototype, "browserError", 2);
2932
+ __decorateClass([
2933
+ n3({ attribute: false })
2934
+ ], LuzmoDashboard.prototype, "browserErrorMsg", 2);
2935
+ __decorateClass([
2936
+ n3({ attribute: false })
2937
+ ], LuzmoDashboard.prototype, "dashboardError", 2);
2938
+ __decorateClass([
2939
+ n3({ attribute: false })
2940
+ ], LuzmoDashboard.prototype, "browserNotSupported", 2);
2941
+ __decorateClass([
2942
+ n3()
2943
+ ], LuzmoDashboard.prototype, "VERSION", 2);
2944
+ __decorateClass([
2945
+ r4()
2946
+ ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
2947
+ __decorateClass([
2948
+ r4()
2949
+ ], LuzmoDashboard.prototype, "dashboardReference", 2);
2950
+
2951
+ // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-web-component.ts
2952
+ var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
2953
+ };
2954
+ LuzmoDashboardWebComponent = __decorateClass([
2955
+ t("luzmo-dashboard-web-component")
2956
+ ], LuzmoDashboardWebComponent);
2957
+ /*! Bundled license information:
2958
+
2959
+ @lit/reactive-element/decorators/custom-element.js:
2960
+ (**
2961
+ * @license
2962
+ * Copyright 2017 Google LLC
2963
+ * SPDX-License-Identifier: BSD-3-Clause
2964
+ *)
2965
+
2966
+ @lit/reactive-element/css-tag.js:
2967
+ (**
2968
+ * @license
2969
+ * Copyright 2019 Google LLC
2970
+ * SPDX-License-Identifier: BSD-3-Clause
2971
+ *)
2972
+
2973
+ @lit/reactive-element/reactive-element.js:
2974
+ (**
2975
+ * @license
2976
+ * Copyright 2017 Google LLC
2977
+ * SPDX-License-Identifier: BSD-3-Clause
2978
+ *)
2979
+
2980
+ @lit/reactive-element/decorators/property.js:
2981
+ (**
2982
+ * @license
2983
+ * Copyright 2017 Google LLC
2984
+ * SPDX-License-Identifier: BSD-3-Clause
2985
+ *)
2986
+
2987
+ @lit/reactive-element/decorators/state.js:
2988
+ (**
2989
+ * @license
2990
+ * Copyright 2017 Google LLC
2991
+ * SPDX-License-Identifier: BSD-3-Clause
2992
+ *)
2993
+
2994
+ @lit/reactive-element/decorators/event-options.js:
2995
+ (**
2996
+ * @license
2997
+ * Copyright 2017 Google LLC
2998
+ * SPDX-License-Identifier: BSD-3-Clause
2999
+ *)
3000
+
3001
+ @lit/reactive-element/decorators/base.js:
3002
+ (**
3003
+ * @license
3004
+ * Copyright 2017 Google LLC
3005
+ * SPDX-License-Identifier: BSD-3-Clause
3006
+ *)
3007
+
3008
+ @lit/reactive-element/decorators/query.js:
3009
+ (**
3010
+ * @license
3011
+ * Copyright 2017 Google LLC
3012
+ * SPDX-License-Identifier: BSD-3-Clause
3013
+ *)
3014
+
3015
+ @lit/reactive-element/decorators/query-all.js:
3016
+ (**
3017
+ * @license
3018
+ * Copyright 2017 Google LLC
3019
+ * SPDX-License-Identifier: BSD-3-Clause
3020
+ *)
3021
+
3022
+ @lit/reactive-element/decorators/query-async.js:
3023
+ (**
3024
+ * @license
3025
+ * Copyright 2017 Google LLC
3026
+ * SPDX-License-Identifier: BSD-3-Clause
3027
+ *)
3028
+
3029
+ @lit/reactive-element/decorators/query-assigned-elements.js:
3030
+ (**
3031
+ * @license
3032
+ * Copyright 2021 Google LLC
3033
+ * SPDX-License-Identifier: BSD-3-Clause
3034
+ *)
3035
+
3036
+ @lit/reactive-element/decorators/query-assigned-nodes.js:
3037
+ (**
3038
+ * @license
3039
+ * Copyright 2017 Google LLC
3040
+ * SPDX-License-Identifier: BSD-3-Clause
3041
+ *)
3042
+
3043
+ lit-html/lit-html.js:
3044
+ (**
3045
+ * @license
3046
+ * Copyright 2017 Google LLC
3047
+ * SPDX-License-Identifier: BSD-3-Clause
3048
+ *)
3049
+
3050
+ lit-element/lit-element.js:
3051
+ (**
3052
+ * @license
3053
+ * Copyright 2017 Google LLC
3054
+ * SPDX-License-Identifier: BSD-3-Clause
3055
+ *)
3056
+
3057
+ lit-html/is-server.js:
3058
+ (**
3059
+ * @license
3060
+ * Copyright 2022 Google LLC
3061
+ * SPDX-License-Identifier: BSD-3-Clause
3062
+ *)
3063
+
3064
+ lit-html/directive.js:
3065
+ (**
3066
+ * @license
3067
+ * Copyright 2017 Google LLC
3068
+ * SPDX-License-Identifier: BSD-3-Clause
3069
+ *)
3070
+
3071
+ lit-html/directives/style-map.js:
3072
+ (**
3073
+ * @license
3074
+ * Copyright 2018 Google LLC
3075
+ * SPDX-License-Identifier: BSD-3-Clause
3076
+ *)
3077
+ */
3078
+ if (typeof module.exports == "object" && typeof exports == "object") {
3079
+ var __cp = (to, from, except, desc) => {
3080
+ if ((from && typeof from === "object") || typeof from === "function") {
3081
+ for (let key of Object.getOwnPropertyNames(from)) {
3082
+ if (!Object.prototype.hasOwnProperty.call(to, key) && key !== except)
3083
+ Object.defineProperty(to, key, {
3084
+ get: () => from[key],
3085
+ enumerable: !(desc = Object.getOwnPropertyDescriptor(from, key)) || desc.enumerable,
3086
+ });
3087
+ }
3088
+ }
3089
+ return to;
3090
+ };
3091
+ module.exports = __cp(module.exports, exports);
3092
+ }
3093
+ return module.exports;
3094
+ }))