@record-evolution/widget-overlay 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,650 @@
1
+ /* @license Copyright (c) 2023 Record Evolution GmbH. All rights reserved.*/
2
+ import { n as n$1, T, E, Z, i as i$2, _ as __decorate, a as i$3, x } from './property-v0slTy4i.js';
3
+
4
+ /**
5
+ * @license
6
+ * Copyright 2017 Google LLC
7
+ * SPDX-License-Identifier: BSD-3-Clause
8
+ */
9
+ function r$1(r) {
10
+ return n$1({
11
+ ...r,
12
+ state: !0,
13
+ attribute: !1
14
+ });
15
+ }
16
+
17
+ /**
18
+ * @license
19
+ * Copyright 2017 Google LLC
20
+ * SPDX-License-Identifier: BSD-3-Clause
21
+ */
22
+ const e$3 = (e, t, c) => (c.configurable = !0, c.enumerable = !0, Reflect.decorate && "object" != typeof t && Object.defineProperty(e, t, c), c);
23
+
24
+ /**
25
+ * @license
26
+ * Copyright 2017 Google LLC
27
+ * SPDX-License-Identifier: BSD-3-Clause
28
+ */
29
+ function e$2(e, r) {
30
+ return (n, s, i) => {
31
+ const o = t => t.renderRoot?.querySelector(e) ?? null;
32
+ return e$3(n, s, {
33
+ get() {
34
+ return o(this);
35
+ }
36
+ });
37
+ };
38
+ }
39
+
40
+ /**
41
+ * @license
42
+ * Copyright 2017 Google LLC
43
+ * SPDX-License-Identifier: BSD-3-Clause
44
+ */
45
+ const t$2 = {
46
+ ATTRIBUTE: 1,
47
+ CHILD: 2,
48
+ PROPERTY: 3,
49
+ BOOLEAN_ATTRIBUTE: 4,
50
+ EVENT: 5,
51
+ ELEMENT: 6
52
+ },
53
+ e$1 = t => (...e) => ({
54
+ _$litDirective$: t,
55
+ values: e
56
+ });
57
+ let i$1 = class i {
58
+ constructor(t) {}
59
+ get _$AU() {
60
+ return this._$AM._$AU;
61
+ }
62
+ _$AT(t, e, i) {
63
+ this._$Ct = t, this._$AM = e, this._$Ci = i;
64
+ }
65
+ _$AS(t, e) {
66
+ return this.update(t, e);
67
+ }
68
+ update(t, e) {
69
+ return this.render(...e);
70
+ }
71
+ };
72
+
73
+ /**
74
+ * @license
75
+ * Copyright 2018 Google LLC
76
+ * SPDX-License-Identifier: BSD-3-Clause
77
+ */
78
+ const n = "important",
79
+ i = " !" + n,
80
+ o$1 = e$1(class extends i$1 {
81
+ constructor(t) {
82
+ if (super(t), t.type !== t$2.ATTRIBUTE || "style" !== t.name || t.strings?.length > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
83
+ }
84
+ render(t) {
85
+ return Object.keys(t).reduce((e, r) => {
86
+ const s = t[r];
87
+ return null == s ? e : e + `${r = r.includes("-") ? r : r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s};`;
88
+ }, "");
89
+ }
90
+ update(e, [r]) {
91
+ const {
92
+ style: s
93
+ } = e.element;
94
+ if (void 0 === this.ft) return this.ft = new Set(Object.keys(r)), this.render(r);
95
+ for (const t of this.ft) null == r[t] && (this.ft.delete(t), t.includes("-") ? s.removeProperty(t) : s[t] = null);
96
+ for (const t in r) {
97
+ const e = r[t];
98
+ if (null != e) {
99
+ this.ft.add(t);
100
+ const r = "string" == typeof e && e.endsWith(i);
101
+ t.includes("-") || r ? s.setProperty(t, r ? e.slice(0, -11) : e, r ? n : "") : s[t] = e;
102
+ }
103
+ }
104
+ return T;
105
+ }
106
+ });
107
+
108
+ /**
109
+ * @license
110
+ * Copyright 2017 Google LLC
111
+ * SPDX-License-Identifier: BSD-3-Clause
112
+ */
113
+ class e extends i$1 {
114
+ constructor(i) {
115
+ if (super(i), this.it = E, i.type !== t$2.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
116
+ }
117
+ render(r) {
118
+ if (r === E || null == r) return this._t = void 0, this.it = r;
119
+ if (r === T) return r;
120
+ if ("string" != typeof r) throw Error(this.constructor.directiveName + "() called with a non-string value");
121
+ if (r === this.it) return this._t;
122
+ this.it = r;
123
+ const s = [r];
124
+ return s.raw = s, this._t = {
125
+ _$litType$: this.constructor.resultType,
126
+ strings: s,
127
+ values: []
128
+ };
129
+ }
130
+ }
131
+ e.directiveName = "unsafeHTML", e.resultType = 1;
132
+
133
+ /**
134
+ * @license
135
+ * Copyright 2017 Google LLC
136
+ * SPDX-License-Identifier: BSD-3-Clause
137
+ */
138
+ let t$1 = class t extends e {};
139
+ t$1.directiveName = "unsafeSVG", t$1.resultType = 2;
140
+ const o = e$1(t$1);
141
+
142
+ /**
143
+ * @license
144
+ * Copyright 2020 Google LLC
145
+ * SPDX-License-Identifier: BSD-3-Clause
146
+ */
147
+ const {
148
+ I: t
149
+ } = Z,
150
+ s = () => document.createComment(""),
151
+ r = (o, i, n) => {
152
+ const e = o._$AA.parentNode,
153
+ l = void 0 === i ? o._$AB : i._$AA;
154
+ if (void 0 === n) {
155
+ const i = e.insertBefore(s(), l),
156
+ c = e.insertBefore(s(), l);
157
+ n = new t(i, c, o, o.options);
158
+ } else {
159
+ const t = n._$AB.nextSibling,
160
+ i = n._$AM,
161
+ c = i !== o;
162
+ if (c) {
163
+ let t;
164
+ n._$AQ?.(o), n._$AM = o, void 0 !== n._$AP && (t = o._$AU) !== i._$AU && n._$AP(t);
165
+ }
166
+ if (t !== l || c) {
167
+ let o = n._$AA;
168
+ for (; o !== t;) {
169
+ const t = o.nextSibling;
170
+ e.insertBefore(o, l), o = t;
171
+ }
172
+ }
173
+ }
174
+ return n;
175
+ },
176
+ v = (o, t, i = o) => (o._$AI(t, i), o),
177
+ u$1 = {},
178
+ m = (o, t = u$1) => o._$AH = t,
179
+ p = o => o._$AH,
180
+ M = o => {
181
+ o._$AP?.(!1, !0);
182
+ let t = o._$AA;
183
+ const i = o._$AB.nextSibling;
184
+ for (; t !== i;) {
185
+ const o = t.nextSibling;
186
+ t.remove(), t = o;
187
+ }
188
+ };
189
+
190
+ /**
191
+ * @license
192
+ * Copyright 2017 Google LLC
193
+ * SPDX-License-Identifier: BSD-3-Clause
194
+ */
195
+ const u = (e, s, t) => {
196
+ const r = new Map();
197
+ for (let l = s; l <= t; l++) r.set(e[l], l);
198
+ return r;
199
+ },
200
+ c = e$1(class extends i$1 {
201
+ constructor(e) {
202
+ if (super(e), e.type !== t$2.CHILD) throw Error("repeat() can only be used in text expressions");
203
+ }
204
+ dt(e, s, t) {
205
+ let r;
206
+ void 0 === t ? t = s : void 0 !== s && (r = s);
207
+ const l = [],
208
+ o = [];
209
+ let i = 0;
210
+ for (const s of e) l[i] = r ? r(s, i) : i, o[i] = t(s, i), i++;
211
+ return {
212
+ values: o,
213
+ keys: l
214
+ };
215
+ }
216
+ render(e, s, t) {
217
+ return this.dt(e, s, t).values;
218
+ }
219
+ update(s, [t, r$1, c]) {
220
+ const d = p(s),
221
+ {
222
+ values: p$1,
223
+ keys: a
224
+ } = this.dt(t, r$1, c);
225
+ if (!Array.isArray(d)) return this.ut = a, p$1;
226
+ const h = this.ut ??= [],
227
+ v$1 = [];
228
+ let m$1,
229
+ y,
230
+ x = 0,
231
+ j = d.length - 1,
232
+ k = 0,
233
+ w = p$1.length - 1;
234
+ for (; x <= j && k <= w;) if (null === d[x]) x++;else if (null === d[j]) j--;else if (h[x] === a[k]) v$1[k] = v(d[x], p$1[k]), x++, k++;else if (h[j] === a[w]) v$1[w] = v(d[j], p$1[w]), j--, w--;else if (h[x] === a[w]) v$1[w] = v(d[x], p$1[w]), r(s, v$1[w + 1], d[x]), x++, w--;else if (h[j] === a[k]) v$1[k] = v(d[j], p$1[k]), r(s, d[x], d[j]), j--, k++;else if (void 0 === m$1 && (m$1 = u(a, k, w), y = u(h, x, j)), m$1.has(h[x])) {
235
+ if (m$1.has(h[j])) {
236
+ const e = y.get(a[k]),
237
+ t = void 0 !== e ? d[e] : null;
238
+ if (null === t) {
239
+ const e = r(s, d[x]);
240
+ v(e, p$1[k]), v$1[k] = e;
241
+ } else v$1[k] = v(t, p$1[k]), r(s, d[x], t), d[e] = null;
242
+ k++;
243
+ } else M(d[j]), j--;
244
+ } else M(d[x]), x++;
245
+ for (; k <= w;) {
246
+ const e = r(s, v$1[w + 1]);
247
+ v(e, p$1[k]), v$1[k++] = e;
248
+ }
249
+ for (; x <= j;) {
250
+ const e = d[x++];
251
+ null !== e && M(e);
252
+ }
253
+ return this.ut = a, m(s, v$1), T;
254
+ }
255
+ });
256
+
257
+ class WidgetImage extends i$3 {
258
+ constructor() {
259
+ super();
260
+ this.renderMap = {
261
+ progress: this.renderProgress.bind(this),
262
+ text: this.renderText.bind(this),
263
+ switch: this.renderSwitch.bind(this),
264
+ html: this.renderHtml.bind(this)
265
+ };
266
+ this.version = '1.0.1';
267
+ this.getModifier = this.getModifier.bind(this);
268
+ }
269
+ update(changedProperties) {
270
+ if (changedProperties.has('inputData')) {
271
+ this.transform();
272
+ if (!this.modifier)
273
+ this.getModifier();
274
+ }
275
+ if (changedProperties.has('theme')) {
276
+ this.registerTheme(this.theme);
277
+ }
278
+ super.update(changedProperties);
279
+ }
280
+ firstUpdated(_changedProperties) {
281
+ this.registerTheme(this.theme);
282
+ const ro = new ResizeObserver(this.getModifier);
283
+ ro.observe(this);
284
+ }
285
+ registerTheme(theme) {
286
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
287
+ const cssTextColor = getComputedStyle(this).getPropertyValue('--re-text-color').trim();
288
+ const cssBgColor = getComputedStyle(this).getPropertyValue('--re-tile-background-color').trim();
289
+ this.themeBgColor = cssBgColor || ((_b = (_a = this.theme) === null || _a === void 0 ? void 0 : _a.theme_object) === null || _b === void 0 ? void 0 : _b.backgroundColor);
290
+ this.themeTitleColor = cssTextColor || ((_f = (_e = (_d = (_c = this.theme) === null || _c === void 0 ? void 0 : _c.theme_object) === null || _d === void 0 ? void 0 : _d.title) === null || _e === void 0 ? void 0 : _e.textStyle) === null || _f === void 0 ? void 0 : _f.color);
291
+ this.themeSubtitleColor =
292
+ cssTextColor || ((_k = (_j = (_h = (_g = this.theme) === null || _g === void 0 ? void 0 : _g.theme_object) === null || _h === void 0 ? void 0 : _h.title) === null || _j === void 0 ? void 0 : _j.subtextStyle) === null || _k === void 0 ? void 0 : _k.color) || this.themeTitleColor;
293
+ }
294
+ handleFileChange(ev) {
295
+ var _a;
296
+ const input = ev.target;
297
+ const file = (_a = input.files) === null || _a === void 0 ? void 0 : _a[0];
298
+ if (!file)
299
+ return;
300
+ // Revoke previous object URL
301
+ if (this.previewUrl)
302
+ URL.revokeObjectURL(this.previewUrl);
303
+ this.previewUrl = URL.createObjectURL(file);
304
+ this.dispatchEvent(new CustomEvent('overlay-file-selected', {
305
+ detail: { file, name: file.name, size: file.size, type: file.type, url: this.previewUrl },
306
+ bubbles: true,
307
+ composed: true
308
+ }));
309
+ }
310
+ transform() {
311
+ var _a, _b, _c;
312
+ this.inlineSvg = undefined;
313
+ if (!((_a = this.inputData) === null || _a === void 0 ? void 0 : _a.image)) {
314
+ this.previewUrl = undefined;
315
+ return;
316
+ }
317
+ const raw = this.inputData.image.trim();
318
+ // Dynamically load progress bar element if needed
319
+ if ((_c = (_b = this.inputData) === null || _b === void 0 ? void 0 : _b.overlays) === null || _c === void 0 ? void 0 : _c.some((o) => o.layerType === 'progress')) {
320
+ import('./linear-progress.js');
321
+ }
322
+ // Inline SVG markup (optionally starting with an XML declaration or other preamble)
323
+ const trimmed = raw.replace(/^\uFEFF/, '').trimStart();
324
+ // Find the actual <svg ...>...</svg> block even if preceded by <?xml ...?> or <!DOCTYPE ...>
325
+ const svgBlockMatch = trimmed.match(/<svg[\s\S]*?<\/svg>/i);
326
+ if (svgBlockMatch) {
327
+ this.inlineSvg = svgBlockMatch[0].trim();
328
+ this.previewUrl = undefined;
329
+ return;
330
+ }
331
+ // Full data URL (already encoded)
332
+ if (/^data:image\/svg\+xml[,;]/.test(raw)) {
333
+ // It's an SVG data URL; we could theoretically decode, but safer to keep as src
334
+ this.previewUrl = raw;
335
+ return;
336
+ }
337
+ if (/^data:image\/[a-zA-Z.+-]+;base64,/.test(raw)) {
338
+ this.previewUrl = raw;
339
+ return;
340
+ }
341
+ // Bare base64 string (heuristic)
342
+ if (/^[A-Za-z0-9+/]+=*$/.test(raw) && raw.length > 100) {
343
+ this.previewUrl = `data:image/*;base64,${raw}`;
344
+ return;
345
+ }
346
+ // Absolute URL
347
+ try {
348
+ new URL(raw);
349
+ this.previewUrl = raw;
350
+ return;
351
+ }
352
+ catch (_d) {
353
+ // Relative path
354
+ if (/^([./]|\/)/.test(raw)) {
355
+ this.previewUrl = raw;
356
+ return;
357
+ }
358
+ }
359
+ // Fallback
360
+ this.previewUrl = undefined;
361
+ }
362
+ async getModifier() {
363
+ var _a;
364
+ if (!this.baseLayer)
365
+ return;
366
+ const rect = this.baseLayer.getBoundingClientRect();
367
+ if (!rect)
368
+ return;
369
+ const containerRect = (_a = this.baseLayer.parentElement) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
370
+ if (!containerRect)
371
+ return;
372
+ let intrinsicWidth;
373
+ let intrinsicHeight;
374
+ if (this.baseLayer instanceof HTMLImageElement) {
375
+ // For <img>
376
+ intrinsicWidth = this.baseLayer.naturalWidth;
377
+ intrinsicHeight = this.baseLayer.naturalHeight;
378
+ }
379
+ else {
380
+ const innerSvg = this.baseLayer.querySelector('svg');
381
+ if (innerSvg) {
382
+ // For <svg>
383
+ const viewBox = innerSvg.viewBox.baseVal;
384
+ console.log(viewBox);
385
+ if (viewBox && viewBox.width > 0 && viewBox.height > 0) {
386
+ intrinsicWidth = viewBox.width;
387
+ intrinsicHeight = viewBox.height;
388
+ }
389
+ else {
390
+ // fallback to width/height attributes if set
391
+ const widthAttr = this.baseLayer.getAttribute('width');
392
+ const heightAttr = this.baseLayer.getAttribute('height');
393
+ if (widthAttr && heightAttr) {
394
+ intrinsicWidth = parseFloat(widthAttr);
395
+ intrinsicHeight = parseFloat(heightAttr);
396
+ }
397
+ }
398
+ }
399
+ }
400
+ if (!intrinsicWidth || !intrinsicHeight)
401
+ return;
402
+ // Actual visible area of the image/svg
403
+ const scaleX = rect.width / intrinsicWidth;
404
+ const scaleY = rect.height / intrinsicHeight;
405
+ const scale = Math.min(scaleX, scaleY);
406
+ const visibleWidth = intrinsicWidth * scale;
407
+ const visibleHeight = intrinsicHeight * scale;
408
+ const xOffset = (containerRect.width - visibleWidth) / 2;
409
+ const yOffset = (containerRect.height - visibleHeight) / 2;
410
+ this.modifier = { scaler: scale, xOffset, yOffset, visibleWidth, visibleHeight };
411
+ }
412
+ getOverlayItemPosition(relX, relY, modifier) {
413
+ return {
414
+ left: modifier.xOffset + relX * modifier.visibleWidth,
415
+ top: modifier.yOffset + relY * modifier.visibleHeight
416
+ };
417
+ }
418
+ renderText(_overlay, item, modifier) {
419
+ var _a, _b, _c, _d, _e, _f, _g;
420
+ const overlay = _overlay;
421
+ const pos = this.getOverlayItemPosition(item.relXPos, item.relYPos, modifier);
422
+ if (!pos)
423
+ return E;
424
+ const precision = (_b = (_a = overlay.textStyle) === null || _a === void 0 ? void 0 : _a.precision) !== null && _b !== void 0 ? _b : 1;
425
+ let value = item.data;
426
+ const numericValue = Number(value);
427
+ let color = '#333';
428
+ if (!Number.isNaN(numericValue)) {
429
+ if (typeof precision === 'number' && precision >= 0) {
430
+ value = numericValue.toFixed(precision);
431
+ const sectionIndex = (_d = (_c = overlay.sections) === null || _c === void 0 ? void 0 : _c.sectionLimits.findIndex((limit) => numericValue <= limit)) !== null && _d !== void 0 ? _d : -2;
432
+ color = (_f = (sectionIndex >= 1 ? (_e = overlay.sections) === null || _e === void 0 ? void 0 : _e.colors[sectionIndex - 1] : '#333')) !== null && _f !== void 0 ? _f : '#333';
433
+ }
434
+ }
435
+ const styles = {
436
+ 'font-size': ((_g = overlay.textStyle.fontSize) !== null && _g !== void 0 ? _g : 14) * modifier.scaler + 'px',
437
+ color,
438
+ 'background-color': overlay.textStyle.backgroundColor,
439
+ 'font-weight': overlay.textStyle.fontWeight,
440
+ left: `${pos.left}px`,
441
+ top: `${pos.top}px`,
442
+ 'border-radius': 10 * modifier.scaler + 'px',
443
+ 'transform-origin': '50% 50%',
444
+ transform: `translate(-50%, -50%)`,
445
+ padding: `${6 * modifier.scaler}px ${12 * modifier.scaler}px`
446
+ };
447
+ return x ` <div class="overlay-item" style=${o$1(styles)}>${item.title} ${value}</div> `;
448
+ }
449
+ renderProgress(_overlay, item, modifier) {
450
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
451
+ const overlay = _overlay;
452
+ const pos = this.getOverlayItemPosition(item.relXPos, item.relYPos, modifier);
453
+ if (!pos)
454
+ return E;
455
+ const sectionIndex = (_b = (_a = overlay.sections) === null || _a === void 0 ? void 0 : _a.sectionLimits.findIndex((limit) => Number(item.data) <= limit)) !== null && _b !== void 0 ? _b : -2;
456
+ const sectionColor = sectionIndex >= 1 ? (_c = overlay.sections) === null || _c === void 0 ? void 0 : _c.colors[sectionIndex - 1] : undefined;
457
+ const styles = {
458
+ '--progress-color': sectionColor !== null && sectionColor !== void 0 ? sectionColor : '#333',
459
+ '--progress-width': ((_e = (_d = overlay.progressStyle) === null || _d === void 0 ? void 0 : _d.width) !== null && _e !== void 0 ? _e : 10) * modifier.scaler + 'px',
460
+ '--progress-height': ((_g = (_f = overlay.progressStyle) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : 100) * modifier.scaler + 'px',
461
+ '--progress-background': (_j = (_h = overlay.progressStyle) === null || _h === void 0 ? void 0 : _h.backgroundColor) !== null && _j !== void 0 ? _j : '#fff',
462
+ 'border-radius': 10 * modifier.scaler + 'px',
463
+ 'transform-origin': '50% 50%',
464
+ transform: `translate(-50%, -50%) rotate(${(_l = (_k = overlay.progressStyle) === null || _k === void 0 ? void 0 : _k.rotate) !== null && _l !== void 0 ? _l : 0}deg)`,
465
+ left: `${pos.left}px`,
466
+ top: `${pos.top}px`
467
+ };
468
+ // Derive percentage based on item.data within overlay.sections min/max.
469
+ // Supports several possible property names; falls back to sectionLimits array.
470
+ const rawValue = Number(item.data);
471
+ const sections = (_m = overlay.sections) !== null && _m !== void 0 ? _m : {};
472
+ const min = Math.min(...sections.sectionLimits.map(Number));
473
+ const max = Math.max(...sections.sectionLimits.map(Number));
474
+ let percent = max === min ? 0 : (rawValue - min) / (max - min);
475
+ percent = Math.min(1, Math.max(0, percent));
476
+ // percent now holds the normalized 0-100 percentage for rawValue
477
+ return x ` <linear-progress .value=${percent} style=${o$1(styles)}></linear-progress> `;
478
+ }
479
+ renderHtml(_overlay, item, modifier) {
480
+ return x ` <div>${item.title}: ${item.data}</div> `;
481
+ }
482
+ renderSwitch(_overlay, item, modifier) {
483
+ return x ` <div>${item.title}: ${item.data}</div> `;
484
+ }
485
+ renderLayer(overlay) {
486
+ var _a;
487
+ const modifier = this.modifier;
488
+ if (!modifier)
489
+ return E;
490
+ return x ` ${c((_a = overlay.items) !== null && _a !== void 0 ? _a : [], (item) => item.title, (item) => {
491
+ return x ` ${this.renderMap[overlay.layerType](overlay, item, modifier)} `;
492
+ })}`;
493
+ }
494
+ render() {
495
+ var _a, _b, _c, _d, _e, _f;
496
+ const hasImage = !!this.inlineSvg || !!this.previewUrl;
497
+ return x `
498
+ <div class="wrapper" style="background-color: ${this.themeBgColor}">
499
+ <h3 class="paging" ?active=${(_a = this.inputData) === null || _a === void 0 ? void 0 : _a.title} style="color: ${this.themeTitleColor}">
500
+ ${(_b = this.inputData) === null || _b === void 0 ? void 0 : _b.title}
501
+ </h3>
502
+ <p
503
+ class="paging"
504
+ ?active=${(_c = this.inputData) === null || _c === void 0 ? void 0 : _c.subTitle}
505
+ style="color: ${this.themeSubtitleColor}"
506
+ >
507
+ ${(_d = this.inputData) === null || _d === void 0 ? void 0 : _d.subTitle}
508
+ </p>
509
+
510
+ <div class="paging no-data" ?active=${!hasImage}>No Image</div>
511
+ <div class="img-container paging" ?active="${hasImage}">
512
+ ${this.inlineSvg
513
+ ? x `<div id="base-layer" class="svg-wrapper">${o(this.inlineSvg)}</div>`
514
+ : this.previewUrl
515
+ ? x `<img
516
+ id="base-layer"
517
+ @load="${this.getModifier}"
518
+ src="${this.previewUrl}"
519
+ alt="Image Widget"
520
+ />`
521
+ : ''}
522
+ ${c((_f = (_e = this.inputData) === null || _e === void 0 ? void 0 : _e.overlays) !== null && _f !== void 0 ? _f : [], (o) => o.layerName, (o) => x `
523
+ <div class="overlay" type="${o.layerType}" name="${o.layerName}">
524
+ ${this.renderLayer(o)}
525
+ </div>
526
+ `)}
527
+ </div>
528
+ </div>
529
+ `;
530
+ }
531
+ }
532
+ WidgetImage.styles = i$2 `
533
+ :host {
534
+ display: block;
535
+ font-family: sans-serif;
536
+ box-sizing: border-box;
537
+ margin: auto;
538
+ }
539
+
540
+ .paging:not([active]) {
541
+ display: none !important;
542
+ }
543
+
544
+ .wrapper {
545
+ display: flex;
546
+ flex-direction: column;
547
+ height: 100%;
548
+ width: 100%;
549
+ padding: 16px;
550
+ box-sizing: border-box;
551
+ }
552
+
553
+ .svg-wrapper {
554
+ width: 100%;
555
+ height: 100%;
556
+ overflow: hidden;
557
+ position: relative;
558
+ }
559
+
560
+ .svg-wrapper svg {
561
+ width: 100%;
562
+ height: 100%;
563
+ display: block;
564
+ /* preserveAspectRatio inside SVG handles "contain"-like scaling */
565
+ }
566
+
567
+ h3 {
568
+ margin: 0;
569
+ max-width: 300px;
570
+ overflow: hidden;
571
+ text-overflow: ellipsis;
572
+ white-space: nowrap;
573
+ }
574
+ p {
575
+ margin: 10px 0 0 0;
576
+ max-width: 300px;
577
+ font-size: 14px;
578
+ line-height: 17px;
579
+ overflow: hidden;
580
+ text-overflow: ellipsis;
581
+ white-space: nowrap;
582
+ }
583
+
584
+ .img-container {
585
+ flex: 1;
586
+ box-sizing: border-box;
587
+ overflow: hidden;
588
+ position: relative;
589
+ }
590
+
591
+ img {
592
+ width: 100%; /* Set the width of the container */
593
+ height: 100%;
594
+ object-fit: contain;
595
+ }
596
+ .no-data {
597
+ font-size: 20px;
598
+ display: flex;
599
+ height: 100%;
600
+ width: 100%;
601
+ text-align: center;
602
+ align-items: center;
603
+ justify-content: center;
604
+ }
605
+
606
+ .overlay {
607
+ position: absolute;
608
+ top: 0;
609
+ left: 0;
610
+ right: 0;
611
+ bottom: 0;
612
+ pointer-events: none;
613
+ }
614
+
615
+ .overlay-item {
616
+ position: absolute;
617
+ pointer-events: auto;
618
+ }
619
+ `;
620
+ __decorate([
621
+ n$1({ type: Object })
622
+ ], WidgetImage.prototype, "inputData", void 0);
623
+ __decorate([
624
+ n$1({ type: Object })
625
+ ], WidgetImage.prototype, "theme", void 0);
626
+ __decorate([
627
+ r$1()
628
+ ], WidgetImage.prototype, "themeBgColor", void 0);
629
+ __decorate([
630
+ r$1()
631
+ ], WidgetImage.prototype, "themeTitleColor", void 0);
632
+ __decorate([
633
+ r$1()
634
+ ], WidgetImage.prototype, "themeSubtitleColor", void 0);
635
+ __decorate([
636
+ r$1()
637
+ ], WidgetImage.prototype, "previewUrl", void 0);
638
+ __decorate([
639
+ r$1()
640
+ ], WidgetImage.prototype, "inlineSvg", void 0);
641
+ __decorate([
642
+ r$1()
643
+ ], WidgetImage.prototype, "modifier", void 0);
644
+ __decorate([
645
+ e$2('#base-layer')
646
+ ], WidgetImage.prototype, "baseLayer", void 0);
647
+ window.customElements.define('widget-overlay-1.0.1', WidgetImage);
648
+
649
+ export { WidgetImage };
650
+ //# sourceMappingURL=widget-overlay.js.map