pollcatch 1.0.1 → 1.0.2
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/package.json +1 -1
- package/pc.js +808 -777
package/pc.js
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
import { css as H, LitElement as mt, html as l, nothing as h } from "lit";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright 2017 Google LLC
|
|
5
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/
|
|
7
|
-
const B = (e) => (t, s) => {
|
|
8
|
-
s !== void 0 ? s.addInitializer(() => {
|
|
9
|
-
customElements.define(e, t);
|
|
10
|
-
}) : customElements.define(e, t);
|
|
11
|
-
};
|
|
12
1
|
/**
|
|
13
2
|
* @license
|
|
14
3
|
* Copyright 2019 Google LLC
|
|
15
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
5
|
*/
|
|
17
|
-
const
|
|
18
|
-
let
|
|
6
|
+
const pt = globalThis, At = pt.ShadowRoot && (pt.ShadyCSS === void 0 || pt.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, _t = Symbol(), Dt = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
let pe = class {
|
|
19
8
|
constructor(t, s, i) {
|
|
20
|
-
if (this._$cssResult$ = !0, i !==
|
|
9
|
+
if (this._$cssResult$ = !0, i !== _t) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
21
10
|
this.cssText = t, this.t = s;
|
|
22
11
|
}
|
|
23
12
|
get styleSheet() {
|
|
@@ -25,7 +14,7 @@ let _e = class {
|
|
|
25
14
|
const s = this.t;
|
|
26
15
|
if (At && t === void 0) {
|
|
27
16
|
const i = s !== void 0 && s.length === 1;
|
|
28
|
-
i && (t =
|
|
17
|
+
i && (t = Dt.get(s)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && Dt.set(s, t));
|
|
29
18
|
}
|
|
30
19
|
return t;
|
|
31
20
|
}
|
|
@@ -33,26 +22,33 @@ let _e = class {
|
|
|
33
22
|
return this.cssText;
|
|
34
23
|
}
|
|
35
24
|
};
|
|
36
|
-
const
|
|
25
|
+
const Te = (e) => new pe(typeof e == "string" ? e : e + "", void 0, _t), B = (e, ...t) => {
|
|
26
|
+
const s = e.length === 1 ? e[0] : t.reduce((i, o, r) => i + ((a) => {
|
|
27
|
+
if (a._$cssResult$ === !0) return a.cssText;
|
|
28
|
+
if (typeof a == "number") return a;
|
|
29
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
|
+
})(o) + e[r + 1], e[0]);
|
|
31
|
+
return new pe(s, e, _t);
|
|
32
|
+
}, Me = (e, t) => {
|
|
37
33
|
if (At) e.adoptedStyleSheets = t.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);
|
|
38
34
|
else for (const s of t) {
|
|
39
|
-
const i = document.createElement("style"), o =
|
|
35
|
+
const i = document.createElement("style"), o = pt.litNonce;
|
|
40
36
|
o !== void 0 && i.setAttribute("nonce", o), i.textContent = s.cssText, e.appendChild(i);
|
|
41
37
|
}
|
|
42
|
-
},
|
|
38
|
+
}, Vt = At ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
|
|
43
39
|
let s = "";
|
|
44
40
|
for (const i of t.cssRules) s += i.cssText;
|
|
45
|
-
return
|
|
41
|
+
return Te(s);
|
|
46
42
|
})(e) : e;
|
|
47
43
|
/**
|
|
48
44
|
* @license
|
|
49
45
|
* Copyright 2017 Google LLC
|
|
50
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
47
|
*/
|
|
52
|
-
const { is:
|
|
48
|
+
const { is: ze, defineProperty: Ne, getOwnPropertyDescriptor: Ie, getOwnPropertyNames: Re, getOwnPropertySymbols: Ue, getPrototypeOf: Le } = Object, D = globalThis, Ht = D.trustedTypes, je = Ht ? Ht.emptyScript : "", ft = D.reactiveElementPolyfillSupport, st = (e, t) => e, ht = { toAttribute(e, t) {
|
|
53
49
|
switch (t) {
|
|
54
50
|
case Boolean:
|
|
55
|
-
e = e ?
|
|
51
|
+
e = e ? je : null;
|
|
56
52
|
break;
|
|
57
53
|
case Object:
|
|
58
54
|
case Array:
|
|
@@ -77,23 +73,23 @@ const { is: Me, defineProperty: Te, getOwnPropertyDescriptor: ze, getOwnProperty
|
|
|
77
73
|
}
|
|
78
74
|
}
|
|
79
75
|
return s;
|
|
80
|
-
} },
|
|
81
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
82
|
-
let
|
|
76
|
+
} }, Pt = (e, t) => !ze(e, t), Bt = { attribute: !0, type: String, converter: ht, reflect: !1, hasChanged: Pt };
|
|
77
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), D.litPropertyMetadata ?? (D.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
|
+
let J = class extends HTMLElement {
|
|
83
79
|
static addInitializer(t) {
|
|
84
80
|
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
85
81
|
}
|
|
86
82
|
static get observedAttributes() {
|
|
87
83
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
88
84
|
}
|
|
89
|
-
static createProperty(t, s =
|
|
85
|
+
static createProperty(t, s = Bt) {
|
|
90
86
|
if (s.state && (s.attribute = !1), this._$Ei(), this.elementProperties.set(t, s), !s.noAccessor) {
|
|
91
87
|
const i = Symbol(), o = this.getPropertyDescriptor(t, i, s);
|
|
92
|
-
o !== void 0 &&
|
|
88
|
+
o !== void 0 && Ne(this.prototype, t, o);
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
91
|
static getPropertyDescriptor(t, s, i) {
|
|
96
|
-
const { get: o, set: r } =
|
|
92
|
+
const { get: o, set: r } = Ie(this.prototype, t) ?? { get() {
|
|
97
93
|
return this[s];
|
|
98
94
|
}, set(a) {
|
|
99
95
|
this[s] = a;
|
|
@@ -106,17 +102,17 @@ let tt = class extends HTMLElement {
|
|
|
106
102
|
}, configurable: !0, enumerable: !0 };
|
|
107
103
|
}
|
|
108
104
|
static getPropertyOptions(t) {
|
|
109
|
-
return this.elementProperties.get(t) ??
|
|
105
|
+
return this.elementProperties.get(t) ?? Bt;
|
|
110
106
|
}
|
|
111
107
|
static _$Ei() {
|
|
112
108
|
if (this.hasOwnProperty(st("elementProperties"))) return;
|
|
113
|
-
const t =
|
|
109
|
+
const t = Le(this);
|
|
114
110
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
115
111
|
}
|
|
116
112
|
static finalize() {
|
|
117
113
|
if (this.hasOwnProperty(st("finalized"))) return;
|
|
118
114
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(st("properties"))) {
|
|
119
|
-
const s = this.properties, i = [...
|
|
115
|
+
const s = this.properties, i = [...Re(s), ...Ue(s)];
|
|
120
116
|
for (const o of i) this.createProperty(o, s[o]);
|
|
121
117
|
}
|
|
122
118
|
const t = this[Symbol.metadata];
|
|
@@ -135,8 +131,8 @@ let tt = class extends HTMLElement {
|
|
|
135
131
|
const s = [];
|
|
136
132
|
if (Array.isArray(t)) {
|
|
137
133
|
const i = new Set(t.flat(1 / 0).reverse());
|
|
138
|
-
for (const o of i) s.unshift(
|
|
139
|
-
} else t !== void 0 && s.push(
|
|
134
|
+
for (const o of i) s.unshift(Vt(o));
|
|
135
|
+
} else t !== void 0 && s.push(Vt(t));
|
|
140
136
|
return s;
|
|
141
137
|
}
|
|
142
138
|
static _$Eu(t, s) {
|
|
@@ -165,7 +161,7 @@ let tt = class extends HTMLElement {
|
|
|
165
161
|
}
|
|
166
162
|
createRenderRoot() {
|
|
167
163
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
168
|
-
return
|
|
164
|
+
return Me(t, this.constructor.elementStyles), t;
|
|
169
165
|
}
|
|
170
166
|
connectedCallback() {
|
|
171
167
|
var t;
|
|
@@ -190,7 +186,7 @@ let tt = class extends HTMLElement {
|
|
|
190
186
|
var r;
|
|
191
187
|
const i = this.constructor.elementProperties.get(t), o = this.constructor._$Eu(t, i);
|
|
192
188
|
if (o !== void 0 && i.reflect === !0) {
|
|
193
|
-
const a = (((r = i.converter) == null ? void 0 : r.toAttribute) !== void 0 ? i.converter :
|
|
189
|
+
const a = (((r = i.converter) == null ? void 0 : r.toAttribute) !== void 0 ? i.converter : ht).toAttribute(s, i.type);
|
|
194
190
|
this._$Em = t, a == null ? this.removeAttribute(o) : this.setAttribute(o, a), this._$Em = null;
|
|
195
191
|
}
|
|
196
192
|
}
|
|
@@ -198,13 +194,13 @@ let tt = class extends HTMLElement {
|
|
|
198
194
|
var r;
|
|
199
195
|
const i = this.constructor, o = i._$Eh.get(t);
|
|
200
196
|
if (o !== void 0 && this._$Em !== o) {
|
|
201
|
-
const a = i.getPropertyOptions(o), n = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((r = a.converter) == null ? void 0 : r.fromAttribute) !== void 0 ? a.converter :
|
|
197
|
+
const a = i.getPropertyOptions(o), n = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((r = a.converter) == null ? void 0 : r.fromAttribute) !== void 0 ? a.converter : ht;
|
|
202
198
|
this._$Em = o, this[o] = n.fromAttribute(s, a.type), this._$Em = null;
|
|
203
199
|
}
|
|
204
200
|
}
|
|
205
201
|
requestUpdate(t, s, i) {
|
|
206
202
|
if (t !== void 0) {
|
|
207
|
-
if (i ?? (i = this.constructor.getPropertyOptions(t)), !(i.hasChanged ??
|
|
203
|
+
if (i ?? (i = this.constructor.getPropertyOptions(t)), !(i.hasChanged ?? Pt)(this[t], s)) return;
|
|
208
204
|
this.P(t, s, i);
|
|
209
205
|
}
|
|
210
206
|
this.isUpdatePending === !1 && (this._$ES = this._$ET());
|
|
@@ -277,13 +273,294 @@ let tt = class extends HTMLElement {
|
|
|
277
273
|
firstUpdated(t) {
|
|
278
274
|
}
|
|
279
275
|
};
|
|
280
|
-
|
|
276
|
+
J.elementStyles = [], J.shadowRootOptions = { mode: "open" }, J[st("elementProperties")] = /* @__PURE__ */ new Map(), J[st("finalized")] = /* @__PURE__ */ new Map(), ft == null || ft({ ReactiveElement: J }), (D.reactiveElementVersions ?? (D.reactiveElementVersions = [])).push("2.0.4");
|
|
277
|
+
/**
|
|
278
|
+
* @license
|
|
279
|
+
* Copyright 2017 Google LLC
|
|
280
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
281
|
+
*/
|
|
282
|
+
const it = globalThis, ut = it.trustedTypes, Ft = ut ? ut.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, he = "$lit$", j = `lit$${Math.random().toFixed(9).slice(2)}$`, ue = "?" + j, De = `<${ue}>`, W = document, rt = () => W.createComment(""), at = (e) => e === null || typeof e != "object" && typeof e != "function", Ot = Array.isArray, Ve = (e) => Ot(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", gt = `[
|
|
283
|
+
\f\r]`, et = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, qt = /-->/g, Kt = />/g, K = RegExp(`>|${gt}(?:([^\\s"'>=/]+)(${gt}*=${gt}*(?:[^
|
|
284
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), Yt = /'/g, Gt = /"/g, me = /^(?:script|style|textarea|title)$/i, He = (e) => (t, ...s) => ({ _$litType$: e, strings: t, values: s }), l = He(1), H = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), Wt = /* @__PURE__ */ new WeakMap(), Y = W.createTreeWalker(W, 129);
|
|
285
|
+
function be(e, t) {
|
|
286
|
+
if (!Ot(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
287
|
+
return Ft !== void 0 ? Ft.createHTML(t) : t;
|
|
288
|
+
}
|
|
289
|
+
const Be = (e, t) => {
|
|
290
|
+
const s = e.length - 1, i = [];
|
|
291
|
+
let o, r = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = et;
|
|
292
|
+
for (let n = 0; n < s; n++) {
|
|
293
|
+
const c = e[n];
|
|
294
|
+
let h, m, b = -1, S = 0;
|
|
295
|
+
for (; S < c.length && (a.lastIndex = S, m = a.exec(c), m !== null); ) S = a.lastIndex, a === et ? m[1] === "!--" ? a = qt : m[1] !== void 0 ? a = Kt : m[2] !== void 0 ? (me.test(m[2]) && (o = RegExp("</" + m[2], "g")), a = K) : m[3] !== void 0 && (a = K) : a === K ? m[0] === ">" ? (a = o ?? et, b = -1) : m[1] === void 0 ? b = -2 : (b = a.lastIndex - m[2].length, h = m[1], a = m[3] === void 0 ? K : m[3] === '"' ? Gt : Yt) : a === Gt || a === Yt ? a = K : a === qt || a === Kt ? a = et : (a = K, o = void 0);
|
|
296
|
+
const L = a === K && e[n + 1].startsWith("/>") ? " " : "";
|
|
297
|
+
r += a === et ? c + De : b >= 0 ? (i.push(h), c.slice(0, b) + he + c.slice(b) + j + L) : c + j + (b === -2 ? n : L);
|
|
298
|
+
}
|
|
299
|
+
return [be(e, r + (e[s] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
|
|
300
|
+
};
|
|
301
|
+
let Ct = class fe {
|
|
302
|
+
constructor({ strings: t, _$litType$: s }, i) {
|
|
303
|
+
let o;
|
|
304
|
+
this.parts = [];
|
|
305
|
+
let r = 0, a = 0;
|
|
306
|
+
const n = t.length - 1, c = this.parts, [h, m] = Be(t, s);
|
|
307
|
+
if (this.el = fe.createElement(h, i), Y.currentNode = this.el.content, s === 2 || s === 3) {
|
|
308
|
+
const b = this.el.content.firstChild;
|
|
309
|
+
b.replaceWith(...b.childNodes);
|
|
310
|
+
}
|
|
311
|
+
for (; (o = Y.nextNode()) !== null && c.length < n; ) {
|
|
312
|
+
if (o.nodeType === 1) {
|
|
313
|
+
if (o.hasAttributes()) for (const b of o.getAttributeNames()) if (b.endsWith(he)) {
|
|
314
|
+
const S = m[a++], L = o.getAttribute(b).split(j), ct = /([.?@])?(.*)/.exec(S);
|
|
315
|
+
c.push({ type: 1, index: r, name: ct[2], strings: L, ctor: ct[1] === "." ? qe : ct[1] === "?" ? Ke : ct[1] === "@" ? Ye : mt }), o.removeAttribute(b);
|
|
316
|
+
} else b.startsWith(j) && (c.push({ type: 6, index: r }), o.removeAttribute(b));
|
|
317
|
+
if (me.test(o.tagName)) {
|
|
318
|
+
const b = o.textContent.split(j), S = b.length - 1;
|
|
319
|
+
if (S > 0) {
|
|
320
|
+
o.textContent = ut ? ut.emptyScript : "";
|
|
321
|
+
for (let L = 0; L < S; L++) o.append(b[L], rt()), Y.nextNode(), c.push({ type: 2, index: ++r });
|
|
322
|
+
o.append(b[S], rt());
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
} else if (o.nodeType === 8) if (o.data === ue) c.push({ type: 2, index: r });
|
|
326
|
+
else {
|
|
327
|
+
let b = -1;
|
|
328
|
+
for (; (b = o.data.indexOf(j, b + 1)) !== -1; ) c.push({ type: 7, index: r }), b += j.length - 1;
|
|
329
|
+
}
|
|
330
|
+
r++;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
static createElement(t, s) {
|
|
334
|
+
const i = W.createElement("template");
|
|
335
|
+
return i.innerHTML = t, i;
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
function X(e, t, s = e, i) {
|
|
339
|
+
var a, n;
|
|
340
|
+
if (t === H) return t;
|
|
341
|
+
let o = i !== void 0 ? (a = s._$Co) == null ? void 0 : a[i] : s._$Cl;
|
|
342
|
+
const r = at(t) ? void 0 : t._$litDirective$;
|
|
343
|
+
return (o == null ? void 0 : o.constructor) !== r && ((n = o == null ? void 0 : o._$AO) == null || n.call(o, !1), r === void 0 ? o = void 0 : (o = new r(e), o._$AT(e, s, i)), i !== void 0 ? (s._$Co ?? (s._$Co = []))[i] = o : s._$Cl = o), o !== void 0 && (t = X(e, o._$AS(e, t.values), o, i)), t;
|
|
344
|
+
}
|
|
345
|
+
let Fe = class {
|
|
346
|
+
constructor(t, s) {
|
|
347
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = s;
|
|
348
|
+
}
|
|
349
|
+
get parentNode() {
|
|
350
|
+
return this._$AM.parentNode;
|
|
351
|
+
}
|
|
352
|
+
get _$AU() {
|
|
353
|
+
return this._$AM._$AU;
|
|
354
|
+
}
|
|
355
|
+
u(t) {
|
|
356
|
+
const { el: { content: s }, parts: i } = this._$AD, o = ((t == null ? void 0 : t.creationScope) ?? W).importNode(s, !0);
|
|
357
|
+
Y.currentNode = o;
|
|
358
|
+
let r = Y.nextNode(), a = 0, n = 0, c = i[0];
|
|
359
|
+
for (; c !== void 0; ) {
|
|
360
|
+
if (a === c.index) {
|
|
361
|
+
let h;
|
|
362
|
+
c.type === 2 ? h = new nt(r, r.nextSibling, this, t) : c.type === 1 ? h = new c.ctor(r, c.name, c.strings, this, t) : c.type === 6 && (h = new Ge(r, this, t)), this._$AV.push(h), c = i[++n];
|
|
363
|
+
}
|
|
364
|
+
a !== (c == null ? void 0 : c.index) && (r = Y.nextNode(), a++);
|
|
365
|
+
}
|
|
366
|
+
return Y.currentNode = W, o;
|
|
367
|
+
}
|
|
368
|
+
p(t) {
|
|
369
|
+
let s = 0;
|
|
370
|
+
for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, s), s += i.strings.length - 2) : i._$AI(t[s])), s++;
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
class nt {
|
|
374
|
+
get _$AU() {
|
|
375
|
+
var t;
|
|
376
|
+
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
|
377
|
+
}
|
|
378
|
+
constructor(t, s, i, o) {
|
|
379
|
+
this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = t, this._$AB = s, this._$AM = i, this.options = o, this._$Cv = (o == null ? void 0 : o.isConnected) ?? !0;
|
|
380
|
+
}
|
|
381
|
+
get parentNode() {
|
|
382
|
+
let t = this._$AA.parentNode;
|
|
383
|
+
const s = this._$AM;
|
|
384
|
+
return s !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = s.parentNode), t;
|
|
385
|
+
}
|
|
386
|
+
get startNode() {
|
|
387
|
+
return this._$AA;
|
|
388
|
+
}
|
|
389
|
+
get endNode() {
|
|
390
|
+
return this._$AB;
|
|
391
|
+
}
|
|
392
|
+
_$AI(t, s = this) {
|
|
393
|
+
t = X(this, t, s), at(t) ? t === d || t == null || t === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : t !== this._$AH && t !== H && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Ve(t) ? this.k(t) : this._(t);
|
|
394
|
+
}
|
|
395
|
+
O(t) {
|
|
396
|
+
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
397
|
+
}
|
|
398
|
+
T(t) {
|
|
399
|
+
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
400
|
+
}
|
|
401
|
+
_(t) {
|
|
402
|
+
this._$AH !== d && at(this._$AH) ? this._$AA.nextSibling.data = t : this.T(W.createTextNode(t)), this._$AH = t;
|
|
403
|
+
}
|
|
404
|
+
$(t) {
|
|
405
|
+
var r;
|
|
406
|
+
const { values: s, _$litType$: i } = t, o = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = Ct.createElement(be(i.h, i.h[0]), this.options)), i);
|
|
407
|
+
if (((r = this._$AH) == null ? void 0 : r._$AD) === o) this._$AH.p(s);
|
|
408
|
+
else {
|
|
409
|
+
const a = new Fe(o, this), n = a.u(this.options);
|
|
410
|
+
a.p(s), this.T(n), this._$AH = a;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
_$AC(t) {
|
|
414
|
+
let s = Wt.get(t.strings);
|
|
415
|
+
return s === void 0 && Wt.set(t.strings, s = new Ct(t)), s;
|
|
416
|
+
}
|
|
417
|
+
k(t) {
|
|
418
|
+
Ot(this._$AH) || (this._$AH = [], this._$AR());
|
|
419
|
+
const s = this._$AH;
|
|
420
|
+
let i, o = 0;
|
|
421
|
+
for (const r of t) o === s.length ? s.push(i = new nt(this.O(rt()), this.O(rt()), this, this.options)) : i = s[o], i._$AI(r), o++;
|
|
422
|
+
o < s.length && (this._$AR(i && i._$AB.nextSibling, o), s.length = o);
|
|
423
|
+
}
|
|
424
|
+
_$AR(t = this._$AA.nextSibling, s) {
|
|
425
|
+
var i;
|
|
426
|
+
for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, s); t && t !== this._$AB; ) {
|
|
427
|
+
const o = t.nextSibling;
|
|
428
|
+
t.remove(), t = o;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
setConnected(t) {
|
|
432
|
+
var s;
|
|
433
|
+
this._$AM === void 0 && (this._$Cv = t, (s = this._$AP) == null || s.call(this, t));
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
class mt {
|
|
437
|
+
get tagName() {
|
|
438
|
+
return this.element.tagName;
|
|
439
|
+
}
|
|
440
|
+
get _$AU() {
|
|
441
|
+
return this._$AM._$AU;
|
|
442
|
+
}
|
|
443
|
+
constructor(t, s, i, o, r) {
|
|
444
|
+
this.type = 1, this._$AH = d, this._$AN = void 0, this.element = t, this.name = s, this._$AM = o, this.options = r, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = d;
|
|
445
|
+
}
|
|
446
|
+
_$AI(t, s = this, i, o) {
|
|
447
|
+
const r = this.strings;
|
|
448
|
+
let a = !1;
|
|
449
|
+
if (r === void 0) t = X(this, t, s, 0), a = !at(t) || t !== this._$AH && t !== H, a && (this._$AH = t);
|
|
450
|
+
else {
|
|
451
|
+
const n = t;
|
|
452
|
+
let c, h;
|
|
453
|
+
for (t = r[0], c = 0; c < r.length - 1; c++) h = X(this, n[i + c], s, c), h === H && (h = this._$AH[c]), a || (a = !at(h) || h !== this._$AH[c]), h === d ? t = d : t !== d && (t += (h ?? "") + r[c + 1]), this._$AH[c] = h;
|
|
454
|
+
}
|
|
455
|
+
a && !o && this.j(t);
|
|
456
|
+
}
|
|
457
|
+
j(t) {
|
|
458
|
+
t === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
let qe = class extends mt {
|
|
462
|
+
constructor() {
|
|
463
|
+
super(...arguments), this.type = 3;
|
|
464
|
+
}
|
|
465
|
+
j(t) {
|
|
466
|
+
this.element[this.name] = t === d ? void 0 : t;
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
class Ke extends mt {
|
|
470
|
+
constructor() {
|
|
471
|
+
super(...arguments), this.type = 4;
|
|
472
|
+
}
|
|
473
|
+
j(t) {
|
|
474
|
+
this.element.toggleAttribute(this.name, !!t && t !== d);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
class Ye extends mt {
|
|
478
|
+
constructor(t, s, i, o, r) {
|
|
479
|
+
super(t, s, i, o, r), this.type = 5;
|
|
480
|
+
}
|
|
481
|
+
_$AI(t, s = this) {
|
|
482
|
+
if ((t = X(this, t, s, 0) ?? d) === H) return;
|
|
483
|
+
const i = this._$AH, o = t === d && i !== d || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, r = t !== d && (i === d || o);
|
|
484
|
+
o && this.element.removeEventListener(this.name, this, i), r && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
485
|
+
}
|
|
486
|
+
handleEvent(t) {
|
|
487
|
+
var s;
|
|
488
|
+
typeof this._$AH == "function" ? this._$AH.call(((s = this.options) == null ? void 0 : s.host) ?? this.element, t) : this._$AH.handleEvent(t);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
class Ge {
|
|
492
|
+
constructor(t, s, i) {
|
|
493
|
+
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = s, this.options = i;
|
|
494
|
+
}
|
|
495
|
+
get _$AU() {
|
|
496
|
+
return this._$AM._$AU;
|
|
497
|
+
}
|
|
498
|
+
_$AI(t) {
|
|
499
|
+
X(this, t);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
const yt = it.litHtmlPolyfillSupport;
|
|
503
|
+
yt == null || yt(Ct, nt), (it.litHtmlVersions ?? (it.litHtmlVersions = [])).push("3.2.1");
|
|
504
|
+
const We = (e, t, s) => {
|
|
505
|
+
const i = (s == null ? void 0 : s.renderBefore) ?? t;
|
|
506
|
+
let o = i._$litPart$;
|
|
507
|
+
if (o === void 0) {
|
|
508
|
+
const r = (s == null ? void 0 : s.renderBefore) ?? null;
|
|
509
|
+
i._$litPart$ = o = new nt(t.insertBefore(rt(), r), r, void 0, s ?? {});
|
|
510
|
+
}
|
|
511
|
+
return o._$AI(e), o;
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* @license
|
|
515
|
+
* Copyright 2017 Google LLC
|
|
516
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
517
|
+
*/
|
|
518
|
+
let V = class extends J {
|
|
519
|
+
constructor() {
|
|
520
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
521
|
+
}
|
|
522
|
+
createRenderRoot() {
|
|
523
|
+
var s;
|
|
524
|
+
const t = super.createRenderRoot();
|
|
525
|
+
return (s = this.renderOptions).renderBefore ?? (s.renderBefore = t.firstChild), t;
|
|
526
|
+
}
|
|
527
|
+
update(t) {
|
|
528
|
+
const s = this.render();
|
|
529
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = We(s, this.renderRoot, this.renderOptions);
|
|
530
|
+
}
|
|
531
|
+
connectedCallback() {
|
|
532
|
+
var t;
|
|
533
|
+
super.connectedCallback(), (t = this._$Do) == null || t.setConnected(!0);
|
|
534
|
+
}
|
|
535
|
+
disconnectedCallback() {
|
|
536
|
+
var t;
|
|
537
|
+
super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
|
|
538
|
+
}
|
|
539
|
+
render() {
|
|
540
|
+
return H;
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
var de;
|
|
544
|
+
V._$litElement$ = !0, V.finalized = !0, (de = globalThis.litElementHydrateSupport) == null || de.call(globalThis, { LitElement: V });
|
|
545
|
+
const vt = globalThis.litElementPolyfillSupport;
|
|
546
|
+
vt == null || vt({ LitElement: V });
|
|
547
|
+
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.1");
|
|
548
|
+
/**
|
|
549
|
+
* @license
|
|
550
|
+
* Copyright 2017 Google LLC
|
|
551
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
552
|
+
*/
|
|
553
|
+
const F = (e) => (t, s) => {
|
|
554
|
+
s !== void 0 ? s.addInitializer(() => {
|
|
555
|
+
customElements.define(e, t);
|
|
556
|
+
}) : customElements.define(e, t);
|
|
557
|
+
};
|
|
281
558
|
/**
|
|
282
559
|
* @license
|
|
283
560
|
* Copyright 2017 Google LLC
|
|
284
561
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
285
562
|
*/
|
|
286
|
-
const
|
|
563
|
+
const Ze = { attribute: !0, type: String, converter: ht, reflect: !1, hasChanged: Pt }, Je = (e = Ze, t, s) => {
|
|
287
564
|
const { kind: i, metadata: o } = s;
|
|
288
565
|
let r = globalThis.litPropertyMetadata.get(o);
|
|
289
566
|
if (r === void 0 && globalThis.litPropertyMetadata.set(o, r = /* @__PURE__ */ new Map()), r.set(s.name, e), i === "accessor") {
|
|
@@ -304,8 +581,8 @@ const Le = { attribute: !0, type: String, converter: pt, reflect: !1, hasChanged
|
|
|
304
581
|
}
|
|
305
582
|
throw Error("Unsupported decorator location: " + i);
|
|
306
583
|
};
|
|
307
|
-
function
|
|
308
|
-
return (t, s) => typeof s == "object" ?
|
|
584
|
+
function p(e) {
|
|
585
|
+
return (t, s) => typeof s == "object" ? Je(e, t, s) : ((i, o, r) => {
|
|
309
586
|
const a = o.hasOwnProperty(r);
|
|
310
587
|
return o.constructor.createProperty(r, a ? { ...i, wrapped: !0 } : i), a ? Object.getOwnPropertyDescriptor(o, r) : void 0;
|
|
311
588
|
})(e, t, s);
|
|
@@ -316,9 +593,9 @@ function d(e) {
|
|
|
316
593
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
317
594
|
*/
|
|
318
595
|
function y(e) {
|
|
319
|
-
return
|
|
596
|
+
return p({ ...e, state: !0, attribute: !1 });
|
|
320
597
|
}
|
|
321
|
-
const
|
|
598
|
+
const Xe = B`
|
|
322
599
|
:host {
|
|
323
600
|
/* Base CSS variables */
|
|
324
601
|
--pc-primary-color: #2196f3;
|
|
@@ -625,31 +902,31 @@ const De = H`
|
|
|
625
902
|
padding: 0.2em 0;
|
|
626
903
|
}
|
|
627
904
|
}
|
|
628
|
-
`,
|
|
629
|
-
function
|
|
905
|
+
`, ge = "http://127.0.0.1:54321/functions/v1/data", Qe = "pc_session_id", ts = 24 * 60 * 60 * 1e3, xt = process.env.NODE_ENV === "development";
|
|
906
|
+
function es(e) {
|
|
630
907
|
return {
|
|
631
908
|
debug: (t, ...s) => {
|
|
632
|
-
|
|
909
|
+
xt && console.debug(`[${e}]`, t, ...s);
|
|
633
910
|
},
|
|
634
911
|
info: (t, ...s) => {
|
|
635
|
-
|
|
912
|
+
xt && console.info(`[${e}]`, t, ...s);
|
|
636
913
|
},
|
|
637
914
|
warn: (t, ...s) => {
|
|
638
|
-
|
|
915
|
+
xt && console.warn(`[${e}]`, t, ...s);
|
|
639
916
|
},
|
|
640
917
|
error: (t, ...s) => {
|
|
641
918
|
console.error(`[${e}]`, t, ...s);
|
|
642
919
|
}
|
|
643
920
|
};
|
|
644
921
|
}
|
|
645
|
-
const f =
|
|
646
|
-
function
|
|
922
|
+
const f = es("Pollcatch");
|
|
923
|
+
function Zt() {
|
|
647
924
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (f.warn("crypto.randomUUID not available, using fallback UUID generator"), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
648
925
|
const t = Math.random() * 16 | 0;
|
|
649
926
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
650
927
|
}));
|
|
651
928
|
}
|
|
652
|
-
function
|
|
929
|
+
function Tt() {
|
|
653
930
|
const e = "test-local-storage";
|
|
654
931
|
try {
|
|
655
932
|
return localStorage.setItem(e, e), localStorage.removeItem(e), !0;
|
|
@@ -657,7 +934,7 @@ function Pt() {
|
|
|
657
934
|
return f.warn("localStorage not available, session ID will not persist"), !1;
|
|
658
935
|
}
|
|
659
936
|
}
|
|
660
|
-
function
|
|
937
|
+
function ye(e) {
|
|
661
938
|
try {
|
|
662
939
|
const t = localStorage.getItem(e);
|
|
663
940
|
return t ? JSON.parse(t) : void 0;
|
|
@@ -666,14 +943,14 @@ function pe(e) {
|
|
|
666
943
|
return;
|
|
667
944
|
}
|
|
668
945
|
}
|
|
669
|
-
function
|
|
946
|
+
function ve(e, t) {
|
|
670
947
|
try {
|
|
671
948
|
return localStorage.setItem(e, JSON.stringify(t)), !0;
|
|
672
949
|
} catch (s) {
|
|
673
950
|
return f.warn(`Failed to set item in localStorage: ${e}`, s), !1;
|
|
674
951
|
}
|
|
675
952
|
}
|
|
676
|
-
async function
|
|
953
|
+
async function ss() {
|
|
677
954
|
if (typeof window < "u") {
|
|
678
955
|
if (window.pcProject !== void 0)
|
|
679
956
|
return f.debug("Found project key in global variable"), window.pcProject;
|
|
@@ -686,31 +963,31 @@ async function Fe() {
|
|
|
686
963
|
}
|
|
687
964
|
f.warn("No project key found in global variable or script tags");
|
|
688
965
|
}
|
|
689
|
-
async function
|
|
690
|
-
const e =
|
|
691
|
-
if (
|
|
692
|
-
const s =
|
|
966
|
+
async function Jt() {
|
|
967
|
+
const e = Qe, t = ts;
|
|
968
|
+
if (Tt()) {
|
|
969
|
+
const s = ye(e);
|
|
693
970
|
if (s && s.id && s.timestamp && Date.now() - s.timestamp < t)
|
|
694
971
|
return f.debug("Using existing session ID from localStorage"), s.id;
|
|
695
972
|
f.debug(
|
|
696
973
|
s ? "Session ID expired" : "No session ID found",
|
|
697
974
|
"generating new one"
|
|
698
975
|
);
|
|
699
|
-
const i =
|
|
700
|
-
return
|
|
976
|
+
const i = Zt();
|
|
977
|
+
return ve(e, {
|
|
701
978
|
id: i,
|
|
702
979
|
timestamp: Date.now()
|
|
703
980
|
}) ? f.debug("Generated and stored new session ID") : f.warn("Generated session ID but failed to store it"), i;
|
|
704
981
|
} else {
|
|
705
|
-
const s =
|
|
982
|
+
const s = Zt();
|
|
706
983
|
return f.debug("Generated non-persistent session ID"), s;
|
|
707
984
|
}
|
|
708
985
|
}
|
|
709
|
-
async function
|
|
986
|
+
async function is(e, t) {
|
|
710
987
|
try {
|
|
711
988
|
if (!e)
|
|
712
989
|
throw new Error("Name parameter is required");
|
|
713
|
-
const s = `${
|
|
990
|
+
const s = `${ge}/${encodeURIComponent(t)}/${encodeURIComponent(e)}`;
|
|
714
991
|
f.debug(`Fetching stats for: ${e}`, { projectKey: t });
|
|
715
992
|
const i = await fetch(s);
|
|
716
993
|
if (!i.ok)
|
|
@@ -731,8 +1008,8 @@ async function qe(e, t) {
|
|
|
731
1008
|
throw f.error("Error loading stats:", s), s;
|
|
732
1009
|
}
|
|
733
1010
|
}
|
|
734
|
-
async function
|
|
735
|
-
const t = JSON.stringify(e), s = `${
|
|
1011
|
+
async function os(e) {
|
|
1012
|
+
const t = JSON.stringify(e), s = `${ge}`;
|
|
736
1013
|
try {
|
|
737
1014
|
if (f.debug("Sending stats", e), typeof navigator < "u" && navigator.sendBeacon)
|
|
738
1015
|
if (navigator.sendBeacon(s, t)) {
|
|
@@ -755,10 +1032,10 @@ async function Ke(e) {
|
|
|
755
1032
|
throw f.error("Failed to send analytics:", i), i;
|
|
756
1033
|
}
|
|
757
1034
|
}
|
|
758
|
-
function
|
|
1035
|
+
function xe(e) {
|
|
759
1036
|
return !e || typeof e != "string" ? !1 : /^[\p{Emoji}]$/u.test(e) ? !0 : new RegExp("^\\p{Emoji}(\\p{Emoji_Modifier}|\\u200D\\p{Emoji})*$", "u").test(e);
|
|
760
1037
|
}
|
|
761
|
-
function
|
|
1038
|
+
function Mt(e) {
|
|
762
1039
|
if (!e || typeof e != "string")
|
|
763
1040
|
return !1;
|
|
764
1041
|
const t = e.trim();
|
|
@@ -770,7 +1047,7 @@ function Ot(e) {
|
|
|
770
1047
|
return !1;
|
|
771
1048
|
}
|
|
772
1049
|
}
|
|
773
|
-
function
|
|
1050
|
+
function rs(e) {
|
|
774
1051
|
if (!e || typeof e != "string")
|
|
775
1052
|
return [];
|
|
776
1053
|
const t = e.trim();
|
|
@@ -785,151 +1062,151 @@ function Ye(e) {
|
|
|
785
1062
|
}
|
|
786
1063
|
return t.split(",").map((s) => s.trim()).filter((s) => s !== "");
|
|
787
1064
|
}
|
|
788
|
-
function
|
|
1065
|
+
function as(e, t) {
|
|
789
1066
|
const s = /{([^{}]+)}/g;
|
|
790
1067
|
return e.replace(s, (i, o) => {
|
|
791
1068
|
const r = o.trim(), a = t[r];
|
|
792
1069
|
return a !== void 0 ? String(a) : i;
|
|
793
1070
|
});
|
|
794
1071
|
}
|
|
795
|
-
function
|
|
1072
|
+
function ns(e, t) {
|
|
796
1073
|
let s = 2166136261;
|
|
797
1074
|
const i = e + ":" + t;
|
|
798
1075
|
for (let o = 0; o < i.length; o++)
|
|
799
1076
|
s ^= i.charCodeAt(o), s += (s << 1) + (s << 4) + (s << 7) + (s << 8) + (s << 24);
|
|
800
1077
|
return (s >>> 0).toString(16).padStart(8, "0");
|
|
801
1078
|
}
|
|
802
|
-
var
|
|
1079
|
+
var ls = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, I = function(e) {
|
|
803
1080
|
return typeof e == "string" ? e.length > 0 : typeof e == "number";
|
|
804
1081
|
}, x = function(e, t, s) {
|
|
805
1082
|
return t === void 0 && (t = 0), s === void 0 && (s = Math.pow(10, t)), Math.round(s * e) / s + 0;
|
|
806
|
-
},
|
|
1083
|
+
}, k = function(e, t, s) {
|
|
807
1084
|
return t === void 0 && (t = 0), s === void 0 && (s = 1), e > s ? s : e > t ? e : t;
|
|
808
|
-
},
|
|
1085
|
+
}, $e = function(e) {
|
|
809
1086
|
return (e = isFinite(e) ? e % 360 : 0) > 0 ? e : e + 360;
|
|
810
|
-
},
|
|
811
|
-
return { r:
|
|
812
|
-
},
|
|
1087
|
+
}, Xt = function(e) {
|
|
1088
|
+
return { r: k(e.r, 0, 255), g: k(e.g, 0, 255), b: k(e.b, 0, 255), a: k(e.a) };
|
|
1089
|
+
}, $t = function(e) {
|
|
813
1090
|
return { r: x(e.r), g: x(e.g), b: x(e.b), a: x(e.a, 3) };
|
|
814
|
-
},
|
|
1091
|
+
}, cs = /^#([0-9a-f]{3,8})$/i, dt = function(e) {
|
|
815
1092
|
var t = e.toString(16);
|
|
816
1093
|
return t.length < 2 ? "0" + t : t;
|
|
817
|
-
},
|
|
1094
|
+
}, we = function(e) {
|
|
818
1095
|
var t = e.r, s = e.g, i = e.b, o = e.a, r = Math.max(t, s, i), a = r - Math.min(t, s, i), n = a ? r === t ? (s - i) / a : r === s ? 2 + (i - t) / a : 4 + (t - s) / a : 0;
|
|
819
1096
|
return { h: 60 * (n < 0 ? n + 6 : n), s: r ? a / r * 100 : 0, v: r / 255 * 100, a: o };
|
|
820
|
-
},
|
|
1097
|
+
}, Se = function(e) {
|
|
821
1098
|
var t = e.h, s = e.s, i = e.v, o = e.a;
|
|
822
1099
|
t = t / 360 * 6, s /= 100, i /= 100;
|
|
823
|
-
var r = Math.floor(t), a = i * (1 - s), n = i * (1 - (t - r) * s), c = i * (1 - (1 - t + r) * s),
|
|
824
|
-
return { r: 255 * [i, n, a, a, c, i][
|
|
825
|
-
},
|
|
826
|
-
return { h:
|
|
827
|
-
},
|
|
1100
|
+
var r = Math.floor(t), a = i * (1 - s), n = i * (1 - (t - r) * s), c = i * (1 - (1 - t + r) * s), h = r % 6;
|
|
1101
|
+
return { r: 255 * [i, n, a, a, c, i][h], g: 255 * [c, i, i, n, a, a][h], b: 255 * [a, a, c, i, i, n][h], a: o };
|
|
1102
|
+
}, Qt = function(e) {
|
|
1103
|
+
return { h: $e(e.h), s: k(e.s, 0, 100), l: k(e.l, 0, 100), a: k(e.a) };
|
|
1104
|
+
}, te = function(e) {
|
|
828
1105
|
return { h: x(e.h), s: x(e.s), l: x(e.l), a: x(e.a, 3) };
|
|
829
|
-
},
|
|
830
|
-
return
|
|
1106
|
+
}, ee = function(e) {
|
|
1107
|
+
return Se((s = (t = e).s, { h: t.h, s: (s *= ((i = t.l) < 50 ? i : 100 - i) / 100) > 0 ? 2 * s / (i + s) * 100 : 0, v: i + s, a: t.a }));
|
|
831
1108
|
var t, s, i;
|
|
832
|
-
},
|
|
833
|
-
return { h: (t =
|
|
1109
|
+
}, ot = function(e) {
|
|
1110
|
+
return { h: (t = we(e)).h, s: (o = (200 - (s = t.s)) * (i = t.v) / 100) > 0 && o < 200 ? s * i / 100 / (o <= 100 ? o : 200 - o) * 100 : 0, l: o / 2, a: t.a };
|
|
834
1111
|
var t, s, i, o;
|
|
835
|
-
},
|
|
836
|
-
var t =
|
|
1112
|
+
}, ds = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, ps = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, hs = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, us = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, se = { string: [[function(e) {
|
|
1113
|
+
var t = cs.exec(e);
|
|
837
1114
|
return t ? (e = t[1]).length <= 4 ? { r: parseInt(e[0] + e[0], 16), g: parseInt(e[1] + e[1], 16), b: parseInt(e[2] + e[2], 16), a: e.length === 4 ? x(parseInt(e[3] + e[3], 16) / 255, 2) : 1 } : e.length === 6 || e.length === 8 ? { r: parseInt(e.substr(0, 2), 16), g: parseInt(e.substr(2, 2), 16), b: parseInt(e.substr(4, 2), 16), a: e.length === 8 ? x(parseInt(e.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
|
|
838
1115
|
}, "hex"], [function(e) {
|
|
839
|
-
var t =
|
|
840
|
-
return t ? t[2] !== t[4] || t[4] !== t[6] ? null :
|
|
1116
|
+
var t = hs.exec(e) || us.exec(e);
|
|
1117
|
+
return t ? t[2] !== t[4] || t[4] !== t[6] ? null : Xt({ r: Number(t[1]) / (t[2] ? 100 / 255 : 1), g: Number(t[3]) / (t[4] ? 100 / 255 : 1), b: Number(t[5]) / (t[6] ? 100 / 255 : 1), a: t[7] === void 0 ? 1 : Number(t[7]) / (t[8] ? 100 : 1) }) : null;
|
|
841
1118
|
}, "rgb"], [function(e) {
|
|
842
|
-
var t =
|
|
1119
|
+
var t = ds.exec(e) || ps.exec(e);
|
|
843
1120
|
if (!t) return null;
|
|
844
|
-
var s, i, o =
|
|
845
|
-
return
|
|
1121
|
+
var s, i, o = Qt({ h: (s = t[1], i = t[2], i === void 0 && (i = "deg"), Number(s) * (ls[i] || 1)), s: Number(t[3]), l: Number(t[4]), a: t[5] === void 0 ? 1 : Number(t[5]) / (t[6] ? 100 : 1) });
|
|
1122
|
+
return ee(o);
|
|
846
1123
|
}, "hsl"]], object: [[function(e) {
|
|
847
1124
|
var t = e.r, s = e.g, i = e.b, o = e.a, r = o === void 0 ? 1 : o;
|
|
848
|
-
return
|
|
1125
|
+
return I(t) && I(s) && I(i) ? Xt({ r: Number(t), g: Number(s), b: Number(i), a: Number(r) }) : null;
|
|
849
1126
|
}, "rgb"], [function(e) {
|
|
850
1127
|
var t = e.h, s = e.s, i = e.l, o = e.a, r = o === void 0 ? 1 : o;
|
|
851
|
-
if (!
|
|
852
|
-
var a =
|
|
853
|
-
return
|
|
1128
|
+
if (!I(t) || !I(s) || !I(i)) return null;
|
|
1129
|
+
var a = Qt({ h: Number(t), s: Number(s), l: Number(i), a: Number(r) });
|
|
1130
|
+
return ee(a);
|
|
854
1131
|
}, "hsl"], [function(e) {
|
|
855
1132
|
var t = e.h, s = e.s, i = e.v, o = e.a, r = o === void 0 ? 1 : o;
|
|
856
|
-
if (!
|
|
1133
|
+
if (!I(t) || !I(s) || !I(i)) return null;
|
|
857
1134
|
var a = function(n) {
|
|
858
|
-
return { h:
|
|
1135
|
+
return { h: $e(n.h), s: k(n.s, 0, 100), v: k(n.v, 0, 100), a: k(n.a) };
|
|
859
1136
|
}({ h: Number(t), s: Number(s), v: Number(i), a: Number(r) });
|
|
860
|
-
return
|
|
861
|
-
}, "hsv"]] },
|
|
1137
|
+
return Se(a);
|
|
1138
|
+
}, "hsv"]] }, ie = function(e, t) {
|
|
862
1139
|
for (var s = 0; s < t.length; s++) {
|
|
863
1140
|
var i = t[s][0](e);
|
|
864
1141
|
if (i) return [i, t[s][1]];
|
|
865
1142
|
}
|
|
866
1143
|
return [null, void 0];
|
|
867
|
-
},
|
|
868
|
-
return typeof e == "string" ?
|
|
869
|
-
},
|
|
870
|
-
var s =
|
|
871
|
-
return { h: s.h, s:
|
|
872
|
-
},
|
|
1144
|
+
}, ms = function(e) {
|
|
1145
|
+
return typeof e == "string" ? ie(e.trim(), se.string) : typeof e == "object" && e !== null ? ie(e, se.object) : [null, void 0];
|
|
1146
|
+
}, wt = function(e, t) {
|
|
1147
|
+
var s = ot(e);
|
|
1148
|
+
return { h: s.h, s: k(s.s + 100 * t, 0, 100), l: s.l, a: s.a };
|
|
1149
|
+
}, St = function(e) {
|
|
873
1150
|
return (299 * e.r + 587 * e.g + 114 * e.b) / 1e3 / 255;
|
|
874
|
-
},
|
|
875
|
-
var s =
|
|
876
|
-
return { h: s.h, s: s.s, l:
|
|
877
|
-
},
|
|
1151
|
+
}, oe = function(e, t) {
|
|
1152
|
+
var s = ot(e);
|
|
1153
|
+
return { h: s.h, s: s.s, l: k(s.l + 100 * t, 0, 100), a: s.a };
|
|
1154
|
+
}, re = function() {
|
|
878
1155
|
function e(t) {
|
|
879
|
-
this.parsed =
|
|
1156
|
+
this.parsed = ms(t)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
880
1157
|
}
|
|
881
1158
|
return e.prototype.isValid = function() {
|
|
882
1159
|
return this.parsed !== null;
|
|
883
1160
|
}, e.prototype.brightness = function() {
|
|
884
|
-
return x(
|
|
1161
|
+
return x(St(this.rgba), 2);
|
|
885
1162
|
}, e.prototype.isDark = function() {
|
|
886
|
-
return
|
|
1163
|
+
return St(this.rgba) < 0.5;
|
|
887
1164
|
}, e.prototype.isLight = function() {
|
|
888
|
-
return
|
|
1165
|
+
return St(this.rgba) >= 0.5;
|
|
889
1166
|
}, e.prototype.toHex = function() {
|
|
890
|
-
return t =
|
|
1167
|
+
return t = $t(this.rgba), s = t.r, i = t.g, o = t.b, a = (r = t.a) < 1 ? dt(x(255 * r)) : "", "#" + dt(s) + dt(i) + dt(o) + a;
|
|
891
1168
|
var t, s, i, o, r, a;
|
|
892
1169
|
}, e.prototype.toRgb = function() {
|
|
893
|
-
return
|
|
1170
|
+
return $t(this.rgba);
|
|
894
1171
|
}, e.prototype.toRgbString = function() {
|
|
895
|
-
return t =
|
|
1172
|
+
return t = $t(this.rgba), s = t.r, i = t.g, o = t.b, (r = t.a) < 1 ? "rgba(" + s + ", " + i + ", " + o + ", " + r + ")" : "rgb(" + s + ", " + i + ", " + o + ")";
|
|
896
1173
|
var t, s, i, o, r;
|
|
897
1174
|
}, e.prototype.toHsl = function() {
|
|
898
|
-
return
|
|
1175
|
+
return te(ot(this.rgba));
|
|
899
1176
|
}, e.prototype.toHslString = function() {
|
|
900
|
-
return t =
|
|
1177
|
+
return t = te(ot(this.rgba)), s = t.h, i = t.s, o = t.l, (r = t.a) < 1 ? "hsla(" + s + ", " + i + "%, " + o + "%, " + r + ")" : "hsl(" + s + ", " + i + "%, " + o + "%)";
|
|
901
1178
|
var t, s, i, o, r;
|
|
902
1179
|
}, e.prototype.toHsv = function() {
|
|
903
|
-
return t =
|
|
1180
|
+
return t = we(this.rgba), { h: x(t.h), s: x(t.s), v: x(t.v), a: x(t.a, 3) };
|
|
904
1181
|
var t;
|
|
905
1182
|
}, e.prototype.invert = function() {
|
|
906
|
-
return
|
|
1183
|
+
return _({ r: 255 - (t = this.rgba).r, g: 255 - t.g, b: 255 - t.b, a: t.a });
|
|
907
1184
|
var t;
|
|
908
1185
|
}, e.prototype.saturate = function(t) {
|
|
909
|
-
return t === void 0 && (t = 0.1),
|
|
1186
|
+
return t === void 0 && (t = 0.1), _(wt(this.rgba, t));
|
|
910
1187
|
}, e.prototype.desaturate = function(t) {
|
|
911
|
-
return t === void 0 && (t = 0.1),
|
|
1188
|
+
return t === void 0 && (t = 0.1), _(wt(this.rgba, -t));
|
|
912
1189
|
}, e.prototype.grayscale = function() {
|
|
913
|
-
return
|
|
1190
|
+
return _(wt(this.rgba, -1));
|
|
914
1191
|
}, e.prototype.lighten = function(t) {
|
|
915
|
-
return t === void 0 && (t = 0.1),
|
|
1192
|
+
return t === void 0 && (t = 0.1), _(oe(this.rgba, t));
|
|
916
1193
|
}, e.prototype.darken = function(t) {
|
|
917
|
-
return t === void 0 && (t = 0.1),
|
|
1194
|
+
return t === void 0 && (t = 0.1), _(oe(this.rgba, -t));
|
|
918
1195
|
}, e.prototype.rotate = function(t) {
|
|
919
1196
|
return t === void 0 && (t = 15), this.hue(this.hue() + t);
|
|
920
1197
|
}, e.prototype.alpha = function(t) {
|
|
921
|
-
return typeof t == "number" ?
|
|
1198
|
+
return typeof t == "number" ? _({ r: (s = this.rgba).r, g: s.g, b: s.b, a: t }) : x(this.rgba.a, 3);
|
|
922
1199
|
var s;
|
|
923
1200
|
}, e.prototype.hue = function(t) {
|
|
924
|
-
var s =
|
|
925
|
-
return typeof t == "number" ?
|
|
1201
|
+
var s = ot(this.rgba);
|
|
1202
|
+
return typeof t == "number" ? _({ h: t, s: s.s, l: s.l, a: s.a }) : x(s.h);
|
|
926
1203
|
}, e.prototype.isEqual = function(t) {
|
|
927
|
-
return this.toHex() ===
|
|
1204
|
+
return this.toHex() === _(t).toHex();
|
|
928
1205
|
}, e;
|
|
929
|
-
}(),
|
|
930
|
-
return e instanceof
|
|
931
|
-
},
|
|
932
|
-
const
|
|
1206
|
+
}(), _ = function(e) {
|
|
1207
|
+
return e instanceof re ? e : new re(e);
|
|
1208
|
+
}, ke = /* @__PURE__ */ ((e) => (e[e.AA_NORMAL = 4.5] = "AA_NORMAL", e[e.AA_LARGE = 3] = "AA_LARGE", e[e.AAA_NORMAL = 7] = "AAA_NORMAL", e[e.AAA_LARGE = 4.5] = "AAA_LARGE", e))(ke || {});
|
|
1209
|
+
const bs = {
|
|
933
1210
|
black: "#000000",
|
|
934
1211
|
white: "#ffffff",
|
|
935
1212
|
red: "#ff0000",
|
|
@@ -946,20 +1223,20 @@ const is = {
|
|
|
946
1223
|
teal: "#008080",
|
|
947
1224
|
navy: "#000080"
|
|
948
1225
|
};
|
|
949
|
-
function
|
|
1226
|
+
function fs(e) {
|
|
950
1227
|
const t = e.toLowerCase().trim();
|
|
951
|
-
return
|
|
1228
|
+
return bs[t] || null;
|
|
952
1229
|
}
|
|
953
|
-
function
|
|
954
|
-
const s =
|
|
1230
|
+
function kt(e, t) {
|
|
1231
|
+
const s = ae(e), i = ae(t), o = Math.max(s, i), r = Math.min(s, i);
|
|
955
1232
|
return (o + 0.05) / (r + 0.05);
|
|
956
1233
|
}
|
|
957
|
-
function
|
|
958
|
-
const t =
|
|
1234
|
+
function ae(e) {
|
|
1235
|
+
const t = gs(e), s = t.r / 255, i = t.g / 255, o = t.b / 255, r = s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4), a = i <= 0.03928 ? i / 12.92 : Math.pow((i + 0.055) / 1.055, 2.4), n = o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4);
|
|
959
1236
|
return 0.2126 * r + 0.7152 * a + 0.0722 * n;
|
|
960
1237
|
}
|
|
961
|
-
function
|
|
962
|
-
if (!
|
|
1238
|
+
function ne(e, t = {}) {
|
|
1239
|
+
if (!_(e).isValid())
|
|
963
1240
|
return console.warn(`Invalid color provided: ${e}`), "black";
|
|
964
1241
|
const {
|
|
965
1242
|
minContrast: i = 4.5,
|
|
@@ -970,36 +1247,36 @@ function te(e, t = {}) {
|
|
|
970
1247
|
},
|
|
971
1248
|
fallback: a = "white"
|
|
972
1249
|
} = t, n = o.map((m) => m === "black" ? "#000000" : m === "white" ? "#ffffff" : m === "light" ? r.light || "#f8f9fa" : m === "dark" ? r.dark || "#343a40" : m);
|
|
973
|
-
let c = a,
|
|
1250
|
+
let c = a, h = 0;
|
|
974
1251
|
for (const m of n) {
|
|
975
|
-
const b =
|
|
976
|
-
b >= i && b >
|
|
1252
|
+
const b = kt(e, m);
|
|
1253
|
+
b >= i && b > h && (h = b, c = m);
|
|
977
1254
|
}
|
|
978
|
-
if (
|
|
979
|
-
const m =
|
|
980
|
-
c = a,
|
|
1255
|
+
if (h === 0) {
|
|
1256
|
+
const m = kt(e, a);
|
|
1257
|
+
c = a, h = m;
|
|
981
1258
|
for (const b of n) {
|
|
982
1259
|
if (b === a) continue;
|
|
983
|
-
const
|
|
984
|
-
|
|
1260
|
+
const S = kt(e, b);
|
|
1261
|
+
S > h && (h = S, c = b);
|
|
985
1262
|
}
|
|
986
1263
|
console.warn(
|
|
987
|
-
`No color option met the minimum contrast ratio of ${i}:1 against ${e}. Using ${c} with contrast ratio ${
|
|
1264
|
+
`No color option met the minimum contrast ratio of ${i}:1 against ${e}. Using ${c} with contrast ratio ${h.toFixed(2)}:1 instead.`
|
|
988
1265
|
);
|
|
989
1266
|
}
|
|
990
1267
|
return c;
|
|
991
1268
|
}
|
|
992
|
-
function
|
|
993
|
-
const s =
|
|
1269
|
+
function gs(e) {
|
|
1270
|
+
const s = fs(e) || e, i = _(s);
|
|
994
1271
|
if (!i.isValid())
|
|
995
1272
|
return console.warn(`Invalid color provided: ${e}`), { r: 0, g: 0, b: 0 };
|
|
996
1273
|
const { r: o, g: r, b: a } = i.toRgb();
|
|
997
1274
|
return { r: o, g: r, b: a };
|
|
998
1275
|
}
|
|
999
|
-
function
|
|
1276
|
+
function R(e, t) {
|
|
1000
1277
|
return e === "left" || e === "right" ? t || "center" : e === "top" || e === "bottom" ? t || "start" : t || "center";
|
|
1001
1278
|
}
|
|
1002
|
-
function
|
|
1279
|
+
function ys(e, t = "1rem") {
|
|
1003
1280
|
if (!e) return t;
|
|
1004
1281
|
const s = {
|
|
1005
1282
|
xs: "0.75rem",
|
|
@@ -1018,7 +1295,7 @@ function as(e, t = "1rem") {
|
|
|
1018
1295
|
const a = parseFloat(o);
|
|
1019
1296
|
return isNaN(a) ? t : `${a}rem`;
|
|
1020
1297
|
}
|
|
1021
|
-
function
|
|
1298
|
+
function vs(e, t = "4px") {
|
|
1022
1299
|
if (!e) return t;
|
|
1023
1300
|
const s = {
|
|
1024
1301
|
xs: "2px",
|
|
@@ -1038,7 +1315,7 @@ function ns(e, t = "4px") {
|
|
|
1038
1315
|
const a = parseFloat(o);
|
|
1039
1316
|
return isNaN(a) ? t : `${a}px`;
|
|
1040
1317
|
}
|
|
1041
|
-
function
|
|
1318
|
+
function G() {
|
|
1042
1319
|
return {
|
|
1043
1320
|
count: 0,
|
|
1044
1321
|
sum: 0,
|
|
@@ -1048,26 +1325,26 @@ function K() {
|
|
|
1048
1325
|
updated: (/* @__PURE__ */ new Date()).toISOString()
|
|
1049
1326
|
};
|
|
1050
1327
|
}
|
|
1051
|
-
function
|
|
1052
|
-
if (!
|
|
1053
|
-
return
|
|
1328
|
+
function xs(e) {
|
|
1329
|
+
if (!Tt())
|
|
1330
|
+
return G();
|
|
1054
1331
|
try {
|
|
1055
|
-
const t =
|
|
1056
|
-
return t ? { ...
|
|
1332
|
+
const t = ye(e);
|
|
1333
|
+
return t ? { ...G(), ...t } : G();
|
|
1057
1334
|
} catch (t) {
|
|
1058
|
-
return f.warn("Failed to load localStats from localStorage", t),
|
|
1335
|
+
return f.warn("Failed to load localStats from localStorage", t), G();
|
|
1059
1336
|
}
|
|
1060
1337
|
}
|
|
1061
|
-
function
|
|
1062
|
-
if (!
|
|
1338
|
+
function $s(e, t) {
|
|
1339
|
+
if (!Tt())
|
|
1063
1340
|
return !1;
|
|
1064
1341
|
try {
|
|
1065
|
-
return
|
|
1342
|
+
return ve(e, t) ? (f.debug("Saved localStats to localStorage", t), !0) : !1;
|
|
1066
1343
|
} catch (s) {
|
|
1067
1344
|
return f.warn("Failed to save localStats to localStorage", s), !1;
|
|
1068
1345
|
}
|
|
1069
1346
|
}
|
|
1070
|
-
function
|
|
1347
|
+
function ws(e, t) {
|
|
1071
1348
|
const s = {
|
|
1072
1349
|
count: Math.max(0, e.count - t.count),
|
|
1073
1350
|
sum: (e.sum || 0) - (t.sum || 0),
|
|
@@ -1082,9 +1359,9 @@ function ds(e, t) {
|
|
|
1082
1359
|
s.breakdown[i] && (s.breakdown[i] = Math.max(0, s.breakdown[i] - o), s.breakdown[i] === 0 && delete s.breakdown[i]);
|
|
1083
1360
|
return s;
|
|
1084
1361
|
}
|
|
1085
|
-
function
|
|
1362
|
+
function Ss(e, t) {
|
|
1086
1363
|
if (!e.count && !t.count)
|
|
1087
|
-
return
|
|
1364
|
+
return G();
|
|
1088
1365
|
if (!e.count)
|
|
1089
1366
|
return { ...t };
|
|
1090
1367
|
const s = {
|
|
@@ -1103,7 +1380,7 @@ function ps(e, t) {
|
|
|
1103
1380
|
}
|
|
1104
1381
|
return s;
|
|
1105
1382
|
}
|
|
1106
|
-
function
|
|
1383
|
+
function ks(e) {
|
|
1107
1384
|
if (!e || typeof e != "object")
|
|
1108
1385
|
return 0;
|
|
1109
1386
|
let t = 0, s = 0, i = 0;
|
|
@@ -1116,27 +1393,27 @@ function hs(e) {
|
|
|
1116
1393
|
const o = t / i * 100, r = s / i * 100;
|
|
1117
1394
|
return Math.round(o - r);
|
|
1118
1395
|
}
|
|
1119
|
-
var
|
|
1396
|
+
var Cs = Object.defineProperty, g = (e, t, s, i) => {
|
|
1120
1397
|
for (var o = void 0, r = e.length - 1, a; r >= 0; r--)
|
|
1121
1398
|
(a = e[r]) && (o = a(t, s, o) || o);
|
|
1122
|
-
return o &&
|
|
1399
|
+
return o && Cs(t, s, o), o;
|
|
1123
1400
|
};
|
|
1124
|
-
const
|
|
1401
|
+
const jt = class jt extends V {
|
|
1125
1402
|
constructor() {
|
|
1126
|
-
super(...arguments), this.readonly = !1, this.showStats = !1, this.showCounts = !1, this.showChart = !1, this.minContrast =
|
|
1403
|
+
super(...arguments), this.readonly = !1, this.showStats = !1, this.showCounts = !1, this.showChart = !1, this.minContrast = ke.AA_NORMAL, this.labelPosition = "top", this.statsIsLoading = !1, this.localStats = G();
|
|
1127
1404
|
}
|
|
1128
1405
|
/**
|
|
1129
1406
|
* Gets the project key for the widget
|
|
1130
1407
|
* @returns The project key
|
|
1131
1408
|
*/
|
|
1132
1409
|
async getProjectKey() {
|
|
1133
|
-
return this.projectKey || await
|
|
1410
|
+
return this.projectKey || await ss() || "public";
|
|
1134
1411
|
}
|
|
1135
1412
|
/**
|
|
1136
1413
|
* Gets the localStorage key for this widget's localStats
|
|
1137
1414
|
*/
|
|
1138
1415
|
async getLocalStatsKey() {
|
|
1139
|
-
const t = await
|
|
1416
|
+
const t = await Jt(), s = await this.getProjectKey(), i = this.name || "unnamed";
|
|
1140
1417
|
return `pc-local-stats-${t}-${s}-${i}`;
|
|
1141
1418
|
}
|
|
1142
1419
|
/**
|
|
@@ -1145,9 +1422,9 @@ const Lt = class Lt extends mt {
|
|
|
1145
1422
|
async loadLocalStatsFromStorage() {
|
|
1146
1423
|
try {
|
|
1147
1424
|
const t = await this.getLocalStatsKey();
|
|
1148
|
-
this.localStats =
|
|
1425
|
+
this.localStats = xs(t), f.debug("Loaded localStats from localStorage", this.localStats);
|
|
1149
1426
|
} catch (t) {
|
|
1150
|
-
f.warn("Failed to generate localStorage key for localStats", t), this.localStats =
|
|
1427
|
+
f.warn("Failed to generate localStorage key for localStats", t), this.localStats = G();
|
|
1151
1428
|
}
|
|
1152
1429
|
}
|
|
1153
1430
|
/**
|
|
@@ -1156,7 +1433,7 @@ const Lt = class Lt extends mt {
|
|
|
1156
1433
|
async saveLocalStatsToStorage() {
|
|
1157
1434
|
try {
|
|
1158
1435
|
const t = await this.getLocalStatsKey();
|
|
1159
|
-
|
|
1436
|
+
$s(t, this.localStats) || f.warn("Failed to save localStats to localStorage");
|
|
1160
1437
|
} catch (t) {
|
|
1161
1438
|
f.warn("Failed to save localStats to localStorage", t);
|
|
1162
1439
|
}
|
|
@@ -1165,7 +1442,7 @@ const Lt = class Lt extends mt {
|
|
|
1165
1442
|
* Updates the stats with the localStats
|
|
1166
1443
|
*/
|
|
1167
1444
|
async updateStats(t, s) {
|
|
1168
|
-
if (this.stats && (this.stats =
|
|
1445
|
+
if (this.stats && (this.stats = ws(this.stats, this.localStats)), this.localStats = {
|
|
1169
1446
|
count: t > 0 ? 1 : 0,
|
|
1170
1447
|
sum: t,
|
|
1171
1448
|
avg: t,
|
|
@@ -1177,13 +1454,13 @@ const Lt = class Lt extends mt {
|
|
|
1177
1454
|
}, s && s.length > 0)
|
|
1178
1455
|
for (const i of s)
|
|
1179
1456
|
i && (this.localStats.breakdown[i] = 1);
|
|
1180
|
-
this.stats ? this.stats =
|
|
1457
|
+
this.stats ? this.stats = Ss(this.stats, this.localStats) : this.stats = { ...this.localStats };
|
|
1181
1458
|
}
|
|
1182
1459
|
/**
|
|
1183
1460
|
* Undo the stats with the localStats
|
|
1184
1461
|
*/
|
|
1185
1462
|
async submitStats(t, s) {
|
|
1186
|
-
const i = Math.floor(Date.now() / 1e3).toString(), o = await
|
|
1463
|
+
const i = Math.floor(Date.now() / 1e3).toString(), o = await Jt(), r = await this.getProjectKey(), a = this.name || "", n = {
|
|
1187
1464
|
sessionId: o,
|
|
1188
1465
|
projectId: r,
|
|
1189
1466
|
widgetName: a,
|
|
@@ -1193,11 +1470,11 @@ const Lt = class Lt extends mt {
|
|
|
1193
1470
|
textValues: s,
|
|
1194
1471
|
tags: this.tags,
|
|
1195
1472
|
timestamp: i
|
|
1196
|
-
}, c =
|
|
1473
|
+
}, c = ns(JSON.stringify(n), i);
|
|
1197
1474
|
try {
|
|
1198
|
-
|
|
1199
|
-
} catch (
|
|
1200
|
-
f.warn("Failed to send stats event",
|
|
1475
|
+
os({ ...n, hash: c });
|
|
1476
|
+
} catch (h) {
|
|
1477
|
+
f.warn("Failed to send stats event", h);
|
|
1201
1478
|
}
|
|
1202
1479
|
return n;
|
|
1203
1480
|
}
|
|
@@ -1222,7 +1499,7 @@ const Lt = class Lt extends mt {
|
|
|
1222
1499
|
if (this.primaryColor) {
|
|
1223
1500
|
s += `--pc-primary-color: ${this.primaryColor} !important;
|
|
1224
1501
|
`;
|
|
1225
|
-
const i =
|
|
1502
|
+
const i = ne(this.primaryColor, {
|
|
1226
1503
|
minContrast: this.minContrast,
|
|
1227
1504
|
colorOptions: ["black", "white", "light", "dark"]
|
|
1228
1505
|
});
|
|
@@ -1232,14 +1509,14 @@ const Lt = class Lt extends mt {
|
|
|
1232
1509
|
`;
|
|
1233
1510
|
}
|
|
1234
1511
|
if (this.buttonRadius) {
|
|
1235
|
-
const i =
|
|
1512
|
+
const i = vs(this.buttonRadius);
|
|
1236
1513
|
s += `--pc-button-radius: ${i} !important;
|
|
1237
1514
|
`;
|
|
1238
1515
|
}
|
|
1239
1516
|
if (this.muteColor) {
|
|
1240
1517
|
s += `--pc-mute-color: ${this.muteColor} !important;
|
|
1241
1518
|
`;
|
|
1242
|
-
const i =
|
|
1519
|
+
const i = ne(this.muteColor, {
|
|
1243
1520
|
minContrast: this.minContrast,
|
|
1244
1521
|
colorOptions: ["black", "white", "light", "dark"]
|
|
1245
1522
|
});
|
|
@@ -1248,7 +1525,7 @@ const Lt = class Lt extends mt {
|
|
|
1248
1525
|
}
|
|
1249
1526
|
if (this.textColor && (s += `--pc-text-color: ${this.textColor} !important;
|
|
1250
1527
|
`), this.size) {
|
|
1251
|
-
const i =
|
|
1528
|
+
const i = ys(this.size);
|
|
1252
1529
|
s += `font-size: ${i} !important;
|
|
1253
1530
|
`;
|
|
1254
1531
|
}
|
|
@@ -1263,7 +1540,7 @@ const Lt = class Lt extends mt {
|
|
|
1263
1540
|
this.statsIsLoading = !0;
|
|
1264
1541
|
try {
|
|
1265
1542
|
const t = await this.getProjectKey();
|
|
1266
|
-
this.stats = await
|
|
1543
|
+
this.stats = await is(this.name, t);
|
|
1267
1544
|
} catch (t) {
|
|
1268
1545
|
f.debug("Error loading stats", t), this.stats = void 0;
|
|
1269
1546
|
} finally {
|
|
@@ -1293,78 +1570,78 @@ const Lt = class Lt extends mt {
|
|
|
1293
1570
|
sum: ((o = this.stats) == null ? void 0 : o.sum) || 0,
|
|
1294
1571
|
avg: ((r = this.stats) == null ? void 0 : r.avg) || 0,
|
|
1295
1572
|
pct: ((a = this.stats) == null ? void 0 : a.pct) || 0,
|
|
1296
|
-
nps: this.widgetType === "nps" ?
|
|
1573
|
+
nps: this.widgetType === "nps" ? ks(((n = this.stats) == null ? void 0 : n.breakdown) || {}) : 0
|
|
1297
1574
|
};
|
|
1298
|
-
return
|
|
1575
|
+
return as(t, s);
|
|
1299
1576
|
}
|
|
1300
1577
|
};
|
|
1301
|
-
|
|
1302
|
-
let u =
|
|
1578
|
+
jt.styles = [Xe];
|
|
1579
|
+
let u = jt;
|
|
1303
1580
|
g([
|
|
1304
|
-
|
|
1581
|
+
p({ type: Boolean, reflect: !0 })
|
|
1305
1582
|
], u.prototype, "readonly");
|
|
1306
1583
|
g([
|
|
1307
|
-
|
|
1584
|
+
p({ type: String, attribute: "project" })
|
|
1308
1585
|
], u.prototype, "projectKey");
|
|
1309
1586
|
g([
|
|
1310
|
-
|
|
1587
|
+
p({ type: String })
|
|
1311
1588
|
], u.prototype, "tags");
|
|
1312
1589
|
g([
|
|
1313
|
-
|
|
1590
|
+
p({ type: String })
|
|
1314
1591
|
], u.prototype, "name");
|
|
1315
1592
|
g([
|
|
1316
|
-
|
|
1593
|
+
p({ type: Boolean, attribute: "show-stats" })
|
|
1317
1594
|
], u.prototype, "showStats");
|
|
1318
1595
|
g([
|
|
1319
|
-
|
|
1596
|
+
p({ type: Boolean, attribute: "show-counts" })
|
|
1320
1597
|
], u.prototype, "showCounts");
|
|
1321
1598
|
g([
|
|
1322
|
-
|
|
1599
|
+
p({ type: Boolean, attribute: "show-chart" })
|
|
1323
1600
|
], u.prototype, "showChart");
|
|
1324
1601
|
g([
|
|
1325
|
-
|
|
1602
|
+
p({ type: String, attribute: "stats-text" })
|
|
1326
1603
|
], u.prototype, "statsText");
|
|
1327
1604
|
g([
|
|
1328
|
-
|
|
1605
|
+
p({ type: String, attribute: "stats-position" })
|
|
1329
1606
|
], u.prototype, "statsPosition");
|
|
1330
1607
|
g([
|
|
1331
|
-
|
|
1608
|
+
p({ type: String, attribute: "stats-align" })
|
|
1332
1609
|
], u.prototype, "statsAlign");
|
|
1333
1610
|
g([
|
|
1334
|
-
|
|
1611
|
+
p({ type: String })
|
|
1335
1612
|
], u.prototype, "icon");
|
|
1336
1613
|
g([
|
|
1337
|
-
|
|
1614
|
+
p({ type: String, attribute: "icon-active" })
|
|
1338
1615
|
], u.prototype, "iconActive");
|
|
1339
1616
|
g([
|
|
1340
|
-
|
|
1617
|
+
p({ type: String, attribute: "primary-color" })
|
|
1341
1618
|
], u.prototype, "primaryColor");
|
|
1342
1619
|
g([
|
|
1343
|
-
|
|
1620
|
+
p({ type: String, attribute: "mute-color" })
|
|
1344
1621
|
], u.prototype, "muteColor");
|
|
1345
1622
|
g([
|
|
1346
|
-
|
|
1623
|
+
p({ type: String, attribute: "text-color" })
|
|
1347
1624
|
], u.prototype, "textColor");
|
|
1348
1625
|
g([
|
|
1349
|
-
|
|
1626
|
+
p({ type: String })
|
|
1350
1627
|
], u.prototype, "size");
|
|
1351
1628
|
g([
|
|
1352
|
-
|
|
1629
|
+
p({ type: String, attribute: "button-radius" })
|
|
1353
1630
|
], u.prototype, "buttonRadius");
|
|
1354
1631
|
g([
|
|
1355
|
-
|
|
1632
|
+
p({ type: Number, attribute: "min-contrast" })
|
|
1356
1633
|
], u.prototype, "minContrast");
|
|
1357
1634
|
g([
|
|
1358
|
-
|
|
1635
|
+
p({ type: String })
|
|
1359
1636
|
], u.prototype, "css");
|
|
1360
1637
|
g([
|
|
1361
|
-
|
|
1638
|
+
p({ type: String })
|
|
1362
1639
|
], u.prototype, "label");
|
|
1363
1640
|
g([
|
|
1364
|
-
|
|
1641
|
+
p({ type: String, attribute: "label-position" })
|
|
1365
1642
|
], u.prototype, "labelPosition");
|
|
1366
1643
|
g([
|
|
1367
|
-
|
|
1644
|
+
p({ type: String, attribute: "label-align" })
|
|
1368
1645
|
], u.prototype, "labelAlign");
|
|
1369
1646
|
g([
|
|
1370
1647
|
y()
|
|
@@ -1375,7 +1652,7 @@ g([
|
|
|
1375
1652
|
g([
|
|
1376
1653
|
y()
|
|
1377
1654
|
], u.prototype, "localStats");
|
|
1378
|
-
const
|
|
1655
|
+
const Es = B`
|
|
1379
1656
|
/* Add responsive sizing with CSS variables */
|
|
1380
1657
|
:host {
|
|
1381
1658
|
--pc-nps-button-size: clamp(1.6em, calc(1.5em + 0.5vw), 2.4em);
|
|
@@ -1623,235 +1900,8 @@ const ms = H`
|
|
|
1623
1900
|
* Copyright 2017 Google LLC
|
|
1624
1901
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1625
1902
|
*/
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1628
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), oe = /'/g, re = /"/g, xe = /^(?:script|style|textarea|title)$/i, W = Symbol.for("lit-noChange"), $ = Symbol.for("lit-nothing"), ae = /* @__PURE__ */ new WeakMap(), Y = G.createTreeWalker(G, 129);
|
|
1629
|
-
function $e(e, t) {
|
|
1630
|
-
if (!Mt(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
1631
|
-
return ee !== void 0 ? ee.createHTML(t) : t;
|
|
1632
|
-
}
|
|
1633
|
-
const gs = (e, t) => {
|
|
1634
|
-
const s = e.length - 1, i = [];
|
|
1635
|
-
let o, r = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = et;
|
|
1636
|
-
for (let n = 0; n < s; n++) {
|
|
1637
|
-
const c = e[n];
|
|
1638
|
-
let p, m, b = -1, k = 0;
|
|
1639
|
-
for (; k < c.length && (a.lastIndex = k, m = a.exec(c), m !== null); ) k = a.lastIndex, a === et ? m[1] === "!--" ? a = se : m[1] !== void 0 ? a = ie : m[2] !== void 0 ? (xe.test(m[2]) && (o = RegExp("</" + m[2], "g")), a = q) : m[3] !== void 0 && (a = q) : a === q ? m[0] === ">" ? (a = o ?? et, b = -1) : m[1] === void 0 ? b = -2 : (b = a.lastIndex - m[2].length, p = m[1], a = m[3] === void 0 ? q : m[3] === '"' ? re : oe) : a === re || a === oe ? a = q : a === se || a === ie ? a = et : (a = q, o = void 0);
|
|
1640
|
-
const j = a === q && e[n + 1].startsWith("/>") ? " " : "";
|
|
1641
|
-
r += a === et ? c + bs : b >= 0 ? (i.push(p), c.slice(0, b) + ye + c.slice(b) + D + j) : c + D + (b === -2 ? n : j);
|
|
1642
|
-
}
|
|
1643
|
-
return [$e(e, r + (e[s] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
|
|
1644
|
-
};
|
|
1645
|
-
class at {
|
|
1646
|
-
constructor({ strings: t, _$litType$: s }, i) {
|
|
1647
|
-
let o;
|
|
1648
|
-
this.parts = [];
|
|
1649
|
-
let r = 0, a = 0;
|
|
1650
|
-
const n = t.length - 1, c = this.parts, [p, m] = gs(t, s);
|
|
1651
|
-
if (this.el = at.createElement(p, i), Y.currentNode = this.el.content, s === 2 || s === 3) {
|
|
1652
|
-
const b = this.el.content.firstChild;
|
|
1653
|
-
b.replaceWith(...b.childNodes);
|
|
1654
|
-
}
|
|
1655
|
-
for (; (o = Y.nextNode()) !== null && c.length < n; ) {
|
|
1656
|
-
if (o.nodeType === 1) {
|
|
1657
|
-
if (o.hasAttributes()) for (const b of o.getAttributeNames()) if (b.endsWith(ye)) {
|
|
1658
|
-
const k = m[a++], j = o.getAttribute(b).split(D), lt = /([.?@])?(.*)/.exec(k);
|
|
1659
|
-
c.push({ type: 1, index: r, name: lt[2], strings: j, ctor: lt[1] === "." ? vs : lt[1] === "?" ? xs : lt[1] === "@" ? $s : ft }), o.removeAttribute(b);
|
|
1660
|
-
} else b.startsWith(D) && (c.push({ type: 6, index: r }), o.removeAttribute(b));
|
|
1661
|
-
if (xe.test(o.tagName)) {
|
|
1662
|
-
const b = o.textContent.split(D), k = b.length - 1;
|
|
1663
|
-
if (k > 0) {
|
|
1664
|
-
o.textContent = ht ? ht.emptyScript : "";
|
|
1665
|
-
for (let j = 0; j < k; j++) o.append(b[j], ut()), Y.nextNode(), c.push({ type: 2, index: ++r });
|
|
1666
|
-
o.append(b[k], ut());
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
} else if (o.nodeType === 8) if (o.data === ve) c.push({ type: 2, index: r });
|
|
1670
|
-
else {
|
|
1671
|
-
let b = -1;
|
|
1672
|
-
for (; (b = o.data.indexOf(D, b + 1)) !== -1; ) c.push({ type: 7, index: r }), b += D.length - 1;
|
|
1673
|
-
}
|
|
1674
|
-
r++;
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
static createElement(t, s) {
|
|
1678
|
-
const i = G.createElement("template");
|
|
1679
|
-
return i.innerHTML = t, i;
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
function J(e, t, s = e, i) {
|
|
1683
|
-
var a, n;
|
|
1684
|
-
if (t === W) return t;
|
|
1685
|
-
let o = i !== void 0 ? (a = s._$Co) == null ? void 0 : a[i] : s._$Cl;
|
|
1686
|
-
const r = rt(t) ? void 0 : t._$litDirective$;
|
|
1687
|
-
return (o == null ? void 0 : o.constructor) !== r && ((n = o == null ? void 0 : o._$AO) == null || n.call(o, !1), r === void 0 ? o = void 0 : (o = new r(e), o._$AT(e, s, i)), i !== void 0 ? (s._$Co ?? (s._$Co = []))[i] = o : s._$Cl = o), o !== void 0 && (t = J(e, o._$AS(e, t.values), o, i)), t;
|
|
1688
|
-
}
|
|
1689
|
-
class ys {
|
|
1690
|
-
constructor(t, s) {
|
|
1691
|
-
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = s;
|
|
1692
|
-
}
|
|
1693
|
-
get parentNode() {
|
|
1694
|
-
return this._$AM.parentNode;
|
|
1695
|
-
}
|
|
1696
|
-
get _$AU() {
|
|
1697
|
-
return this._$AM._$AU;
|
|
1698
|
-
}
|
|
1699
|
-
u(t) {
|
|
1700
|
-
const { el: { content: s }, parts: i } = this._$AD, o = ((t == null ? void 0 : t.creationScope) ?? G).importNode(s, !0);
|
|
1701
|
-
Y.currentNode = o;
|
|
1702
|
-
let r = Y.nextNode(), a = 0, n = 0, c = i[0];
|
|
1703
|
-
for (; c !== void 0; ) {
|
|
1704
|
-
if (a === c.index) {
|
|
1705
|
-
let p;
|
|
1706
|
-
c.type === 2 ? p = new bt(r, r.nextSibling, this, t) : c.type === 1 ? p = new c.ctor(r, c.name, c.strings, this, t) : c.type === 6 && (p = new ws(r, this, t)), this._$AV.push(p), c = i[++n];
|
|
1707
|
-
}
|
|
1708
|
-
a !== (c == null ? void 0 : c.index) && (r = Y.nextNode(), a++);
|
|
1709
|
-
}
|
|
1710
|
-
return Y.currentNode = G, o;
|
|
1711
|
-
}
|
|
1712
|
-
p(t) {
|
|
1713
|
-
let s = 0;
|
|
1714
|
-
for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, s), s += i.strings.length - 2) : i._$AI(t[s])), s++;
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
class bt {
|
|
1718
|
-
get _$AU() {
|
|
1719
|
-
var t;
|
|
1720
|
-
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
|
1721
|
-
}
|
|
1722
|
-
constructor(t, s, i, o) {
|
|
1723
|
-
this.type = 2, this._$AH = $, this._$AN = void 0, this._$AA = t, this._$AB = s, this._$AM = i, this.options = o, this._$Cv = (o == null ? void 0 : o.isConnected) ?? !0;
|
|
1724
|
-
}
|
|
1725
|
-
get parentNode() {
|
|
1726
|
-
let t = this._$AA.parentNode;
|
|
1727
|
-
const s = this._$AM;
|
|
1728
|
-
return s !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = s.parentNode), t;
|
|
1729
|
-
}
|
|
1730
|
-
get startNode() {
|
|
1731
|
-
return this._$AA;
|
|
1732
|
-
}
|
|
1733
|
-
get endNode() {
|
|
1734
|
-
return this._$AB;
|
|
1735
|
-
}
|
|
1736
|
-
_$AI(t, s = this) {
|
|
1737
|
-
t = J(this, t, s), rt(t) ? t === $ || t == null || t === "" ? (this._$AH !== $ && this._$AR(), this._$AH = $) : t !== this._$AH && t !== W && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : fs(t) ? this.k(t) : this._(t);
|
|
1738
|
-
}
|
|
1739
|
-
O(t) {
|
|
1740
|
-
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
1741
|
-
}
|
|
1742
|
-
T(t) {
|
|
1743
|
-
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
1744
|
-
}
|
|
1745
|
-
_(t) {
|
|
1746
|
-
this._$AH !== $ && rt(this._$AH) ? this._$AA.nextSibling.data = t : this.T(G.createTextNode(t)), this._$AH = t;
|
|
1747
|
-
}
|
|
1748
|
-
$(t) {
|
|
1749
|
-
var r;
|
|
1750
|
-
const { values: s, _$litType$: i } = t, o = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = at.createElement($e(i.h, i.h[0]), this.options)), i);
|
|
1751
|
-
if (((r = this._$AH) == null ? void 0 : r._$AD) === o) this._$AH.p(s);
|
|
1752
|
-
else {
|
|
1753
|
-
const a = new ys(o, this), n = a.u(this.options);
|
|
1754
|
-
a.p(s), this.T(n), this._$AH = a;
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
_$AC(t) {
|
|
1758
|
-
let s = ae.get(t.strings);
|
|
1759
|
-
return s === void 0 && ae.set(t.strings, s = new at(t)), s;
|
|
1760
|
-
}
|
|
1761
|
-
k(t) {
|
|
1762
|
-
Mt(this._$AH) || (this._$AH = [], this._$AR());
|
|
1763
|
-
const s = this._$AH;
|
|
1764
|
-
let i, o = 0;
|
|
1765
|
-
for (const r of t) o === s.length ? s.push(i = new bt(this.O(ut()), this.O(ut()), this, this.options)) : i = s[o], i._$AI(r), o++;
|
|
1766
|
-
o < s.length && (this._$AR(i && i._$AB.nextSibling, o), s.length = o);
|
|
1767
|
-
}
|
|
1768
|
-
_$AR(t = this._$AA.nextSibling, s) {
|
|
1769
|
-
var i;
|
|
1770
|
-
for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, s); t && t !== this._$AB; ) {
|
|
1771
|
-
const o = t.nextSibling;
|
|
1772
|
-
t.remove(), t = o;
|
|
1773
|
-
}
|
|
1774
|
-
}
|
|
1775
|
-
setConnected(t) {
|
|
1776
|
-
var s;
|
|
1777
|
-
this._$AM === void 0 && (this._$Cv = t, (s = this._$AP) == null || s.call(this, t));
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
class ft {
|
|
1781
|
-
get tagName() {
|
|
1782
|
-
return this.element.tagName;
|
|
1783
|
-
}
|
|
1784
|
-
get _$AU() {
|
|
1785
|
-
return this._$AM._$AU;
|
|
1786
|
-
}
|
|
1787
|
-
constructor(t, s, i, o, r) {
|
|
1788
|
-
this.type = 1, this._$AH = $, this._$AN = void 0, this.element = t, this.name = s, this._$AM = o, this.options = r, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = $;
|
|
1789
|
-
}
|
|
1790
|
-
_$AI(t, s = this, i, o) {
|
|
1791
|
-
const r = this.strings;
|
|
1792
|
-
let a = !1;
|
|
1793
|
-
if (r === void 0) t = J(this, t, s, 0), a = !rt(t) || t !== this._$AH && t !== W, a && (this._$AH = t);
|
|
1794
|
-
else {
|
|
1795
|
-
const n = t;
|
|
1796
|
-
let c, p;
|
|
1797
|
-
for (t = r[0], c = 0; c < r.length - 1; c++) p = J(this, n[i + c], s, c), p === W && (p = this._$AH[c]), a || (a = !rt(p) || p !== this._$AH[c]), p === $ ? t = $ : t !== $ && (t += (p ?? "") + r[c + 1]), this._$AH[c] = p;
|
|
1798
|
-
}
|
|
1799
|
-
a && !o && this.j(t);
|
|
1800
|
-
}
|
|
1801
|
-
j(t) {
|
|
1802
|
-
t === $ ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
class vs extends ft {
|
|
1806
|
-
constructor() {
|
|
1807
|
-
super(...arguments), this.type = 3;
|
|
1808
|
-
}
|
|
1809
|
-
j(t) {
|
|
1810
|
-
this.element[this.name] = t === $ ? void 0 : t;
|
|
1811
|
-
}
|
|
1812
|
-
}
|
|
1813
|
-
class xs extends ft {
|
|
1814
|
-
constructor() {
|
|
1815
|
-
super(...arguments), this.type = 4;
|
|
1816
|
-
}
|
|
1817
|
-
j(t) {
|
|
1818
|
-
this.element.toggleAttribute(this.name, !!t && t !== $);
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
class $s extends ft {
|
|
1822
|
-
constructor(t, s, i, o, r) {
|
|
1823
|
-
super(t, s, i, o, r), this.type = 5;
|
|
1824
|
-
}
|
|
1825
|
-
_$AI(t, s = this) {
|
|
1826
|
-
if ((t = J(this, t, s, 0) ?? $) === W) return;
|
|
1827
|
-
const i = this._$AH, o = t === $ && i !== $ || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, r = t !== $ && (i === $ || o);
|
|
1828
|
-
o && this.element.removeEventListener(this.name, this, i), r && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
1829
|
-
}
|
|
1830
|
-
handleEvent(t) {
|
|
1831
|
-
var s;
|
|
1832
|
-
typeof this._$AH == "function" ? this._$AH.call(((s = this.options) == null ? void 0 : s.host) ?? this.element, t) : this._$AH.handleEvent(t);
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
class ws {
|
|
1836
|
-
constructor(t, s, i) {
|
|
1837
|
-
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = s, this.options = i;
|
|
1838
|
-
}
|
|
1839
|
-
get _$AU() {
|
|
1840
|
-
return this._$AM._$AU;
|
|
1841
|
-
}
|
|
1842
|
-
_$AI(t) {
|
|
1843
|
-
J(this, t);
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
const Et = ot.litHtmlPolyfillSupport;
|
|
1847
|
-
Et == null || Et(at, bt), (ot.litHtmlVersions ?? (ot.litHtmlVersions = [])).push("3.2.1");
|
|
1848
|
-
/**
|
|
1849
|
-
* @license
|
|
1850
|
-
* Copyright 2017 Google LLC
|
|
1851
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1852
|
-
*/
|
|
1853
|
-
const we = { ATTRIBUTE: 1 }, Se = (e) => (...t) => ({ _$litDirective$: e, values: t });
|
|
1854
|
-
let ke = class {
|
|
1903
|
+
const Ce = { ATTRIBUTE: 1 }, Ee = (e) => (...t) => ({ _$litDirective$: e, values: t });
|
|
1904
|
+
let Ae = class {
|
|
1855
1905
|
constructor(t) {
|
|
1856
1906
|
}
|
|
1857
1907
|
get _$AU() {
|
|
@@ -1872,10 +1922,10 @@ let ke = class {
|
|
|
1872
1922
|
* Copyright 2018 Google LLC
|
|
1873
1923
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1874
1924
|
*/
|
|
1875
|
-
const v =
|
|
1925
|
+
const v = Ee(class extends Ae {
|
|
1876
1926
|
constructor(e) {
|
|
1877
1927
|
var t;
|
|
1878
|
-
if (super(e), e.type !==
|
|
1928
|
+
if (super(e), e.type !== Ce.ATTRIBUTE || e.name !== "class" || ((t = e.strings) == null ? void 0 : t.length) > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
|
|
1879
1929
|
}
|
|
1880
1930
|
render(e) {
|
|
1881
1931
|
return " " + Object.keys(e).filter((t) => e[t]).join(" ") + " ";
|
|
@@ -1893,10 +1943,10 @@ const v = Se(class extends ke {
|
|
|
1893
1943
|
const a = !!t[r];
|
|
1894
1944
|
a === this.st.has(r) || (o = this.nt) != null && o.has(r) || (a ? (s.add(r), this.st.add(r)) : (s.remove(r), this.st.delete(r)));
|
|
1895
1945
|
}
|
|
1896
|
-
return
|
|
1946
|
+
return H;
|
|
1897
1947
|
}
|
|
1898
1948
|
});
|
|
1899
|
-
function
|
|
1949
|
+
function zt(e, t = {}) {
|
|
1900
1950
|
if (!e || e.length === 0)
|
|
1901
1951
|
return l`<div class="pc-bar-chart pc-bar-chart--empty">No data available</div>`;
|
|
1902
1952
|
const s = Math.max(...e.map((r) => r.value)), o = { ...{
|
|
@@ -1911,11 +1961,11 @@ function Tt(e, t = {}) {
|
|
|
1911
1961
|
const n = `
|
|
1912
1962
|
width: ${s > 0 ? r.value / s * o.maxWidth : 0}%;
|
|
1913
1963
|
background-color: ${o.barColor};
|
|
1914
|
-
`, c = o.labelFormatter(r.label),
|
|
1964
|
+
`, c = o.labelFormatter(r.label), h = c && l`<span class="pc-bar-label-text">${c}</span>`;
|
|
1915
1965
|
return l`
|
|
1916
1966
|
<div class="pc-bar-row">
|
|
1917
1967
|
<div class="pc-bar-label">
|
|
1918
|
-
${
|
|
1968
|
+
${h}
|
|
1919
1969
|
<span class="pc-bar-label-icon">${r.icon}</span>
|
|
1920
1970
|
</div>
|
|
1921
1971
|
<div class="pc-bar-container">
|
|
@@ -1928,9 +1978,9 @@ function Tt(e, t = {}) {
|
|
|
1928
1978
|
</div>
|
|
1929
1979
|
`;
|
|
1930
1980
|
}
|
|
1931
|
-
const
|
|
1932
|
-
var
|
|
1933
|
-
function
|
|
1981
|
+
const lt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='20'%20height='5'%20viewBox='0%200%2020%205'%20fill='currentColor'%3e%3ccircle%20cx='3'%20cy='2.5'%20r='1.5'%20opacity='0.3'%3e%3canimate%20attributeName='opacity'%20begin='0s'%20dur='1s'%20values='0.3;0.8;0.3'%20repeatCount='indefinite'/%3e%3c/circle%3e%3ccircle%20cx='10'%20cy='2.5'%20r='1.5'%20opacity='0.3'%3e%3canimate%20attributeName='opacity'%20begin='0.2s'%20dur='1s'%20values='0.3;0.8;0.3'%20repeatCount='indefinite'/%3e%3c/circle%3e%3ccircle%20cx='17'%20cy='2.5'%20r='1.5'%20opacity='0.3'%3e%3canimate%20attributeName='opacity'%20begin='0.4s'%20dur='1s'%20values='0.3;0.8;0.3'%20repeatCount='indefinite'/%3e%3c/circle%3e%3c/svg%3e", bt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='currentColor'%3e%3cpath%20d='M200-200h57l391-391-57-57-391%20391v57Zm-80%2080v-170l528-527q12-11%2026.5-17t30.5-6q16%200%2031%206t26%2018l55%2056q12%2011%2017.5%2026t5.5%2030q0%2016-5.5%2030.5T817-647L290-120H120Zm640-584-56-56%2056%2056Zm-141%2085-28-29%2057%2057-29-28Z'/%3e%3c/svg%3e", Nt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='%23434343'%3e%3cpath%20d='M640-160v-280h160v280H640Zm-240%200v-640h160v640H400Zm-240%200v-440h160v440H160Z'/%3e%3c/svg%3e", It = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='%23434343'%3e%3cpath%20d='M160-160v-440h160v440H160Zm240%200v-400l160%20160v240H400Zm160-354L400-674v-126h160v286Zm240%20240L640-434v-6h160v166Zm-9%20219L55-791l57-57%20736%20736-57%2057Z'/%3e%3c/svg%3e";
|
|
1982
|
+
var Rt = /* @__PURE__ */ ((e) => (e.DECORATIVE = "decorative", e.FUNCTIONAL = "functional", e.STATUS = "status", e))(Rt || {});
|
|
1983
|
+
function _e(e, t = {}) {
|
|
1934
1984
|
const {
|
|
1935
1985
|
type: s = "functional",
|
|
1936
1986
|
alt: i,
|
|
@@ -1945,24 +1995,24 @@ function Ee(e, t = {}) {
|
|
|
1945
1995
|
s === "functional" && !i && !o && console.warn(
|
|
1946
1996
|
`No alt text or aria-label provided for functional icon in ${a}. This may cause accessibility issues.`
|
|
1947
1997
|
);
|
|
1948
|
-
const n = r ? " (selected)" : "", c =
|
|
1998
|
+
const n = r ? " (selected)" : "", c = Mt(e) && !i ? "" : i || e, h = o || (c ? `${c}${n}` : n);
|
|
1949
1999
|
return {
|
|
1950
2000
|
alt: c,
|
|
1951
|
-
ariaLabel:
|
|
2001
|
+
ariaLabel: h,
|
|
1952
2002
|
ariaHidden: !1
|
|
1953
2003
|
};
|
|
1954
2004
|
}
|
|
1955
|
-
function
|
|
2005
|
+
function Ut(e, t = "polite") {
|
|
1956
2006
|
let s = document.getElementById("screen-reader-announcer");
|
|
1957
2007
|
s ? s.setAttribute("aria-live", t) : (s = document.createElement("div"), s.id = "screen-reader-announcer", s.setAttribute("aria-live", t), s.setAttribute("role", "status"), s.setAttribute("aria-atomic", "true"), s.style.position = "absolute", s.style.width = "1px", s.style.height = "1px", s.style.margin = "-1px", s.style.padding = "0", s.style.overflow = "hidden", s.style.clip = "rect(0, 0, 0, 0)", s.style.whiteSpace = "nowrap", s.style.border = "0", document.body.appendChild(s)), s.textContent = "", setTimeout(() => {
|
|
1958
2008
|
s.textContent = e;
|
|
1959
2009
|
}, 50);
|
|
1960
2010
|
}
|
|
1961
|
-
function
|
|
2011
|
+
function Lt(e, t) {
|
|
1962
2012
|
return `${e}: ${t}`;
|
|
1963
2013
|
}
|
|
1964
|
-
var
|
|
1965
|
-
function
|
|
2014
|
+
var w = /* @__PURE__ */ ((e) => (e.BUTTON = "button", e.CHECKBOX = "checkbox", e.RADIO = "radio", e.RADIOGROUP = "radiogroup", e.SWITCH = "switch", e.TAB = "tab", e.TABLIST = "tablist", e.TABPANEL = "tabpanel", e.MENU = "menu", e.MENUITEM = "menuitem", e.MENUITEMCHECKBOX = "menuitemcheckbox", e.MENUITEMRADIO = "menuitemradio", e.SLIDER = "slider", e.TEXTBOX = "textbox", e.COMBOBOX = "combobox", e.LISTBOX = "listbox", e.OPTION = "option", e.PROGRESSBAR = "progressbar", e.STATUS = "status", e.ALERT = "alert", e.DIALOG = "dialog", e.GROUP = "group", e.REGION = "region", e.NONE = "none", e.PRESENTATION = "presentation", e))(w || {});
|
|
2015
|
+
function O(e) {
|
|
1966
2016
|
const t = {};
|
|
1967
2017
|
e.role !== void 0 && (t.role = e.role);
|
|
1968
2018
|
for (const [s, i] of Object.entries(e)) {
|
|
@@ -1972,26 +2022,26 @@ function M(e) {
|
|
|
1972
2022
|
}
|
|
1973
2023
|
return t;
|
|
1974
2024
|
}
|
|
1975
|
-
function
|
|
1976
|
-
return
|
|
2025
|
+
function As(e, t, s) {
|
|
2026
|
+
return O({
|
|
1977
2027
|
role: "button",
|
|
1978
2028
|
ariaLabel: e,
|
|
1979
2029
|
ariaPressed: t,
|
|
1980
2030
|
ariaDisabled: s
|
|
1981
2031
|
});
|
|
1982
2032
|
}
|
|
1983
|
-
function
|
|
1984
|
-
return
|
|
2033
|
+
function le(e, t, s, i = !1) {
|
|
2034
|
+
return O({
|
|
1985
2035
|
role: i ? "radio" : "checkbox",
|
|
1986
2036
|
ariaLabel: e,
|
|
1987
2037
|
ariaChecked: t,
|
|
1988
2038
|
ariaDisabled: s
|
|
1989
2039
|
});
|
|
1990
2040
|
}
|
|
1991
|
-
var
|
|
1992
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
2041
|
+
var _s = Object.defineProperty, Ps = Object.getOwnPropertyDescriptor, q = (e, t, s, i) => {
|
|
2042
|
+
for (var o = i > 1 ? void 0 : i ? Ps(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
1993
2043
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
1994
|
-
return i && o &&
|
|
2044
|
+
return i && o && _s(t, s, o), o;
|
|
1995
2045
|
};
|
|
1996
2046
|
let T = class extends u {
|
|
1997
2047
|
constructor() {
|
|
@@ -2042,15 +2092,15 @@ let T = class extends u {
|
|
|
2042
2092
|
* Render NPS buttons for edit mode
|
|
2043
2093
|
*/
|
|
2044
2094
|
renderEditNps() {
|
|
2045
|
-
const e = this.getCurrentScore(), t = this.hasUserScore(), s = Array.from({ length: this.max - this.min + 1 }, (a, n) => n + this.min), i = `nps-control-${this.name || this.widgetType}`, o =
|
|
2046
|
-
role:
|
|
2095
|
+
const e = this.getCurrentScore(), t = this.hasUserScore(), s = Array.from({ length: this.max - this.min + 1 }, (a, n) => n + this.min), i = `nps-control-${this.name || this.widgetType}`, o = O({
|
|
2096
|
+
role: w.GROUP,
|
|
2047
2097
|
ariaLabel: this.label || "NPS Rating",
|
|
2048
2098
|
ariaDescribedby: `${i}-description`
|
|
2049
2099
|
}), r = s.map((a) => {
|
|
2050
2100
|
const n = t && a === Math.round(e), c = {
|
|
2051
2101
|
"nps-button": !0,
|
|
2052
2102
|
selected: n
|
|
2053
|
-
},
|
|
2103
|
+
}, h = As(`Rate ${a}`, n, this.readonly);
|
|
2054
2104
|
return l`
|
|
2055
2105
|
<button
|
|
2056
2106
|
data-testid="nps-button-${a}"
|
|
@@ -2065,7 +2115,7 @@ let T = class extends u {
|
|
|
2065
2115
|
?disabled="${this.readonly}"
|
|
2066
2116
|
?readonly="${this.readonly}"
|
|
2067
2117
|
id="${i}-option-${a}"
|
|
2068
|
-
...=${
|
|
2118
|
+
...=${h}
|
|
2069
2119
|
>
|
|
2070
2120
|
${a}
|
|
2071
2121
|
</button>
|
|
@@ -2093,8 +2143,8 @@ let T = class extends u {
|
|
|
2093
2143
|
"nps-button": !0,
|
|
2094
2144
|
selected: !0,
|
|
2095
2145
|
"view-mode": !0
|
|
2096
|
-
}, i =
|
|
2097
|
-
role:
|
|
2146
|
+
}, i = O({
|
|
2147
|
+
role: w.PRESENTATION
|
|
2098
2148
|
}), o = l`
|
|
2099
2149
|
<button
|
|
2100
2150
|
data-testid="nps-view-display"
|
|
@@ -2115,24 +2165,18 @@ let T = class extends u {
|
|
|
2115
2165
|
*/
|
|
2116
2166
|
renderChart(e) {
|
|
2117
2167
|
var n;
|
|
2118
|
-
if (e && ["bottom", "top"].includes(this.statsPosition || ""))
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
return h;
|
|
2122
|
-
if (!this.isChartVisible || this.isEditMode) return h;
|
|
2123
|
-
if (!this.showChart || !this.hasStats()) return h;
|
|
2124
|
-
if (this.statsIsLoading || !((n = this.stats) != null && n.breakdown)) return h;
|
|
2125
|
-
const t = Object.values(this.stats.breakdown).reduce((c, p) => c + p, 0), s = Object.entries(this.stats.breakdown).map(
|
|
2126
|
-
([c, p]) => ({
|
|
2168
|
+
if (e && ["bottom", "top"].includes(this.statsPosition || "") || !e && ["left", "right"].includes(this.statsPosition || "") || !this.isChartVisible || this.isEditMode || !this.showChart || !this.hasStats() || this.statsIsLoading || !((n = this.stats) != null && n.breakdown)) return d;
|
|
2169
|
+
const t = Object.values(this.stats.breakdown).reduce((c, h) => c + h, 0), s = Object.entries(this.stats.breakdown).map(
|
|
2170
|
+
([c, h]) => ({
|
|
2127
2171
|
label: c,
|
|
2128
|
-
value:
|
|
2172
|
+
value: h
|
|
2129
2173
|
})
|
|
2130
|
-
), o = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", r =
|
|
2174
|
+
), o = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", r = zt(s, {
|
|
2131
2175
|
barColor: o,
|
|
2132
2176
|
labelFormatter: (c) => `${c}`,
|
|
2133
2177
|
valueFormatter: (c) => `${t > 0 ? Math.round(c / t * 100) : 0}%`
|
|
2134
|
-
}), a =
|
|
2135
|
-
role:
|
|
2178
|
+
}), a = O({
|
|
2179
|
+
role: w.REGION,
|
|
2136
2180
|
ariaLabel: `Results chart for ${this.label || "NPS Rating"}`
|
|
2137
2181
|
});
|
|
2138
2182
|
return l`
|
|
@@ -2158,10 +2202,10 @@ let T = class extends u {
|
|
|
2158
2202
|
* Render stats text
|
|
2159
2203
|
*/
|
|
2160
2204
|
renderStatsText() {
|
|
2161
|
-
if (!this.showStats) return
|
|
2205
|
+
if (!this.showStats) return d;
|
|
2162
2206
|
if (this.statsIsLoading)
|
|
2163
2207
|
return l`<span class="pc-stats-text">
|
|
2164
|
-
<img src="${
|
|
2208
|
+
<img src="${lt}" alt="Loading" class="pc-loading-icon" />
|
|
2165
2209
|
</span>`;
|
|
2166
2210
|
const e = this.statsText || "{avg} ({count})", t = this.formatStatsText(e), s = !this.readonly && this.showChart && this.hasStats();
|
|
2167
2211
|
return l`
|
|
@@ -2169,7 +2213,7 @@ let T = class extends u {
|
|
|
2169
2213
|
${t}
|
|
2170
2214
|
${s ? l`
|
|
2171
2215
|
<img
|
|
2172
|
-
src="${this.isChartVisible ?
|
|
2216
|
+
src="${this.isChartVisible ? It : Nt}"
|
|
2173
2217
|
alt="${this.isChartVisible ? "Hide chart" : "Show chart"}"
|
|
2174
2218
|
class="chart-toggle-icon"
|
|
2175
2219
|
data-testid="nps-chart-toggle-button"
|
|
@@ -2178,7 +2222,7 @@ let T = class extends u {
|
|
|
2178
2222
|
tabindex="0"
|
|
2179
2223
|
@keydown="${this.handleChartToggleKeyDown}"
|
|
2180
2224
|
/>
|
|
2181
|
-
` :
|
|
2225
|
+
` : d}
|
|
2182
2226
|
</span>
|
|
2183
2227
|
`;
|
|
2184
2228
|
}
|
|
@@ -2186,20 +2230,20 @@ let T = class extends u {
|
|
|
2186
2230
|
* Render add/edit button
|
|
2187
2231
|
*/
|
|
2188
2232
|
renderActionButton() {
|
|
2189
|
-
if (this.readonly || this.isEditMode || this.statsIsLoading) return
|
|
2233
|
+
if (this.readonly || this.isEditMode || this.statsIsLoading) return d;
|
|
2190
2234
|
const e = this.hasUserScore(), t = e ? "Edit rating" : "Add rating";
|
|
2191
2235
|
return l`
|
|
2192
2236
|
<div class="action-button-container">
|
|
2193
2237
|
${e ? l`<span class="thank-you-msg" data-testid="nps-thank-you-msg"
|
|
2194
2238
|
>${this.thankYouMsg}</span
|
|
2195
|
-
>` :
|
|
2239
|
+
>` : d}
|
|
2196
2240
|
<button
|
|
2197
2241
|
class="action-btn"
|
|
2198
2242
|
data-testid="nps-action-button"
|
|
2199
2243
|
@click="${this.handleEnterEditMode}"
|
|
2200
2244
|
aria-label="${t}"
|
|
2201
2245
|
>
|
|
2202
|
-
<img src="${
|
|
2246
|
+
<img src="${bt}" alt="${t}" class="icon" />
|
|
2203
2247
|
</button>
|
|
2204
2248
|
</div>
|
|
2205
2249
|
`;
|
|
@@ -2217,7 +2261,7 @@ let T = class extends u {
|
|
|
2217
2261
|
if (this.readonly) return;
|
|
2218
2262
|
this.hoverValue = -1;
|
|
2219
2263
|
const t = this.label || "NPS", s = `Rated ${e} out of ${this.max}`;
|
|
2220
|
-
|
|
2264
|
+
Ut(Lt(t, s)), await this.handleChange(e, [String(e)]), this.isEditMode = !1;
|
|
2221
2265
|
}
|
|
2222
2266
|
/**
|
|
2223
2267
|
* Render min/max labels
|
|
@@ -2236,9 +2280,9 @@ let T = class extends u {
|
|
|
2236
2280
|
renderContent() {
|
|
2237
2281
|
return this.isEditMode ? l`
|
|
2238
2282
|
<div class="pc-section" data-testid="nps-edit-section">
|
|
2239
|
-
${this.minMaxPosition === "top" ? this.renderMinMaxLabels() :
|
|
2283
|
+
${this.minMaxPosition === "top" ? this.renderMinMaxLabels() : d}
|
|
2240
2284
|
${this.renderEditNps()}
|
|
2241
|
-
${this.minMaxPosition === "bottom" ? this.renderMinMaxLabels() :
|
|
2285
|
+
${this.minMaxPosition === "bottom" ? this.renderMinMaxLabels() : d}
|
|
2242
2286
|
</div>
|
|
2243
2287
|
` : l`
|
|
2244
2288
|
<div class="pc-section" data-testid="nps-view-section">
|
|
@@ -2252,15 +2296,15 @@ let T = class extends u {
|
|
|
2252
2296
|
render() {
|
|
2253
2297
|
const e = {
|
|
2254
2298
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
2255
|
-
[`pc-flex-align-${
|
|
2299
|
+
[`pc-flex-align-${R(this.labelPosition, this.labelAlign)}`]: !0,
|
|
2256
2300
|
"edit-mode": this.isEditMode,
|
|
2257
2301
|
"view-mode": !this.isEditMode
|
|
2258
2302
|
}, t = {
|
|
2259
2303
|
nps: !0,
|
|
2260
2304
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
2261
|
-
[`pc-flex-align-${
|
|
2262
|
-
}, s =
|
|
2263
|
-
role:
|
|
2305
|
+
[`pc-flex-align-${R(this.statsPosition, this.statsAlign)}`]: !0
|
|
2306
|
+
}, s = O({
|
|
2307
|
+
role: w.REGION,
|
|
2264
2308
|
ariaLabel: this.label || "NPS Rating"
|
|
2265
2309
|
});
|
|
2266
2310
|
return l`
|
|
@@ -2271,40 +2315,40 @@ let T = class extends u {
|
|
|
2271
2315
|
>
|
|
2272
2316
|
${this.renderLabel()}
|
|
2273
2317
|
<div class="pc-body ${v(t)}" data-testid="nps-body">
|
|
2274
|
-
${this.isEditMode ?
|
|
2275
|
-
${this.isEditMode ?
|
|
2318
|
+
${this.isEditMode ? d : this.renderStatsText()}
|
|
2319
|
+
${this.isEditMode ? d : this.renderChart(!1)} ${this.renderContent()}
|
|
2276
2320
|
</div>
|
|
2277
|
-
${this.isEditMode ?
|
|
2321
|
+
${this.isEditMode ? d : this.renderChart(!0)}
|
|
2278
2322
|
</div>
|
|
2279
2323
|
`;
|
|
2280
2324
|
}
|
|
2281
2325
|
};
|
|
2282
|
-
T.styles = [...u.styles,
|
|
2283
|
-
|
|
2284
|
-
|
|
2326
|
+
T.styles = [...u.styles, Es];
|
|
2327
|
+
q([
|
|
2328
|
+
p({ type: String, attribute: "min-label" })
|
|
2285
2329
|
], T.prototype, "minLabel", 2);
|
|
2286
|
-
|
|
2287
|
-
|
|
2330
|
+
q([
|
|
2331
|
+
p({ type: String, attribute: "max-label" })
|
|
2288
2332
|
], T.prototype, "maxLabel", 2);
|
|
2289
|
-
|
|
2290
|
-
|
|
2333
|
+
q([
|
|
2334
|
+
p({ type: String, attribute: "thank-you-msg" })
|
|
2291
2335
|
], T.prototype, "thankYouMsg", 2);
|
|
2292
|
-
|
|
2293
|
-
|
|
2336
|
+
q([
|
|
2337
|
+
p({ type: String, attribute: "min-max-position" })
|
|
2294
2338
|
], T.prototype, "minMaxPosition", 2);
|
|
2295
|
-
|
|
2339
|
+
q([
|
|
2296
2340
|
y()
|
|
2297
2341
|
], T.prototype, "isChartVisible", 2);
|
|
2298
|
-
|
|
2342
|
+
q([
|
|
2299
2343
|
y()
|
|
2300
2344
|
], T.prototype, "isEditMode", 2);
|
|
2301
|
-
|
|
2345
|
+
q([
|
|
2302
2346
|
y()
|
|
2303
2347
|
], T.prototype, "hoverValue", 2);
|
|
2304
|
-
T =
|
|
2305
|
-
|
|
2348
|
+
T = q([
|
|
2349
|
+
F("pc-nps")
|
|
2306
2350
|
], T);
|
|
2307
|
-
const
|
|
2351
|
+
const Os = B`
|
|
2308
2352
|
/* Add responsive sizing with CSS variables */
|
|
2309
2353
|
:host {
|
|
2310
2354
|
--pc-checkbox-size: clamp(1em, calc(0.8em + 0.3vw), 1.4em);
|
|
@@ -2741,12 +2785,12 @@ const Cs = H`
|
|
|
2741
2785
|
gap: 0.5em;
|
|
2742
2786
|
}
|
|
2743
2787
|
`;
|
|
2744
|
-
var
|
|
2745
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
2788
|
+
var Ts = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, Q = (e, t, s, i) => {
|
|
2789
|
+
for (var o = i > 1 ? void 0 : i ? Ms(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
2746
2790
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
2747
|
-
return i && o &&
|
|
2791
|
+
return i && o && Ts(t, s, o), o;
|
|
2748
2792
|
};
|
|
2749
|
-
let
|
|
2793
|
+
let P = class extends V {
|
|
2750
2794
|
constructor() {
|
|
2751
2795
|
super(...arguments), this.value = "", this.icon = "", this.tooltip = "", this.disabled = !1, this.selected = !1;
|
|
2752
2796
|
}
|
|
@@ -2765,33 +2809,33 @@ let O = class extends mt {
|
|
|
2765
2809
|
return l` <slot></slot> `;
|
|
2766
2810
|
}
|
|
2767
2811
|
};
|
|
2768
|
-
|
|
2812
|
+
P.styles = B`
|
|
2769
2813
|
:host {
|
|
2770
2814
|
display: none;
|
|
2771
2815
|
}
|
|
2772
2816
|
`;
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
],
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
],
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
],
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
],
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
],
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
],
|
|
2791
|
-
var
|
|
2792
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
2817
|
+
Q([
|
|
2818
|
+
p({ type: String, reflect: !0 })
|
|
2819
|
+
], P.prototype, "value", 2);
|
|
2820
|
+
Q([
|
|
2821
|
+
p({ type: String })
|
|
2822
|
+
], P.prototype, "icon", 2);
|
|
2823
|
+
Q([
|
|
2824
|
+
p({ type: String })
|
|
2825
|
+
], P.prototype, "tooltip", 2);
|
|
2826
|
+
Q([
|
|
2827
|
+
p({ type: Boolean, reflect: !0 })
|
|
2828
|
+
], P.prototype, "disabled", 2);
|
|
2829
|
+
Q([
|
|
2830
|
+
p({ type: Boolean, reflect: !0 })
|
|
2831
|
+
], P.prototype, "selected", 2);
|
|
2832
|
+
P = Q([
|
|
2833
|
+
F("pc-poll-option")
|
|
2834
|
+
], P);
|
|
2835
|
+
var zs = Object.defineProperty, Ns = Object.getOwnPropertyDescriptor, z = (e, t, s, i) => {
|
|
2836
|
+
for (var o = i > 1 ? void 0 : i ? Ns(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
2793
2837
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
2794
|
-
return i && o &&
|
|
2838
|
+
return i && o && zs(t, s, o), o;
|
|
2795
2839
|
};
|
|
2796
2840
|
let C = class extends u {
|
|
2797
2841
|
constructor() {
|
|
@@ -2821,7 +2865,7 @@ let C = class extends u {
|
|
|
2821
2865
|
getSlottedOptions() {
|
|
2822
2866
|
var s;
|
|
2823
2867
|
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot");
|
|
2824
|
-
return e ? e.assignedElements().filter((i) => i instanceof
|
|
2868
|
+
return e ? e.assignedElements().filter((i) => i instanceof P).map((i) => {
|
|
2825
2869
|
var o, r;
|
|
2826
2870
|
return {
|
|
2827
2871
|
value: i.value || i.labelContent || ((o = i.textContent) == null ? void 0 : o.trim()) || "",
|
|
@@ -2902,7 +2946,7 @@ let C = class extends u {
|
|
|
2902
2946
|
if (!this.slotExists) return;
|
|
2903
2947
|
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot");
|
|
2904
2948
|
if (!e) return;
|
|
2905
|
-
e.assignedElements().filter((i) => i instanceof
|
|
2949
|
+
e.assignedElements().filter((i) => i instanceof P).forEach((i) => {
|
|
2906
2950
|
i.selected = this.isSelected(i.value);
|
|
2907
2951
|
});
|
|
2908
2952
|
}
|
|
@@ -2914,7 +2958,7 @@ let C = class extends u {
|
|
|
2914
2958
|
if (!this.slotExists) return;
|
|
2915
2959
|
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot");
|
|
2916
2960
|
if (!e) return;
|
|
2917
|
-
e.assignedElements().filter((i) => i instanceof
|
|
2961
|
+
e.assignedElements().filter((i) => i instanceof P).forEach((i) => {
|
|
2918
2962
|
i.selected = this.pendingSelections.includes(i.value);
|
|
2919
2963
|
});
|
|
2920
2964
|
}
|
|
@@ -2923,21 +2967,21 @@ let C = class extends u {
|
|
|
2923
2967
|
*/
|
|
2924
2968
|
renderOptionIcon(e, t) {
|
|
2925
2969
|
if (!e) return "";
|
|
2926
|
-
const s =
|
|
2970
|
+
const s = Rt.DECORATIVE, i = `Poll for: ${t == null ? void 0 : t.label}`, o = (t == null ? void 0 : t.label) || "", r = t ? this.isSelected(t.value) : !1, a = _e(e, {
|
|
2927
2971
|
type: s,
|
|
2928
2972
|
alt: o,
|
|
2929
2973
|
isSelected: r,
|
|
2930
2974
|
componentName: i
|
|
2931
2975
|
});
|
|
2932
|
-
return
|
|
2976
|
+
return xe(e) ? l`<span
|
|
2933
2977
|
class="poll-option-icon"
|
|
2934
2978
|
aria-hidden="${a.ariaHidden ? "true" : "false"}"
|
|
2935
2979
|
>${e}</span
|
|
2936
|
-
>` :
|
|
2980
|
+
>` : Mt(e) ? l`<img
|
|
2937
2981
|
src="${e}"
|
|
2938
2982
|
alt="${a.alt}"
|
|
2939
2983
|
class="poll-option-icon-img"
|
|
2940
|
-
aria-label="${a.ariaLabel ||
|
|
2984
|
+
aria-label="${a.ariaLabel || d}"
|
|
2941
2985
|
aria-hidden="${a.ariaHidden ? "true" : "false"}"
|
|
2942
2986
|
/>` : l`<span
|
|
2943
2987
|
class="poll-option-icon"
|
|
@@ -2949,7 +2993,7 @@ let C = class extends u {
|
|
|
2949
2993
|
* Renders the selection indicator (checkbox or radio button) with proper ARIA roles
|
|
2950
2994
|
*/
|
|
2951
2995
|
renderSelectionIndicator() {
|
|
2952
|
-
const e = this.multiple ?
|
|
2996
|
+
const e = this.multiple ? w.CHECKBOX : w.RADIO;
|
|
2953
2997
|
return this.multiple ? l`<span class="poll-checkbox" role="${e}"></span>` : l`<span class="poll-radio" role="${e}"></span>`;
|
|
2954
2998
|
}
|
|
2955
2999
|
/**
|
|
@@ -2960,7 +3004,7 @@ let C = class extends u {
|
|
|
2960
3004
|
"poll-option": !0,
|
|
2961
3005
|
selected: s,
|
|
2962
3006
|
disabled: e.disabled || !1
|
|
2963
|
-
}, o = t + 1, r = `poll-${this.widgetType}-${o}`, a =
|
|
3007
|
+
}, o = t + 1, r = `poll-${this.widgetType}-${o}`, a = le(
|
|
2964
3008
|
e.label,
|
|
2965
3009
|
s,
|
|
2966
3010
|
e.disabled || this.readonly,
|
|
@@ -2988,7 +3032,7 @@ let C = class extends u {
|
|
|
2988
3032
|
* Render submit button for multiple selection
|
|
2989
3033
|
*/
|
|
2990
3034
|
renderSubmitButton() {
|
|
2991
|
-
if (!this.multiple || !this.isEditMode) return
|
|
3035
|
+
if (!this.multiple || !this.isEditMode) return d;
|
|
2992
3036
|
const e = this.pendingSelections.length === 0;
|
|
2993
3037
|
return l`
|
|
2994
3038
|
<button
|
|
@@ -3006,7 +3050,7 @@ let C = class extends u {
|
|
|
3006
3050
|
* Render poll options with proper grouping role
|
|
3007
3051
|
*/
|
|
3008
3052
|
renderPollOptions() {
|
|
3009
|
-
const e = this.multiple ?
|
|
3053
|
+
const e = this.multiple ? w.GROUP : w.RADIOGROUP, t = this.label || this.name || "Options", s = O({
|
|
3010
3054
|
role: e,
|
|
3011
3055
|
ariaLabel: t
|
|
3012
3056
|
});
|
|
@@ -3028,7 +3072,7 @@ let C = class extends u {
|
|
|
3028
3072
|
renderEditToggleIcon(e = "edit-toggle-button") {
|
|
3029
3073
|
return l`
|
|
3030
3074
|
<img
|
|
3031
|
-
src="${
|
|
3075
|
+
src="${bt}"
|
|
3032
3076
|
alt="Edit vote"
|
|
3033
3077
|
class="edit-toggle-icon"
|
|
3034
3078
|
data-testid="${e}"
|
|
@@ -3057,16 +3101,16 @@ let C = class extends u {
|
|
|
3057
3101
|
* Renders stats with ARIA live updates for screen readers
|
|
3058
3102
|
*/
|
|
3059
3103
|
renderStats() {
|
|
3060
|
-
if (!this.statsText) return
|
|
3104
|
+
if (!this.statsText) return d;
|
|
3061
3105
|
if (this.statsIsLoading) {
|
|
3062
|
-
const s =
|
|
3106
|
+
const s = O({
|
|
3063
3107
|
ariaLabel: "Loading poll statistics",
|
|
3064
3108
|
ariaBusy: !0
|
|
3065
3109
|
});
|
|
3066
3110
|
return l`
|
|
3067
3111
|
<span data-testid="poll-stats-loading" class="pc-stats-text" ...=${s}>
|
|
3068
3112
|
<img
|
|
3069
|
-
src="${
|
|
3113
|
+
src="${lt}"
|
|
3070
3114
|
alt="Loading poll statistics"
|
|
3071
3115
|
class="pc-loading-icon"
|
|
3072
3116
|
aria-hidden="true"
|
|
@@ -3080,10 +3124,10 @@ let C = class extends u {
|
|
|
3080
3124
|
<span
|
|
3081
3125
|
data-testid="poll-stats"
|
|
3082
3126
|
class="pc-stats-text"
|
|
3083
|
-
role="${
|
|
3127
|
+
role="${w.STATUS}"
|
|
3084
3128
|
aria-live="polite"
|
|
3085
3129
|
>
|
|
3086
|
-
${e} ${t ? this.renderEditToggleIcon("poll-edit-toggle-button") :
|
|
3130
|
+
${e} ${t ? this.renderEditToggleIcon("poll-edit-toggle-button") : d}
|
|
3087
3131
|
</span>
|
|
3088
3132
|
`;
|
|
3089
3133
|
}
|
|
@@ -3144,7 +3188,7 @@ let C = class extends u {
|
|
|
3144
3188
|
* Render poll options with previous selections but disabled (for view mode)
|
|
3145
3189
|
*/
|
|
3146
3190
|
renderDisabledPollOptions() {
|
|
3147
|
-
const e = this.multiple ?
|
|
3191
|
+
const e = this.multiple ? w.GROUP : w.RADIOGROUP, t = this.label || this.name || "Options", s = O({
|
|
3148
3192
|
role: e,
|
|
3149
3193
|
ariaLabel: t
|
|
3150
3194
|
});
|
|
@@ -3162,7 +3206,7 @@ let C = class extends u {
|
|
|
3162
3206
|
"poll-option--disabled": !0,
|
|
3163
3207
|
selected: r,
|
|
3164
3208
|
disabled: !0
|
|
3165
|
-
}, n = o + 1, c = `poll-${this.widgetType}-disabled-${n}`,
|
|
3209
|
+
}, n = o + 1, c = `poll-${this.widgetType}-disabled-${n}`, h = le(
|
|
3166
3210
|
i.label,
|
|
3167
3211
|
r,
|
|
3168
3212
|
!0,
|
|
@@ -3177,7 +3221,7 @@ let C = class extends u {
|
|
|
3177
3221
|
disabled
|
|
3178
3222
|
id="${c}-option-${o}"
|
|
3179
3223
|
title="${i.tooltip || ""}"
|
|
3180
|
-
...=${
|
|
3224
|
+
...=${h}
|
|
3181
3225
|
>
|
|
3182
3226
|
${this.renderSelectionIndicator()} ${this.renderOptionIcon(i.icon, i)}
|
|
3183
3227
|
<span class="poll-option-label">
|
|
@@ -3230,18 +3274,18 @@ let C = class extends u {
|
|
|
3230
3274
|
announceSelectionChange(e, t, s) {
|
|
3231
3275
|
const i = `Poll for: ${e.label}`;
|
|
3232
3276
|
let o = "";
|
|
3233
|
-
this.multiple ? o = (t == null ? void 0 : t.includes(e.value)) || !1 ? `${e.label} selected` : `${e.label} unselected` : o = t && t.length > 0 ? `${e.label} selected` : "Selection cleared",
|
|
3277
|
+
this.multiple ? o = (t == null ? void 0 : t.includes(e.value)) || !1 ? `${e.label} selected` : `${e.label} unselected` : o = t && t.length > 0 ? `${e.label} selected` : "Selection cleared", Ut(Lt(i, o));
|
|
3234
3278
|
}
|
|
3235
3279
|
render() {
|
|
3236
3280
|
const e = {
|
|
3237
3281
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
3238
|
-
[`pc-flex-align-${
|
|
3282
|
+
[`pc-flex-align-${R(this.labelPosition, this.labelAlign)}`]: !0
|
|
3239
3283
|
}, t = "bottom", s = {
|
|
3240
3284
|
poll: !0,
|
|
3241
3285
|
[`pc-flex-pos-${t}`]: !0,
|
|
3242
|
-
[`pc-flex-align-${
|
|
3243
|
-
}, i =
|
|
3244
|
-
role:
|
|
3286
|
+
[`pc-flex-align-${R(t, this.statsAlign)}`]: !0
|
|
3287
|
+
}, i = O({
|
|
3288
|
+
role: w.REGION,
|
|
3245
3289
|
ariaLabel: this.label || this.name || "Poll"
|
|
3246
3290
|
});
|
|
3247
3291
|
return l`
|
|
@@ -3253,45 +3297,45 @@ let C = class extends u {
|
|
|
3253
3297
|
${this.renderLabel()}
|
|
3254
3298
|
<div class="pc-body ${v(s)}" data-testid="poll-body">
|
|
3255
3299
|
${this.renderContent()}
|
|
3256
|
-
${this.showStats && !this.isEditMode ? this.renderStats() :
|
|
3300
|
+
${this.showStats && !this.isEditMode ? this.renderStats() : d}
|
|
3257
3301
|
</div>
|
|
3258
3302
|
<slot @slotchange=${() => this.updateNormalizedOptions()}></slot>
|
|
3259
3303
|
</div>
|
|
3260
3304
|
`;
|
|
3261
3305
|
}
|
|
3262
3306
|
};
|
|
3263
|
-
C.styles = [...u.styles,
|
|
3264
|
-
|
|
3265
|
-
|
|
3307
|
+
C.styles = [...u.styles, Os];
|
|
3308
|
+
z([
|
|
3309
|
+
p({ type: Array })
|
|
3266
3310
|
], C.prototype, "options", 2);
|
|
3267
|
-
|
|
3268
|
-
|
|
3311
|
+
z([
|
|
3312
|
+
p({ type: Boolean, reflect: !0 })
|
|
3269
3313
|
], C.prototype, "multiple", 2);
|
|
3270
|
-
|
|
3271
|
-
|
|
3314
|
+
z([
|
|
3315
|
+
p({ type: String, attribute: "button-radius" })
|
|
3272
3316
|
], C.prototype, "buttonRadius", 2);
|
|
3273
|
-
|
|
3274
|
-
|
|
3317
|
+
z([
|
|
3318
|
+
p({ type: String, attribute: "thank-you-msg" })
|
|
3275
3319
|
], C.prototype, "thankYouMsg", 2);
|
|
3276
|
-
|
|
3277
|
-
|
|
3320
|
+
z([
|
|
3321
|
+
p({ type: String, attribute: "button-text" })
|
|
3278
3322
|
], C.prototype, "buttonText", 2);
|
|
3279
|
-
|
|
3323
|
+
z([
|
|
3280
3324
|
y()
|
|
3281
3325
|
], C.prototype, "normalizedOptions", 2);
|
|
3282
|
-
|
|
3326
|
+
z([
|
|
3283
3327
|
y()
|
|
3284
3328
|
], C.prototype, "slotExists", 2);
|
|
3285
|
-
|
|
3329
|
+
z([
|
|
3286
3330
|
y()
|
|
3287
3331
|
], C.prototype, "isEditMode", 2);
|
|
3288
|
-
|
|
3332
|
+
z([
|
|
3289
3333
|
y()
|
|
3290
3334
|
], C.prototype, "pendingSelections", 2);
|
|
3291
|
-
C =
|
|
3292
|
-
|
|
3335
|
+
C = z([
|
|
3336
|
+
F("pc-poll")
|
|
3293
3337
|
], C);
|
|
3294
|
-
const
|
|
3338
|
+
const Is = B`
|
|
3295
3339
|
.pc-container {
|
|
3296
3340
|
gap: 0.6em;
|
|
3297
3341
|
}
|
|
@@ -3523,12 +3567,12 @@ const Ms = H`
|
|
|
3523
3567
|
}
|
|
3524
3568
|
}
|
|
3525
3569
|
`;
|
|
3526
|
-
var
|
|
3527
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
3570
|
+
var Rs = Object.defineProperty, Us = Object.getOwnPropertyDescriptor, A = (e, t, s, i) => {
|
|
3571
|
+
for (var o = i > 1 ? void 0 : i ? Us(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
3528
3572
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
3529
|
-
return i && o &&
|
|
3573
|
+
return i && o && Rs(t, s, o), o;
|
|
3530
3574
|
};
|
|
3531
|
-
let
|
|
3575
|
+
let $ = class extends u {
|
|
3532
3576
|
constructor() {
|
|
3533
3577
|
super(), this.placeholder = "", this.rows = 3, this.buttonRadius = "sm", this.buttonText = "Submit", this.thankYouMsg = "Thank you for your feedback!", this.textValue = "", this.isEditMode = !0, this.submittedText = "", this.hasUserSubmitted = !1, this.handleEditToggleKeyDown = (e) => {
|
|
3534
3578
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.handleEnterEditMode());
|
|
@@ -3550,7 +3594,7 @@ let w = class extends u {
|
|
|
3550
3594
|
renderEditToggleIcon(e = "text-edit-toggle-button") {
|
|
3551
3595
|
return l`
|
|
3552
3596
|
<img
|
|
3553
|
-
src="${
|
|
3597
|
+
src="${bt}"
|
|
3554
3598
|
alt="Edit feedback"
|
|
3555
3599
|
class="edit-toggle-icon"
|
|
3556
3600
|
data-testid="${e}"
|
|
@@ -3599,7 +3643,7 @@ let w = class extends u {
|
|
|
3599
3643
|
return l`
|
|
3600
3644
|
<span data-testid="text-stats-loading" class="pc-stats-text">
|
|
3601
3645
|
<img
|
|
3602
|
-
src="${
|
|
3646
|
+
src="${lt}"
|
|
3603
3647
|
alt="Loading"
|
|
3604
3648
|
class="pc-loading-icon"
|
|
3605
3649
|
data-testid="text-stats-loading-icon"
|
|
@@ -3613,7 +3657,7 @@ let w = class extends u {
|
|
|
3613
3657
|
* Renders the submit button
|
|
3614
3658
|
*/
|
|
3615
3659
|
renderSubmitButton() {
|
|
3616
|
-
if (this.readonly || this.hasSubmitted() && !this.isEditMode) return
|
|
3660
|
+
if (this.readonly || this.hasSubmitted() && !this.isEditMode) return d;
|
|
3617
3661
|
const e = this.textValue.trim(), t = !this.minlength || e.length >= this.minlength, s = !e || !t;
|
|
3618
3662
|
return l`
|
|
3619
3663
|
<button
|
|
@@ -3725,7 +3769,7 @@ let w = class extends u {
|
|
|
3725
3769
|
render() {
|
|
3726
3770
|
const e = {
|
|
3727
3771
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
3728
|
-
[`pc-flex-align-${
|
|
3772
|
+
[`pc-flex-align-${R(this.labelPosition, this.labelAlign)}`]: !0
|
|
3729
3773
|
};
|
|
3730
3774
|
return l`
|
|
3731
3775
|
<div class="pc-container ${v(e)}" data-testid="text-container">
|
|
@@ -3735,44 +3779,44 @@ let w = class extends u {
|
|
|
3735
3779
|
`;
|
|
3736
3780
|
}
|
|
3737
3781
|
};
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
],
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
],
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
],
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
],
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
],
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
],
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
],
|
|
3760
|
-
|
|
3782
|
+
$.styles = [...u.styles, Is];
|
|
3783
|
+
A([
|
|
3784
|
+
p({ type: String })
|
|
3785
|
+
], $.prototype, "placeholder", 2);
|
|
3786
|
+
A([
|
|
3787
|
+
p({ type: Number })
|
|
3788
|
+
], $.prototype, "maxlength", 2);
|
|
3789
|
+
A([
|
|
3790
|
+
p({ type: Number })
|
|
3791
|
+
], $.prototype, "minlength", 2);
|
|
3792
|
+
A([
|
|
3793
|
+
p({ type: Number, attribute: "rows" })
|
|
3794
|
+
], $.prototype, "rows", 2);
|
|
3795
|
+
A([
|
|
3796
|
+
p({ type: String, attribute: "button-radius" })
|
|
3797
|
+
], $.prototype, "buttonRadius", 2);
|
|
3798
|
+
A([
|
|
3799
|
+
p({ type: String, attribute: "button-text" })
|
|
3800
|
+
], $.prototype, "buttonText", 2);
|
|
3801
|
+
A([
|
|
3802
|
+
p({ type: String, attribute: "thank-you-msg" })
|
|
3803
|
+
], $.prototype, "thankYouMsg", 2);
|
|
3804
|
+
A([
|
|
3761
3805
|
y()
|
|
3762
|
-
],
|
|
3763
|
-
|
|
3806
|
+
], $.prototype, "textValue", 2);
|
|
3807
|
+
A([
|
|
3764
3808
|
y()
|
|
3765
|
-
],
|
|
3766
|
-
|
|
3809
|
+
], $.prototype, "isEditMode", 2);
|
|
3810
|
+
A([
|
|
3767
3811
|
y()
|
|
3768
|
-
],
|
|
3769
|
-
|
|
3812
|
+
], $.prototype, "submittedText", 2);
|
|
3813
|
+
A([
|
|
3770
3814
|
y()
|
|
3771
|
-
],
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
],
|
|
3775
|
-
const
|
|
3815
|
+
], $.prototype, "hasUserSubmitted", 2);
|
|
3816
|
+
$ = A([
|
|
3817
|
+
F("pc-text")
|
|
3818
|
+
], $);
|
|
3819
|
+
const Ls = B`
|
|
3776
3820
|
/* Adjust stats text for reactions */
|
|
3777
3821
|
.pc-stats-text {
|
|
3778
3822
|
font-size: var(--pc-font-size-small, 0.8em);
|
|
@@ -3985,7 +4029,7 @@ const Ns = H`
|
|
|
3985
4029
|
}
|
|
3986
4030
|
|
|
3987
4031
|
/* Media queries handled by base component */
|
|
3988
|
-
`,
|
|
4032
|
+
`, ce = {
|
|
3989
4033
|
// Faces
|
|
3990
4034
|
smile: "😊",
|
|
3991
4035
|
laugh: "😄",
|
|
@@ -4128,19 +4172,19 @@ const Ns = H`
|
|
|
4128
4172
|
hiking: "🥾",
|
|
4129
4173
|
yoga: "🧘"
|
|
4130
4174
|
};
|
|
4131
|
-
function
|
|
4175
|
+
function js(e) {
|
|
4132
4176
|
let t = "❓", s = !1;
|
|
4133
|
-
return e ? e in
|
|
4177
|
+
return e ? e in ce ? t = ce[e] : xe(e) ? t = e : Mt(e) ? (s = !0, t = e) : /^\w+@\w+$/.test(e) ? t = e : e.endsWith(".svg") ? (t = `https://cdn.jsdelivr.net/npm/@mdi/svg@7.4.47/svg/${e}`, s = !0) : t = e : t = "❓", {
|
|
4134
4178
|
icon: t,
|
|
4135
4179
|
isRemoteImage: s
|
|
4136
4180
|
};
|
|
4137
4181
|
}
|
|
4138
|
-
var
|
|
4139
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
4182
|
+
var Ds = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, tt = (e, t, s, i) => {
|
|
4183
|
+
for (var o = i > 1 ? void 0 : i ? Vs(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
4140
4184
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
4141
|
-
return i && o &&
|
|
4185
|
+
return i && o && Ds(t, s, o), o;
|
|
4142
4186
|
};
|
|
4143
|
-
let
|
|
4187
|
+
let M = class extends V {
|
|
4144
4188
|
constructor() {
|
|
4145
4189
|
super(...arguments), this.name = "", this.icon = "", this.tooltip = "", this.disabled = !1, this.selected = !1;
|
|
4146
4190
|
}
|
|
@@ -4159,36 +4203,36 @@ let z = class extends mt {
|
|
|
4159
4203
|
return l` <slot></slot> `;
|
|
4160
4204
|
}
|
|
4161
4205
|
};
|
|
4162
|
-
|
|
4206
|
+
M.styles = B`
|
|
4163
4207
|
:host {
|
|
4164
4208
|
display: none;
|
|
4165
4209
|
}
|
|
4166
4210
|
`;
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
],
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
],
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
],
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
],
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
],
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
],
|
|
4185
|
-
var
|
|
4186
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
4211
|
+
tt([
|
|
4212
|
+
p({ type: String, reflect: !0 })
|
|
4213
|
+
], M.prototype, "name", 2);
|
|
4214
|
+
tt([
|
|
4215
|
+
p({ type: String })
|
|
4216
|
+
], M.prototype, "icon", 2);
|
|
4217
|
+
tt([
|
|
4218
|
+
p({ type: String })
|
|
4219
|
+
], M.prototype, "tooltip", 2);
|
|
4220
|
+
tt([
|
|
4221
|
+
p({ type: Boolean, reflect: !0 })
|
|
4222
|
+
], M.prototype, "disabled", 2);
|
|
4223
|
+
tt([
|
|
4224
|
+
p({ type: Boolean, reflect: !0 })
|
|
4225
|
+
], M.prototype, "selected", 2);
|
|
4226
|
+
M = tt([
|
|
4227
|
+
F("pc-reaction-icon")
|
|
4228
|
+
], M);
|
|
4229
|
+
var Hs = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, N = (e, t, s, i) => {
|
|
4230
|
+
for (var o = i > 1 ? void 0 : i ? Bs(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
4187
4231
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
4188
|
-
return i && o &&
|
|
4232
|
+
return i && o && Hs(t, s, o), o;
|
|
4189
4233
|
};
|
|
4190
|
-
const
|
|
4191
|
-
let
|
|
4234
|
+
const Fs = "/src/images/emoji/add_reaction.svg";
|
|
4235
|
+
let E = class extends u {
|
|
4192
4236
|
constructor() {
|
|
4193
4237
|
super(), this.options = [], this.multiple = !1, this.mode = "compact", this.popupPosition = "auto", this.buttonRadius = "999px", this.normalizedReactions = [], this.slotExists = !1, this.isPopoverVisible = !1, this.isChartVisible = !1, this.handleClickOutside = (e) => {
|
|
4194
4238
|
var o, r;
|
|
@@ -4207,7 +4251,7 @@ let A = class extends u {
|
|
|
4207
4251
|
getSlottedReactions() {
|
|
4208
4252
|
var s;
|
|
4209
4253
|
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot");
|
|
4210
|
-
return e ? e.assignedElements().filter((i) => i instanceof
|
|
4254
|
+
return e ? e.assignedElements().filter((i) => i instanceof M).map((i) => ({
|
|
4211
4255
|
name: i.name || i.labelContent || i.icon,
|
|
4212
4256
|
icon: i.icon,
|
|
4213
4257
|
tooltip: i.tooltip,
|
|
@@ -4275,7 +4319,7 @@ let A = class extends u {
|
|
|
4275
4319
|
if (!this.slotExists) return;
|
|
4276
4320
|
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot");
|
|
4277
4321
|
if (!e) return;
|
|
4278
|
-
e.assignedElements().filter((i) => i instanceof
|
|
4322
|
+
e.assignedElements().filter((i) => i instanceof M).forEach((i) => {
|
|
4279
4323
|
i.selected = this.isSelected(i.name);
|
|
4280
4324
|
});
|
|
4281
4325
|
}
|
|
@@ -4289,7 +4333,7 @@ let A = class extends u {
|
|
|
4289
4333
|
* Renders the icon for a reaction
|
|
4290
4334
|
*/
|
|
4291
4335
|
renderReactionIcon(e, t) {
|
|
4292
|
-
const { icon: s, isRemoteImage: i } =
|
|
4336
|
+
const { icon: s, isRemoteImage: i } = js(e), o = Rt.FUNCTIONAL, r = "reaction", a = t.tooltip || `${t.name} reaction`, n = _e(s, {
|
|
4293
4337
|
type: o,
|
|
4294
4338
|
alt: a,
|
|
4295
4339
|
ariaLabel: a,
|
|
@@ -4300,7 +4344,7 @@ let A = class extends u {
|
|
|
4300
4344
|
class="icon-img"
|
|
4301
4345
|
src="${s}"
|
|
4302
4346
|
alt="${n.alt}"
|
|
4303
|
-
aria-label="${n.ariaLabel ||
|
|
4347
|
+
aria-label="${n.ariaLabel || d}"
|
|
4304
4348
|
aria-hidden="${n.ariaHidden}"
|
|
4305
4349
|
/>` : l`<span class="icon" aria-hidden="${n.ariaHidden}"
|
|
4306
4350
|
>${s}</span
|
|
@@ -4326,7 +4370,7 @@ let A = class extends u {
|
|
|
4326
4370
|
title="${e.tooltip || ""}"
|
|
4327
4371
|
>
|
|
4328
4372
|
${this.renderReactionIcon(e.icon, e)}
|
|
4329
|
-
${t ? l`<span class="count-label">${i}</span>` :
|
|
4373
|
+
${t ? l`<span class="count-label">${i}</span>` : d}
|
|
4330
4374
|
</button>
|
|
4331
4375
|
`;
|
|
4332
4376
|
}
|
|
@@ -4343,7 +4387,7 @@ let A = class extends u {
|
|
|
4343
4387
|
aria-expanded="${this.isPopoverVisible}"
|
|
4344
4388
|
aria-haspopup="menu"
|
|
4345
4389
|
>
|
|
4346
|
-
<img src="${
|
|
4390
|
+
<img src="${Fs}" alt="" class="trigger-icon" />
|
|
4347
4391
|
</button>
|
|
4348
4392
|
`;
|
|
4349
4393
|
}
|
|
@@ -4351,7 +4395,7 @@ let A = class extends u {
|
|
|
4351
4395
|
* Render the popover for compact mode
|
|
4352
4396
|
*/
|
|
4353
4397
|
renderPopover() {
|
|
4354
|
-
if (!this.isPopoverVisible || this.mode !== "compact") return
|
|
4398
|
+
if (!this.isPopoverVisible || this.mode !== "compact") return d;
|
|
4355
4399
|
const e = {
|
|
4356
4400
|
popover: !0,
|
|
4357
4401
|
top: this.popupPosition === "top" || this.popupPosition === "auto" && this.shouldShowPopoverOnTop(),
|
|
@@ -4393,7 +4437,7 @@ let A = class extends u {
|
|
|
4393
4437
|
* Render reactions based on mode
|
|
4394
4438
|
*/
|
|
4395
4439
|
renderReactions() {
|
|
4396
|
-
if (this.normalizedReactions.length === 0) return
|
|
4440
|
+
if (this.normalizedReactions.length === 0) return d;
|
|
4397
4441
|
const e = {
|
|
4398
4442
|
reaction: !0,
|
|
4399
4443
|
expand: this.mode === "expand",
|
|
@@ -4420,7 +4464,7 @@ let A = class extends u {
|
|
|
4420
4464
|
(s) => this.renderReactionButton(s, this.showCounts)
|
|
4421
4465
|
)}
|
|
4422
4466
|
</div>
|
|
4423
|
-
` :
|
|
4467
|
+
` : d}
|
|
4424
4468
|
${this.renderPopover()}
|
|
4425
4469
|
</div>
|
|
4426
4470
|
`;
|
|
@@ -4431,24 +4475,18 @@ let A = class extends u {
|
|
|
4431
4475
|
*/
|
|
4432
4476
|
renderChart(e) {
|
|
4433
4477
|
var a;
|
|
4434
|
-
if (e && ["bottom", "top"].includes(this.statsPosition || ""))
|
|
4435
|
-
return h;
|
|
4436
|
-
if (!e && ["left", "right"].includes(this.statsPosition || ""))
|
|
4437
|
-
return h;
|
|
4438
|
-
if (!this.isChartVisible) return h;
|
|
4439
|
-
if (!this.showChart || !this.hasStats()) return h;
|
|
4440
|
-
if (this.statsIsLoading || !((a = this.stats) != null && a.breakdown)) return h;
|
|
4478
|
+
if (e && ["bottom", "top"].includes(this.statsPosition || "") || !e && ["left", "right"].includes(this.statsPosition || "") || !this.isChartVisible || !this.showChart || !this.hasStats() || this.statsIsLoading || !((a = this.stats) != null && a.breakdown)) return d;
|
|
4441
4479
|
const t = Object.values(this.stats.breakdown).reduce((n, c) => n + c, 0), s = Object.entries(this.stats.breakdown).map(
|
|
4442
4480
|
([n, c]) => {
|
|
4443
|
-
const
|
|
4481
|
+
const h = this.normalizedReactions.find((m) => m.name === n);
|
|
4444
4482
|
return {
|
|
4445
4483
|
label: "",
|
|
4446
4484
|
// do not show label
|
|
4447
4485
|
value: c,
|
|
4448
|
-
icon:
|
|
4486
|
+
icon: h && this.renderReactionIcon((h == null ? void 0 : h.icon) || "", h ?? {}) || ""
|
|
4449
4487
|
};
|
|
4450
4488
|
}
|
|
4451
|
-
), o = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", r =
|
|
4489
|
+
), o = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", r = zt(s, {
|
|
4452
4490
|
barColor: o,
|
|
4453
4491
|
labelFormatter: (n) => `${n}`,
|
|
4454
4492
|
valueFormatter: (n) => `${t > 0 ? Math.round(n / t * 100) : 0}%`
|
|
@@ -4476,11 +4514,10 @@ let A = class extends u {
|
|
|
4476
4514
|
* Render stats similar to other components
|
|
4477
4515
|
*/
|
|
4478
4516
|
renderStats() {
|
|
4479
|
-
if (!this.showStats) return
|
|
4480
|
-
if (!this.statsText) return h;
|
|
4517
|
+
if (!this.showStats || !this.statsText) return d;
|
|
4481
4518
|
if (this.statsIsLoading)
|
|
4482
4519
|
return l`<span class="pc-stats-text" data-testid="stats-text">
|
|
4483
|
-
<img src="${
|
|
4520
|
+
<img src="${lt}" alt="Loading" class="pc-loading-icon" />
|
|
4484
4521
|
</span>`;
|
|
4485
4522
|
if (!this.stats) return "";
|
|
4486
4523
|
const e = this.formatStatsText(this.statsText), t = !this.readonly && this.showChart && this.hasStats();
|
|
@@ -4489,7 +4526,7 @@ let A = class extends u {
|
|
|
4489
4526
|
${e}
|
|
4490
4527
|
${t ? l`
|
|
4491
4528
|
<img
|
|
4492
|
-
src="${this.isChartVisible ?
|
|
4529
|
+
src="${this.isChartVisible ? It : Nt}"
|
|
4493
4530
|
alt="${this.isChartVisible ? "Hide chart" : "Show chart"}"
|
|
4494
4531
|
class="chart-toggle-icon"
|
|
4495
4532
|
data-testid="reaction-chart-toggle-button"
|
|
@@ -4498,7 +4535,7 @@ let A = class extends u {
|
|
|
4498
4535
|
tabindex="0"
|
|
4499
4536
|
@keydown="${this.handleChartToggleKeyDown}"
|
|
4500
4537
|
/>
|
|
4501
|
-
` :
|
|
4538
|
+
` : d}
|
|
4502
4539
|
</span>
|
|
4503
4540
|
`;
|
|
4504
4541
|
}
|
|
@@ -4510,7 +4547,7 @@ let A = class extends u {
|
|
|
4510
4547
|
try {
|
|
4511
4548
|
this.options = JSON.parse(s);
|
|
4512
4549
|
} catch {
|
|
4513
|
-
this.options =
|
|
4550
|
+
this.options = rs(s);
|
|
4514
4551
|
}
|
|
4515
4552
|
this.updateNormalizedReactions();
|
|
4516
4553
|
}
|
|
@@ -4537,15 +4574,15 @@ let A = class extends u {
|
|
|
4537
4574
|
*/
|
|
4538
4575
|
announceReactionChange(e, t) {
|
|
4539
4576
|
const s = this.componentName, i = t ? `Added ${e.name} reaction` : `Removed ${e.name} reaction`;
|
|
4540
|
-
|
|
4577
|
+
Ut(Lt(s, i));
|
|
4541
4578
|
}
|
|
4542
4579
|
render() {
|
|
4543
4580
|
const e = {
|
|
4544
4581
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
4545
|
-
[`pc-flex-align-${
|
|
4582
|
+
[`pc-flex-align-${R(this.labelPosition, this.labelAlign)}`]: !0
|
|
4546
4583
|
}, t = {
|
|
4547
4584
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
4548
|
-
[`pc-flex-align-${
|
|
4585
|
+
[`pc-flex-align-${R(this.statsPosition, this.statsAlign)}`]: !0
|
|
4549
4586
|
};
|
|
4550
4587
|
return l`
|
|
4551
4588
|
<div class="pc-container ${v(e)}" data-testid="reaction-container">
|
|
@@ -4559,38 +4596,38 @@ let A = class extends u {
|
|
|
4559
4596
|
`;
|
|
4560
4597
|
}
|
|
4561
4598
|
};
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
],
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
],
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
],
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
],
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
],
|
|
4578
|
-
|
|
4599
|
+
E.styles = [...u.styles, Ls];
|
|
4600
|
+
N([
|
|
4601
|
+
p({ type: Array })
|
|
4602
|
+
], E.prototype, "options", 2);
|
|
4603
|
+
N([
|
|
4604
|
+
p({ type: Boolean, reflect: !0 })
|
|
4605
|
+
], E.prototype, "multiple", 2);
|
|
4606
|
+
N([
|
|
4607
|
+
p({ type: String })
|
|
4608
|
+
], E.prototype, "mode", 2);
|
|
4609
|
+
N([
|
|
4610
|
+
p({ type: String, attribute: "popup-position" })
|
|
4611
|
+
], E.prototype, "popupPosition", 2);
|
|
4612
|
+
N([
|
|
4613
|
+
p({ type: String, attribute: "button-radius" })
|
|
4614
|
+
], E.prototype, "buttonRadius", 2);
|
|
4615
|
+
N([
|
|
4579
4616
|
y()
|
|
4580
|
-
],
|
|
4581
|
-
|
|
4617
|
+
], E.prototype, "normalizedReactions", 2);
|
|
4618
|
+
N([
|
|
4582
4619
|
y()
|
|
4583
|
-
],
|
|
4584
|
-
|
|
4620
|
+
], E.prototype, "slotExists", 2);
|
|
4621
|
+
N([
|
|
4585
4622
|
y()
|
|
4586
|
-
],
|
|
4587
|
-
|
|
4623
|
+
], E.prototype, "isPopoverVisible", 2);
|
|
4624
|
+
N([
|
|
4588
4625
|
y()
|
|
4589
|
-
],
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
],
|
|
4593
|
-
const
|
|
4626
|
+
], E.prototype, "isChartVisible", 2);
|
|
4627
|
+
E = N([
|
|
4628
|
+
F("pc-reaction")
|
|
4629
|
+
], E);
|
|
4630
|
+
const qs = B`
|
|
4594
4631
|
/* Base variables */
|
|
4595
4632
|
:host {
|
|
4596
4633
|
--pc-stars-star-size: clamp(1.2em, calc(1.2em + 0.3vw), 2em);
|
|
@@ -4947,10 +4984,10 @@ const Vs = H`
|
|
|
4947
4984
|
* Copyright 2018 Google LLC
|
|
4948
4985
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4949
4986
|
*/
|
|
4950
|
-
const
|
|
4987
|
+
const Pe = "important", Ks = " !" + Pe, Ys = Ee(class extends Ae {
|
|
4951
4988
|
constructor(e) {
|
|
4952
4989
|
var t;
|
|
4953
|
-
if (super(e), e.type !==
|
|
4990
|
+
if (super(e), e.type !== Ce.ATTRIBUTE || e.name !== "style" || ((t = e.strings) == null ? void 0 : t.length) > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
|
|
4954
4991
|
}
|
|
4955
4992
|
render(e) {
|
|
4956
4993
|
return Object.keys(e).reduce((t, s) => {
|
|
@@ -4966,19 +5003,19 @@ const Ce = "important", Hs = " !" + Ce, Bs = Se(class extends ke {
|
|
|
4966
5003
|
const o = t[i];
|
|
4967
5004
|
if (o != null) {
|
|
4968
5005
|
this.ft.add(i);
|
|
4969
|
-
const r = typeof o == "string" && o.endsWith(
|
|
4970
|
-
i.includes("-") || r ? s.setProperty(i, r ? o.slice(0, -11) : o, r ?
|
|
5006
|
+
const r = typeof o == "string" && o.endsWith(Ks);
|
|
5007
|
+
i.includes("-") || r ? s.setProperty(i, r ? o.slice(0, -11) : o, r ? Pe : "") : s[i] = o;
|
|
4971
5008
|
}
|
|
4972
5009
|
}
|
|
4973
|
-
return
|
|
5010
|
+
return H;
|
|
4974
5011
|
}
|
|
4975
5012
|
});
|
|
4976
|
-
var
|
|
4977
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
5013
|
+
var Gs = Object.defineProperty, Ws = Object.getOwnPropertyDescriptor, Z = (e, t, s, i) => {
|
|
5014
|
+
for (var o = i > 1 ? void 0 : i ? Ws(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
4978
5015
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
4979
|
-
return i && o &&
|
|
5016
|
+
return i && o && Gs(t, s, o), o;
|
|
4980
5017
|
};
|
|
4981
|
-
let
|
|
5018
|
+
let U = class extends u {
|
|
4982
5019
|
constructor() {
|
|
4983
5020
|
super(), this.numStars = 5, this.defaultMode = "view", this.isChartVisible = !1, this.isEditMode = !1, this.hoverValue = 0, this.editValue = 0, this.handleEditStarLeave = () => {
|
|
4984
5021
|
this.hoverValue = 0;
|
|
@@ -5055,7 +5092,7 @@ let L = class extends u {
|
|
|
5055
5092
|
<span
|
|
5056
5093
|
data-testid="stars-view-star-${s}"
|
|
5057
5094
|
class=${v(r)}
|
|
5058
|
-
style=${
|
|
5095
|
+
style=${Ys(a)}
|
|
5059
5096
|
role="presentation"
|
|
5060
5097
|
>
|
|
5061
5098
|
★
|
|
@@ -5099,10 +5136,10 @@ let L = class extends u {
|
|
|
5099
5136
|
* Render stats text for view mode
|
|
5100
5137
|
*/
|
|
5101
5138
|
renderStatsText() {
|
|
5102
|
-
if (!this.showStats || this.isEditMode) return
|
|
5139
|
+
if (!this.showStats || this.isEditMode) return d;
|
|
5103
5140
|
if (this.statsIsLoading)
|
|
5104
5141
|
return l`<span class="pc-stats-text">
|
|
5105
|
-
<img src="${
|
|
5142
|
+
<img src="${lt}" alt="Loading" class="pc-loading-icon" />
|
|
5106
5143
|
</span>`;
|
|
5107
5144
|
const e = this.statsText || "Average {avg} ({count} votes)", t = this.formatStatsText(e), s = !this.readonly && this.showChart && this.hasStats();
|
|
5108
5145
|
return l`
|
|
@@ -5110,7 +5147,7 @@ let L = class extends u {
|
|
|
5110
5147
|
${t}
|
|
5111
5148
|
${s ? l`
|
|
5112
5149
|
<img
|
|
5113
|
-
src="${this.isChartVisible ?
|
|
5150
|
+
src="${this.isChartVisible ? It : Nt}"
|
|
5114
5151
|
alt="${this.isChartVisible ? "Hide chart" : "Show chart"}"
|
|
5115
5152
|
class="chart-toggle-icon"
|
|
5116
5153
|
data-testid="stars-chart-toggle-button"
|
|
@@ -5119,7 +5156,7 @@ let L = class extends u {
|
|
|
5119
5156
|
tabindex="0"
|
|
5120
5157
|
@keydown="${this.handleChartToggleKeyDown}"
|
|
5121
5158
|
/>
|
|
5122
|
-
` :
|
|
5159
|
+
` : d}
|
|
5123
5160
|
</span>
|
|
5124
5161
|
`;
|
|
5125
5162
|
}
|
|
@@ -5127,7 +5164,7 @@ let L = class extends u {
|
|
|
5127
5164
|
* Render add/edit button
|
|
5128
5165
|
*/
|
|
5129
5166
|
renderActionButton() {
|
|
5130
|
-
if (this.readonly || this.isEditMode || this.statsIsLoading) return
|
|
5167
|
+
if (this.readonly || this.isEditMode || this.statsIsLoading) return d;
|
|
5131
5168
|
const t = this.hasUserStars() ? "Edit rating" : "Add rating";
|
|
5132
5169
|
return l`
|
|
5133
5170
|
<button
|
|
@@ -5136,7 +5173,7 @@ let L = class extends u {
|
|
|
5136
5173
|
@click="${this.handleEnterEditMode}"
|
|
5137
5174
|
aria-label="${t}"
|
|
5138
5175
|
>
|
|
5139
|
-
<img src="${
|
|
5176
|
+
<img src="${bt}" alt="${t}" class="icon" />
|
|
5140
5177
|
</button>
|
|
5141
5178
|
`;
|
|
5142
5179
|
}
|
|
@@ -5145,20 +5182,14 @@ let L = class extends u {
|
|
|
5145
5182
|
*/
|
|
5146
5183
|
renderChart(e) {
|
|
5147
5184
|
var a;
|
|
5148
|
-
if (e && ["bottom", "top"].includes(this.statsPosition || ""))
|
|
5149
|
-
return h;
|
|
5150
|
-
if (!e && ["left", "right"].includes(this.statsPosition || ""))
|
|
5151
|
-
return h;
|
|
5152
|
-
if (!this.isChartVisible || this.isEditMode) return h;
|
|
5153
|
-
if (!this.showChart || !this.hasStats()) return h;
|
|
5154
|
-
if (this.statsIsLoading || !((a = this.stats) != null && a.breakdown)) return h;
|
|
5185
|
+
if (e && ["bottom", "top"].includes(this.statsPosition || "") || !e && ["left", "right"].includes(this.statsPosition || "") || !this.isChartVisible || this.isEditMode || !this.showChart || !this.hasStats() || this.statsIsLoading || !((a = this.stats) != null && a.breakdown)) return d;
|
|
5155
5186
|
const t = Object.values(this.stats.breakdown).reduce((n, c) => n + c, 0), s = Object.entries(this.stats.breakdown).map(
|
|
5156
5187
|
([n, c]) => ({
|
|
5157
5188
|
label: n,
|
|
5158
5189
|
value: c,
|
|
5159
5190
|
icon: "★"
|
|
5160
5191
|
})
|
|
5161
|
-
), o = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", r =
|
|
5192
|
+
), o = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", r = zt(s, {
|
|
5162
5193
|
barColor: o,
|
|
5163
5194
|
labelFormatter: (n) => `${n}`,
|
|
5164
5195
|
valueFormatter: (n) => `${t > 0 ? Math.round(n / t * 100) : 0}%`
|
|
@@ -5202,13 +5233,13 @@ let L = class extends u {
|
|
|
5202
5233
|
render() {
|
|
5203
5234
|
const e = {
|
|
5204
5235
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
5205
|
-
[`pc-flex-align-${
|
|
5236
|
+
[`pc-flex-align-${R(this.labelPosition, this.labelAlign)}`]: !0,
|
|
5206
5237
|
"edit-mode": this.isEditMode,
|
|
5207
5238
|
"view-mode": !this.isEditMode
|
|
5208
5239
|
}, t = {
|
|
5209
5240
|
stars: !0,
|
|
5210
5241
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5211
|
-
[`pc-flex-align-${
|
|
5242
|
+
[`pc-flex-align-${R(this.statsPosition, this.statsAlign)}`]: !0
|
|
5212
5243
|
};
|
|
5213
5244
|
return l`
|
|
5214
5245
|
<div class="pc-container ${v(e)}" data-testid="stars-container">
|
|
@@ -5227,34 +5258,34 @@ let L = class extends u {
|
|
|
5227
5258
|
`;
|
|
5228
5259
|
}
|
|
5229
5260
|
};
|
|
5230
|
-
|
|
5261
|
+
U.styles = [...u.styles, qs];
|
|
5231
5262
|
Z([
|
|
5232
|
-
|
|
5233
|
-
],
|
|
5263
|
+
p({ type: Number, attribute: "num-stars" })
|
|
5264
|
+
], U.prototype, "numStars", 2);
|
|
5234
5265
|
Z([
|
|
5235
|
-
|
|
5236
|
-
],
|
|
5266
|
+
p({ type: String, attribute: "default-mode" })
|
|
5267
|
+
], U.prototype, "defaultMode", 2);
|
|
5237
5268
|
Z([
|
|
5238
5269
|
y()
|
|
5239
|
-
],
|
|
5270
|
+
], U.prototype, "isChartVisible", 2);
|
|
5240
5271
|
Z([
|
|
5241
5272
|
y()
|
|
5242
|
-
],
|
|
5273
|
+
], U.prototype, "isEditMode", 2);
|
|
5243
5274
|
Z([
|
|
5244
5275
|
y()
|
|
5245
|
-
],
|
|
5276
|
+
], U.prototype, "hoverValue", 2);
|
|
5246
5277
|
Z([
|
|
5247
5278
|
y()
|
|
5248
|
-
],
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
],
|
|
5252
|
-
var
|
|
5253
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
5279
|
+
], U.prototype, "editValue", 2);
|
|
5280
|
+
U = Z([
|
|
5281
|
+
F("pc-stars")
|
|
5282
|
+
], U);
|
|
5283
|
+
var Zs = Object.defineProperty, Js = Object.getOwnPropertyDescriptor, Oe = (e, t, s, i) => {
|
|
5284
|
+
for (var o = i > 1 ? void 0 : i ? Js(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
5254
5285
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
5255
|
-
return i && o &&
|
|
5286
|
+
return i && o && Zs(t, s, o), o;
|
|
5256
5287
|
};
|
|
5257
|
-
let
|
|
5288
|
+
let Et = class extends V {
|
|
5258
5289
|
/**
|
|
5259
5290
|
* Disable shadow DOM for PollCatch
|
|
5260
5291
|
*/
|
|
@@ -5293,7 +5324,7 @@ let Ct = class extends mt {
|
|
|
5293
5324
|
if (!this.type)
|
|
5294
5325
|
return console.warn(
|
|
5295
5326
|
"poll-catch: No type specified. Please provide a type attribute (nps, poll, stars, text, reaction)."
|
|
5296
|
-
),
|
|
5327
|
+
), d;
|
|
5297
5328
|
switch (this.type) {
|
|
5298
5329
|
case "nps":
|
|
5299
5330
|
return l`<pc-nps></pc-nps>`;
|
|
@@ -5308,23 +5339,23 @@ let Ct = class extends mt {
|
|
|
5308
5339
|
default:
|
|
5309
5340
|
return console.warn(
|
|
5310
5341
|
`poll-catch: Unknown widget type "${this.type}". Supported types: nps, poll, stars, text, reaction.`
|
|
5311
|
-
),
|
|
5342
|
+
), d;
|
|
5312
5343
|
}
|
|
5313
5344
|
}
|
|
5314
5345
|
};
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
],
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
],
|
|
5346
|
+
Oe([
|
|
5347
|
+
p({ type: String })
|
|
5348
|
+
], Et.prototype, "type", 2);
|
|
5349
|
+
Et = Oe([
|
|
5350
|
+
F("poll-catch")
|
|
5351
|
+
], Et);
|
|
5321
5352
|
export {
|
|
5322
5353
|
T as PcNps,
|
|
5323
5354
|
C as PcPoll,
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5355
|
+
P as PcPollOption,
|
|
5356
|
+
E as PcReaction,
|
|
5357
|
+
M as PcReactionIcon,
|
|
5358
|
+
U as PcStars,
|
|
5359
|
+
$ as PcText,
|
|
5360
|
+
Et as PollCatch
|
|
5330
5361
|
};
|