pollcatch 2.5.2 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pc.js +514 -500
package/pc.js
CHANGED
|
@@ -22,7 +22,7 @@ let Pe = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const We = (e) => new Pe(typeof e == "string" ? e : e + "", void 0, Gt),
|
|
25
|
+
const We = (e) => new Pe(typeof e == "string" ? e : e + "", void 0, Gt), V = (e, ...t) => {
|
|
26
26
|
const o = e.length === 1 ? e[0] : t.reduce((r, s, i) => r + ((a) => {
|
|
27
27
|
if (a._$cssResult$ === !0) return a.cssText;
|
|
28
28
|
if (typeof a == "number") return a;
|
|
@@ -45,7 +45,7 @@ const We = (e) => new Pe(typeof e == "string" ? e : e + "", void 0, Gt), U = (e,
|
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is: Ge, defineProperty: Ze, getOwnPropertyDescriptor:
|
|
48
|
+
const { is: Ge, defineProperty: Ze, getOwnPropertyDescriptor: Xe, getOwnPropertyNames: Je, getOwnPropertySymbols: Qe, getPrototypeOf: to } = Object, H = globalThis, ie = H.trustedTypes, eo = ie ? ie.emptyScript : "", Mt = H.reactiveElementPolyfillSupport, pt = (e, t) => e, kt = { toAttribute(e, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
51
|
e = e ? eo : null;
|
|
@@ -74,8 +74,8 @@ const { is: Ge, defineProperty: Ze, getOwnPropertyDescriptor: Je, getOwnProperty
|
|
|
74
74
|
}
|
|
75
75
|
return o;
|
|
76
76
|
} }, Zt = (e, t) => !Ge(e, t), ae = { attribute: !0, type: String, converter: kt, reflect: !1, hasChanged: Zt };
|
|
77
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
78
|
-
let
|
|
77
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), H.litPropertyMetadata ?? (H.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
|
+
let st = class extends HTMLElement {
|
|
79
79
|
static addInitializer(t) {
|
|
80
80
|
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
81
81
|
}
|
|
@@ -89,7 +89,7 @@ let rt = class extends HTMLElement {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
static getPropertyDescriptor(t, o, r) {
|
|
92
|
-
const { get: s, set: i } =
|
|
92
|
+
const { get: s, set: i } = Xe(this.prototype, t) ?? { get() {
|
|
93
93
|
return this[o];
|
|
94
94
|
}, set(a) {
|
|
95
95
|
this[o] = a;
|
|
@@ -112,7 +112,7 @@ let rt = class extends HTMLElement {
|
|
|
112
112
|
static finalize() {
|
|
113
113
|
if (this.hasOwnProperty(pt("finalized"))) return;
|
|
114
114
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(pt("properties"))) {
|
|
115
|
-
const o = this.properties, r = [...
|
|
115
|
+
const o = this.properties, r = [...Je(o), ...Qe(o)];
|
|
116
116
|
for (const s of r) this.createProperty(s, o[s]);
|
|
117
117
|
}
|
|
118
118
|
const t = this[Symbol.metadata];
|
|
@@ -273,17 +273,17 @@ let rt = class extends HTMLElement {
|
|
|
273
273
|
firstUpdated(t) {
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
-
|
|
276
|
+
st.elementStyles = [], st.shadowRootOptions = { mode: "open" }, st[pt("elementProperties")] = /* @__PURE__ */ new Map(), st[pt("finalized")] = /* @__PURE__ */ new Map(), Mt == null || Mt({ ReactiveElement: st }), (H.reactiveElementVersions ?? (H.reactiveElementVersions = [])).push("2.0.4");
|
|
277
277
|
/**
|
|
278
278
|
* @license
|
|
279
279
|
* Copyright 2017 Google LLC
|
|
280
280
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
281
281
|
*/
|
|
282
|
-
const ut = globalThis, Et = ut.trustedTypes, ne = Et ? Et.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, Te = "$lit$",
|
|
283
|
-
\f\r]`, ct = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, le = /-->/g, ce = />/g,
|
|
284
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), de = /'/g, pe = /"/g, Oe = /^(?:script|style|textarea|title)$/i, so = (e) => (t, ...o) => ({ _$litType$: e, strings: t, values: o }), c = so(1),
|
|
282
|
+
const ut = globalThis, Et = ut.trustedTypes, ne = Et ? Et.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, Te = "$lit$", q = `lit$${Math.random().toFixed(9).slice(2)}$`, _e = "?" + q, oo = `<${_e}>`, Q = document, gt = () => Q.createComment(""), mt = (e) => e === null || typeof e != "object" && typeof e != "function", Xt = Array.isArray, ro = (e) => Xt(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", Lt = `[
|
|
283
|
+
\f\r]`, ct = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, le = /-->/g, ce = />/g, X = RegExp(`>|${Lt}(?:([^\\s"'>=/]+)(${Lt}*=${Lt}*(?:[^
|
|
284
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), de = /'/g, pe = /"/g, Oe = /^(?:script|style|textarea|title)$/i, so = (e) => (t, ...o) => ({ _$litType$: e, strings: t, values: o }), c = so(1), F = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), ue = /* @__PURE__ */ new WeakMap(), J = Q.createTreeWalker(Q, 129);
|
|
285
285
|
function Ie(e, t) {
|
|
286
|
-
if (!
|
|
286
|
+
if (!Xt(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
287
287
|
return ne !== void 0 ? ne.createHTML(t) : t;
|
|
288
288
|
}
|
|
289
289
|
const io = (e, t) => {
|
|
@@ -291,10 +291,10 @@ const io = (e, t) => {
|
|
|
291
291
|
let s, i = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = ct;
|
|
292
292
|
for (let l = 0; l < o; l++) {
|
|
293
293
|
const n = e[l];
|
|
294
|
-
let d, p,
|
|
295
|
-
for (;
|
|
296
|
-
const
|
|
297
|
-
i += a === ct ? n + oo :
|
|
294
|
+
let d, p, f = -1, b = 0;
|
|
295
|
+
for (; b < n.length && (a.lastIndex = b, p = a.exec(n), p !== null); ) b = a.lastIndex, a === ct ? p[1] === "!--" ? a = le : p[1] !== void 0 ? a = ce : p[2] !== void 0 ? (Oe.test(p[2]) && (s = RegExp("</" + p[2], "g")), a = X) : p[3] !== void 0 && (a = X) : a === X ? p[0] === ">" ? (a = s ?? ct, f = -1) : p[1] === void 0 ? f = -2 : (f = a.lastIndex - p[2].length, d = p[1], a = p[3] === void 0 ? X : p[3] === '"' ? pe : de) : a === pe || a === de ? a = X : a === le || a === ce ? a = ct : (a = X, s = void 0);
|
|
296
|
+
const w = a === X && e[l + 1].startsWith("/>") ? " " : "";
|
|
297
|
+
i += a === ct ? n + oo : f >= 0 ? (r.push(d), n.slice(0, f) + Te + n.slice(f) + q + w) : n + q + (f === -2 ? l : w);
|
|
298
298
|
}
|
|
299
299
|
return [Ie(e, i + (e[o] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
300
300
|
};
|
|
@@ -305,42 +305,42 @@ let Ft = class ze {
|
|
|
305
305
|
let i = 0, a = 0;
|
|
306
306
|
const l = t.length - 1, n = this.parts, [d, p] = io(t, o);
|
|
307
307
|
if (this.el = ze.createElement(d, r), J.currentNode = this.el.content, o === 2 || o === 3) {
|
|
308
|
-
const
|
|
309
|
-
|
|
308
|
+
const f = this.el.content.firstChild;
|
|
309
|
+
f.replaceWith(...f.childNodes);
|
|
310
310
|
}
|
|
311
311
|
for (; (s = J.nextNode()) !== null && n.length < l; ) {
|
|
312
312
|
if (s.nodeType === 1) {
|
|
313
|
-
if (s.hasAttributes()) for (const
|
|
314
|
-
const
|
|
315
|
-
n.push({ type: 1, index: i, name:
|
|
316
|
-
} else
|
|
313
|
+
if (s.hasAttributes()) for (const f of s.getAttributeNames()) if (f.endsWith(Te)) {
|
|
314
|
+
const b = p[a++], w = s.getAttribute(f).split(q), E = /([.?@])?(.*)/.exec(b);
|
|
315
|
+
n.push({ type: 1, index: i, name: E[2], strings: w, ctor: E[1] === "." ? no : E[1] === "?" ? lo : E[1] === "@" ? co : Tt }), s.removeAttribute(f);
|
|
316
|
+
} else f.startsWith(q) && (n.push({ type: 6, index: i }), s.removeAttribute(f));
|
|
317
317
|
if (Oe.test(s.tagName)) {
|
|
318
|
-
const
|
|
319
|
-
if (
|
|
318
|
+
const f = s.textContent.split(q), b = f.length - 1;
|
|
319
|
+
if (b > 0) {
|
|
320
320
|
s.textContent = Et ? Et.emptyScript : "";
|
|
321
|
-
for (let
|
|
322
|
-
s.append(
|
|
321
|
+
for (let w = 0; w < b; w++) s.append(f[w], gt()), J.nextNode(), n.push({ type: 2, index: ++i });
|
|
322
|
+
s.append(f[b], gt());
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
} else if (s.nodeType === 8) if (s.data === _e) n.push({ type: 2, index: i });
|
|
326
326
|
else {
|
|
327
|
-
let
|
|
328
|
-
for (; (
|
|
327
|
+
let f = -1;
|
|
328
|
+
for (; (f = s.data.indexOf(q, f + 1)) !== -1; ) n.push({ type: 7, index: i }), f += q.length - 1;
|
|
329
329
|
}
|
|
330
330
|
i++;
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
static createElement(t, o) {
|
|
334
|
-
const r =
|
|
334
|
+
const r = Q.createElement("template");
|
|
335
335
|
return r.innerHTML = t, r;
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
|
-
function
|
|
338
|
+
function at(e, t, o = e, r) {
|
|
339
339
|
var a, l;
|
|
340
|
-
if (t ===
|
|
340
|
+
if (t === F) return t;
|
|
341
341
|
let s = r !== void 0 ? (a = o._$Co) == null ? void 0 : a[r] : o._$Cl;
|
|
342
342
|
const i = mt(t) ? void 0 : t._$litDirective$;
|
|
343
|
-
return (s == null ? void 0 : s.constructor) !== i && ((l = s == null ? void 0 : s._$AO) == null || l.call(s, !1), i === void 0 ? s = void 0 : (s = new i(e), s._$AT(e, o, r)), r !== void 0 ? (o._$Co ?? (o._$Co = []))[r] = s : o._$Cl = s), s !== void 0 && (t =
|
|
343
|
+
return (s == null ? void 0 : s.constructor) !== i && ((l = s == null ? void 0 : s._$AO) == null || l.call(s, !1), i === void 0 ? s = void 0 : (s = new i(e), s._$AT(e, o, r)), r !== void 0 ? (o._$Co ?? (o._$Co = []))[r] = s : o._$Cl = s), s !== void 0 && (t = at(e, s._$AS(e, t.values), s, r)), t;
|
|
344
344
|
}
|
|
345
345
|
let ao = class {
|
|
346
346
|
constructor(t, o) {
|
|
@@ -353,7 +353,7 @@ let ao = class {
|
|
|
353
353
|
return this._$AM._$AU;
|
|
354
354
|
}
|
|
355
355
|
u(t) {
|
|
356
|
-
const { el: { content: o }, parts: r } = this._$AD, s = ((t == null ? void 0 : t.creationScope) ??
|
|
356
|
+
const { el: { content: o }, parts: r } = this._$AD, s = ((t == null ? void 0 : t.creationScope) ?? Q).importNode(o, !0);
|
|
357
357
|
J.currentNode = s;
|
|
358
358
|
let i = J.nextNode(), a = 0, l = 0, n = r[0];
|
|
359
359
|
for (; n !== void 0; ) {
|
|
@@ -363,7 +363,7 @@ let ao = class {
|
|
|
363
363
|
}
|
|
364
364
|
a !== (n == null ? void 0 : n.index) && (i = J.nextNode(), a++);
|
|
365
365
|
}
|
|
366
|
-
return J.currentNode =
|
|
366
|
+
return J.currentNode = Q, s;
|
|
367
367
|
}
|
|
368
368
|
p(t) {
|
|
369
369
|
let o = 0;
|
|
@@ -390,7 +390,7 @@ class vt {
|
|
|
390
390
|
return this._$AB;
|
|
391
391
|
}
|
|
392
392
|
_$AI(t, o = this) {
|
|
393
|
-
t =
|
|
393
|
+
t = at(this, t, o), mt(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== F && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : ro(t) ? this.k(t) : this._(t);
|
|
394
394
|
}
|
|
395
395
|
O(t) {
|
|
396
396
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -399,7 +399,7 @@ class vt {
|
|
|
399
399
|
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
400
400
|
}
|
|
401
401
|
_(t) {
|
|
402
|
-
this._$AH !== u && mt(this._$AH) ? this._$AA.nextSibling.data = t : this.T(
|
|
402
|
+
this._$AH !== u && mt(this._$AH) ? this._$AA.nextSibling.data = t : this.T(Q.createTextNode(t)), this._$AH = t;
|
|
403
403
|
}
|
|
404
404
|
$(t) {
|
|
405
405
|
var i;
|
|
@@ -415,7 +415,7 @@ class vt {
|
|
|
415
415
|
return o === void 0 && ue.set(t.strings, o = new Ft(t)), o;
|
|
416
416
|
}
|
|
417
417
|
k(t) {
|
|
418
|
-
|
|
418
|
+
Xt(this._$AH) || (this._$AH = [], this._$AR());
|
|
419
419
|
const o = this._$AH;
|
|
420
420
|
let r, s = 0;
|
|
421
421
|
for (const i of t) s === o.length ? o.push(r = new vt(this.O(gt()), this.O(gt()), this, this.options)) : r = o[s], r._$AI(i), s++;
|
|
@@ -446,11 +446,11 @@ class Tt {
|
|
|
446
446
|
_$AI(t, o = this, r, s) {
|
|
447
447
|
const i = this.strings;
|
|
448
448
|
let a = !1;
|
|
449
|
-
if (i === void 0) t =
|
|
449
|
+
if (i === void 0) t = at(this, t, o, 0), a = !mt(t) || t !== this._$AH && t !== F, a && (this._$AH = t);
|
|
450
450
|
else {
|
|
451
451
|
const l = t;
|
|
452
452
|
let n, d;
|
|
453
|
-
for (t = i[0], n = 0; n < i.length - 1; n++) d =
|
|
453
|
+
for (t = i[0], n = 0; n < i.length - 1; n++) d = at(this, l[r + n], o, n), d === F && (d = this._$AH[n]), a || (a = !mt(d) || d !== this._$AH[n]), d === u ? t = u : t !== u && (t += (d ?? "") + i[n + 1]), this._$AH[n] = d;
|
|
454
454
|
}
|
|
455
455
|
a && !s && this.j(t);
|
|
456
456
|
}
|
|
@@ -479,7 +479,7 @@ class co extends Tt {
|
|
|
479
479
|
super(t, o, r, s, i), this.type = 5;
|
|
480
480
|
}
|
|
481
481
|
_$AI(t, o = this) {
|
|
482
|
-
if ((t =
|
|
482
|
+
if ((t = at(this, t, o, 0) ?? u) === F) return;
|
|
483
483
|
const r = this._$AH, s = t === u && r !== u || t.capture !== r.capture || t.once !== r.once || t.passive !== r.passive, i = t !== u && (r === u || s);
|
|
484
484
|
s && this.element.removeEventListener(this.name, this, r), i && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
485
485
|
}
|
|
@@ -496,7 +496,7 @@ class po {
|
|
|
496
496
|
return this._$AM._$AU;
|
|
497
497
|
}
|
|
498
498
|
_$AI(t) {
|
|
499
|
-
|
|
499
|
+
at(this, t);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
const Dt = ut.litHtmlPolyfillSupport;
|
|
@@ -515,7 +515,7 @@ const uo = (e, t, o) => {
|
|
|
515
515
|
* Copyright 2017 Google LLC
|
|
516
516
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
517
517
|
*/
|
|
518
|
-
let
|
|
518
|
+
let B = class extends st {
|
|
519
519
|
constructor() {
|
|
520
520
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
521
521
|
}
|
|
@@ -537,13 +537,13 @@ let R = class extends rt {
|
|
|
537
537
|
super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
|
|
538
538
|
}
|
|
539
539
|
render() {
|
|
540
|
-
return
|
|
540
|
+
return F;
|
|
541
541
|
}
|
|
542
542
|
};
|
|
543
543
|
var Ae;
|
|
544
|
-
|
|
544
|
+
B._$litElement$ = !0, B.finalized = !0, (Ae = globalThis.litElementHydrateSupport) == null || Ae.call(globalThis, { LitElement: B });
|
|
545
545
|
const Nt = globalThis.litElementPolyfillSupport;
|
|
546
|
-
Nt == null || Nt({ LitElement:
|
|
546
|
+
Nt == null || Nt({ LitElement: B });
|
|
547
547
|
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.1");
|
|
548
548
|
/**
|
|
549
549
|
* @license
|
|
@@ -581,7 +581,7 @@ const ho = { attribute: !0, type: String, converter: kt, reflect: !1, hasChanged
|
|
|
581
581
|
}
|
|
582
582
|
throw Error("Unsupported decorator location: " + r);
|
|
583
583
|
};
|
|
584
|
-
function
|
|
584
|
+
function h(e) {
|
|
585
585
|
return (t, o) => typeof o == "object" ? fo(e, t, o) : ((r, s, i) => {
|
|
586
586
|
const a = s.hasOwnProperty(i);
|
|
587
587
|
return s.constructor.createProperty(i, a ? { ...r, wrapped: !0 } : r), a ? Object.getOwnPropertyDescriptor(s, i) : void 0;
|
|
@@ -592,8 +592,8 @@ function f(e) {
|
|
|
592
592
|
* Copyright 2017 Google LLC
|
|
593
593
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
594
594
|
*/
|
|
595
|
-
function
|
|
596
|
-
return
|
|
595
|
+
function C(e) {
|
|
596
|
+
return h({ ...e, state: !0, attribute: !1 });
|
|
597
597
|
}
|
|
598
598
|
/**
|
|
599
599
|
* @license
|
|
@@ -617,8 +617,8 @@ function bt(e, t) {
|
|
|
617
617
|
} });
|
|
618
618
|
};
|
|
619
619
|
}
|
|
620
|
-
var
|
|
621
|
-
const
|
|
620
|
+
var x = /* @__PURE__ */ ((e) => (e.reaction = "reaction", e.stars = "stars", e.poll = "poll", e.text = "text", e.nps = "nps", e))(x || {});
|
|
621
|
+
const Jt = c`
|
|
622
622
|
<svg
|
|
623
623
|
xmlns="http://www.w3.org/2000/svg"
|
|
624
624
|
height="24px"
|
|
@@ -675,18 +675,18 @@ const Xt = c`
|
|
|
675
675
|
<path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z" />
|
|
676
676
|
</svg>
|
|
677
677
|
`;
|
|
678
|
-
var mo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) },
|
|
678
|
+
var mo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, D = function(e) {
|
|
679
679
|
return typeof e == "string" ? e.length > 0 : typeof e == "number";
|
|
680
|
-
},
|
|
680
|
+
}, S = function(e, t, o) {
|
|
681
681
|
return t === void 0 && (t = 0), o === void 0 && (o = Math.pow(10, t)), Math.round(o * e) / o + 0;
|
|
682
|
-
},
|
|
682
|
+
}, P = function(e, t, o) {
|
|
683
683
|
return t === void 0 && (t = 0), o === void 0 && (o = 1), e > o ? o : e > t ? e : t;
|
|
684
684
|
}, Le = function(e) {
|
|
685
685
|
return (e = isFinite(e) ? e % 360 : 0) > 0 ? e : e + 360;
|
|
686
686
|
}, he = function(e) {
|
|
687
|
-
return { r:
|
|
687
|
+
return { r: P(e.r, 0, 255), g: P(e.g, 0, 255), b: P(e.b, 0, 255), a: P(e.a) };
|
|
688
688
|
}, Rt = function(e) {
|
|
689
|
-
return { r:
|
|
689
|
+
return { r: S(e.r), g: S(e.g), b: S(e.b), a: S(e.a, 3) };
|
|
690
690
|
}, vo = /^#([0-9a-f]{3,8})$/i, xt = function(e) {
|
|
691
691
|
var t = e.toString(16);
|
|
692
692
|
return t.length < 2 ? "0" + t : t;
|
|
@@ -699,9 +699,9 @@ var mo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, L = function(e) {
|
|
|
699
699
|
var i = Math.floor(t), a = r * (1 - o), l = r * (1 - (t - i) * o), n = r * (1 - (1 - t + i) * o), d = i % 6;
|
|
700
700
|
return { r: 255 * [r, l, a, a, n, r][d], g: 255 * [n, r, r, l, a, a][d], b: 255 * [a, a, n, r, r, l][d], a: s };
|
|
701
701
|
}, fe = function(e) {
|
|
702
|
-
return { h: Le(e.h), s:
|
|
702
|
+
return { h: Le(e.h), s: P(e.s, 0, 100), l: P(e.l, 0, 100), a: P(e.a) };
|
|
703
703
|
}, ge = function(e) {
|
|
704
|
-
return { h:
|
|
704
|
+
return { h: S(e.h), s: S(e.s), l: S(e.l), a: S(e.a, 3) };
|
|
705
705
|
}, me = function(e) {
|
|
706
706
|
return Ne((o = (t = e).s, { h: t.h, s: (o *= ((r = t.l) < 50 ? r : 100 - r) / 100) > 0 ? 2 * o / (r + o) * 100 : 0, v: r + o, a: t.a }));
|
|
707
707
|
var t, o, r;
|
|
@@ -710,7 +710,7 @@ var mo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, L = function(e) {
|
|
|
710
710
|
var t, o, r, s;
|
|
711
711
|
}, bo = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, yo = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, wo = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, xo = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, ve = { string: [[function(e) {
|
|
712
712
|
var t = vo.exec(e);
|
|
713
|
-
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 ?
|
|
713
|
+
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 ? S(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 ? S(parseInt(e.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
|
|
714
714
|
}, "hex"], [function(e) {
|
|
715
715
|
var t = wo.exec(e) || xo.exec(e);
|
|
716
716
|
return t ? t[2] !== t[4] || t[4] !== t[6] ? null : he({ 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;
|
|
@@ -721,17 +721,17 @@ var mo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, L = function(e) {
|
|
|
721
721
|
return me(s);
|
|
722
722
|
}, "hsl"]], object: [[function(e) {
|
|
723
723
|
var t = e.r, o = e.g, r = e.b, s = e.a, i = s === void 0 ? 1 : s;
|
|
724
|
-
return
|
|
724
|
+
return D(t) && D(o) && D(r) ? he({ r: Number(t), g: Number(o), b: Number(r), a: Number(i) }) : null;
|
|
725
725
|
}, "rgb"], [function(e) {
|
|
726
726
|
var t = e.h, o = e.s, r = e.l, s = e.a, i = s === void 0 ? 1 : s;
|
|
727
|
-
if (!
|
|
727
|
+
if (!D(t) || !D(o) || !D(r)) return null;
|
|
728
728
|
var a = fe({ h: Number(t), s: Number(o), l: Number(r), a: Number(i) });
|
|
729
729
|
return me(a);
|
|
730
730
|
}, "hsl"], [function(e) {
|
|
731
731
|
var t = e.h, o = e.s, r = e.v, s = e.a, i = s === void 0 ? 1 : s;
|
|
732
|
-
if (!
|
|
732
|
+
if (!D(t) || !D(o) || !D(r)) return null;
|
|
733
733
|
var a = function(l) {
|
|
734
|
-
return { h: Le(l.h), s:
|
|
734
|
+
return { h: Le(l.h), s: P(l.s, 0, 100), v: P(l.v, 0, 100), a: P(l.a) };
|
|
735
735
|
}({ h: Number(t), s: Number(o), v: Number(r), a: Number(i) });
|
|
736
736
|
return Ne(a);
|
|
737
737
|
}, "hsv"]] }, be = function(e, t) {
|
|
@@ -744,12 +744,12 @@ var mo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, L = function(e) {
|
|
|
744
744
|
return typeof e == "string" ? be(e.trim(), ve.string) : typeof e == "object" && e !== null ? be(e, ve.object) : [null, void 0];
|
|
745
745
|
}, Bt = function(e, t) {
|
|
746
746
|
var o = ht(e);
|
|
747
|
-
return { h: o.h, s:
|
|
747
|
+
return { h: o.h, s: P(o.s + 100 * t, 0, 100), l: o.l, a: o.a };
|
|
748
748
|
}, Ut = function(e) {
|
|
749
749
|
return (299 * e.r + 587 * e.g + 114 * e.b) / 1e3 / 255;
|
|
750
750
|
}, ye = function(e, t) {
|
|
751
751
|
var o = ht(e);
|
|
752
|
-
return { h: o.h, s: o.s, l:
|
|
752
|
+
return { h: o.h, s: o.s, l: P(o.l + 100 * t, 0, 100), a: o.a };
|
|
753
753
|
}, we = function() {
|
|
754
754
|
function e(t) {
|
|
755
755
|
this.parsed = $o(t)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
@@ -757,13 +757,13 @@ var mo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, L = function(e) {
|
|
|
757
757
|
return e.prototype.isValid = function() {
|
|
758
758
|
return this.parsed !== null;
|
|
759
759
|
}, e.prototype.brightness = function() {
|
|
760
|
-
return
|
|
760
|
+
return S(Ut(this.rgba), 2);
|
|
761
761
|
}, e.prototype.isDark = function() {
|
|
762
762
|
return Ut(this.rgba) < 0.5;
|
|
763
763
|
}, e.prototype.isLight = function() {
|
|
764
764
|
return Ut(this.rgba) >= 0.5;
|
|
765
765
|
}, e.prototype.toHex = function() {
|
|
766
|
-
return t = Rt(this.rgba), o = t.r, r = t.g, s = t.b, a = (i = t.a) < 1 ? xt(
|
|
766
|
+
return t = Rt(this.rgba), o = t.r, r = t.g, s = t.b, a = (i = t.a) < 1 ? xt(S(255 * i)) : "", "#" + xt(o) + xt(r) + xt(s) + a;
|
|
767
767
|
var t, o, r, s, i, a;
|
|
768
768
|
}, e.prototype.toRgb = function() {
|
|
769
769
|
return Rt(this.rgba);
|
|
@@ -776,33 +776,33 @@ var mo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, L = function(e) {
|
|
|
776
776
|
return t = ge(ht(this.rgba)), o = t.h, r = t.s, s = t.l, (i = t.a) < 1 ? "hsla(" + o + ", " + r + "%, " + s + "%, " + i + ")" : "hsl(" + o + ", " + r + "%, " + s + "%)";
|
|
777
777
|
var t, o, r, s, i;
|
|
778
778
|
}, e.prototype.toHsv = function() {
|
|
779
|
-
return t = De(this.rgba), { h:
|
|
779
|
+
return t = De(this.rgba), { h: S(t.h), s: S(t.s), v: S(t.v), a: S(t.a, 3) };
|
|
780
780
|
var t;
|
|
781
781
|
}, e.prototype.invert = function() {
|
|
782
|
-
return
|
|
782
|
+
return T({ r: 255 - (t = this.rgba).r, g: 255 - t.g, b: 255 - t.b, a: t.a });
|
|
783
783
|
var t;
|
|
784
784
|
}, e.prototype.saturate = function(t) {
|
|
785
|
-
return t === void 0 && (t = 0.1),
|
|
785
|
+
return t === void 0 && (t = 0.1), T(Bt(this.rgba, t));
|
|
786
786
|
}, e.prototype.desaturate = function(t) {
|
|
787
|
-
return t === void 0 && (t = 0.1),
|
|
787
|
+
return t === void 0 && (t = 0.1), T(Bt(this.rgba, -t));
|
|
788
788
|
}, e.prototype.grayscale = function() {
|
|
789
|
-
return
|
|
789
|
+
return T(Bt(this.rgba, -1));
|
|
790
790
|
}, e.prototype.lighten = function(t) {
|
|
791
|
-
return t === void 0 && (t = 0.1),
|
|
791
|
+
return t === void 0 && (t = 0.1), T(ye(this.rgba, t));
|
|
792
792
|
}, e.prototype.darken = function(t) {
|
|
793
|
-
return t === void 0 && (t = 0.1),
|
|
793
|
+
return t === void 0 && (t = 0.1), T(ye(this.rgba, -t));
|
|
794
794
|
}, e.prototype.rotate = function(t) {
|
|
795
795
|
return t === void 0 && (t = 15), this.hue(this.hue() + t);
|
|
796
796
|
}, e.prototype.alpha = function(t) {
|
|
797
|
-
return typeof t == "number" ?
|
|
797
|
+
return typeof t == "number" ? T({ r: (o = this.rgba).r, g: o.g, b: o.b, a: t }) : S(this.rgba.a, 3);
|
|
798
798
|
var o;
|
|
799
799
|
}, e.prototype.hue = function(t) {
|
|
800
800
|
var o = ht(this.rgba);
|
|
801
|
-
return typeof t == "number" ?
|
|
801
|
+
return typeof t == "number" ? T({ h: t, s: o.s, l: o.l, a: o.a }) : S(o.h);
|
|
802
802
|
}, e.prototype.isEqual = function(t) {
|
|
803
|
-
return this.toHex() ===
|
|
803
|
+
return this.toHex() === T(t).toHex();
|
|
804
804
|
}, e;
|
|
805
|
-
}(),
|
|
805
|
+
}(), T = function(e) {
|
|
806
806
|
return e instanceof we ? e : new we(e);
|
|
807
807
|
};
|
|
808
808
|
const So = typeof process < "u" && (process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test");
|
|
@@ -862,7 +862,7 @@ function xe(e) {
|
|
|
862
862
|
return 0.2126 * i + 0.7152 * a + 0.0722 * l;
|
|
863
863
|
}
|
|
864
864
|
function Ao(e, t = {}) {
|
|
865
|
-
if (!
|
|
865
|
+
if (!T(e).isValid())
|
|
866
866
|
return g.warn(`Invalid color provided: ${e}`), "black";
|
|
867
867
|
const {
|
|
868
868
|
minContrast: r = 4.5,
|
|
@@ -875,16 +875,16 @@ function Ao(e, t = {}) {
|
|
|
875
875
|
} = t, l = s.map((p) => p === "black" ? "#000000" : p === "white" ? "#ffffff" : p === "light" ? i.light || "#f8f9fa" : p === "dark" ? i.dark || "#343a40" : p);
|
|
876
876
|
let n = a, d = 0;
|
|
877
877
|
for (const p of l) {
|
|
878
|
-
const
|
|
879
|
-
|
|
878
|
+
const f = jt(e, p);
|
|
879
|
+
f >= r && f > d && (d = f, n = p);
|
|
880
880
|
}
|
|
881
881
|
if (d === 0) {
|
|
882
882
|
const p = jt(e, a);
|
|
883
883
|
n = a, d = p;
|
|
884
|
-
for (const
|
|
885
|
-
if (
|
|
886
|
-
const
|
|
887
|
-
|
|
884
|
+
for (const f of l) {
|
|
885
|
+
if (f === a) continue;
|
|
886
|
+
const b = jt(e, f);
|
|
887
|
+
b > d && (d = b, n = f);
|
|
888
888
|
}
|
|
889
889
|
g.warn(
|
|
890
890
|
`No color option met the minimum contrast ratio of ${r}:1 against ${e}. Using ${n} with contrast ratio ${d.toFixed(2)}:1 instead.`
|
|
@@ -893,13 +893,13 @@ function Ao(e, t = {}) {
|
|
|
893
893
|
return n;
|
|
894
894
|
}
|
|
895
895
|
function Po(e) {
|
|
896
|
-
const o = Eo(e) || e, r =
|
|
896
|
+
const o = Eo(e) || e, r = T(o);
|
|
897
897
|
if (!r.isValid())
|
|
898
898
|
return g.warn(`Invalid color provided: ${e}`), { r: 0, g: 0, b: 0 };
|
|
899
899
|
const { r: s, g: i, b: a } = r.toRgb();
|
|
900
900
|
return { r: s, g: i, b: a };
|
|
901
901
|
}
|
|
902
|
-
function
|
|
902
|
+
function O(e, t) {
|
|
903
903
|
const r = t ? {
|
|
904
904
|
left: "start",
|
|
905
905
|
right: "end",
|
|
@@ -950,8 +950,8 @@ function To(e, t = "4px") {
|
|
|
950
950
|
const a = parseFloat(s);
|
|
951
951
|
return isNaN(a) ? t : `${a}px`;
|
|
952
952
|
}
|
|
953
|
-
var
|
|
954
|
-
function
|
|
953
|
+
var N = /* @__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))(N || {});
|
|
954
|
+
function it(e) {
|
|
955
955
|
const t = {};
|
|
956
956
|
e.role !== void 0 && (t.role = e.role);
|
|
957
957
|
for (const [o, r] of Object.entries(e)) {
|
|
@@ -962,7 +962,7 @@ function st(e) {
|
|
|
962
962
|
return t;
|
|
963
963
|
}
|
|
964
964
|
function _o(e, t, o) {
|
|
965
|
-
return
|
|
965
|
+
return it({
|
|
966
966
|
role: "button",
|
|
967
967
|
ariaLabel: e,
|
|
968
968
|
ariaPressed: t,
|
|
@@ -970,7 +970,7 @@ function _o(e, t, o) {
|
|
|
970
970
|
});
|
|
971
971
|
}
|
|
972
972
|
function Oo(e, t, o, r = !1) {
|
|
973
|
-
return
|
|
973
|
+
return it({
|
|
974
974
|
role: r ? "radio" : "checkbox",
|
|
975
975
|
ariaLabel: e,
|
|
976
976
|
ariaChecked: t,
|
|
@@ -986,7 +986,7 @@ function Io(e) {
|
|
|
986
986
|
const t = e.replace(/[<>"']/g, "").trim();
|
|
987
987
|
return /^(#[0-9a-fA-F]{3,8}|rgb\([^)]+\)|rgba\([^)]+\)|hsl\([^)]+\)|hsla\([^)]+\)|[a-zA-Z]+)$/.test(t);
|
|
988
988
|
}
|
|
989
|
-
function
|
|
989
|
+
function rt(e) {
|
|
990
990
|
return Io(e) ? e.replace(/[<>"']/g, "").trim() : (g.warn("Invalid color value:", e), "#000000");
|
|
991
991
|
}
|
|
992
992
|
function zo(e) {
|
|
@@ -1091,7 +1091,7 @@ function Ce(e, t) {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
return { avg: s > 0 ? Math.round(r / s * 10) / 10 : 0, count: s, sum: r, breakdown: o };
|
|
1093
1093
|
}
|
|
1094
|
-
function
|
|
1094
|
+
function R() {
|
|
1095
1095
|
return {
|
|
1096
1096
|
count: 0,
|
|
1097
1097
|
sum: 0,
|
|
@@ -1103,12 +1103,12 @@ function N() {
|
|
|
1103
1103
|
}
|
|
1104
1104
|
function Bo(e) {
|
|
1105
1105
|
if (!te())
|
|
1106
|
-
return
|
|
1106
|
+
return R();
|
|
1107
1107
|
try {
|
|
1108
1108
|
const t = Be(e);
|
|
1109
|
-
return t ? { ...
|
|
1109
|
+
return t ? { ...R(), ...t } : R();
|
|
1110
1110
|
} catch (t) {
|
|
1111
|
-
return g.warn("Failed to load localStats from localStorage", t),
|
|
1111
|
+
return g.warn("Failed to load localStats from localStorage", t), R();
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
1114
|
function Uo(e, t) {
|
|
@@ -1137,7 +1137,7 @@ function Vo(e, t) {
|
|
|
1137
1137
|
}
|
|
1138
1138
|
function jo(e, t) {
|
|
1139
1139
|
if (!e.count && !t.count)
|
|
1140
|
-
return
|
|
1140
|
+
return R();
|
|
1141
1141
|
if (!e.count)
|
|
1142
1142
|
return { ...t };
|
|
1143
1143
|
const o = {
|
|
@@ -1217,7 +1217,7 @@ const ke = 5;
|
|
|
1217
1217
|
class Go {
|
|
1218
1218
|
// Tracks if user has ever made a selection (even if later deselected)
|
|
1219
1219
|
constructor(t) {
|
|
1220
|
-
this.stats =
|
|
1220
|
+
this.stats = R(), this.localStats = R(), this.prevLocalStats = R(), this.isLoading = !0, this.isLoadingConfig = !1, this.isSubmitting = !1, this.hasInteracted = !1, (this.host = t).addController(this);
|
|
1221
1221
|
}
|
|
1222
1222
|
hostConnected() {
|
|
1223
1223
|
this.loadStats();
|
|
@@ -1272,17 +1272,20 @@ class Go {
|
|
|
1272
1272
|
if (o.type === "registered" && t.widgetId) {
|
|
1273
1273
|
const a = Ko(t.widgetId);
|
|
1274
1274
|
if (a) {
|
|
1275
|
-
g.debug("Using prefetched config from cache", { widgetId: t.widgetId }), this.applyWidgetAttributes(a.attributes);
|
|
1276
|
-
const l = this.getOptionsForDataFunc(t), n = Ce(
|
|
1277
|
-
|
|
1275
|
+
g.debug("Using prefetched widget config from cache", { widgetId: t.widgetId }), this.applyWidgetAttributes(a.config.attributes);
|
|
1276
|
+
const l = this.getOptionsForDataFunc(t), n = Ce(
|
|
1277
|
+
a.stats.breakdown ?? {},
|
|
1278
|
+
l
|
|
1279
|
+
), d = n.count, p = n.sum, f = d > 0 ? Math.round(p / d * 10) / 10 : 0, b = d > 0 ? Math.round(p / d * 100) : 0, w = {
|
|
1278
1280
|
count: d,
|
|
1279
1281
|
sum: p,
|
|
1280
|
-
avg:
|
|
1281
|
-
pct:
|
|
1282
|
-
nps: t.type ===
|
|
1282
|
+
avg: f,
|
|
1283
|
+
pct: b,
|
|
1284
|
+
nps: t.type === x.nps ? ft(n.breakdown) : 0,
|
|
1283
1285
|
breakdown: n.breakdown,
|
|
1284
1286
|
updated: a.stats.updatedAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
1285
|
-
}
|
|
1287
|
+
};
|
|
1288
|
+
this.stats = w, this.isLoading = !1, this.isLoadingConfig = !1, this.host.requestUpdate();
|
|
1286
1289
|
return;
|
|
1287
1290
|
}
|
|
1288
1291
|
}
|
|
@@ -1290,52 +1293,52 @@ class Go {
|
|
|
1290
1293
|
const a = t.type;
|
|
1291
1294
|
let l;
|
|
1292
1295
|
if (t.dataFunc && typeof window < "u") {
|
|
1293
|
-
const
|
|
1294
|
-
let
|
|
1295
|
-
for (const
|
|
1296
|
-
if (
|
|
1297
|
-
l =
|
|
1296
|
+
const $ = t.dataFunc.replace(/^window\./, "").split(".");
|
|
1297
|
+
let A = window;
|
|
1298
|
+
for (const Z of $)
|
|
1299
|
+
if (A = A == null ? void 0 : A[Z], A === void 0) break;
|
|
1300
|
+
l = A;
|
|
1298
1301
|
}
|
|
1299
1302
|
let n, d = null;
|
|
1300
1303
|
if (l && typeof l == "function") {
|
|
1301
|
-
const
|
|
1304
|
+
const k = this.getOptionsForDataFunc(t);
|
|
1302
1305
|
g.debug(`Using data function for: ${t.widgetId || t.name}`, {
|
|
1303
1306
|
dataFuncName: t.dataFunc,
|
|
1304
|
-
options:
|
|
1307
|
+
options: k
|
|
1305
1308
|
});
|
|
1306
|
-
const
|
|
1307
|
-
if (
|
|
1308
|
-
if (
|
|
1309
|
-
throw g.error("Custom data function returned unsuccessful response",
|
|
1310
|
-
n =
|
|
1309
|
+
const $ = await l(t.widgetId, t.name, k);
|
|
1310
|
+
if ($ && typeof $ == "object" && "success" in $ && "data" in $) {
|
|
1311
|
+
if (!$.success)
|
|
1312
|
+
throw g.error("Custom data function returned unsuccessful response", $), new Error("Custom data function returned unsuccessful response");
|
|
1313
|
+
n = $.data || {};
|
|
1311
1314
|
} else
|
|
1312
|
-
n =
|
|
1315
|
+
n = $ || {};
|
|
1313
1316
|
} else {
|
|
1314
|
-
const
|
|
1315
|
-
let
|
|
1316
|
-
o.type === "registered" ? (
|
|
1317
|
-
endpoint:
|
|
1317
|
+
const k = t.dataEndpoint || Yt;
|
|
1318
|
+
let $;
|
|
1319
|
+
o.type === "registered" ? ($ = `${k}/widgets/${encodeURIComponent(t.widgetId)}`, this.isLoadingConfig = !0, this.host.requestUpdate()) : $ = `${k}/public-widgets/${encodeURIComponent(t.name)}`, g.debug("Fetching stats for widget", {
|
|
1320
|
+
endpoint: $,
|
|
1318
1321
|
type: o.type
|
|
1319
1322
|
});
|
|
1320
|
-
const
|
|
1321
|
-
if (!
|
|
1322
|
-
throw new Error(`API request failed with status: ${
|
|
1323
|
-
const
|
|
1324
|
-
if (!
|
|
1325
|
-
throw g.error("Backend returned unsuccessful response",
|
|
1326
|
-
o.type === "registered" ? (d = ((s = (r =
|
|
1323
|
+
const A = await fetch($);
|
|
1324
|
+
if (!A.ok)
|
|
1325
|
+
throw new Error(`API request failed with status: ${A.status}`);
|
|
1326
|
+
const Z = await A.json();
|
|
1327
|
+
if (!Z.success)
|
|
1328
|
+
throw g.error("Backend returned unsuccessful response", Z), new Error("Backend returned unsuccessful response");
|
|
1329
|
+
o.type === "registered" ? (d = ((s = (r = Z.data) == null ? void 0 : r.config) == null ? void 0 : s.attributes) || null, n = ((i = Z.data) == null ? void 0 : i.stats) || {}) : n = Z.data || {};
|
|
1327
1330
|
}
|
|
1328
1331
|
d && !l && this.applyWidgetAttributes(d);
|
|
1329
|
-
const p = this.getOptionsForDataFunc(t),
|
|
1330
|
-
count:
|
|
1331
|
-
sum:
|
|
1332
|
-
avg:
|
|
1333
|
-
pct:
|
|
1334
|
-
nps: a ===
|
|
1335
|
-
breakdown:
|
|
1332
|
+
const p = this.getOptionsForDataFunc(t), f = Ce(n.breakdown ?? {}, p), b = f.count, w = f.sum, E = b > 0 ? Math.round(w / b * 10) / 10 : 0, M = b > 0 ? Math.round(w / b * 100) : 0, L = {
|
|
1333
|
+
count: b,
|
|
1334
|
+
sum: w,
|
|
1335
|
+
avg: E,
|
|
1336
|
+
pct: M,
|
|
1337
|
+
nps: a === x.nps ? ft(f.breakdown) : 0,
|
|
1338
|
+
breakdown: f.breakdown,
|
|
1336
1339
|
updated: n.updatedAt || n.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1337
1340
|
};
|
|
1338
|
-
this.stats =
|
|
1341
|
+
this.stats = L;
|
|
1339
1342
|
} catch (a) {
|
|
1340
1343
|
throw g.error("Error loading stats:", a, this.localStats), a;
|
|
1341
1344
|
} finally {
|
|
@@ -1350,14 +1353,14 @@ class Go {
|
|
|
1350
1353
|
*/
|
|
1351
1354
|
getOptionsForDataFunc(t) {
|
|
1352
1355
|
switch (t.type) {
|
|
1353
|
-
case
|
|
1356
|
+
case x.stars: {
|
|
1354
1357
|
const r = t.numStars || 5;
|
|
1355
1358
|
return Array.from({ length: r }, (s, i) => String(i + 1));
|
|
1356
1359
|
}
|
|
1357
|
-
case
|
|
1360
|
+
case x.nps:
|
|
1358
1361
|
return Array.from({ length: 11 }, (r, s) => String(s));
|
|
1359
|
-
case
|
|
1360
|
-
case
|
|
1362
|
+
case x.poll:
|
|
1363
|
+
case x.reaction:
|
|
1361
1364
|
default:
|
|
1362
1365
|
return t.options.map((r) => r.value);
|
|
1363
1366
|
}
|
|
@@ -1371,7 +1374,7 @@ class Go {
|
|
|
1371
1374
|
const o = Bo(t);
|
|
1372
1375
|
g.debug("Loaded localStats from localStorage", o), this.localStats = o, o.submitted && (this.prevLocalStats = { ...o });
|
|
1373
1376
|
} catch (o) {
|
|
1374
|
-
g.warn("Failed to generate localStorage key for localStats", o), this.localStats =
|
|
1377
|
+
g.warn("Failed to generate localStorage key for localStats", o), this.localStats = R();
|
|
1375
1378
|
}
|
|
1376
1379
|
this.host.requestUpdate();
|
|
1377
1380
|
}
|
|
@@ -1490,7 +1493,7 @@ class Go {
|
|
|
1490
1493
|
sum: (o == null ? void 0 : o.sum) || 0,
|
|
1491
1494
|
avg: s,
|
|
1492
1495
|
pct: (o == null ? void 0 : o.pct) || 0,
|
|
1493
|
-
nps: r.type ===
|
|
1496
|
+
nps: r.type === x.nps ? ft((o == null ? void 0 : o.breakdown) || {}) : 0
|
|
1494
1497
|
};
|
|
1495
1498
|
return g.debug("Stats data: ", this.stats), Ho(t, i);
|
|
1496
1499
|
}
|
|
@@ -1518,7 +1521,7 @@ class Go {
|
|
|
1518
1521
|
toggleValueSelected(t, o) {
|
|
1519
1522
|
const r = Object.keys(this.localStats.breakdown || {}), s = r.includes(t), i = this.host;
|
|
1520
1523
|
let a = 1;
|
|
1521
|
-
if ((i.type ===
|
|
1524
|
+
if ((i.type === x.stars || i.type === x.nps) && (a = parseInt(t)), s)
|
|
1522
1525
|
if (o) {
|
|
1523
1526
|
const n = r.filter((d) => d !== t);
|
|
1524
1527
|
this.updateStats(n.length > 0 ? 1 : 0, n);
|
|
@@ -1684,13 +1687,13 @@ function je(e, t = {}) {
|
|
|
1684
1687
|
ariaHidden: !1
|
|
1685
1688
|
};
|
|
1686
1689
|
}
|
|
1687
|
-
function
|
|
1690
|
+
function Xo(e, t = "polite") {
|
|
1688
1691
|
let o = document.getElementById("screen-reader-announcer");
|
|
1689
1692
|
o ? o.setAttribute("aria-live", t) : (o = document.createElement("div"), o.id = "screen-reader-announcer", o.setAttribute("aria-live", t), o.setAttribute("role", "status"), o.setAttribute("aria-atomic", "true"), o.style.position = "absolute", o.style.width = "1px", o.style.height = "1px", o.style.margin = "-1px", o.style.padding = "0", o.style.overflow = "hidden", o.style.clip = "rect(0, 0, 0, 0)", o.style.whiteSpace = "nowrap", o.style.border = "0", document.body.appendChild(o)), o.textContent = "", setTimeout(() => {
|
|
1690
1693
|
o.textContent = e;
|
|
1691
1694
|
}, 50);
|
|
1692
1695
|
}
|
|
1693
|
-
function
|
|
1696
|
+
function Jo(e, t) {
|
|
1694
1697
|
return `${e}: ${t}`;
|
|
1695
1698
|
}
|
|
1696
1699
|
/**
|
|
@@ -1720,7 +1723,7 @@ let Fe = class {
|
|
|
1720
1723
|
* Copyright 2018 Google LLC
|
|
1721
1724
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1722
1725
|
*/
|
|
1723
|
-
const
|
|
1726
|
+
const y = He(class extends Fe {
|
|
1724
1727
|
constructor(e) {
|
|
1725
1728
|
var t;
|
|
1726
1729
|
if (super(e), e.type !== qe.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.");
|
|
@@ -1741,10 +1744,10 @@ const w = He(class extends Fe {
|
|
|
1741
1744
|
const a = !!t[i];
|
|
1742
1745
|
a === this.st.has(i) || (s = this.nt) != null && s.has(i) || (a ? (o.add(i), this.st.add(i)) : (o.remove(i), this.st.delete(i)));
|
|
1743
1746
|
}
|
|
1744
|
-
return
|
|
1747
|
+
return F;
|
|
1745
1748
|
}
|
|
1746
1749
|
});
|
|
1747
|
-
var Qo = Object.defineProperty,
|
|
1750
|
+
var Qo = Object.defineProperty, v = (e, t, o, r) => {
|
|
1748
1751
|
for (var s = void 0, i = e.length - 1, a; i >= 0; i--)
|
|
1749
1752
|
(a = e[i]) && (s = a(t, o, s) || s);
|
|
1750
1753
|
return s && Qo(t, o, s), s;
|
|
@@ -1753,7 +1756,7 @@ const $t = {
|
|
|
1753
1756
|
mobile: "480px",
|
|
1754
1757
|
tablet: "768px",
|
|
1755
1758
|
desktop: "1024px"
|
|
1756
|
-
}, oe = class oe extends
|
|
1759
|
+
}, oe = class oe extends B {
|
|
1757
1760
|
constructor() {
|
|
1758
1761
|
super(...arguments), this.dataController = new Go(this), this.displayController = new Zo(this, this.dataController), this.hasEditButton = !0, this.showStats = "never", this.showChart = !1, this.initialized = !1, this.ariaLabel = null, this.minContrast = Re.AA_NORMAL, this.options = [], this.questionPosition = "top", this.statsText = "{count} votes", this.buttonText = "Submit", this.buttonRadius = "sm", this.multiple = !1, this.inline = !1, this.readonly = !1, this.handleEditToggleKeyDown = (t) => {
|
|
1759
1762
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.handleEnterEditMode());
|
|
@@ -1787,7 +1790,7 @@ const $t = {
|
|
|
1787
1790
|
let o = `:host {
|
|
1788
1791
|
`;
|
|
1789
1792
|
if (this.primaryColor) {
|
|
1790
|
-
const i =
|
|
1793
|
+
const i = rt(this.primaryColor);
|
|
1791
1794
|
o += `--pc-primary-color: ${i} !important;
|
|
1792
1795
|
`;
|
|
1793
1796
|
const a = Ao(i, {
|
|
@@ -1798,27 +1801,27 @@ const $t = {
|
|
|
1798
1801
|
`;
|
|
1799
1802
|
}
|
|
1800
1803
|
if (this.muteColor) {
|
|
1801
|
-
const i =
|
|
1804
|
+
const i = rt(this.muteColor);
|
|
1802
1805
|
o += `--pc-mute-color: ${i} !important;
|
|
1803
1806
|
`;
|
|
1804
1807
|
}
|
|
1805
1808
|
if (this.textColor) {
|
|
1806
|
-
const i =
|
|
1809
|
+
const i = rt(this.textColor);
|
|
1807
1810
|
o += `--pc-text-color: ${i} !important;
|
|
1808
1811
|
`;
|
|
1809
1812
|
}
|
|
1810
1813
|
if (this.backgroundColor) {
|
|
1811
|
-
const i =
|
|
1814
|
+
const i = rt(this.backgroundColor);
|
|
1812
1815
|
o += `--pc-background-color: ${i} !important;
|
|
1813
1816
|
`;
|
|
1814
1817
|
}
|
|
1815
1818
|
const r = this.starColor || this.accentColor || this.primaryColor;
|
|
1816
1819
|
if (r) {
|
|
1817
|
-
const i =
|
|
1820
|
+
const i = rt(r);
|
|
1818
1821
|
o += `--pc-star-color: ${i} !important;
|
|
1819
1822
|
`;
|
|
1820
1823
|
}
|
|
1821
|
-
const s = this.starHoverColor || (r ? `color-mix(in srgb, ${
|
|
1824
|
+
const s = this.starHoverColor || (r ? `color-mix(in srgb, ${rt(r)} 80%, white)` : null);
|
|
1822
1825
|
if (s && (o += `--pc-star-hover-color: ${s} !important;
|
|
1823
1826
|
`), this.starSize) {
|
|
1824
1827
|
const i = qt(this.starSize, "1.5em", 1.5);
|
|
@@ -1872,7 +1875,7 @@ const $t = {
|
|
|
1872
1875
|
*/
|
|
1873
1876
|
announceSelectionChange(t, o, r) {
|
|
1874
1877
|
const s = `Poll for "${t}"`, i = r ? `${o.label} selected` : `${o.label} unselected`;
|
|
1875
|
-
Jo(
|
|
1878
|
+
Xo(Jo(s, i));
|
|
1876
1879
|
}
|
|
1877
1880
|
/** Common render methods */
|
|
1878
1881
|
renderLabel() {
|
|
@@ -1922,7 +1925,7 @@ const $t = {
|
|
|
1922
1925
|
tabindex="0"
|
|
1923
1926
|
aria-label="${this.displayController.isChartVisible ? "Hide chart" : "Show chart"}"
|
|
1924
1927
|
@keydown="${() => this.displayController.toggleChartVisibility()}"
|
|
1925
|
-
>${this.displayController.isChartVisible ? Qt :
|
|
1928
|
+
>${this.displayController.isChartVisible ? Qt : Jt}</span
|
|
1926
1929
|
>
|
|
1927
1930
|
` : u;
|
|
1928
1931
|
}
|
|
@@ -1931,9 +1934,9 @@ const $t = {
|
|
|
1931
1934
|
return u;
|
|
1932
1935
|
const o = {
|
|
1933
1936
|
"pc-status": !0,
|
|
1934
|
-
[`pc-flex-content-${
|
|
1937
|
+
[`pc-flex-content-${O(this.statsPosition, this.statsAlign)}`]: !0
|
|
1935
1938
|
};
|
|
1936
|
-
return c`<div class="${
|
|
1939
|
+
return c`<div class="${y(o)}" data-testid="pc-status">
|
|
1937
1940
|
${this.renderStatsText()} ${this.renderChartToggle()} ${this.renderEditToggleIcon()}
|
|
1938
1941
|
</div>`;
|
|
1939
1942
|
}
|
|
@@ -1970,7 +1973,7 @@ const $t = {
|
|
|
1970
1973
|
}
|
|
1971
1974
|
};
|
|
1972
1975
|
oe.styles = [
|
|
1973
|
-
|
|
1976
|
+
V`
|
|
1974
1977
|
:host {
|
|
1975
1978
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
1976
1979
|
--default-font-size-base: 1rem;
|
|
@@ -2051,112 +2054,112 @@ oe.styles = [
|
|
|
2051
2054
|
`
|
|
2052
2055
|
];
|
|
2053
2056
|
let m = oe;
|
|
2054
|
-
|
|
2055
|
-
|
|
2057
|
+
v([
|
|
2058
|
+
h({ type: String, attribute: "show-stats" })
|
|
2056
2059
|
], m.prototype, "showStats");
|
|
2057
|
-
|
|
2058
|
-
|
|
2060
|
+
v([
|
|
2061
|
+
h({ type: Boolean, attribute: "show-chart" })
|
|
2059
2062
|
], m.prototype, "showChart");
|
|
2060
|
-
|
|
2061
|
-
|
|
2063
|
+
v([
|
|
2064
|
+
h({ type: Boolean, attribute: "initialized" })
|
|
2062
2065
|
], m.prototype, "initialized");
|
|
2063
|
-
|
|
2064
|
-
|
|
2066
|
+
v([
|
|
2067
|
+
h({ type: String, attribute: "primary-color" })
|
|
2065
2068
|
], m.prototype, "primaryColor");
|
|
2066
|
-
|
|
2067
|
-
|
|
2069
|
+
v([
|
|
2070
|
+
h({ type: String, attribute: "mute-color" })
|
|
2068
2071
|
], m.prototype, "muteColor");
|
|
2069
|
-
|
|
2070
|
-
|
|
2072
|
+
v([
|
|
2073
|
+
h({ type: String, attribute: "text-color" })
|
|
2071
2074
|
], m.prototype, "textColor");
|
|
2072
|
-
|
|
2073
|
-
|
|
2075
|
+
v([
|
|
2076
|
+
h({ type: String, attribute: "background-color" })
|
|
2074
2077
|
], m.prototype, "backgroundColor");
|
|
2075
|
-
|
|
2076
|
-
|
|
2078
|
+
v([
|
|
2079
|
+
h({ type: String, attribute: "accent-color" })
|
|
2077
2080
|
], m.prototype, "accentColor");
|
|
2078
|
-
|
|
2079
|
-
|
|
2081
|
+
v([
|
|
2082
|
+
h({ type: String, attribute: "star-color" })
|
|
2080
2083
|
], m.prototype, "starColor");
|
|
2081
|
-
|
|
2082
|
-
|
|
2084
|
+
v([
|
|
2085
|
+
h({ type: String, attribute: "star-hover-color" })
|
|
2083
2086
|
], m.prototype, "starHoverColor");
|
|
2084
|
-
|
|
2085
|
-
|
|
2087
|
+
v([
|
|
2088
|
+
h({ type: String, attribute: "star-size" })
|
|
2086
2089
|
], m.prototype, "starSize");
|
|
2087
|
-
|
|
2088
|
-
|
|
2090
|
+
v([
|
|
2091
|
+
h({ type: String, attribute: "reaction-size" })
|
|
2089
2092
|
], m.prototype, "reactionSize");
|
|
2090
|
-
|
|
2091
|
-
|
|
2093
|
+
v([
|
|
2094
|
+
h({ type: String })
|
|
2092
2095
|
], m.prototype, "size");
|
|
2093
|
-
|
|
2094
|
-
|
|
2096
|
+
v([
|
|
2097
|
+
h({ type: String, attribute: "aria-label" })
|
|
2095
2098
|
], m.prototype, "ariaLabel");
|
|
2096
|
-
|
|
2097
|
-
|
|
2099
|
+
v([
|
|
2100
|
+
h({ type: String, attribute: "aria-describedby" })
|
|
2098
2101
|
], m.prototype, "ariaDescribedby");
|
|
2099
|
-
|
|
2100
|
-
|
|
2102
|
+
v([
|
|
2103
|
+
h({ type: Number, attribute: "min-contrast" })
|
|
2101
2104
|
], m.prototype, "minContrast");
|
|
2102
|
-
|
|
2103
|
-
|
|
2105
|
+
v([
|
|
2106
|
+
h({ type: String })
|
|
2104
2107
|
], m.prototype, "css");
|
|
2105
|
-
|
|
2106
|
-
|
|
2108
|
+
v([
|
|
2109
|
+
h({ type: Array })
|
|
2107
2110
|
], m.prototype, "options");
|
|
2108
|
-
|
|
2109
|
-
|
|
2111
|
+
v([
|
|
2112
|
+
h({ type: String, attribute: "widget-id" })
|
|
2110
2113
|
], m.prototype, "widgetId");
|
|
2111
|
-
|
|
2112
|
-
|
|
2114
|
+
v([
|
|
2115
|
+
h({ type: String, attribute: "name" })
|
|
2113
2116
|
], m.prototype, "name");
|
|
2114
|
-
|
|
2115
|
-
|
|
2117
|
+
v([
|
|
2118
|
+
h({ type: String })
|
|
2116
2119
|
], m.prototype, "metadata");
|
|
2117
|
-
|
|
2118
|
-
|
|
2120
|
+
v([
|
|
2121
|
+
h({ type: String, attribute: "data-func" })
|
|
2119
2122
|
], m.prototype, "dataFunc");
|
|
2120
|
-
|
|
2121
|
-
|
|
2123
|
+
v([
|
|
2124
|
+
h({ type: String, attribute: "data-endpoint" })
|
|
2122
2125
|
], m.prototype, "dataEndpoint");
|
|
2123
|
-
|
|
2124
|
-
|
|
2126
|
+
v([
|
|
2127
|
+
h({ type: String })
|
|
2125
2128
|
], m.prototype, "question");
|
|
2126
|
-
|
|
2127
|
-
|
|
2129
|
+
v([
|
|
2130
|
+
h({ type: String, attribute: "question-position" })
|
|
2128
2131
|
], m.prototype, "questionPosition");
|
|
2129
|
-
|
|
2130
|
-
|
|
2132
|
+
v([
|
|
2133
|
+
h({ type: String, attribute: "question-align" })
|
|
2131
2134
|
], m.prototype, "questionAlign");
|
|
2132
|
-
|
|
2133
|
-
|
|
2135
|
+
v([
|
|
2136
|
+
h({ type: String, attribute: "stats-text" })
|
|
2134
2137
|
], m.prototype, "statsText");
|
|
2135
|
-
|
|
2136
|
-
|
|
2138
|
+
v([
|
|
2139
|
+
h({ type: String, attribute: "stats-position" })
|
|
2137
2140
|
], m.prototype, "statsPosition");
|
|
2138
|
-
|
|
2139
|
-
|
|
2141
|
+
v([
|
|
2142
|
+
h({ type: String, attribute: "stats-align" })
|
|
2140
2143
|
], m.prototype, "statsAlign");
|
|
2141
|
-
|
|
2142
|
-
|
|
2144
|
+
v([
|
|
2145
|
+
h({ type: String, attribute: "button-text" })
|
|
2143
2146
|
], m.prototype, "buttonText");
|
|
2144
|
-
|
|
2145
|
-
|
|
2147
|
+
v([
|
|
2148
|
+
h({ type: String, attribute: "button-radius" })
|
|
2146
2149
|
], m.prototype, "buttonRadius");
|
|
2147
|
-
|
|
2148
|
-
|
|
2150
|
+
v([
|
|
2151
|
+
h({ type: String, attribute: "thank-you-msg" })
|
|
2149
2152
|
], m.prototype, "thankYouMsg");
|
|
2150
|
-
|
|
2151
|
-
|
|
2153
|
+
v([
|
|
2154
|
+
h({ type: Boolean, attribute: "multiple" })
|
|
2152
2155
|
], m.prototype, "multiple");
|
|
2153
|
-
|
|
2154
|
-
|
|
2156
|
+
v([
|
|
2157
|
+
h({ type: Boolean, reflect: !0 })
|
|
2155
2158
|
], m.prototype, "inline");
|
|
2156
|
-
|
|
2157
|
-
|
|
2159
|
+
v([
|
|
2160
|
+
h({ type: Boolean, reflect: !0 })
|
|
2158
2161
|
], m.prototype, "readonly");
|
|
2159
|
-
const tr =
|
|
2162
|
+
const tr = V`
|
|
2160
2163
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
2161
2164
|
|
|
2162
2165
|
.pc-body {
|
|
@@ -2607,7 +2610,7 @@ const tr = U`
|
|
|
2607
2610
|
animation: none;
|
|
2608
2611
|
}
|
|
2609
2612
|
}
|
|
2610
|
-
`, It =
|
|
2613
|
+
`, It = V`
|
|
2611
2614
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
2612
2615
|
:host {
|
|
2613
2616
|
--default-primary-color: #2196f3;
|
|
@@ -3326,7 +3329,7 @@ const tr = U`
|
|
|
3326
3329
|
opacity: 1;
|
|
3327
3330
|
}
|
|
3328
3331
|
}
|
|
3329
|
-
`, er =
|
|
3332
|
+
`, er = V`
|
|
3330
3333
|
:host {
|
|
3331
3334
|
--popover-bg: light-dark(#ffffff, #1a1a1a);
|
|
3332
3335
|
--popover-border: light-dark(#e0e0e0, #333333);
|
|
@@ -3448,21 +3451,21 @@ const tr = U`
|
|
|
3448
3451
|
max-width: 100%;
|
|
3449
3452
|
}
|
|
3450
3453
|
`;
|
|
3451
|
-
var or = Object.defineProperty, rr = Object.getOwnPropertyDescriptor,
|
|
3454
|
+
var or = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, j = (e, t, o, r) => {
|
|
3452
3455
|
for (var s = r > 1 ? void 0 : r ? rr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3453
3456
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3454
3457
|
return r && s && or(t, o, s), s;
|
|
3455
3458
|
};
|
|
3456
|
-
let
|
|
3459
|
+
let _ = class extends B {
|
|
3457
3460
|
constructor() {
|
|
3458
3461
|
super(...arguments), this.open = !1, this.position = "auto", this.isClosing = !1, this.computedPosition = "bottom", this.popoverStyles = {}, this.arrowStyles = {}, this.updatePosition = () => {
|
|
3459
|
-
var
|
|
3462
|
+
var f;
|
|
3460
3463
|
if (!this.anchor || !this.open) return;
|
|
3461
|
-
const e = this.anchor.getBoundingClientRect(), t = window.innerWidth, o = window.innerHeight, r = 12, s = (
|
|
3464
|
+
const e = this.anchor.getBoundingClientRect(), t = window.innerWidth, o = window.innerHeight, r = 12, s = (f = this.popoverElement) == null ? void 0 : f.getBoundingClientRect(), i = (s == null ? void 0 : s.width) || 280, a = (s == null ? void 0 : s.height) || 200;
|
|
3462
3465
|
let l = this.position;
|
|
3463
3466
|
if (l === "auto") {
|
|
3464
|
-
const
|
|
3465
|
-
l =
|
|
3467
|
+
const b = o - e.bottom, w = e.top;
|
|
3468
|
+
l = b >= a + r || b >= w ? "bottom" : "top";
|
|
3466
3469
|
}
|
|
3467
3470
|
this.computedPosition = l;
|
|
3468
3471
|
let n, d;
|
|
@@ -3526,7 +3529,7 @@ let I = class extends R {
|
|
|
3526
3529
|
return c`
|
|
3527
3530
|
<div class="pc-popover-scrim" @click=${this.handleScrimClick}></div>
|
|
3528
3531
|
<div
|
|
3529
|
-
class=${
|
|
3532
|
+
class=${y(e)}
|
|
3530
3533
|
data-position=${this.computedPosition}
|
|
3531
3534
|
style=${Object.entries(this.popoverStyles).map(([t, o]) => `${t}: ${o}`).join("; ")}
|
|
3532
3535
|
role="dialog"
|
|
@@ -3542,35 +3545,35 @@ let I = class extends R {
|
|
|
3542
3545
|
`;
|
|
3543
3546
|
}
|
|
3544
3547
|
};
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
],
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
],
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
],
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
],
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
],
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
],
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
],
|
|
3567
|
-
|
|
3548
|
+
_.styles = [er];
|
|
3549
|
+
j([
|
|
3550
|
+
h({ type: Boolean, reflect: !0 })
|
|
3551
|
+
], _.prototype, "open", 2);
|
|
3552
|
+
j([
|
|
3553
|
+
h({ type: String })
|
|
3554
|
+
], _.prototype, "position", 2);
|
|
3555
|
+
j([
|
|
3556
|
+
h({ attribute: !1 })
|
|
3557
|
+
], _.prototype, "anchor", 2);
|
|
3558
|
+
j([
|
|
3559
|
+
C()
|
|
3560
|
+
], _.prototype, "isClosing", 2);
|
|
3561
|
+
j([
|
|
3562
|
+
C()
|
|
3563
|
+
], _.prototype, "computedPosition", 2);
|
|
3564
|
+
j([
|
|
3565
|
+
C()
|
|
3566
|
+
], _.prototype, "popoverStyles", 2);
|
|
3567
|
+
j([
|
|
3568
|
+
C()
|
|
3569
|
+
], _.prototype, "arrowStyles", 2);
|
|
3570
|
+
j([
|
|
3568
3571
|
bt(".pc-popover")
|
|
3569
|
-
],
|
|
3570
|
-
|
|
3572
|
+
], _.prototype, "popoverElement", 2);
|
|
3573
|
+
_ = j([
|
|
3571
3574
|
W("pc-popover")
|
|
3572
|
-
],
|
|
3573
|
-
const sr =
|
|
3575
|
+
], _);
|
|
3576
|
+
const sr = V`
|
|
3574
3577
|
:host {
|
|
3575
3578
|
--sheet-bg: light-dark(#ffffff, #1a1a1a);
|
|
3576
3579
|
--sheet-border: light-dark(#e0e0e0, #333333);
|
|
@@ -3683,12 +3686,12 @@ const sr = U`
|
|
|
3683
3686
|
max-width: 100%;
|
|
3684
3687
|
}
|
|
3685
3688
|
`;
|
|
3686
|
-
var ir = Object.defineProperty, ar = Object.getOwnPropertyDescriptor,
|
|
3689
|
+
var ir = Object.defineProperty, ar = Object.getOwnPropertyDescriptor, ot = (e, t, o, r) => {
|
|
3687
3690
|
for (var s = r > 1 ? void 0 : r ? ar(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3688
3691
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3689
3692
|
return r && s && ir(t, o, s), s;
|
|
3690
3693
|
};
|
|
3691
|
-
let
|
|
3694
|
+
let U = class extends B {
|
|
3692
3695
|
constructor() {
|
|
3693
3696
|
super(...arguments), this.open = !1, this.dragToClose = !0, this.isClosing = !1, this.isDragging = !1, this.dragOffset = 0, this.dragStartY = 0, this.sheetHeight = 0, this.handleKeyDown = (e) => {
|
|
3694
3697
|
if (e.key === "Escape" && this.open && (e.preventDefault(), e.stopPropagation(), this.close()), e.key === "Tab" && this.open && this.sheetElement) {
|
|
@@ -3766,8 +3769,8 @@ let B = class extends R {
|
|
|
3766
3769
|
dragging: this.isDragging
|
|
3767
3770
|
};
|
|
3768
3771
|
return c`
|
|
3769
|
-
<div class=${
|
|
3770
|
-
<div class=${
|
|
3772
|
+
<div class=${y(e)} @click=${this.handleScrimClick}></div>
|
|
3773
|
+
<div class=${y(t)} role="dialog" aria-modal="true" tabindex="-1">
|
|
3771
3774
|
<div
|
|
3772
3775
|
class="pc-sheet-handle"
|
|
3773
3776
|
@touchstart=${this.handleDragStart}
|
|
@@ -3782,35 +3785,35 @@ let B = class extends R {
|
|
|
3782
3785
|
`;
|
|
3783
3786
|
}
|
|
3784
3787
|
};
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
],
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
],
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
],
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
],
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
],
|
|
3801
|
-
|
|
3788
|
+
U.styles = [sr];
|
|
3789
|
+
ot([
|
|
3790
|
+
h({ type: Boolean, reflect: !0 })
|
|
3791
|
+
], U.prototype, "open", 2);
|
|
3792
|
+
ot([
|
|
3793
|
+
h({ type: Boolean, attribute: "drag-to-close" })
|
|
3794
|
+
], U.prototype, "dragToClose", 2);
|
|
3795
|
+
ot([
|
|
3796
|
+
C()
|
|
3797
|
+
], U.prototype, "isClosing", 2);
|
|
3798
|
+
ot([
|
|
3799
|
+
C()
|
|
3800
|
+
], U.prototype, "isDragging", 2);
|
|
3801
|
+
ot([
|
|
3802
|
+
C()
|
|
3803
|
+
], U.prototype, "dragOffset", 2);
|
|
3804
|
+
ot([
|
|
3802
3805
|
bt(".pc-bottom-sheet")
|
|
3803
|
-
],
|
|
3804
|
-
|
|
3806
|
+
], U.prototype, "sheetElement", 2);
|
|
3807
|
+
U = ot([
|
|
3805
3808
|
W("pc-bottom-sheet")
|
|
3806
|
-
],
|
|
3809
|
+
], U);
|
|
3807
3810
|
var nr = Object.defineProperty, lr = Object.getOwnPropertyDescriptor, yt = (e, t, o, r) => {
|
|
3808
3811
|
for (var s = r > 1 ? void 0 : r ? lr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3809
3812
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3810
3813
|
return r && s && nr(t, o, s), s;
|
|
3811
3814
|
};
|
|
3812
3815
|
const cr = 768;
|
|
3813
|
-
let
|
|
3816
|
+
let tt = class extends B {
|
|
3814
3817
|
constructor() {
|
|
3815
3818
|
super(...arguments), this.open = !1, this.position = "auto", this.isMobile = !1, this.handleMediaChange = (e) => {
|
|
3816
3819
|
this.isMobile = e.matches;
|
|
@@ -3845,34 +3848,34 @@ let Q = class extends R {
|
|
|
3845
3848
|
`;
|
|
3846
3849
|
}
|
|
3847
3850
|
};
|
|
3848
|
-
|
|
3851
|
+
tt.styles = V`
|
|
3849
3852
|
:host {
|
|
3850
3853
|
display: contents;
|
|
3851
3854
|
}
|
|
3852
3855
|
`;
|
|
3853
3856
|
yt([
|
|
3854
|
-
|
|
3855
|
-
],
|
|
3857
|
+
h({ type: Boolean, reflect: !0 })
|
|
3858
|
+
], tt.prototype, "open", 2);
|
|
3856
3859
|
yt([
|
|
3857
|
-
|
|
3858
|
-
],
|
|
3860
|
+
h({ type: String })
|
|
3861
|
+
], tt.prototype, "position", 2);
|
|
3859
3862
|
yt([
|
|
3860
|
-
|
|
3861
|
-
],
|
|
3863
|
+
h({ attribute: !1 })
|
|
3864
|
+
], tt.prototype, "anchor", 2);
|
|
3862
3865
|
yt([
|
|
3863
|
-
|
|
3864
|
-
],
|
|
3865
|
-
|
|
3866
|
+
C()
|
|
3867
|
+
], tt.prototype, "isMobile", 2);
|
|
3868
|
+
tt = yt([
|
|
3866
3869
|
W("pc-responsive-modal")
|
|
3867
|
-
],
|
|
3870
|
+
], tt);
|
|
3868
3871
|
var dr = Object.defineProperty, pr = Object.getOwnPropertyDescriptor, K = (e, t, o, r) => {
|
|
3869
3872
|
for (var s = r > 1 ? void 0 : r ? pr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3870
3873
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3871
3874
|
return r && s && dr(t, o, s), s;
|
|
3872
3875
|
};
|
|
3873
|
-
let
|
|
3876
|
+
let I = class extends m {
|
|
3874
3877
|
constructor() {
|
|
3875
|
-
super(), this.min = 0, this.max = 10, this.type =
|
|
3878
|
+
super(), this.min = 0, this.max = 10, this.type = x.nps, this.minLabel = "Not at all", this.maxLabel = "Extremely", this.minMaxPosition = "top", this.hoverValue = -1, this.popoverOpen = !1, this.handleNumberLeave = () => {
|
|
3876
3879
|
this.hoverValue = -1;
|
|
3877
3880
|
}, this.handleKeyDown = (e) => {
|
|
3878
3881
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.hoverValue >= 0 && this.handleNumberClick(this.hoverValue));
|
|
@@ -3882,8 +3885,8 @@ let M = class extends m {
|
|
|
3882
3885
|
* Render NPS buttons for edit mode
|
|
3883
3886
|
*/
|
|
3884
3887
|
renderNpsButtons() {
|
|
3885
|
-
const e = Array.from({ length: this.max - this.min + 1 }, (s, i) => i + this.min), t = `nps-control-${this.name || this.type}`, o =
|
|
3886
|
-
role:
|
|
3888
|
+
const e = Array.from({ length: this.max - this.min + 1 }, (s, i) => i + this.min), t = `nps-control-${this.name || this.type}`, o = it({
|
|
3889
|
+
role: N.GROUP,
|
|
3887
3890
|
ariaLabel: this.question || "NPS Rating",
|
|
3888
3891
|
ariaDescribedby: `${t}-description`
|
|
3889
3892
|
}), r = e.map((s) => {
|
|
@@ -3895,7 +3898,7 @@ let M = class extends m {
|
|
|
3895
3898
|
<button
|
|
3896
3899
|
data-testid="nps-button-${s}"
|
|
3897
3900
|
?disabled=${!this.displayController.allowEdit()}
|
|
3898
|
-
class=${
|
|
3901
|
+
class=${y(a)}
|
|
3899
3902
|
@click="${() => this.handleNumberClick(s)}"
|
|
3900
3903
|
@mouseenter="${() => this.handleNumberHover(s)}"
|
|
3901
3904
|
@focus="${() => this.handleNumberHover(s)}"
|
|
@@ -3934,10 +3937,10 @@ let M = class extends m {
|
|
|
3934
3937
|
* NPS score displayed prominently in the middle
|
|
3935
3938
|
*/
|
|
3936
3939
|
renderChart() {
|
|
3937
|
-
const e = this.dataController.stats, t = (e == null ? void 0 : e.nps) ?? 0, o = 100, r = 100, s = 80, i = (
|
|
3938
|
-
x: o + s * Math.cos(
|
|
3939
|
-
y: r - s * Math.sin(
|
|
3940
|
-
}), a = i(Math.PI), l = i(Math.PI / 2), n = i(Math.PI / 4), d = i(0), p = ($,
|
|
3940
|
+
const e = this.dataController.stats, t = (e == null ? void 0 : e.nps) ?? 0, o = 100, r = 100, s = 80, i = (k) => ({
|
|
3941
|
+
x: o + s * Math.cos(k),
|
|
3942
|
+
y: r - s * Math.sin(k)
|
|
3943
|
+
}), a = i(Math.PI), l = i(Math.PI / 2), n = i(Math.PI / 4), d = i(0), p = (k, $, A = 0) => `M ${k.x} ${k.y} A ${s} ${s} 0 ${A} 1 ${$.x} ${$.y}`, f = p(a, l), b = p(l, n), w = p(n, d), M = ((k) => Math.PI - (k + 100) / 200 * Math.PI)(t), L = i(M);
|
|
3941
3944
|
return c`
|
|
3942
3945
|
<div class="nps-semicircle-gauge" data-testid="nps-semicircle-gauge">
|
|
3943
3946
|
<svg viewBox="0 0 200 115">
|
|
@@ -3948,12 +3951,12 @@ let M = class extends m {
|
|
|
3948
3951
|
/>
|
|
3949
3952
|
|
|
3950
3953
|
<!-- Colored segments -->
|
|
3951
|
-
<path class="gauge-arc gauge-arc-detractor" d="${
|
|
3952
|
-
<path class="gauge-arc gauge-arc-passive" d="${
|
|
3953
|
-
<path class="gauge-arc gauge-arc-promoter" d="${
|
|
3954
|
+
<path class="gauge-arc gauge-arc-detractor" d="${f}" />
|
|
3955
|
+
<path class="gauge-arc gauge-arc-passive" d="${b}" />
|
|
3956
|
+
<path class="gauge-arc gauge-arc-promoter" d="${w}" />
|
|
3954
3957
|
|
|
3955
3958
|
<!-- Needle indicator -->
|
|
3956
|
-
<circle class="gauge-needle" cx="${
|
|
3959
|
+
<circle class="gauge-needle" cx="${L.x}" cy="${L.y}" r="5" />
|
|
3957
3960
|
|
|
3958
3961
|
<!-- Score display in center -->
|
|
3959
3962
|
<text class="gauge-score" x="${o}" y="${r - 15}">${t}</text>
|
|
@@ -4022,9 +4025,9 @@ let M = class extends m {
|
|
|
4022
4025
|
</svg>
|
|
4023
4026
|
</div>
|
|
4024
4027
|
`;
|
|
4025
|
-
const a = s.detractors / i * 100, l = s.passives / i * 100, n = s.promoters / i * 100, d = a / 100 * r, p = l / 100 * r,
|
|
4026
|
-
let
|
|
4027
|
-
return
|
|
4028
|
+
const a = s.detractors / i * 100, l = s.passives / i * 100, n = s.promoters / i * 100, d = a / 100 * r, p = l / 100 * r, f = n / 100 * r, b = 0, w = -d, E = -(d + p), M = this.getUserScore();
|
|
4029
|
+
let L = "gauge-bg";
|
|
4030
|
+
return M !== null && (M <= 6 ? L = "gauge-detractor" : M <= 8 ? L = "gauge-passive" : L = "gauge-promoter"), c`
|
|
4028
4031
|
<div class="inline-nps-gauge">
|
|
4029
4032
|
<svg viewBox="0 0 20 20">
|
|
4030
4033
|
<!-- Background circle -->
|
|
@@ -4036,7 +4039,7 @@ let M = class extends m {
|
|
|
4036
4039
|
cy="10"
|
|
4037
4040
|
r="${o}"
|
|
4038
4041
|
stroke-dasharray="${d} ${r}"
|
|
4039
|
-
stroke-dashoffset="${
|
|
4042
|
+
stroke-dashoffset="${b}"
|
|
4040
4043
|
/>
|
|
4041
4044
|
<!-- Passive segment (yellow) -->
|
|
4042
4045
|
<circle
|
|
@@ -4045,7 +4048,7 @@ let M = class extends m {
|
|
|
4045
4048
|
cy="10"
|
|
4046
4049
|
r="${o}"
|
|
4047
4050
|
stroke-dasharray="${p} ${r}"
|
|
4048
|
-
stroke-dashoffset="${
|
|
4051
|
+
stroke-dashoffset="${w}"
|
|
4049
4052
|
/>
|
|
4050
4053
|
<!-- Promoter segment (green) -->
|
|
4051
4054
|
<circle
|
|
@@ -4053,11 +4056,11 @@ let M = class extends m {
|
|
|
4053
4056
|
cx="10"
|
|
4054
4057
|
cy="10"
|
|
4055
4058
|
r="${o}"
|
|
4056
|
-
stroke-dasharray="${
|
|
4057
|
-
stroke-dashoffset="${
|
|
4059
|
+
stroke-dasharray="${f} ${r}"
|
|
4060
|
+
stroke-dashoffset="${E}"
|
|
4058
4061
|
/>
|
|
4059
4062
|
<!-- Center dot showing user's score category -->
|
|
4060
|
-
<circle class="gauge-dot ${
|
|
4063
|
+
<circle class="gauge-dot ${L}" cx="10" cy="10" r="2" />
|
|
4061
4064
|
</svg>
|
|
4062
4065
|
</div>
|
|
4063
4066
|
`;
|
|
@@ -4100,7 +4103,7 @@ let M = class extends m {
|
|
|
4100
4103
|
};
|
|
4101
4104
|
return c`
|
|
4102
4105
|
<button
|
|
4103
|
-
class=${
|
|
4106
|
+
class=${y(i)}
|
|
4104
4107
|
@click=${() => this.handlePopoverNumberClick(r)}
|
|
4105
4108
|
@mouseenter=${() => this.handleNumberHover(r)}
|
|
4106
4109
|
@mouseleave=${this.handleNumberLeave}
|
|
@@ -4134,7 +4137,7 @@ let M = class extends m {
|
|
|
4134
4137
|
@keydown="${(e) => {
|
|
4135
4138
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.displayController.toggleChartVisibility());
|
|
4136
4139
|
}}"
|
|
4137
|
-
>${this.displayController.isChartVisible ? Qt :
|
|
4140
|
+
>${this.displayController.isChartVisible ? Qt : Jt}</span
|
|
4138
4141
|
>
|
|
4139
4142
|
`;
|
|
4140
4143
|
}
|
|
@@ -4203,16 +4206,16 @@ let M = class extends m {
|
|
|
4203
4206
|
renderStandardMode() {
|
|
4204
4207
|
const e = {
|
|
4205
4208
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
4206
|
-
[`pc-flex-align-${
|
|
4209
|
+
[`pc-flex-align-${O(this.questionPosition, this.questionAlign)}`]: !0
|
|
4207
4210
|
}, t = {
|
|
4208
4211
|
nps: !0,
|
|
4209
4212
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
4210
|
-
[`pc-flex-align-${
|
|
4213
|
+
[`pc-flex-align-${O(this.statsPosition, this.statsAlign)}`]: !0
|
|
4211
4214
|
};
|
|
4212
4215
|
return c`
|
|
4213
|
-
<div class="pc-container ${
|
|
4216
|
+
<div class="pc-container ${y(e)}" data-testid="nps-container">
|
|
4214
4217
|
${this.renderLabelAtStart()}
|
|
4215
|
-
<div class="pc-body ${
|
|
4218
|
+
<div class="pc-body ${y(t)}" data-testid="nps-body">
|
|
4216
4219
|
${this.renderStatusAtStart()} ${this.renderContent()} ${this.renderStatusAtEnd()}
|
|
4217
4220
|
</div>
|
|
4218
4221
|
${this.renderLabelAtEnd()}
|
|
@@ -4226,32 +4229,32 @@ let M = class extends m {
|
|
|
4226
4229
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
4227
4230
|
}
|
|
4228
4231
|
};
|
|
4229
|
-
|
|
4232
|
+
I.styles = [...m.styles, It, tr];
|
|
4230
4233
|
K([
|
|
4231
|
-
|
|
4232
|
-
],
|
|
4234
|
+
h({ type: String, attribute: "min-label" })
|
|
4235
|
+
], I.prototype, "minLabel", 2);
|
|
4233
4236
|
K([
|
|
4234
|
-
|
|
4235
|
-
],
|
|
4237
|
+
h({ type: String, attribute: "max-label" })
|
|
4238
|
+
], I.prototype, "maxLabel", 2);
|
|
4236
4239
|
K([
|
|
4237
|
-
|
|
4238
|
-
],
|
|
4240
|
+
h({ type: String, attribute: "thank-you-msg" })
|
|
4241
|
+
], I.prototype, "thankYouMsg", 2);
|
|
4239
4242
|
K([
|
|
4240
|
-
|
|
4241
|
-
],
|
|
4243
|
+
h({ type: String, attribute: "min-max-position" })
|
|
4244
|
+
], I.prototype, "minMaxPosition", 2);
|
|
4242
4245
|
K([
|
|
4243
|
-
|
|
4244
|
-
],
|
|
4246
|
+
C()
|
|
4247
|
+
], I.prototype, "hoverValue", 2);
|
|
4245
4248
|
K([
|
|
4246
|
-
|
|
4247
|
-
],
|
|
4249
|
+
C()
|
|
4250
|
+
], I.prototype, "popoverOpen", 2);
|
|
4248
4251
|
K([
|
|
4249
4252
|
bt(".pc-inline-trigger")
|
|
4250
|
-
],
|
|
4251
|
-
|
|
4253
|
+
], I.prototype, "triggerElement", 2);
|
|
4254
|
+
I = K([
|
|
4252
4255
|
W("pc-nps")
|
|
4253
|
-
],
|
|
4254
|
-
const ur =
|
|
4256
|
+
], I);
|
|
4257
|
+
const ur = V`
|
|
4255
4258
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
4256
4259
|
|
|
4257
4260
|
.pc-container {
|
|
@@ -4641,16 +4644,16 @@ var hr = Object.defineProperty, fr = Object.getOwnPropertyDescriptor, wt = (e, t
|
|
|
4641
4644
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
4642
4645
|
return r && s && hr(t, o, s), s;
|
|
4643
4646
|
};
|
|
4644
|
-
let
|
|
4647
|
+
let et = class extends m {
|
|
4645
4648
|
constructor() {
|
|
4646
|
-
super(), this.type =
|
|
4649
|
+
super(), this.type = x.poll, this.multiple = !1, this.compact = !1, this.popoverOpen = !1, this.hasEditButton = !0, this.statsText = "{count} votes", this.questionPosition = "top", this.statsPosition = "bottom", this.showStats = "after-vote";
|
|
4647
4650
|
}
|
|
4648
4651
|
renderStatus() {
|
|
4649
4652
|
const t = {
|
|
4650
4653
|
"pc-status": !0,
|
|
4651
|
-
[`pc-flex-content-${
|
|
4654
|
+
[`pc-flex-content-${O("bottom", this.statsAlign)}`]: !0
|
|
4652
4655
|
};
|
|
4653
|
-
return c`<div class="${
|
|
4656
|
+
return c`<div class="${y(t)}" data-testid="pc-status">
|
|
4654
4657
|
<span>${this.renderStatsText()} ${this.renderEditToggleIcon("stats-edit-button")}</span>
|
|
4655
4658
|
</div>`;
|
|
4656
4659
|
}
|
|
@@ -4665,7 +4668,7 @@ let tt = class extends m {
|
|
|
4665
4668
|
}, t = this.displayController.shouldDisableSubmitButton();
|
|
4666
4669
|
return c`
|
|
4667
4670
|
<button
|
|
4668
|
-
class="${
|
|
4671
|
+
class="${y(e)}"
|
|
4669
4672
|
data-testid="pc-submit-button"
|
|
4670
4673
|
@click="${this.handleSubmit}"
|
|
4671
4674
|
?disabled="${t}"
|
|
@@ -4724,7 +4727,7 @@ let tt = class extends m {
|
|
|
4724
4727
|
* Renders the selection indicator (checkbox or radio button) with proper ARIA roles
|
|
4725
4728
|
*/
|
|
4726
4729
|
renderSelectionIndicator() {
|
|
4727
|
-
const e = this.multiple ?
|
|
4730
|
+
const e = this.multiple ? N.CHECKBOX : N.RADIO;
|
|
4728
4731
|
return this.multiple ? c`<span class="poll-checkbox" role="${e}"></span>` : c`<span class="poll-radio" role="${e}"></span>`;
|
|
4729
4732
|
}
|
|
4730
4733
|
/**
|
|
@@ -4746,7 +4749,7 @@ let tt = class extends m {
|
|
|
4746
4749
|
return c`
|
|
4747
4750
|
<button
|
|
4748
4751
|
data-testid="poll-option-i${t}"
|
|
4749
|
-
class="${
|
|
4752
|
+
class="${y(s)}"
|
|
4750
4753
|
@click="${(n) => {
|
|
4751
4754
|
n.stopPropagation(), this.handleClick(e);
|
|
4752
4755
|
}}"
|
|
@@ -4770,13 +4773,13 @@ let tt = class extends m {
|
|
|
4770
4773
|
*/
|
|
4771
4774
|
renderPollOptions() {
|
|
4772
4775
|
var s;
|
|
4773
|
-
const e = this.multiple ?
|
|
4776
|
+
const e = this.multiple ? N.GROUP : N.RADIOGROUP, t = this.question || this.name || "Options", o = it({
|
|
4774
4777
|
role: e,
|
|
4775
4778
|
ariaLabel: t
|
|
4776
4779
|
});
|
|
4777
4780
|
return c`
|
|
4778
4781
|
<div
|
|
4779
|
-
class="${
|
|
4782
|
+
class="${y({
|
|
4780
4783
|
"poll-container": !0
|
|
4781
4784
|
})}"
|
|
4782
4785
|
data-testid="poll-option-container"
|
|
@@ -4792,22 +4795,22 @@ let tt = class extends m {
|
|
|
4792
4795
|
*/
|
|
4793
4796
|
renderBarChart() {
|
|
4794
4797
|
var n, d;
|
|
4795
|
-
const e = ((n = this.dataController.stats) == null ? void 0 : n.breakdown) || {}, t = ((d = this.dataController.localStats) == null ? void 0 : d.breakdown) || {}, o = Object.values(e).reduce((p,
|
|
4796
|
-
const
|
|
4798
|
+
const e = ((n = this.dataController.stats) == null ? void 0 : n.breakdown) || {}, t = ((d = this.dataController.localStats) == null ? void 0 : d.breakdown) || {}, o = Object.values(e).reduce((p, f) => p + f, 0), r = this.options.map((p, f) => {
|
|
4799
|
+
const b = e[p.value] || 0, w = o > 0 ? Math.round(b / o * 100) : 0, E = (t[p.value] || 0) > 0;
|
|
4797
4800
|
return {
|
|
4798
4801
|
option: p,
|
|
4799
|
-
index:
|
|
4800
|
-
voteCount:
|
|
4801
|
-
percentage:
|
|
4802
|
-
isSelected:
|
|
4802
|
+
index: f,
|
|
4803
|
+
voteCount: b,
|
|
4804
|
+
percentage: w,
|
|
4805
|
+
isSelected: E
|
|
4803
4806
|
};
|
|
4804
|
-
}), s = this.multiple ?
|
|
4807
|
+
}), s = this.multiple ? N.GROUP : N.RADIOGROUP, i = this.question || this.name || "Options", a = it({
|
|
4805
4808
|
role: s,
|
|
4806
4809
|
ariaLabel: i
|
|
4807
4810
|
});
|
|
4808
4811
|
return c`
|
|
4809
4812
|
<div
|
|
4810
|
-
class="${
|
|
4813
|
+
class="${y({
|
|
4811
4814
|
"poll-container": !0
|
|
4812
4815
|
})}"
|
|
4813
4816
|
data-testid="poll-chart-container"
|
|
@@ -4815,7 +4818,7 @@ let tt = class extends m {
|
|
|
4815
4818
|
...=${a}
|
|
4816
4819
|
>
|
|
4817
4820
|
${r.map((p) => {
|
|
4818
|
-
const
|
|
4821
|
+
const f = {
|
|
4819
4822
|
"poll-option": !0,
|
|
4820
4823
|
"poll-option--compact": this.compact,
|
|
4821
4824
|
"poll-option--chart-view": !0,
|
|
@@ -4823,7 +4826,7 @@ let tt = class extends m {
|
|
|
4823
4826
|
};
|
|
4824
4827
|
return c`
|
|
4825
4828
|
<div
|
|
4826
|
-
class="${
|
|
4829
|
+
class="${y(f)}"
|
|
4827
4830
|
data-testid="poll-chart-item-${p.index}"
|
|
4828
4831
|
role="listitem"
|
|
4829
4832
|
aria-label="${p.option.label}: ${p.percentage}% (${p.voteCount} votes)"
|
|
@@ -5027,25 +5030,25 @@ let tt = class extends m {
|
|
|
5027
5030
|
* Render standard mode - original behavior
|
|
5028
5031
|
*/
|
|
5029
5032
|
renderStandardMode() {
|
|
5030
|
-
const e =
|
|
5033
|
+
const e = O(this.questionPosition, this.questionAlign), t = {
|
|
5031
5034
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
5032
5035
|
[`pc-flex-align-${e}`]: !0
|
|
5033
|
-
}, o =
|
|
5036
|
+
}, o = O(this.statsPosition, this.statsAlign), r = {
|
|
5034
5037
|
"pc-body": !0,
|
|
5035
5038
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5036
5039
|
[`pc-flex-align-${o}`]: !0
|
|
5037
|
-
}, s =
|
|
5038
|
-
role:
|
|
5040
|
+
}, s = it({
|
|
5041
|
+
role: N.REGION,
|
|
5039
5042
|
ariaLabel: this.question || this.name || "Poll"
|
|
5040
5043
|
});
|
|
5041
5044
|
return c`
|
|
5042
5045
|
<div
|
|
5043
|
-
class="pc-container ${
|
|
5046
|
+
class="pc-container ${y(t)}"
|
|
5044
5047
|
data-testid="poll-container"
|
|
5045
5048
|
...=${s}
|
|
5046
5049
|
>
|
|
5047
5050
|
${this.renderLabelAtStart()}
|
|
5048
|
-
<div class="${
|
|
5051
|
+
<div class="${y(r)}" data-testid="poll-body">
|
|
5049
5052
|
${this.renderContent()} ${this.renderFooter()}
|
|
5050
5053
|
</div>
|
|
5051
5054
|
${this.renderLabelAtEnd()}
|
|
@@ -5056,23 +5059,23 @@ let tt = class extends m {
|
|
|
5056
5059
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
5057
5060
|
}
|
|
5058
5061
|
};
|
|
5059
|
-
|
|
5062
|
+
et.styles = [...m.styles, It, ur];
|
|
5060
5063
|
wt([
|
|
5061
|
-
|
|
5062
|
-
],
|
|
5064
|
+
h({ type: Boolean })
|
|
5065
|
+
], et.prototype, "multiple", 2);
|
|
5063
5066
|
wt([
|
|
5064
|
-
|
|
5065
|
-
],
|
|
5067
|
+
h({ type: Boolean })
|
|
5068
|
+
], et.prototype, "compact", 2);
|
|
5066
5069
|
wt([
|
|
5067
|
-
|
|
5068
|
-
],
|
|
5070
|
+
C()
|
|
5071
|
+
], et.prototype, "popoverOpen", 2);
|
|
5069
5072
|
wt([
|
|
5070
5073
|
bt(".pc-inline-trigger")
|
|
5071
|
-
],
|
|
5072
|
-
|
|
5074
|
+
], et.prototype, "triggerElement", 2);
|
|
5075
|
+
et = wt([
|
|
5073
5076
|
W("pc-poll")
|
|
5074
|
-
],
|
|
5075
|
-
const gr =
|
|
5077
|
+
], et);
|
|
5078
|
+
const gr = V`
|
|
5076
5079
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
5077
5080
|
|
|
5078
5081
|
.pc-section {
|
|
@@ -5282,7 +5285,7 @@ const Ye = "important", mr = " !" + Ye, vr = He(class extends Fe {
|
|
|
5282
5285
|
r.includes("-") || i ? o.setProperty(r, i ? s.slice(0, -11) : s, i ? Ye : "") : o[r] = s;
|
|
5283
5286
|
}
|
|
5284
5287
|
}
|
|
5285
|
-
return
|
|
5288
|
+
return F;
|
|
5286
5289
|
}
|
|
5287
5290
|
});
|
|
5288
5291
|
function Ct(e, t = {}) {
|
|
@@ -5464,14 +5467,14 @@ function Pt(e) {
|
|
|
5464
5467
|
isRemoteImage: o
|
|
5465
5468
|
};
|
|
5466
5469
|
}
|
|
5467
|
-
var br = Object.defineProperty, yr = Object.getOwnPropertyDescriptor,
|
|
5470
|
+
var br = Object.defineProperty, yr = Object.getOwnPropertyDescriptor, lt = (e, t, o, r) => {
|
|
5468
5471
|
for (var s = r > 1 ? void 0 : r ? yr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
5469
5472
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
5470
5473
|
return r && s && br(t, o, s), s;
|
|
5471
5474
|
};
|
|
5472
|
-
let
|
|
5475
|
+
let Y = class extends m {
|
|
5473
5476
|
constructor() {
|
|
5474
|
-
super(), this.type =
|
|
5477
|
+
super(), this.type = x.stars, this.icon = "★", this.numStars = 5, this.hoverValue = -1, this.popoverOpen = !1, this.handleStarKeyDown = (e) => {
|
|
5475
5478
|
if (e.key === "Enter" || e.key === " ") {
|
|
5476
5479
|
e.preventDefault();
|
|
5477
5480
|
const t = e.target, o = parseInt(t.dataset.star || "0");
|
|
@@ -5510,22 +5513,22 @@ let F = class extends m {
|
|
|
5510
5513
|
renderStars(e = !1) {
|
|
5511
5514
|
var n;
|
|
5512
5515
|
const t = this.getUserVotePosition(), o = this.dataController.stats, r = (o == null ? void 0 : o.avg) ?? 0, s = ((n = this.dataController.localStats) == null ? void 0 : n.avg) ?? 0, i = this.readonly ? r : s, a = this.displayController.allowEdit(), l = Array.from({ length: this.numStars }, (d, p) => p + 1).map((d) => {
|
|
5513
|
-
const p = e ? t || 0 : Math.floor(i),
|
|
5516
|
+
const p = e ? t || 0 : Math.floor(i), f = d <= p || d <= (this.hoverValue || 0), b = !e && !f && d === Math.ceil(i) && i % 1 !== 0, w = {
|
|
5514
5517
|
star: !0,
|
|
5515
|
-
selected:
|
|
5516
|
-
partial:
|
|
5518
|
+
selected: f,
|
|
5519
|
+
partial: b,
|
|
5517
5520
|
"view-mode": !a
|
|
5518
|
-
},
|
|
5521
|
+
}, E = b ? { "--partial-fill": `${i % 1 * 100}%` } : {}, M = e ? () => this.handlePopoverStarClick(d) : () => this.handleStarClick(d);
|
|
5519
5522
|
return c`
|
|
5520
5523
|
<div class="pc-section" data-testid="pc-section">
|
|
5521
5524
|
<span
|
|
5522
5525
|
data-testid="${e ? "popover" : "stars-view"}-star-${d}"
|
|
5523
|
-
class=${w
|
|
5524
|
-
style=${vr(
|
|
5526
|
+
class=${y(w)}
|
|
5527
|
+
style=${vr(E)}
|
|
5525
5528
|
role="${a ? "button" : "presentation"}"
|
|
5526
5529
|
tabindex="${a ? "0" : ""}"
|
|
5527
5530
|
aria-label="${a ? `Rate ${d} star${d > 1 ? "s" : ""}` : ""}"
|
|
5528
|
-
@click="${
|
|
5531
|
+
@click="${M}"
|
|
5529
5532
|
@mouseenter="${() => this.handleStarHover(d)}"
|
|
5530
5533
|
@focus="${() => this.handleStarHover(d)}"
|
|
5531
5534
|
@mouseleave="${this.handleStarLeave}"
|
|
@@ -5616,7 +5619,7 @@ let F = class extends m {
|
|
|
5616
5619
|
};
|
|
5617
5620
|
return c`
|
|
5618
5621
|
<button
|
|
5619
|
-
class=${
|
|
5622
|
+
class=${y(i)}
|
|
5620
5623
|
@click=${() => {
|
|
5621
5624
|
this.popoverOpen = !0;
|
|
5622
5625
|
}}
|
|
@@ -5698,7 +5701,7 @@ let F = class extends m {
|
|
|
5698
5701
|
@keydown="${(e) => {
|
|
5699
5702
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.displayController.toggleChartVisibility());
|
|
5700
5703
|
}}"
|
|
5701
|
-
>${this.displayController.isChartVisible ? Qt :
|
|
5704
|
+
>${this.displayController.isChartVisible ? Qt : Jt}</span
|
|
5702
5705
|
>
|
|
5703
5706
|
`;
|
|
5704
5707
|
}
|
|
@@ -5756,18 +5759,18 @@ let F = class extends m {
|
|
|
5756
5759
|
* Render standard mode - original behavior
|
|
5757
5760
|
*/
|
|
5758
5761
|
renderStandardMode() {
|
|
5759
|
-
const e =
|
|
5762
|
+
const e = O(this.questionPosition, this.questionAlign), t = {
|
|
5760
5763
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
5761
5764
|
[`pc-flex-align-${e}`]: !0
|
|
5762
|
-
}, o =
|
|
5765
|
+
}, o = O(this.statsPosition, this.statsAlign), r = {
|
|
5763
5766
|
"pc-body": !0,
|
|
5764
5767
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5765
5768
|
[`pc-flex-align-${o}`]: !0
|
|
5766
5769
|
}, s = !this.displayController.shouldShowChart();
|
|
5767
5770
|
return c`
|
|
5768
|
-
<div class="pc-container ${
|
|
5771
|
+
<div class="pc-container ${y(t)}" data-testid="pc-container">
|
|
5769
5772
|
${this.renderLabelAtStart()}
|
|
5770
|
-
<div class="${
|
|
5773
|
+
<div class="${y(r)}" data-testid="stars-body">
|
|
5771
5774
|
${this.renderStatusAtStart()} ${this.renderChart()}
|
|
5772
5775
|
${s ? this.renderStars() : u} ${this.renderStatusAtEnd()}
|
|
5773
5776
|
</div>
|
|
@@ -5779,26 +5782,26 @@ let F = class extends m {
|
|
|
5779
5782
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
5780
5783
|
}
|
|
5781
5784
|
};
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
],
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
],
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
],
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
],
|
|
5795
|
-
|
|
5785
|
+
Y.styles = [...m.styles, It, gr];
|
|
5786
|
+
lt([
|
|
5787
|
+
h({ type: String })
|
|
5788
|
+
], Y.prototype, "icon", 2);
|
|
5789
|
+
lt([
|
|
5790
|
+
h({ type: Number, attribute: "num-stars" })
|
|
5791
|
+
], Y.prototype, "numStars", 2);
|
|
5792
|
+
lt([
|
|
5793
|
+
C()
|
|
5794
|
+
], Y.prototype, "hoverValue", 2);
|
|
5795
|
+
lt([
|
|
5796
|
+
C()
|
|
5797
|
+
], Y.prototype, "popoverOpen", 2);
|
|
5798
|
+
lt([
|
|
5796
5799
|
bt(".pc-inline-trigger")
|
|
5797
|
-
],
|
|
5798
|
-
|
|
5800
|
+
], Y.prototype, "triggerElement", 2);
|
|
5801
|
+
Y = lt([
|
|
5799
5802
|
W("pc-stars")
|
|
5800
|
-
],
|
|
5801
|
-
const wr =
|
|
5803
|
+
], Y);
|
|
5804
|
+
const wr = V`
|
|
5802
5805
|
/* Adjust stats text for reactions */
|
|
5803
5806
|
.pc-stats-text {
|
|
5804
5807
|
font-size: var(--pc-font-size-small, var(--default-font-size-small));
|
|
@@ -6067,9 +6070,9 @@ var $r = Object.defineProperty, Sr = Object.getOwnPropertyDescriptor, zt = (e, t
|
|
|
6067
6070
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
6068
6071
|
return r && s && $r(t, o, s), s;
|
|
6069
6072
|
};
|
|
6070
|
-
let
|
|
6073
|
+
let nt = class extends m {
|
|
6071
6074
|
constructor() {
|
|
6072
|
-
super(), this.type =
|
|
6075
|
+
super(), this.type = x.reaction, this.showCounts = !1, this.compact = !1, this.popupPosition = "auto", this.hasEditButton = !1, this.statsText = "{count} votes", this.buttonRadius = "990px", this.muteColor = "#cccccc", this.questionPosition = "top", this.statsPosition = "right", this.popupPosition = "auto";
|
|
6073
6076
|
}
|
|
6074
6077
|
/**
|
|
6075
6078
|
* Get the display count for a specific reaction including local optimistic updates
|
|
@@ -6118,7 +6121,7 @@ let at = class extends m {
|
|
|
6118
6121
|
}, l = `${e.tooltip || e.value} reaction${o ? ", selected" : ""}${t ? `, ${r} votes` : ""}`;
|
|
6119
6122
|
return c`
|
|
6120
6123
|
<button
|
|
6121
|
-
class="${
|
|
6124
|
+
class="${y(a)}"
|
|
6122
6125
|
@click="${() => this.handleReactionClick(e)}"
|
|
6123
6126
|
?disabled="${s}"
|
|
6124
6127
|
aria-pressed="${o}"
|
|
@@ -6160,7 +6163,7 @@ let at = class extends m {
|
|
|
6160
6163
|
bottom: this.popupPosition === "bottom" || this.popupPosition === "auto" && !this.shouldShowPopoverOnTop()
|
|
6161
6164
|
};
|
|
6162
6165
|
return c`
|
|
6163
|
-
<div class="${
|
|
6166
|
+
<div class="${y(e)}" role="menu">
|
|
6164
6167
|
<div class="popover-content">
|
|
6165
6168
|
${this.options.map((t) => {
|
|
6166
6169
|
const o = this.displayController.shouldDisableOption(t);
|
|
@@ -6207,7 +6210,7 @@ let at = class extends m {
|
|
|
6207
6210
|
(o) => this.dataController.isValueSelected(o.value)
|
|
6208
6211
|
);
|
|
6209
6212
|
return c`
|
|
6210
|
-
<div class="${
|
|
6213
|
+
<div class="${y(e)}">
|
|
6211
6214
|
${t.length > 0 ? c`
|
|
6212
6215
|
<div class="reaction-list">
|
|
6213
6216
|
${t.map(
|
|
@@ -6220,7 +6223,7 @@ let at = class extends m {
|
|
|
6220
6223
|
`;
|
|
6221
6224
|
} else
|
|
6222
6225
|
return c`
|
|
6223
|
-
<div class="${
|
|
6226
|
+
<div class="${y(e)}">
|
|
6224
6227
|
<div class="reaction-list">
|
|
6225
6228
|
${this.options.map((t) => this.renderReactionButton(t, this.showCounts))}
|
|
6226
6229
|
</div>
|
|
@@ -6235,7 +6238,7 @@ let at = class extends m {
|
|
|
6235
6238
|
const e = this.dataController.getBreakdownInfo(), o = Object.entries(e.breakdownCount).filter(
|
|
6236
6239
|
([n, d]) => this.options.some((p) => p.value === n)
|
|
6237
6240
|
).map(([n, d]) => {
|
|
6238
|
-
const p = this.options.find((
|
|
6241
|
+
const p = this.options.find((f) => f.value === n);
|
|
6239
6242
|
return {
|
|
6240
6243
|
label: n,
|
|
6241
6244
|
// Use the reaction value as label
|
|
@@ -6284,18 +6287,18 @@ let at = class extends m {
|
|
|
6284
6287
|
* (Reactions are inherently inline, so inline mode = standard mode)
|
|
6285
6288
|
*/
|
|
6286
6289
|
renderStandardMode() {
|
|
6287
|
-
const e =
|
|
6290
|
+
const e = O(this.questionPosition, this.questionAlign), t = {
|
|
6288
6291
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
6289
6292
|
[`pc-flex-align-${e}`]: !0
|
|
6290
|
-
}, o =
|
|
6293
|
+
}, o = O(this.statsPosition, this.statsAlign), r = {
|
|
6291
6294
|
"pc-body": !0,
|
|
6292
6295
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
6293
6296
|
[`pc-flex-align-${o}`]: !0
|
|
6294
6297
|
};
|
|
6295
6298
|
return c`
|
|
6296
|
-
<div class="${
|
|
6299
|
+
<div class="${y(t)}" data-testid="reaction-container">
|
|
6297
6300
|
${this.renderLabelAtStart()}
|
|
6298
|
-
<div class="${
|
|
6301
|
+
<div class="${y(r)}" data-testid="reaction-body">
|
|
6299
6302
|
${this.renderStatusAtStart()} ${this.renderChart()} ${this.renderReactions()}
|
|
6300
6303
|
${this.renderStatusAtEnd()}
|
|
6301
6304
|
</div>
|
|
@@ -6307,19 +6310,19 @@ let at = class extends m {
|
|
|
6307
6310
|
return this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
6308
6311
|
}
|
|
6309
6312
|
};
|
|
6310
|
-
|
|
6313
|
+
nt.styles = [...m.styles, It, wr];
|
|
6311
6314
|
zt([
|
|
6312
|
-
|
|
6313
|
-
],
|
|
6315
|
+
h({ type: Boolean, attribute: "show-counts" })
|
|
6316
|
+
], nt.prototype, "showCounts", 2);
|
|
6314
6317
|
zt([
|
|
6315
|
-
|
|
6316
|
-
],
|
|
6318
|
+
h({ type: Boolean, reflect: !0 })
|
|
6319
|
+
], nt.prototype, "compact", 2);
|
|
6317
6320
|
zt([
|
|
6318
|
-
|
|
6319
|
-
],
|
|
6320
|
-
|
|
6321
|
+
h({ type: String, attribute: "popup-position" })
|
|
6322
|
+
], nt.prototype, "popupPosition", 2);
|
|
6323
|
+
nt = zt([
|
|
6321
6324
|
W("pc-reaction")
|
|
6322
|
-
],
|
|
6325
|
+
], nt);
|
|
6323
6326
|
function dt(e, t, o = void 0) {
|
|
6324
6327
|
const r = e.getAttribute(t);
|
|
6325
6328
|
return r === null ? o : r == null ? void 0 : r.trim();
|
|
@@ -6328,14 +6331,15 @@ function Cr(e, t = void 0) {
|
|
|
6328
6331
|
const o = e.textContent;
|
|
6329
6332
|
return o === "" || o === null ? t : o == null ? void 0 : o.trim();
|
|
6330
6333
|
}
|
|
6331
|
-
var kr = Object.defineProperty, Er = Object.getOwnPropertyDescriptor,
|
|
6334
|
+
var kr = Object.defineProperty, Er = Object.getOwnPropertyDescriptor, G = (e, t, o, r) => {
|
|
6332
6335
|
for (var s = r > 1 ? void 0 : r ? Er(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
6333
6336
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
6334
6337
|
return r && s && kr(t, o, s), s;
|
|
6335
6338
|
};
|
|
6336
|
-
|
|
6339
|
+
const Ar = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
6340
|
+
let z = class extends B {
|
|
6337
6341
|
constructor() {
|
|
6338
|
-
super(), this.options = "", this.parsedOptions = [], this.
|
|
6342
|
+
super(), this.options = "", this.parsedOptions = [], this.isPrefetching = !1, z.injectGlobalStyle();
|
|
6339
6343
|
}
|
|
6340
6344
|
/**
|
|
6341
6345
|
* Inject global style to hide poll-catch-option elements
|
|
@@ -6360,41 +6364,7 @@ let Y = class extends R {
|
|
|
6360
6364
|
return this;
|
|
6361
6365
|
}
|
|
6362
6366
|
connectedCallback() {
|
|
6363
|
-
super.connectedCallback(), this.
|
|
6364
|
-
}
|
|
6365
|
-
async maybeFetchType() {
|
|
6366
|
-
var t, o, r, s, i, a, l, n, d, p, h, v, x, k;
|
|
6367
|
-
if (this.type || !this.widgetId) return;
|
|
6368
|
-
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(this.widgetId)) {
|
|
6369
|
-
g.error(`poll-catch: Invalid widget-id format: ${this.widgetId}`);
|
|
6370
|
-
return;
|
|
6371
|
-
}
|
|
6372
|
-
this.isLoadingType = !0;
|
|
6373
|
-
try {
|
|
6374
|
-
const _ = `${this.getAttribute("data-endpoint") || Yt}/widgets/${encodeURIComponent(this.widgetId)}`, $ = await fetch(_);
|
|
6375
|
-
if (!$.ok)
|
|
6376
|
-
throw new Error(`API request failed with status: ${$.status}`);
|
|
6377
|
-
const y = await $.json();
|
|
6378
|
-
if (!y.success)
|
|
6379
|
-
throw new Error("Backend returned unsuccessful response");
|
|
6380
|
-
const E = (o = (t = y.data) == null ? void 0 : t.config) == null ? void 0 : o.type;
|
|
6381
|
-
if (!E)
|
|
6382
|
-
throw new Error("Backend response missing widget type");
|
|
6383
|
-
Wo(this.widgetId, {
|
|
6384
|
-
type: E,
|
|
6385
|
-
attributes: ((s = (r = y.data) == null ? void 0 : r.config) == null ? void 0 : s.attributes) || null,
|
|
6386
|
-
stats: {
|
|
6387
|
-
count: ((a = (i = y.data) == null ? void 0 : i.stats) == null ? void 0 : a.count) ?? 0,
|
|
6388
|
-
sum: ((n = (l = y.data) == null ? void 0 : l.stats) == null ? void 0 : n.sum) ?? 0,
|
|
6389
|
-
breakdown: ((p = (d = y.data) == null ? void 0 : d.stats) == null ? void 0 : p.breakdown) ?? {},
|
|
6390
|
-
updatedAt: ((v = (h = y.data) == null ? void 0 : h.stats) == null ? void 0 : v.updatedAt) || ((k = (x = y.data) == null ? void 0 : x.stats) == null ? void 0 : k.updated_at)
|
|
6391
|
-
}
|
|
6392
|
-
}), this.type = E, this.isLoadingType = !1, await this.updateComplete, this.forceUpdate();
|
|
6393
|
-
} catch (P) {
|
|
6394
|
-
g.error("poll-catch: Failed to fetch widget config", P);
|
|
6395
|
-
} finally {
|
|
6396
|
-
this.isLoadingType = !1;
|
|
6397
|
-
}
|
|
6367
|
+
super.connectedCallback(), this.widgetId && !this.type && !this.dataFunc && this.prefetchWidgetConfig();
|
|
6398
6368
|
}
|
|
6399
6369
|
forceUpdate() {
|
|
6400
6370
|
this.forwardAttributesToWidget(), this.forwardOptionsToWidget();
|
|
@@ -6414,6 +6384,44 @@ let Y = class extends R {
|
|
|
6414
6384
|
this.forwardAttributesToWidget();
|
|
6415
6385
|
});
|
|
6416
6386
|
}
|
|
6387
|
+
/**
|
|
6388
|
+
* Prefetch widget config from the API to determine widget type
|
|
6389
|
+
*/
|
|
6390
|
+
async prefetchWidgetConfig() {
|
|
6391
|
+
var e, t;
|
|
6392
|
+
if (!this.widgetId || !Ar.test(this.widgetId)) {
|
|
6393
|
+
g.warn(`poll-catch: Invalid widget-id format for prefetch: ${this.widgetId}`);
|
|
6394
|
+
return;
|
|
6395
|
+
}
|
|
6396
|
+
this.isPrefetching = !0;
|
|
6397
|
+
try {
|
|
6398
|
+
const r = `${this.dataEndpoint || Yt}/widgets/${encodeURIComponent(this.widgetId)}`;
|
|
6399
|
+
g.debug("poll-catch: Prefetching widget config", { url: r });
|
|
6400
|
+
const s = await fetch(r);
|
|
6401
|
+
if (!s.ok)
|
|
6402
|
+
throw new Error(`API request failed with status: ${s.status}`);
|
|
6403
|
+
const i = await s.json();
|
|
6404
|
+
if (!i.success)
|
|
6405
|
+
throw new Error("Backend returned unsuccessful response");
|
|
6406
|
+
const a = (e = i.data) == null ? void 0 : e.config, l = (t = i.data) == null ? void 0 : t.stats;
|
|
6407
|
+
if (!(a != null && a.type) || !Object.values(x).includes(a.type))
|
|
6408
|
+
throw new Error(`Invalid widget type from server: ${a == null ? void 0 : a.type}`);
|
|
6409
|
+
Wo(this.widgetId, {
|
|
6410
|
+
config: { type: a.type, attributes: a.attributes || null },
|
|
6411
|
+
stats: {
|
|
6412
|
+
count: (l == null ? void 0 : l.count) ?? 0,
|
|
6413
|
+
sum: (l == null ? void 0 : l.sum) ?? 0,
|
|
6414
|
+
breakdown: (l == null ? void 0 : l.breakdown) ?? {},
|
|
6415
|
+
updatedAt: (l == null ? void 0 : l.updatedAt) || (l == null ? void 0 : l.updated_at)
|
|
6416
|
+
}
|
|
6417
|
+
}), this.type = a.type;
|
|
6418
|
+
} catch (o) {
|
|
6419
|
+
g.warn("poll-catch: Failed to prefetch widget config", o);
|
|
6420
|
+
} finally {
|
|
6421
|
+
this.isPrefetching = !1;
|
|
6422
|
+
}
|
|
6423
|
+
this.requestUpdate(), await this.updateComplete, this.forwardAttributesToWidget(), this.forwardOptionsToWidget();
|
|
6424
|
+
}
|
|
6417
6425
|
/**
|
|
6418
6426
|
* Forward all attributes except 'type' to the child widget
|
|
6419
6427
|
*/
|
|
@@ -6440,8 +6448,8 @@ let Y = class extends R {
|
|
|
6440
6448
|
t && t.length > 0 && (r = Array.from(t).map((s) => {
|
|
6441
6449
|
const i = dt(s, "value", "") || "", a = dt(s, "label", Cr(s, i)) || "", l = dt(s, "icon", void 0), n = dt(s, "tooltip", void 0), d = dt(s, "disabled", void 0), p = { value: i, label: a };
|
|
6442
6450
|
if (l !== void 0) {
|
|
6443
|
-
const
|
|
6444
|
-
p.icon =
|
|
6451
|
+
const f = Pt(l);
|
|
6452
|
+
p.icon = f.icon;
|
|
6445
6453
|
}
|
|
6446
6454
|
return n !== void 0 && (p.tooltip = n), d !== void 0 && (p.disabled = !0), p;
|
|
6447
6455
|
})), this.parsedOptions = r;
|
|
@@ -6450,16 +6458,16 @@ let Y = class extends R {
|
|
|
6450
6458
|
* Render the appropriate widget based on the type
|
|
6451
6459
|
*/
|
|
6452
6460
|
render() {
|
|
6453
|
-
if (this.
|
|
6461
|
+
if (this.isPrefetching)
|
|
6454
6462
|
return u;
|
|
6455
6463
|
switch (this.type) {
|
|
6456
|
-
case
|
|
6464
|
+
case x.nps:
|
|
6457
6465
|
return c`<pc-nps></pc-nps>`;
|
|
6458
|
-
case
|
|
6466
|
+
case x.poll:
|
|
6459
6467
|
return c`<pc-poll .options=${this.parsedOptions}></pc-poll>`;
|
|
6460
|
-
case
|
|
6468
|
+
case x.stars:
|
|
6461
6469
|
return c`<pc-stars></pc-stars>`;
|
|
6462
|
-
case
|
|
6470
|
+
case x.reaction:
|
|
6463
6471
|
return c`<pc-reaction .options=${this.parsedOptions}></pc-reaction>`;
|
|
6464
6472
|
default:
|
|
6465
6473
|
return this.widgetId || console.warn(
|
|
@@ -6468,24 +6476,30 @@ let Y = class extends R {
|
|
|
6468
6476
|
}
|
|
6469
6477
|
}
|
|
6470
6478
|
};
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
],
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
],
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
],
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
],
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
],
|
|
6486
|
-
|
|
6479
|
+
G([
|
|
6480
|
+
h({ type: String })
|
|
6481
|
+
], z.prototype, "type", 2);
|
|
6482
|
+
G([
|
|
6483
|
+
h({ type: String })
|
|
6484
|
+
], z.prototype, "options", 2);
|
|
6485
|
+
G([
|
|
6486
|
+
h({ type: String, attribute: "widget-id" })
|
|
6487
|
+
], z.prototype, "widgetId", 2);
|
|
6488
|
+
G([
|
|
6489
|
+
h({ type: String, attribute: "data-endpoint" })
|
|
6490
|
+
], z.prototype, "dataEndpoint", 2);
|
|
6491
|
+
G([
|
|
6492
|
+
h({ type: String, attribute: "data-func" })
|
|
6493
|
+
], z.prototype, "dataFunc", 2);
|
|
6494
|
+
G([
|
|
6495
|
+
C()
|
|
6496
|
+
], z.prototype, "parsedOptions", 2);
|
|
6497
|
+
G([
|
|
6498
|
+
C()
|
|
6499
|
+
], z.prototype, "isPrefetching", 2);
|
|
6500
|
+
z = G([
|
|
6487
6501
|
W("poll-catch")
|
|
6488
|
-
],
|
|
6502
|
+
], z);
|
|
6489
6503
|
export {
|
|
6490
|
-
|
|
6504
|
+
z as PollCatch
|
|
6491
6505
|
};
|