@luzmo/embed 5.0.1 → 5.0.3

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