pollcatch 2.4.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pc.js +714 -644
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 St = globalThis, Kt = St.ShadowRoot && (St.ShadyCSS === void 0 || St.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Gt = Symbol(), re = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
let Pe = class {
|
|
8
8
|
constructor(t, o, r) {
|
|
9
|
-
if (this._$cssResult$ = !0, r !==
|
|
9
|
+
if (this._$cssResult$ = !0, r !== Gt) 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 (Kt && t === void 0) {
|
|
16
16
|
const r = o !== void 0 && o.length === 1;
|
|
17
|
-
r && (t =
|
|
17
|
+
r && (t = re.get(o)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), r && re.set(o, t));
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
}
|
|
@@ -22,33 +22,33 @@ let Ee = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const We = (e) => new Pe(typeof e == "string" ? e : e + "", void 0, Gt), U = (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 Pe(o, e, Gt);
|
|
32
|
+
}, Ke = (e, t) => {
|
|
33
|
+
if (Kt) 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 = St.litNonce;
|
|
36
36
|
s !== void 0 && r.setAttribute("nonce", s), r.textContent = o.cssText, e.appendChild(r);
|
|
37
37
|
}
|
|
38
|
-
},
|
|
38
|
+
}, se = Kt ? (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 We(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: Ge, defineProperty: Ze, getOwnPropertyDescriptor: Je, getOwnPropertyNames: Xe, getOwnPropertySymbols: Qe, getPrototypeOf: to } = Object, q = globalThis, ie = q.trustedTypes, eo = ie ? ie.emptyScript : "", Mt = q.reactiveElementPolyfillSupport, pt = (e, t) => e, kt = { toAttribute(e, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
e = e ?
|
|
51
|
+
e = e ? eo : null;
|
|
52
52
|
break;
|
|
53
53
|
case Object:
|
|
54
54
|
case Array:
|
|
@@ -73,23 +73,23 @@ const { is: Ke, defineProperty: We, getOwnPropertyDescriptor: Ge, getOwnProperty
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return o;
|
|
76
|
-
} },
|
|
76
|
+
} }, Zt = (e, t) => !Ge(e, t), ae = { attribute: !0, type: String, converter: kt, reflect: !1, hasChanged: Zt };
|
|
77
77
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), q.litPropertyMetadata ?? (q.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
|
-
let
|
|
78
|
+
let rt = 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 = ae) {
|
|
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 && Ze(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 } = Je(this.prototype, t) ?? { get() {
|
|
93
93
|
return this[o];
|
|
94
94
|
}, set(a) {
|
|
95
95
|
this[o] = a;
|
|
@@ -102,17 +102,17 @@ let ot = 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) ?? ae;
|
|
106
106
|
}
|
|
107
107
|
static _$Ei() {
|
|
108
|
-
if (this.hasOwnProperty(
|
|
109
|
-
const t =
|
|
108
|
+
if (this.hasOwnProperty(pt("elementProperties"))) return;
|
|
109
|
+
const t = to(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(pt("finalized"))) return;
|
|
114
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(pt("properties"))) {
|
|
115
|
+
const o = this.properties, r = [...Xe(o), ...Qe(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 ot = 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(se(s));
|
|
135
|
+
} else t !== void 0 && o.push(se(t));
|
|
136
136
|
return o;
|
|
137
137
|
}
|
|
138
138
|
static _$Eu(t, o) {
|
|
@@ -161,7 +161,7 @@ let ot = class extends HTMLElement {
|
|
|
161
161
|
}
|
|
162
162
|
createRenderRoot() {
|
|
163
163
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
164
|
-
return
|
|
164
|
+
return Ke(t, this.constructor.elementStyles), t;
|
|
165
165
|
}
|
|
166
166
|
connectedCallback() {
|
|
167
167
|
var t;
|
|
@@ -186,7 +186,7 @@ let ot = 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 : kt).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 ot = 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 : kt;
|
|
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 ?? Zt)(this[t], o)) return;
|
|
204
204
|
this.P(t, o, r);
|
|
205
205
|
}
|
|
206
206
|
this.isUpdatePending === !1 && (this._$ES = this._$ET());
|
|
@@ -273,56 +273,56 @@ let ot = class extends HTMLElement {
|
|
|
273
273
|
firstUpdated(t) {
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
-
|
|
276
|
+
rt.elementStyles = [], rt.shadowRootOptions = { mode: "open" }, rt[pt("elementProperties")] = /* @__PURE__ */ new Map(), rt[pt("finalized")] = /* @__PURE__ */ new Map(), Mt == null || Mt({ ReactiveElement: rt }), (q.reactiveElementVersions ?? (q.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 ut = globalThis, Et = ut.trustedTypes, ne = Et ? Et.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, Te = "$lit$", j = `lit$${Math.random().toFixed(9).slice(2)}$`, _e = "?" + j, oo = `<${_e}>`, X = document, gt = () => X.createComment(""), mt = (e) => e === null || typeof e != "object" && typeof e != "function", Jt = Array.isArray, ro = (e) => Jt(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", Lt = `[
|
|
283
|
+
\f\r]`, ct = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, le = /-->/g, ce = />/g, Z = RegExp(`>|${Lt}(?:([^\\s"'>=/]+)(${Lt}*=${Lt}*(?:[^
|
|
284
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), de = /'/g, pe = /"/g, Oe = /^(?:script|style|textarea|title)$/i, so = (e) => (t, ...o) => ({ _$litType$: e, strings: t, values: o }), c = so(1), H = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), ue = /* @__PURE__ */ new WeakMap(), J = X.createTreeWalker(X, 129);
|
|
285
|
+
function Ie(e, t) {
|
|
286
|
+
if (!Jt(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
287
|
+
return ne !== void 0 ? ne.createHTML(t) : t;
|
|
288
288
|
}
|
|
289
|
-
const
|
|
289
|
+
const io = (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 = ct;
|
|
292
292
|
for (let l = 0; l < o; l++) {
|
|
293
293
|
const n = e[l];
|
|
294
|
-
let d, p, h = -1,
|
|
295
|
-
for (;
|
|
296
|
-
const x = a ===
|
|
297
|
-
i += a ===
|
|
294
|
+
let d, p, h = -1, v = 0;
|
|
295
|
+
for (; v < n.length && (a.lastIndex = v, p = a.exec(n), p !== null); ) v = a.lastIndex, a === ct ? p[1] === "!--" ? a = le : p[1] !== void 0 ? a = ce : p[2] !== void 0 ? (Oe.test(p[2]) && (s = RegExp("</" + p[2], "g")), a = Z) : p[3] !== void 0 && (a = Z) : a === Z ? p[0] === ">" ? (a = s ?? ct, h = -1) : p[1] === void 0 ? h = -2 : (h = a.lastIndex - p[2].length, d = p[1], a = p[3] === void 0 ? Z : p[3] === '"' ? pe : de) : a === pe || a === de ? a = Z : a === le || a === ce ? a = ct : (a = Z, s = void 0);
|
|
296
|
+
const x = a === Z && e[l + 1].startsWith("/>") ? " " : "";
|
|
297
|
+
i += a === ct ? n + oo : h >= 0 ? (r.push(d), n.slice(0, h) + Te + n.slice(h) + j + x) : n + j + (h === -2 ? l : x);
|
|
298
298
|
}
|
|
299
|
-
return [
|
|
299
|
+
return [Ie(e, i + (e[o] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
300
300
|
};
|
|
301
|
-
let Ft = class
|
|
301
|
+
let Ft = class ze {
|
|
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] = io(t, o);
|
|
307
|
+
if (this.el = ze.createElement(d, r), J.currentNode = this.el.content, o === 2 || o === 3) {
|
|
308
308
|
const h = this.el.content.firstChild;
|
|
309
309
|
h.replaceWith(...h.childNodes);
|
|
310
310
|
}
|
|
311
|
-
for (; (s =
|
|
311
|
+
for (; (s = J.nextNode()) !== null && n.length < l; ) {
|
|
312
312
|
if (s.nodeType === 1) {
|
|
313
|
-
if (s.hasAttributes()) for (const h of s.getAttributeNames()) if (h.endsWith(
|
|
314
|
-
const
|
|
315
|
-
n.push({ type: 1, index: i, name:
|
|
313
|
+
if (s.hasAttributes()) for (const h of s.getAttributeNames()) if (h.endsWith(Te)) {
|
|
314
|
+
const v = p[a++], x = s.getAttribute(h).split(j), k = /([.?@])?(.*)/.exec(v);
|
|
315
|
+
n.push({ type: 1, index: i, name: k[2], strings: x, ctor: k[1] === "." ? no : k[1] === "?" ? lo : k[1] === "@" ? co : Tt }), s.removeAttribute(h);
|
|
316
316
|
} else h.startsWith(j) && (n.push({ type: 6, index: i }), s.removeAttribute(h));
|
|
317
|
-
if (
|
|
318
|
-
const h = s.textContent.split(j),
|
|
319
|
-
if (
|
|
320
|
-
s.textContent =
|
|
321
|
-
for (let x = 0; x <
|
|
322
|
-
s.append(h[
|
|
317
|
+
if (Oe.test(s.tagName)) {
|
|
318
|
+
const h = s.textContent.split(j), v = h.length - 1;
|
|
319
|
+
if (v > 0) {
|
|
320
|
+
s.textContent = Et ? Et.emptyScript : "";
|
|
321
|
+
for (let x = 0; x < v; x++) s.append(h[x], gt()), J.nextNode(), n.push({ type: 2, index: ++i });
|
|
322
|
+
s.append(h[v], gt());
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
} else if (s.nodeType === 8) if (s.data ===
|
|
325
|
+
} else if (s.nodeType === 8) if (s.data === _e) n.push({ type: 2, index: i });
|
|
326
326
|
else {
|
|
327
327
|
let h = -1;
|
|
328
328
|
for (; (h = s.data.indexOf(j, h + 1)) !== -1; ) n.push({ type: 7, index: i }), h += j.length - 1;
|
|
@@ -331,18 +331,18 @@ let Ft = class Oe {
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
static createElement(t, o) {
|
|
334
|
-
const r =
|
|
334
|
+
const r = X.createElement("template");
|
|
335
335
|
return r.innerHTML = t, r;
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
|
-
function
|
|
338
|
+
function it(e, t, o = e, r) {
|
|
339
339
|
var a, l;
|
|
340
340
|
if (t === H) 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 = mt(t) ? void 0 : t._$litDirective$;
|
|
343
|
+
return (s == null ? void 0 : s.constructor) !== i && ((l = s == null ? void 0 : s._$AO) == null || l.call(s, !1), i === void 0 ? s = void 0 : (s = new i(e), s._$AT(e, o, r)), r !== void 0 ? (o._$Co ?? (o._$Co = []))[r] = s : o._$Cl = s), s !== void 0 && (t = it(e, s._$AS(e, t.values), s, r)), t;
|
|
344
344
|
}
|
|
345
|
-
let
|
|
345
|
+
let ao = 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 so = 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) ?? X).importNode(o, !0);
|
|
357
|
+
J.currentNode = s;
|
|
358
|
+
let i = J.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 vt(i, i.nextSibling, this, t) : n.type === 1 ? d = new n.ctor(i, n.name, n.strings, this, t) : n.type === 6 && (d = new po(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 = J.nextNode(), a++);
|
|
365
365
|
}
|
|
366
|
-
return
|
|
366
|
+
return J.currentNode = X, 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 vt {
|
|
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 gt {
|
|
|
390
390
|
return this._$AB;
|
|
391
391
|
}
|
|
392
392
|
_$AI(t, o = this) {
|
|
393
|
-
t =
|
|
393
|
+
t = it(this, t, o), mt(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== H && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : ro(t) ? this.k(t) : this._(t);
|
|
394
394
|
}
|
|
395
395
|
O(t) {
|
|
396
396
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -399,26 +399,26 @@ class gt {
|
|
|
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 && mt(this._$AH) ? this._$AA.nextSibling.data = t : this.T(X.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 = Ft.createElement(
|
|
406
|
+
const { values: o, _$litType$: r } = t, s = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el = Ft.createElement(Ie(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 ao(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 = ue.get(t.strings);
|
|
415
|
+
return o === void 0 && ue.set(t.strings, o = new Ft(t)), o;
|
|
416
416
|
}
|
|
417
417
|
k(t) {
|
|
418
|
-
|
|
418
|
+
Jt(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 vt(this.O(gt()), this.O(gt()), 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 gt {
|
|
|
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 Tt {
|
|
437
437
|
get tagName() {
|
|
438
438
|
return this.element.tagName;
|
|
439
439
|
}
|
|
@@ -446,11 +446,11 @@ class Pt {
|
|
|
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 = it(this, t, o, 0), a = !mt(t) || t !== this._$AH && t !== H, 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 = it(this, l[r + n], o, n), d === H && (d = this._$AH[n]), a || (a = !mt(d) || d !== this._$AH[n]), d === u ? t = u : t !== u && (t += (d ?? "") + i[n + 1]), this._$AH[n] = d;
|
|
454
454
|
}
|
|
455
455
|
a && !s && this.j(t);
|
|
456
456
|
}
|
|
@@ -458,7 +458,7 @@ class Pt {
|
|
|
458
458
|
t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
let
|
|
461
|
+
let no = class extends Tt {
|
|
462
462
|
constructor() {
|
|
463
463
|
super(...arguments), this.type = 3;
|
|
464
464
|
}
|
|
@@ -466,7 +466,7 @@ let io = class extends Pt {
|
|
|
466
466
|
this.element[this.name] = t === u ? void 0 : t;
|
|
467
467
|
}
|
|
468
468
|
};
|
|
469
|
-
class
|
|
469
|
+
class lo extends Tt {
|
|
470
470
|
constructor() {
|
|
471
471
|
super(...arguments), this.type = 4;
|
|
472
472
|
}
|
|
@@ -474,12 +474,12 @@ class ao extends Pt {
|
|
|
474
474
|
this.element.toggleAttribute(this.name, !!t && t !== u);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
class
|
|
477
|
+
class co extends Tt {
|
|
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 = it(this, t, o, 0) ?? u) === H) 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 no extends Pt {
|
|
|
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 po {
|
|
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 lo {
|
|
|
496
496
|
return this._$AM._$AU;
|
|
497
497
|
}
|
|
498
498
|
_$AI(t) {
|
|
499
|
-
|
|
499
|
+
it(this, t);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
const Nt =
|
|
503
|
-
Nt == null || Nt(Ft,
|
|
504
|
-
const
|
|
502
|
+
const Nt = ut.litHtmlPolyfillSupport;
|
|
503
|
+
Nt == null || Nt(Ft, vt), (ut.litHtmlVersions ?? (ut.litHtmlVersions = [])).push("3.2.1");
|
|
504
|
+
const uo = (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 vt(t.insertBefore(gt(), i), i, void 0, o ?? {});
|
|
510
510
|
}
|
|
511
511
|
return s._$AI(e), s;
|
|
512
512
|
};
|
|
@@ -515,7 +515,7 @@ const co = (e, t, o) => {
|
|
|
515
515
|
* Copyright 2017 Google LLC
|
|
516
516
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
517
517
|
*/
|
|
518
|
-
let R = class extends
|
|
518
|
+
let R = class extends rt {
|
|
519
519
|
constructor() {
|
|
520
520
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
521
521
|
}
|
|
@@ -526,7 +526,7 @@ let R = class extends ot {
|
|
|
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 = uo(o, this.renderRoot, this.renderOptions);
|
|
530
530
|
}
|
|
531
531
|
connectedCallback() {
|
|
532
532
|
var t;
|
|
@@ -540,8 +540,8 @@ let R = class extends ot {
|
|
|
540
540
|
return H;
|
|
541
541
|
}
|
|
542
542
|
};
|
|
543
|
-
var
|
|
544
|
-
R._$litElement$ = !0, R.finalized = !0, (
|
|
543
|
+
var Ae;
|
|
544
|
+
R._$litElement$ = !0, R.finalized = !0, (Ae = globalThis.litElementHydrateSupport) == null || Ae.call(globalThis, { LitElement: R });
|
|
545
545
|
const Dt = globalThis.litElementPolyfillSupport;
|
|
546
546
|
Dt == null || Dt({ LitElement: R });
|
|
547
547
|
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.1");
|
|
@@ -550,7 +550,7 @@ Dt == null || Dt({ LitElement: R });
|
|
|
550
550
|
* Copyright 2017 Google LLC
|
|
551
551
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
552
552
|
*/
|
|
553
|
-
const
|
|
553
|
+
const W = (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 Y = (e) => (t, o) => {
|
|
|
560
560
|
* Copyright 2017 Google LLC
|
|
561
561
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
562
562
|
*/
|
|
563
|
-
const
|
|
563
|
+
const ho = { attribute: !0, type: String, converter: kt, reflect: !1, hasChanged: Zt }, fo = (e = ho, 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 po = { attribute: !0, type: String, converter: St, reflect: !1, hasChanged
|
|
|
582
582
|
throw Error("Unsupported decorator location: " + r);
|
|
583
583
|
};
|
|
584
584
|
function f(e) {
|
|
585
|
-
return (t, o) => typeof o == "object" ?
|
|
585
|
+
return (t, o) => typeof o == "object" ? fo(e, t, o) : ((r, s, i) => {
|
|
586
586
|
const a = s.hasOwnProperty(i);
|
|
587
587
|
return s.constructor.createProperty(i, a ? { ...r, wrapped: !0 } : r), a ? Object.getOwnPropertyDescriptor(s, i) : void 0;
|
|
588
588
|
})(e, t, o);
|
|
@@ -592,7 +592,7 @@ function f(e) {
|
|
|
592
592
|
* Copyright 2017 Google LLC
|
|
593
593
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
594
594
|
*/
|
|
595
|
-
function
|
|
595
|
+
function A(e) {
|
|
596
596
|
return f({ ...e, state: !0, attribute: !1 });
|
|
597
597
|
}
|
|
598
598
|
/**
|
|
@@ -600,25 +600,25 @@ function k(e) {
|
|
|
600
600
|
* Copyright 2017 Google LLC
|
|
601
601
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
602
602
|
*/
|
|
603
|
-
const
|
|
603
|
+
const go = (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 bt(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 go(o, r, { get() {
|
|
616
616
|
return i(this);
|
|
617
617
|
} });
|
|
618
618
|
};
|
|
619
619
|
}
|
|
620
620
|
var S = /* @__PURE__ */ ((e) => (e.reaction = "reaction", e.stars = "stars", e.poll = "poll", e.text = "text", e.nps = "nps", e))(S || {});
|
|
621
|
-
const
|
|
621
|
+
const Xt = c`
|
|
622
622
|
<svg
|
|
623
623
|
xmlns="http://www.w3.org/2000/svg"
|
|
624
624
|
height="24px"
|
|
@@ -628,7 +628,7 @@ const Zt = c`
|
|
|
628
628
|
>
|
|
629
629
|
<path d="M640-160v-280h160v280H640Zm-240 0v-640h160v640H400Zm-240 0v-440h160v440H160Z" />
|
|
630
630
|
</svg>
|
|
631
|
-
`,
|
|
631
|
+
`, Qt = c`
|
|
632
632
|
<svg
|
|
633
633
|
xmlns="http://www.w3.org/2000/svg"
|
|
634
634
|
height="24px"
|
|
@@ -640,7 +640,7 @@ const Zt = 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
|
+
`, At = c`
|
|
644
644
|
<svg
|
|
645
645
|
xmlns="http://www.w3.org/2000/svg"
|
|
646
646
|
height="24px"
|
|
@@ -652,7 +652,7 @@ const Zt = 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
|
+
`, _t = c`
|
|
656
656
|
<svg
|
|
657
657
|
xmlns="http://www.w3.org/2000/svg"
|
|
658
658
|
width="16"
|
|
@@ -664,7 +664,7 @@ const Zt = 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
|
+
`, Me = c`
|
|
668
668
|
<svg
|
|
669
669
|
xmlns="http://www.w3.org/2000/svg"
|
|
670
670
|
height="24px"
|
|
@@ -675,95 +675,95 @@ const Zt = c`
|
|
|
675
675
|
<path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z" />
|
|
676
676
|
</svg>
|
|
677
677
|
`;
|
|
678
|
-
var
|
|
678
|
+
var mo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, L = function(e) {
|
|
679
679
|
return typeof e == "string" ? e.length > 0 : typeof e == "number";
|
|
680
|
-
},
|
|
680
|
+
}, C = 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
|
+
}, T = function(e, t, o) {
|
|
683
683
|
return t === void 0 && (t = 0), o === void 0 && (o = 1), e > o ? o : e > t ? e : t;
|
|
684
|
-
},
|
|
684
|
+
}, Le = function(e) {
|
|
685
685
|
return (e = isFinite(e) ? e % 360 : 0) > 0 ? e : e + 360;
|
|
686
|
-
},
|
|
687
|
-
return { r:
|
|
686
|
+
}, he = function(e) {
|
|
687
|
+
return { r: T(e.r, 0, 255), g: T(e.g, 0, 255), b: T(e.b, 0, 255), a: T(e.a) };
|
|
688
688
|
}, Rt = function(e) {
|
|
689
|
-
return { r:
|
|
690
|
-
},
|
|
689
|
+
return { r: C(e.r), g: C(e.g), b: C(e.b), a: C(e.a, 3) };
|
|
690
|
+
}, vo = /^#([0-9a-f]{3,8})$/i, xt = function(e) {
|
|
691
691
|
var t = e.toString(16);
|
|
692
692
|
return t.length < 2 ? "0" + t : t;
|
|
693
|
-
},
|
|
693
|
+
}, Ne = 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
|
+
}, De = 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
|
-
}, ue = function(e) {
|
|
702
|
-
return { h: ze(e.h), s: P(e.s, 0, 100), l: P(e.l, 0, 100), a: P(e.a) };
|
|
703
|
-
}, he = function(e) {
|
|
704
|
-
return { h: $(e.h), s: $(e.s), l: $(e.l), a: $(e.a, 3) };
|
|
705
701
|
}, fe = function(e) {
|
|
706
|
-
return
|
|
702
|
+
return { h: Le(e.h), s: T(e.s, 0, 100), l: T(e.l, 0, 100), a: T(e.a) };
|
|
703
|
+
}, ge = function(e) {
|
|
704
|
+
return { h: C(e.h), s: C(e.s), l: C(e.l), a: C(e.a, 3) };
|
|
705
|
+
}, me = function(e) {
|
|
706
|
+
return De((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
|
+
}, ht = function(e) {
|
|
709
|
+
return { h: (t = Ne(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 =
|
|
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 ?
|
|
711
|
+
}, bo = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, yo = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, wo = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, xo = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, ve = { string: [[function(e) {
|
|
712
|
+
var t = vo.exec(e);
|
|
713
|
+
return t ? (e = t[1]).length <= 4 ? { r: parseInt(e[0] + e[0], 16), g: parseInt(e[1] + e[1], 16), b: parseInt(e[2] + e[2], 16), a: e.length === 4 ? C(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 ? C(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 = wo.exec(e) || xo.exec(e);
|
|
716
|
+
return t ? t[2] !== t[4] || t[4] !== t[6] ? null : he({ r: Number(t[1]) / (t[2] ? 100 / 255 : 1), g: Number(t[3]) / (t[4] ? 100 / 255 : 1), b: Number(t[5]) / (t[6] ? 100 / 255 : 1), a: t[7] === void 0 ? 1 : Number(t[7]) / (t[8] ? 100 : 1) }) : null;
|
|
717
717
|
}, "rgb"], [function(e) {
|
|
718
|
-
var t =
|
|
718
|
+
var t = bo.exec(e) || yo.exec(e);
|
|
719
719
|
if (!t) return null;
|
|
720
|
-
var o, r, s =
|
|
721
|
-
return
|
|
720
|
+
var o, r, s = fe({ h: (o = t[1], r = t[2], r === void 0 && (r = "deg"), Number(o) * (mo[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 me(s);
|
|
722
722
|
}, "hsl"]], object: [[function(e) {
|
|
723
723
|
var t = e.r, o = e.g, r = e.b, s = e.a, i = s === void 0 ? 1 : s;
|
|
724
|
-
return L(t) && L(o) && L(r) ?
|
|
724
|
+
return L(t) && L(o) && L(r) ? he({ r: Number(t), g: Number(o), b: Number(r), a: Number(i) }) : null;
|
|
725
725
|
}, "rgb"], [function(e) {
|
|
726
726
|
var t = e.h, o = e.s, r = e.l, s = e.a, i = s === void 0 ? 1 : s;
|
|
727
727
|
if (!L(t) || !L(o) || !L(r)) return null;
|
|
728
|
-
var a =
|
|
729
|
-
return
|
|
728
|
+
var a = fe({ h: Number(t), s: Number(o), l: Number(r), a: Number(i) });
|
|
729
|
+
return me(a);
|
|
730
730
|
}, "hsl"], [function(e) {
|
|
731
731
|
var t = e.h, o = e.s, r = e.v, s = e.a, i = s === void 0 ? 1 : s;
|
|
732
732
|
if (!L(t) || !L(o) || !L(r)) return null;
|
|
733
733
|
var a = function(l) {
|
|
734
|
-
return { h:
|
|
734
|
+
return { h: Le(l.h), s: T(l.s, 0, 100), v: T(l.v, 0, 100), a: T(l.a) };
|
|
735
735
|
}({ h: Number(t), s: Number(o), v: Number(r), a: Number(i) });
|
|
736
|
-
return
|
|
737
|
-
}, "hsv"]] },
|
|
736
|
+
return De(a);
|
|
737
|
+
}, "hsv"]] }, be = 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" ?
|
|
743
|
+
}, $o = function(e) {
|
|
744
|
+
return typeof e == "string" ? be(e.trim(), ve.string) : typeof e == "object" && e !== null ? be(e, ve.object) : [null, void 0];
|
|
745
745
|
}, Bt = function(e, t) {
|
|
746
|
-
var o =
|
|
747
|
-
return { h: o.h, s:
|
|
746
|
+
var o = ht(e);
|
|
747
|
+
return { h: o.h, s: T(o.s + 100 * t, 0, 100), l: o.l, a: o.a };
|
|
748
748
|
}, Ut = function(e) {
|
|
749
749
|
return (299 * e.r + 587 * e.g + 114 * e.b) / 1e3 / 255;
|
|
750
|
-
},
|
|
751
|
-
var o =
|
|
752
|
-
return { h: o.h, s: o.s, l:
|
|
753
|
-
},
|
|
750
|
+
}, ye = function(e, t) {
|
|
751
|
+
var o = ht(e);
|
|
752
|
+
return { h: o.h, s: o.s, l: T(o.l + 100 * t, 0, 100), a: o.a };
|
|
753
|
+
}, we = function() {
|
|
754
754
|
function e(t) {
|
|
755
|
-
this.parsed =
|
|
755
|
+
this.parsed = $o(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
|
|
760
|
+
return C(Ut(this.rgba), 2);
|
|
761
761
|
}, e.prototype.isDark = function() {
|
|
762
762
|
return Ut(this.rgba) < 0.5;
|
|
763
763
|
}, e.prototype.isLight = function() {
|
|
764
764
|
return Ut(this.rgba) >= 0.5;
|
|
765
765
|
}, e.prototype.toHex = function() {
|
|
766
|
-
return t = Rt(this.rgba), o = t.r, r = t.g, s = t.b, a = (i = t.a) < 1 ?
|
|
766
|
+
return t = Rt(this.rgba), o = t.r, r = t.g, s = t.b, a = (i = t.a) < 1 ? xt(C(255 * i)) : "", "#" + xt(o) + xt(r) + xt(s) + a;
|
|
767
767
|
var t, o, r, s, i, a;
|
|
768
768
|
}, e.prototype.toRgb = function() {
|
|
769
769
|
return Rt(this.rgba);
|
|
@@ -771,42 +771,42 @@ var fo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, L = function(e) {
|
|
|
771
771
|
return t = Rt(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 ge(ht(this.rgba));
|
|
775
775
|
}, e.prototype.toHslString = function() {
|
|
776
|
-
return t =
|
|
776
|
+
return t = ge(ht(this.rgba)), o = t.h, r = t.s, s = t.l, (i = t.a) < 1 ? "hsla(" + o + ", " + r + "%, " + s + "%, " + i + ")" : "hsl(" + o + ", " + r + "%, " + s + "%)";
|
|
777
777
|
var t, o, r, s, i;
|
|
778
778
|
}, e.prototype.toHsv = function() {
|
|
779
|
-
return t =
|
|
779
|
+
return t = Ne(this.rgba), { h: C(t.h), s: C(t.s), v: C(t.v), a: C(t.a, 3) };
|
|
780
780
|
var t;
|
|
781
781
|
}, e.prototype.invert = function() {
|
|
782
|
-
return
|
|
782
|
+
return O({ 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), O(Bt(this.rgba, t));
|
|
786
786
|
}, e.prototype.desaturate = function(t) {
|
|
787
|
-
return t === void 0 && (t = 0.1),
|
|
787
|
+
return t === void 0 && (t = 0.1), O(Bt(this.rgba, -t));
|
|
788
788
|
}, e.prototype.grayscale = function() {
|
|
789
|
-
return
|
|
789
|
+
return O(Bt(this.rgba, -1));
|
|
790
790
|
}, e.prototype.lighten = function(t) {
|
|
791
|
-
return t === void 0 && (t = 0.1),
|
|
791
|
+
return t === void 0 && (t = 0.1), O(ye(this.rgba, t));
|
|
792
792
|
}, e.prototype.darken = function(t) {
|
|
793
|
-
return t === void 0 && (t = 0.1),
|
|
793
|
+
return t === void 0 && (t = 0.1), O(ye(this.rgba, -t));
|
|
794
794
|
}, e.prototype.rotate = function(t) {
|
|
795
795
|
return t === void 0 && (t = 15), this.hue(this.hue() + t);
|
|
796
796
|
}, e.prototype.alpha = function(t) {
|
|
797
|
-
return typeof t == "number" ?
|
|
797
|
+
return typeof t == "number" ? O({ r: (o = this.rgba).r, g: o.g, b: o.b, a: t }) : C(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 = ht(this.rgba);
|
|
801
|
+
return typeof t == "number" ? O({ h: t, s: o.s, l: o.l, a: o.a }) : C(o.h);
|
|
802
802
|
}, e.prototype.isEqual = function(t) {
|
|
803
|
-
return this.toHex() ===
|
|
803
|
+
return this.toHex() === O(t).toHex();
|
|
804
804
|
}, e;
|
|
805
|
-
}(),
|
|
806
|
-
return e instanceof
|
|
805
|
+
}(), O = function(e) {
|
|
806
|
+
return e instanceof we ? e : new we(e);
|
|
807
807
|
};
|
|
808
808
|
const Vt = process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
809
|
-
function
|
|
809
|
+
function So(e) {
|
|
810
810
|
return {
|
|
811
811
|
debug: (t, ...o) => {
|
|
812
812
|
Vt && console.debug(`[${e}]`, t, ...o);
|
|
@@ -822,9 +822,9 @@ function wo(e) {
|
|
|
822
822
|
}
|
|
823
823
|
};
|
|
824
824
|
}
|
|
825
|
-
const
|
|
826
|
-
var
|
|
827
|
-
const
|
|
825
|
+
const g = So("Pollcatch");
|
|
826
|
+
var Re = /* @__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))(Re || {});
|
|
827
|
+
const Co = {
|
|
828
828
|
black: "#000000",
|
|
829
829
|
white: "#ffffff",
|
|
830
830
|
red: "#ff0000",
|
|
@@ -841,21 +841,21 @@ const $o = {
|
|
|
841
841
|
teal: "#008080",
|
|
842
842
|
navy: "#000080"
|
|
843
843
|
};
|
|
844
|
-
function
|
|
844
|
+
function ko(e) {
|
|
845
845
|
const t = e.toLowerCase().trim();
|
|
846
|
-
return
|
|
846
|
+
return Co[t] || null;
|
|
847
847
|
}
|
|
848
848
|
function jt(e, t) {
|
|
849
|
-
const o =
|
|
849
|
+
const o = xe(e), r = xe(t), s = Math.max(o, r), i = Math.min(o, r);
|
|
850
850
|
return (s + 0.05) / (i + 0.05);
|
|
851
851
|
}
|
|
852
|
-
function
|
|
853
|
-
const t =
|
|
852
|
+
function xe(e) {
|
|
853
|
+
const t = Ao(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);
|
|
854
854
|
return 0.2126 * i + 0.7152 * a + 0.0722 * l;
|
|
855
855
|
}
|
|
856
|
-
function
|
|
857
|
-
if (!
|
|
858
|
-
return
|
|
856
|
+
function Eo(e, t = {}) {
|
|
857
|
+
if (!O(e).isValid())
|
|
858
|
+
return g.warn(`Invalid color provided: ${e}`), "black";
|
|
859
859
|
const {
|
|
860
860
|
minContrast: r = 4.5,
|
|
861
861
|
colorOptions: s = ["black", "white", "light", "dark"],
|
|
@@ -875,23 +875,23 @@ function Co(e, t = {}) {
|
|
|
875
875
|
n = a, d = p;
|
|
876
876
|
for (const h of l) {
|
|
877
877
|
if (h === a) continue;
|
|
878
|
-
const
|
|
879
|
-
|
|
878
|
+
const v = jt(e, h);
|
|
879
|
+
v > d && (d = v, n = h);
|
|
880
880
|
}
|
|
881
|
-
|
|
881
|
+
g.warn(
|
|
882
882
|
`No color option met the minimum contrast ratio of ${r}:1 against ${e}. Using ${n} with contrast ratio ${d.toFixed(2)}:1 instead.`
|
|
883
883
|
);
|
|
884
884
|
}
|
|
885
885
|
return n;
|
|
886
886
|
}
|
|
887
|
-
function
|
|
888
|
-
const o =
|
|
887
|
+
function Ao(e) {
|
|
888
|
+
const o = ko(e) || e, r = O(o);
|
|
889
889
|
if (!r.isValid())
|
|
890
|
-
return
|
|
890
|
+
return g.warn(`Invalid color provided: ${e}`), { r: 0, g: 0, b: 0 };
|
|
891
891
|
const { r: s, g: i, b: a } = r.toRgb();
|
|
892
892
|
return { r: s, g: i, b: a };
|
|
893
893
|
}
|
|
894
|
-
function
|
|
894
|
+
function z(e, t) {
|
|
895
895
|
const r = t ? {
|
|
896
896
|
left: "start",
|
|
897
897
|
right: "end",
|
|
@@ -922,7 +922,7 @@ function qt(e, t = "1rem", o = 1) {
|
|
|
922
922
|
const l = parseFloat(i);
|
|
923
923
|
return isNaN(l) ? t : `${l}rem`;
|
|
924
924
|
}
|
|
925
|
-
function
|
|
925
|
+
function Po(e, t = "4px") {
|
|
926
926
|
if (!e) return t;
|
|
927
927
|
const o = {
|
|
928
928
|
xs: "2px",
|
|
@@ -943,7 +943,7 @@ function Eo(e, t = "4px") {
|
|
|
943
943
|
return isNaN(a) ? t : `${a}px`;
|
|
944
944
|
}
|
|
945
945
|
var N = /* @__PURE__ */ ((e) => (e.BUTTON = "button", e.CHECKBOX = "checkbox", e.RADIO = "radio", e.RADIOGROUP = "radiogroup", e.SWITCH = "switch", e.TAB = "tab", e.TABLIST = "tablist", e.TABPANEL = "tabpanel", e.MENU = "menu", e.MENUITEM = "menuitem", e.MENUITEMCHECKBOX = "menuitemcheckbox", e.MENUITEMRADIO = "menuitemradio", e.SLIDER = "slider", e.TEXTBOX = "textbox", e.COMBOBOX = "combobox", e.LISTBOX = "listbox", e.OPTION = "option", e.PROGRESSBAR = "progressbar", e.STATUS = "status", e.ALERT = "alert", e.DIALOG = "dialog", e.GROUP = "group", e.REGION = "region", e.NONE = "none", e.PRESENTATION = "presentation", e))(N || {});
|
|
946
|
-
function
|
|
946
|
+
function st(e) {
|
|
947
947
|
const t = {};
|
|
948
948
|
e.role !== void 0 && (t.role = e.role);
|
|
949
949
|
for (const [o, r] of Object.entries(e)) {
|
|
@@ -953,16 +953,16 @@ function rt(e) {
|
|
|
953
953
|
}
|
|
954
954
|
return t;
|
|
955
955
|
}
|
|
956
|
-
function
|
|
957
|
-
return
|
|
956
|
+
function To(e, t, o) {
|
|
957
|
+
return st({
|
|
958
958
|
role: "button",
|
|
959
959
|
ariaLabel: e,
|
|
960
960
|
ariaPressed: t,
|
|
961
961
|
ariaDisabled: o
|
|
962
962
|
});
|
|
963
963
|
}
|
|
964
|
-
function
|
|
965
|
-
return
|
|
964
|
+
function _o(e, t, o, r = !1) {
|
|
965
|
+
return st({
|
|
966
966
|
role: r ? "radio" : "checkbox",
|
|
967
967
|
ariaLabel: e,
|
|
968
968
|
ariaChecked: t,
|
|
@@ -972,79 +972,79 @@ function Po(e, t, o, r = !1) {
|
|
|
972
972
|
function Ht(e, t, o) {
|
|
973
973
|
typeof o == "boolean" ? e.setAttribute(t, o ? "true" : "false") : e.setAttribute(t, o);
|
|
974
974
|
}
|
|
975
|
-
function
|
|
975
|
+
function Oo(e) {
|
|
976
976
|
if (typeof e != "string")
|
|
977
977
|
return !1;
|
|
978
978
|
const t = e.replace(/[<>"']/g, "").trim();
|
|
979
979
|
return /^(#[0-9a-fA-F]{3,8}|rgb\([^)]+\)|rgba\([^)]+\)|hsl\([^)]+\)|hsla\([^)]+\)|[a-zA-Z]+)$/.test(t);
|
|
980
980
|
}
|
|
981
|
-
function
|
|
982
|
-
return
|
|
981
|
+
function ot(e) {
|
|
982
|
+
return Oo(e) ? e.replace(/[<>"']/g, "").trim() : (g.warn("Invalid color value:", e), "#000000");
|
|
983
983
|
}
|
|
984
|
-
function
|
|
984
|
+
function Io(e) {
|
|
985
985
|
if (typeof e != "string")
|
|
986
|
-
return
|
|
986
|
+
return g.warn("Non-string value passed to sanitizeCSS:", typeof e), "";
|
|
987
987
|
let t = e;
|
|
988
988
|
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;
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function zo(e) {
|
|
991
991
|
return typeof e != "string" || !e.trim() ? "" : e.replace(
|
|
992
992
|
/([^{}:;]+):\s*([^;{}!]+)(\s*!important)?\s*(;|})/gi,
|
|
993
993
|
(t, o, r, s, i) => s ? t : `${o}: ${r.trim()} !important${i}`
|
|
994
994
|
);
|
|
995
995
|
}
|
|
996
|
-
const
|
|
997
|
-
function
|
|
998
|
-
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (
|
|
996
|
+
const Yt = "https://jpxwfjorwcsrqraorpbj.supabase.co/functions/v1/data", Mo = "pc_session_id", Lo = 24 * 60 * 60 * 1e3;
|
|
997
|
+
function $e() {
|
|
998
|
+
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) {
|
|
999
999
|
const t = Math.random() * 16 | 0;
|
|
1000
1000
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
1001
1001
|
}));
|
|
1002
1002
|
}
|
|
1003
|
-
function
|
|
1003
|
+
function te() {
|
|
1004
1004
|
const e = "test-local-storage";
|
|
1005
1005
|
try {
|
|
1006
1006
|
return localStorage.setItem(e, e), localStorage.removeItem(e), !0;
|
|
1007
1007
|
} catch {
|
|
1008
|
-
return
|
|
1008
|
+
return g.warn("localStorage not available, session ID will not persist"), !1;
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1011
|
+
function Be(e) {
|
|
1012
1012
|
try {
|
|
1013
1013
|
const t = localStorage.getItem(e);
|
|
1014
1014
|
return t ? JSON.parse(t) : void 0;
|
|
1015
1015
|
} catch (t) {
|
|
1016
|
-
|
|
1016
|
+
g.warn(`Failed to get item from localStorage: ${e}`, t);
|
|
1017
1017
|
return;
|
|
1018
1018
|
}
|
|
1019
1019
|
}
|
|
1020
|
-
function
|
|
1020
|
+
function Ue(e, t) {
|
|
1021
1021
|
try {
|
|
1022
1022
|
return localStorage.setItem(e, JSON.stringify(t)), !0;
|
|
1023
1023
|
} catch (o) {
|
|
1024
|
-
return
|
|
1024
|
+
return g.warn(`Failed to set item in localStorage: ${e}`, o), !1;
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
-
async function
|
|
1028
|
-
const e =
|
|
1029
|
-
if (
|
|
1030
|
-
const o =
|
|
1027
|
+
async function Se() {
|
|
1028
|
+
const e = Mo, t = Lo;
|
|
1029
|
+
if (te()) {
|
|
1030
|
+
const o = Be(e);
|
|
1031
1031
|
if (o && o.id && o.timestamp && Date.now() - o.timestamp < t)
|
|
1032
|
-
return
|
|
1033
|
-
|
|
1032
|
+
return g.debug("Using existing session ID from localStorage"), o.id;
|
|
1033
|
+
g.debug(
|
|
1034
1034
|
o ? "Session ID expired" : "No session ID found",
|
|
1035
1035
|
"generating new one"
|
|
1036
1036
|
);
|
|
1037
|
-
const r =
|
|
1038
|
-
return
|
|
1037
|
+
const r = $e();
|
|
1038
|
+
return Ue(e, {
|
|
1039
1039
|
id: r,
|
|
1040
1040
|
timestamp: Date.now()
|
|
1041
|
-
}) ?
|
|
1041
|
+
}) ? g.debug("Generated and stored new session ID") : g.warn("Generated session ID but failed to store it"), r;
|
|
1042
1042
|
} else {
|
|
1043
|
-
const o =
|
|
1044
|
-
return
|
|
1043
|
+
const o = $e();
|
|
1044
|
+
return g.debug("Generated non-persistent session ID"), o;
|
|
1045
1045
|
}
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1047
|
+
function ft(e) {
|
|
1048
1048
|
if (!e || typeof e != "object")
|
|
1049
1049
|
return 0;
|
|
1050
1050
|
let t = 0, o = 0, r = 0;
|
|
@@ -1057,7 +1057,7 @@ function Et(e) {
|
|
|
1057
1057
|
const s = t / r * 100, i = o / r * 100;
|
|
1058
1058
|
return Math.round(s - i);
|
|
1059
1059
|
}
|
|
1060
|
-
function
|
|
1060
|
+
function No(e) {
|
|
1061
1061
|
if (!e || typeof e != "object")
|
|
1062
1062
|
return { promoters: 0, passives: 0, detractors: 0 };
|
|
1063
1063
|
let t = 0, o = 0, r = 0;
|
|
@@ -1067,14 +1067,14 @@ function Mo(e) {
|
|
|
1067
1067
|
}
|
|
1068
1068
|
return { promoters: t, passives: o, detractors: r };
|
|
1069
1069
|
}
|
|
1070
|
-
function
|
|
1070
|
+
function Do(e, t) {
|
|
1071
1071
|
const o = {};
|
|
1072
1072
|
for (const r of t)
|
|
1073
1073
|
o[r] = e[r] || 0;
|
|
1074
1074
|
return o;
|
|
1075
1075
|
}
|
|
1076
|
-
function
|
|
1077
|
-
const o = t ?
|
|
1076
|
+
function Ce(e, t) {
|
|
1077
|
+
const o = t ? Do(e, t) : e;
|
|
1078
1078
|
let r = 0, s = 0;
|
|
1079
1079
|
for (const [a, l] of Object.entries(o)) {
|
|
1080
1080
|
s += l;
|
|
@@ -1093,26 +1093,26 @@ function D() {
|
|
|
1093
1093
|
updated: (/* @__PURE__ */ new Date()).toISOString()
|
|
1094
1094
|
};
|
|
1095
1095
|
}
|
|
1096
|
-
function
|
|
1097
|
-
if (!
|
|
1096
|
+
function Ro(e) {
|
|
1097
|
+
if (!te())
|
|
1098
1098
|
return D();
|
|
1099
1099
|
try {
|
|
1100
|
-
const t =
|
|
1100
|
+
const t = Be(e);
|
|
1101
1101
|
return t ? { ...D(), ...t } : D();
|
|
1102
1102
|
} catch (t) {
|
|
1103
|
-
return
|
|
1103
|
+
return g.warn("Failed to load localStats from localStorage", t), D();
|
|
1104
1104
|
}
|
|
1105
1105
|
}
|
|
1106
|
-
function
|
|
1107
|
-
if (!
|
|
1106
|
+
function Bo(e, t) {
|
|
1107
|
+
if (!te())
|
|
1108
1108
|
return !1;
|
|
1109
1109
|
try {
|
|
1110
|
-
return
|
|
1110
|
+
return Ue(e, t) ? (g.debug("Saved localStats to localStorage", t), !0) : !1;
|
|
1111
1111
|
} catch (o) {
|
|
1112
|
-
return
|
|
1112
|
+
return g.warn("Failed to save localStats to localStorage", o), !1;
|
|
1113
1113
|
}
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1115
|
+
function Uo(e, t) {
|
|
1116
1116
|
const o = {
|
|
1117
1117
|
count: Math.max(0, e.count - t.count),
|
|
1118
1118
|
sum: (e.sum || 0) - (t.sum || 0),
|
|
@@ -1125,9 +1125,9 @@ function Bo(e, t) {
|
|
|
1125
1125
|
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)
|
|
1126
1126
|
for (const [r, s] of Object.entries(t.breakdown))
|
|
1127
1127
|
o.breakdown[r] && (o.breakdown[r] = Math.max(0, o.breakdown[r] - s), o.breakdown[r] === 0 && delete o.breakdown[r]);
|
|
1128
|
-
return o.nps =
|
|
1128
|
+
return o.nps = ft((o == null ? void 0 : o.breakdown) || {}), o;
|
|
1129
1129
|
}
|
|
1130
|
-
function
|
|
1130
|
+
function Vo(e, t) {
|
|
1131
1131
|
if (!e.count && !t.count)
|
|
1132
1132
|
return D();
|
|
1133
1133
|
if (!e.count)
|
|
@@ -1146,12 +1146,12 @@ function Uo(e, t) {
|
|
|
1146
1146
|
for (const [r, s] of Object.entries(t.breakdown))
|
|
1147
1147
|
o.breakdown[r] = (o.breakdown[r] || 0) + s;
|
|
1148
1148
|
}
|
|
1149
|
-
return o.nps =
|
|
1149
|
+
return o.nps = ft((o == null ? void 0 : o.breakdown) || {}), o;
|
|
1150
1150
|
}
|
|
1151
|
-
function
|
|
1151
|
+
function Ve(e) {
|
|
1152
1152
|
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);
|
|
1153
1153
|
}
|
|
1154
|
-
function
|
|
1154
|
+
function Ot(e) {
|
|
1155
1155
|
if (!e || typeof e != "string")
|
|
1156
1156
|
return !1;
|
|
1157
1157
|
const t = e.trim();
|
|
@@ -1165,7 +1165,7 @@ function _t(e) {
|
|
|
1165
1165
|
return !1;
|
|
1166
1166
|
}
|
|
1167
1167
|
}
|
|
1168
|
-
function
|
|
1168
|
+
function jo(e) {
|
|
1169
1169
|
if (!e || typeof e != "string")
|
|
1170
1170
|
return [];
|
|
1171
1171
|
const t = e.trim();
|
|
@@ -1180,25 +1180,33 @@ function Vo(e) {
|
|
|
1180
1180
|
}
|
|
1181
1181
|
return t.split(",").map((o) => o.trim()).filter((o) => o !== "");
|
|
1182
1182
|
}
|
|
1183
|
-
function
|
|
1183
|
+
function qo(e, t) {
|
|
1184
1184
|
const o = /{([^{}]+)}/g;
|
|
1185
1185
|
return e.replace(o, (r, s) => {
|
|
1186
1186
|
const i = s.trim(), a = t[i];
|
|
1187
1187
|
return a !== void 0 ? String(a) : r;
|
|
1188
1188
|
});
|
|
1189
1189
|
}
|
|
1190
|
-
function
|
|
1190
|
+
function Ho(e, t) {
|
|
1191
1191
|
let o = 2166136261;
|
|
1192
1192
|
const r = e + ":" + t;
|
|
1193
1193
|
for (let s = 0; s < r.length; s++)
|
|
1194
1194
|
o ^= r.charCodeAt(s), o += (o << 1) + (o << 4) + (o << 7) + (o << 8) + (o << 24);
|
|
1195
1195
|
return (o >>> 0).toString(16).padStart(8, "0");
|
|
1196
1196
|
}
|
|
1197
|
-
function
|
|
1197
|
+
function Fo(e, t = 50) {
|
|
1198
1198
|
return e.length <= t ? e : e.substring(0, t).trim() + "...";
|
|
1199
1199
|
}
|
|
1200
|
-
const
|
|
1201
|
-
|
|
1200
|
+
const Wt = /* @__PURE__ */ new Map();
|
|
1201
|
+
function Yo(e, t) {
|
|
1202
|
+
Wt.set(e, t);
|
|
1203
|
+
}
|
|
1204
|
+
function Wo(e) {
|
|
1205
|
+
const t = Wt.get(e);
|
|
1206
|
+
return t && Wt.delete(e), t;
|
|
1207
|
+
}
|
|
1208
|
+
const ke = 5;
|
|
1209
|
+
class Ko {
|
|
1202
1210
|
// Tracks if user has ever made a selection (even if later deselected)
|
|
1203
1211
|
constructor(t) {
|
|
1204
1212
|
this.stats = D(), this.localStats = D(), this.prevLocalStats = D(), this.isLoading = !0, this.isLoadingConfig = !1, this.isSubmitting = !1, this.hasInteracted = !1, (this.host = t).addController(this);
|
|
@@ -1212,13 +1220,13 @@ class Fo {
|
|
|
1212
1220
|
*/
|
|
1213
1221
|
validateWidgetIdentifier() {
|
|
1214
1222
|
const t = this.host;
|
|
1215
|
-
return t.widgetId ? /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t.widgetId) ? { type: "registered" } : { type: "none", error: `Invalid widget-id format: ${t.widgetId}` } : t.name ? t.name.length <
|
|
1223
|
+
return t.widgetId ? /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t.widgetId) ? { type: "registered" } : { type: "none", error: `Invalid widget-id format: ${t.widgetId}` } : t.name ? t.name.length < ke ? {
|
|
1216
1224
|
type: "none",
|
|
1217
|
-
error: `Widget name must be at least ${
|
|
1225
|
+
error: `Widget name must be at least ${ke} characters long. Got: "${t.name}"`
|
|
1218
1226
|
} : { type: "public" } : { type: "none", error: "Widget requires either widget-id or name attribute" };
|
|
1219
1227
|
}
|
|
1220
1228
|
async getLocalStatsKey() {
|
|
1221
|
-
const t = this.host, o = await
|
|
1229
|
+
const t = this.host, o = await Se(), r = t.widgetId || t.name || "unnamed";
|
|
1222
1230
|
return `pc-local-stats-${o}-${r}`;
|
|
1223
1231
|
}
|
|
1224
1232
|
/**
|
|
@@ -1238,7 +1246,7 @@ class Fo {
|
|
|
1238
1246
|
for (const [s, i] of Object.entries(t)) {
|
|
1239
1247
|
if (i == null) continue;
|
|
1240
1248
|
const a = s.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
1241
|
-
typeof i == "boolean" ? i ? r.setAttribute(a, "") : r.removeAttribute(a) : typeof i == "object" ? r.setAttribute(a, JSON.stringify(i)) : r.setAttribute(a, String(i)),
|
|
1249
|
+
typeof i == "boolean" ? i ? r.setAttribute(a, "") : r.removeAttribute(a) : typeof i == "object" ? r.setAttribute(a, JSON.stringify(i)) : r.setAttribute(a, String(i)), g.debug(`Applied widget attribute: ${a}=${i}`);
|
|
1242
1250
|
}
|
|
1243
1251
|
}
|
|
1244
1252
|
/**
|
|
@@ -1250,61 +1258,78 @@ class Fo {
|
|
|
1250
1258
|
this.isLoading = !1, this.stats = this.localStats, this.host.requestUpdate();
|
|
1251
1259
|
const o = this.validateWidgetIdentifier();
|
|
1252
1260
|
if (o.error) {
|
|
1253
|
-
|
|
1261
|
+
g.error(o.error);
|
|
1254
1262
|
return;
|
|
1255
1263
|
}
|
|
1264
|
+
if (o.type === "registered" && t.widgetId) {
|
|
1265
|
+
const a = Wo(t.widgetId);
|
|
1266
|
+
if (a) {
|
|
1267
|
+
g.debug("Using prefetched config from cache", { widgetId: t.widgetId }), this.applyWidgetAttributes(a.attributes);
|
|
1268
|
+
const l = this.getOptionsForDataFunc(t), n = Ce(a.stats.breakdown, l), d = n.count, p = n.sum, h = d > 0 ? Math.round(p / d * 10) / 10 : 0, v = d > 0 ? Math.round(p / d * 100) : 0;
|
|
1269
|
+
this.stats = {
|
|
1270
|
+
count: d,
|
|
1271
|
+
sum: p,
|
|
1272
|
+
avg: h,
|
|
1273
|
+
pct: v,
|
|
1274
|
+
nps: t.type === S.nps ? ft(n.breakdown) : 0,
|
|
1275
|
+
breakdown: n.breakdown,
|
|
1276
|
+
updated: a.stats.updatedAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
1277
|
+
}, this.isLoading = !1, this.isLoadingConfig = !1, this.host.requestUpdate();
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1256
1281
|
try {
|
|
1257
1282
|
const a = t.type;
|
|
1258
1283
|
let l;
|
|
1259
1284
|
if (t.dataFunc && typeof window < "u") {
|
|
1260
|
-
const
|
|
1261
|
-
let
|
|
1262
|
-
for (const
|
|
1263
|
-
if (
|
|
1264
|
-
l =
|
|
1285
|
+
const y = t.dataFunc.replace(/^window\./, "").split(".");
|
|
1286
|
+
let E = window;
|
|
1287
|
+
for (const G of y)
|
|
1288
|
+
if (E = E == null ? void 0 : E[G], E === void 0) break;
|
|
1289
|
+
l = E;
|
|
1265
1290
|
}
|
|
1266
1291
|
let n, d = null;
|
|
1267
1292
|
if (l && typeof l == "function") {
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1293
|
+
const $ = this.getOptionsForDataFunc(t);
|
|
1294
|
+
g.debug(`Using data function for: ${t.widgetId || t.name}`, {
|
|
1270
1295
|
dataFuncName: t.dataFunc,
|
|
1271
|
-
options:
|
|
1296
|
+
options: $
|
|
1272
1297
|
});
|
|
1273
|
-
const
|
|
1274
|
-
if (
|
|
1275
|
-
if (!
|
|
1276
|
-
throw
|
|
1277
|
-
n =
|
|
1298
|
+
const y = await l(t.widgetId, t.name, $);
|
|
1299
|
+
if (y && typeof y == "object" && "success" in y && "data" in y) {
|
|
1300
|
+
if (!y.success)
|
|
1301
|
+
throw g.error("Custom data function returned unsuccessful response", y), new Error("Custom data function returned unsuccessful response");
|
|
1302
|
+
n = y.data || {};
|
|
1278
1303
|
} else
|
|
1279
|
-
n =
|
|
1304
|
+
n = y || {};
|
|
1280
1305
|
} else {
|
|
1281
|
-
const
|
|
1282
|
-
let
|
|
1283
|
-
o.type === "registered" ? (
|
|
1284
|
-
endpoint:
|
|
1306
|
+
const $ = t.dataEndpoint || Yt;
|
|
1307
|
+
let y;
|
|
1308
|
+
o.type === "registered" ? (y = `${$}/widgets/${encodeURIComponent(t.widgetId)}`, this.isLoadingConfig = !0, this.host.requestUpdate()) : y = `${$}/public-widgets/${encodeURIComponent(t.name)}`, g.debug("Fetching stats for widget", {
|
|
1309
|
+
endpoint: y,
|
|
1285
1310
|
type: o.type
|
|
1286
1311
|
});
|
|
1287
|
-
const
|
|
1288
|
-
if (!
|
|
1289
|
-
throw new Error(`API request failed with status: ${
|
|
1290
|
-
const
|
|
1291
|
-
if (!
|
|
1292
|
-
throw
|
|
1293
|
-
o.type === "registered" ? (d = ((s = (r =
|
|
1312
|
+
const E = await fetch(y);
|
|
1313
|
+
if (!E.ok)
|
|
1314
|
+
throw new Error(`API request failed with status: ${E.status}`);
|
|
1315
|
+
const G = await E.json();
|
|
1316
|
+
if (!G.success)
|
|
1317
|
+
throw g.error("Backend returned unsuccessful response", G), new Error("Backend returned unsuccessful response");
|
|
1318
|
+
o.type === "registered" ? (d = ((s = (r = G.data) == null ? void 0 : r.config) == null ? void 0 : s.attributes) || null, n = ((i = G.data) == null ? void 0 : i.stats) || {}) : n = G.data || {};
|
|
1294
1319
|
}
|
|
1295
1320
|
d && !l && this.applyWidgetAttributes(d);
|
|
1296
|
-
const p = this.getOptionsForDataFunc(t), h =
|
|
1297
|
-
count:
|
|
1321
|
+
const p = this.getOptionsForDataFunc(t), h = Ce(n.breakdown ?? {}, p), v = h.count, x = h.sum, k = v > 0 ? Math.round(x / v * 10) / 10 : 0, P = v > 0 ? Math.round(x / v * 100) : 0, _ = {
|
|
1322
|
+
count: v,
|
|
1298
1323
|
sum: x,
|
|
1299
|
-
avg:
|
|
1300
|
-
pct:
|
|
1301
|
-
nps: a === S.nps ?
|
|
1324
|
+
avg: k,
|
|
1325
|
+
pct: P,
|
|
1326
|
+
nps: a === S.nps ? ft(h.breakdown) : 0,
|
|
1302
1327
|
breakdown: h.breakdown,
|
|
1303
1328
|
updated: n.updatedAt || n.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1304
1329
|
};
|
|
1305
|
-
this.stats =
|
|
1330
|
+
this.stats = _;
|
|
1306
1331
|
} catch (a) {
|
|
1307
|
-
throw
|
|
1332
|
+
throw g.error("Error loading stats:", a, this.localStats), a;
|
|
1308
1333
|
} finally {
|
|
1309
1334
|
this.isLoading = !1, this.isLoadingConfig = !1, this.host.requestUpdate();
|
|
1310
1335
|
}
|
|
@@ -1335,10 +1360,10 @@ class Fo {
|
|
|
1335
1360
|
async loadLocalStats() {
|
|
1336
1361
|
const t = await this.getLocalStatsKey();
|
|
1337
1362
|
try {
|
|
1338
|
-
const o =
|
|
1339
|
-
|
|
1363
|
+
const o = Ro(t);
|
|
1364
|
+
g.debug("Loaded localStats from localStorage", o), this.localStats = o, o.submitted && (this.prevLocalStats = { ...o });
|
|
1340
1365
|
} catch (o) {
|
|
1341
|
-
|
|
1366
|
+
g.warn("Failed to generate localStorage key for localStats", o), this.localStats = D();
|
|
1342
1367
|
}
|
|
1343
1368
|
this.host.requestUpdate();
|
|
1344
1369
|
}
|
|
@@ -1348,9 +1373,9 @@ class Fo {
|
|
|
1348
1373
|
async persistLocalStats() {
|
|
1349
1374
|
try {
|
|
1350
1375
|
const t = await this.getLocalStatsKey();
|
|
1351
|
-
|
|
1376
|
+
Bo(t, this.localStats) || g.warn("Failed to save localStats to localStorage");
|
|
1352
1377
|
} catch (t) {
|
|
1353
|
-
|
|
1378
|
+
g.warn("Failed to save localStats to localStorage", t);
|
|
1354
1379
|
}
|
|
1355
1380
|
}
|
|
1356
1381
|
/**
|
|
@@ -1362,7 +1387,7 @@ class Fo {
|
|
|
1362
1387
|
* @param textValues
|
|
1363
1388
|
*/
|
|
1364
1389
|
updateStats(t, o) {
|
|
1365
|
-
if (this.hasInteracted = !0, this.stats && (this.stats =
|
|
1390
|
+
if (this.hasInteracted = !0, this.stats && (this.stats = Uo(this.stats, this.localStats)), this.localStats = {
|
|
1366
1391
|
count: t > 0 || o.length > 0 ? 1 : 0,
|
|
1367
1392
|
sum: t,
|
|
1368
1393
|
// e.g. number of stars, nps value
|
|
@@ -1376,15 +1401,15 @@ class Fo {
|
|
|
1376
1401
|
}, o && o.length > 0)
|
|
1377
1402
|
for (const r of o)
|
|
1378
1403
|
r && (this.localStats.breakdown[r] = 1);
|
|
1379
|
-
this.stats =
|
|
1404
|
+
this.stats = Vo(this.stats, this.localStats), g.debug("Stats updated - remote: ", this.stats), g.debug("Stats updated - local: ", this.stats), this.persistLocalStats(), this.host.requestUpdate();
|
|
1380
1405
|
}
|
|
1381
1406
|
async markStatsAsSubmitted() {
|
|
1382
1407
|
this.localStats.submitted = (/* @__PURE__ */ new Date()).toISOString(), this.prevLocalStats = { ...this.localStats }, await this.persistLocalStats(), this.host.requestUpdate();
|
|
1383
1408
|
}
|
|
1384
1409
|
async submitStats() {
|
|
1385
1410
|
if (!this.hasLocalStats() && !this.hasInteracted)
|
|
1386
|
-
throw
|
|
1387
|
-
const t = this.host, o = Math.floor(Date.now() / 1e3).toString(), r = await
|
|
1411
|
+
throw g.warn("No local stats to submit"), new Error("No local stats to submit");
|
|
1412
|
+
const t = this.host, o = Math.floor(Date.now() / 1e3).toString(), r = await Se(), s = this.localStats.sum, i = Object.keys(this.localStats.breakdown || {}), a = this.prevLocalStats.sum, l = Object.keys(this.prevLocalStats.breakdown || {});
|
|
1388
1413
|
this.isSubmitting = !0, this.host.requestUpdate();
|
|
1389
1414
|
const n = {
|
|
1390
1415
|
sessionId: r,
|
|
@@ -1398,11 +1423,11 @@ class Fo {
|
|
|
1398
1423
|
prevTextValues: l,
|
|
1399
1424
|
metadata: t.metadata,
|
|
1400
1425
|
timestamp: o
|
|
1401
|
-
}, d =
|
|
1426
|
+
}, d = Ho(JSON.stringify(n), o);
|
|
1402
1427
|
try {
|
|
1403
1428
|
await this.sendStats({ ...n, hash: d }), await this.markStatsAsSubmitted(), this.dispatchSubmitEvent(n);
|
|
1404
1429
|
} catch (p) {
|
|
1405
|
-
|
|
1430
|
+
g.warn("Failed to send stats event", p);
|
|
1406
1431
|
} finally {
|
|
1407
1432
|
this.isSubmitting = !1, this.host.requestUpdate();
|
|
1408
1433
|
}
|
|
@@ -1411,25 +1436,25 @@ class Fo {
|
|
|
1411
1436
|
async sendStats(t) {
|
|
1412
1437
|
const o = this.host;
|
|
1413
1438
|
if (o.dataFunc) {
|
|
1414
|
-
|
|
1439
|
+
g.debug("Skip sending stats as data function is in use.");
|
|
1415
1440
|
return;
|
|
1416
1441
|
}
|
|
1417
1442
|
const r = this.validateWidgetIdentifier();
|
|
1418
1443
|
if (r.error)
|
|
1419
|
-
throw
|
|
1420
|
-
const s = o.dataEndpoint ||
|
|
1421
|
-
if (!
|
|
1422
|
-
throw
|
|
1444
|
+
throw g.error(r.error), new Error(r.error);
|
|
1445
|
+
const s = o.dataEndpoint || Yt;
|
|
1446
|
+
if (!Ot(s))
|
|
1447
|
+
throw g.error("Invalid data endpoint", { dataEndpoint: s }), new Error(`Invalid data endpoint: ${s}`);
|
|
1423
1448
|
let i;
|
|
1424
1449
|
r.type === "registered" ? i = `${s}/widgets/${encodeURIComponent(o.widgetId)}` : i = `${s}/public-widgets/${encodeURIComponent(o.name)}`;
|
|
1425
1450
|
const a = JSON.stringify(t);
|
|
1426
1451
|
try {
|
|
1427
|
-
if (
|
|
1452
|
+
if (g.debug("Sending stats", { endpoint: i, event: t }), typeof navigator < "u" && navigator.sendBeacon)
|
|
1428
1453
|
if (navigator.sendBeacon(i, a)) {
|
|
1429
|
-
|
|
1454
|
+
g.debug("Successfully sent stats via sendBeacon");
|
|
1430
1455
|
return;
|
|
1431
1456
|
} else
|
|
1432
|
-
|
|
1457
|
+
g.debug("sendBeacon failed, falling back to fetch");
|
|
1433
1458
|
const l = await fetch(i, {
|
|
1434
1459
|
body: a,
|
|
1435
1460
|
method: "POST",
|
|
@@ -1440,9 +1465,9 @@ class Fo {
|
|
|
1440
1465
|
});
|
|
1441
1466
|
if (!l.ok)
|
|
1442
1467
|
throw new Error(`API request failed with status: ${l.status}`);
|
|
1443
|
-
|
|
1468
|
+
g.debug("Successfully sent stats via fetch");
|
|
1444
1469
|
} catch (l) {
|
|
1445
|
-
throw
|
|
1470
|
+
throw g.error("Failed to send analytics:", l), l;
|
|
1446
1471
|
}
|
|
1447
1472
|
}
|
|
1448
1473
|
/**
|
|
@@ -1457,9 +1482,9 @@ class Fo {
|
|
|
1457
1482
|
sum: (o == null ? void 0 : o.sum) || 0,
|
|
1458
1483
|
avg: s,
|
|
1459
1484
|
pct: (o == null ? void 0 : o.pct) || 0,
|
|
1460
|
-
nps: r.type === S.nps ?
|
|
1485
|
+
nps: r.type === S.nps ? ft((o == null ? void 0 : o.breakdown) || {}) : 0
|
|
1461
1486
|
};
|
|
1462
|
-
return
|
|
1487
|
+
return g.debug("Stats data: ", this.stats), qo(t, i);
|
|
1463
1488
|
}
|
|
1464
1489
|
/**
|
|
1465
1490
|
* Checks if a value is selected in the local stats
|
|
@@ -1519,7 +1544,7 @@ class Fo {
|
|
|
1519
1544
|
bubbles: !0,
|
|
1520
1545
|
composed: !0
|
|
1521
1546
|
});
|
|
1522
|
-
t.dispatchEvent(i),
|
|
1547
|
+
t.dispatchEvent(i), g.debug("Dispatched change event", s);
|
|
1523
1548
|
}
|
|
1524
1549
|
/**
|
|
1525
1550
|
* Dispatches a 'submit' CustomEvent on the host element
|
|
@@ -1531,7 +1556,7 @@ class Fo {
|
|
|
1531
1556
|
bubbles: !0,
|
|
1532
1557
|
composed: !0
|
|
1533
1558
|
});
|
|
1534
|
-
o.dispatchEvent(r),
|
|
1559
|
+
o.dispatchEvent(r), g.debug("Dispatched submit event", t);
|
|
1535
1560
|
}
|
|
1536
1561
|
hasLocalStats() {
|
|
1537
1562
|
var t;
|
|
@@ -1546,7 +1571,7 @@ class Fo {
|
|
|
1546
1571
|
return ((t = this.localStats) == null ? void 0 : t.submitted) !== void 0 && this.hasLocalStats();
|
|
1547
1572
|
}
|
|
1548
1573
|
}
|
|
1549
|
-
class
|
|
1574
|
+
class Go {
|
|
1550
1575
|
constructor(t, o) {
|
|
1551
1576
|
this.isEditing = !0, this.isChartVisible = !1, this.isStatsVisible = !1, this.isThankYouVisible = !1, this.isReactionPopoverVisible = !1, this.initialized = !1, this.handleClickOutside = (r) => {
|
|
1552
1577
|
r.target !== this.host && (this.toggleThankYouVisibility(!1), this.toggleReactionPopoverVisibility(!1));
|
|
@@ -1634,8 +1659,8 @@ class Yo {
|
|
|
1634
1659
|
return !(this.host.readonly || !this.isEditing);
|
|
1635
1660
|
}
|
|
1636
1661
|
}
|
|
1637
|
-
var
|
|
1638
|
-
function
|
|
1662
|
+
var ee = /* @__PURE__ */ ((e) => (e.DECORATIVE = "decorative", e.FUNCTIONAL = "functional", e.STATUS = "status", e))(ee || {});
|
|
1663
|
+
function je(e, t = {}) {
|
|
1639
1664
|
const { type: o = "functional", alt: r, ariaLabel: s, isSelected: i } = t;
|
|
1640
1665
|
if (!e)
|
|
1641
1666
|
return { alt: "", ariaHidden: !0 };
|
|
@@ -1644,20 +1669,20 @@ function Ue(e, t = {}) {
|
|
|
1644
1669
|
o === "functional" && !r && !s && console.warn(
|
|
1645
1670
|
"No alt text or aria-label provided for functional icon. This may cause accessibility issues."
|
|
1646
1671
|
);
|
|
1647
|
-
const a = i ? " (selected)" : "", l =
|
|
1672
|
+
const a = i ? " (selected)" : "", l = Ot(e) && !r ? "" : r || e, n = s || (l ? `${l}${a}` : a);
|
|
1648
1673
|
return {
|
|
1649
1674
|
alt: l,
|
|
1650
1675
|
ariaLabel: n,
|
|
1651
1676
|
ariaHidden: !1
|
|
1652
1677
|
};
|
|
1653
1678
|
}
|
|
1654
|
-
function
|
|
1679
|
+
function Zo(e, t = "polite") {
|
|
1655
1680
|
let o = document.getElementById("screen-reader-announcer");
|
|
1656
1681
|
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(() => {
|
|
1657
1682
|
o.textContent = e;
|
|
1658
1683
|
}, 50);
|
|
1659
1684
|
}
|
|
1660
|
-
function
|
|
1685
|
+
function Jo(e, t) {
|
|
1661
1686
|
return `${e}: ${t}`;
|
|
1662
1687
|
}
|
|
1663
1688
|
/**
|
|
@@ -1665,8 +1690,8 @@ function Wo(e, t) {
|
|
|
1665
1690
|
* Copyright 2017 Google LLC
|
|
1666
1691
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1667
1692
|
*/
|
|
1668
|
-
const
|
|
1669
|
-
let
|
|
1693
|
+
const qe = { ATTRIBUTE: 1 }, He = (e) => (...t) => ({ _$litDirective$: e, values: t });
|
|
1694
|
+
let Fe = class {
|
|
1670
1695
|
constructor(t) {
|
|
1671
1696
|
}
|
|
1672
1697
|
get _$AU() {
|
|
@@ -1687,10 +1712,10 @@ let qe = class {
|
|
|
1687
1712
|
* Copyright 2018 Google LLC
|
|
1688
1713
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1689
1714
|
*/
|
|
1690
|
-
const
|
|
1715
|
+
const w = He(class extends Fe {
|
|
1691
1716
|
constructor(e) {
|
|
1692
1717
|
var t;
|
|
1693
|
-
if (super(e), e.type !==
|
|
1718
|
+
if (super(e), e.type !== qe.ATTRIBUTE || e.name !== "class" || ((t = e.strings) == null ? void 0 : t.length) > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
|
|
1694
1719
|
}
|
|
1695
1720
|
render(e) {
|
|
1696
1721
|
return " " + Object.keys(e).filter((t) => e[t]).join(" ") + " ";
|
|
@@ -1711,18 +1736,18 @@ const y = je(class extends qe {
|
|
|
1711
1736
|
return H;
|
|
1712
1737
|
}
|
|
1713
1738
|
});
|
|
1714
|
-
var
|
|
1739
|
+
var Xo = Object.defineProperty, b = (e, t, o, r) => {
|
|
1715
1740
|
for (var s = void 0, i = e.length - 1, a; i >= 0; i--)
|
|
1716
1741
|
(a = e[i]) && (s = a(t, o, s) || s);
|
|
1717
|
-
return s &&
|
|
1742
|
+
return s && Xo(t, o, s), s;
|
|
1718
1743
|
};
|
|
1719
|
-
const
|
|
1744
|
+
const $t = {
|
|
1720
1745
|
mobile: "480px",
|
|
1721
1746
|
tablet: "768px",
|
|
1722
1747
|
desktop: "1024px"
|
|
1723
|
-
},
|
|
1748
|
+
}, oe = class oe extends R {
|
|
1724
1749
|
constructor() {
|
|
1725
|
-
super(...arguments), this.dataController = new
|
|
1750
|
+
super(...arguments), this.dataController = new Ko(this), this.displayController = new Go(this, this.dataController), this.hasEditButton = !0, this.showStats = "never", this.showChart = !1, this.initialized = !1, this.ariaLabel = null, this.minContrast = Re.AA_NORMAL, this.options = [], this.questionPosition = "top", this.statsText = "{count} votes", this.buttonText = "Submit", this.buttonRadius = "sm", this.multiple = !1, this.inline = !1, this.readonly = !1, this.handleEditToggleKeyDown = (t) => {
|
|
1726
1751
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.handleEnterEditMode());
|
|
1727
1752
|
};
|
|
1728
1753
|
}
|
|
@@ -1754,10 +1779,10 @@ const xt = {
|
|
|
1754
1779
|
let o = `:host {
|
|
1755
1780
|
`;
|
|
1756
1781
|
if (this.primaryColor) {
|
|
1757
|
-
const i =
|
|
1782
|
+
const i = ot(this.primaryColor);
|
|
1758
1783
|
o += `--pc-primary-color: ${i} !important;
|
|
1759
1784
|
`;
|
|
1760
|
-
const a =
|
|
1785
|
+
const a = Eo(i, {
|
|
1761
1786
|
minContrast: this.minContrast,
|
|
1762
1787
|
colorOptions: ["black", "white", "light", "dark"]
|
|
1763
1788
|
});
|
|
@@ -1765,27 +1790,27 @@ const xt = {
|
|
|
1765
1790
|
`;
|
|
1766
1791
|
}
|
|
1767
1792
|
if (this.muteColor) {
|
|
1768
|
-
const i =
|
|
1793
|
+
const i = ot(this.muteColor);
|
|
1769
1794
|
o += `--pc-mute-color: ${i} !important;
|
|
1770
1795
|
`;
|
|
1771
1796
|
}
|
|
1772
1797
|
if (this.textColor) {
|
|
1773
|
-
const i =
|
|
1798
|
+
const i = ot(this.textColor);
|
|
1774
1799
|
o += `--pc-text-color: ${i} !important;
|
|
1775
1800
|
`;
|
|
1776
1801
|
}
|
|
1777
1802
|
if (this.backgroundColor) {
|
|
1778
|
-
const i =
|
|
1803
|
+
const i = ot(this.backgroundColor);
|
|
1779
1804
|
o += `--pc-background-color: ${i} !important;
|
|
1780
1805
|
`;
|
|
1781
1806
|
}
|
|
1782
1807
|
const r = this.starColor || this.accentColor || this.primaryColor;
|
|
1783
1808
|
if (r) {
|
|
1784
|
-
const i =
|
|
1809
|
+
const i = ot(r);
|
|
1785
1810
|
o += `--pc-star-color: ${i} !important;
|
|
1786
1811
|
`;
|
|
1787
1812
|
}
|
|
1788
|
-
const s = this.starHoverColor || (r ? `color-mix(in srgb, ${
|
|
1813
|
+
const s = this.starHoverColor || (r ? `color-mix(in srgb, ${ot(r)} 80%, white)` : null);
|
|
1789
1814
|
if (s && (o += `--pc-star-hover-color: ${s} !important;
|
|
1790
1815
|
`), this.starSize) {
|
|
1791
1816
|
const i = qt(this.starSize, "1.5em", 1.5);
|
|
@@ -1803,12 +1828,12 @@ const xt = {
|
|
|
1803
1828
|
`;
|
|
1804
1829
|
}
|
|
1805
1830
|
if (this.buttonRadius) {
|
|
1806
|
-
const i =
|
|
1831
|
+
const i = Po(this.buttonRadius);
|
|
1807
1832
|
o += `--pc-button-radius: ${i} !important;
|
|
1808
1833
|
`;
|
|
1809
1834
|
}
|
|
1810
1835
|
o += `}
|
|
1811
|
-
`, this.css && (o +=
|
|
1836
|
+
`, this.css && (o += zo(Io(this.css))), t.textContent = o;
|
|
1812
1837
|
}
|
|
1813
1838
|
/**
|
|
1814
1839
|
* Update ARIA attributes for accessibility
|
|
@@ -1827,11 +1852,11 @@ const xt = {
|
|
|
1827
1852
|
*/
|
|
1828
1853
|
getBreakpointClasses() {
|
|
1829
1854
|
return {
|
|
1830
|
-
"pc-mobile": window.matchMedia(`(max-width: ${
|
|
1855
|
+
"pc-mobile": window.matchMedia(`(max-width: ${$t.mobile})`).matches,
|
|
1831
1856
|
"pc-tablet": window.matchMedia(
|
|
1832
|
-
`(min-width: ${
|
|
1857
|
+
`(min-width: ${$t.mobile}) and (max-width: ${$t.tablet})`
|
|
1833
1858
|
).matches,
|
|
1834
|
-
"pc-desktop": window.matchMedia(`(min-width: ${
|
|
1859
|
+
"pc-desktop": window.matchMedia(`(min-width: ${$t.desktop})`).matches
|
|
1835
1860
|
};
|
|
1836
1861
|
}
|
|
1837
1862
|
/**
|
|
@@ -1839,7 +1864,7 @@ const xt = {
|
|
|
1839
1864
|
*/
|
|
1840
1865
|
announceSelectionChange(t, o, r) {
|
|
1841
1866
|
const s = `Poll for "${t}"`, i = r ? `${o.label} selected` : `${o.label} unselected`;
|
|
1842
|
-
|
|
1867
|
+
Zo(Jo(s, i));
|
|
1843
1868
|
}
|
|
1844
1869
|
/** Common render methods */
|
|
1845
1870
|
renderLabel() {
|
|
@@ -1870,7 +1895,7 @@ const xt = {
|
|
|
1870
1895
|
tabindex="0"
|
|
1871
1896
|
aria-label="Edit vote"
|
|
1872
1897
|
@keydown="${this.handleEditToggleKeyDown}"
|
|
1873
|
-
>${
|
|
1898
|
+
>${At}</span
|
|
1874
1899
|
>
|
|
1875
1900
|
` : u;
|
|
1876
1901
|
}
|
|
@@ -1889,7 +1914,7 @@ const xt = {
|
|
|
1889
1914
|
tabindex="0"
|
|
1890
1915
|
aria-label="${this.displayController.isChartVisible ? "Hide chart" : "Show chart"}"
|
|
1891
1916
|
@keydown="${() => this.displayController.toggleChartVisibility()}"
|
|
1892
|
-
>${this.displayController.isChartVisible ?
|
|
1917
|
+
>${this.displayController.isChartVisible ? Qt : Xt}</span
|
|
1893
1918
|
>
|
|
1894
1919
|
` : u;
|
|
1895
1920
|
}
|
|
@@ -1898,9 +1923,9 @@ const xt = {
|
|
|
1898
1923
|
return u;
|
|
1899
1924
|
const o = {
|
|
1900
1925
|
"pc-status": !0,
|
|
1901
|
-
[`pc-flex-content-${
|
|
1926
|
+
[`pc-flex-content-${z(this.statsPosition, this.statsAlign)}`]: !0
|
|
1902
1927
|
};
|
|
1903
|
-
return c`<div class="${
|
|
1928
|
+
return c`<div class="${w(o)}" data-testid="pc-status">
|
|
1904
1929
|
${this.renderStatsText()} ${this.renderChartToggle()} ${this.renderEditToggleIcon()}
|
|
1905
1930
|
</div>`;
|
|
1906
1931
|
}
|
|
@@ -1916,7 +1941,7 @@ const xt = {
|
|
|
1916
1941
|
renderThankYouMessage() {
|
|
1917
1942
|
if (!this.displayController.shouldDisplayThankYouMsg())
|
|
1918
1943
|
return u;
|
|
1919
|
-
const t =
|
|
1944
|
+
const t = Fo(this.thankYouMsg || "");
|
|
1920
1945
|
return c`
|
|
1921
1946
|
<div class="pc-thank-you-overlay" data-testid="poll-thank-you-overlay">
|
|
1922
1947
|
<div class="pc-thank-you" data-testid="thank-you">
|
|
@@ -1928,7 +1953,7 @@ const xt = {
|
|
|
1928
1953
|
@click="${() => this.displayController.toggleThankYouVisibility(!1)}"
|
|
1929
1954
|
role="button"
|
|
1930
1955
|
aria-label="Close"
|
|
1931
|
-
>${
|
|
1956
|
+
>${_t}</span
|
|
1932
1957
|
>
|
|
1933
1958
|
</div>
|
|
1934
1959
|
</div>
|
|
@@ -1936,7 +1961,7 @@ const xt = {
|
|
|
1936
1961
|
`;
|
|
1937
1962
|
}
|
|
1938
1963
|
};
|
|
1939
|
-
|
|
1964
|
+
oe.styles = [
|
|
1940
1965
|
U`
|
|
1941
1966
|
:host {
|
|
1942
1967
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
@@ -2017,113 +2042,113 @@ te.styles = [
|
|
|
2017
2042
|
}
|
|
2018
2043
|
`
|
|
2019
2044
|
];
|
|
2020
|
-
let
|
|
2021
|
-
|
|
2045
|
+
let m = oe;
|
|
2046
|
+
b([
|
|
2022
2047
|
f({ type: String, attribute: "show-stats" })
|
|
2023
|
-
],
|
|
2024
|
-
|
|
2048
|
+
], m.prototype, "showStats");
|
|
2049
|
+
b([
|
|
2025
2050
|
f({ type: Boolean, attribute: "show-chart" })
|
|
2026
|
-
],
|
|
2027
|
-
|
|
2051
|
+
], m.prototype, "showChart");
|
|
2052
|
+
b([
|
|
2028
2053
|
f({ type: Boolean, attribute: "initialized" })
|
|
2029
|
-
],
|
|
2030
|
-
|
|
2054
|
+
], m.prototype, "initialized");
|
|
2055
|
+
b([
|
|
2031
2056
|
f({ type: String, attribute: "primary-color" })
|
|
2032
|
-
],
|
|
2033
|
-
|
|
2057
|
+
], m.prototype, "primaryColor");
|
|
2058
|
+
b([
|
|
2034
2059
|
f({ type: String, attribute: "mute-color" })
|
|
2035
|
-
],
|
|
2036
|
-
|
|
2060
|
+
], m.prototype, "muteColor");
|
|
2061
|
+
b([
|
|
2037
2062
|
f({ type: String, attribute: "text-color" })
|
|
2038
|
-
],
|
|
2039
|
-
|
|
2063
|
+
], m.prototype, "textColor");
|
|
2064
|
+
b([
|
|
2040
2065
|
f({ type: String, attribute: "background-color" })
|
|
2041
|
-
],
|
|
2042
|
-
|
|
2066
|
+
], m.prototype, "backgroundColor");
|
|
2067
|
+
b([
|
|
2043
2068
|
f({ type: String, attribute: "accent-color" })
|
|
2044
|
-
],
|
|
2045
|
-
|
|
2069
|
+
], m.prototype, "accentColor");
|
|
2070
|
+
b([
|
|
2046
2071
|
f({ type: String, attribute: "star-color" })
|
|
2047
|
-
],
|
|
2048
|
-
|
|
2072
|
+
], m.prototype, "starColor");
|
|
2073
|
+
b([
|
|
2049
2074
|
f({ type: String, attribute: "star-hover-color" })
|
|
2050
|
-
],
|
|
2051
|
-
|
|
2075
|
+
], m.prototype, "starHoverColor");
|
|
2076
|
+
b([
|
|
2052
2077
|
f({ type: String, attribute: "star-size" })
|
|
2053
|
-
],
|
|
2054
|
-
|
|
2078
|
+
], m.prototype, "starSize");
|
|
2079
|
+
b([
|
|
2055
2080
|
f({ type: String, attribute: "reaction-size" })
|
|
2056
|
-
],
|
|
2057
|
-
|
|
2081
|
+
], m.prototype, "reactionSize");
|
|
2082
|
+
b([
|
|
2058
2083
|
f({ type: String })
|
|
2059
|
-
],
|
|
2060
|
-
|
|
2084
|
+
], m.prototype, "size");
|
|
2085
|
+
b([
|
|
2061
2086
|
f({ type: String, attribute: "aria-label" })
|
|
2062
|
-
],
|
|
2063
|
-
|
|
2087
|
+
], m.prototype, "ariaLabel");
|
|
2088
|
+
b([
|
|
2064
2089
|
f({ type: String, attribute: "aria-describedby" })
|
|
2065
|
-
],
|
|
2066
|
-
|
|
2090
|
+
], m.prototype, "ariaDescribedby");
|
|
2091
|
+
b([
|
|
2067
2092
|
f({ type: Number, attribute: "min-contrast" })
|
|
2068
|
-
],
|
|
2069
|
-
|
|
2093
|
+
], m.prototype, "minContrast");
|
|
2094
|
+
b([
|
|
2070
2095
|
f({ type: String })
|
|
2071
|
-
],
|
|
2072
|
-
|
|
2096
|
+
], m.prototype, "css");
|
|
2097
|
+
b([
|
|
2073
2098
|
f({ type: Array })
|
|
2074
|
-
],
|
|
2075
|
-
|
|
2099
|
+
], m.prototype, "options");
|
|
2100
|
+
b([
|
|
2076
2101
|
f({ type: String, attribute: "widget-id" })
|
|
2077
|
-
],
|
|
2078
|
-
|
|
2102
|
+
], m.prototype, "widgetId");
|
|
2103
|
+
b([
|
|
2079
2104
|
f({ type: String, attribute: "name" })
|
|
2080
|
-
],
|
|
2081
|
-
|
|
2105
|
+
], m.prototype, "name");
|
|
2106
|
+
b([
|
|
2082
2107
|
f({ type: String })
|
|
2083
|
-
],
|
|
2084
|
-
|
|
2108
|
+
], m.prototype, "metadata");
|
|
2109
|
+
b([
|
|
2085
2110
|
f({ type: String, attribute: "data-func" })
|
|
2086
|
-
],
|
|
2087
|
-
|
|
2111
|
+
], m.prototype, "dataFunc");
|
|
2112
|
+
b([
|
|
2088
2113
|
f({ type: String, attribute: "data-endpoint" })
|
|
2089
|
-
],
|
|
2090
|
-
|
|
2114
|
+
], m.prototype, "dataEndpoint");
|
|
2115
|
+
b([
|
|
2091
2116
|
f({ type: String })
|
|
2092
|
-
],
|
|
2093
|
-
|
|
2117
|
+
], m.prototype, "question");
|
|
2118
|
+
b([
|
|
2094
2119
|
f({ type: String, attribute: "question-position" })
|
|
2095
|
-
],
|
|
2096
|
-
|
|
2120
|
+
], m.prototype, "questionPosition");
|
|
2121
|
+
b([
|
|
2097
2122
|
f({ type: String, attribute: "question-align" })
|
|
2098
|
-
],
|
|
2099
|
-
|
|
2123
|
+
], m.prototype, "questionAlign");
|
|
2124
|
+
b([
|
|
2100
2125
|
f({ type: String, attribute: "stats-text" })
|
|
2101
|
-
],
|
|
2102
|
-
|
|
2126
|
+
], m.prototype, "statsText");
|
|
2127
|
+
b([
|
|
2103
2128
|
f({ type: String, attribute: "stats-position" })
|
|
2104
|
-
],
|
|
2105
|
-
|
|
2129
|
+
], m.prototype, "statsPosition");
|
|
2130
|
+
b([
|
|
2106
2131
|
f({ type: String, attribute: "stats-align" })
|
|
2107
|
-
],
|
|
2108
|
-
|
|
2132
|
+
], m.prototype, "statsAlign");
|
|
2133
|
+
b([
|
|
2109
2134
|
f({ type: String, attribute: "button-text" })
|
|
2110
|
-
],
|
|
2111
|
-
|
|
2135
|
+
], m.prototype, "buttonText");
|
|
2136
|
+
b([
|
|
2112
2137
|
f({ type: String, attribute: "button-radius" })
|
|
2113
|
-
],
|
|
2114
|
-
|
|
2138
|
+
], m.prototype, "buttonRadius");
|
|
2139
|
+
b([
|
|
2115
2140
|
f({ type: String, attribute: "thank-you-msg" })
|
|
2116
|
-
],
|
|
2117
|
-
|
|
2141
|
+
], m.prototype, "thankYouMsg");
|
|
2142
|
+
b([
|
|
2118
2143
|
f({ type: Boolean, attribute: "multiple" })
|
|
2119
|
-
],
|
|
2120
|
-
|
|
2144
|
+
], m.prototype, "multiple");
|
|
2145
|
+
b([
|
|
2121
2146
|
f({ type: Boolean, reflect: !0 })
|
|
2122
|
-
],
|
|
2123
|
-
|
|
2147
|
+
], m.prototype, "inline");
|
|
2148
|
+
b([
|
|
2124
2149
|
f({ type: Boolean, reflect: !0 })
|
|
2125
|
-
],
|
|
2126
|
-
const
|
|
2150
|
+
], m.prototype, "readonly");
|
|
2151
|
+
const Qo = U`
|
|
2127
2152
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
2128
2153
|
|
|
2129
2154
|
.pc-body {
|
|
@@ -2574,7 +2599,7 @@ const Zo = U`
|
|
|
2574
2599
|
animation: none;
|
|
2575
2600
|
}
|
|
2576
2601
|
}
|
|
2577
|
-
`,
|
|
2602
|
+
`, It = U`
|
|
2578
2603
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
2579
2604
|
:host {
|
|
2580
2605
|
--default-primary-color: #2196f3;
|
|
@@ -3293,7 +3318,7 @@ const Zo = U`
|
|
|
3293
3318
|
opacity: 1;
|
|
3294
3319
|
}
|
|
3295
3320
|
}
|
|
3296
|
-
`,
|
|
3321
|
+
`, tr = U`
|
|
3297
3322
|
:host {
|
|
3298
3323
|
--popover-bg: light-dark(#ffffff, #1a1a1a);
|
|
3299
3324
|
--popover-border: light-dark(#e0e0e0, #333333);
|
|
@@ -3415,12 +3440,12 @@ const Zo = U`
|
|
|
3415
3440
|
max-width: 100%;
|
|
3416
3441
|
}
|
|
3417
3442
|
`;
|
|
3418
|
-
var
|
|
3419
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3443
|
+
var er = Object.defineProperty, or = Object.getOwnPropertyDescriptor, V = (e, t, o, r) => {
|
|
3444
|
+
for (var s = r > 1 ? void 0 : r ? or(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3420
3445
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3421
|
-
return r && s &&
|
|
3446
|
+
return r && s && er(t, o, s), s;
|
|
3422
3447
|
};
|
|
3423
|
-
let
|
|
3448
|
+
let I = class extends R {
|
|
3424
3449
|
constructor() {
|
|
3425
3450
|
super(...arguments), this.open = !1, this.position = "auto", this.isClosing = !1, this.computedPosition = "bottom", this.popoverStyles = {}, this.arrowStyles = {}, this.updatePosition = () => {
|
|
3426
3451
|
var h;
|
|
@@ -3428,8 +3453,8 @@ let _ = class extends R {
|
|
|
3428
3453
|
const e = this.anchor.getBoundingClientRect(), t = window.innerWidth, o = window.innerHeight, r = 12, s = (h = this.popoverElement) == null ? void 0 : h.getBoundingClientRect(), i = (s == null ? void 0 : s.width) || 280, a = (s == null ? void 0 : s.height) || 200;
|
|
3429
3454
|
let l = this.position;
|
|
3430
3455
|
if (l === "auto") {
|
|
3431
|
-
const
|
|
3432
|
-
l =
|
|
3456
|
+
const v = o - e.bottom, x = e.top;
|
|
3457
|
+
l = v >= a + r || v >= x ? "bottom" : "top";
|
|
3433
3458
|
}
|
|
3434
3459
|
this.computedPosition = l;
|
|
3435
3460
|
let n, d;
|
|
@@ -3493,7 +3518,7 @@ let _ = class extends R {
|
|
|
3493
3518
|
return c`
|
|
3494
3519
|
<div class="pc-popover-scrim" @click=${this.handleScrimClick}></div>
|
|
3495
3520
|
<div
|
|
3496
|
-
class=${
|
|
3521
|
+
class=${w(e)}
|
|
3497
3522
|
data-position=${this.computedPosition}
|
|
3498
3523
|
style=${Object.entries(this.popoverStyles).map(([t, o]) => `${t}: ${o}`).join("; ")}
|
|
3499
3524
|
role="dialog"
|
|
@@ -3509,35 +3534,35 @@ let _ = class extends R {
|
|
|
3509
3534
|
`;
|
|
3510
3535
|
}
|
|
3511
3536
|
};
|
|
3512
|
-
|
|
3537
|
+
I.styles = [tr];
|
|
3513
3538
|
V([
|
|
3514
3539
|
f({ type: Boolean, reflect: !0 })
|
|
3515
|
-
],
|
|
3540
|
+
], I.prototype, "open", 2);
|
|
3516
3541
|
V([
|
|
3517
3542
|
f({ type: String })
|
|
3518
|
-
],
|
|
3543
|
+
], I.prototype, "position", 2);
|
|
3519
3544
|
V([
|
|
3520
3545
|
f({ attribute: !1 })
|
|
3521
|
-
],
|
|
3546
|
+
], I.prototype, "anchor", 2);
|
|
3522
3547
|
V([
|
|
3523
|
-
|
|
3524
|
-
],
|
|
3548
|
+
A()
|
|
3549
|
+
], I.prototype, "isClosing", 2);
|
|
3525
3550
|
V([
|
|
3526
|
-
|
|
3527
|
-
],
|
|
3551
|
+
A()
|
|
3552
|
+
], I.prototype, "computedPosition", 2);
|
|
3528
3553
|
V([
|
|
3529
|
-
|
|
3530
|
-
],
|
|
3554
|
+
A()
|
|
3555
|
+
], I.prototype, "popoverStyles", 2);
|
|
3531
3556
|
V([
|
|
3532
|
-
|
|
3533
|
-
],
|
|
3557
|
+
A()
|
|
3558
|
+
], I.prototype, "arrowStyles", 2);
|
|
3534
3559
|
V([
|
|
3535
|
-
|
|
3536
|
-
],
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
],
|
|
3540
|
-
const
|
|
3560
|
+
bt(".pc-popover")
|
|
3561
|
+
], I.prototype, "popoverElement", 2);
|
|
3562
|
+
I = V([
|
|
3563
|
+
W("pc-popover")
|
|
3564
|
+
], I);
|
|
3565
|
+
const rr = U`
|
|
3541
3566
|
:host {
|
|
3542
3567
|
--sheet-bg: light-dark(#ffffff, #1a1a1a);
|
|
3543
3568
|
--sheet-border: light-dark(#e0e0e0, #333333);
|
|
@@ -3650,10 +3675,10 @@ const tr = U`
|
|
|
3650
3675
|
max-width: 100%;
|
|
3651
3676
|
}
|
|
3652
3677
|
`;
|
|
3653
|
-
var
|
|
3654
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3678
|
+
var sr = Object.defineProperty, ir = Object.getOwnPropertyDescriptor, et = (e, t, o, r) => {
|
|
3679
|
+
for (var s = r > 1 ? void 0 : r ? ir(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3655
3680
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3656
|
-
return r && s &&
|
|
3681
|
+
return r && s && sr(t, o, s), s;
|
|
3657
3682
|
};
|
|
3658
3683
|
let B = class extends R {
|
|
3659
3684
|
constructor() {
|
|
@@ -3733,8 +3758,8 @@ let B = class extends R {
|
|
|
3733
3758
|
dragging: this.isDragging
|
|
3734
3759
|
};
|
|
3735
3760
|
return c`
|
|
3736
|
-
<div class=${
|
|
3737
|
-
<div class=${
|
|
3761
|
+
<div class=${w(e)} @click=${this.handleScrimClick}></div>
|
|
3762
|
+
<div class=${w(t)} role="dialog" aria-modal="true" tabindex="-1">
|
|
3738
3763
|
<div
|
|
3739
3764
|
class="pc-sheet-handle"
|
|
3740
3765
|
@touchstart=${this.handleDragStart}
|
|
@@ -3749,35 +3774,35 @@ let B = class extends R {
|
|
|
3749
3774
|
`;
|
|
3750
3775
|
}
|
|
3751
3776
|
};
|
|
3752
|
-
B.styles = [
|
|
3753
|
-
|
|
3777
|
+
B.styles = [rr];
|
|
3778
|
+
et([
|
|
3754
3779
|
f({ type: Boolean, reflect: !0 })
|
|
3755
3780
|
], B.prototype, "open", 2);
|
|
3756
|
-
|
|
3781
|
+
et([
|
|
3757
3782
|
f({ type: Boolean, attribute: "drag-to-close" })
|
|
3758
3783
|
], B.prototype, "dragToClose", 2);
|
|
3759
|
-
|
|
3760
|
-
|
|
3784
|
+
et([
|
|
3785
|
+
A()
|
|
3761
3786
|
], B.prototype, "isClosing", 2);
|
|
3762
|
-
|
|
3763
|
-
|
|
3787
|
+
et([
|
|
3788
|
+
A()
|
|
3764
3789
|
], B.prototype, "isDragging", 2);
|
|
3765
|
-
|
|
3766
|
-
|
|
3790
|
+
et([
|
|
3791
|
+
A()
|
|
3767
3792
|
], B.prototype, "dragOffset", 2);
|
|
3768
|
-
|
|
3769
|
-
|
|
3793
|
+
et([
|
|
3794
|
+
bt(".pc-bottom-sheet")
|
|
3770
3795
|
], B.prototype, "sheetElement", 2);
|
|
3771
|
-
B =
|
|
3772
|
-
|
|
3796
|
+
B = et([
|
|
3797
|
+
W("pc-bottom-sheet")
|
|
3773
3798
|
], B);
|
|
3774
|
-
var
|
|
3775
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3799
|
+
var ar = Object.defineProperty, nr = Object.getOwnPropertyDescriptor, yt = (e, t, o, r) => {
|
|
3800
|
+
for (var s = r > 1 ? void 0 : r ? nr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3776
3801
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3777
|
-
return r && s &&
|
|
3802
|
+
return r && s && ar(t, o, s), s;
|
|
3778
3803
|
};
|
|
3779
|
-
const
|
|
3780
|
-
let
|
|
3804
|
+
const lr = 768;
|
|
3805
|
+
let Q = class extends R {
|
|
3781
3806
|
constructor() {
|
|
3782
3807
|
super(...arguments), this.open = !1, this.position = "auto", this.isMobile = !1, this.handleMediaChange = (e) => {
|
|
3783
3808
|
this.isMobile = e.matches;
|
|
@@ -3793,7 +3818,7 @@ let X = class extends R {
|
|
|
3793
3818
|
super.disconnectedCallback(), (e = this.mediaQuery) == null || e.removeEventListener("change", this.handleMediaChange);
|
|
3794
3819
|
}
|
|
3795
3820
|
setupMediaQuery() {
|
|
3796
|
-
this.mediaQuery = window.matchMedia(`(max-width: ${
|
|
3821
|
+
this.mediaQuery = window.matchMedia(`(max-width: ${lr - 1}px)`), this.isMobile = this.mediaQuery.matches, this.mediaQuery.addEventListener("change", this.handleMediaChange);
|
|
3797
3822
|
}
|
|
3798
3823
|
render() {
|
|
3799
3824
|
return this.isMobile ? c`
|
|
@@ -3812,32 +3837,32 @@ let X = class extends R {
|
|
|
3812
3837
|
`;
|
|
3813
3838
|
}
|
|
3814
3839
|
};
|
|
3815
|
-
|
|
3840
|
+
Q.styles = U`
|
|
3816
3841
|
:host {
|
|
3817
3842
|
display: contents;
|
|
3818
3843
|
}
|
|
3819
3844
|
`;
|
|
3820
|
-
|
|
3845
|
+
yt([
|
|
3821
3846
|
f({ type: Boolean, reflect: !0 })
|
|
3822
|
-
],
|
|
3823
|
-
|
|
3847
|
+
], Q.prototype, "open", 2);
|
|
3848
|
+
yt([
|
|
3824
3849
|
f({ type: String })
|
|
3825
|
-
],
|
|
3826
|
-
|
|
3850
|
+
], Q.prototype, "position", 2);
|
|
3851
|
+
yt([
|
|
3827
3852
|
f({ attribute: !1 })
|
|
3828
|
-
],
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
],
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
],
|
|
3835
|
-
var
|
|
3836
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3853
|
+
], Q.prototype, "anchor", 2);
|
|
3854
|
+
yt([
|
|
3855
|
+
A()
|
|
3856
|
+
], Q.prototype, "isMobile", 2);
|
|
3857
|
+
Q = yt([
|
|
3858
|
+
W("pc-responsive-modal")
|
|
3859
|
+
], Q);
|
|
3860
|
+
var cr = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, K = (e, t, o, r) => {
|
|
3861
|
+
for (var s = r > 1 ? void 0 : r ? dr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3837
3862
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3838
|
-
return r && s &&
|
|
3863
|
+
return r && s && cr(t, o, s), s;
|
|
3839
3864
|
};
|
|
3840
|
-
let
|
|
3865
|
+
let M = class extends m {
|
|
3841
3866
|
constructor() {
|
|
3842
3867
|
super(), this.min = 0, this.max = 10, this.type = S.nps, this.minLabel = "Not at all", this.maxLabel = "Extremely", this.minMaxPosition = "top", this.hoverValue = -1, this.popoverOpen = !1, this.handleNumberLeave = () => {
|
|
3843
3868
|
this.hoverValue = -1;
|
|
@@ -3849,7 +3874,7 @@ let I = class extends g {
|
|
|
3849
3874
|
* Render NPS buttons for edit mode
|
|
3850
3875
|
*/
|
|
3851
3876
|
renderNpsButtons() {
|
|
3852
|
-
const e = Array.from({ length: this.max - this.min + 1 }, (s, i) => i + this.min), t = `nps-control-${this.name || this.type}`, o =
|
|
3877
|
+
const e = Array.from({ length: this.max - this.min + 1 }, (s, i) => i + this.min), t = `nps-control-${this.name || this.type}`, o = st({
|
|
3853
3878
|
role: N.GROUP,
|
|
3854
3879
|
ariaLabel: this.question || "NPS Rating",
|
|
3855
3880
|
ariaDescribedby: `${t}-description`
|
|
@@ -3857,12 +3882,12 @@ let I = class extends g {
|
|
|
3857
3882
|
const i = this.dataController.isValueSelected(String(s)), a = {
|
|
3858
3883
|
"nps-button": !0,
|
|
3859
3884
|
selected: i
|
|
3860
|
-
}, l =
|
|
3885
|
+
}, l = To(`Rate ${s}`, i, !1);
|
|
3861
3886
|
return c`
|
|
3862
3887
|
<button
|
|
3863
3888
|
data-testid="nps-button-${s}"
|
|
3864
3889
|
?disabled=${!this.displayController.allowEdit()}
|
|
3865
|
-
class=${
|
|
3890
|
+
class=${w(a)}
|
|
3866
3891
|
@click="${() => this.handleNumberClick(s)}"
|
|
3867
3892
|
@mouseenter="${() => this.handleNumberHover(s)}"
|
|
3868
3893
|
@focus="${() => this.handleNumberHover(s)}"
|
|
@@ -3901,10 +3926,10 @@ let I = class extends g {
|
|
|
3901
3926
|
* NPS score displayed prominently in the middle
|
|
3902
3927
|
*/
|
|
3903
3928
|
renderChart() {
|
|
3904
|
-
const e = this.dataController.stats, t = (e == null ? void 0 : e.nps) ?? 0, o = 100, r = 100, s = 80, i = (
|
|
3905
|
-
x: o + s * Math.cos(
|
|
3906
|
-
y: r - s * Math.sin(
|
|
3907
|
-
}), a = i(Math.PI), l = i(Math.PI / 2), n = i(Math.PI / 4), d = i(0), p = (
|
|
3929
|
+
const e = this.dataController.stats, t = (e == null ? void 0 : e.nps) ?? 0, o = 100, r = 100, s = 80, i = ($) => ({
|
|
3930
|
+
x: o + s * Math.cos($),
|
|
3931
|
+
y: r - s * Math.sin($)
|
|
3932
|
+
}), a = i(Math.PI), l = i(Math.PI / 2), n = i(Math.PI / 4), d = i(0), p = ($, y, E = 0) => `M ${$.x} ${$.y} A ${s} ${s} 0 ${E} 1 ${y.x} ${y.y}`, h = p(a, l), v = p(l, n), x = p(n, d), P = (($) => Math.PI - ($ + 100) / 200 * Math.PI)(t), _ = i(P);
|
|
3908
3933
|
return c`
|
|
3909
3934
|
<div class="nps-semicircle-gauge" data-testid="nps-semicircle-gauge">
|
|
3910
3935
|
<svg viewBox="0 0 200 115">
|
|
@@ -3916,11 +3941,11 @@ let I = class extends g {
|
|
|
3916
3941
|
|
|
3917
3942
|
<!-- Colored segments -->
|
|
3918
3943
|
<path class="gauge-arc gauge-arc-detractor" d="${h}" />
|
|
3919
|
-
<path class="gauge-arc gauge-arc-passive" d="${
|
|
3944
|
+
<path class="gauge-arc gauge-arc-passive" d="${v}" />
|
|
3920
3945
|
<path class="gauge-arc gauge-arc-promoter" d="${x}" />
|
|
3921
3946
|
|
|
3922
3947
|
<!-- Needle indicator -->
|
|
3923
|
-
<circle class="gauge-needle" cx="${
|
|
3948
|
+
<circle class="gauge-needle" cx="${_.x}" cy="${_.y}" r="5" />
|
|
3924
3949
|
|
|
3925
3950
|
<!-- Score display in center -->
|
|
3926
3951
|
<text class="gauge-score" x="${o}" y="${r - 15}">${t}</text>
|
|
@@ -3980,7 +4005,7 @@ let I = class extends g {
|
|
|
3980
4005
|
* Uses SVG with 3 colored segments for detractors/passives/promoters
|
|
3981
4006
|
*/
|
|
3982
4007
|
renderInlineGauge() {
|
|
3983
|
-
const e = this.dataController.stats, t = (e == null ? void 0 : e.breakdown) || {}, o = 8, r = 2 * Math.PI * o, s =
|
|
4008
|
+
const e = this.dataController.stats, t = (e == null ? void 0 : e.breakdown) || {}, o = 8, r = 2 * Math.PI * o, s = No(t), i = s.detractors + s.passives + s.promoters;
|
|
3984
4009
|
if (i === 0)
|
|
3985
4010
|
return c`
|
|
3986
4011
|
<div class="inline-nps-gauge">
|
|
@@ -3989,9 +4014,9 @@ let I = class extends g {
|
|
|
3989
4014
|
</svg>
|
|
3990
4015
|
</div>
|
|
3991
4016
|
`;
|
|
3992
|
-
const a = s.detractors / i * 100, l = s.passives / i * 100, n = s.promoters / i * 100, d = a / 100 * r, p = l / 100 * r, h = n / 100 * r,
|
|
3993
|
-
let
|
|
3994
|
-
return
|
|
4017
|
+
const a = s.detractors / i * 100, l = s.passives / i * 100, n = s.promoters / i * 100, d = a / 100 * r, p = l / 100 * r, h = n / 100 * r, v = 0, x = -d, k = -(d + p), P = this.getUserScore();
|
|
4018
|
+
let _ = "gauge-bg";
|
|
4019
|
+
return P !== null && (P <= 6 ? _ = "gauge-detractor" : P <= 8 ? _ = "gauge-passive" : _ = "gauge-promoter"), c`
|
|
3995
4020
|
<div class="inline-nps-gauge">
|
|
3996
4021
|
<svg viewBox="0 0 20 20">
|
|
3997
4022
|
<!-- Background circle -->
|
|
@@ -4003,7 +4028,7 @@ let I = class extends g {
|
|
|
4003
4028
|
cy="10"
|
|
4004
4029
|
r="${o}"
|
|
4005
4030
|
stroke-dasharray="${d} ${r}"
|
|
4006
|
-
stroke-dashoffset="${
|
|
4031
|
+
stroke-dashoffset="${v}"
|
|
4007
4032
|
/>
|
|
4008
4033
|
<!-- Passive segment (yellow) -->
|
|
4009
4034
|
<circle
|
|
@@ -4021,10 +4046,10 @@ let I = class extends g {
|
|
|
4021
4046
|
cy="10"
|
|
4022
4047
|
r="${o}"
|
|
4023
4048
|
stroke-dasharray="${h} ${r}"
|
|
4024
|
-
stroke-dashoffset="${
|
|
4049
|
+
stroke-dashoffset="${k}"
|
|
4025
4050
|
/>
|
|
4026
4051
|
<!-- Center dot showing user's score category -->
|
|
4027
|
-
<circle class="gauge-dot ${
|
|
4052
|
+
<circle class="gauge-dot ${_}" cx="10" cy="10" r="2" />
|
|
4028
4053
|
</svg>
|
|
4029
4054
|
</div>
|
|
4030
4055
|
`;
|
|
@@ -4035,7 +4060,7 @@ let I = class extends g {
|
|
|
4035
4060
|
* Shows add icon when no selection, edit icon when user has submitted
|
|
4036
4061
|
*/
|
|
4037
4062
|
renderInlineTrigger() {
|
|
4038
|
-
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ?
|
|
4063
|
+
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ? At : Me;
|
|
4039
4064
|
return c`
|
|
4040
4065
|
<button
|
|
4041
4066
|
class="pc-inline-trigger"
|
|
@@ -4067,7 +4092,7 @@ let I = class extends g {
|
|
|
4067
4092
|
};
|
|
4068
4093
|
return c`
|
|
4069
4094
|
<button
|
|
4070
|
-
class=${
|
|
4095
|
+
class=${w(i)}
|
|
4071
4096
|
@click=${() => this.handlePopoverNumberClick(r)}
|
|
4072
4097
|
@mouseenter=${() => this.handleNumberHover(r)}
|
|
4073
4098
|
@mouseleave=${this.handleNumberLeave}
|
|
@@ -4101,7 +4126,7 @@ let I = class extends g {
|
|
|
4101
4126
|
@keydown="${(e) => {
|
|
4102
4127
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.displayController.toggleChartVisibility());
|
|
4103
4128
|
}}"
|
|
4104
|
-
>${this.displayController.isChartVisible ?
|
|
4129
|
+
>${this.displayController.isChartVisible ? Qt : Xt}</span
|
|
4105
4130
|
>
|
|
4106
4131
|
`;
|
|
4107
4132
|
}
|
|
@@ -4120,7 +4145,7 @@ let I = class extends g {
|
|
|
4120
4145
|
aria-label="Close"
|
|
4121
4146
|
data-testid="popover-close-button"
|
|
4122
4147
|
>
|
|
4123
|
-
${
|
|
4148
|
+
${_t}
|
|
4124
4149
|
</button>
|
|
4125
4150
|
${this.question ? c`<div class="pc-popover-question">${this.question}</div>` : u}
|
|
4126
4151
|
${this.renderPopoverNpsButtons()}
|
|
@@ -4170,16 +4195,16 @@ let I = class extends g {
|
|
|
4170
4195
|
renderStandardMode() {
|
|
4171
4196
|
const e = {
|
|
4172
4197
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
4173
|
-
[`pc-flex-align-${
|
|
4198
|
+
[`pc-flex-align-${z(this.questionPosition, this.questionAlign)}`]: !0
|
|
4174
4199
|
}, t = {
|
|
4175
4200
|
nps: !0,
|
|
4176
4201
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
4177
|
-
[`pc-flex-align-${
|
|
4202
|
+
[`pc-flex-align-${z(this.statsPosition, this.statsAlign)}`]: !0
|
|
4178
4203
|
};
|
|
4179
4204
|
return c`
|
|
4180
|
-
<div class="pc-container ${
|
|
4205
|
+
<div class="pc-container ${w(e)}" data-testid="nps-container">
|
|
4181
4206
|
${this.renderLabelAtStart()}
|
|
4182
|
-
<div class="pc-body ${
|
|
4207
|
+
<div class="pc-body ${w(t)}" data-testid="nps-body">
|
|
4183
4208
|
${this.renderStatusAtStart()} ${this.renderContent()} ${this.renderStatusAtEnd()}
|
|
4184
4209
|
</div>
|
|
4185
4210
|
${this.renderLabelAtEnd()}
|
|
@@ -4193,32 +4218,32 @@ let I = class extends g {
|
|
|
4193
4218
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
4194
4219
|
}
|
|
4195
4220
|
};
|
|
4196
|
-
|
|
4221
|
+
M.styles = [...m.styles, It, Qo];
|
|
4197
4222
|
K([
|
|
4198
4223
|
f({ type: String, attribute: "min-label" })
|
|
4199
|
-
],
|
|
4224
|
+
], M.prototype, "minLabel", 2);
|
|
4200
4225
|
K([
|
|
4201
4226
|
f({ type: String, attribute: "max-label" })
|
|
4202
|
-
],
|
|
4227
|
+
], M.prototype, "maxLabel", 2);
|
|
4203
4228
|
K([
|
|
4204
4229
|
f({ type: String, attribute: "thank-you-msg" })
|
|
4205
|
-
],
|
|
4230
|
+
], M.prototype, "thankYouMsg", 2);
|
|
4206
4231
|
K([
|
|
4207
4232
|
f({ type: String, attribute: "min-max-position" })
|
|
4208
|
-
],
|
|
4233
|
+
], M.prototype, "minMaxPosition", 2);
|
|
4209
4234
|
K([
|
|
4210
|
-
|
|
4211
|
-
],
|
|
4235
|
+
A()
|
|
4236
|
+
], M.prototype, "hoverValue", 2);
|
|
4212
4237
|
K([
|
|
4213
|
-
|
|
4214
|
-
],
|
|
4238
|
+
A()
|
|
4239
|
+
], M.prototype, "popoverOpen", 2);
|
|
4215
4240
|
K([
|
|
4216
|
-
|
|
4217
|
-
],
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
],
|
|
4221
|
-
const
|
|
4241
|
+
bt(".pc-inline-trigger")
|
|
4242
|
+
], M.prototype, "triggerElement", 2);
|
|
4243
|
+
M = K([
|
|
4244
|
+
W("pc-nps")
|
|
4245
|
+
], M);
|
|
4246
|
+
const pr = U`
|
|
4222
4247
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
4223
4248
|
|
|
4224
4249
|
.pc-container {
|
|
@@ -4603,21 +4628,21 @@ const lr = U`
|
|
|
4603
4628
|
opacity: 0.8;
|
|
4604
4629
|
}
|
|
4605
4630
|
`;
|
|
4606
|
-
var
|
|
4607
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
4631
|
+
var ur = Object.defineProperty, hr = Object.getOwnPropertyDescriptor, wt = (e, t, o, r) => {
|
|
4632
|
+
for (var s = r > 1 ? void 0 : r ? hr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
4608
4633
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
4609
|
-
return r && s &&
|
|
4634
|
+
return r && s && ur(t, o, s), s;
|
|
4610
4635
|
};
|
|
4611
|
-
let
|
|
4636
|
+
let tt = class extends m {
|
|
4612
4637
|
constructor() {
|
|
4613
4638
|
super(), this.type = S.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";
|
|
4614
4639
|
}
|
|
4615
4640
|
renderStatus() {
|
|
4616
4641
|
const t = {
|
|
4617
4642
|
"pc-status": !0,
|
|
4618
|
-
[`pc-flex-content-${
|
|
4643
|
+
[`pc-flex-content-${z("bottom", this.statsAlign)}`]: !0
|
|
4619
4644
|
};
|
|
4620
|
-
return c`<div class="${
|
|
4645
|
+
return c`<div class="${w(t)}" data-testid="pc-status">
|
|
4621
4646
|
<span>${this.renderStatsText()} ${this.renderEditToggleIcon("stats-edit-button")}</span>
|
|
4622
4647
|
</div>`;
|
|
4623
4648
|
}
|
|
@@ -4632,7 +4657,7 @@ let Q = class extends g {
|
|
|
4632
4657
|
}, t = this.displayController.shouldDisableSubmitButton();
|
|
4633
4658
|
return c`
|
|
4634
4659
|
<button
|
|
4635
|
-
class="${
|
|
4660
|
+
class="${w(e)}"
|
|
4636
4661
|
data-testid="pc-submit-button"
|
|
4637
4662
|
@click="${this.handleSubmit}"
|
|
4638
4663
|
?disabled="${t}"
|
|
@@ -4666,16 +4691,16 @@ let Q = class extends g {
|
|
|
4666
4691
|
*/
|
|
4667
4692
|
renderOptionIcon(e) {
|
|
4668
4693
|
if (!(e != null && e.icon)) return "";
|
|
4669
|
-
const t =
|
|
4694
|
+
const t = ee.DECORATIVE, o = (e == null ? void 0 : e.label) || "", r = e ? this.dataController.isValueSelected(e.value) : !1, s = je(e == null ? void 0 : e.icon, {
|
|
4670
4695
|
type: t,
|
|
4671
4696
|
alt: o,
|
|
4672
4697
|
isSelected: r
|
|
4673
4698
|
});
|
|
4674
|
-
return
|
|
4699
|
+
return Ve(e == null ? void 0 : e.icon) ? c`<span
|
|
4675
4700
|
class="poll-option-icon"
|
|
4676
4701
|
aria-hidden="${s.ariaHidden ? "true" : "false"}"
|
|
4677
4702
|
>${e == null ? void 0 : e.icon}</span
|
|
4678
|
-
>` :
|
|
4703
|
+
>` : Ot(e == null ? void 0 : e.icon) ? c`<img
|
|
4679
4704
|
src="${e == null ? void 0 : e.icon}"
|
|
4680
4705
|
alt="${s.alt}"
|
|
4681
4706
|
class="poll-option-icon-img"
|
|
@@ -4703,7 +4728,7 @@ let Q = class extends g {
|
|
|
4703
4728
|
selected: o,
|
|
4704
4729
|
"poll-option--compact": this.compact,
|
|
4705
4730
|
"poll-option--disabled": r
|
|
4706
|
-
}, i = t + 1, a = `poll-${this.type}-${i}`, l =
|
|
4731
|
+
}, i = t + 1, a = `poll-${this.type}-${i}`, l = _o(
|
|
4707
4732
|
e.label,
|
|
4708
4733
|
o,
|
|
4709
4734
|
r,
|
|
@@ -4713,7 +4738,7 @@ let Q = class extends g {
|
|
|
4713
4738
|
return c`
|
|
4714
4739
|
<button
|
|
4715
4740
|
data-testid="poll-option-i${t}"
|
|
4716
|
-
class="${
|
|
4741
|
+
class="${w(s)}"
|
|
4717
4742
|
@click="${(n) => {
|
|
4718
4743
|
n.stopPropagation(), this.handleClick(e);
|
|
4719
4744
|
}}"
|
|
@@ -4737,13 +4762,13 @@ let Q = class extends g {
|
|
|
4737
4762
|
*/
|
|
4738
4763
|
renderPollOptions() {
|
|
4739
4764
|
var s;
|
|
4740
|
-
const e = this.multiple ? N.GROUP : N.RADIOGROUP, t = this.question || this.name || "Options", o =
|
|
4765
|
+
const e = this.multiple ? N.GROUP : N.RADIOGROUP, t = this.question || this.name || "Options", o = st({
|
|
4741
4766
|
role: e,
|
|
4742
4767
|
ariaLabel: t
|
|
4743
4768
|
});
|
|
4744
4769
|
return c`
|
|
4745
4770
|
<div
|
|
4746
|
-
class="${
|
|
4771
|
+
class="${w({
|
|
4747
4772
|
"poll-container": !0
|
|
4748
4773
|
})}"
|
|
4749
4774
|
data-testid="poll-option-container"
|
|
@@ -4760,21 +4785,21 @@ let Q = class extends g {
|
|
|
4760
4785
|
renderBarChart() {
|
|
4761
4786
|
var n, d;
|
|
4762
4787
|
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, h) => p + h, 0), r = this.options.map((p, h) => {
|
|
4763
|
-
const
|
|
4788
|
+
const v = e[p.value] || 0, x = o > 0 ? Math.round(v / o * 100) : 0, k = (t[p.value] || 0) > 0;
|
|
4764
4789
|
return {
|
|
4765
4790
|
option: p,
|
|
4766
4791
|
index: h,
|
|
4767
|
-
voteCount:
|
|
4792
|
+
voteCount: v,
|
|
4768
4793
|
percentage: x,
|
|
4769
|
-
isSelected:
|
|
4794
|
+
isSelected: k
|
|
4770
4795
|
};
|
|
4771
|
-
}), s = this.multiple ? N.GROUP : N.RADIOGROUP, i = this.question || this.name || "Options", a =
|
|
4796
|
+
}), s = this.multiple ? N.GROUP : N.RADIOGROUP, i = this.question || this.name || "Options", a = st({
|
|
4772
4797
|
role: s,
|
|
4773
4798
|
ariaLabel: i
|
|
4774
4799
|
});
|
|
4775
4800
|
return c`
|
|
4776
4801
|
<div
|
|
4777
|
-
class="${
|
|
4802
|
+
class="${w({
|
|
4778
4803
|
"poll-container": !0
|
|
4779
4804
|
})}"
|
|
4780
4805
|
data-testid="poll-chart-container"
|
|
@@ -4790,7 +4815,7 @@ let Q = class extends g {
|
|
|
4790
4815
|
};
|
|
4791
4816
|
return c`
|
|
4792
4817
|
<div
|
|
4793
|
-
class="${
|
|
4818
|
+
class="${w(h)}"
|
|
4794
4819
|
data-testid="poll-chart-item-${p.index}"
|
|
4795
4820
|
role="listitem"
|
|
4796
4821
|
aria-label="${p.option.label}: ${p.percentage}% (${p.voteCount} votes)"
|
|
@@ -4861,7 +4886,7 @@ let Q = class extends g {
|
|
|
4861
4886
|
* Shows add icon when no selection, edit icon when user has submitted
|
|
4862
4887
|
*/
|
|
4863
4888
|
renderInlineTrigger() {
|
|
4864
|
-
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ?
|
|
4889
|
+
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ? At : Me;
|
|
4865
4890
|
return c`
|
|
4866
4891
|
<button
|
|
4867
4892
|
class="pc-inline-trigger"
|
|
@@ -4920,7 +4945,7 @@ let Q = class extends g {
|
|
|
4920
4945
|
aria-label="Close"
|
|
4921
4946
|
data-testid="popover-close-button"
|
|
4922
4947
|
>
|
|
4923
|
-
${
|
|
4948
|
+
${_t}
|
|
4924
4949
|
</button>
|
|
4925
4950
|
${this.question ? c`<div class="pc-popover-question">${this.question}</div>` : u}
|
|
4926
4951
|
${e ? this.renderBarChart() : this.renderPollOptions()}
|
|
@@ -4937,7 +4962,7 @@ let Q = class extends g {
|
|
|
4937
4962
|
@keydown=${(s) => {
|
|
4938
4963
|
(s.key === "Enter" || s.key === " ") && (s.preventDefault(), this.handlePopoverEditClick());
|
|
4939
4964
|
}}
|
|
4940
|
-
>${
|
|
4965
|
+
>${At}</span
|
|
4941
4966
|
>` : u}
|
|
4942
4967
|
</div>` : u}
|
|
4943
4968
|
</div>
|
|
@@ -4994,25 +5019,25 @@ let Q = class extends g {
|
|
|
4994
5019
|
* Render standard mode - original behavior
|
|
4995
5020
|
*/
|
|
4996
5021
|
renderStandardMode() {
|
|
4997
|
-
const e =
|
|
5022
|
+
const e = z(this.questionPosition, this.questionAlign), t = {
|
|
4998
5023
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
4999
5024
|
[`pc-flex-align-${e}`]: !0
|
|
5000
|
-
}, o =
|
|
5025
|
+
}, o = z(this.statsPosition, this.statsAlign), r = {
|
|
5001
5026
|
"pc-body": !0,
|
|
5002
5027
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5003
5028
|
[`pc-flex-align-${o}`]: !0
|
|
5004
|
-
}, s =
|
|
5029
|
+
}, s = st({
|
|
5005
5030
|
role: N.REGION,
|
|
5006
5031
|
ariaLabel: this.question || this.name || "Poll"
|
|
5007
5032
|
});
|
|
5008
5033
|
return c`
|
|
5009
5034
|
<div
|
|
5010
|
-
class="pc-container ${
|
|
5035
|
+
class="pc-container ${w(t)}"
|
|
5011
5036
|
data-testid="poll-container"
|
|
5012
5037
|
...=${s}
|
|
5013
5038
|
>
|
|
5014
5039
|
${this.renderLabelAtStart()}
|
|
5015
|
-
<div class="${
|
|
5040
|
+
<div class="${w(r)}" data-testid="poll-body">
|
|
5016
5041
|
${this.renderContent()} ${this.renderFooter()}
|
|
5017
5042
|
</div>
|
|
5018
5043
|
${this.renderLabelAtEnd()}
|
|
@@ -5023,23 +5048,23 @@ let Q = class extends g {
|
|
|
5023
5048
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
5024
5049
|
}
|
|
5025
5050
|
};
|
|
5026
|
-
|
|
5027
|
-
|
|
5051
|
+
tt.styles = [...m.styles, It, pr];
|
|
5052
|
+
wt([
|
|
5028
5053
|
f({ type: Boolean })
|
|
5029
|
-
],
|
|
5030
|
-
|
|
5054
|
+
], tt.prototype, "multiple", 2);
|
|
5055
|
+
wt([
|
|
5031
5056
|
f({ type: Boolean })
|
|
5032
|
-
],
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
],
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
],
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
],
|
|
5042
|
-
const
|
|
5057
|
+
], tt.prototype, "compact", 2);
|
|
5058
|
+
wt([
|
|
5059
|
+
A()
|
|
5060
|
+
], tt.prototype, "popoverOpen", 2);
|
|
5061
|
+
wt([
|
|
5062
|
+
bt(".pc-inline-trigger")
|
|
5063
|
+
], tt.prototype, "triggerElement", 2);
|
|
5064
|
+
tt = wt([
|
|
5065
|
+
W("pc-poll")
|
|
5066
|
+
], tt);
|
|
5067
|
+
const fr = U`
|
|
5043
5068
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
5044
5069
|
|
|
5045
5070
|
.pc-section {
|
|
@@ -5226,10 +5251,10 @@ const pr = U`
|
|
|
5226
5251
|
* Copyright 2018 Google LLC
|
|
5227
5252
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5228
5253
|
*/
|
|
5229
|
-
const
|
|
5254
|
+
const Ye = "important", gr = " !" + Ye, mr = He(class extends Fe {
|
|
5230
5255
|
constructor(e) {
|
|
5231
5256
|
var t;
|
|
5232
|
-
if (super(e), e.type !==
|
|
5257
|
+
if (super(e), e.type !== qe.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.");
|
|
5233
5258
|
}
|
|
5234
5259
|
render(e) {
|
|
5235
5260
|
return Object.keys(e).reduce((t, o) => {
|
|
@@ -5245,14 +5270,14 @@ const He = "important", ur = " !" + He, hr = je(class extends qe {
|
|
|
5245
5270
|
const s = t[r];
|
|
5246
5271
|
if (s != null) {
|
|
5247
5272
|
this.ft.add(r);
|
|
5248
|
-
const i = typeof s == "string" && s.endsWith(
|
|
5249
|
-
r.includes("-") || i ? o.setProperty(r, i ? s.slice(0, -11) : s, i ?
|
|
5273
|
+
const i = typeof s == "string" && s.endsWith(gr);
|
|
5274
|
+
r.includes("-") || i ? o.setProperty(r, i ? s.slice(0, -11) : s, i ? Ye : "") : o[r] = s;
|
|
5250
5275
|
}
|
|
5251
5276
|
}
|
|
5252
5277
|
return H;
|
|
5253
5278
|
}
|
|
5254
5279
|
});
|
|
5255
|
-
function
|
|
5280
|
+
function Ct(e, t = {}) {
|
|
5256
5281
|
if (!e || e.length === 0)
|
|
5257
5282
|
return c`<div class="pc-bar-chart pc-bar-chart--empty">No data available</div>`;
|
|
5258
5283
|
const o = Math.max(...e.map((i) => i.value)), s = { ...{
|
|
@@ -5281,7 +5306,7 @@ function $t(e, t = {}) {
|
|
|
5281
5306
|
</div>
|
|
5282
5307
|
`;
|
|
5283
5308
|
}
|
|
5284
|
-
const
|
|
5309
|
+
const Ee = {
|
|
5285
5310
|
// Faces
|
|
5286
5311
|
smile: "😊",
|
|
5287
5312
|
laugh: "😄",
|
|
@@ -5424,19 +5449,19 @@ const Ce = {
|
|
|
5424
5449
|
hiking: "🥾",
|
|
5425
5450
|
yoga: "🧘"
|
|
5426
5451
|
};
|
|
5427
|
-
function
|
|
5452
|
+
function Pt(e) {
|
|
5428
5453
|
let t = "❓", o = !1;
|
|
5429
|
-
return e ? e in
|
|
5454
|
+
return e ? e in Ee ? t = Ee[e] : Ve(e) ? t = e : Ot(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 = "❓", {
|
|
5430
5455
|
icon: t,
|
|
5431
5456
|
isRemoteImage: o
|
|
5432
5457
|
};
|
|
5433
5458
|
}
|
|
5434
|
-
var
|
|
5435
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
5459
|
+
var vr = Object.defineProperty, br = Object.getOwnPropertyDescriptor, nt = (e, t, o, r) => {
|
|
5460
|
+
for (var s = r > 1 ? void 0 : r ? br(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
5436
5461
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
5437
|
-
return r && s &&
|
|
5462
|
+
return r && s && vr(t, o, s), s;
|
|
5438
5463
|
};
|
|
5439
|
-
let F = class extends
|
|
5464
|
+
let F = class extends m {
|
|
5440
5465
|
constructor() {
|
|
5441
5466
|
super(), this.type = S.stars, this.icon = "★", this.numStars = 5, this.hoverValue = -1, this.popoverOpen = !1, this.handleStarKeyDown = (e) => {
|
|
5442
5467
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -5459,14 +5484,14 @@ let F = class extends g {
|
|
|
5459
5484
|
* Renders the star icon using resolveIcon for emoji, URL, or MDI support
|
|
5460
5485
|
*/
|
|
5461
5486
|
renderStarIcon() {
|
|
5462
|
-
const { icon: e, isRemoteImage: t } =
|
|
5487
|
+
const { icon: e, isRemoteImage: t } = Pt(this.icon);
|
|
5463
5488
|
return t ? c`<img class="star-icon-img" src="${e}" alt="star" />` : e;
|
|
5464
5489
|
}
|
|
5465
5490
|
/**
|
|
5466
5491
|
* Gets the resolved icon string (for use in chart labels)
|
|
5467
5492
|
*/
|
|
5468
5493
|
getResolvedIconString() {
|
|
5469
|
-
const { icon: e, isRemoteImage: t } =
|
|
5494
|
+
const { icon: e, isRemoteImage: t } = Pt(this.icon);
|
|
5470
5495
|
return t ? "★" : e;
|
|
5471
5496
|
}
|
|
5472
5497
|
/**
|
|
@@ -5477,22 +5502,22 @@ let F = class extends g {
|
|
|
5477
5502
|
renderStars(e = !1) {
|
|
5478
5503
|
var n;
|
|
5479
5504
|
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) => {
|
|
5480
|
-
const p = e ? t || 0 : Math.floor(i), h = d <= p || d <= (this.hoverValue || 0),
|
|
5505
|
+
const p = e ? t || 0 : Math.floor(i), h = d <= p || d <= (this.hoverValue || 0), v = !e && !h && d === Math.ceil(i) && i % 1 !== 0, x = {
|
|
5481
5506
|
star: !0,
|
|
5482
5507
|
selected: h,
|
|
5483
|
-
partial:
|
|
5508
|
+
partial: v,
|
|
5484
5509
|
"view-mode": !a
|
|
5485
|
-
},
|
|
5510
|
+
}, k = v ? { "--partial-fill": `${i % 1 * 100}%` } : {}, P = e ? () => this.handlePopoverStarClick(d) : () => this.handleStarClick(d);
|
|
5486
5511
|
return c`
|
|
5487
5512
|
<div class="pc-section" data-testid="pc-section">
|
|
5488
5513
|
<span
|
|
5489
5514
|
data-testid="${e ? "popover" : "stars-view"}-star-${d}"
|
|
5490
|
-
class=${
|
|
5491
|
-
style=${
|
|
5515
|
+
class=${w(x)}
|
|
5516
|
+
style=${mr(k)}
|
|
5492
5517
|
role="${a ? "button" : "presentation"}"
|
|
5493
5518
|
tabindex="${a ? "0" : ""}"
|
|
5494
5519
|
aria-label="${a ? `Rate ${d} star${d > 1 ? "s" : ""}` : ""}"
|
|
5495
|
-
@click="${
|
|
5520
|
+
@click="${P}"
|
|
5496
5521
|
@mouseenter="${() => this.handleStarHover(d)}"
|
|
5497
5522
|
@focus="${() => this.handleStarHover(d)}"
|
|
5498
5523
|
@mouseleave="${this.handleStarLeave}"
|
|
@@ -5516,7 +5541,7 @@ let F = class extends g {
|
|
|
5516
5541
|
label: n,
|
|
5517
5542
|
value: d,
|
|
5518
5543
|
icon: r
|
|
5519
|
-
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l =
|
|
5544
|
+
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l = Ct(s, {
|
|
5520
5545
|
barColor: a,
|
|
5521
5546
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
5522
5547
|
valueFormatter: (n) => `${o > 0 ? Math.round(n.value / o * 100) : 0}%`
|
|
@@ -5583,7 +5608,7 @@ let F = class extends g {
|
|
|
5583
5608
|
};
|
|
5584
5609
|
return c`
|
|
5585
5610
|
<button
|
|
5586
|
-
class=${
|
|
5611
|
+
class=${w(i)}
|
|
5587
5612
|
@click=${() => {
|
|
5588
5613
|
this.popoverOpen = !0;
|
|
5589
5614
|
}}
|
|
@@ -5616,7 +5641,7 @@ let F = class extends g {
|
|
|
5616
5641
|
aria-label="Close"
|
|
5617
5642
|
data-testid="popover-close-button"
|
|
5618
5643
|
>
|
|
5619
|
-
${
|
|
5644
|
+
${_t}
|
|
5620
5645
|
</button>
|
|
5621
5646
|
${this.question ? c`<div class="pc-popover-question">${this.question}</div>` : u}
|
|
5622
5647
|
${this.renderStars(!0)}
|
|
@@ -5639,7 +5664,7 @@ let F = class extends g {
|
|
|
5639
5664
|
label: n,
|
|
5640
5665
|
value: d,
|
|
5641
5666
|
icon: r
|
|
5642
|
-
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l =
|
|
5667
|
+
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l = Ct(s, {
|
|
5643
5668
|
barColor: a,
|
|
5644
5669
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
5645
5670
|
valueFormatter: (n) => `${o > 0 ? Math.round(n.value / o * 100) : 0}%`
|
|
@@ -5665,7 +5690,7 @@ let F = class extends g {
|
|
|
5665
5690
|
@keydown="${(e) => {
|
|
5666
5691
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.displayController.toggleChartVisibility());
|
|
5667
5692
|
}}"
|
|
5668
|
-
>${this.displayController.isChartVisible ?
|
|
5693
|
+
>${this.displayController.isChartVisible ? Qt : Xt}</span
|
|
5669
5694
|
>
|
|
5670
5695
|
`;
|
|
5671
5696
|
}
|
|
@@ -5708,7 +5733,7 @@ let F = class extends g {
|
|
|
5708
5733
|
label: n,
|
|
5709
5734
|
value: d,
|
|
5710
5735
|
icon: r
|
|
5711
|
-
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l =
|
|
5736
|
+
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l = Ct(s, {
|
|
5712
5737
|
barColor: a,
|
|
5713
5738
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
5714
5739
|
valueFormatter: (n) => `${o > 0 ? Math.round(n.value / o * 100) : 0}%`
|
|
@@ -5723,18 +5748,18 @@ let F = class extends g {
|
|
|
5723
5748
|
* Render standard mode - original behavior
|
|
5724
5749
|
*/
|
|
5725
5750
|
renderStandardMode() {
|
|
5726
|
-
const e =
|
|
5751
|
+
const e = z(this.questionPosition, this.questionAlign), t = {
|
|
5727
5752
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
5728
5753
|
[`pc-flex-align-${e}`]: !0
|
|
5729
|
-
}, o =
|
|
5754
|
+
}, o = z(this.statsPosition, this.statsAlign), r = {
|
|
5730
5755
|
"pc-body": !0,
|
|
5731
5756
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5732
5757
|
[`pc-flex-align-${o}`]: !0
|
|
5733
5758
|
}, s = !this.displayController.shouldShowChart();
|
|
5734
5759
|
return c`
|
|
5735
|
-
<div class="pc-container ${
|
|
5760
|
+
<div class="pc-container ${w(t)}" data-testid="pc-container">
|
|
5736
5761
|
${this.renderLabelAtStart()}
|
|
5737
|
-
<div class="${
|
|
5762
|
+
<div class="${w(r)}" data-testid="stars-body">
|
|
5738
5763
|
${this.renderStatusAtStart()} ${this.renderChart()}
|
|
5739
5764
|
${s ? this.renderStars() : u} ${this.renderStatusAtEnd()}
|
|
5740
5765
|
</div>
|
|
@@ -5746,7 +5771,7 @@ let F = class extends g {
|
|
|
5746
5771
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
5747
5772
|
}
|
|
5748
5773
|
};
|
|
5749
|
-
F.styles = [...
|
|
5774
|
+
F.styles = [...m.styles, It, fr];
|
|
5750
5775
|
nt([
|
|
5751
5776
|
f({ type: String })
|
|
5752
5777
|
], F.prototype, "icon", 2);
|
|
@@ -5754,18 +5779,18 @@ nt([
|
|
|
5754
5779
|
f({ type: Number, attribute: "num-stars" })
|
|
5755
5780
|
], F.prototype, "numStars", 2);
|
|
5756
5781
|
nt([
|
|
5757
|
-
|
|
5782
|
+
A()
|
|
5758
5783
|
], F.prototype, "hoverValue", 2);
|
|
5759
5784
|
nt([
|
|
5760
|
-
|
|
5785
|
+
A()
|
|
5761
5786
|
], F.prototype, "popoverOpen", 2);
|
|
5762
5787
|
nt([
|
|
5763
|
-
|
|
5788
|
+
bt(".pc-inline-trigger")
|
|
5764
5789
|
], F.prototype, "triggerElement", 2);
|
|
5765
5790
|
F = nt([
|
|
5766
|
-
|
|
5791
|
+
W("pc-stars")
|
|
5767
5792
|
], F);
|
|
5768
|
-
const
|
|
5793
|
+
const yr = U`
|
|
5769
5794
|
/* Adjust stats text for reactions */
|
|
5770
5795
|
.pc-stats-text {
|
|
5771
5796
|
font-size: var(--pc-font-size-small, var(--default-font-size-small));
|
|
@@ -6028,13 +6053,13 @@ const mr = U`
|
|
|
6028
6053
|
animation: none;
|
|
6029
6054
|
}
|
|
6030
6055
|
}
|
|
6031
|
-
`,
|
|
6032
|
-
var
|
|
6033
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
6056
|
+
`, wr = "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";
|
|
6057
|
+
var xr = Object.defineProperty, $r = Object.getOwnPropertyDescriptor, zt = (e, t, o, r) => {
|
|
6058
|
+
for (var s = r > 1 ? void 0 : r ? $r(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
6034
6059
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
6035
|
-
return r && s &&
|
|
6060
|
+
return r && s && xr(t, o, s), s;
|
|
6036
6061
|
};
|
|
6037
|
-
let
|
|
6062
|
+
let at = class extends m {
|
|
6038
6063
|
constructor() {
|
|
6039
6064
|
super(), this.type = S.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";
|
|
6040
6065
|
}
|
|
@@ -6058,7 +6083,7 @@ let it = class extends g {
|
|
|
6058
6083
|
* Renders the icon for a reaction
|
|
6059
6084
|
*/
|
|
6060
6085
|
renderReactionIcon(e, t) {
|
|
6061
|
-
const { icon: o, isRemoteImage: r } =
|
|
6086
|
+
const { icon: o, isRemoteImage: r } = Pt(e), s = ee.FUNCTIONAL, i = t.tooltip || `${t.value} reaction`, a = je(o, {
|
|
6062
6087
|
type: s,
|
|
6063
6088
|
alt: i,
|
|
6064
6089
|
ariaLabel: i,
|
|
@@ -6085,7 +6110,7 @@ let it = class extends g {
|
|
|
6085
6110
|
}, l = `${e.tooltip || e.value} reaction${o ? ", selected" : ""}${t ? `, ${r} votes` : ""}`;
|
|
6086
6111
|
return c`
|
|
6087
6112
|
<button
|
|
6088
|
-
class="${
|
|
6113
|
+
class="${w(a)}"
|
|
6089
6114
|
@click="${() => this.handleReactionClick(e)}"
|
|
6090
6115
|
?disabled="${s}"
|
|
6091
6116
|
aria-pressed="${o}"
|
|
@@ -6112,7 +6137,7 @@ let it = class extends g {
|
|
|
6112
6137
|
aria-expanded="${this.displayController.shouldShowReactionPopover()}"
|
|
6113
6138
|
aria-haspopup="true"
|
|
6114
6139
|
>
|
|
6115
|
-
<img src="${
|
|
6140
|
+
<img src="${wr}" alt="" class="trigger-icon" />
|
|
6116
6141
|
</button>
|
|
6117
6142
|
`;
|
|
6118
6143
|
}
|
|
@@ -6127,7 +6152,7 @@ let it = class extends g {
|
|
|
6127
6152
|
bottom: this.popupPosition === "bottom" || this.popupPosition === "auto" && !this.shouldShowPopoverOnTop()
|
|
6128
6153
|
};
|
|
6129
6154
|
return c`
|
|
6130
|
-
<div class="${
|
|
6155
|
+
<div class="${w(e)}" role="menu">
|
|
6131
6156
|
<div class="popover-content">
|
|
6132
6157
|
${this.options.map((t) => {
|
|
6133
6158
|
const o = this.displayController.shouldDisableOption(t);
|
|
@@ -6174,7 +6199,7 @@ let it = class extends g {
|
|
|
6174
6199
|
(o) => this.dataController.isValueSelected(o.value)
|
|
6175
6200
|
);
|
|
6176
6201
|
return c`
|
|
6177
|
-
<div class="${
|
|
6202
|
+
<div class="${w(e)}">
|
|
6178
6203
|
${t.length > 0 ? c`
|
|
6179
6204
|
<div class="reaction-list">
|
|
6180
6205
|
${t.map(
|
|
@@ -6187,7 +6212,7 @@ let it = class extends g {
|
|
|
6187
6212
|
`;
|
|
6188
6213
|
} else
|
|
6189
6214
|
return c`
|
|
6190
|
-
<div class="${
|
|
6215
|
+
<div class="${w(e)}">
|
|
6191
6216
|
<div class="reaction-list">
|
|
6192
6217
|
${this.options.map((t) => this.renderReactionButton(t, this.showCounts))}
|
|
6193
6218
|
</div>
|
|
@@ -6210,7 +6235,7 @@ let it = class extends g {
|
|
|
6210
6235
|
icon: (p == null ? void 0 : p.icon) || n
|
|
6211
6236
|
// Use the icon or fall back to reaction value
|
|
6212
6237
|
};
|
|
6213
|
-
}), r = getComputedStyle(this), s = r.getPropertyValue("--pc-primary-color").trim(), a = r.getPropertyValue("--pc-accent-color").trim() || s || "#ffc107", l =
|
|
6238
|
+
}), r = getComputedStyle(this), s = r.getPropertyValue("--pc-primary-color").trim(), a = r.getPropertyValue("--pc-accent-color").trim() || s || "#ffc107", l = Ct(o, {
|
|
6214
6239
|
barColor: a,
|
|
6215
6240
|
labelFormatter: (n) => `${n.label}`,
|
|
6216
6241
|
valueFormatter: (n) => `${e.totalCount > 0 ? Math.round(n.value / e.totalCount * 100) : 0}%`
|
|
@@ -6251,18 +6276,18 @@ let it = class extends g {
|
|
|
6251
6276
|
* (Reactions are inherently inline, so inline mode = standard mode)
|
|
6252
6277
|
*/
|
|
6253
6278
|
renderStandardMode() {
|
|
6254
|
-
const e =
|
|
6279
|
+
const e = z(this.questionPosition, this.questionAlign), t = {
|
|
6255
6280
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
6256
6281
|
[`pc-flex-align-${e}`]: !0
|
|
6257
|
-
}, o =
|
|
6282
|
+
}, o = z(this.statsPosition, this.statsAlign), r = {
|
|
6258
6283
|
"pc-body": !0,
|
|
6259
6284
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
6260
6285
|
[`pc-flex-align-${o}`]: !0
|
|
6261
6286
|
};
|
|
6262
6287
|
return c`
|
|
6263
|
-
<div class="${
|
|
6288
|
+
<div class="${w(t)}" data-testid="reaction-container">
|
|
6264
6289
|
${this.renderLabelAtStart()}
|
|
6265
|
-
<div class="${
|
|
6290
|
+
<div class="${w(r)}" data-testid="reaction-body">
|
|
6266
6291
|
${this.renderStatusAtStart()} ${this.renderChart()} ${this.renderReactions()}
|
|
6267
6292
|
${this.renderStatusAtEnd()}
|
|
6268
6293
|
</div>
|
|
@@ -6274,35 +6299,35 @@ let it = class extends g {
|
|
|
6274
6299
|
return this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
6275
6300
|
}
|
|
6276
6301
|
};
|
|
6277
|
-
|
|
6278
|
-
|
|
6302
|
+
at.styles = [...m.styles, It, yr];
|
|
6303
|
+
zt([
|
|
6279
6304
|
f({ type: Boolean, attribute: "show-counts" })
|
|
6280
|
-
],
|
|
6281
|
-
|
|
6305
|
+
], at.prototype, "showCounts", 2);
|
|
6306
|
+
zt([
|
|
6282
6307
|
f({ type: Boolean, reflect: !0 })
|
|
6283
|
-
],
|
|
6284
|
-
|
|
6308
|
+
], at.prototype, "compact", 2);
|
|
6309
|
+
zt([
|
|
6285
6310
|
f({ type: String, attribute: "popup-position" })
|
|
6286
|
-
],
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
],
|
|
6290
|
-
function
|
|
6311
|
+
], at.prototype, "popupPosition", 2);
|
|
6312
|
+
at = zt([
|
|
6313
|
+
W("pc-reaction")
|
|
6314
|
+
], at);
|
|
6315
|
+
function dt(e, t, o = void 0) {
|
|
6291
6316
|
const r = e.getAttribute(t);
|
|
6292
6317
|
return r === null ? o : r == null ? void 0 : r.trim();
|
|
6293
6318
|
}
|
|
6294
|
-
function
|
|
6319
|
+
function Sr(e, t = void 0) {
|
|
6295
6320
|
const o = e.textContent;
|
|
6296
6321
|
return o === "" || o === null ? t : o == null ? void 0 : o.trim();
|
|
6297
6322
|
}
|
|
6298
|
-
var
|
|
6299
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
6323
|
+
var Cr = Object.defineProperty, kr = Object.getOwnPropertyDescriptor, lt = (e, t, o, r) => {
|
|
6324
|
+
for (var s = r > 1 ? void 0 : r ? kr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
6300
6325
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
6301
|
-
return r && s &&
|
|
6326
|
+
return r && s && Cr(t, o, s), s;
|
|
6302
6327
|
};
|
|
6303
|
-
let
|
|
6328
|
+
let Y = class extends R {
|
|
6304
6329
|
constructor() {
|
|
6305
|
-
super(), this.options = "", this.parsedOptions = [],
|
|
6330
|
+
super(), this.options = "", this.parsedOptions = [], this.isLoadingType = !1, Y.injectGlobalStyle();
|
|
6306
6331
|
}
|
|
6307
6332
|
/**
|
|
6308
6333
|
* Inject global style to hide poll-catch-option elements
|
|
@@ -6326,6 +6351,43 @@ let at = class extends R {
|
|
|
6326
6351
|
createRenderRoot() {
|
|
6327
6352
|
return this;
|
|
6328
6353
|
}
|
|
6354
|
+
connectedCallback() {
|
|
6355
|
+
super.connectedCallback(), this.maybeFetchType();
|
|
6356
|
+
}
|
|
6357
|
+
async maybeFetchType() {
|
|
6358
|
+
var t, o, r, s, i, a, l, n, d, p, h, v, x, k;
|
|
6359
|
+
if (this.type || !this.widgetId) return;
|
|
6360
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(this.widgetId)) {
|
|
6361
|
+
g.error(`poll-catch: Invalid widget-id format: ${this.widgetId}`);
|
|
6362
|
+
return;
|
|
6363
|
+
}
|
|
6364
|
+
this.isLoadingType = !0;
|
|
6365
|
+
try {
|
|
6366
|
+
const _ = `${this.getAttribute("data-endpoint") || Yt}/widgets/${encodeURIComponent(this.widgetId)}`, $ = await fetch(_);
|
|
6367
|
+
if (!$.ok)
|
|
6368
|
+
throw new Error(`API request failed with status: ${$.status}`);
|
|
6369
|
+
const y = await $.json();
|
|
6370
|
+
if (!y.success)
|
|
6371
|
+
throw new Error("Backend returned unsuccessful response");
|
|
6372
|
+
const E = (o = (t = y.data) == null ? void 0 : t.config) == null ? void 0 : o.type;
|
|
6373
|
+
if (!E)
|
|
6374
|
+
throw new Error("Backend response missing widget type");
|
|
6375
|
+
Yo(this.widgetId, {
|
|
6376
|
+
type: E,
|
|
6377
|
+
attributes: ((s = (r = y.data) == null ? void 0 : r.config) == null ? void 0 : s.attributes) || null,
|
|
6378
|
+
stats: {
|
|
6379
|
+
count: ((a = (i = y.data) == null ? void 0 : i.stats) == null ? void 0 : a.count) ?? 0,
|
|
6380
|
+
sum: ((n = (l = y.data) == null ? void 0 : l.stats) == null ? void 0 : n.sum) ?? 0,
|
|
6381
|
+
breakdown: ((p = (d = y.data) == null ? void 0 : d.stats) == null ? void 0 : p.breakdown) ?? {},
|
|
6382
|
+
updatedAt: ((v = (h = y.data) == null ? void 0 : h.stats) == null ? void 0 : v.updatedAt) || ((k = (x = y.data) == null ? void 0 : x.stats) == null ? void 0 : k.updated_at)
|
|
6383
|
+
}
|
|
6384
|
+
}), this.type = E, await this.updateComplete, this.forceUpdate();
|
|
6385
|
+
} catch (P) {
|
|
6386
|
+
g.error("poll-catch: Failed to fetch widget config", P);
|
|
6387
|
+
} finally {
|
|
6388
|
+
this.isLoadingType = !1;
|
|
6389
|
+
}
|
|
6390
|
+
}
|
|
6329
6391
|
forceUpdate() {
|
|
6330
6392
|
this.forwardAttributesToWidget(), this.forwardOptionsToWidget();
|
|
6331
6393
|
}
|
|
@@ -6361,16 +6423,16 @@ let at = class extends R {
|
|
|
6361
6423
|
const e = this.querySelector("pc-poll, pc-reaction");
|
|
6362
6424
|
if (!e) return;
|
|
6363
6425
|
const t = this.querySelectorAll("poll-catch-option");
|
|
6364
|
-
let r =
|
|
6426
|
+
let r = jo(this.options).map((s) => ({
|
|
6365
6427
|
value: s,
|
|
6366
6428
|
label: s,
|
|
6367
6429
|
icon: e.tagName === "PC-REACTION" ? s : void 0
|
|
6368
6430
|
// REACTION widget uses options for the icon
|
|
6369
6431
|
}));
|
|
6370
6432
|
t && t.length > 0 && (r = Array.from(t).map((s) => {
|
|
6371
|
-
const i =
|
|
6433
|
+
const i = dt(s, "value", "") || "", a = dt(s, "label", Sr(s, i)) || "", l = dt(s, "icon", void 0), n = dt(s, "tooltip", void 0), d = dt(s, "disabled", void 0), p = { value: i, label: a };
|
|
6372
6434
|
if (l !== void 0) {
|
|
6373
|
-
const h =
|
|
6435
|
+
const h = Pt(l);
|
|
6374
6436
|
p.icon = h.icon;
|
|
6375
6437
|
}
|
|
6376
6438
|
return n !== void 0 && (p.tooltip = n), d !== void 0 && (p.disabled = !0), p;
|
|
@@ -6380,6 +6442,8 @@ let at = class extends R {
|
|
|
6380
6442
|
* Render the appropriate widget based on the type
|
|
6381
6443
|
*/
|
|
6382
6444
|
render() {
|
|
6445
|
+
if (this.isLoadingType)
|
|
6446
|
+
return u;
|
|
6383
6447
|
switch (this.type) {
|
|
6384
6448
|
case S.nps:
|
|
6385
6449
|
return c`<pc-nps></pc-nps>`;
|
|
@@ -6390,24 +6454,30 @@ let at = class extends R {
|
|
|
6390
6454
|
case S.reaction:
|
|
6391
6455
|
return c`<pc-reaction .options=${this.parsedOptions}></pc-reaction>`;
|
|
6392
6456
|
default:
|
|
6393
|
-
return console.warn(
|
|
6457
|
+
return this.widgetId || console.warn(
|
|
6394
6458
|
`poll-catch: Unknown widget type "${this.type}". Supported types: nps, poll, stars, reaction.`
|
|
6395
6459
|
), u;
|
|
6396
6460
|
}
|
|
6397
6461
|
}
|
|
6398
6462
|
};
|
|
6399
|
-
|
|
6463
|
+
lt([
|
|
6400
6464
|
f({ type: String })
|
|
6401
|
-
],
|
|
6402
|
-
|
|
6465
|
+
], Y.prototype, "type", 2);
|
|
6466
|
+
lt([
|
|
6467
|
+
f({ type: String, attribute: "widget-id" })
|
|
6468
|
+
], Y.prototype, "widgetId", 2);
|
|
6469
|
+
lt([
|
|
6403
6470
|
f({ type: String })
|
|
6404
|
-
],
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
],
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
],
|
|
6471
|
+
], Y.prototype, "options", 2);
|
|
6472
|
+
lt([
|
|
6473
|
+
A()
|
|
6474
|
+
], Y.prototype, "parsedOptions", 2);
|
|
6475
|
+
lt([
|
|
6476
|
+
A()
|
|
6477
|
+
], Y.prototype, "isLoadingType", 2);
|
|
6478
|
+
Y = lt([
|
|
6479
|
+
W("poll-catch")
|
|
6480
|
+
], Y);
|
|
6411
6481
|
export {
|
|
6412
|
-
|
|
6482
|
+
Y as PollCatch
|
|
6413
6483
|
};
|