pollcatch 2.5.3 → 2.5.4
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 +2 -2
- package/pc.js +730 -741
package/pc.js
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const
|
|
7
|
-
let
|
|
6
|
+
const yt = globalThis, Ht = yt.ShadowRoot && (yt.ShadyCSS === void 0 || yt.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ft = Symbol(), te = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
let Ce = class {
|
|
8
8
|
constructor(t, o, r) {
|
|
9
|
-
if (this._$cssResult$ = !0, r !==
|
|
9
|
+
if (this._$cssResult$ = !0, r !== Ft) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
10
|
this.cssText = t, this.t = o;
|
|
11
11
|
}
|
|
12
12
|
get styleSheet() {
|
|
13
13
|
let t = this.o;
|
|
14
14
|
const o = this.t;
|
|
15
|
-
if (
|
|
15
|
+
if (Ht && t === void 0) {
|
|
16
16
|
const r = o !== void 0 && o.length === 1;
|
|
17
|
-
r && (t =
|
|
17
|
+
r && (t = te.get(o)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), r && te.set(o, t));
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
}
|
|
@@ -22,33 +22,33 @@ let Pe = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const Ge = (e) => new Ce(typeof e == "string" ? e : e + "", void 0, Ft), R = (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;
|
|
29
29
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
30
|
})(s) + e[i + 1], e[0]);
|
|
31
|
-
return new
|
|
32
|
-
},
|
|
33
|
-
if (
|
|
31
|
+
return new Ce(o, e, Ft);
|
|
32
|
+
}, Ze = (e, t) => {
|
|
33
|
+
if (Ht) e.adoptedStyleSheets = t.map((o) => o instanceof CSSStyleSheet ? o : o.styleSheet);
|
|
34
34
|
else for (const o of t) {
|
|
35
|
-
const r = document.createElement("style"), s =
|
|
35
|
+
const r = document.createElement("style"), s = yt.litNonce;
|
|
36
36
|
s !== void 0 && r.setAttribute("nonce", s), r.textContent = o.cssText, e.appendChild(r);
|
|
37
37
|
}
|
|
38
|
-
},
|
|
38
|
+
}, ee = Ht ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
|
|
39
39
|
let o = "";
|
|
40
40
|
for (const r of t.cssRules) o += r.cssText;
|
|
41
|
-
return
|
|
41
|
+
return Ge(o);
|
|
42
42
|
})(e) : e;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is:
|
|
48
|
+
const { is: Xe, defineProperty: Je, getOwnPropertyDescriptor: Qe, getOwnPropertyNames: to, getOwnPropertySymbols: eo, getPrototypeOf: oo } = Object, U = globalThis, oe = U.trustedTypes, ro = oe ? oe.emptyScript : "", Ot = U.reactiveElementPolyfillSupport, lt = (e, t) => e, xt = { toAttribute(e, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
e = e ?
|
|
51
|
+
e = e ? ro : null;
|
|
52
52
|
break;
|
|
53
53
|
case Object:
|
|
54
54
|
case Array:
|
|
@@ -73,23 +73,23 @@ const { is: Ge, defineProperty: Ze, getOwnPropertyDescriptor: Xe, getOwnProperty
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return o;
|
|
76
|
-
} },
|
|
77
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
78
|
-
let
|
|
76
|
+
} }, Yt = (e, t) => !Xe(e, t), re = { attribute: !0, type: String, converter: xt, reflect: !1, hasChanged: Yt };
|
|
77
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), U.litPropertyMetadata ?? (U.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
|
+
let tt = class extends HTMLElement {
|
|
79
79
|
static addInitializer(t) {
|
|
80
80
|
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
81
81
|
}
|
|
82
82
|
static get observedAttributes() {
|
|
83
83
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
84
84
|
}
|
|
85
|
-
static createProperty(t, o =
|
|
85
|
+
static createProperty(t, o = re) {
|
|
86
86
|
if (o.state && (o.attribute = !1), this._$Ei(), this.elementProperties.set(t, o), !o.noAccessor) {
|
|
87
87
|
const r = Symbol(), s = this.getPropertyDescriptor(t, r, o);
|
|
88
|
-
s !== void 0 &&
|
|
88
|
+
s !== void 0 && Je(this.prototype, t, s);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
static getPropertyDescriptor(t, o, r) {
|
|
92
|
-
const { get: s, set: i } =
|
|
92
|
+
const { get: s, set: i } = Qe(this.prototype, t) ?? { get() {
|
|
93
93
|
return this[o];
|
|
94
94
|
}, set(a) {
|
|
95
95
|
this[o] = a;
|
|
@@ -102,17 +102,17 @@ let st = class extends HTMLElement {
|
|
|
102
102
|
}, configurable: !0, enumerable: !0 };
|
|
103
103
|
}
|
|
104
104
|
static getPropertyOptions(t) {
|
|
105
|
-
return this.elementProperties.get(t) ??
|
|
105
|
+
return this.elementProperties.get(t) ?? re;
|
|
106
106
|
}
|
|
107
107
|
static _$Ei() {
|
|
108
|
-
if (this.hasOwnProperty(
|
|
109
|
-
const t =
|
|
108
|
+
if (this.hasOwnProperty(lt("elementProperties"))) return;
|
|
109
|
+
const t = oo(this);
|
|
110
110
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
111
111
|
}
|
|
112
112
|
static finalize() {
|
|
113
|
-
if (this.hasOwnProperty(
|
|
114
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
115
|
-
const o = this.properties, r = [...
|
|
113
|
+
if (this.hasOwnProperty(lt("finalized"))) return;
|
|
114
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(lt("properties"))) {
|
|
115
|
+
const o = this.properties, r = [...to(o), ...eo(o)];
|
|
116
116
|
for (const s of r) this.createProperty(s, o[s]);
|
|
117
117
|
}
|
|
118
118
|
const t = this[Symbol.metadata];
|
|
@@ -131,8 +131,8 @@ let st = class extends HTMLElement {
|
|
|
131
131
|
const o = [];
|
|
132
132
|
if (Array.isArray(t)) {
|
|
133
133
|
const r = new Set(t.flat(1 / 0).reverse());
|
|
134
|
-
for (const s of r) o.unshift(
|
|
135
|
-
} else t !== void 0 && o.push(
|
|
134
|
+
for (const s of r) o.unshift(ee(s));
|
|
135
|
+
} else t !== void 0 && o.push(ee(t));
|
|
136
136
|
return o;
|
|
137
137
|
}
|
|
138
138
|
static _$Eu(t, o) {
|
|
@@ -161,7 +161,7 @@ let st = class extends HTMLElement {
|
|
|
161
161
|
}
|
|
162
162
|
createRenderRoot() {
|
|
163
163
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
164
|
-
return
|
|
164
|
+
return Ze(t, this.constructor.elementStyles), t;
|
|
165
165
|
}
|
|
166
166
|
connectedCallback() {
|
|
167
167
|
var t;
|
|
@@ -186,7 +186,7 @@ let st = class extends HTMLElement {
|
|
|
186
186
|
var i;
|
|
187
187
|
const r = this.constructor.elementProperties.get(t), s = this.constructor._$Eu(t, r);
|
|
188
188
|
if (s !== void 0 && r.reflect === !0) {
|
|
189
|
-
const a = (((i = r.converter) == null ? void 0 : i.toAttribute) !== void 0 ? r.converter :
|
|
189
|
+
const a = (((i = r.converter) == null ? void 0 : i.toAttribute) !== void 0 ? r.converter : xt).toAttribute(o, r.type);
|
|
190
190
|
this._$Em = t, a == null ? this.removeAttribute(s) : this.setAttribute(s, a), this._$Em = null;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
@@ -194,13 +194,13 @@ let st = class extends HTMLElement {
|
|
|
194
194
|
var i;
|
|
195
195
|
const r = this.constructor, s = r._$Eh.get(t);
|
|
196
196
|
if (s !== void 0 && this._$Em !== s) {
|
|
197
|
-
const a = r.getPropertyOptions(s), l = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((i = a.converter) == null ? void 0 : i.fromAttribute) !== void 0 ? a.converter :
|
|
197
|
+
const a = r.getPropertyOptions(s), l = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((i = a.converter) == null ? void 0 : i.fromAttribute) !== void 0 ? a.converter : xt;
|
|
198
198
|
this._$Em = s, this[s] = l.fromAttribute(o, a.type), this._$Em = null;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
requestUpdate(t, o, r) {
|
|
202
202
|
if (t !== void 0) {
|
|
203
|
-
if (r ?? (r = this.constructor.getPropertyOptions(t)), !(r.hasChanged ??
|
|
203
|
+
if (r ?? (r = this.constructor.getPropertyOptions(t)), !(r.hasChanged ?? Yt)(this[t], o)) return;
|
|
204
204
|
this.P(t, o, r);
|
|
205
205
|
}
|
|
206
206
|
this.isUpdatePending === !1 && (this._$ES = this._$ET());
|
|
@@ -273,76 +273,76 @@ let st = class extends HTMLElement {
|
|
|
273
273
|
firstUpdated(t) {
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
-
|
|
276
|
+
tt.elementStyles = [], tt.shadowRootOptions = { mode: "open" }, tt[lt("elementProperties")] = /* @__PURE__ */ new Map(), tt[lt("finalized")] = /* @__PURE__ */ new Map(), Ot == null || Ot({ ReactiveElement: tt }), (U.reactiveElementVersions ?? (U.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
|
|
283
|
-
\f\r]`,
|
|
284
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
285
|
-
function
|
|
286
|
-
if (!
|
|
287
|
-
return
|
|
282
|
+
const ct = globalThis, $t = ct.trustedTypes, se = $t ? $t.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, ke = "$lit$", V = `lit$${Math.random().toFixed(9).slice(2)}$`, Ee = "?" + V, so = `<${Ee}>`, G = document, pt = () => G.createComment(""), ut = (e) => e === null || typeof e != "object" && typeof e != "function", Wt = Array.isArray, io = (e) => Wt(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", It = `[
|
|
283
|
+
\f\r]`, at = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ie = /-->/g, ae = />/g, W = RegExp(`>|${It}(?:([^\\s"'>=/]+)(${It}*=${It}*(?:[^
|
|
284
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ne = /'/g, le = /"/g, Ae = /^(?:script|style|textarea|title)$/i, ao = (e) => (t, ...o) => ({ _$litType$: e, strings: t, values: o }), c = ao(1), j = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), ce = /* @__PURE__ */ new WeakMap(), K = G.createTreeWalker(G, 129);
|
|
285
|
+
function Pe(e, t) {
|
|
286
|
+
if (!Wt(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
287
|
+
return se !== void 0 ? se.createHTML(t) : t;
|
|
288
288
|
}
|
|
289
|
-
const
|
|
289
|
+
const no = (e, t) => {
|
|
290
290
|
const o = e.length - 1, r = [];
|
|
291
|
-
let s, i = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a =
|
|
291
|
+
let s, i = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = at;
|
|
292
292
|
for (let l = 0; l < o; l++) {
|
|
293
293
|
const n = e[l];
|
|
294
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 ===
|
|
296
|
-
const
|
|
297
|
-
i += a ===
|
|
295
|
+
for (; b < n.length && (a.lastIndex = b, p = a.exec(n), p !== null); ) b = a.lastIndex, a === at ? p[1] === "!--" ? a = ie : p[1] !== void 0 ? a = ae : p[2] !== void 0 ? (Ae.test(p[2]) && (s = RegExp("</" + p[2], "g")), a = W) : p[3] !== void 0 && (a = W) : a === W ? p[0] === ">" ? (a = s ?? at, f = -1) : p[1] === void 0 ? f = -2 : (f = a.lastIndex - p[2].length, d = p[1], a = p[3] === void 0 ? W : p[3] === '"' ? le : ne) : a === le || a === ne ? a = W : a === ie || a === ae ? a = at : (a = W, s = void 0);
|
|
296
|
+
const y = a === W && e[l + 1].startsWith("/>") ? " " : "";
|
|
297
|
+
i += a === at ? n + so : f >= 0 ? (r.push(d), n.slice(0, f) + ke + n.slice(f) + V + y) : n + V + (f === -2 ? l : y);
|
|
298
298
|
}
|
|
299
|
-
return [
|
|
299
|
+
return [Pe(e, i + (e[o] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
300
300
|
};
|
|
301
|
-
let
|
|
301
|
+
let jt = class Te {
|
|
302
302
|
constructor({ strings: t, _$litType$: o }, r) {
|
|
303
303
|
let s;
|
|
304
304
|
this.parts = [];
|
|
305
305
|
let i = 0, a = 0;
|
|
306
|
-
const l = t.length - 1, n = this.parts, [d, p] =
|
|
307
|
-
if (this.el =
|
|
306
|
+
const l = t.length - 1, n = this.parts, [d, p] = no(t, o);
|
|
307
|
+
if (this.el = Te.createElement(d, r), K.currentNode = this.el.content, o === 2 || o === 3) {
|
|
308
308
|
const f = this.el.content.firstChild;
|
|
309
309
|
f.replaceWith(...f.childNodes);
|
|
310
310
|
}
|
|
311
|
-
for (; (s =
|
|
311
|
+
for (; (s = K.nextNode()) !== null && n.length < l; ) {
|
|
312
312
|
if (s.nodeType === 1) {
|
|
313
|
-
if (s.hasAttributes()) for (const f of s.getAttributeNames()) if (f.endsWith(
|
|
314
|
-
const b = p[a++],
|
|
315
|
-
n.push({ type: 1, index: i, name:
|
|
316
|
-
} else f.startsWith(
|
|
317
|
-
if (
|
|
318
|
-
const f = s.textContent.split(
|
|
313
|
+
if (s.hasAttributes()) for (const f of s.getAttributeNames()) if (f.endsWith(ke)) {
|
|
314
|
+
const b = p[a++], y = s.getAttribute(f).split(V), x = /([.?@])?(.*)/.exec(b);
|
|
315
|
+
n.push({ type: 1, index: i, name: x[2], strings: y, ctor: x[1] === "." ? co : x[1] === "?" ? po : x[1] === "@" ? uo : Et }), s.removeAttribute(f);
|
|
316
|
+
} else f.startsWith(V) && (n.push({ type: 6, index: i }), s.removeAttribute(f));
|
|
317
|
+
if (Ae.test(s.tagName)) {
|
|
318
|
+
const f = s.textContent.split(V), b = f.length - 1;
|
|
319
319
|
if (b > 0) {
|
|
320
|
-
s.textContent =
|
|
321
|
-
for (let
|
|
322
|
-
s.append(f[b],
|
|
320
|
+
s.textContent = $t ? $t.emptyScript : "";
|
|
321
|
+
for (let y = 0; y < b; y++) s.append(f[y], pt()), K.nextNode(), n.push({ type: 2, index: ++i });
|
|
322
|
+
s.append(f[b], pt());
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
} else if (s.nodeType === 8) if (s.data ===
|
|
325
|
+
} else if (s.nodeType === 8) if (s.data === Ee) n.push({ type: 2, index: i });
|
|
326
326
|
else {
|
|
327
327
|
let f = -1;
|
|
328
|
-
for (; (f = s.data.indexOf(
|
|
328
|
+
for (; (f = s.data.indexOf(V, f + 1)) !== -1; ) n.push({ type: 7, index: i }), f += V.length - 1;
|
|
329
329
|
}
|
|
330
330
|
i++;
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
static createElement(t, o) {
|
|
334
|
-
const r =
|
|
334
|
+
const r = G.createElement("template");
|
|
335
335
|
return r.innerHTML = t, r;
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
|
-
function
|
|
338
|
+
function ot(e, t, o = e, r) {
|
|
339
339
|
var a, l;
|
|
340
|
-
if (t ===
|
|
340
|
+
if (t === j) return t;
|
|
341
341
|
let s = r !== void 0 ? (a = o._$Co) == null ? void 0 : a[r] : o._$Cl;
|
|
342
|
-
const i =
|
|
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 =
|
|
342
|
+
const i = ut(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 = ot(e, s._$AS(e, t.values), s, r)), t;
|
|
344
344
|
}
|
|
345
|
-
let
|
|
345
|
+
let lo = class {
|
|
346
346
|
constructor(t, o) {
|
|
347
347
|
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = o;
|
|
348
348
|
}
|
|
@@ -353,24 +353,24 @@ 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) ??
|
|
357
|
-
|
|
358
|
-
let i =
|
|
356
|
+
const { el: { content: o }, parts: r } = this._$AD, s = ((t == null ? void 0 : t.creationScope) ?? G).importNode(o, !0);
|
|
357
|
+
K.currentNode = s;
|
|
358
|
+
let i = K.nextNode(), a = 0, l = 0, n = r[0];
|
|
359
359
|
for (; n !== void 0; ) {
|
|
360
360
|
if (a === n.index) {
|
|
361
361
|
let d;
|
|
362
|
-
n.type === 2 ? d = new
|
|
362
|
+
n.type === 2 ? d = new ht(i, i.nextSibling, this, t) : n.type === 1 ? d = new n.ctor(i, n.name, n.strings, this, t) : n.type === 6 && (d = new ho(i, this, t)), this._$AV.push(d), n = r[++l];
|
|
363
363
|
}
|
|
364
|
-
a !== (n == null ? void 0 : n.index) && (i =
|
|
364
|
+
a !== (n == null ? void 0 : n.index) && (i = K.nextNode(), a++);
|
|
365
365
|
}
|
|
366
|
-
return
|
|
366
|
+
return K.currentNode = G, s;
|
|
367
367
|
}
|
|
368
368
|
p(t) {
|
|
369
369
|
let o = 0;
|
|
370
370
|
for (const r of this._$AV) r !== void 0 && (r.strings !== void 0 ? (r._$AI(t, r, o), o += r.strings.length - 2) : r._$AI(t[o])), o++;
|
|
371
371
|
}
|
|
372
372
|
};
|
|
373
|
-
class
|
|
373
|
+
class ht {
|
|
374
374
|
get _$AU() {
|
|
375
375
|
var t;
|
|
376
376
|
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
|
@@ -390,7 +390,7 @@ class vt {
|
|
|
390
390
|
return this._$AB;
|
|
391
391
|
}
|
|
392
392
|
_$AI(t, o = this) {
|
|
393
|
-
t =
|
|
393
|
+
t = ot(this, t, o), ut(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== j && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : io(t) ? this.k(t) : this._(t);
|
|
394
394
|
}
|
|
395
395
|
O(t) {
|
|
396
396
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -399,26 +399,26 @@ class vt {
|
|
|
399
399
|
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
400
400
|
}
|
|
401
401
|
_(t) {
|
|
402
|
-
this._$AH !== u &&
|
|
402
|
+
this._$AH !== u && ut(this._$AH) ? this._$AA.nextSibling.data = t : this.T(G.createTextNode(t)), this._$AH = t;
|
|
403
403
|
}
|
|
404
404
|
$(t) {
|
|
405
405
|
var i;
|
|
406
|
-
const { values: o, _$litType$: r } = t, s = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el =
|
|
406
|
+
const { values: o, _$litType$: r } = t, s = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el = jt.createElement(Pe(r.h, r.h[0]), this.options)), r);
|
|
407
407
|
if (((i = this._$AH) == null ? void 0 : i._$AD) === s) this._$AH.p(o);
|
|
408
408
|
else {
|
|
409
|
-
const a = new
|
|
409
|
+
const a = new lo(s, this), l = a.u(this.options);
|
|
410
410
|
a.p(o), this.T(l), this._$AH = a;
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
_$AC(t) {
|
|
414
|
-
let o =
|
|
415
|
-
return o === void 0 &&
|
|
414
|
+
let o = ce.get(t.strings);
|
|
415
|
+
return o === void 0 && ce.set(t.strings, o = new jt(t)), o;
|
|
416
416
|
}
|
|
417
417
|
k(t) {
|
|
418
|
-
|
|
418
|
+
Wt(this._$AH) || (this._$AH = [], this._$AR());
|
|
419
419
|
const o = this._$AH;
|
|
420
420
|
let r, s = 0;
|
|
421
|
-
for (const i of t) s === o.length ? o.push(r = new
|
|
421
|
+
for (const i of t) s === o.length ? o.push(r = new ht(this.O(pt()), this.O(pt()), this, this.options)) : r = o[s], r._$AI(i), s++;
|
|
422
422
|
s < o.length && (this._$AR(r && r._$AB.nextSibling, s), o.length = s);
|
|
423
423
|
}
|
|
424
424
|
_$AR(t = this._$AA.nextSibling, o) {
|
|
@@ -433,7 +433,7 @@ class vt {
|
|
|
433
433
|
this._$AM === void 0 && (this._$Cv = t, (o = this._$AP) == null || o.call(this, t));
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
-
class
|
|
436
|
+
class Et {
|
|
437
437
|
get tagName() {
|
|
438
438
|
return this.element.tagName;
|
|
439
439
|
}
|
|
@@ -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 = ot(this, t, o, 0), a = !ut(t) || t !== this._$AH && t !== j, 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 = ot(this, l[r + n], o, n), d === j && (d = this._$AH[n]), a || (a = !ut(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
|
}
|
|
@@ -458,7 +458,7 @@ class Tt {
|
|
|
458
458
|
t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
let
|
|
461
|
+
let co = class extends Et {
|
|
462
462
|
constructor() {
|
|
463
463
|
super(...arguments), this.type = 3;
|
|
464
464
|
}
|
|
@@ -466,7 +466,7 @@ let no = class extends Tt {
|
|
|
466
466
|
this.element[this.name] = t === u ? void 0 : t;
|
|
467
467
|
}
|
|
468
468
|
};
|
|
469
|
-
class
|
|
469
|
+
class po extends Et {
|
|
470
470
|
constructor() {
|
|
471
471
|
super(...arguments), this.type = 4;
|
|
472
472
|
}
|
|
@@ -474,12 +474,12 @@ class lo extends Tt {
|
|
|
474
474
|
this.element.toggleAttribute(this.name, !!t && t !== u);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
class
|
|
477
|
+
class uo extends Et {
|
|
478
478
|
constructor(t, o, r, s, i) {
|
|
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 = ot(this, t, o, 0) ?? u) === j) 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
|
}
|
|
@@ -488,7 +488,7 @@ class co extends Tt {
|
|
|
488
488
|
typeof this._$AH == "function" ? this._$AH.call(((o = this.options) == null ? void 0 : o.host) ?? this.element, t) : this._$AH.handleEvent(t);
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
class
|
|
491
|
+
class ho {
|
|
492
492
|
constructor(t, o, r) {
|
|
493
493
|
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = o, this.options = r;
|
|
494
494
|
}
|
|
@@ -496,17 +496,17 @@ class po {
|
|
|
496
496
|
return this._$AM._$AU;
|
|
497
497
|
}
|
|
498
498
|
_$AI(t) {
|
|
499
|
-
|
|
499
|
+
ot(this, t);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
const
|
|
502
|
+
const zt = ct.litHtmlPolyfillSupport;
|
|
503
|
+
zt == null || zt(jt, ht), (ct.litHtmlVersions ?? (ct.litHtmlVersions = [])).push("3.2.1");
|
|
504
|
+
const fo = (e, t, o) => {
|
|
505
505
|
const r = (o == null ? void 0 : o.renderBefore) ?? t;
|
|
506
506
|
let s = r._$litPart$;
|
|
507
507
|
if (s === void 0) {
|
|
508
508
|
const i = (o == null ? void 0 : o.renderBefore) ?? null;
|
|
509
|
-
r._$litPart$ = s = new
|
|
509
|
+
r._$litPart$ = s = new ht(t.insertBefore(pt(), i), i, void 0, o ?? {});
|
|
510
510
|
}
|
|
511
511
|
return s._$AI(e), s;
|
|
512
512
|
};
|
|
@@ -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 N = class extends tt {
|
|
519
519
|
constructor() {
|
|
520
520
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
521
521
|
}
|
|
@@ -526,7 +526,7 @@ let B = class extends st {
|
|
|
526
526
|
}
|
|
527
527
|
update(t) {
|
|
528
528
|
const o = this.render();
|
|
529
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do =
|
|
529
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = fo(o, this.renderRoot, this.renderOptions);
|
|
530
530
|
}
|
|
531
531
|
connectedCallback() {
|
|
532
532
|
var t;
|
|
@@ -537,20 +537,20 @@ let B = class extends st {
|
|
|
537
537
|
super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
|
|
538
538
|
}
|
|
539
539
|
render() {
|
|
540
|
-
return
|
|
540
|
+
return j;
|
|
541
541
|
}
|
|
542
542
|
};
|
|
543
|
-
var
|
|
544
|
-
|
|
545
|
-
const
|
|
546
|
-
|
|
543
|
+
var Se;
|
|
544
|
+
N._$litElement$ = !0, N.finalized = !0, (Se = globalThis.litElementHydrateSupport) == null || Se.call(globalThis, { LitElement: N });
|
|
545
|
+
const Mt = globalThis.litElementPolyfillSupport;
|
|
546
|
+
Mt == null || Mt({ LitElement: N });
|
|
547
547
|
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.1");
|
|
548
548
|
/**
|
|
549
549
|
* @license
|
|
550
550
|
* Copyright 2017 Google LLC
|
|
551
551
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
552
552
|
*/
|
|
553
|
-
const
|
|
553
|
+
const F = (e) => (t, o) => {
|
|
554
554
|
o !== void 0 ? o.addInitializer(() => {
|
|
555
555
|
customElements.define(e, t);
|
|
556
556
|
}) : customElements.define(e, t);
|
|
@@ -560,7 +560,7 @@ const W = (e) => (t, o) => {
|
|
|
560
560
|
* Copyright 2017 Google LLC
|
|
561
561
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
562
562
|
*/
|
|
563
|
-
const
|
|
563
|
+
const go = { attribute: !0, type: String, converter: xt, reflect: !1, hasChanged: Yt }, mo = (e = go, t, o) => {
|
|
564
564
|
const { kind: r, metadata: s } = o;
|
|
565
565
|
let i = globalThis.litPropertyMetadata.get(s);
|
|
566
566
|
if (i === void 0 && globalThis.litPropertyMetadata.set(s, i = /* @__PURE__ */ new Map()), i.set(o.name, e), r === "accessor") {
|
|
@@ -582,7 +582,7 @@ const ho = { attribute: !0, type: String, converter: kt, reflect: !1, hasChanged
|
|
|
582
582
|
throw Error("Unsupported decorator location: " + r);
|
|
583
583
|
};
|
|
584
584
|
function h(e) {
|
|
585
|
-
return (t, o) => typeof o == "object" ?
|
|
585
|
+
return (t, o) => typeof o == "object" ? mo(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;
|
|
588
588
|
})(e, t, o);
|
|
@@ -600,25 +600,25 @@ function C(e) {
|
|
|
600
600
|
* Copyright 2017 Google LLC
|
|
601
601
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
602
602
|
*/
|
|
603
|
-
const
|
|
603
|
+
const vo = (e, t, o) => (o.configurable = !0, o.enumerable = !0, Reflect.decorate && typeof t != "object" && Object.defineProperty(e, t, o), o);
|
|
604
604
|
/**
|
|
605
605
|
* @license
|
|
606
606
|
* Copyright 2017 Google LLC
|
|
607
607
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
608
608
|
*/
|
|
609
|
-
function
|
|
609
|
+
function ft(e, t) {
|
|
610
610
|
return (o, r, s) => {
|
|
611
611
|
const i = (a) => {
|
|
612
612
|
var l;
|
|
613
613
|
return ((l = a.renderRoot) == null ? void 0 : l.querySelector(e)) ?? null;
|
|
614
614
|
};
|
|
615
|
-
return
|
|
615
|
+
return vo(o, r, { get() {
|
|
616
616
|
return i(this);
|
|
617
617
|
} });
|
|
618
618
|
};
|
|
619
619
|
}
|
|
620
|
-
var
|
|
621
|
-
const
|
|
620
|
+
var $ = /* @__PURE__ */ ((e) => (e.reaction = "reaction", e.stars = "stars", e.poll = "poll", e.text = "text", e.nps = "nps", e))($ || {});
|
|
621
|
+
const Kt = c`
|
|
622
622
|
<svg
|
|
623
623
|
xmlns="http://www.w3.org/2000/svg"
|
|
624
624
|
height="24px"
|
|
@@ -628,7 +628,7 @@ const Jt = c`
|
|
|
628
628
|
>
|
|
629
629
|
<path d="M640-160v-280h160v280H640Zm-240 0v-640h160v640H400Zm-240 0v-440h160v440H160Z" />
|
|
630
630
|
</svg>
|
|
631
|
-
`,
|
|
631
|
+
`, Gt = c`
|
|
632
632
|
<svg
|
|
633
633
|
xmlns="http://www.w3.org/2000/svg"
|
|
634
634
|
height="24px"
|
|
@@ -640,7 +640,7 @@ const Jt = c`
|
|
|
640
640
|
d="M160-160v-440h160v440H160Zm240 0v-400l160 160v240H400Zm160-354L400-674v-126h160v286Zm240 240L640-434v-6h160v166Zm-9 219L55-791l57-57 736 736-57 57Z"
|
|
641
641
|
/>
|
|
642
642
|
</svg>
|
|
643
|
-
`,
|
|
643
|
+
`, St = c`
|
|
644
644
|
<svg
|
|
645
645
|
xmlns="http://www.w3.org/2000/svg"
|
|
646
646
|
height="24px"
|
|
@@ -652,7 +652,7 @@ const Jt = c`
|
|
|
652
652
|
d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"
|
|
653
653
|
/>
|
|
654
654
|
</svg>
|
|
655
|
-
`,
|
|
655
|
+
`, At = c`
|
|
656
656
|
<svg
|
|
657
657
|
xmlns="http://www.w3.org/2000/svg"
|
|
658
658
|
width="16"
|
|
@@ -664,7 +664,7 @@ const Jt = c`
|
|
|
664
664
|
d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"
|
|
665
665
|
/>
|
|
666
666
|
</svg>
|
|
667
|
-
`,
|
|
667
|
+
`, _e = c`
|
|
668
668
|
<svg
|
|
669
669
|
xmlns="http://www.w3.org/2000/svg"
|
|
670
670
|
height="24px"
|
|
@@ -675,164 +675,164 @@ const Jt = c`
|
|
|
675
675
|
<path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z" />
|
|
676
676
|
</svg>
|
|
677
677
|
`;
|
|
678
|
-
var
|
|
678
|
+
var bo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, z = 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
|
+
}, E = 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
|
+
}, Oe = function(e) {
|
|
685
685
|
return (e = isFinite(e) ? e % 360 : 0) > 0 ? e : e + 360;
|
|
686
|
-
},
|
|
687
|
-
return { r:
|
|
688
|
-
},
|
|
686
|
+
}, de = function(e) {
|
|
687
|
+
return { r: E(e.r, 0, 255), g: E(e.g, 0, 255), b: E(e.b, 0, 255), a: E(e.a) };
|
|
688
|
+
}, Lt = function(e) {
|
|
689
689
|
return { r: S(e.r), g: S(e.g), b: S(e.b), a: S(e.a, 3) };
|
|
690
|
-
},
|
|
690
|
+
}, yo = /^#([0-9a-f]{3,8})$/i, vt = function(e) {
|
|
691
691
|
var t = e.toString(16);
|
|
692
692
|
return t.length < 2 ? "0" + t : t;
|
|
693
|
-
},
|
|
693
|
+
}, Ie = function(e) {
|
|
694
694
|
var t = e.r, o = e.g, r = e.b, s = e.a, i = Math.max(t, o, r), a = i - Math.min(t, o, r), l = a ? i === t ? (o - r) / a : i === o ? 2 + (r - t) / a : 4 + (t - o) / a : 0;
|
|
695
695
|
return { h: 60 * (l < 0 ? l + 6 : l), s: i ? a / i * 100 : 0, v: i / 255 * 100, a: s };
|
|
696
|
-
},
|
|
696
|
+
}, ze = function(e) {
|
|
697
697
|
var t = e.h, o = e.s, r = e.v, s = e.a;
|
|
698
698
|
t = t / 360 * 6, o /= 100, r /= 100;
|
|
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
|
-
},
|
|
702
|
-
return { h:
|
|
703
|
-
},
|
|
701
|
+
}, pe = function(e) {
|
|
702
|
+
return { h: Oe(e.h), s: E(e.s, 0, 100), l: E(e.l, 0, 100), a: E(e.a) };
|
|
703
|
+
}, ue = function(e) {
|
|
704
704
|
return { h: S(e.h), s: S(e.s), l: S(e.l), a: S(e.a, 3) };
|
|
705
|
-
},
|
|
706
|
-
return
|
|
705
|
+
}, he = function(e) {
|
|
706
|
+
return ze((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;
|
|
708
|
-
},
|
|
709
|
-
return { h: (t =
|
|
708
|
+
}, dt = function(e) {
|
|
709
|
+
return { h: (t = Ie(e)).h, s: (s = (200 - (o = t.s)) * (r = t.v) / 100) > 0 && s < 200 ? o * r / 100 / (s <= 100 ? s : 200 - s) * 100 : 0, l: s / 2, a: t.a };
|
|
710
710
|
var t, o, r, s;
|
|
711
|
-
},
|
|
712
|
-
var t =
|
|
711
|
+
}, wo = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, xo = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, $o = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, So = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, fe = { string: [[function(e) {
|
|
712
|
+
var t = yo.exec(e);
|
|
713
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
|
-
var t =
|
|
716
|
-
return t ? t[2] !== t[4] || t[4] !== t[6] ? null :
|
|
715
|
+
var t = $o.exec(e) || So.exec(e);
|
|
716
|
+
return t ? t[2] !== t[4] || t[4] !== t[6] ? null : de({ 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;
|
|
717
717
|
}, "rgb"], [function(e) {
|
|
718
|
-
var t =
|
|
718
|
+
var t = wo.exec(e) || xo.exec(e);
|
|
719
719
|
if (!t) return null;
|
|
720
|
-
var o, r, s =
|
|
721
|
-
return
|
|
720
|
+
var o, r, s = pe({ h: (o = t[1], r = t[2], r === void 0 && (r = "deg"), Number(o) * (bo[r] || 1)), s: Number(t[3]), l: Number(t[4]), a: t[5] === void 0 ? 1 : Number(t[5]) / (t[6] ? 100 : 1) });
|
|
721
|
+
return he(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 z(t) && z(o) && z(r) ? de({ 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 (!
|
|
728
|
-
var a =
|
|
729
|
-
return
|
|
727
|
+
if (!z(t) || !z(o) || !z(r)) return null;
|
|
728
|
+
var a = pe({ h: Number(t), s: Number(o), l: Number(r), a: Number(i) });
|
|
729
|
+
return he(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 (!z(t) || !z(o) || !z(r)) return null;
|
|
733
733
|
var a = function(l) {
|
|
734
|
-
return { h:
|
|
734
|
+
return { h: Oe(l.h), s: E(l.s, 0, 100), v: E(l.v, 0, 100), a: E(l.a) };
|
|
735
735
|
}({ h: Number(t), s: Number(o), v: Number(r), a: Number(i) });
|
|
736
|
-
return
|
|
737
|
-
}, "hsv"]] },
|
|
736
|
+
return ze(a);
|
|
737
|
+
}, "hsv"]] }, ge = function(e, t) {
|
|
738
738
|
for (var o = 0; o < t.length; o++) {
|
|
739
739
|
var r = t[o][0](e);
|
|
740
740
|
if (r) return [r, t[o][1]];
|
|
741
741
|
}
|
|
742
742
|
return [null, void 0];
|
|
743
|
-
},
|
|
744
|
-
return typeof e == "string" ?
|
|
745
|
-
},
|
|
746
|
-
var o =
|
|
747
|
-
return { h: o.h, s:
|
|
748
|
-
},
|
|
743
|
+
}, Co = function(e) {
|
|
744
|
+
return typeof e == "string" ? ge(e.trim(), fe.string) : typeof e == "object" && e !== null ? ge(e, fe.object) : [null, void 0];
|
|
745
|
+
}, Nt = function(e, t) {
|
|
746
|
+
var o = dt(e);
|
|
747
|
+
return { h: o.h, s: E(o.s + 100 * t, 0, 100), l: o.l, a: o.a };
|
|
748
|
+
}, Dt = function(e) {
|
|
749
749
|
return (299 * e.r + 587 * e.g + 114 * e.b) / 1e3 / 255;
|
|
750
|
-
},
|
|
751
|
-
var o =
|
|
752
|
-
return { h: o.h, s: o.s, l:
|
|
753
|
-
},
|
|
750
|
+
}, me = function(e, t) {
|
|
751
|
+
var o = dt(e);
|
|
752
|
+
return { h: o.h, s: o.s, l: E(o.l + 100 * t, 0, 100), a: o.a };
|
|
753
|
+
}, ve = function() {
|
|
754
754
|
function e(t) {
|
|
755
|
-
this.parsed =
|
|
755
|
+
this.parsed = Co(t)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
756
756
|
}
|
|
757
757
|
return e.prototype.isValid = function() {
|
|
758
758
|
return this.parsed !== null;
|
|
759
759
|
}, e.prototype.brightness = function() {
|
|
760
|
-
return S(
|
|
760
|
+
return S(Dt(this.rgba), 2);
|
|
761
761
|
}, e.prototype.isDark = function() {
|
|
762
|
-
return
|
|
762
|
+
return Dt(this.rgba) < 0.5;
|
|
763
763
|
}, e.prototype.isLight = function() {
|
|
764
|
-
return
|
|
764
|
+
return Dt(this.rgba) >= 0.5;
|
|
765
765
|
}, e.prototype.toHex = function() {
|
|
766
|
-
return t =
|
|
766
|
+
return t = Lt(this.rgba), o = t.r, r = t.g, s = t.b, a = (i = t.a) < 1 ? vt(S(255 * i)) : "", "#" + vt(o) + vt(r) + vt(s) + a;
|
|
767
767
|
var t, o, r, s, i, a;
|
|
768
768
|
}, e.prototype.toRgb = function() {
|
|
769
|
-
return
|
|
769
|
+
return Lt(this.rgba);
|
|
770
770
|
}, e.prototype.toRgbString = function() {
|
|
771
|
-
return t =
|
|
771
|
+
return t = Lt(this.rgba), o = t.r, r = t.g, s = t.b, (i = t.a) < 1 ? "rgba(" + o + ", " + r + ", " + s + ", " + i + ")" : "rgb(" + o + ", " + r + ", " + s + ")";
|
|
772
772
|
var t, o, r, s, i;
|
|
773
773
|
}, e.prototype.toHsl = function() {
|
|
774
|
-
return
|
|
774
|
+
return ue(dt(this.rgba));
|
|
775
775
|
}, e.prototype.toHslString = function() {
|
|
776
|
-
return t =
|
|
776
|
+
return t = ue(dt(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 =
|
|
779
|
+
return t = Ie(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 P({ 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), P(Nt(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), P(Nt(this.rgba, -t));
|
|
788
788
|
}, e.prototype.grayscale = function() {
|
|
789
|
-
return
|
|
789
|
+
return P(Nt(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), P(me(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), P(me(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" ? P({ 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
|
-
var o =
|
|
801
|
-
return typeof t == "number" ?
|
|
800
|
+
var o = dt(this.rgba);
|
|
801
|
+
return typeof t == "number" ? P({ 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() === P(t).toHex();
|
|
804
804
|
}, e;
|
|
805
|
-
}(),
|
|
806
|
-
return e instanceof
|
|
805
|
+
}(), P = function(e) {
|
|
806
|
+
return e instanceof ve ? e : new ve(e);
|
|
807
807
|
};
|
|
808
|
-
const
|
|
809
|
-
function
|
|
810
|
-
if (
|
|
808
|
+
const ko = typeof process < "u" && (process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test");
|
|
809
|
+
function Rt() {
|
|
810
|
+
if (ko) return !0;
|
|
811
811
|
try {
|
|
812
812
|
return typeof localStorage < "u" && localStorage.getItem("pc-mode") === "development";
|
|
813
813
|
} catch {
|
|
814
814
|
return !1;
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
|
-
function
|
|
817
|
+
function Eo(e) {
|
|
818
818
|
return {
|
|
819
819
|
debug: (t, ...o) => {
|
|
820
|
-
|
|
820
|
+
Rt() && console.debug(`[${e}]`, t, ...o);
|
|
821
821
|
},
|
|
822
822
|
info: (t, ...o) => {
|
|
823
|
-
|
|
823
|
+
Rt() && console.info(`[${e}]`, t, ...o);
|
|
824
824
|
},
|
|
825
825
|
warn: (t, ...o) => {
|
|
826
|
-
|
|
826
|
+
Rt() && console.warn(`[${e}]`, t, ...o);
|
|
827
827
|
},
|
|
828
828
|
error: (t, ...o) => {
|
|
829
829
|
console.error(`[${e}]`, t, ...o);
|
|
830
830
|
}
|
|
831
831
|
};
|
|
832
832
|
}
|
|
833
|
-
const g =
|
|
834
|
-
var
|
|
835
|
-
const
|
|
833
|
+
const g = Eo("Pollcatch");
|
|
834
|
+
var Me = /* @__PURE__ */ ((e) => (e[e.AA_NORMAL = 4.5] = "AA_NORMAL", e[e.AA_LARGE = 3] = "AA_LARGE", e[e.AAA_NORMAL = 7] = "AAA_NORMAL", e[e.AAA_LARGE = 4.5] = "AAA_LARGE", e))(Me || {});
|
|
835
|
+
const Ao = {
|
|
836
836
|
black: "#000000",
|
|
837
837
|
white: "#ffffff",
|
|
838
838
|
red: "#ff0000",
|
|
@@ -849,20 +849,20 @@ const ko = {
|
|
|
849
849
|
teal: "#008080",
|
|
850
850
|
navy: "#000080"
|
|
851
851
|
};
|
|
852
|
-
function
|
|
852
|
+
function Po(e) {
|
|
853
853
|
const t = e.toLowerCase().trim();
|
|
854
|
-
return
|
|
854
|
+
return Ao[t] || null;
|
|
855
855
|
}
|
|
856
|
-
function
|
|
857
|
-
const o =
|
|
856
|
+
function Bt(e, t) {
|
|
857
|
+
const o = be(e), r = be(t), s = Math.max(o, r), i = Math.min(o, r);
|
|
858
858
|
return (s + 0.05) / (i + 0.05);
|
|
859
859
|
}
|
|
860
|
-
function
|
|
861
|
-
const t =
|
|
860
|
+
function be(e) {
|
|
861
|
+
const t = _o(e), o = t.r / 255, r = t.g / 255, s = t.b / 255, i = o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4), a = r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4), l = s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
|
|
862
862
|
return 0.2126 * i + 0.7152 * a + 0.0722 * l;
|
|
863
863
|
}
|
|
864
|
-
function
|
|
865
|
-
if (!
|
|
864
|
+
function To(e, t = {}) {
|
|
865
|
+
if (!P(e).isValid())
|
|
866
866
|
return g.warn(`Invalid color provided: ${e}`), "black";
|
|
867
867
|
const {
|
|
868
868
|
minContrast: r = 4.5,
|
|
@@ -875,15 +875,15 @@ 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 f =
|
|
878
|
+
const f = Bt(e, p);
|
|
879
879
|
f >= r && f > d && (d = f, n = p);
|
|
880
880
|
}
|
|
881
881
|
if (d === 0) {
|
|
882
|
-
const p =
|
|
882
|
+
const p = Bt(e, a);
|
|
883
883
|
n = a, d = p;
|
|
884
884
|
for (const f of l) {
|
|
885
885
|
if (f === a) continue;
|
|
886
|
-
const b =
|
|
886
|
+
const b = Bt(e, f);
|
|
887
887
|
b > d && (d = b, n = f);
|
|
888
888
|
}
|
|
889
889
|
g.warn(
|
|
@@ -892,14 +892,14 @@ function Ao(e, t = {}) {
|
|
|
892
892
|
}
|
|
893
893
|
return n;
|
|
894
894
|
}
|
|
895
|
-
function
|
|
896
|
-
const o =
|
|
895
|
+
function _o(e) {
|
|
896
|
+
const o = Po(e) || e, r = P(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 _(e, t) {
|
|
903
903
|
const r = t ? {
|
|
904
904
|
left: "start",
|
|
905
905
|
right: "end",
|
|
@@ -911,7 +911,7 @@ function O(e, t) {
|
|
|
911
911
|
}[t] : void 0;
|
|
912
912
|
return e === "left" || e === "right" ? r || "center" : e === "top" || e === "bottom" ? r || "start" : r || "center";
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function Vt(e, t = "1rem", o = 1) {
|
|
915
915
|
if (!e) return t;
|
|
916
916
|
const r = {
|
|
917
917
|
xs: 0.7,
|
|
@@ -930,7 +930,7 @@ function qt(e, t = "1rem", o = 1) {
|
|
|
930
930
|
const l = parseFloat(i);
|
|
931
931
|
return isNaN(l) ? t : `${l}rem`;
|
|
932
932
|
}
|
|
933
|
-
function
|
|
933
|
+
function Oo(e, t = "4px") {
|
|
934
934
|
if (!e) return t;
|
|
935
935
|
const o = {
|
|
936
936
|
xs: "2px",
|
|
@@ -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 M = /* @__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))(M || {});
|
|
954
|
+
function et(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)) {
|
|
@@ -961,54 +961,54 @@ function it(e) {
|
|
|
961
961
|
}
|
|
962
962
|
return t;
|
|
963
963
|
}
|
|
964
|
-
function
|
|
965
|
-
return
|
|
964
|
+
function Io(e, t, o) {
|
|
965
|
+
return et({
|
|
966
966
|
role: "button",
|
|
967
967
|
ariaLabel: e,
|
|
968
968
|
ariaPressed: t,
|
|
969
969
|
ariaDisabled: o
|
|
970
970
|
});
|
|
971
971
|
}
|
|
972
|
-
function
|
|
973
|
-
return
|
|
972
|
+
function zo(e, t, o, r = !1) {
|
|
973
|
+
return et({
|
|
974
974
|
role: r ? "radio" : "checkbox",
|
|
975
975
|
ariaLabel: e,
|
|
976
976
|
ariaChecked: t,
|
|
977
977
|
ariaDisabled: o
|
|
978
978
|
});
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function Ut(e, t, o) {
|
|
981
981
|
typeof o == "boolean" ? e.setAttribute(t, o ? "true" : "false") : e.setAttribute(t, o);
|
|
982
982
|
}
|
|
983
|
-
function
|
|
983
|
+
function Mo(e) {
|
|
984
984
|
if (typeof e != "string")
|
|
985
985
|
return !1;
|
|
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
|
|
990
|
-
return
|
|
989
|
+
function Q(e) {
|
|
990
|
+
return Mo(e) ? e.replace(/[<>"']/g, "").trim() : (g.warn("Invalid color value:", e), "#000000");
|
|
991
991
|
}
|
|
992
|
-
function
|
|
992
|
+
function Lo(e) {
|
|
993
993
|
if (typeof e != "string")
|
|
994
994
|
return g.warn("Non-string value passed to sanitizeCSS:", typeof e), "";
|
|
995
995
|
let t = e;
|
|
996
996
|
return t = t.replace(/@import[^;]+;/gi, "").replace(/expression\s*\([^)]*\)/gi, "").replace(/javascript:\s*[^"'\s;]*/gi, "").replace(/url\s*\(\s*["']?data:(?!image\/[^;]+;base64,)[^"')]*["']?\s*\)/gi, "").replace(/-moz-binding\s*:[^;]+;/gi, "").replace(/behavior\s*:[^;]+;/gi, ""), t;
|
|
997
997
|
}
|
|
998
|
-
function
|
|
998
|
+
function No(e) {
|
|
999
999
|
return typeof e != "string" || !e.trim() ? "" : e.replace(
|
|
1000
1000
|
/([^{}:;]+):\s*([^;{}!]+)(\s*!important)?\s*(;|})/gi,
|
|
1001
1001
|
(t, o, r, s, i) => s ? t : `${o}: ${r.trim()} !important${i}`
|
|
1002
1002
|
);
|
|
1003
1003
|
}
|
|
1004
|
-
const
|
|
1005
|
-
function
|
|
1004
|
+
const Do = "https://jpxwfjorwcsrqraorpbj.supabase.co/functions/v1/data", Ro = "pc_session_id", Bo = 24 * 60 * 60 * 1e3;
|
|
1005
|
+
function ye() {
|
|
1006
1006
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (g.warn("crypto.randomUUID not available, using fallback UUID generator"), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
1007
1007
|
const t = Math.random() * 16 | 0;
|
|
1008
1008
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
1009
1009
|
}));
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1011
|
+
function Zt() {
|
|
1012
1012
|
const e = "test-local-storage";
|
|
1013
1013
|
try {
|
|
1014
1014
|
return localStorage.setItem(e, e), localStorage.removeItem(e), !0;
|
|
@@ -1016,7 +1016,7 @@ function te() {
|
|
|
1016
1016
|
return g.warn("localStorage not available, session ID will not persist"), !1;
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
|
-
function
|
|
1019
|
+
function Le(e) {
|
|
1020
1020
|
try {
|
|
1021
1021
|
const t = localStorage.getItem(e);
|
|
1022
1022
|
return t ? JSON.parse(t) : void 0;
|
|
@@ -1025,34 +1025,34 @@ function Be(e) {
|
|
|
1025
1025
|
return;
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1028
|
+
function Ne(e, t) {
|
|
1029
1029
|
try {
|
|
1030
1030
|
return localStorage.setItem(e, JSON.stringify(t)), !0;
|
|
1031
1031
|
} catch (o) {
|
|
1032
1032
|
return g.warn(`Failed to set item in localStorage: ${e}`, o), !1;
|
|
1033
1033
|
}
|
|
1034
1034
|
}
|
|
1035
|
-
async function
|
|
1036
|
-
const e =
|
|
1037
|
-
if (
|
|
1038
|
-
const o =
|
|
1035
|
+
async function we() {
|
|
1036
|
+
const e = Ro, t = Bo;
|
|
1037
|
+
if (Zt()) {
|
|
1038
|
+
const o = Le(e);
|
|
1039
1039
|
if (o && o.id && o.timestamp && Date.now() - o.timestamp < t)
|
|
1040
1040
|
return g.debug("Using existing session ID from localStorage"), o.id;
|
|
1041
1041
|
g.debug(
|
|
1042
1042
|
o ? "Session ID expired" : "No session ID found",
|
|
1043
1043
|
"generating new one"
|
|
1044
1044
|
);
|
|
1045
|
-
const r =
|
|
1046
|
-
return
|
|
1045
|
+
const r = ye();
|
|
1046
|
+
return Ne(e, {
|
|
1047
1047
|
id: r,
|
|
1048
1048
|
timestamp: Date.now()
|
|
1049
1049
|
}) ? g.debug("Generated and stored new session ID") : g.warn("Generated session ID but failed to store it"), r;
|
|
1050
1050
|
} else {
|
|
1051
|
-
const o =
|
|
1051
|
+
const o = ye();
|
|
1052
1052
|
return g.debug("Generated non-persistent session ID"), o;
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function Ct(e) {
|
|
1056
1056
|
if (!e || typeof e != "object")
|
|
1057
1057
|
return 0;
|
|
1058
1058
|
let t = 0, o = 0, r = 0;
|
|
@@ -1065,7 +1065,7 @@ function ft(e) {
|
|
|
1065
1065
|
const s = t / r * 100, i = o / r * 100;
|
|
1066
1066
|
return Math.round(s - i);
|
|
1067
1067
|
}
|
|
1068
|
-
function
|
|
1068
|
+
function Vo(e) {
|
|
1069
1069
|
if (!e || typeof e != "object")
|
|
1070
1070
|
return { promoters: 0, passives: 0, detractors: 0 };
|
|
1071
1071
|
let t = 0, o = 0, r = 0;
|
|
@@ -1075,14 +1075,14 @@ function No(e) {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
return { promoters: t, passives: o, detractors: r };
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Uo(e, t) {
|
|
1079
1079
|
const o = {};
|
|
1080
1080
|
for (const r of t)
|
|
1081
1081
|
o[r] = e[r] || 0;
|
|
1082
1082
|
return o;
|
|
1083
1083
|
}
|
|
1084
|
-
function
|
|
1085
|
-
const o = t ?
|
|
1084
|
+
function jo(e, t) {
|
|
1085
|
+
const o = t ? Uo(e, t) : e;
|
|
1086
1086
|
let r = 0, s = 0;
|
|
1087
1087
|
for (const [a, l] of Object.entries(o)) {
|
|
1088
1088
|
s += l;
|
|
@@ -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 L() {
|
|
1095
1095
|
return {
|
|
1096
1096
|
count: 0,
|
|
1097
1097
|
sum: 0,
|
|
@@ -1101,26 +1101,26 @@ function R() {
|
|
|
1101
1101
|
updated: (/* @__PURE__ */ new Date()).toISOString()
|
|
1102
1102
|
};
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1105
|
-
if (!
|
|
1106
|
-
return
|
|
1104
|
+
function qo(e) {
|
|
1105
|
+
if (!Zt())
|
|
1106
|
+
return L();
|
|
1107
1107
|
try {
|
|
1108
|
-
const t =
|
|
1109
|
-
return t ? { ...
|
|
1108
|
+
const t = Le(e);
|
|
1109
|
+
return t ? { ...L(), ...t } : L();
|
|
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), L();
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1115
|
-
if (!
|
|
1114
|
+
function Ho(e, t) {
|
|
1115
|
+
if (!Zt())
|
|
1116
1116
|
return !1;
|
|
1117
1117
|
try {
|
|
1118
|
-
return
|
|
1118
|
+
return Ne(e, t) ? (g.debug("Saved localStats to localStorage", t), !0) : !1;
|
|
1119
1119
|
} catch (o) {
|
|
1120
1120
|
return g.warn("Failed to save localStats to localStorage", o), !1;
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
|
-
function
|
|
1123
|
+
function Fo(e, t) {
|
|
1124
1124
|
const o = {
|
|
1125
1125
|
count: Math.max(0, e.count - t.count),
|
|
1126
1126
|
sum: (e.sum || 0) - (t.sum || 0),
|
|
@@ -1133,11 +1133,11 @@ function Vo(e, t) {
|
|
|
1133
1133
|
if (o.count > 0 && o.sum !== void 0 ? o.avg = Math.round(o.sum / o.count * 100) / 100 : o.avg = 0, t.breakdown && o.breakdown)
|
|
1134
1134
|
for (const [r, s] of Object.entries(t.breakdown))
|
|
1135
1135
|
o.breakdown[r] && (o.breakdown[r] = Math.max(0, o.breakdown[r] - s), o.breakdown[r] === 0 && delete o.breakdown[r]);
|
|
1136
|
-
return o.nps =
|
|
1136
|
+
return o.nps = Ct((o == null ? void 0 : o.breakdown) || {}), o;
|
|
1137
1137
|
}
|
|
1138
|
-
function
|
|
1138
|
+
function Yo(e, t) {
|
|
1139
1139
|
if (!e.count && !t.count)
|
|
1140
|
-
return
|
|
1140
|
+
return L();
|
|
1141
1141
|
if (!e.count)
|
|
1142
1142
|
return { ...t };
|
|
1143
1143
|
const o = {
|
|
@@ -1154,12 +1154,12 @@ function jo(e, t) {
|
|
|
1154
1154
|
for (const [r, s] of Object.entries(t.breakdown))
|
|
1155
1155
|
o.breakdown[r] = (o.breakdown[r] || 0) + s;
|
|
1156
1156
|
}
|
|
1157
|
-
return o.nps =
|
|
1157
|
+
return o.nps = Ct((o == null ? void 0 : o.breakdown) || {}), o;
|
|
1158
1158
|
}
|
|
1159
|
-
function
|
|
1159
|
+
function De(e) {
|
|
1160
1160
|
return !e || typeof e != "string" ? !1 : /^[\p{Emoji}]$/u.test(e) ? !0 : new RegExp("^\\p{Emoji}(\\p{Emoji_Modifier}|\\u200D\\p{Emoji})*$", "u").test(e);
|
|
1161
1161
|
}
|
|
1162
|
-
function
|
|
1162
|
+
function Pt(e) {
|
|
1163
1163
|
if (!e || typeof e != "string")
|
|
1164
1164
|
return !1;
|
|
1165
1165
|
const t = e.trim();
|
|
@@ -1173,7 +1173,7 @@ function Ot(e) {
|
|
|
1173
1173
|
return !1;
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
|
-
function
|
|
1176
|
+
function Re(e) {
|
|
1177
1177
|
if (!e || typeof e != "string")
|
|
1178
1178
|
return [];
|
|
1179
1179
|
const t = e.trim();
|
|
@@ -1188,53 +1188,91 @@ function qo(e) {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
return t.split(",").map((o) => o.trim()).filter((o) => o !== "");
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1191
|
+
function Wo(e, t) {
|
|
1192
1192
|
const o = /{([^{}]+)}/g;
|
|
1193
1193
|
return e.replace(o, (r, s) => {
|
|
1194
1194
|
const i = s.trim(), a = t[i];
|
|
1195
1195
|
return a !== void 0 ? String(a) : r;
|
|
1196
1196
|
});
|
|
1197
1197
|
}
|
|
1198
|
-
function
|
|
1198
|
+
function Ko(e, t) {
|
|
1199
1199
|
let o = 2166136261;
|
|
1200
1200
|
const r = e + ":" + t;
|
|
1201
1201
|
for (let s = 0; s < r.length; s++)
|
|
1202
1202
|
o ^= r.charCodeAt(s), o += (o << 1) + (o << 4) + (o << 7) + (o << 8) + (o << 24);
|
|
1203
1203
|
return (o >>> 0).toString(16).padStart(8, "0");
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1205
|
+
function Go(e, t = 50) {
|
|
1206
1206
|
return e.length <= t ? e : e.substring(0, t).trim() + "...";
|
|
1207
1207
|
}
|
|
1208
|
-
const
|
|
1209
|
-
function
|
|
1210
|
-
|
|
1208
|
+
const qt = /* @__PURE__ */ new Map();
|
|
1209
|
+
function Zo(e, t) {
|
|
1210
|
+
qt.set(e, t);
|
|
1211
1211
|
}
|
|
1212
|
-
function
|
|
1213
|
-
const t =
|
|
1214
|
-
return t &&
|
|
1212
|
+
function Xo(e) {
|
|
1213
|
+
const t = qt.get(e);
|
|
1214
|
+
return t && qt.delete(e), t;
|
|
1215
1215
|
}
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1216
|
+
const Be = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, xe = 5;
|
|
1217
|
+
function Ve(e) {
|
|
1218
|
+
return e || Do;
|
|
1219
|
+
}
|
|
1220
|
+
function Ue(e, t) {
|
|
1221
|
+
const o = Ve(t);
|
|
1222
|
+
return e.type === "registered" ? `${o}/widgets/${encodeURIComponent(e.widgetId)}` : `${o}/public-widgets/${encodeURIComponent(e.name)}`;
|
|
1223
|
+
}
|
|
1224
|
+
async function je(e, t) {
|
|
1225
|
+
const o = Ue(e, t);
|
|
1226
|
+
g.debug("API GET", { url: o });
|
|
1227
|
+
const r = await fetch(o);
|
|
1228
|
+
if (!r.ok)
|
|
1229
|
+
throw new Error(`API request failed with status: ${r.status}`);
|
|
1230
|
+
const s = await r.json();
|
|
1231
|
+
if (!s.success)
|
|
1232
|
+
throw new Error("Backend returned unsuccessful response");
|
|
1233
|
+
return s;
|
|
1234
|
+
}
|
|
1235
|
+
async function Jo(e, t, o) {
|
|
1236
|
+
const r = Ue(e, o);
|
|
1237
|
+
if (g.debug("API POST", { url: r }), typeof navigator < "u" && navigator.sendBeacon) {
|
|
1238
|
+
if (navigator.sendBeacon(r, t)) {
|
|
1239
|
+
g.debug("Successfully sent stats via sendBeacon");
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
g.debug("sendBeacon failed, falling back to fetch");
|
|
1243
|
+
}
|
|
1244
|
+
const s = await fetch(r, {
|
|
1245
|
+
body: t,
|
|
1246
|
+
method: "POST",
|
|
1247
|
+
keepalive: !0,
|
|
1248
|
+
headers: {
|
|
1249
|
+
"Content-Type": "application/json"
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
if (!s.ok)
|
|
1253
|
+
throw new Error(`API request failed with status: ${s.status}`);
|
|
1254
|
+
g.debug("Successfully sent stats via fetch");
|
|
1255
|
+
}
|
|
1256
|
+
class Qo {
|
|
1218
1257
|
// Tracks if user has ever made a selection (even if later deselected)
|
|
1219
1258
|
constructor(t) {
|
|
1220
|
-
this.stats =
|
|
1259
|
+
this.stats = L(), this.localStats = L(), this.prevLocalStats = L(), this.isLoading = !0, this.isLoadingConfig = !1, this.isSubmitting = !1, this.hasInteracted = !1, (this.host = t).addController(this);
|
|
1221
1260
|
}
|
|
1222
1261
|
hostConnected() {
|
|
1223
1262
|
this.loadStats();
|
|
1224
1263
|
}
|
|
1225
1264
|
/**
|
|
1226
|
-
* Validates the widget identifier
|
|
1227
|
-
* Returns
|
|
1265
|
+
* Validates and returns the widget identifier.
|
|
1266
|
+
* Returns null (and logs the error) when validation fails.
|
|
1228
1267
|
*/
|
|
1229
|
-
|
|
1268
|
+
getWidgetIdentifier() {
|
|
1230
1269
|
const t = this.host;
|
|
1231
|
-
return t.widgetId ?
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
} : { type: "public" } : { type: "none", error: "Widget requires either widget-id or name attribute" };
|
|
1270
|
+
return t.widgetId ? Be.test(t.widgetId) ? { type: "registered", widgetId: t.widgetId } : (g.error(`Invalid widget-id format: ${t.widgetId}`), null) : t.name ? t.name.length < xe ? (g.error(
|
|
1271
|
+
`Widget name must be at least ${xe} characters long. Got: "${t.name}"`
|
|
1272
|
+
), null) : { type: "public", name: t.name } : (g.error("Widget requires either widget-id or name attribute"), null);
|
|
1235
1273
|
}
|
|
1236
1274
|
async getLocalStatsKey() {
|
|
1237
|
-
const t = this.host, o = await
|
|
1275
|
+
const t = this.host, o = await we(), r = t.widgetId || t.name || "unnamed";
|
|
1238
1276
|
return `pc-local-stats-${o}-${r}`;
|
|
1239
1277
|
}
|
|
1240
1278
|
/**
|
|
@@ -1250,11 +1288,20 @@ class Go {
|
|
|
1250
1288
|
*/
|
|
1251
1289
|
applyWidgetAttributes(t) {
|
|
1252
1290
|
if (!t) return;
|
|
1253
|
-
const r = this.host;
|
|
1254
|
-
for (const [
|
|
1255
|
-
if (
|
|
1256
|
-
|
|
1257
|
-
|
|
1291
|
+
const o = typeof t.attributes == "object" && t.attributes !== null && !Array.isArray(t.attributes) ? t.attributes : t, r = this.host, s = r;
|
|
1292
|
+
for (const [i, a] of Object.entries(o)) {
|
|
1293
|
+
if (a == null) continue;
|
|
1294
|
+
if (i === "options" && typeof a == "string") {
|
|
1295
|
+
const n = Re(a);
|
|
1296
|
+
r.options = n.map((d) => ({
|
|
1297
|
+
value: d,
|
|
1298
|
+
label: d,
|
|
1299
|
+
icon: r.type === $.reaction ? d : void 0
|
|
1300
|
+
})), g.debug("Applied widget options as property:", n);
|
|
1301
|
+
continue;
|
|
1302
|
+
}
|
|
1303
|
+
const l = i.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
1304
|
+
typeof a == "boolean" ? a ? s.setAttribute(l, "") : s.removeAttribute(l) : typeof a == "object" ? s.setAttribute(l, JSON.stringify(a)) : s.setAttribute(l, String(a)), g.debug(`Applied widget attribute: ${l}=${a}`);
|
|
1258
1305
|
}
|
|
1259
1306
|
}
|
|
1260
1307
|
/**
|
|
@@ -1264,86 +1311,66 @@ class Go {
|
|
|
1264
1311
|
var r, s, i;
|
|
1265
1312
|
const t = this.host;
|
|
1266
1313
|
this.isLoading = !1, this.stats = this.localStats, this.host.requestUpdate();
|
|
1267
|
-
const o = this.
|
|
1268
|
-
if (o
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1314
|
+
const o = this.getWidgetIdentifier();
|
|
1315
|
+
if (o)
|
|
1316
|
+
try {
|
|
1317
|
+
let a, l;
|
|
1318
|
+
if (o.type === "registered") {
|
|
1319
|
+
const y = Xo(o.widgetId);
|
|
1320
|
+
y && (g.debug("Using prefetched widget config from cache", {
|
|
1321
|
+
widgetId: o.widgetId
|
|
1322
|
+
}), this.applyWidgetAttributes(y.config.attributes), a = y.stats);
|
|
1323
|
+
}
|
|
1324
|
+
if (!a) {
|
|
1325
|
+
let y;
|
|
1326
|
+
if (o.type !== "registered" && t.dataFunc && typeof window < "u") {
|
|
1327
|
+
const A = t.dataFunc.replace(/^window\./, "").split(".");
|
|
1328
|
+
let k = window;
|
|
1329
|
+
for (const I of A)
|
|
1330
|
+
if (k = k == null ? void 0 : k[I], k === void 0) break;
|
|
1331
|
+
y = k;
|
|
1332
|
+
}
|
|
1333
|
+
if (y && typeof y == "function") {
|
|
1334
|
+
l = this.getValidOptionKeys(t), g.debug(`Using data function for: ${t.widgetId || t.name}`, {
|
|
1335
|
+
dataFuncName: t.dataFunc,
|
|
1336
|
+
options: l
|
|
1337
|
+
});
|
|
1338
|
+
const x = await y(t.widgetId, t.name, l);
|
|
1339
|
+
if (x && typeof x == "object" && "success" in x && "data" in x) {
|
|
1340
|
+
if (!x.success)
|
|
1341
|
+
throw g.error("Custom data function returned unsuccessful response", x), new Error("Custom data function returned unsuccessful response");
|
|
1342
|
+
a = x.data || {};
|
|
1343
|
+
} else
|
|
1344
|
+
a = x || {};
|
|
1345
|
+
} else {
|
|
1346
|
+
o.type === "registered" && (this.isLoadingConfig = !0, this.host.requestUpdate());
|
|
1347
|
+
const x = await je(
|
|
1348
|
+
o,
|
|
1349
|
+
o.type === "registered" ? void 0 : t.dataEndpoint
|
|
1350
|
+
);
|
|
1351
|
+
if (o.type === "registered") {
|
|
1352
|
+
const A = ((s = (r = x.data) == null ? void 0 : r.config) == null ? void 0 : s.attributes) || null;
|
|
1353
|
+
a = ((i = x.data) == null ? void 0 : i.stats) || {}, this.applyWidgetAttributes(A);
|
|
1354
|
+
} else
|
|
1355
|
+
a = x.data || {};
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
l ?? (l = this.getValidOptionKeys(t));
|
|
1359
|
+
const n = jo(a.breakdown ?? {}, l), 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;
|
|
1360
|
+
this.stats = {
|
|
1280
1361
|
count: d,
|
|
1281
1362
|
sum: p,
|
|
1282
1363
|
avg: f,
|
|
1283
1364
|
pct: b,
|
|
1284
|
-
nps: t.type ===
|
|
1365
|
+
nps: t.type === $.nps ? Ct(n.breakdown) : 0,
|
|
1285
1366
|
breakdown: n.breakdown,
|
|
1286
|
-
updated: a.
|
|
1367
|
+
updated: a.updatedAt || a.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1287
1368
|
};
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
try {
|
|
1293
|
-
const a = t.type;
|
|
1294
|
-
let l;
|
|
1295
|
-
if (t.dataFunc && typeof window < "u") {
|
|
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;
|
|
1369
|
+
} catch (a) {
|
|
1370
|
+
throw g.error("Error loading stats:", a, this.localStats), a;
|
|
1371
|
+
} finally {
|
|
1372
|
+
this.isLoading = !1, this.isLoadingConfig = !1, this.host.requestUpdate();
|
|
1301
1373
|
}
|
|
1302
|
-
let n, d = null;
|
|
1303
|
-
if (l && typeof l == "function") {
|
|
1304
|
-
const k = this.getOptionsForDataFunc(t);
|
|
1305
|
-
g.debug(`Using data function for: ${t.widgetId || t.name}`, {
|
|
1306
|
-
dataFuncName: t.dataFunc,
|
|
1307
|
-
options: k
|
|
1308
|
-
});
|
|
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 || {};
|
|
1314
|
-
} else
|
|
1315
|
-
n = $ || {};
|
|
1316
|
-
} else {
|
|
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: $,
|
|
1321
|
-
type: o.type
|
|
1322
|
-
});
|
|
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 || {};
|
|
1330
|
-
}
|
|
1331
|
-
d && !l && this.applyWidgetAttributes(d);
|
|
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,
|
|
1339
|
-
updated: n.updatedAt || n.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1340
|
-
};
|
|
1341
|
-
this.stats = L;
|
|
1342
|
-
} catch (a) {
|
|
1343
|
-
throw g.error("Error loading stats:", a, this.localStats), a;
|
|
1344
|
-
} finally {
|
|
1345
|
-
this.isLoading = !1, this.isLoadingConfig = !1, this.host.requestUpdate();
|
|
1346
|
-
}
|
|
1347
1374
|
}
|
|
1348
1375
|
/**
|
|
1349
1376
|
* Gets the options array for the data function based on widget type.
|
|
@@ -1351,16 +1378,16 @@ class Go {
|
|
|
1351
1378
|
* - For stars: generates ['1', '2', ..., numStars]
|
|
1352
1379
|
* - For NPS: generates ['0', '1', '2', ..., '10']
|
|
1353
1380
|
*/
|
|
1354
|
-
|
|
1381
|
+
getValidOptionKeys(t) {
|
|
1355
1382
|
switch (t.type) {
|
|
1356
|
-
case
|
|
1383
|
+
case $.stars: {
|
|
1357
1384
|
const r = t.numStars || 5;
|
|
1358
1385
|
return Array.from({ length: r }, (s, i) => String(i + 1));
|
|
1359
1386
|
}
|
|
1360
|
-
case
|
|
1387
|
+
case $.nps:
|
|
1361
1388
|
return Array.from({ length: 11 }, (r, s) => String(s));
|
|
1362
|
-
case
|
|
1363
|
-
case
|
|
1389
|
+
case $.poll:
|
|
1390
|
+
case $.reaction:
|
|
1364
1391
|
default:
|
|
1365
1392
|
return t.options.map((r) => r.value);
|
|
1366
1393
|
}
|
|
@@ -1371,10 +1398,10 @@ class Go {
|
|
|
1371
1398
|
async loadLocalStats() {
|
|
1372
1399
|
const t = await this.getLocalStatsKey();
|
|
1373
1400
|
try {
|
|
1374
|
-
const o =
|
|
1401
|
+
const o = qo(t);
|
|
1375
1402
|
g.debug("Loaded localStats from localStorage", o), this.localStats = o, o.submitted && (this.prevLocalStats = { ...o });
|
|
1376
1403
|
} catch (o) {
|
|
1377
|
-
g.warn("Failed to generate localStorage key for localStats", o), this.localStats =
|
|
1404
|
+
g.warn("Failed to generate localStorage key for localStats", o), this.localStats = L();
|
|
1378
1405
|
}
|
|
1379
1406
|
this.host.requestUpdate();
|
|
1380
1407
|
}
|
|
@@ -1384,7 +1411,7 @@ class Go {
|
|
|
1384
1411
|
async persistLocalStats() {
|
|
1385
1412
|
try {
|
|
1386
1413
|
const t = await this.getLocalStatsKey();
|
|
1387
|
-
|
|
1414
|
+
Ho(t, this.localStats) || g.warn("Failed to save localStats to localStorage");
|
|
1388
1415
|
} catch (t) {
|
|
1389
1416
|
g.warn("Failed to save localStats to localStorage", t);
|
|
1390
1417
|
}
|
|
@@ -1398,7 +1425,7 @@ class Go {
|
|
|
1398
1425
|
* @param textValues
|
|
1399
1426
|
*/
|
|
1400
1427
|
updateStats(t, o) {
|
|
1401
|
-
if (this.hasInteracted = !0, this.stats && (this.stats =
|
|
1428
|
+
if (this.hasInteracted = !0, this.stats && (this.stats = Fo(this.stats, this.localStats)), this.localStats = {
|
|
1402
1429
|
count: t > 0 || o.length > 0 ? 1 : 0,
|
|
1403
1430
|
sum: t,
|
|
1404
1431
|
// e.g. number of stars, nps value
|
|
@@ -1412,7 +1439,7 @@ class Go {
|
|
|
1412
1439
|
}, o && o.length > 0)
|
|
1413
1440
|
for (const r of o)
|
|
1414
1441
|
r && (this.localStats.breakdown[r] = 1);
|
|
1415
|
-
this.stats =
|
|
1442
|
+
this.stats = Yo(this.stats, this.localStats), g.debug("Stats updated - remote: ", this.stats), g.debug("Stats updated - local: ", this.stats), this.persistLocalStats(), this.host.requestUpdate();
|
|
1416
1443
|
}
|
|
1417
1444
|
async markStatsAsSubmitted() {
|
|
1418
1445
|
this.localStats.submitted = (/* @__PURE__ */ new Date()).toISOString(), this.prevLocalStats = { ...this.localStats }, await this.persistLocalStats(), this.host.requestUpdate();
|
|
@@ -1420,7 +1447,7 @@ class Go {
|
|
|
1420
1447
|
async submitStats() {
|
|
1421
1448
|
if (!this.hasLocalStats() && !this.hasInteracted)
|
|
1422
1449
|
throw g.warn("No local stats to submit"), new Error("No local stats to submit");
|
|
1423
|
-
const t = this.host, o = Math.floor(Date.now() / 1e3).toString(), r = await
|
|
1450
|
+
const t = this.host, o = Math.floor(Date.now() / 1e3).toString(), r = await we(), s = this.localStats.sum, i = Object.keys(this.localStats.breakdown || {}), a = this.prevLocalStats.sum, l = Object.keys(this.prevLocalStats.breakdown || {});
|
|
1424
1451
|
this.isSubmitting = !0, this.host.requestUpdate();
|
|
1425
1452
|
const n = {
|
|
1426
1453
|
sessionId: r,
|
|
@@ -1434,7 +1461,7 @@ class Go {
|
|
|
1434
1461
|
prevTextValues: l,
|
|
1435
1462
|
metadata: t.metadata,
|
|
1436
1463
|
timestamp: o
|
|
1437
|
-
}, d =
|
|
1464
|
+
}, d = Ko(JSON.stringify(n), o);
|
|
1438
1465
|
try {
|
|
1439
1466
|
await this.sendStats({ ...n, hash: d }), await this.markStatsAsSubmitted(), this.dispatchSubmitEvent(n);
|
|
1440
1467
|
} catch (p) {
|
|
@@ -1445,38 +1472,18 @@ class Go {
|
|
|
1445
1472
|
return n;
|
|
1446
1473
|
}
|
|
1447
1474
|
async sendStats(t) {
|
|
1448
|
-
const o = this.host;
|
|
1449
|
-
if (
|
|
1475
|
+
const o = this.host, r = this.getWidgetIdentifier();
|
|
1476
|
+
if (!r) throw new Error("Invalid widget identifier");
|
|
1477
|
+
if (r.type !== "registered" && o.dataFunc) {
|
|
1450
1478
|
g.debug("Skip sending stats as data function is in use.");
|
|
1451
1479
|
return;
|
|
1452
1480
|
}
|
|
1453
|
-
const r =
|
|
1454
|
-
if (
|
|
1455
|
-
throw g.error(
|
|
1456
|
-
const s = o.dataEndpoint || Yt;
|
|
1457
|
-
if (!Ot(s))
|
|
1458
|
-
throw g.error("Invalid data endpoint", { dataEndpoint: s }), new Error(`Invalid data endpoint: ${s}`);
|
|
1459
|
-
let i;
|
|
1460
|
-
r.type === "registered" ? i = `${s}/widgets/${encodeURIComponent(o.widgetId)}` : i = `${s}/public-widgets/${encodeURIComponent(o.name)}`;
|
|
1481
|
+
const s = r.type === "registered" ? void 0 : o.dataEndpoint, i = Ve(s);
|
|
1482
|
+
if (!Pt(i))
|
|
1483
|
+
throw g.error("Invalid data endpoint", { dataEndpoint: i }), new Error(`Invalid data endpoint: ${i}`);
|
|
1461
1484
|
const a = JSON.stringify(t);
|
|
1462
1485
|
try {
|
|
1463
|
-
|
|
1464
|
-
if (navigator.sendBeacon(i, a)) {
|
|
1465
|
-
g.debug("Successfully sent stats via sendBeacon");
|
|
1466
|
-
return;
|
|
1467
|
-
} else
|
|
1468
|
-
g.debug("sendBeacon failed, falling back to fetch");
|
|
1469
|
-
const l = await fetch(i, {
|
|
1470
|
-
body: a,
|
|
1471
|
-
method: "POST",
|
|
1472
|
-
keepalive: !0,
|
|
1473
|
-
headers: {
|
|
1474
|
-
"Content-Type": "application/json"
|
|
1475
|
-
}
|
|
1476
|
-
});
|
|
1477
|
-
if (!l.ok)
|
|
1478
|
-
throw new Error(`API request failed with status: ${l.status}`);
|
|
1479
|
-
g.debug("Successfully sent stats via fetch");
|
|
1486
|
+
await Jo(r, a, s);
|
|
1480
1487
|
} catch (l) {
|
|
1481
1488
|
throw g.error("Failed to send analytics:", l), l;
|
|
1482
1489
|
}
|
|
@@ -1493,9 +1500,9 @@ class Go {
|
|
|
1493
1500
|
sum: (o == null ? void 0 : o.sum) || 0,
|
|
1494
1501
|
avg: s,
|
|
1495
1502
|
pct: (o == null ? void 0 : o.pct) || 0,
|
|
1496
|
-
nps: r.type ===
|
|
1503
|
+
nps: r.type === $.nps ? Ct((o == null ? void 0 : o.breakdown) || {}) : 0
|
|
1497
1504
|
};
|
|
1498
|
-
return g.debug("Stats data: ", this.stats),
|
|
1505
|
+
return g.debug("Stats data: ", this.stats), Wo(t, i);
|
|
1499
1506
|
}
|
|
1500
1507
|
/**
|
|
1501
1508
|
* Checks if a value is selected in the local stats
|
|
@@ -1521,7 +1528,7 @@ class Go {
|
|
|
1521
1528
|
toggleValueSelected(t, o) {
|
|
1522
1529
|
const r = Object.keys(this.localStats.breakdown || {}), s = r.includes(t), i = this.host;
|
|
1523
1530
|
let a = 1;
|
|
1524
|
-
if ((i.type ===
|
|
1531
|
+
if ((i.type === $.stars || i.type === $.nps) && (a = parseInt(t)), s)
|
|
1525
1532
|
if (o) {
|
|
1526
1533
|
const n = r.filter((d) => d !== t);
|
|
1527
1534
|
this.updateStats(n.length > 0 ? 1 : 0, n);
|
|
@@ -1582,7 +1589,7 @@ class Go {
|
|
|
1582
1589
|
return ((t = this.localStats) == null ? void 0 : t.submitted) !== void 0 && this.hasLocalStats();
|
|
1583
1590
|
}
|
|
1584
1591
|
}
|
|
1585
|
-
class
|
|
1592
|
+
class tr {
|
|
1586
1593
|
constructor(t, o) {
|
|
1587
1594
|
this.isEditing = !0, this.isChartVisible = !1, this.isStatsVisible = !1, this.isThankYouVisible = !1, this.isReactionPopoverVisible = !1, this.initialized = !1, this.handleClickOutside = (r) => {
|
|
1588
1595
|
r.target !== this.host && (this.toggleThankYouVisibility(!1), this.toggleReactionPopoverVisibility(!1));
|
|
@@ -1670,8 +1677,8 @@ class Zo {
|
|
|
1670
1677
|
return !(this.host.readonly || !this.isEditing);
|
|
1671
1678
|
}
|
|
1672
1679
|
}
|
|
1673
|
-
var
|
|
1674
|
-
function
|
|
1680
|
+
var Xt = /* @__PURE__ */ ((e) => (e.DECORATIVE = "decorative", e.FUNCTIONAL = "functional", e.STATUS = "status", e))(Xt || {});
|
|
1681
|
+
function qe(e, t = {}) {
|
|
1675
1682
|
const { type: o = "functional", alt: r, ariaLabel: s, isSelected: i } = t;
|
|
1676
1683
|
if (!e)
|
|
1677
1684
|
return { alt: "", ariaHidden: !0 };
|
|
@@ -1680,20 +1687,20 @@ function je(e, t = {}) {
|
|
|
1680
1687
|
o === "functional" && !r && !s && console.warn(
|
|
1681
1688
|
"No alt text or aria-label provided for functional icon. This may cause accessibility issues."
|
|
1682
1689
|
);
|
|
1683
|
-
const a = i ? " (selected)" : "", l =
|
|
1690
|
+
const a = i ? " (selected)" : "", l = Pt(e) && !r ? "" : r || e, n = s || (l ? `${l}${a}` : a);
|
|
1684
1691
|
return {
|
|
1685
1692
|
alt: l,
|
|
1686
1693
|
ariaLabel: n,
|
|
1687
1694
|
ariaHidden: !1
|
|
1688
1695
|
};
|
|
1689
1696
|
}
|
|
1690
|
-
function
|
|
1697
|
+
function er(e, t = "polite") {
|
|
1691
1698
|
let o = document.getElementById("screen-reader-announcer");
|
|
1692
1699
|
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(() => {
|
|
1693
1700
|
o.textContent = e;
|
|
1694
1701
|
}, 50);
|
|
1695
1702
|
}
|
|
1696
|
-
function
|
|
1703
|
+
function or(e, t) {
|
|
1697
1704
|
return `${e}: ${t}`;
|
|
1698
1705
|
}
|
|
1699
1706
|
/**
|
|
@@ -1701,8 +1708,8 @@ function Jo(e, t) {
|
|
|
1701
1708
|
* Copyright 2017 Google LLC
|
|
1702
1709
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1703
1710
|
*/
|
|
1704
|
-
const
|
|
1705
|
-
let
|
|
1711
|
+
const He = { ATTRIBUTE: 1 }, Fe = (e) => (...t) => ({ _$litDirective$: e, values: t });
|
|
1712
|
+
let Ye = class {
|
|
1706
1713
|
constructor(t) {
|
|
1707
1714
|
}
|
|
1708
1715
|
get _$AU() {
|
|
@@ -1723,10 +1730,10 @@ let Fe = class {
|
|
|
1723
1730
|
* Copyright 2018 Google LLC
|
|
1724
1731
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1725
1732
|
*/
|
|
1726
|
-
const
|
|
1733
|
+
const w = Fe(class extends Ye {
|
|
1727
1734
|
constructor(e) {
|
|
1728
1735
|
var t;
|
|
1729
|
-
if (super(e), e.type !==
|
|
1736
|
+
if (super(e), e.type !== He.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.");
|
|
1730
1737
|
}
|
|
1731
1738
|
render(e) {
|
|
1732
1739
|
return " " + Object.keys(e).filter((t) => e[t]).join(" ") + " ";
|
|
@@ -1744,21 +1751,21 @@ const y = He(class extends Fe {
|
|
|
1744
1751
|
const a = !!t[i];
|
|
1745
1752
|
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)));
|
|
1746
1753
|
}
|
|
1747
|
-
return
|
|
1754
|
+
return j;
|
|
1748
1755
|
}
|
|
1749
1756
|
});
|
|
1750
|
-
var
|
|
1757
|
+
var rr = Object.defineProperty, v = (e, t, o, r) => {
|
|
1751
1758
|
for (var s = void 0, i = e.length - 1, a; i >= 0; i--)
|
|
1752
1759
|
(a = e[i]) && (s = a(t, o, s) || s);
|
|
1753
|
-
return s &&
|
|
1760
|
+
return s && rr(t, o, s), s;
|
|
1754
1761
|
};
|
|
1755
|
-
const
|
|
1762
|
+
const bt = {
|
|
1756
1763
|
mobile: "480px",
|
|
1757
1764
|
tablet: "768px",
|
|
1758
1765
|
desktop: "1024px"
|
|
1759
|
-
},
|
|
1766
|
+
}, Jt = class Jt extends N {
|
|
1760
1767
|
constructor() {
|
|
1761
|
-
super(...arguments), this.dataController = new
|
|
1768
|
+
super(...arguments), this.dataController = new Qo(this), this.displayController = new tr(this, this.dataController), this.hasEditButton = !0, this.showStats = "never", this.showChart = !1, this.initialized = !1, this.ariaLabel = null, this.minContrast = Me.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) => {
|
|
1762
1769
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.handleEnterEditMode());
|
|
1763
1770
|
};
|
|
1764
1771
|
}
|
|
@@ -1790,10 +1797,10 @@ const $t = {
|
|
|
1790
1797
|
let o = `:host {
|
|
1791
1798
|
`;
|
|
1792
1799
|
if (this.primaryColor) {
|
|
1793
|
-
const i =
|
|
1800
|
+
const i = Q(this.primaryColor);
|
|
1794
1801
|
o += `--pc-primary-color: ${i} !important;
|
|
1795
1802
|
`;
|
|
1796
|
-
const a =
|
|
1803
|
+
const a = To(i, {
|
|
1797
1804
|
minContrast: this.minContrast,
|
|
1798
1805
|
colorOptions: ["black", "white", "light", "dark"]
|
|
1799
1806
|
});
|
|
@@ -1801,56 +1808,56 @@ const $t = {
|
|
|
1801
1808
|
`;
|
|
1802
1809
|
}
|
|
1803
1810
|
if (this.muteColor) {
|
|
1804
|
-
const i =
|
|
1811
|
+
const i = Q(this.muteColor);
|
|
1805
1812
|
o += `--pc-mute-color: ${i} !important;
|
|
1806
1813
|
`;
|
|
1807
1814
|
}
|
|
1808
1815
|
if (this.textColor) {
|
|
1809
|
-
const i =
|
|
1816
|
+
const i = Q(this.textColor);
|
|
1810
1817
|
o += `--pc-text-color: ${i} !important;
|
|
1811
1818
|
`;
|
|
1812
1819
|
}
|
|
1813
1820
|
if (this.backgroundColor) {
|
|
1814
|
-
const i =
|
|
1821
|
+
const i = Q(this.backgroundColor);
|
|
1815
1822
|
o += `--pc-background-color: ${i} !important;
|
|
1816
1823
|
`;
|
|
1817
1824
|
}
|
|
1818
1825
|
const r = this.starColor || this.accentColor || this.primaryColor;
|
|
1819
1826
|
if (r) {
|
|
1820
|
-
const i =
|
|
1827
|
+
const i = Q(r);
|
|
1821
1828
|
o += `--pc-star-color: ${i} !important;
|
|
1822
1829
|
`;
|
|
1823
1830
|
}
|
|
1824
|
-
const s = this.starHoverColor || (r ? `color-mix(in srgb, ${
|
|
1831
|
+
const s = this.starHoverColor || (r ? `color-mix(in srgb, ${Q(r)} 80%, white)` : null);
|
|
1825
1832
|
if (s && (o += `--pc-star-hover-color: ${s} !important;
|
|
1826
1833
|
`), this.starSize) {
|
|
1827
|
-
const i =
|
|
1834
|
+
const i = Vt(this.starSize, "1.5em", 1.5);
|
|
1828
1835
|
o += `--pc-stars-star-size: ${i} !important;
|
|
1829
1836
|
`;
|
|
1830
1837
|
}
|
|
1831
1838
|
if (this.reactionSize) {
|
|
1832
|
-
const i =
|
|
1839
|
+
const i = Vt(this.reactionSize, "1em", 1);
|
|
1833
1840
|
o += `--pc-reaction-size: ${i} !important;
|
|
1834
1841
|
`;
|
|
1835
1842
|
}
|
|
1836
1843
|
if (this.size) {
|
|
1837
|
-
const i =
|
|
1844
|
+
const i = Vt(this.size);
|
|
1838
1845
|
o += `font-size: ${i} !important;
|
|
1839
1846
|
`;
|
|
1840
1847
|
}
|
|
1841
1848
|
if (this.buttonRadius) {
|
|
1842
|
-
const i =
|
|
1849
|
+
const i = Oo(this.buttonRadius);
|
|
1843
1850
|
o += `--pc-button-radius: ${i} !important;
|
|
1844
1851
|
`;
|
|
1845
1852
|
}
|
|
1846
1853
|
o += `}
|
|
1847
|
-
`, this.css && (o +=
|
|
1854
|
+
`, this.css && (o += No(Lo(this.css))), t.textContent = o;
|
|
1848
1855
|
}
|
|
1849
1856
|
/**
|
|
1850
1857
|
* Update ARIA attributes for accessibility
|
|
1851
1858
|
*/
|
|
1852
1859
|
updateAriaAttributes() {
|
|
1853
|
-
this.ariaLabel &&
|
|
1860
|
+
this.ariaLabel && Ut(this, "aria-label", this.ariaLabel), this.ariaDescribedby && Ut(this, "aria-describedby", this.ariaDescribedby), Ut(this, "aria-busy", this.dataController.isLoading ? "true" : "false");
|
|
1854
1861
|
}
|
|
1855
1862
|
/**
|
|
1856
1863
|
* Update host CSS classes based on state
|
|
@@ -1863,11 +1870,11 @@ const $t = {
|
|
|
1863
1870
|
*/
|
|
1864
1871
|
getBreakpointClasses() {
|
|
1865
1872
|
return {
|
|
1866
|
-
"pc-mobile": window.matchMedia(`(max-width: ${
|
|
1873
|
+
"pc-mobile": window.matchMedia(`(max-width: ${bt.mobile})`).matches,
|
|
1867
1874
|
"pc-tablet": window.matchMedia(
|
|
1868
|
-
`(min-width: ${
|
|
1875
|
+
`(min-width: ${bt.mobile}) and (max-width: ${bt.tablet})`
|
|
1869
1876
|
).matches,
|
|
1870
|
-
"pc-desktop": window.matchMedia(`(min-width: ${
|
|
1877
|
+
"pc-desktop": window.matchMedia(`(min-width: ${bt.desktop})`).matches
|
|
1871
1878
|
};
|
|
1872
1879
|
}
|
|
1873
1880
|
/**
|
|
@@ -1875,7 +1882,7 @@ const $t = {
|
|
|
1875
1882
|
*/
|
|
1876
1883
|
announceSelectionChange(t, o, r) {
|
|
1877
1884
|
const s = `Poll for "${t}"`, i = r ? `${o.label} selected` : `${o.label} unselected`;
|
|
1878
|
-
|
|
1885
|
+
er(or(s, i));
|
|
1879
1886
|
}
|
|
1880
1887
|
/** Common render methods */
|
|
1881
1888
|
renderLabel() {
|
|
@@ -1906,7 +1913,7 @@ const $t = {
|
|
|
1906
1913
|
tabindex="0"
|
|
1907
1914
|
aria-label="Edit vote"
|
|
1908
1915
|
@keydown="${this.handleEditToggleKeyDown}"
|
|
1909
|
-
>${
|
|
1916
|
+
>${St}</span
|
|
1910
1917
|
>
|
|
1911
1918
|
` : u;
|
|
1912
1919
|
}
|
|
@@ -1925,7 +1932,7 @@ const $t = {
|
|
|
1925
1932
|
tabindex="0"
|
|
1926
1933
|
aria-label="${this.displayController.isChartVisible ? "Hide chart" : "Show chart"}"
|
|
1927
1934
|
@keydown="${() => this.displayController.toggleChartVisibility()}"
|
|
1928
|
-
>${this.displayController.isChartVisible ?
|
|
1935
|
+
>${this.displayController.isChartVisible ? Gt : Kt}</span
|
|
1929
1936
|
>
|
|
1930
1937
|
` : u;
|
|
1931
1938
|
}
|
|
@@ -1934,9 +1941,9 @@ const $t = {
|
|
|
1934
1941
|
return u;
|
|
1935
1942
|
const o = {
|
|
1936
1943
|
"pc-status": !0,
|
|
1937
|
-
[`pc-flex-content-${
|
|
1944
|
+
[`pc-flex-content-${_(this.statsPosition, this.statsAlign)}`]: !0
|
|
1938
1945
|
};
|
|
1939
|
-
return c`<div class="${
|
|
1946
|
+
return c`<div class="${w(o)}" data-testid="pc-status">
|
|
1940
1947
|
${this.renderStatsText()} ${this.renderChartToggle()} ${this.renderEditToggleIcon()}
|
|
1941
1948
|
</div>`;
|
|
1942
1949
|
}
|
|
@@ -1952,7 +1959,7 @@ const $t = {
|
|
|
1952
1959
|
renderThankYouMessage() {
|
|
1953
1960
|
if (!this.displayController.shouldDisplayThankYouMsg())
|
|
1954
1961
|
return u;
|
|
1955
|
-
const t =
|
|
1962
|
+
const t = Go(this.thankYouMsg || "");
|
|
1956
1963
|
return c`
|
|
1957
1964
|
<div class="pc-thank-you-overlay" data-testid="poll-thank-you-overlay">
|
|
1958
1965
|
<div class="pc-thank-you" data-testid="thank-you">
|
|
@@ -1964,7 +1971,7 @@ const $t = {
|
|
|
1964
1971
|
@click="${() => this.displayController.toggleThankYouVisibility(!1)}"
|
|
1965
1972
|
role="button"
|
|
1966
1973
|
aria-label="Close"
|
|
1967
|
-
>${
|
|
1974
|
+
>${At}</span
|
|
1968
1975
|
>
|
|
1969
1976
|
</div>
|
|
1970
1977
|
</div>
|
|
@@ -1972,8 +1979,8 @@ const $t = {
|
|
|
1972
1979
|
`;
|
|
1973
1980
|
}
|
|
1974
1981
|
};
|
|
1975
|
-
|
|
1976
|
-
|
|
1982
|
+
Jt.styles = [
|
|
1983
|
+
R`
|
|
1977
1984
|
:host {
|
|
1978
1985
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
1979
1986
|
--default-font-size-base: 1rem;
|
|
@@ -2053,7 +2060,7 @@ oe.styles = [
|
|
|
2053
2060
|
}
|
|
2054
2061
|
`
|
|
2055
2062
|
];
|
|
2056
|
-
let m =
|
|
2063
|
+
let m = Jt;
|
|
2057
2064
|
v([
|
|
2058
2065
|
h({ type: String, attribute: "show-stats" })
|
|
2059
2066
|
], m.prototype, "showStats");
|
|
@@ -2159,7 +2166,7 @@ v([
|
|
|
2159
2166
|
v([
|
|
2160
2167
|
h({ type: Boolean, reflect: !0 })
|
|
2161
2168
|
], m.prototype, "readonly");
|
|
2162
|
-
const
|
|
2169
|
+
const sr = R`
|
|
2163
2170
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
2164
2171
|
|
|
2165
2172
|
.pc-body {
|
|
@@ -2610,7 +2617,7 @@ const tr = V`
|
|
|
2610
2617
|
animation: none;
|
|
2611
2618
|
}
|
|
2612
2619
|
}
|
|
2613
|
-
`,
|
|
2620
|
+
`, Tt = R`
|
|
2614
2621
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
2615
2622
|
:host {
|
|
2616
2623
|
--default-primary-color: #2196f3;
|
|
@@ -3329,7 +3336,7 @@ const tr = V`
|
|
|
3329
3336
|
opacity: 1;
|
|
3330
3337
|
}
|
|
3331
3338
|
}
|
|
3332
|
-
`,
|
|
3339
|
+
`, ir = R`
|
|
3333
3340
|
:host {
|
|
3334
3341
|
--popover-bg: light-dark(#ffffff, #1a1a1a);
|
|
3335
3342
|
--popover-border: light-dark(#e0e0e0, #333333);
|
|
@@ -3451,12 +3458,12 @@ const tr = V`
|
|
|
3451
3458
|
max-width: 100%;
|
|
3452
3459
|
}
|
|
3453
3460
|
`;
|
|
3454
|
-
var
|
|
3455
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3461
|
+
var ar = Object.defineProperty, nr = Object.getOwnPropertyDescriptor, B = (e, t, o, r) => {
|
|
3462
|
+
for (var s = r > 1 ? void 0 : r ? nr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3456
3463
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3457
|
-
return r && s &&
|
|
3464
|
+
return r && s && ar(t, o, s), s;
|
|
3458
3465
|
};
|
|
3459
|
-
let
|
|
3466
|
+
let T = class extends N {
|
|
3460
3467
|
constructor() {
|
|
3461
3468
|
super(...arguments), this.open = !1, this.position = "auto", this.isClosing = !1, this.computedPosition = "bottom", this.popoverStyles = {}, this.arrowStyles = {}, this.updatePosition = () => {
|
|
3462
3469
|
var f;
|
|
@@ -3464,8 +3471,8 @@ let _ = class extends B {
|
|
|
3464
3471
|
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;
|
|
3465
3472
|
let l = this.position;
|
|
3466
3473
|
if (l === "auto") {
|
|
3467
|
-
const b = o - e.bottom,
|
|
3468
|
-
l = b >= a + r || b >=
|
|
3474
|
+
const b = o - e.bottom, y = e.top;
|
|
3475
|
+
l = b >= a + r || b >= y ? "bottom" : "top";
|
|
3469
3476
|
}
|
|
3470
3477
|
this.computedPosition = l;
|
|
3471
3478
|
let n, d;
|
|
@@ -3529,7 +3536,7 @@ let _ = class extends B {
|
|
|
3529
3536
|
return c`
|
|
3530
3537
|
<div class="pc-popover-scrim" @click=${this.handleScrimClick}></div>
|
|
3531
3538
|
<div
|
|
3532
|
-
class=${
|
|
3539
|
+
class=${w(e)}
|
|
3533
3540
|
data-position=${this.computedPosition}
|
|
3534
3541
|
style=${Object.entries(this.popoverStyles).map(([t, o]) => `${t}: ${o}`).join("; ")}
|
|
3535
3542
|
role="dialog"
|
|
@@ -3545,35 +3552,35 @@ let _ = class extends B {
|
|
|
3545
3552
|
`;
|
|
3546
3553
|
}
|
|
3547
3554
|
};
|
|
3548
|
-
|
|
3549
|
-
|
|
3555
|
+
T.styles = [ir];
|
|
3556
|
+
B([
|
|
3550
3557
|
h({ type: Boolean, reflect: !0 })
|
|
3551
|
-
],
|
|
3552
|
-
|
|
3558
|
+
], T.prototype, "open", 2);
|
|
3559
|
+
B([
|
|
3553
3560
|
h({ type: String })
|
|
3554
|
-
],
|
|
3555
|
-
|
|
3561
|
+
], T.prototype, "position", 2);
|
|
3562
|
+
B([
|
|
3556
3563
|
h({ attribute: !1 })
|
|
3557
|
-
],
|
|
3558
|
-
|
|
3564
|
+
], T.prototype, "anchor", 2);
|
|
3565
|
+
B([
|
|
3559
3566
|
C()
|
|
3560
|
-
],
|
|
3561
|
-
|
|
3567
|
+
], T.prototype, "isClosing", 2);
|
|
3568
|
+
B([
|
|
3562
3569
|
C()
|
|
3563
|
-
],
|
|
3564
|
-
|
|
3570
|
+
], T.prototype, "computedPosition", 2);
|
|
3571
|
+
B([
|
|
3565
3572
|
C()
|
|
3566
|
-
],
|
|
3567
|
-
|
|
3573
|
+
], T.prototype, "popoverStyles", 2);
|
|
3574
|
+
B([
|
|
3568
3575
|
C()
|
|
3569
|
-
],
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
],
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
],
|
|
3576
|
-
const
|
|
3576
|
+
], T.prototype, "arrowStyles", 2);
|
|
3577
|
+
B([
|
|
3578
|
+
ft(".pc-popover")
|
|
3579
|
+
], T.prototype, "popoverElement", 2);
|
|
3580
|
+
T = B([
|
|
3581
|
+
F("pc-popover")
|
|
3582
|
+
], T);
|
|
3583
|
+
const lr = R`
|
|
3577
3584
|
:host {
|
|
3578
3585
|
--sheet-bg: light-dark(#ffffff, #1a1a1a);
|
|
3579
3586
|
--sheet-border: light-dark(#e0e0e0, #333333);
|
|
@@ -3686,12 +3693,12 @@ const sr = V`
|
|
|
3686
3693
|
max-width: 100%;
|
|
3687
3694
|
}
|
|
3688
3695
|
`;
|
|
3689
|
-
var
|
|
3690
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3696
|
+
var cr = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, J = (e, t, o, r) => {
|
|
3697
|
+
for (var s = r > 1 ? void 0 : r ? dr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3691
3698
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3692
|
-
return r && s &&
|
|
3699
|
+
return r && s && cr(t, o, s), s;
|
|
3693
3700
|
};
|
|
3694
|
-
let
|
|
3701
|
+
let D = class extends N {
|
|
3695
3702
|
constructor() {
|
|
3696
3703
|
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) => {
|
|
3697
3704
|
if (e.key === "Escape" && this.open && (e.preventDefault(), e.stopPropagation(), this.close()), e.key === "Tab" && this.open && this.sheetElement) {
|
|
@@ -3769,8 +3776,8 @@ let U = class extends B {
|
|
|
3769
3776
|
dragging: this.isDragging
|
|
3770
3777
|
};
|
|
3771
3778
|
return c`
|
|
3772
|
-
<div class=${
|
|
3773
|
-
<div class=${
|
|
3779
|
+
<div class=${w(e)} @click=${this.handleScrimClick}></div>
|
|
3780
|
+
<div class=${w(t)} role="dialog" aria-modal="true" tabindex="-1">
|
|
3774
3781
|
<div
|
|
3775
3782
|
class="pc-sheet-handle"
|
|
3776
3783
|
@touchstart=${this.handleDragStart}
|
|
@@ -3785,35 +3792,35 @@ let U = class extends B {
|
|
|
3785
3792
|
`;
|
|
3786
3793
|
}
|
|
3787
3794
|
};
|
|
3788
|
-
|
|
3789
|
-
|
|
3795
|
+
D.styles = [lr];
|
|
3796
|
+
J([
|
|
3790
3797
|
h({ type: Boolean, reflect: !0 })
|
|
3791
|
-
],
|
|
3792
|
-
|
|
3798
|
+
], D.prototype, "open", 2);
|
|
3799
|
+
J([
|
|
3793
3800
|
h({ type: Boolean, attribute: "drag-to-close" })
|
|
3794
|
-
],
|
|
3795
|
-
|
|
3801
|
+
], D.prototype, "dragToClose", 2);
|
|
3802
|
+
J([
|
|
3796
3803
|
C()
|
|
3797
|
-
],
|
|
3798
|
-
|
|
3804
|
+
], D.prototype, "isClosing", 2);
|
|
3805
|
+
J([
|
|
3799
3806
|
C()
|
|
3800
|
-
],
|
|
3801
|
-
|
|
3807
|
+
], D.prototype, "isDragging", 2);
|
|
3808
|
+
J([
|
|
3802
3809
|
C()
|
|
3803
|
-
],
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
],
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
],
|
|
3810
|
-
var
|
|
3811
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3810
|
+
], D.prototype, "dragOffset", 2);
|
|
3811
|
+
J([
|
|
3812
|
+
ft(".pc-bottom-sheet")
|
|
3813
|
+
], D.prototype, "sheetElement", 2);
|
|
3814
|
+
D = J([
|
|
3815
|
+
F("pc-bottom-sheet")
|
|
3816
|
+
], D);
|
|
3817
|
+
var pr = Object.defineProperty, ur = Object.getOwnPropertyDescriptor, gt = (e, t, o, r) => {
|
|
3818
|
+
for (var s = r > 1 ? void 0 : r ? ur(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3812
3819
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3813
|
-
return r && s &&
|
|
3820
|
+
return r && s && pr(t, o, s), s;
|
|
3814
3821
|
};
|
|
3815
|
-
const
|
|
3816
|
-
let
|
|
3822
|
+
const hr = 768;
|
|
3823
|
+
let Z = class extends N {
|
|
3817
3824
|
constructor() {
|
|
3818
3825
|
super(...arguments), this.open = !1, this.position = "auto", this.isMobile = !1, this.handleMediaChange = (e) => {
|
|
3819
3826
|
this.isMobile = e.matches;
|
|
@@ -3829,7 +3836,7 @@ let tt = class extends B {
|
|
|
3829
3836
|
super.disconnectedCallback(), (e = this.mediaQuery) == null || e.removeEventListener("change", this.handleMediaChange);
|
|
3830
3837
|
}
|
|
3831
3838
|
setupMediaQuery() {
|
|
3832
|
-
this.mediaQuery = window.matchMedia(`(max-width: ${
|
|
3839
|
+
this.mediaQuery = window.matchMedia(`(max-width: ${hr - 1}px)`), this.isMobile = this.mediaQuery.matches, this.mediaQuery.addEventListener("change", this.handleMediaChange);
|
|
3833
3840
|
}
|
|
3834
3841
|
render() {
|
|
3835
3842
|
return this.isMobile ? c`
|
|
@@ -3848,34 +3855,34 @@ let tt = class extends B {
|
|
|
3848
3855
|
`;
|
|
3849
3856
|
}
|
|
3850
3857
|
};
|
|
3851
|
-
|
|
3858
|
+
Z.styles = R`
|
|
3852
3859
|
:host {
|
|
3853
3860
|
display: contents;
|
|
3854
3861
|
}
|
|
3855
3862
|
`;
|
|
3856
|
-
|
|
3863
|
+
gt([
|
|
3857
3864
|
h({ type: Boolean, reflect: !0 })
|
|
3858
|
-
],
|
|
3859
|
-
|
|
3865
|
+
], Z.prototype, "open", 2);
|
|
3866
|
+
gt([
|
|
3860
3867
|
h({ type: String })
|
|
3861
|
-
],
|
|
3862
|
-
|
|
3868
|
+
], Z.prototype, "position", 2);
|
|
3869
|
+
gt([
|
|
3863
3870
|
h({ attribute: !1 })
|
|
3864
|
-
],
|
|
3865
|
-
|
|
3871
|
+
], Z.prototype, "anchor", 2);
|
|
3872
|
+
gt([
|
|
3866
3873
|
C()
|
|
3867
|
-
],
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
],
|
|
3871
|
-
var
|
|
3872
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3874
|
+
], Z.prototype, "isMobile", 2);
|
|
3875
|
+
Z = gt([
|
|
3876
|
+
F("pc-responsive-modal")
|
|
3877
|
+
], Z);
|
|
3878
|
+
var fr = Object.defineProperty, gr = Object.getOwnPropertyDescriptor, Y = (e, t, o, r) => {
|
|
3879
|
+
for (var s = r > 1 ? void 0 : r ? gr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3873
3880
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3874
|
-
return r && s &&
|
|
3881
|
+
return r && s && fr(t, o, s), s;
|
|
3875
3882
|
};
|
|
3876
|
-
let
|
|
3883
|
+
let O = class extends m {
|
|
3877
3884
|
constructor() {
|
|
3878
|
-
super(), this.min = 0, this.max = 10, this.type =
|
|
3885
|
+
super(), this.min = 0, this.max = 10, this.type = $.nps, this.minLabel = "Not at all", this.maxLabel = "Extremely", this.minMaxPosition = "top", this.hoverValue = -1, this.popoverOpen = !1, this.handleNumberLeave = () => {
|
|
3879
3886
|
this.hoverValue = -1;
|
|
3880
3887
|
}, this.handleKeyDown = (e) => {
|
|
3881
3888
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.hoverValue >= 0 && this.handleNumberClick(this.hoverValue));
|
|
@@ -3885,20 +3892,20 @@ let I = class extends m {
|
|
|
3885
3892
|
* Render NPS buttons for edit mode
|
|
3886
3893
|
*/
|
|
3887
3894
|
renderNpsButtons() {
|
|
3888
|
-
const e = Array.from({ length: this.max - this.min + 1 }, (s, i) => i + this.min), t = `nps-control-${this.name || this.type}`, o =
|
|
3889
|
-
role:
|
|
3895
|
+
const e = Array.from({ length: this.max - this.min + 1 }, (s, i) => i + this.min), t = `nps-control-${this.name || this.type}`, o = et({
|
|
3896
|
+
role: M.GROUP,
|
|
3890
3897
|
ariaLabel: this.question || "NPS Rating",
|
|
3891
3898
|
ariaDescribedby: `${t}-description`
|
|
3892
3899
|
}), r = e.map((s) => {
|
|
3893
3900
|
const i = this.dataController.isValueSelected(String(s)), a = {
|
|
3894
3901
|
"nps-button": !0,
|
|
3895
3902
|
selected: i
|
|
3896
|
-
}, l =
|
|
3903
|
+
}, l = Io(`Rate ${s}`, i, !1);
|
|
3897
3904
|
return c`
|
|
3898
3905
|
<button
|
|
3899
3906
|
data-testid="nps-button-${s}"
|
|
3900
3907
|
?disabled=${!this.displayController.allowEdit()}
|
|
3901
|
-
class=${
|
|
3908
|
+
class=${w(a)}
|
|
3902
3909
|
@click="${() => this.handleNumberClick(s)}"
|
|
3903
3910
|
@mouseenter="${() => this.handleNumberHover(s)}"
|
|
3904
3911
|
@focus="${() => this.handleNumberHover(s)}"
|
|
@@ -3937,10 +3944,10 @@ let I = class extends m {
|
|
|
3937
3944
|
* NPS score displayed prominently in the middle
|
|
3938
3945
|
*/
|
|
3939
3946
|
renderChart() {
|
|
3940
|
-
const e = this.dataController.stats, t = (e == null ? void 0 : e.nps) ?? 0, o = 100, r = 100, s = 80, i = (
|
|
3941
|
-
x: o + s * Math.cos(
|
|
3942
|
-
y: r - s * Math.sin(
|
|
3943
|
-
}), a = i(Math.PI), l = i(Math.PI / 2), n = i(Math.PI / 4), d = i(0), p = (
|
|
3947
|
+
const e = this.dataController.stats, t = (e == null ? void 0 : e.nps) ?? 0, o = 100, r = 100, s = 80, i = (I) => ({
|
|
3948
|
+
x: o + s * Math.cos(I),
|
|
3949
|
+
y: r - s * Math.sin(I)
|
|
3950
|
+
}), a = i(Math.PI), l = i(Math.PI / 2), n = i(Math.PI / 4), d = i(0), p = (I, Qt, Ke = 0) => `M ${I.x} ${I.y} A ${s} ${s} 0 ${Ke} 1 ${Qt.x} ${Qt.y}`, f = p(a, l), b = p(l, n), y = p(n, d), A = ((I) => Math.PI - (I + 100) / 200 * Math.PI)(t), k = i(A);
|
|
3944
3951
|
return c`
|
|
3945
3952
|
<div class="nps-semicircle-gauge" data-testid="nps-semicircle-gauge">
|
|
3946
3953
|
<svg viewBox="0 0 200 115">
|
|
@@ -3953,10 +3960,10 @@ let I = class extends m {
|
|
|
3953
3960
|
<!-- Colored segments -->
|
|
3954
3961
|
<path class="gauge-arc gauge-arc-detractor" d="${f}" />
|
|
3955
3962
|
<path class="gauge-arc gauge-arc-passive" d="${b}" />
|
|
3956
|
-
<path class="gauge-arc gauge-arc-promoter" d="${
|
|
3963
|
+
<path class="gauge-arc gauge-arc-promoter" d="${y}" />
|
|
3957
3964
|
|
|
3958
3965
|
<!-- Needle indicator -->
|
|
3959
|
-
<circle class="gauge-needle" cx="${
|
|
3966
|
+
<circle class="gauge-needle" cx="${k.x}" cy="${k.y}" r="5" />
|
|
3960
3967
|
|
|
3961
3968
|
<!-- Score display in center -->
|
|
3962
3969
|
<text class="gauge-score" x="${o}" y="${r - 15}">${t}</text>
|
|
@@ -4016,7 +4023,7 @@ let I = class extends m {
|
|
|
4016
4023
|
* Uses SVG with 3 colored segments for detractors/passives/promoters
|
|
4017
4024
|
*/
|
|
4018
4025
|
renderInlineGauge() {
|
|
4019
|
-
const e = this.dataController.stats, t = (e == null ? void 0 : e.breakdown) || {}, o = 8, r = 2 * Math.PI * o, s =
|
|
4026
|
+
const e = this.dataController.stats, t = (e == null ? void 0 : e.breakdown) || {}, o = 8, r = 2 * Math.PI * o, s = Vo(t), i = s.detractors + s.passives + s.promoters;
|
|
4020
4027
|
if (i === 0)
|
|
4021
4028
|
return c`
|
|
4022
4029
|
<div class="inline-nps-gauge">
|
|
@@ -4025,9 +4032,9 @@ let I = class extends m {
|
|
|
4025
4032
|
</svg>
|
|
4026
4033
|
</div>
|
|
4027
4034
|
`;
|
|
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,
|
|
4029
|
-
let
|
|
4030
|
-
return
|
|
4035
|
+
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, y = -d, x = -(d + p), A = this.getUserScore();
|
|
4036
|
+
let k = "gauge-bg";
|
|
4037
|
+
return A !== null && (A <= 6 ? k = "gauge-detractor" : A <= 8 ? k = "gauge-passive" : k = "gauge-promoter"), c`
|
|
4031
4038
|
<div class="inline-nps-gauge">
|
|
4032
4039
|
<svg viewBox="0 0 20 20">
|
|
4033
4040
|
<!-- Background circle -->
|
|
@@ -4048,7 +4055,7 @@ let I = class extends m {
|
|
|
4048
4055
|
cy="10"
|
|
4049
4056
|
r="${o}"
|
|
4050
4057
|
stroke-dasharray="${p} ${r}"
|
|
4051
|
-
stroke-dashoffset="${
|
|
4058
|
+
stroke-dashoffset="${y}"
|
|
4052
4059
|
/>
|
|
4053
4060
|
<!-- Promoter segment (green) -->
|
|
4054
4061
|
<circle
|
|
@@ -4057,10 +4064,10 @@ let I = class extends m {
|
|
|
4057
4064
|
cy="10"
|
|
4058
4065
|
r="${o}"
|
|
4059
4066
|
stroke-dasharray="${f} ${r}"
|
|
4060
|
-
stroke-dashoffset="${
|
|
4067
|
+
stroke-dashoffset="${x}"
|
|
4061
4068
|
/>
|
|
4062
4069
|
<!-- Center dot showing user's score category -->
|
|
4063
|
-
<circle class="gauge-dot ${
|
|
4070
|
+
<circle class="gauge-dot ${k}" cx="10" cy="10" r="2" />
|
|
4064
4071
|
</svg>
|
|
4065
4072
|
</div>
|
|
4066
4073
|
`;
|
|
@@ -4071,7 +4078,7 @@ let I = class extends m {
|
|
|
4071
4078
|
* Shows add icon when no selection, edit icon when user has submitted
|
|
4072
4079
|
*/
|
|
4073
4080
|
renderInlineTrigger() {
|
|
4074
|
-
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ?
|
|
4081
|
+
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ? St : _e;
|
|
4075
4082
|
return c`
|
|
4076
4083
|
<button
|
|
4077
4084
|
class="pc-inline-trigger"
|
|
@@ -4103,7 +4110,7 @@ let I = class extends m {
|
|
|
4103
4110
|
};
|
|
4104
4111
|
return c`
|
|
4105
4112
|
<button
|
|
4106
|
-
class=${
|
|
4113
|
+
class=${w(i)}
|
|
4107
4114
|
@click=${() => this.handlePopoverNumberClick(r)}
|
|
4108
4115
|
@mouseenter=${() => this.handleNumberHover(r)}
|
|
4109
4116
|
@mouseleave=${this.handleNumberLeave}
|
|
@@ -4137,7 +4144,7 @@ let I = class extends m {
|
|
|
4137
4144
|
@keydown="${(e) => {
|
|
4138
4145
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.displayController.toggleChartVisibility());
|
|
4139
4146
|
}}"
|
|
4140
|
-
>${this.displayController.isChartVisible ?
|
|
4147
|
+
>${this.displayController.isChartVisible ? Gt : Kt}</span
|
|
4141
4148
|
>
|
|
4142
4149
|
`;
|
|
4143
4150
|
}
|
|
@@ -4156,7 +4163,7 @@ let I = class extends m {
|
|
|
4156
4163
|
aria-label="Close"
|
|
4157
4164
|
data-testid="popover-close-button"
|
|
4158
4165
|
>
|
|
4159
|
-
${
|
|
4166
|
+
${At}
|
|
4160
4167
|
</button>
|
|
4161
4168
|
${this.question ? c`<div class="pc-popover-question">${this.question}</div>` : u}
|
|
4162
4169
|
${this.renderPopoverNpsButtons()}
|
|
@@ -4206,16 +4213,16 @@ let I = class extends m {
|
|
|
4206
4213
|
renderStandardMode() {
|
|
4207
4214
|
const e = {
|
|
4208
4215
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
4209
|
-
[`pc-flex-align-${
|
|
4216
|
+
[`pc-flex-align-${_(this.questionPosition, this.questionAlign)}`]: !0
|
|
4210
4217
|
}, t = {
|
|
4211
4218
|
nps: !0,
|
|
4212
4219
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
4213
|
-
[`pc-flex-align-${
|
|
4220
|
+
[`pc-flex-align-${_(this.statsPosition, this.statsAlign)}`]: !0
|
|
4214
4221
|
};
|
|
4215
4222
|
return c`
|
|
4216
|
-
<div class="pc-container ${
|
|
4223
|
+
<div class="pc-container ${w(e)}" data-testid="nps-container">
|
|
4217
4224
|
${this.renderLabelAtStart()}
|
|
4218
|
-
<div class="pc-body ${
|
|
4225
|
+
<div class="pc-body ${w(t)}" data-testid="nps-body">
|
|
4219
4226
|
${this.renderStatusAtStart()} ${this.renderContent()} ${this.renderStatusAtEnd()}
|
|
4220
4227
|
</div>
|
|
4221
4228
|
${this.renderLabelAtEnd()}
|
|
@@ -4229,32 +4236,32 @@ let I = class extends m {
|
|
|
4229
4236
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
4230
4237
|
}
|
|
4231
4238
|
};
|
|
4232
|
-
|
|
4233
|
-
|
|
4239
|
+
O.styles = [...m.styles, Tt, sr];
|
|
4240
|
+
Y([
|
|
4234
4241
|
h({ type: String, attribute: "min-label" })
|
|
4235
|
-
],
|
|
4236
|
-
|
|
4242
|
+
], O.prototype, "minLabel", 2);
|
|
4243
|
+
Y([
|
|
4237
4244
|
h({ type: String, attribute: "max-label" })
|
|
4238
|
-
],
|
|
4239
|
-
|
|
4245
|
+
], O.prototype, "maxLabel", 2);
|
|
4246
|
+
Y([
|
|
4240
4247
|
h({ type: String, attribute: "thank-you-msg" })
|
|
4241
|
-
],
|
|
4242
|
-
|
|
4248
|
+
], O.prototype, "thankYouMsg", 2);
|
|
4249
|
+
Y([
|
|
4243
4250
|
h({ type: String, attribute: "min-max-position" })
|
|
4244
|
-
],
|
|
4245
|
-
|
|
4251
|
+
], O.prototype, "minMaxPosition", 2);
|
|
4252
|
+
Y([
|
|
4246
4253
|
C()
|
|
4247
|
-
],
|
|
4248
|
-
|
|
4254
|
+
], O.prototype, "hoverValue", 2);
|
|
4255
|
+
Y([
|
|
4249
4256
|
C()
|
|
4250
|
-
],
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
],
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
],
|
|
4257
|
-
const
|
|
4257
|
+
], O.prototype, "popoverOpen", 2);
|
|
4258
|
+
Y([
|
|
4259
|
+
ft(".pc-inline-trigger")
|
|
4260
|
+
], O.prototype, "triggerElement", 2);
|
|
4261
|
+
O = Y([
|
|
4262
|
+
F("pc-nps")
|
|
4263
|
+
], O);
|
|
4264
|
+
const mr = R`
|
|
4258
4265
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
4259
4266
|
|
|
4260
4267
|
.pc-container {
|
|
@@ -4639,21 +4646,21 @@ const ur = V`
|
|
|
4639
4646
|
opacity: 0.8;
|
|
4640
4647
|
}
|
|
4641
4648
|
`;
|
|
4642
|
-
var
|
|
4643
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
4649
|
+
var vr = Object.defineProperty, br = Object.getOwnPropertyDescriptor, mt = (e, t, o, r) => {
|
|
4650
|
+
for (var s = r > 1 ? void 0 : r ? br(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
4644
4651
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
4645
|
-
return r && s &&
|
|
4652
|
+
return r && s && vr(t, o, s), s;
|
|
4646
4653
|
};
|
|
4647
|
-
let
|
|
4654
|
+
let X = class extends m {
|
|
4648
4655
|
constructor() {
|
|
4649
|
-
super(), this.type =
|
|
4656
|
+
super(), this.type = $.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";
|
|
4650
4657
|
}
|
|
4651
4658
|
renderStatus() {
|
|
4652
4659
|
const t = {
|
|
4653
4660
|
"pc-status": !0,
|
|
4654
|
-
[`pc-flex-content-${
|
|
4661
|
+
[`pc-flex-content-${_("bottom", this.statsAlign)}`]: !0
|
|
4655
4662
|
};
|
|
4656
|
-
return c`<div class="${
|
|
4663
|
+
return c`<div class="${w(t)}" data-testid="pc-status">
|
|
4657
4664
|
<span>${this.renderStatsText()} ${this.renderEditToggleIcon("stats-edit-button")}</span>
|
|
4658
4665
|
</div>`;
|
|
4659
4666
|
}
|
|
@@ -4668,7 +4675,7 @@ let et = class extends m {
|
|
|
4668
4675
|
}, t = this.displayController.shouldDisableSubmitButton();
|
|
4669
4676
|
return c`
|
|
4670
4677
|
<button
|
|
4671
|
-
class="${
|
|
4678
|
+
class="${w(e)}"
|
|
4672
4679
|
data-testid="pc-submit-button"
|
|
4673
4680
|
@click="${this.handleSubmit}"
|
|
4674
4681
|
?disabled="${t}"
|
|
@@ -4702,16 +4709,16 @@ let et = class extends m {
|
|
|
4702
4709
|
*/
|
|
4703
4710
|
renderOptionIcon(e) {
|
|
4704
4711
|
if (!(e != null && e.icon)) return "";
|
|
4705
|
-
const t =
|
|
4712
|
+
const t = Xt.DECORATIVE, o = (e == null ? void 0 : e.label) || "", r = e ? this.dataController.isValueSelected(e.value) : !1, s = qe(e == null ? void 0 : e.icon, {
|
|
4706
4713
|
type: t,
|
|
4707
4714
|
alt: o,
|
|
4708
4715
|
isSelected: r
|
|
4709
4716
|
});
|
|
4710
|
-
return
|
|
4717
|
+
return De(e == null ? void 0 : e.icon) ? c`<span
|
|
4711
4718
|
class="poll-option-icon"
|
|
4712
4719
|
aria-hidden="${s.ariaHidden ? "true" : "false"}"
|
|
4713
4720
|
>${e == null ? void 0 : e.icon}</span
|
|
4714
|
-
>` :
|
|
4721
|
+
>` : Pt(e == null ? void 0 : e.icon) ? c`<img
|
|
4715
4722
|
src="${e == null ? void 0 : e.icon}"
|
|
4716
4723
|
alt="${s.alt}"
|
|
4717
4724
|
class="poll-option-icon-img"
|
|
@@ -4727,7 +4734,7 @@ let et = class extends m {
|
|
|
4727
4734
|
* Renders the selection indicator (checkbox or radio button) with proper ARIA roles
|
|
4728
4735
|
*/
|
|
4729
4736
|
renderSelectionIndicator() {
|
|
4730
|
-
const e = this.multiple ?
|
|
4737
|
+
const e = this.multiple ? M.CHECKBOX : M.RADIO;
|
|
4731
4738
|
return this.multiple ? c`<span class="poll-checkbox" role="${e}"></span>` : c`<span class="poll-radio" role="${e}"></span>`;
|
|
4732
4739
|
}
|
|
4733
4740
|
/**
|
|
@@ -4739,7 +4746,7 @@ let et = class extends m {
|
|
|
4739
4746
|
selected: o,
|
|
4740
4747
|
"poll-option--compact": this.compact,
|
|
4741
4748
|
"poll-option--disabled": r
|
|
4742
|
-
}, i = t + 1, a = `poll-${this.type}-${i}`, l =
|
|
4749
|
+
}, i = t + 1, a = `poll-${this.type}-${i}`, l = zo(
|
|
4743
4750
|
e.label,
|
|
4744
4751
|
o,
|
|
4745
4752
|
r,
|
|
@@ -4749,7 +4756,7 @@ let et = class extends m {
|
|
|
4749
4756
|
return c`
|
|
4750
4757
|
<button
|
|
4751
4758
|
data-testid="poll-option-i${t}"
|
|
4752
|
-
class="${
|
|
4759
|
+
class="${w(s)}"
|
|
4753
4760
|
@click="${(n) => {
|
|
4754
4761
|
n.stopPropagation(), this.handleClick(e);
|
|
4755
4762
|
}}"
|
|
@@ -4773,13 +4780,13 @@ let et = class extends m {
|
|
|
4773
4780
|
*/
|
|
4774
4781
|
renderPollOptions() {
|
|
4775
4782
|
var s;
|
|
4776
|
-
const e = this.multiple ?
|
|
4783
|
+
const e = this.multiple ? M.GROUP : M.RADIOGROUP, t = this.question || this.name || "Options", o = et({
|
|
4777
4784
|
role: e,
|
|
4778
4785
|
ariaLabel: t
|
|
4779
4786
|
});
|
|
4780
4787
|
return c`
|
|
4781
4788
|
<div
|
|
4782
|
-
class="${
|
|
4789
|
+
class="${w({
|
|
4783
4790
|
"poll-container": !0
|
|
4784
4791
|
})}"
|
|
4785
4792
|
data-testid="poll-option-container"
|
|
@@ -4796,21 +4803,21 @@ let et = class extends m {
|
|
|
4796
4803
|
renderBarChart() {
|
|
4797
4804
|
var n, d;
|
|
4798
4805
|
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,
|
|
4806
|
+
const b = e[p.value] || 0, y = o > 0 ? Math.round(b / o * 100) : 0, x = (t[p.value] || 0) > 0;
|
|
4800
4807
|
return {
|
|
4801
4808
|
option: p,
|
|
4802
4809
|
index: f,
|
|
4803
4810
|
voteCount: b,
|
|
4804
|
-
percentage:
|
|
4805
|
-
isSelected:
|
|
4811
|
+
percentage: y,
|
|
4812
|
+
isSelected: x
|
|
4806
4813
|
};
|
|
4807
|
-
}), s = this.multiple ?
|
|
4814
|
+
}), s = this.multiple ? M.GROUP : M.RADIOGROUP, i = this.question || this.name || "Options", a = et({
|
|
4808
4815
|
role: s,
|
|
4809
4816
|
ariaLabel: i
|
|
4810
4817
|
});
|
|
4811
4818
|
return c`
|
|
4812
4819
|
<div
|
|
4813
|
-
class="${
|
|
4820
|
+
class="${w({
|
|
4814
4821
|
"poll-container": !0
|
|
4815
4822
|
})}"
|
|
4816
4823
|
data-testid="poll-chart-container"
|
|
@@ -4826,7 +4833,7 @@ let et = class extends m {
|
|
|
4826
4833
|
};
|
|
4827
4834
|
return c`
|
|
4828
4835
|
<div
|
|
4829
|
-
class="${
|
|
4836
|
+
class="${w(f)}"
|
|
4830
4837
|
data-testid="poll-chart-item-${p.index}"
|
|
4831
4838
|
role="listitem"
|
|
4832
4839
|
aria-label="${p.option.label}: ${p.percentage}% (${p.voteCount} votes)"
|
|
@@ -4897,7 +4904,7 @@ let et = class extends m {
|
|
|
4897
4904
|
* Shows add icon when no selection, edit icon when user has submitted
|
|
4898
4905
|
*/
|
|
4899
4906
|
renderInlineTrigger() {
|
|
4900
|
-
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ?
|
|
4907
|
+
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ? St : _e;
|
|
4901
4908
|
return c`
|
|
4902
4909
|
<button
|
|
4903
4910
|
class="pc-inline-trigger"
|
|
@@ -4956,7 +4963,7 @@ let et = class extends m {
|
|
|
4956
4963
|
aria-label="Close"
|
|
4957
4964
|
data-testid="popover-close-button"
|
|
4958
4965
|
>
|
|
4959
|
-
${
|
|
4966
|
+
${At}
|
|
4960
4967
|
</button>
|
|
4961
4968
|
${this.question ? c`<div class="pc-popover-question">${this.question}</div>` : u}
|
|
4962
4969
|
${e ? this.renderBarChart() : this.renderPollOptions()}
|
|
@@ -4973,7 +4980,7 @@ let et = class extends m {
|
|
|
4973
4980
|
@keydown=${(s) => {
|
|
4974
4981
|
(s.key === "Enter" || s.key === " ") && (s.preventDefault(), this.handlePopoverEditClick());
|
|
4975
4982
|
}}
|
|
4976
|
-
>${
|
|
4983
|
+
>${St}</span
|
|
4977
4984
|
>` : u}
|
|
4978
4985
|
</div>` : u}
|
|
4979
4986
|
</div>
|
|
@@ -5030,25 +5037,25 @@ let et = class extends m {
|
|
|
5030
5037
|
* Render standard mode - original behavior
|
|
5031
5038
|
*/
|
|
5032
5039
|
renderStandardMode() {
|
|
5033
|
-
const e =
|
|
5040
|
+
const e = _(this.questionPosition, this.questionAlign), t = {
|
|
5034
5041
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
5035
5042
|
[`pc-flex-align-${e}`]: !0
|
|
5036
|
-
}, o =
|
|
5043
|
+
}, o = _(this.statsPosition, this.statsAlign), r = {
|
|
5037
5044
|
"pc-body": !0,
|
|
5038
5045
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5039
5046
|
[`pc-flex-align-${o}`]: !0
|
|
5040
|
-
}, s =
|
|
5041
|
-
role:
|
|
5047
|
+
}, s = et({
|
|
5048
|
+
role: M.REGION,
|
|
5042
5049
|
ariaLabel: this.question || this.name || "Poll"
|
|
5043
5050
|
});
|
|
5044
5051
|
return c`
|
|
5045
5052
|
<div
|
|
5046
|
-
class="pc-container ${
|
|
5053
|
+
class="pc-container ${w(t)}"
|
|
5047
5054
|
data-testid="poll-container"
|
|
5048
5055
|
...=${s}
|
|
5049
5056
|
>
|
|
5050
5057
|
${this.renderLabelAtStart()}
|
|
5051
|
-
<div class="${
|
|
5058
|
+
<div class="${w(r)}" data-testid="poll-body">
|
|
5052
5059
|
${this.renderContent()} ${this.renderFooter()}
|
|
5053
5060
|
</div>
|
|
5054
5061
|
${this.renderLabelAtEnd()}
|
|
@@ -5059,23 +5066,23 @@ let et = class extends m {
|
|
|
5059
5066
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
5060
5067
|
}
|
|
5061
5068
|
};
|
|
5062
|
-
|
|
5063
|
-
|
|
5069
|
+
X.styles = [...m.styles, Tt, mr];
|
|
5070
|
+
mt([
|
|
5064
5071
|
h({ type: Boolean })
|
|
5065
|
-
],
|
|
5066
|
-
|
|
5072
|
+
], X.prototype, "multiple", 2);
|
|
5073
|
+
mt([
|
|
5067
5074
|
h({ type: Boolean })
|
|
5068
|
-
],
|
|
5069
|
-
|
|
5075
|
+
], X.prototype, "compact", 2);
|
|
5076
|
+
mt([
|
|
5070
5077
|
C()
|
|
5071
|
-
],
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
],
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
],
|
|
5078
|
-
const
|
|
5078
|
+
], X.prototype, "popoverOpen", 2);
|
|
5079
|
+
mt([
|
|
5080
|
+
ft(".pc-inline-trigger")
|
|
5081
|
+
], X.prototype, "triggerElement", 2);
|
|
5082
|
+
X = mt([
|
|
5083
|
+
F("pc-poll")
|
|
5084
|
+
], X);
|
|
5085
|
+
const yr = R`
|
|
5079
5086
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
5080
5087
|
|
|
5081
5088
|
.pc-section {
|
|
@@ -5262,10 +5269,10 @@ const gr = V`
|
|
|
5262
5269
|
* Copyright 2018 Google LLC
|
|
5263
5270
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5264
5271
|
*/
|
|
5265
|
-
const
|
|
5272
|
+
const We = "important", wr = " !" + We, xr = Fe(class extends Ye {
|
|
5266
5273
|
constructor(e) {
|
|
5267
5274
|
var t;
|
|
5268
|
-
if (super(e), e.type !==
|
|
5275
|
+
if (super(e), e.type !== He.ATTRIBUTE || e.name !== "style" || ((t = e.strings) == null ? void 0 : t.length) > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
|
|
5269
5276
|
}
|
|
5270
5277
|
render(e) {
|
|
5271
5278
|
return Object.keys(e).reduce((t, o) => {
|
|
@@ -5281,14 +5288,14 @@ const Ye = "important", mr = " !" + Ye, vr = He(class extends Fe {
|
|
|
5281
5288
|
const s = t[r];
|
|
5282
5289
|
if (s != null) {
|
|
5283
5290
|
this.ft.add(r);
|
|
5284
|
-
const i = typeof s == "string" && s.endsWith(
|
|
5285
|
-
r.includes("-") || i ? o.setProperty(r, i ? s.slice(0, -11) : s, i ?
|
|
5291
|
+
const i = typeof s == "string" && s.endsWith(wr);
|
|
5292
|
+
r.includes("-") || i ? o.setProperty(r, i ? s.slice(0, -11) : s, i ? We : "") : o[r] = s;
|
|
5286
5293
|
}
|
|
5287
5294
|
}
|
|
5288
|
-
return
|
|
5295
|
+
return j;
|
|
5289
5296
|
}
|
|
5290
5297
|
});
|
|
5291
|
-
function
|
|
5298
|
+
function wt(e, t = {}) {
|
|
5292
5299
|
if (!e || e.length === 0)
|
|
5293
5300
|
return c`<div class="pc-bar-chart pc-bar-chart--empty">No data available</div>`;
|
|
5294
5301
|
const o = Math.max(...e.map((i) => i.value)), s = { ...{
|
|
@@ -5317,7 +5324,7 @@ function Ct(e, t = {}) {
|
|
|
5317
5324
|
</div>
|
|
5318
5325
|
`;
|
|
5319
5326
|
}
|
|
5320
|
-
const
|
|
5327
|
+
const $e = {
|
|
5321
5328
|
// Faces
|
|
5322
5329
|
smile: "😊",
|
|
5323
5330
|
laugh: "😄",
|
|
@@ -5460,21 +5467,21 @@ const Ee = {
|
|
|
5460
5467
|
hiking: "🥾",
|
|
5461
5468
|
yoga: "🧘"
|
|
5462
5469
|
};
|
|
5463
|
-
function
|
|
5470
|
+
function kt(e) {
|
|
5464
5471
|
let t = "❓", o = !1;
|
|
5465
|
-
return e ? e in
|
|
5472
|
+
return e ? e in $e ? t = $e[e] : De(e) ? t = e : Pt(e) ? (o = !0, t = e) : /^\w+@\w+$/.test(e) ? t = e : e.endsWith(".svg") && !e.includes("/") ? (t = `https://cdn.jsdelivr.net/npm/@mdi/svg@7.4.47/svg/${e}`, o = !0) : t = e : t = "❓", {
|
|
5466
5473
|
icon: t,
|
|
5467
5474
|
isRemoteImage: o
|
|
5468
5475
|
};
|
|
5469
5476
|
}
|
|
5470
|
-
var
|
|
5471
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
5477
|
+
var $r = Object.defineProperty, Sr = Object.getOwnPropertyDescriptor, st = (e, t, o, r) => {
|
|
5478
|
+
for (var s = r > 1 ? void 0 : r ? Sr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
5472
5479
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
5473
|
-
return r && s &&
|
|
5480
|
+
return r && s && $r(t, o, s), s;
|
|
5474
5481
|
};
|
|
5475
|
-
let
|
|
5482
|
+
let q = class extends m {
|
|
5476
5483
|
constructor() {
|
|
5477
|
-
super(), this.type =
|
|
5484
|
+
super(), this.type = $.stars, this.icon = "★", this.numStars = 5, this.hoverValue = -1, this.popoverOpen = !1, this.handleStarKeyDown = (e) => {
|
|
5478
5485
|
if (e.key === "Enter" || e.key === " ") {
|
|
5479
5486
|
e.preventDefault();
|
|
5480
5487
|
const t = e.target, o = parseInt(t.dataset.star || "0");
|
|
@@ -5495,14 +5502,14 @@ let Y = class extends m {
|
|
|
5495
5502
|
* Renders the star icon using resolveIcon for emoji, URL, or MDI support
|
|
5496
5503
|
*/
|
|
5497
5504
|
renderStarIcon() {
|
|
5498
|
-
const { icon: e, isRemoteImage: t } =
|
|
5505
|
+
const { icon: e, isRemoteImage: t } = kt(this.icon);
|
|
5499
5506
|
return t ? c`<img class="star-icon-img" src="${e}" alt="star" />` : e;
|
|
5500
5507
|
}
|
|
5501
5508
|
/**
|
|
5502
5509
|
* Gets the resolved icon string (for use in chart labels)
|
|
5503
5510
|
*/
|
|
5504
5511
|
getResolvedIconString() {
|
|
5505
|
-
const { icon: e, isRemoteImage: t } =
|
|
5512
|
+
const { icon: e, isRemoteImage: t } = kt(this.icon);
|
|
5506
5513
|
return t ? "★" : e;
|
|
5507
5514
|
}
|
|
5508
5515
|
/**
|
|
@@ -5513,22 +5520,22 @@ let Y = class extends m {
|
|
|
5513
5520
|
renderStars(e = !1) {
|
|
5514
5521
|
var n;
|
|
5515
5522
|
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) => {
|
|
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,
|
|
5523
|
+
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, y = {
|
|
5517
5524
|
star: !0,
|
|
5518
5525
|
selected: f,
|
|
5519
5526
|
partial: b,
|
|
5520
5527
|
"view-mode": !a
|
|
5521
|
-
},
|
|
5528
|
+
}, x = b ? { "--partial-fill": `${i % 1 * 100}%` } : {}, A = e ? () => this.handlePopoverStarClick(d) : () => this.handleStarClick(d);
|
|
5522
5529
|
return c`
|
|
5523
5530
|
<div class="pc-section" data-testid="pc-section">
|
|
5524
5531
|
<span
|
|
5525
5532
|
data-testid="${e ? "popover" : "stars-view"}-star-${d}"
|
|
5526
|
-
class=${y
|
|
5527
|
-
style=${
|
|
5533
|
+
class=${w(y)}
|
|
5534
|
+
style=${xr(x)}
|
|
5528
5535
|
role="${a ? "button" : "presentation"}"
|
|
5529
5536
|
tabindex="${a ? "0" : ""}"
|
|
5530
5537
|
aria-label="${a ? `Rate ${d} star${d > 1 ? "s" : ""}` : ""}"
|
|
5531
|
-
@click="${
|
|
5538
|
+
@click="${A}"
|
|
5532
5539
|
@mouseenter="${() => this.handleStarHover(d)}"
|
|
5533
5540
|
@focus="${() => this.handleStarHover(d)}"
|
|
5534
5541
|
@mouseleave="${this.handleStarLeave}"
|
|
@@ -5552,7 +5559,7 @@ let Y = class extends m {
|
|
|
5552
5559
|
label: n,
|
|
5553
5560
|
value: d,
|
|
5554
5561
|
icon: r
|
|
5555
|
-
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l =
|
|
5562
|
+
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l = wt(s, {
|
|
5556
5563
|
barColor: a,
|
|
5557
5564
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
5558
5565
|
valueFormatter: (n) => `${o > 0 ? Math.round(n.value / o * 100) : 0}%`
|
|
@@ -5619,7 +5626,7 @@ let Y = class extends m {
|
|
|
5619
5626
|
};
|
|
5620
5627
|
return c`
|
|
5621
5628
|
<button
|
|
5622
|
-
class=${
|
|
5629
|
+
class=${w(i)}
|
|
5623
5630
|
@click=${() => {
|
|
5624
5631
|
this.popoverOpen = !0;
|
|
5625
5632
|
}}
|
|
@@ -5652,7 +5659,7 @@ let Y = class extends m {
|
|
|
5652
5659
|
aria-label="Close"
|
|
5653
5660
|
data-testid="popover-close-button"
|
|
5654
5661
|
>
|
|
5655
|
-
${
|
|
5662
|
+
${At}
|
|
5656
5663
|
</button>
|
|
5657
5664
|
${this.question ? c`<div class="pc-popover-question">${this.question}</div>` : u}
|
|
5658
5665
|
${this.renderStars(!0)}
|
|
@@ -5675,7 +5682,7 @@ let Y = class extends m {
|
|
|
5675
5682
|
label: n,
|
|
5676
5683
|
value: d,
|
|
5677
5684
|
icon: r
|
|
5678
|
-
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l =
|
|
5685
|
+
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l = wt(s, {
|
|
5679
5686
|
barColor: a,
|
|
5680
5687
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
5681
5688
|
valueFormatter: (n) => `${o > 0 ? Math.round(n.value / o * 100) : 0}%`
|
|
@@ -5701,7 +5708,7 @@ let Y = class extends m {
|
|
|
5701
5708
|
@keydown="${(e) => {
|
|
5702
5709
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.displayController.toggleChartVisibility());
|
|
5703
5710
|
}}"
|
|
5704
|
-
>${this.displayController.isChartVisible ?
|
|
5711
|
+
>${this.displayController.isChartVisible ? Gt : Kt}</span
|
|
5705
5712
|
>
|
|
5706
5713
|
`;
|
|
5707
5714
|
}
|
|
@@ -5744,7 +5751,7 @@ let Y = class extends m {
|
|
|
5744
5751
|
label: n,
|
|
5745
5752
|
value: d,
|
|
5746
5753
|
icon: r
|
|
5747
|
-
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l =
|
|
5754
|
+
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l = wt(s, {
|
|
5748
5755
|
barColor: a,
|
|
5749
5756
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
5750
5757
|
valueFormatter: (n) => `${o > 0 ? Math.round(n.value / o * 100) : 0}%`
|
|
@@ -5759,18 +5766,18 @@ let Y = class extends m {
|
|
|
5759
5766
|
* Render standard mode - original behavior
|
|
5760
5767
|
*/
|
|
5761
5768
|
renderStandardMode() {
|
|
5762
|
-
const e =
|
|
5769
|
+
const e = _(this.questionPosition, this.questionAlign), t = {
|
|
5763
5770
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
5764
5771
|
[`pc-flex-align-${e}`]: !0
|
|
5765
|
-
}, o =
|
|
5772
|
+
}, o = _(this.statsPosition, this.statsAlign), r = {
|
|
5766
5773
|
"pc-body": !0,
|
|
5767
5774
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5768
5775
|
[`pc-flex-align-${o}`]: !0
|
|
5769
5776
|
}, s = !this.displayController.shouldShowChart();
|
|
5770
5777
|
return c`
|
|
5771
|
-
<div class="pc-container ${
|
|
5778
|
+
<div class="pc-container ${w(t)}" data-testid="pc-container">
|
|
5772
5779
|
${this.renderLabelAtStart()}
|
|
5773
|
-
<div class="${
|
|
5780
|
+
<div class="${w(r)}" data-testid="stars-body">
|
|
5774
5781
|
${this.renderStatusAtStart()} ${this.renderChart()}
|
|
5775
5782
|
${s ? this.renderStars() : u} ${this.renderStatusAtEnd()}
|
|
5776
5783
|
</div>
|
|
@@ -5782,26 +5789,26 @@ let Y = class extends m {
|
|
|
5782
5789
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
5783
5790
|
}
|
|
5784
5791
|
};
|
|
5785
|
-
|
|
5786
|
-
|
|
5792
|
+
q.styles = [...m.styles, Tt, yr];
|
|
5793
|
+
st([
|
|
5787
5794
|
h({ type: String })
|
|
5788
|
-
],
|
|
5789
|
-
|
|
5795
|
+
], q.prototype, "icon", 2);
|
|
5796
|
+
st([
|
|
5790
5797
|
h({ type: Number, attribute: "num-stars" })
|
|
5791
|
-
],
|
|
5792
|
-
|
|
5798
|
+
], q.prototype, "numStars", 2);
|
|
5799
|
+
st([
|
|
5793
5800
|
C()
|
|
5794
|
-
],
|
|
5795
|
-
|
|
5801
|
+
], q.prototype, "hoverValue", 2);
|
|
5802
|
+
st([
|
|
5796
5803
|
C()
|
|
5797
|
-
],
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
],
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
],
|
|
5804
|
-
const
|
|
5804
|
+
], q.prototype, "popoverOpen", 2);
|
|
5805
|
+
st([
|
|
5806
|
+
ft(".pc-inline-trigger")
|
|
5807
|
+
], q.prototype, "triggerElement", 2);
|
|
5808
|
+
q = st([
|
|
5809
|
+
F("pc-stars")
|
|
5810
|
+
], q);
|
|
5811
|
+
const Cr = R`
|
|
5805
5812
|
/* Adjust stats text for reactions */
|
|
5806
5813
|
.pc-stats-text {
|
|
5807
5814
|
font-size: var(--pc-font-size-small, var(--default-font-size-small));
|
|
@@ -6064,15 +6071,15 @@ const wr = V`
|
|
|
6064
6071
|
animation: none;
|
|
6065
6072
|
}
|
|
6066
6073
|
}
|
|
6067
|
-
`,
|
|
6068
|
-
var
|
|
6069
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
6074
|
+
`, kr = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='%23434343'%3e%3cpath%20d='M480-480Zm0%20400q-83%200-156-31.5T197-197q-54-54-85.5-127T80-480q0-83%2031.5-156T197-763q54-54%20127-85.5T480-880q43%200%2083%208.5t77%2024.5v90q-35-20-75.5-31.5T480-800q-133%200-226.5%2093.5T160-480q0%20133%2093.5%20226.5T480-160q133%200%20226.5-93.5T800-480q0-32-6.5-62T776-600h86q9%2029%2013.5%2058.5T880-480q0%2083-31.5%20156T763-197q-54%2054-127%2085.5T480-80Zm320-600v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80ZM620-520q25%200%2042.5-17.5T680-580q0-25-17.5-42.5T620-640q-25%200-42.5%2017.5T560-580q0%2025%2017.5%2042.5T620-520Zm-280%200q25%200%2042.5-17.5T400-580q0-25-17.5-42.5T340-640q-25%200-42.5%2017.5T280-580q0%2025%2017.5%2042.5T340-520Zm140%20260q68%200%20123.5-38.5T684-400H276q25%2063%2080.5%20101.5T480-260Z'/%3e%3c/svg%3e";
|
|
6075
|
+
var Er = Object.defineProperty, Ar = Object.getOwnPropertyDescriptor, _t = (e, t, o, r) => {
|
|
6076
|
+
for (var s = r > 1 ? void 0 : r ? Ar(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
6070
6077
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
6071
|
-
return r && s &&
|
|
6078
|
+
return r && s && Er(t, o, s), s;
|
|
6072
6079
|
};
|
|
6073
|
-
let
|
|
6080
|
+
let rt = class extends m {
|
|
6074
6081
|
constructor() {
|
|
6075
|
-
super(), this.type =
|
|
6082
|
+
super(), this.type = $.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";
|
|
6076
6083
|
}
|
|
6077
6084
|
/**
|
|
6078
6085
|
* Get the display count for a specific reaction including local optimistic updates
|
|
@@ -6094,7 +6101,7 @@ let nt = class extends m {
|
|
|
6094
6101
|
* Renders the icon for a reaction
|
|
6095
6102
|
*/
|
|
6096
6103
|
renderReactionIcon(e, t) {
|
|
6097
|
-
const { icon: o, isRemoteImage: r } =
|
|
6104
|
+
const { icon: o, isRemoteImage: r } = kt(e), s = Xt.FUNCTIONAL, i = t.tooltip || `${t.value} reaction`, a = qe(o, {
|
|
6098
6105
|
type: s,
|
|
6099
6106
|
alt: i,
|
|
6100
6107
|
ariaLabel: i,
|
|
@@ -6121,7 +6128,7 @@ let nt = class extends m {
|
|
|
6121
6128
|
}, l = `${e.tooltip || e.value} reaction${o ? ", selected" : ""}${t ? `, ${r} votes` : ""}`;
|
|
6122
6129
|
return c`
|
|
6123
6130
|
<button
|
|
6124
|
-
class="${
|
|
6131
|
+
class="${w(a)}"
|
|
6125
6132
|
@click="${() => this.handleReactionClick(e)}"
|
|
6126
6133
|
?disabled="${s}"
|
|
6127
6134
|
aria-pressed="${o}"
|
|
@@ -6148,7 +6155,7 @@ let nt = class extends m {
|
|
|
6148
6155
|
aria-expanded="${this.displayController.shouldShowReactionPopover()}"
|
|
6149
6156
|
aria-haspopup="true"
|
|
6150
6157
|
>
|
|
6151
|
-
<img src="${
|
|
6158
|
+
<img src="${kr}" alt="" class="trigger-icon" />
|
|
6152
6159
|
</button>
|
|
6153
6160
|
`;
|
|
6154
6161
|
}
|
|
@@ -6163,7 +6170,7 @@ let nt = class extends m {
|
|
|
6163
6170
|
bottom: this.popupPosition === "bottom" || this.popupPosition === "auto" && !this.shouldShowPopoverOnTop()
|
|
6164
6171
|
};
|
|
6165
6172
|
return c`
|
|
6166
|
-
<div class="${
|
|
6173
|
+
<div class="${w(e)}" role="menu">
|
|
6167
6174
|
<div class="popover-content">
|
|
6168
6175
|
${this.options.map((t) => {
|
|
6169
6176
|
const o = this.displayController.shouldDisableOption(t);
|
|
@@ -6210,7 +6217,7 @@ let nt = class extends m {
|
|
|
6210
6217
|
(o) => this.dataController.isValueSelected(o.value)
|
|
6211
6218
|
);
|
|
6212
6219
|
return c`
|
|
6213
|
-
<div class="${
|
|
6220
|
+
<div class="${w(e)}">
|
|
6214
6221
|
${t.length > 0 ? c`
|
|
6215
6222
|
<div class="reaction-list">
|
|
6216
6223
|
${t.map(
|
|
@@ -6223,7 +6230,7 @@ let nt = class extends m {
|
|
|
6223
6230
|
`;
|
|
6224
6231
|
} else
|
|
6225
6232
|
return c`
|
|
6226
|
-
<div class="${
|
|
6233
|
+
<div class="${w(e)}">
|
|
6227
6234
|
<div class="reaction-list">
|
|
6228
6235
|
${this.options.map((t) => this.renderReactionButton(t, this.showCounts))}
|
|
6229
6236
|
</div>
|
|
@@ -6246,7 +6253,7 @@ let nt = class extends m {
|
|
|
6246
6253
|
icon: (p == null ? void 0 : p.icon) || n
|
|
6247
6254
|
// Use the icon or fall back to reaction value
|
|
6248
6255
|
};
|
|
6249
|
-
}), r = getComputedStyle(this), s = r.getPropertyValue("--pc-primary-color").trim(), a = r.getPropertyValue("--pc-accent-color").trim() || s || "#ffc107", l =
|
|
6256
|
+
}), r = getComputedStyle(this), s = r.getPropertyValue("--pc-primary-color").trim(), a = r.getPropertyValue("--pc-accent-color").trim() || s || "#ffc107", l = wt(o, {
|
|
6250
6257
|
barColor: a,
|
|
6251
6258
|
labelFormatter: (n) => `${n.label}`,
|
|
6252
6259
|
valueFormatter: (n) => `${e.totalCount > 0 ? Math.round(n.value / e.totalCount * 100) : 0}%`
|
|
@@ -6287,18 +6294,18 @@ let nt = class extends m {
|
|
|
6287
6294
|
* (Reactions are inherently inline, so inline mode = standard mode)
|
|
6288
6295
|
*/
|
|
6289
6296
|
renderStandardMode() {
|
|
6290
|
-
const e =
|
|
6297
|
+
const e = _(this.questionPosition, this.questionAlign), t = {
|
|
6291
6298
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
6292
6299
|
[`pc-flex-align-${e}`]: !0
|
|
6293
|
-
}, o =
|
|
6300
|
+
}, o = _(this.statsPosition, this.statsAlign), r = {
|
|
6294
6301
|
"pc-body": !0,
|
|
6295
6302
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
6296
6303
|
[`pc-flex-align-${o}`]: !0
|
|
6297
6304
|
};
|
|
6298
6305
|
return c`
|
|
6299
|
-
<div class="${
|
|
6306
|
+
<div class="${w(t)}" data-testid="reaction-container">
|
|
6300
6307
|
${this.renderLabelAtStart()}
|
|
6301
|
-
<div class="${
|
|
6308
|
+
<div class="${w(r)}" data-testid="reaction-body">
|
|
6302
6309
|
${this.renderStatusAtStart()} ${this.renderChart()} ${this.renderReactions()}
|
|
6303
6310
|
${this.renderStatusAtEnd()}
|
|
6304
6311
|
</div>
|
|
@@ -6310,36 +6317,35 @@ let nt = class extends m {
|
|
|
6310
6317
|
return this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
6311
6318
|
}
|
|
6312
6319
|
};
|
|
6313
|
-
|
|
6314
|
-
|
|
6320
|
+
rt.styles = [...m.styles, Tt, Cr];
|
|
6321
|
+
_t([
|
|
6315
6322
|
h({ type: Boolean, attribute: "show-counts" })
|
|
6316
|
-
],
|
|
6317
|
-
|
|
6323
|
+
], rt.prototype, "showCounts", 2);
|
|
6324
|
+
_t([
|
|
6318
6325
|
h({ type: Boolean, reflect: !0 })
|
|
6319
|
-
],
|
|
6320
|
-
|
|
6326
|
+
], rt.prototype, "compact", 2);
|
|
6327
|
+
_t([
|
|
6321
6328
|
h({ type: String, attribute: "popup-position" })
|
|
6322
|
-
],
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
],
|
|
6326
|
-
function
|
|
6329
|
+
], rt.prototype, "popupPosition", 2);
|
|
6330
|
+
rt = _t([
|
|
6331
|
+
F("pc-reaction")
|
|
6332
|
+
], rt);
|
|
6333
|
+
function nt(e, t, o = void 0) {
|
|
6327
6334
|
const r = e.getAttribute(t);
|
|
6328
6335
|
return r === null ? o : r == null ? void 0 : r.trim();
|
|
6329
6336
|
}
|
|
6330
|
-
function
|
|
6337
|
+
function Pr(e, t = void 0) {
|
|
6331
6338
|
const o = e.textContent;
|
|
6332
6339
|
return o === "" || o === null ? t : o == null ? void 0 : o.trim();
|
|
6333
6340
|
}
|
|
6334
|
-
var
|
|
6335
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
6341
|
+
var Tr = Object.defineProperty, _r = Object.getOwnPropertyDescriptor, it = (e, t, o, r) => {
|
|
6342
|
+
for (var s = r > 1 ? void 0 : r ? _r(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
6336
6343
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
6337
|
-
return r && s &&
|
|
6344
|
+
return r && s && Tr(t, o, s), s;
|
|
6338
6345
|
};
|
|
6339
|
-
|
|
6340
|
-
let z = class extends B {
|
|
6346
|
+
let H = class extends N {
|
|
6341
6347
|
constructor() {
|
|
6342
|
-
super(), this.options = "", this.parsedOptions = [], this.isPrefetching = !1,
|
|
6348
|
+
super(), this.options = "", this.parsedOptions = [], this.isPrefetching = !1, H.injectGlobalStyle();
|
|
6343
6349
|
}
|
|
6344
6350
|
/**
|
|
6345
6351
|
* Inject global style to hide poll-catch-option elements
|
|
@@ -6364,63 +6370,52 @@ let z = class extends B {
|
|
|
6364
6370
|
return this;
|
|
6365
6371
|
}
|
|
6366
6372
|
connectedCallback() {
|
|
6367
|
-
super.connectedCallback(), this.widgetId &&
|
|
6373
|
+
super.connectedCallback(), this.widgetId && (this.type = void 0, this.prefetchWidgetConfig());
|
|
6368
6374
|
}
|
|
6369
6375
|
forceUpdate() {
|
|
6370
6376
|
this.forwardAttributesToWidget(), this.forwardOptionsToWidget();
|
|
6371
6377
|
}
|
|
6372
6378
|
/**
|
|
6373
|
-
*
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
*
|
|
6380
|
-
*
|
|
6379
|
+
* Runs synchronously after every render cycle.
|
|
6380
|
+
* Always forwards attributes so the child widget has them (especially widget-id)
|
|
6381
|
+
* BEFORE DataController's async loadStats() fires. This is critical because
|
|
6382
|
+
* loadStats() starts in hostConnected() and yields at its first await — if
|
|
6383
|
+
* attributes aren't set by then, validation fails.
|
|
6384
|
+
*
|
|
6385
|
+
* Options are only forwarded when type or options change to avoid an infinite
|
|
6386
|
+
* loop (forwardOptionsToWidget sets parsedOptions, a @state).
|
|
6381
6387
|
*/
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
this.forwardAttributesToWidget();
|
|
6385
|
-
});
|
|
6388
|
+
updated(e) {
|
|
6389
|
+
this.forwardAttributesToWidget(), (e.has("type") || e.has("options")) && this.forwardOptionsToWidget();
|
|
6386
6390
|
}
|
|
6387
6391
|
/**
|
|
6388
6392
|
* Prefetch widget config from the API to determine widget type
|
|
6389
6393
|
*/
|
|
6390
6394
|
async prefetchWidgetConfig() {
|
|
6391
6395
|
var e, t;
|
|
6392
|
-
if (!this.widgetId || !
|
|
6396
|
+
if (!this.widgetId || !Be.test(this.widgetId)) {
|
|
6393
6397
|
g.warn(`poll-catch: Invalid widget-id format for prefetch: ${this.widgetId}`);
|
|
6394
6398
|
return;
|
|
6395
6399
|
}
|
|
6396
6400
|
this.isPrefetching = !0;
|
|
6397
6401
|
try {
|
|
6398
|
-
const
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
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 },
|
|
6402
|
+
const o = await je({ type: "registered", widgetId: this.widgetId }), r = (e = o.data) == null ? void 0 : e.config, s = (t = o.data) == null ? void 0 : t.stats;
|
|
6403
|
+
if (!(r != null && r.type) || !Object.values($).includes(r.type))
|
|
6404
|
+
throw new Error(`Invalid widget type from server: ${r == null ? void 0 : r.type}`);
|
|
6405
|
+
Zo(this.widgetId, {
|
|
6406
|
+
config: { type: r.type, attributes: r.attributes || null },
|
|
6411
6407
|
stats: {
|
|
6412
|
-
count: (
|
|
6413
|
-
sum: (
|
|
6414
|
-
breakdown: (
|
|
6415
|
-
updatedAt: (
|
|
6408
|
+
count: (s == null ? void 0 : s.count) ?? 0,
|
|
6409
|
+
sum: (s == null ? void 0 : s.sum) ?? 0,
|
|
6410
|
+
breakdown: (s == null ? void 0 : s.breakdown) ?? {},
|
|
6411
|
+
updatedAt: (s == null ? void 0 : s.updatedAt) || (s == null ? void 0 : s.updated_at)
|
|
6416
6412
|
}
|
|
6417
|
-
}), this.type =
|
|
6413
|
+
}), this.type = r.type;
|
|
6418
6414
|
} catch (o) {
|
|
6419
6415
|
g.warn("poll-catch: Failed to prefetch widget config", o);
|
|
6420
6416
|
} finally {
|
|
6421
6417
|
this.isPrefetching = !1;
|
|
6422
6418
|
}
|
|
6423
|
-
this.requestUpdate(), await this.updateComplete, this.forwardAttributesToWidget(), this.forwardOptionsToWidget();
|
|
6424
6419
|
}
|
|
6425
6420
|
/**
|
|
6426
6421
|
* Forward all attributes except 'type' to the child widget
|
|
@@ -6439,16 +6434,16 @@ let z = class extends B {
|
|
|
6439
6434
|
const e = this.querySelector("pc-poll, pc-reaction");
|
|
6440
6435
|
if (!e) return;
|
|
6441
6436
|
const t = this.querySelectorAll("poll-catch-option");
|
|
6442
|
-
let r =
|
|
6437
|
+
let r = Re(this.options).map((s) => ({
|
|
6443
6438
|
value: s,
|
|
6444
6439
|
label: s,
|
|
6445
6440
|
icon: e.tagName === "PC-REACTION" ? s : void 0
|
|
6446
6441
|
// REACTION widget uses options for the icon
|
|
6447
6442
|
}));
|
|
6448
6443
|
t && t.length > 0 && (r = Array.from(t).map((s) => {
|
|
6449
|
-
const i =
|
|
6444
|
+
const i = nt(s, "value", "") || "", a = nt(s, "label", Pr(s, i)) || "", l = nt(s, "icon", void 0), n = nt(s, "tooltip", void 0), d = nt(s, "disabled", void 0), p = { value: i, label: a };
|
|
6450
6445
|
if (l !== void 0) {
|
|
6451
|
-
const f =
|
|
6446
|
+
const f = kt(l);
|
|
6452
6447
|
p.icon = f.icon;
|
|
6453
6448
|
}
|
|
6454
6449
|
return n !== void 0 && (p.tooltip = n), d !== void 0 && (p.disabled = !0), p;
|
|
@@ -6461,13 +6456,13 @@ let z = class extends B {
|
|
|
6461
6456
|
if (this.isPrefetching)
|
|
6462
6457
|
return u;
|
|
6463
6458
|
switch (this.type) {
|
|
6464
|
-
case
|
|
6459
|
+
case $.nps:
|
|
6465
6460
|
return c`<pc-nps></pc-nps>`;
|
|
6466
|
-
case
|
|
6461
|
+
case $.poll:
|
|
6467
6462
|
return c`<pc-poll .options=${this.parsedOptions}></pc-poll>`;
|
|
6468
|
-
case
|
|
6463
|
+
case $.stars:
|
|
6469
6464
|
return c`<pc-stars></pc-stars>`;
|
|
6470
|
-
case
|
|
6465
|
+
case $.reaction:
|
|
6471
6466
|
return c`<pc-reaction .options=${this.parsedOptions}></pc-reaction>`;
|
|
6472
6467
|
default:
|
|
6473
6468
|
return this.widgetId || console.warn(
|
|
@@ -6476,30 +6471,24 @@ let z = class extends B {
|
|
|
6476
6471
|
}
|
|
6477
6472
|
}
|
|
6478
6473
|
};
|
|
6479
|
-
|
|
6474
|
+
it([
|
|
6480
6475
|
h({ type: String })
|
|
6481
|
-
],
|
|
6482
|
-
|
|
6476
|
+
], H.prototype, "type", 2);
|
|
6477
|
+
it([
|
|
6483
6478
|
h({ type: String })
|
|
6484
|
-
],
|
|
6485
|
-
|
|
6479
|
+
], H.prototype, "options", 2);
|
|
6480
|
+
it([
|
|
6486
6481
|
h({ type: String, attribute: "widget-id" })
|
|
6487
|
-
],
|
|
6488
|
-
|
|
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([
|
|
6482
|
+
], H.prototype, "widgetId", 2);
|
|
6483
|
+
it([
|
|
6495
6484
|
C()
|
|
6496
|
-
],
|
|
6497
|
-
|
|
6485
|
+
], H.prototype, "parsedOptions", 2);
|
|
6486
|
+
it([
|
|
6498
6487
|
C()
|
|
6499
|
-
],
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
],
|
|
6488
|
+
], H.prototype, "isPrefetching", 2);
|
|
6489
|
+
H = it([
|
|
6490
|
+
F("poll-catch")
|
|
6491
|
+
], H);
|
|
6503
6492
|
export {
|
|
6504
|
-
|
|
6493
|
+
H as PollCatch
|
|
6505
6494
|
};
|