pollcatch 2.1.3 → 2.1.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/pc.js +229 -221
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pollcatch",
3
3
  "private": false,
4
- "version": "2.1.3",
4
+ "version": "2.1.5",
5
5
  "type": "module",
6
6
  "main": "pc.js",
7
7
  "module": "pc.js",
package/pc.js CHANGED
@@ -281,7 +281,7 @@ U.elementStyles = [], U.shadowRootOptions = { mode: "open" }, U[K("elementProper
281
281
  */
282
282
  const W = globalThis, nt = W.trustedTypes, Bt = nt ? nt.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, ne = "$lit$", P = `lit$${Math.random().toFixed(9).slice(2)}$`, le = "?" + P, Ne = `<${le}>`, L = document, X = () => L.createComment(""), Q = (e) => e === null || typeof e != "object" && typeof e != "function", Pt = Array.isArray, Me = (e) => Pt(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", bt = `[
283
283
  \f\r]`, Z = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Dt = /-->/g, Vt = />/g, N = RegExp(`>|${bt}(?:([^\\s"'>=/]+)(${bt}*=${bt}*(?:[^
284
- \f\r"'\`<>=]|("|')|))|$)`, "g"), qt = /'/g, Ht = /"/g, ce = /^(?:script|style|textarea|title)$/i, Le = (e) => (t, ...o) => ({ _$litType$: e, strings: t, values: o }), d = Le(1), z = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), Ft = /* @__PURE__ */ new WeakMap(), M = L.createTreeWalker(L, 129);
284
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), qt = /'/g, Ht = /"/g, ce = /^(?:script|style|textarea|title)$/i, Le = (e) => (t, ...o) => ({ _$litType$: e, strings: t, values: o }), d = Le(1), z = Symbol.for("lit-noChange"), h = Symbol.for("lit-nothing"), Ft = /* @__PURE__ */ new WeakMap(), M = L.createTreeWalker(L, 129);
285
285
  function de(e, t) {
286
286
  if (!Pt(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
287
287
  return Bt !== void 0 ? Bt.createHTML(t) : t;
@@ -291,10 +291,10 @@ const Re = (e, t) => {
291
291
  let s, i = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = Z;
292
292
  for (let n = 0; n < o; n++) {
293
293
  const l = e[n];
294
- let p, c, h = -1, w = 0;
295
- for (; w < l.length && (a.lastIndex = w, c = a.exec(l), c !== null); ) w = a.lastIndex, a === Z ? c[1] === "!--" ? a = Dt : c[1] !== void 0 ? a = Vt : c[2] !== void 0 ? (ce.test(c[2]) && (s = RegExp("</" + c[2], "g")), a = N) : c[3] !== void 0 && (a = N) : a === N ? c[0] === ">" ? (a = s ?? Z, h = -1) : c[1] === void 0 ? h = -2 : (h = a.lastIndex - c[2].length, p = c[1], a = c[3] === void 0 ? N : c[3] === '"' ? Ht : qt) : a === Ht || a === qt ? a = N : a === Dt || a === Vt ? a = Z : (a = N, s = void 0);
296
- const v = a === N && e[n + 1].startsWith("/>") ? " " : "";
297
- i += a === Z ? l + Ne : h >= 0 ? (r.push(p), l.slice(0, h) + ne + l.slice(h) + P + v) : l + P + (h === -2 ? n : v);
294
+ let u, c, p = -1, v = 0;
295
+ for (; v < l.length && (a.lastIndex = v, c = a.exec(l), c !== null); ) v = a.lastIndex, a === Z ? c[1] === "!--" ? a = Dt : c[1] !== void 0 ? a = Vt : c[2] !== void 0 ? (ce.test(c[2]) && (s = RegExp("</" + c[2], "g")), a = N) : c[3] !== void 0 && (a = N) : a === N ? c[0] === ">" ? (a = s ?? Z, p = -1) : c[1] === void 0 ? p = -2 : (p = a.lastIndex - c[2].length, u = c[1], a = c[3] === void 0 ? N : c[3] === '"' ? Ht : qt) : a === Ht || a === qt ? a = N : a === Dt || a === Vt ? a = Z : (a = N, s = void 0);
296
+ const y = a === N && e[n + 1].startsWith("/>") ? " " : "";
297
+ i += a === Z ? l + Ne : p >= 0 ? (r.push(u), l.slice(0, p) + ne + l.slice(p) + P + y) : l + P + (p === -2 ? n : y);
298
298
  }
299
299
  return [de(e, i + (e[o] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
300
300
  };
@@ -303,29 +303,29 @@ let kt = class pe {
303
303
  let s;
304
304
  this.parts = [];
305
305
  let i = 0, a = 0;
306
- const n = t.length - 1, l = this.parts, [p, c] = Re(t, o);
307
- if (this.el = pe.createElement(p, r), M.currentNode = this.el.content, o === 2 || o === 3) {
308
- const h = this.el.content.firstChild;
309
- h.replaceWith(...h.childNodes);
306
+ const n = t.length - 1, l = this.parts, [u, c] = Re(t, o);
307
+ if (this.el = pe.createElement(u, r), M.currentNode = this.el.content, o === 2 || o === 3) {
308
+ const p = this.el.content.firstChild;
309
+ p.replaceWith(...p.childNodes);
310
310
  }
311
311
  for (; (s = M.nextNode()) !== null && l.length < n; ) {
312
312
  if (s.nodeType === 1) {
313
- if (s.hasAttributes()) for (const h of s.getAttributeNames()) if (h.endsWith(ne)) {
314
- const w = c[a++], v = s.getAttribute(h).split(P), E = /([.?@])?(.*)/.exec(w);
315
- l.push({ type: 1, index: i, name: E[2], strings: v, ctor: E[1] === "." ? je : E[1] === "?" ? Be : E[1] === "@" ? De : ct }), s.removeAttribute(h);
316
- } else h.startsWith(P) && (l.push({ type: 6, index: i }), s.removeAttribute(h));
313
+ if (s.hasAttributes()) for (const p of s.getAttributeNames()) if (p.endsWith(ne)) {
314
+ const v = c[a++], y = s.getAttribute(p).split(P), E = /([.?@])?(.*)/.exec(v);
315
+ l.push({ type: 1, index: i, name: E[2], strings: y, ctor: E[1] === "." ? je : E[1] === "?" ? Be : E[1] === "@" ? De : ct }), s.removeAttribute(p);
316
+ } else p.startsWith(P) && (l.push({ type: 6, index: i }), s.removeAttribute(p));
317
317
  if (ce.test(s.tagName)) {
318
- const h = s.textContent.split(P), w = h.length - 1;
319
- if (w > 0) {
318
+ const p = s.textContent.split(P), v = p.length - 1;
319
+ if (v > 0) {
320
320
  s.textContent = nt ? nt.emptyScript : "";
321
- for (let v = 0; v < w; v++) s.append(h[v], X()), M.nextNode(), l.push({ type: 2, index: ++i });
322
- s.append(h[w], X());
321
+ for (let y = 0; y < v; y++) s.append(p[y], X()), M.nextNode(), l.push({ type: 2, index: ++i });
322
+ s.append(p[v], X());
323
323
  }
324
324
  }
325
325
  } else if (s.nodeType === 8) if (s.data === le) l.push({ type: 2, index: i });
326
326
  else {
327
- let h = -1;
328
- for (; (h = s.data.indexOf(P, h + 1)) !== -1; ) l.push({ type: 7, index: i }), h += P.length - 1;
327
+ let p = -1;
328
+ for (; (p = s.data.indexOf(P, p + 1)) !== -1; ) l.push({ type: 7, index: i }), p += P.length - 1;
329
329
  }
330
330
  i++;
331
331
  }
@@ -358,8 +358,8 @@ let Ue = class {
358
358
  let i = M.nextNode(), a = 0, n = 0, l = r[0];
359
359
  for (; l !== void 0; ) {
360
360
  if (a === l.index) {
361
- let p;
362
- l.type === 2 ? p = new et(i, i.nextSibling, this, t) : l.type === 1 ? p = new l.ctor(i, l.name, l.strings, this, t) : l.type === 6 && (p = new Ve(i, this, t)), this._$AV.push(p), l = r[++n];
361
+ let u;
362
+ l.type === 2 ? u = new et(i, i.nextSibling, this, t) : l.type === 1 ? u = new l.ctor(i, l.name, l.strings, this, t) : l.type === 6 && (u = new Ve(i, this, t)), this._$AV.push(u), l = r[++n];
363
363
  }
364
364
  a !== (l == null ? void 0 : l.index) && (i = M.nextNode(), a++);
365
365
  }
@@ -376,7 +376,7 @@ class et {
376
376
  return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
377
377
  }
378
378
  constructor(t, o, r, s) {
379
- this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = o, this._$AM = r, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
379
+ this.type = 2, this._$AH = h, this._$AN = void 0, this._$AA = t, this._$AB = o, this._$AM = r, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
380
380
  }
381
381
  get parentNode() {
382
382
  let t = this._$AA.parentNode;
@@ -390,7 +390,7 @@ class et {
390
390
  return this._$AB;
391
391
  }
392
392
  _$AI(t, o = this) {
393
- t = D(this, t, o), Q(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== z && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Me(t) ? this.k(t) : this._(t);
393
+ t = D(this, t, o), Q(t) ? t === h || t == null || t === "" ? (this._$AH !== h && this._$AR(), this._$AH = h) : t !== this._$AH && t !== z && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Me(t) ? this.k(t) : this._(t);
394
394
  }
395
395
  O(t) {
396
396
  return this._$AA.parentNode.insertBefore(t, this._$AB);
@@ -399,7 +399,7 @@ class et {
399
399
  this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
400
400
  }
401
401
  _(t) {
402
- this._$AH !== u && Q(this._$AH) ? this._$AA.nextSibling.data = t : this.T(L.createTextNode(t)), this._$AH = t;
402
+ this._$AH !== h && Q(this._$AH) ? this._$AA.nextSibling.data = t : this.T(L.createTextNode(t)), this._$AH = t;
403
403
  }
404
404
  $(t) {
405
405
  var i;
@@ -441,7 +441,7 @@ class ct {
441
441
  return this._$AM._$AU;
442
442
  }
443
443
  constructor(t, o, r, s, i) {
444
- this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = o, this._$AM = s, this.options = i, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = u;
444
+ this.type = 1, this._$AH = h, this._$AN = void 0, this.element = t, this.name = o, this._$AM = s, this.options = i, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = h;
445
445
  }
446
446
  _$AI(t, o = this, r, s) {
447
447
  const i = this.strings;
@@ -449,13 +449,13 @@ class ct {
449
449
  if (i === void 0) t = D(this, t, o, 0), a = !Q(t) || t !== this._$AH && t !== z, a && (this._$AH = t);
450
450
  else {
451
451
  const n = t;
452
- let l, p;
453
- for (t = i[0], l = 0; l < i.length - 1; l++) p = D(this, n[r + l], o, l), p === z && (p = this._$AH[l]), a || (a = !Q(p) || p !== this._$AH[l]), p === u ? t = u : t !== u && (t += (p ?? "") + i[l + 1]), this._$AH[l] = p;
452
+ let l, u;
453
+ for (t = i[0], l = 0; l < i.length - 1; l++) u = D(this, n[r + l], o, l), u === z && (u = this._$AH[l]), a || (a = !Q(u) || u !== this._$AH[l]), u === h ? t = h : t !== h && (t += (u ?? "") + i[l + 1]), this._$AH[l] = u;
454
454
  }
455
455
  a && !s && this.j(t);
456
456
  }
457
457
  j(t) {
458
- t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
458
+ t === h ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
459
459
  }
460
460
  }
461
461
  let je = class extends ct {
@@ -463,7 +463,7 @@ let je = class extends ct {
463
463
  super(...arguments), this.type = 3;
464
464
  }
465
465
  j(t) {
466
- this.element[this.name] = t === u ? void 0 : t;
466
+ this.element[this.name] = t === h ? void 0 : t;
467
467
  }
468
468
  };
469
469
  class Be extends ct {
@@ -471,7 +471,7 @@ class Be extends ct {
471
471
  super(...arguments), this.type = 4;
472
472
  }
473
473
  j(t) {
474
- this.element.toggleAttribute(this.name, !!t && t !== u);
474
+ this.element.toggleAttribute(this.name, !!t && t !== h);
475
475
  }
476
476
  }
477
477
  class De extends ct {
@@ -479,8 +479,8 @@ class De extends ct {
479
479
  super(t, o, r, s, i), this.type = 5;
480
480
  }
481
481
  _$AI(t, o = this) {
482
- if ((t = D(this, t, o, 0) ?? u) === z) return;
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);
482
+ if ((t = D(this, t, o, 0) ?? h) === z) return;
483
+ const r = this._$AH, s = t === h && r !== h || t.capture !== r.capture || t.once !== r.once || t.passive !== r.passive, i = t !== h && (r === h || s);
484
484
  s && this.element.removeEventListener(this.name, this, r), i && this.element.addEventListener(this.name, this, t), this._$AH = t;
485
485
  }
486
486
  handleEvent(t) {
@@ -618,8 +618,8 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
618
618
  }, fe = function(e) {
619
619
  var t = e.h, o = e.s, r = e.v, s = e.a;
620
620
  t = t / 360 * 6, o /= 100, r /= 100;
621
- var i = Math.floor(t), a = r * (1 - o), n = r * (1 - (t - i) * o), l = r * (1 - (1 - t + i) * o), p = i % 6;
622
- return { r: 255 * [r, n, a, a, l, r][p], g: 255 * [l, r, r, n, a, a][p], b: 255 * [a, a, l, r, r, n][p], a: s };
621
+ var i = Math.floor(t), a = r * (1 - o), n = r * (1 - (t - i) * o), l = r * (1 - (1 - t + i) * o), u = i % 6;
622
+ return { r: 255 * [r, n, a, a, l, r][u], g: 255 * [l, r, r, n, a, a][u], b: 255 * [a, a, l, r, r, n][u], a: s };
623
623
  }, Zt = function(e) {
624
624
  return { h: ue(e.h), s: S(e.s, 0, 100), l: S(e.l, 0, 100), a: S(e.a) };
625
625
  }, Gt = function(e) {
@@ -744,7 +744,7 @@ function ro(e) {
744
744
  }
745
745
  };
746
746
  }
747
- const b = ro("Pollcatch");
747
+ const m = ro("Pollcatch");
748
748
  var me = /* @__PURE__ */ ((e) => (e[e.AA_NORMAL = 4.5] = "AA_NORMAL", e[e.AA_LARGE = 3] = "AA_LARGE", e[e.AAA_NORMAL = 7] = "AAA_NORMAL", e[e.AAA_LARGE = 4.5] = "AAA_LARGE", e))(me || {});
749
749
  const so = {
750
750
  black: "#000000",
@@ -777,7 +777,7 @@ function te(e) {
777
777
  }
778
778
  function ao(e, t = {}) {
779
779
  if (!C(e).isValid())
780
- return b.warn(`Invalid color provided: ${e}`), "black";
780
+ return m.warn(`Invalid color provided: ${e}`), "black";
781
781
  const {
782
782
  minContrast: r = 4.5,
783
783
  colorOptions: s = ["black", "white", "light", "dark"],
@@ -787,21 +787,21 @@ function ao(e, t = {}) {
787
787
  },
788
788
  fallback: a = "white"
789
789
  } = t, n = s.map((c) => c === "black" ? "#000000" : c === "white" ? "#ffffff" : c === "light" ? i.light || "#f8f9fa" : c === "dark" ? i.dark || "#343a40" : c);
790
- let l = a, p = 0;
790
+ let l = a, u = 0;
791
791
  for (const c of n) {
792
- const h = St(e, c);
793
- h >= r && h > p && (p = h, l = c);
792
+ const p = St(e, c);
793
+ p >= r && p > u && (u = p, l = c);
794
794
  }
795
- if (p === 0) {
795
+ if (u === 0) {
796
796
  const c = St(e, a);
797
- l = a, p = c;
798
- for (const h of n) {
799
- if (h === a) continue;
800
- const w = St(e, h);
801
- w > p && (p = w, l = h);
797
+ l = a, u = c;
798
+ for (const p of n) {
799
+ if (p === a) continue;
800
+ const v = St(e, p);
801
+ v > u && (u = v, l = p);
802
802
  }
803
- b.warn(
804
- `No color option met the minimum contrast ratio of ${r}:1 against ${e}. Using ${l} with contrast ratio ${p.toFixed(2)}:1 instead.`
803
+ m.warn(
804
+ `No color option met the minimum contrast ratio of ${r}:1 against ${e}. Using ${l} with contrast ratio ${u.toFixed(2)}:1 instead.`
805
805
  );
806
806
  }
807
807
  return l;
@@ -809,7 +809,7 @@ function ao(e, t = {}) {
809
809
  function no(e) {
810
810
  const o = io(e) || e, r = C(o);
811
811
  if (!r.isValid())
812
- return b.warn(`Invalid color provided: ${e}`), { r: 0, g: 0, b: 0 };
812
+ return m.warn(`Invalid color provided: ${e}`), { r: 0, g: 0, b: 0 };
813
813
  const { r: s, g: i, b: a } = r.toRgb();
814
814
  return { r: s, g: i, b: a };
815
815
  }
@@ -901,17 +901,17 @@ function ho(e) {
901
901
  return /^(#[0-9a-fA-F]{3,8}|rgb\([^)]+\)|rgba\([^)]+\)|hsl\([^)]+\)|hsla\([^)]+\)|[a-zA-Z]+)$/.test(t);
902
902
  }
903
903
  function R(e) {
904
- return ho(e) ? e.replace(/[<>"']/g, "").trim() : (b.warn("Invalid color value:", e), "#000000");
904
+ return ho(e) ? e.replace(/[<>"']/g, "").trim() : (m.warn("Invalid color value:", e), "#000000");
905
905
  }
906
906
  function fo(e) {
907
907
  if (typeof e != "string")
908
- return b.warn("Non-string value passed to sanitizeCSS:", typeof e), "";
908
+ return m.warn("Non-string value passed to sanitizeCSS:", typeof e), "";
909
909
  let t = e;
910
910
  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;
911
911
  }
912
912
  const ee = "https://jpxwfjorwcsrqraorpbj.supabase.co/functions/v1/data", mo = "pc_session_id", bo = 24 * 60 * 60 * 1e3;
913
913
  function oe() {
914
- return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (b.warn("crypto.randomUUID not available, using fallback UUID generator"), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
914
+ return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (m.warn("crypto.randomUUID not available, using fallback UUID generator"), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
915
915
  const t = Math.random() * 16 | 0;
916
916
  return (e === "x" ? t : t & 3 | 8).toString(16);
917
917
  }));
@@ -921,7 +921,7 @@ function Tt() {
921
921
  try {
922
922
  return localStorage.setItem(e, e), localStorage.removeItem(e), !0;
923
923
  } catch {
924
- return b.warn("localStorage not available, session ID will not persist"), !1;
924
+ return m.warn("localStorage not available, session ID will not persist"), !1;
925
925
  }
926
926
  }
927
927
  function be(e) {
@@ -929,7 +929,7 @@ function be(e) {
929
929
  const t = localStorage.getItem(e);
930
930
  return t ? JSON.parse(t) : void 0;
931
931
  } catch (t) {
932
- b.warn(`Failed to get item from localStorage: ${e}`, t);
932
+ m.warn(`Failed to get item from localStorage: ${e}`, t);
933
933
  return;
934
934
  }
935
935
  }
@@ -937,29 +937,29 @@ function ge(e, t) {
937
937
  try {
938
938
  return localStorage.setItem(e, JSON.stringify(t)), !0;
939
939
  } catch (o) {
940
- return b.warn(`Failed to set item in localStorage: ${e}`, o), !1;
940
+ return m.warn(`Failed to set item in localStorage: ${e}`, o), !1;
941
941
  }
942
942
  }
943
943
  async function go() {
944
944
  if (typeof window < "u") {
945
945
  if (window.pcProject !== void 0)
946
- return b.debug("Found project key in global variable"), window.pcProject;
946
+ return m.debug("Found project key in global variable"), window.pcProject;
947
947
  const e = document.querySelectorAll("script[pc-project]");
948
948
  if (e.length > 0) {
949
949
  const t = e[e.length - 1], o = t == null ? void 0 : t.getAttribute("pc-project");
950
950
  if (o)
951
- return b.debug("Found project key in script tag attribute"), o;
951
+ return m.debug("Found project key in script tag attribute"), o;
952
952
  }
953
953
  }
954
- b.warn("No project key found in global variable or script tags");
954
+ m.warn("No project key found in global variable or script tags");
955
955
  }
956
956
  async function re() {
957
957
  const e = mo, t = bo;
958
958
  if (Tt()) {
959
959
  const o = be(e);
960
960
  if (o && o.id && o.timestamp && Date.now() - o.timestamp < t)
961
- return b.debug("Using existing session ID from localStorage"), o.id;
962
- b.debug(
961
+ return m.debug("Using existing session ID from localStorage"), o.id;
962
+ m.debug(
963
963
  o ? "Session ID expired" : "No session ID found",
964
964
  "generating new one"
965
965
  );
@@ -967,10 +967,10 @@ async function re() {
967
967
  return ge(e, {
968
968
  id: r,
969
969
  timestamp: Date.now()
970
- }) ? b.debug("Generated and stored new session ID") : b.warn("Generated session ID but failed to store it"), r;
970
+ }) ? m.debug("Generated and stored new session ID") : m.warn("Generated session ID but failed to store it"), r;
971
971
  } else {
972
972
  const o = oe();
973
- return b.debug("Generated non-persistent session ID"), o;
973
+ return m.debug("Generated non-persistent session ID"), o;
974
974
  }
975
975
  }
976
976
  function lt(e) {
@@ -1003,16 +1003,16 @@ function vo(e) {
1003
1003
  const t = be(e);
1004
1004
  return t ? { ...O(), ...t } : O();
1005
1005
  } catch (t) {
1006
- return b.warn("Failed to load localStats from localStorage", t), O();
1006
+ return m.warn("Failed to load localStats from localStorage", t), O();
1007
1007
  }
1008
1008
  }
1009
1009
  function yo(e, t) {
1010
1010
  if (!Tt())
1011
1011
  return !1;
1012
1012
  try {
1013
- return ge(e, t) ? (b.debug("Saved localStats to localStorage", t), !0) : !1;
1013
+ return ge(e, t) ? (m.debug("Saved localStats to localStorage", t), !0) : !1;
1014
1014
  } catch (o) {
1015
- return b.warn("Failed to save localStats to localStorage", o), !1;
1015
+ return m.warn("Failed to save localStats to localStorage", o), !1;
1016
1016
  }
1017
1017
  }
1018
1018
  function wo(e, t) {
@@ -1127,44 +1127,52 @@ class Ao {
1127
1127
  this.isLoading = !1, this.stats = this.localStats, this.host.requestUpdate();
1128
1128
  try {
1129
1129
  const o = await this.getProjectId(), r = t.name, s = t.type;
1130
- if (!r)
1131
- throw new Error("Name parameter is required");
1132
1130
  let i;
1133
1131
  if (t.dataFunc && typeof window < "u") {
1134
- const w = t.dataFunc.replace(/^window\./, "").split(".");
1135
- let v = window;
1136
- for (const E of w)
1137
- if (v = v == null ? void 0 : v[E], v === void 0) break;
1138
- i = v;
1132
+ const v = t.dataFunc.replace(/^window\./, "").split(".");
1133
+ let y = window;
1134
+ for (const E of v)
1135
+ if (y = y == null ? void 0 : y[E], y === void 0) break;
1136
+ i = y;
1139
1137
  }
1140
- let a;
1141
- if (i && typeof i == "function")
1142
- b.debug(`Using data function for: ${r}`, {
1138
+ let a, n;
1139
+ if (i && typeof i == "function") {
1140
+ const p = t.options.map((v) => v.value);
1141
+ if (m.debug(`Using data function for: ${r}`, {
1143
1142
  dataFuncName: t.dataFunc,
1144
- projectKey: o
1145
- }), a = await i(o, r);
1146
- else {
1147
- const h = t.dataEndpoint || ee, w = `${h}/${encodeURIComponent(o)}/${encodeURIComponent(r)}`;
1148
- b.debug(`Fetching stats for: ${r}`, { endpoint: h, projectKey: o });
1149
- const v = await fetch(w);
1150
- if (!v.ok)
1151
- throw new Error(`API request failed with status: ${v.status}`);
1152
- a = await v.json();
1143
+ projectKey: o,
1144
+ options: p
1145
+ }), a = await i(o, r, p), a && typeof a == "object" && "success" in a && "data" in a) {
1146
+ if (!a.success)
1147
+ throw m.error("Custom data function returned unsuccessful response", a), new Error("Custom data function returned unsuccessful response");
1148
+ n = a.data || {};
1149
+ } else
1150
+ n = a || {};
1151
+ } else {
1152
+ const p = t.dataEndpoint || ee;
1153
+ if (!r)
1154
+ throw new Error("Name parameter is required");
1155
+ const v = `${p}/${encodeURIComponent(o)}/${encodeURIComponent(r)}`;
1156
+ m.debug(`Fetching stats for: ${r}`, { endpoint: p, projectKey: o });
1157
+ const y = await fetch(v);
1158
+ if (!y.ok)
1159
+ throw new Error(`API request failed with status: ${y.status}`);
1160
+ if (a = await y.json(), !a.success)
1161
+ throw m.error("Backend returned unsuccessful response", a), new Error("Backend returned unsuccessful response");
1162
+ n = a.data || {};
1153
1163
  }
1154
- if (!a.success)
1155
- throw b.error("Backend returned unsuccessful response", a), new Error("Backend returned unsuccessful response");
1156
- const n = a.data || {}, l = n.count > 0 ? Math.round(n.sum / n.count) : 0, p = Math.round(n.sum / n.count * 100), c = {
1164
+ const l = n.count > 0 ? Math.round(n.sum / n.count) : 0, u = Math.round(n.sum / n.count * 100), c = {
1157
1165
  count: n.count ?? 0,
1158
1166
  sum: n.sum,
1159
1167
  avg: l,
1160
- pct: p,
1168
+ pct: u,
1161
1169
  nps: s === x.nps ? lt((n == null ? void 0 : n.breakdown) || {}) : 0,
1162
1170
  breakdown: n.breakdown ?? {},
1163
1171
  updated: n.updated_at || (/* @__PURE__ */ new Date()).toISOString()
1164
1172
  };
1165
1173
  this.stats = c;
1166
1174
  } catch (o) {
1167
- throw b.error("Error loading stats:", o, this.localStats), o;
1175
+ throw m.error("Error loading stats:", o, this.localStats), o;
1168
1176
  } finally {
1169
1177
  this.isLoading = !1, this.host.requestUpdate();
1170
1178
  }
@@ -1176,9 +1184,9 @@ class Ao {
1176
1184
  const t = await this.getLocalStatsKey();
1177
1185
  try {
1178
1186
  const o = vo(t);
1179
- b.debug("Loaded localStats from localStorage", o), this.localStats = o;
1187
+ m.debug("Loaded localStats from localStorage", o), this.localStats = o;
1180
1188
  } catch (o) {
1181
- b.warn("Failed to generate localStorage key for localStats", o), this.localStats = O();
1189
+ m.warn("Failed to generate localStorage key for localStats", o), this.localStats = O();
1182
1190
  }
1183
1191
  this.host.requestUpdate();
1184
1192
  }
@@ -1188,9 +1196,9 @@ class Ao {
1188
1196
  async persistLocalStats() {
1189
1197
  try {
1190
1198
  const t = await this.getLocalStatsKey();
1191
- yo(t, this.localStats) || b.warn("Failed to save localStats to localStorage");
1199
+ yo(t, this.localStats) || m.warn("Failed to save localStats to localStorage");
1192
1200
  } catch (t) {
1193
- b.warn("Failed to save localStats to localStorage", t);
1201
+ m.warn("Failed to save localStats to localStorage", t);
1194
1202
  }
1195
1203
  }
1196
1204
  /**
@@ -1218,14 +1226,14 @@ class Ao {
1218
1226
  }, o && o.length > 0)
1219
1227
  for (const s of o)
1220
1228
  s && (this.localStats.breakdown[s] = 1);
1221
- this.stats = $o(this.stats, this.localStats), b.debug("Stats updated - remote: ", this.stats), b.debug("Stats updated - local: ", this.stats), this.persistLocalStats(), this.host.requestUpdate();
1229
+ this.stats = $o(this.stats, this.localStats), m.debug("Stats updated - remote: ", this.stats), m.debug("Stats updated - local: ", this.stats), this.persistLocalStats(), this.host.requestUpdate();
1222
1230
  }
1223
1231
  async markStatsAsSubmitted() {
1224
1232
  this.localStats.submitted = (/* @__PURE__ */ new Date()).toISOString(), await this.persistLocalStats(), this.host.requestUpdate();
1225
1233
  }
1226
1234
  async submitStats() {
1227
1235
  if (!this.hasLocalStats())
1228
- throw b.warn("No local stats to submit"), new Error("No local stats to submit");
1236
+ throw m.warn("No local stats to submit"), new Error("No local stats to submit");
1229
1237
  const t = this.host, o = Math.floor(Date.now() / 1e3).toString(), r = await re(), s = await this.getProjectId(), i = t.name || "", a = this.localStats.sum, n = Object.keys(this.localStats.breakdown || {});
1230
1238
  this.isSubmitting = !0, this.host.requestUpdate();
1231
1239
  const l = {
@@ -1238,11 +1246,11 @@ class Ao {
1238
1246
  textValues: n,
1239
1247
  metadata: t.metadata,
1240
1248
  timestamp: o
1241
- }, p = Co(JSON.stringify(l), o);
1249
+ }, u = Co(JSON.stringify(l), o);
1242
1250
  try {
1243
- await this.sendStats({ ...l, hash: p }), await this.markStatsAsSubmitted(), this.dispatchSubmitEvent(l);
1251
+ await this.sendStats({ ...l, hash: u }), await this.markStatsAsSubmitted(), this.dispatchSubmitEvent(l);
1244
1252
  } catch (c) {
1245
- b.warn("Failed to send stats event", c);
1253
+ m.warn("Failed to send stats event", c);
1246
1254
  } finally {
1247
1255
  this.isSubmitting = !1, this.host.requestUpdate();
1248
1256
  }
@@ -1251,18 +1259,18 @@ class Ao {
1251
1259
  async sendStats(t) {
1252
1260
  const o = JSON.stringify(t), r = this.host, s = r.dataEndpoint || ee;
1253
1261
  if (r.dataFunc) {
1254
- b.debug("Skip sending stats as data function is in use.");
1262
+ m.debug("Skip sending stats as data function is in use.");
1255
1263
  return;
1256
1264
  }
1257
1265
  if (!dt(s))
1258
- throw b.error("Invalid data endpoint", { dataEndpoint: s }), new Error(`Invalid data endpoint: ${s}`);
1266
+ throw m.error("Invalid data endpoint", { dataEndpoint: s }), new Error(`Invalid data endpoint: ${s}`);
1259
1267
  try {
1260
- if (b.debug("Sending stats", { endpoint: s, event: t }), typeof navigator < "u" && navigator.sendBeacon)
1268
+ if (m.debug("Sending stats", { endpoint: s, event: t }), typeof navigator < "u" && navigator.sendBeacon)
1261
1269
  if (navigator.sendBeacon(s, o)) {
1262
- b.debug("Successfully sent stats via sendBeacon");
1270
+ m.debug("Successfully sent stats via sendBeacon");
1263
1271
  return;
1264
1272
  } else
1265
- b.debug("sendBeacon failed, falling back to fetch");
1273
+ m.debug("sendBeacon failed, falling back to fetch");
1266
1274
  const i = await fetch(s, {
1267
1275
  body: o,
1268
1276
  method: "POST",
@@ -1273,9 +1281,9 @@ class Ao {
1273
1281
  });
1274
1282
  if (!i.ok)
1275
1283
  throw new Error(`API request failed with status: ${i.status}`);
1276
- b.debug("Successfully sent stats via fetch");
1284
+ m.debug("Successfully sent stats via fetch");
1277
1285
  } catch (i) {
1278
- throw b.error("Failed to send analytics:", i), i;
1286
+ throw m.error("Failed to send analytics:", i), i;
1279
1287
  }
1280
1288
  }
1281
1289
  /**
@@ -1292,7 +1300,7 @@ class Ao {
1292
1300
  pct: (o == null ? void 0 : o.pct) || 0,
1293
1301
  nps: r.type === x.nps ? lt((o == null ? void 0 : o.breakdown) || {}) : 0
1294
1302
  };
1295
- return b.debug("Stats data: ", this.stats), So(t, s);
1303
+ return m.debug("Stats data: ", this.stats), So(t, s);
1296
1304
  }
1297
1305
  /**
1298
1306
  * Checks if a value is selected in the local stats
@@ -1320,7 +1328,7 @@ class Ao {
1320
1328
  let a = 1;
1321
1329
  if ((i.type === x.stars || i.type === x.nps) && (a = parseInt(t)), s)
1322
1330
  if (o) {
1323
- const l = r.filter((p) => p !== t);
1331
+ const l = r.filter((u) => u !== t);
1324
1332
  this.updateStats(l.length > 0 ? 1 : 0, l);
1325
1333
  } else
1326
1334
  this.updateStats(0, []);
@@ -1352,7 +1360,7 @@ class Ao {
1352
1360
  bubbles: !0,
1353
1361
  composed: !0
1354
1362
  });
1355
- t.dispatchEvent(i), b.debug("Dispatched change event", s);
1363
+ t.dispatchEvent(i), m.debug("Dispatched change event", s);
1356
1364
  }
1357
1365
  /**
1358
1366
  * Dispatches a 'submit' CustomEvent on the host element
@@ -1364,7 +1372,7 @@ class Ao {
1364
1372
  bubbles: !0,
1365
1373
  composed: !0
1366
1374
  });
1367
- o.dispatchEvent(r), b.debug("Dispatched submit event", t);
1375
+ o.dispatchEvent(r), m.debug("Dispatched submit event", t);
1368
1376
  }
1369
1377
  hasLocalStats() {
1370
1378
  var t;
@@ -1516,7 +1524,7 @@ let xe = class {
1516
1524
  * Copyright 2018 Google LLC
1517
1525
  * SPDX-License-Identifier: BSD-3-Clause
1518
1526
  */
1519
- const y = $e(class extends xe {
1527
+ const w = $e(class extends xe {
1520
1528
  constructor(e) {
1521
1529
  var t;
1522
1530
  if (super(e), e.type !== we.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.");
@@ -1662,13 +1670,13 @@ const st = {
1662
1670
  }
1663
1671
  /** Common render methods */
1664
1672
  renderLabel() {
1665
- return this.question ? d`<label class="pc-label" data-testid="pc-label">${this.question}</label>` : u;
1673
+ return this.question ? d`<label class="pc-label" data-testid="pc-label">${this.question}</label>` : h;
1666
1674
  }
1667
1675
  renderLabelAtStart() {
1668
- return this.questionPosition === "left" || this.questionPosition === "top" ? this.renderLabel() : u;
1676
+ return this.questionPosition === "left" || this.questionPosition === "top" ? this.renderLabel() : h;
1669
1677
  }
1670
1678
  renderLabelAtEnd() {
1671
- return this.questionPosition === "right" || this.questionPosition === "bottom" ? this.renderLabel() : u;
1679
+ return this.questionPosition === "right" || this.questionPosition === "bottom" ? this.renderLabel() : h;
1672
1680
  }
1673
1681
  /**
1674
1682
  * Handle edit button click - switch to edit mode
@@ -1691,10 +1699,10 @@ const st = {
1691
1699
  tabindex="0"
1692
1700
  @keydown="${this.handleEditToggleKeyDown}"
1693
1701
  />
1694
- ` : u;
1702
+ ` : h;
1695
1703
  }
1696
1704
  renderStatsText() {
1697
- if (!this.displayController.shouldShowStats()) return u;
1705
+ if (!this.displayController.shouldShowStats()) return h;
1698
1706
  const t = this.dataController.formatStatsText(this.statsText || "");
1699
1707
  return d`<span class="pc-stats-text">${t}</span>`;
1700
1708
  }
@@ -1710,31 +1718,31 @@ const st = {
1710
1718
  tabindex="0"
1711
1719
  @keydown="${() => this.displayController.toggleChartVisibility()}"
1712
1720
  />
1713
- ` : u;
1721
+ ` : h;
1714
1722
  }
1715
1723
  renderStatus() {
1716
1724
  if (!this.displayController.shouldShowStats() && !this.displayController.shouldShowChartToggle() && !this.displayController.shouldShowEditButton())
1717
- return u;
1725
+ return h;
1718
1726
  const o = {
1719
1727
  "pc-status": !0,
1720
1728
  [`pc-flex-content-${k(this.statsPosition, this.statsAlign)}`]: !0
1721
1729
  };
1722
- return d`<div class="${y(o)}" data-testid="pc-status">
1730
+ return d`<div class="${w(o)}" data-testid="pc-status">
1723
1731
  ${this.renderStatsText()} ${this.renderChartToggle()} ${this.renderEditToggleIcon()}
1724
1732
  </div>`;
1725
1733
  }
1726
1734
  renderStatusAtStart() {
1727
- return this.statsPosition === "left" || this.statsPosition === "top" ? this.renderStatus() : u;
1735
+ return this.statsPosition === "left" || this.statsPosition === "top" ? this.renderStatus() : h;
1728
1736
  }
1729
1737
  renderStatusAtEnd() {
1730
- return this.statsPosition === "right" || this.statsPosition === "bottom" ? this.renderStatus() : u;
1738
+ return this.statsPosition === "right" || this.statsPosition === "bottom" ? this.renderStatus() : h;
1731
1739
  }
1732
1740
  /**
1733
1741
  * Renders the thank you message with edit button (new overlay style)
1734
1742
  */
1735
1743
  renderThankYouMessage() {
1736
1744
  if (!this.displayController.shouldDisplayThankYouMsg())
1737
- return u;
1745
+ return h;
1738
1746
  const t = ko(this.thankYouMsg || "");
1739
1747
  return d`
1740
1748
  <div class="pc-thank-you-overlay" data-testid="poll-thank-you-overlay">
@@ -1845,106 +1853,106 @@ Mt.styles = [
1845
1853
  }
1846
1854
  `
1847
1855
  ];
1848
- let m = Mt;
1856
+ let b = Mt;
1849
1857
  g([
1850
1858
  f({ type: String, attribute: "show-stats" })
1851
- ], m.prototype, "showStats");
1859
+ ], b.prototype, "showStats");
1852
1860
  g([
1853
1861
  f({ type: Boolean, attribute: "show-chart" })
1854
- ], m.prototype, "showChart");
1862
+ ], b.prototype, "showChart");
1855
1863
  g([
1856
1864
  f({ type: Boolean, attribute: "initialized" })
1857
- ], m.prototype, "initialized");
1865
+ ], b.prototype, "initialized");
1858
1866
  g([
1859
1867
  f({ type: Boolean, attribute: "lock-answer" })
1860
- ], m.prototype, "lockAnswer");
1868
+ ], b.prototype, "lockAnswer");
1861
1869
  g([
1862
1870
  f({ type: String, attribute: "primary-color" })
1863
- ], m.prototype, "primaryColor");
1871
+ ], b.prototype, "primaryColor");
1864
1872
  g([
1865
1873
  f({ type: String, attribute: "mute-color" })
1866
- ], m.prototype, "muteColor");
1874
+ ], b.prototype, "muteColor");
1867
1875
  g([
1868
1876
  f({ type: String, attribute: "text-color" })
1869
- ], m.prototype, "textColor");
1877
+ ], b.prototype, "textColor");
1870
1878
  g([
1871
1879
  f({ type: String, attribute: "background-color" })
1872
- ], m.prototype, "backgroundColor");
1880
+ ], b.prototype, "backgroundColor");
1873
1881
  g([
1874
1882
  f({ type: String, attribute: "accent-color" })
1875
- ], m.prototype, "accentColor");
1883
+ ], b.prototype, "accentColor");
1876
1884
  g([
1877
1885
  f({ type: String, attribute: "star-color" })
1878
- ], m.prototype, "starColor");
1886
+ ], b.prototype, "starColor");
1879
1887
  g([
1880
1888
  f({ type: String, attribute: "star-hover-color" })
1881
- ], m.prototype, "starHoverColor");
1889
+ ], b.prototype, "starHoverColor");
1882
1890
  g([
1883
1891
  f({ type: String })
1884
- ], m.prototype, "size");
1892
+ ], b.prototype, "size");
1885
1893
  g([
1886
1894
  f({ type: String, attribute: "aria-label" })
1887
- ], m.prototype, "ariaLabel");
1895
+ ], b.prototype, "ariaLabel");
1888
1896
  g([
1889
1897
  f({ type: String, attribute: "aria-describedby" })
1890
- ], m.prototype, "ariaDescribedby");
1898
+ ], b.prototype, "ariaDescribedby");
1891
1899
  g([
1892
1900
  f({ type: Number, attribute: "min-contrast" })
1893
- ], m.prototype, "minContrast");
1901
+ ], b.prototype, "minContrast");
1894
1902
  g([
1895
1903
  f({ type: String })
1896
- ], m.prototype, "css");
1904
+ ], b.prototype, "css");
1897
1905
  g([
1898
1906
  f({ type: Array })
1899
- ], m.prototype, "options");
1907
+ ], b.prototype, "options");
1900
1908
  g([
1901
1909
  f({ type: String })
1902
- ], m.prototype, "project");
1910
+ ], b.prototype, "project");
1903
1911
  g([
1904
1912
  f({ type: String, attribute: "name" })
1905
- ], m.prototype, "name");
1913
+ ], b.prototype, "name");
1906
1914
  g([
1907
1915
  f({ type: String })
1908
- ], m.prototype, "metadata");
1916
+ ], b.prototype, "metadata");
1909
1917
  g([
1910
1918
  f({ type: String, attribute: "data-func" })
1911
- ], m.prototype, "dataFunc");
1919
+ ], b.prototype, "dataFunc");
1912
1920
  g([
1913
1921
  f({ type: String, attribute: "data-endpoint" })
1914
- ], m.prototype, "dataEndpoint");
1922
+ ], b.prototype, "dataEndpoint");
1915
1923
  g([
1916
1924
  f({ type: String })
1917
- ], m.prototype, "question");
1925
+ ], b.prototype, "question");
1918
1926
  g([
1919
1927
  f({ type: String, attribute: "question-position" })
1920
- ], m.prototype, "questionPosition");
1928
+ ], b.prototype, "questionPosition");
1921
1929
  g([
1922
1930
  f({ type: String, attribute: "question-align" })
1923
- ], m.prototype, "questionAlign");
1931
+ ], b.prototype, "questionAlign");
1924
1932
  g([
1925
1933
  f({ type: String, attribute: "stats-text" })
1926
- ], m.prototype, "statsText");
1934
+ ], b.prototype, "statsText");
1927
1935
  g([
1928
1936
  f({ type: String, attribute: "stats-position" })
1929
- ], m.prototype, "statsPosition");
1937
+ ], b.prototype, "statsPosition");
1930
1938
  g([
1931
1939
  f({ type: String, attribute: "stats-align" })
1932
- ], m.prototype, "statsAlign");
1940
+ ], b.prototype, "statsAlign");
1933
1941
  g([
1934
1942
  f({ type: String, attribute: "button-text" })
1935
- ], m.prototype, "buttonText");
1943
+ ], b.prototype, "buttonText");
1936
1944
  g([
1937
1945
  f({ type: String, attribute: "button-radius" })
1938
- ], m.prototype, "buttonRadius");
1946
+ ], b.prototype, "buttonRadius");
1939
1947
  g([
1940
1948
  f({ type: String, attribute: "thank-you-msg" })
1941
- ], m.prototype, "thankYouMsg");
1949
+ ], b.prototype, "thankYouMsg");
1942
1950
  g([
1943
1951
  f({ type: Boolean, attribute: "multiple" })
1944
- ], m.prototype, "multiple");
1952
+ ], b.prototype, "multiple");
1945
1953
  g([
1946
1954
  f({ type: Boolean, attribute: "read-only" })
1947
- ], m.prototype, "readOnly");
1955
+ ], b.prototype, "readOnly");
1948
1956
  const To = F`
1949
1957
  /* CSS variables inherit from parent - defaults are specified at usage sites */
1950
1958
 
@@ -2586,10 +2594,10 @@ function It(e, t = {}) {
2586
2594
  const n = `
2587
2595
  width: ${o > 0 ? i.value / o * s.maxWidth : 0}%;
2588
2596
  background-color: ${s.barColor};
2589
- `, l = s.labelFormatter(i), p = i.label ? d`<span class="pc-bar-label-text">${l}</span>` : u, c = !i.label && i.icon ? d`<span class="pc-bar-label-icon">${i.icon}</span>` : u;
2597
+ `, l = s.labelFormatter(i), u = i.label ? d`<span class="pc-bar-label-text">${l}</span>` : h, c = !i.label && i.icon ? d`<span class="pc-bar-label-icon">${i.icon}</span>` : h;
2590
2598
  return d`
2591
2599
  <div class="pc-bar-row">
2592
- <div class="pc-bar-label">${p} ${c}</div>
2600
+ <div class="pc-bar-label">${u} ${c}</div>
2593
2601
  <div class="pc-bar-container">
2594
2602
  <div class="pc-bar" style="${n}"></div>
2595
2603
  <div class="pc-bar-value">${s.valueFormatter(i)}</div>
@@ -2605,7 +2613,7 @@ var zo = Object.defineProperty, Io = Object.getOwnPropertyDescriptor, Y = (e, t,
2605
2613
  (a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
2606
2614
  return r && s && zo(t, o, s), s;
2607
2615
  };
2608
- let I = class extends m {
2616
+ let I = class extends b {
2609
2617
  constructor() {
2610
2618
  super(), this.min = 0, this.max = 10, this.type = x.nps, this.minLabel = "Not at all", this.maxLabel = "Extremely", this.minMaxPosition = "top", this.hoverValue = -1, this.handleNumberLeave = () => {
2611
2619
  this.hoverValue = -1;
@@ -2630,7 +2638,7 @@ let I = class extends m {
2630
2638
  <button
2631
2639
  data-testid="nps-button-${s}"
2632
2640
  ?disabled=${!this.displayController.allowEdit()}
2633
- class=${y(a)}
2641
+ class=${w(a)}
2634
2642
  @click="${() => this.handleNumberClick(s)}"
2635
2643
  @mouseenter="${() => this.handleNumberHover(s)}"
2636
2644
  @focus="${() => this.handleNumberHover(s)}"
@@ -2647,7 +2655,7 @@ let I = class extends m {
2647
2655
  });
2648
2656
  return d`
2649
2657
  <div class="nps-container" data-testid="nps-edit-container">
2650
- ${this.minMaxPosition === "top" ? this.renderMinMaxLabels() : u}
2658
+ ${this.minMaxPosition === "top" ? this.renderMinMaxLabels() : h}
2651
2659
  <div
2652
2660
  class="nps-buttons-container"
2653
2661
  id="${t}"
@@ -2656,7 +2664,7 @@ let I = class extends m {
2656
2664
  >
2657
2665
  ${r}
2658
2666
  </div>
2659
- ${this.minMaxPosition === "bottom" ? this.renderMinMaxLabels() : u}
2667
+ ${this.minMaxPosition === "bottom" ? this.renderMinMaxLabels() : h}
2660
2668
  <div id="${t}-description" class="sr-only" data-testid="nps-description">
2661
2669
  Rate from ${this.min} (${this.minLabel}) to ${this.max} (${this.maxLabel})
2662
2670
  </div>
@@ -2668,7 +2676,7 @@ let I = class extends m {
2668
2676
  */
2669
2677
  renderChart() {
2670
2678
  var a;
2671
- if (!this.displayController.shouldShowChart()) return u;
2679
+ if (!this.displayController.shouldShowChart()) return h;
2672
2680
  const e = ((a = this.dataController.stats) == null ? void 0 : a.breakdown) || {}, t = Object.values(e).reduce((n, l) => n + l, 0), o = Object.entries(e).map(([n, l]) => ({
2673
2681
  label: n,
2674
2682
  value: l
@@ -2723,9 +2731,9 @@ let I = class extends m {
2723
2731
  [`pc-flex-align-${k(this.statsPosition, this.statsAlign)}`]: !0
2724
2732
  };
2725
2733
  return d`
2726
- <div class="pc-container ${y(e)}" data-testid="nps-container">
2734
+ <div class="pc-container ${w(e)}" data-testid="nps-container">
2727
2735
  ${this.renderLabelAtStart()}
2728
- <div class="pc-body ${y(t)}" data-testid="nps-body">
2736
+ <div class="pc-body ${w(t)}" data-testid="nps-body">
2729
2737
  ${this.renderStatusAtStart()} ${this.renderContent()} ${this.renderStatusAtEnd()}
2730
2738
  </div>
2731
2739
  ${this.renderLabelAtEnd()}
@@ -2733,7 +2741,7 @@ let I = class extends m {
2733
2741
  `;
2734
2742
  }
2735
2743
  };
2736
- I.styles = [...m.styles, pt, To];
2744
+ I.styles = [...b.styles, pt, To];
2737
2745
  Y([
2738
2746
  f({ type: String, attribute: "min-label" })
2739
2747
  ], I.prototype, "minLabel", 2);
@@ -3014,7 +3022,7 @@ var Mo = Object.defineProperty, Lo = Object.getOwnPropertyDescriptor, Nt = (e, t
3014
3022
  (a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
3015
3023
  return r && s && Mo(t, o, s), s;
3016
3024
  };
3017
- let tt = class extends m {
3025
+ let tt = class extends b {
3018
3026
  constructor() {
3019
3027
  super(), this.type = x.poll, this.multiple = !1, this.compact = !1, this.hasEditButton = !0, this.statsText = "{count} votes", this.questionPosition = "top", this.statsPosition = "bottom", this.showStats = "after-vote";
3020
3028
  }
@@ -3023,7 +3031,7 @@ let tt = class extends m {
3023
3031
  "pc-status": !0,
3024
3032
  [`pc-flex-content-${k("bottom", this.statsAlign)}`]: !0
3025
3033
  };
3026
- return d`<div class="${y(t)}" data-testid="pc-status">
3034
+ return d`<div class="${w(t)}" data-testid="pc-status">
3027
3035
  <span>${this.renderStatsText()} ${this.renderEditToggleIcon("stats-edit-button")}</span>
3028
3036
  </div>`;
3029
3037
  }
@@ -3031,14 +3039,14 @@ let tt = class extends m {
3031
3039
  * Render submit button for any selection type
3032
3040
  */
3033
3041
  renderSubmitButton() {
3034
- if (!this.displayController.isEditing) return u;
3042
+ if (!this.displayController.isEditing) return h;
3035
3043
  const e = {
3036
3044
  "pc-submit-button": !0,
3037
3045
  "pc-submit-button--compact": this.compact
3038
3046
  }, t = this.displayController.shouldDisableSubmitButton();
3039
3047
  return d`
3040
3048
  <button
3041
- class="${y(e)}"
3049
+ class="${w(e)}"
3042
3050
  data-testid="pc-submit-button"
3043
3051
  @click="${this.handleSubmit}"
3044
3052
  ?disabled="${t}"
@@ -3053,7 +3061,7 @@ let tt = class extends m {
3053
3061
  <div class="pc-footer" data-testid="pc-footer">
3054
3062
  ${this.renderStatus()} ${this.renderSubmitButton()}
3055
3063
  </div>
3056
- ` : u;
3064
+ ` : h;
3057
3065
  }
3058
3066
  /**
3059
3067
  * Handle click on an option with optimistic updates
@@ -3085,7 +3093,7 @@ let tt = class extends m {
3085
3093
  src="${e == null ? void 0 : e.icon}"
3086
3094
  alt="${s.alt}"
3087
3095
  class="poll-option-icon-img"
3088
- aria-label="${s.ariaLabel || u}"
3096
+ aria-label="${s.ariaLabel || h}"
3089
3097
  aria-hidden="${s.ariaHidden ? "true" : "false"}"
3090
3098
  />` : d`<span
3091
3099
  class="poll-option-icon"
@@ -3119,7 +3127,7 @@ let tt = class extends m {
3119
3127
  return d`
3120
3128
  <button
3121
3129
  data-testid="poll-option-i${t}"
3122
- class="${y(s)}"
3130
+ class="${w(s)}"
3123
3131
  @click="${() => this.handleClick(e)}"
3124
3132
  ?disabled="${r}"
3125
3133
  id="${a}-option-${t}"
@@ -3146,7 +3154,7 @@ let tt = class extends m {
3146
3154
  });
3147
3155
  return d`
3148
3156
  <div
3149
- class="${y({
3157
+ class="${w({
3150
3158
  "poll-container": !0
3151
3159
  })}"
3152
3160
  data-testid="poll-option-container"
@@ -3161,14 +3169,14 @@ let tt = class extends m {
3161
3169
  * Render chart that replaces poll options when showing
3162
3170
  */
3163
3171
  renderBarChart() {
3164
- var l, p;
3165
- const e = ((l = this.dataController.stats) == null ? void 0 : l.breakdown) || {}, t = ((p = this.dataController.localStats) == null ? void 0 : p.breakdown) || {}, o = Object.values(e).reduce((c, h) => c + h, 0), r = this.options.map((c, h) => {
3166
- const w = e[c.value] || 0, v = o > 0 ? Math.round(w / o * 100) : 0, E = (t[c.value] || 0) > 0;
3172
+ var l, u;
3173
+ const e = ((l = this.dataController.stats) == null ? void 0 : l.breakdown) || {}, t = ((u = this.dataController.localStats) == null ? void 0 : u.breakdown) || {}, o = Object.values(e).reduce((c, p) => c + p, 0), r = this.options.map((c, p) => {
3174
+ const v = e[c.value] || 0, y = o > 0 ? Math.round(v / o * 100) : 0, E = (t[c.value] || 0) > 0;
3167
3175
  return {
3168
3176
  option: c,
3169
- index: h,
3170
- voteCount: w,
3171
- percentage: v,
3177
+ index: p,
3178
+ voteCount: v,
3179
+ percentage: y,
3172
3180
  isSelected: E
3173
3181
  };
3174
3182
  }), s = this.multiple ? _.GROUP : _.RADIOGROUP, i = this.question || this.name || "Options", a = B({
@@ -3177,7 +3185,7 @@ let tt = class extends m {
3177
3185
  });
3178
3186
  return d`
3179
3187
  <div
3180
- class="${y({
3188
+ class="${w({
3181
3189
  "poll-container": !0
3182
3190
  })}"
3183
3191
  data-testid="poll-chart-container"
@@ -3185,7 +3193,7 @@ let tt = class extends m {
3185
3193
  ...=${a}
3186
3194
  >
3187
3195
  ${r.map((c) => {
3188
- const h = {
3196
+ const p = {
3189
3197
  "poll-option": !0,
3190
3198
  "poll-option--compact": this.compact,
3191
3199
  "poll-option--chart-view": !0,
@@ -3193,11 +3201,11 @@ let tt = class extends m {
3193
3201
  };
3194
3202
  return d`
3195
3203
  <div
3196
- class="${y(h)}"
3204
+ class="${w(p)}"
3197
3205
  data-testid="poll-chart-item-${c.index}"
3198
3206
  role="listitem"
3199
3207
  aria-label="${c.option.label}: ${c.percentage}% (${c.voteCount} votes)"
3200
- @click="${this.multiple ? () => this.handleClick(c.option) : u}"
3208
+ @click="${this.multiple ? () => this.handleClick(c.option) : h}"
3201
3209
  >
3202
3210
  <div
3203
3211
  class="poll-option-bar"
@@ -3264,12 +3272,12 @@ let tt = class extends m {
3264
3272
  });
3265
3273
  return d`
3266
3274
  <div
3267
- class="pc-container ${y(t)}"
3275
+ class="pc-container ${w(t)}"
3268
3276
  data-testid="poll-container"
3269
3277
  ...=${s}
3270
3278
  >
3271
3279
  ${this.renderLabelAtStart()}
3272
- <div class="${y(r)}" data-testid="poll-body">
3280
+ <div class="${w(r)}" data-testid="poll-body">
3273
3281
  ${this.renderContent()} ${this.renderFooter()}
3274
3282
  </div>
3275
3283
  ${this.renderLabelAtEnd()}
@@ -3277,7 +3285,7 @@ let tt = class extends m {
3277
3285
  `;
3278
3286
  }
3279
3287
  };
3280
- tt.styles = [...m.styles, pt, No];
3288
+ tt.styles = [...b.styles, pt, No];
3281
3289
  Nt([
3282
3290
  f({ type: Boolean })
3283
3291
  ], tt.prototype, "multiple", 2);
@@ -3400,7 +3408,7 @@ var Bo = Object.defineProperty, Do = Object.getOwnPropertyDescriptor, ut = (e, t
3400
3408
  (a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
3401
3409
  return r && s && Bo(t, o, s), s;
3402
3410
  };
3403
- let V = class extends m {
3411
+ let V = class extends b {
3404
3412
  constructor() {
3405
3413
  super(), this.type = x.stars, this.numStars = 5, this.hoverValue = -1, this.handleStarKeyDown = (e) => {
3406
3414
  if (e.key === "Enter" || e.key === " ") {
@@ -3424,20 +3432,20 @@ let V = class extends m {
3424
3432
  */
3425
3433
  renderStars() {
3426
3434
  var i, a;
3427
- if (this.displayController.shouldShowChart()) return u;
3435
+ if (this.displayController.shouldShowChart()) return h;
3428
3436
  const e = ((i = this.dataController.stats) == null ? void 0 : i.avg) || 0, t = ((a = this.dataController.localStats) == null ? void 0 : a.avg) || 0, o = this.readOnly ? e : t, r = this.displayController.allowEdit(), s = Array.from({ length: this.numStars }, (n, l) => l + 1).map((n) => {
3429
- const l = n <= Math.floor(o) || n <= (this.hoverValue || 0), p = !l && n === Math.ceil(o) && o % 1 !== 0, c = {
3437
+ const l = n <= Math.floor(o) || n <= (this.hoverValue || 0), u = !l && n === Math.ceil(o) && o % 1 !== 0, c = {
3430
3438
  star: !0,
3431
3439
  selected: l,
3432
- partial: p,
3440
+ partial: u,
3433
3441
  "view-mode": !r
3434
- }, h = p ? { "--partial-fill": `${o % 1 * 100}%` } : {};
3442
+ }, p = u ? { "--partial-fill": `${o % 1 * 100}%` } : {};
3435
3443
  return d`
3436
3444
  <div class="pc-section" data-testid="pc-section">
3437
3445
  <span
3438
3446
  data-testid="stars-view-star-${n}"
3439
- class=${y(c)}
3440
- style=${jo(h)}
3447
+ class=${w(c)}
3448
+ style=${jo(p)}
3441
3449
  role="${r ? "button" : "presentation"}"
3442
3450
  tabindex="${r ? "0" : ""}"
3443
3451
  aria-label="${r ? `Rate ${n} star${n > 1 ? "s" : ""}` : ""}"
@@ -3460,7 +3468,7 @@ let V = class extends m {
3460
3468
  */
3461
3469
  renderChart() {
3462
3470
  var a;
3463
- if (!this.displayController.shouldShowChart()) return u;
3471
+ if (!this.displayController.shouldShowChart()) return h;
3464
3472
  const e = ((a = this.dataController.stats) == null ? void 0 : a.breakdown) || {}, t = Object.values(e).reduce((n, l) => n + l, 0), o = Object.entries(e).map(([n, l]) => ({
3465
3473
  label: n,
3466
3474
  value: l,
@@ -3486,9 +3494,9 @@ let V = class extends m {
3486
3494
  [`pc-flex-align-${o}`]: !0
3487
3495
  };
3488
3496
  return d`
3489
- <div class="pc-container ${y(t)}" data-testid="pc-container">
3497
+ <div class="pc-container ${w(t)}" data-testid="pc-container">
3490
3498
  ${this.renderLabelAtStart()}
3491
- <div class="${y(r)}" data-testid="stars-body">
3499
+ <div class="${w(r)}" data-testid="stars-body">
3492
3500
  ${this.renderStatusAtStart()} ${this.renderChart()} ${this.renderStars()}
3493
3501
  ${this.renderStatusAtEnd()}
3494
3502
  </div>
@@ -3497,7 +3505,7 @@ let V = class extends m {
3497
3505
  `;
3498
3506
  }
3499
3507
  };
3500
- V.styles = [...m.styles, pt, Ro];
3508
+ V.styles = [...b.styles, pt, Ro];
3501
3509
  ut([
3502
3510
  f({ type: String })
3503
3511
  ], V.prototype, "icon", 2);
@@ -3859,7 +3867,7 @@ var Ho = Object.defineProperty, Fo = Object.getOwnPropertyDescriptor, ht = (e, t
3859
3867
  (a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
3860
3868
  return r && s && Ho(t, o, s), s;
3861
3869
  };
3862
- let q = class extends m {
3870
+ let q = class extends b {
3863
3871
  constructor() {
3864
3872
  super(), this.type = x.reaction, this.showCounts = !1, this.compact = !1, this.popupPosition = "auto", this.hasEditButton = !1, this.statsText = "{count} votes", this.buttonRadius = "990px", this.muteColor = "#cccccc", this.questionPosition = "top", this.statsPosition = "right", this.popupPosition = "auto";
3865
3873
  }
@@ -3894,7 +3902,7 @@ let q = class extends m {
3894
3902
  class="icon-img"
3895
3903
  src="${o}"
3896
3904
  alt="${a.alt}"
3897
- aria-label="${a.ariaLabel || u}"
3905
+ aria-label="${a.ariaLabel || h}"
3898
3906
  aria-hidden="${a.ariaHidden}"
3899
3907
  />` : d`<span class="icon" aria-hidden="${a.ariaHidden}"
3900
3908
  >${o}</span
@@ -3911,7 +3919,7 @@ let q = class extends m {
3911
3919
  }, n = `${e.tooltip || e.value} reaction${o ? ", selected" : ""}${t ? `, ${r} votes` : ""}`;
3912
3920
  return d`
3913
3921
  <button
3914
- class="${y(a)}"
3922
+ class="${w(a)}"
3915
3923
  @click="${() => this.handleReactionClick(e)}"
3916
3924
  ?disabled="${s}"
3917
3925
  aria-pressed="${o}"
@@ -3919,8 +3927,8 @@ let q = class extends m {
3919
3927
  title="${e.tooltip || ""}"
3920
3928
  data-testid="reaction-button-${i}"
3921
3929
  >
3922
- ${e.icon ? this.renderReactionIcon(e.icon, e) : u}
3923
- ${t ? d`<span class="count-label">${r}</span>` : u}
3930
+ ${e.icon ? this.renderReactionIcon(e.icon, e) : h}
3931
+ ${t ? d`<span class="count-label">${r}</span>` : h}
3924
3932
  </button>
3925
3933
  `;
3926
3934
  }
@@ -3946,14 +3954,14 @@ let q = class extends m {
3946
3954
  * Render the popover for compact mode
3947
3955
  */
3948
3956
  renderPopover() {
3949
- if (!this.displayController.shouldShowReactionPopover() || !this.compact) return u;
3957
+ if (!this.displayController.shouldShowReactionPopover() || !this.compact) return h;
3950
3958
  const e = {
3951
3959
  popover: !0,
3952
3960
  top: this.popupPosition === "top" || this.popupPosition === "auto" && this.shouldShowPopoverOnTop(),
3953
3961
  bottom: this.popupPosition === "bottom" || this.popupPosition === "auto" && !this.shouldShowPopoverOnTop()
3954
3962
  };
3955
3963
  return d`
3956
- <div class="${y(e)}" role="menu">
3964
+ <div class="${w(e)}" role="menu">
3957
3965
  <div class="popover-content">
3958
3966
  ${this.options.map((t) => {
3959
3967
  const o = this.displayController.shouldDisableOption(t);
@@ -3966,7 +3974,7 @@ let q = class extends m {
3966
3974
  aria-label="${t.tooltip || t.value} reaction"
3967
3975
  title="${t.tooltip || ""}"
3968
3976
  >
3969
- ${t.icon ? this.renderReactionIcon(t.icon, t) : u}
3977
+ ${t.icon ? this.renderReactionIcon(t.icon, t) : h}
3970
3978
  </button>
3971
3979
  `;
3972
3980
  })}
@@ -3989,7 +3997,7 @@ let q = class extends m {
3989
3997
  * Render reactions based on mode
3990
3998
  */
3991
3999
  renderReactions() {
3992
- if (this.displayController.shouldShowChart() || this.options.length === 0) return u;
4000
+ if (this.displayController.shouldShowChart() || this.options.length === 0) return h;
3993
4001
  const e = {
3994
4002
  reaction: !0,
3995
4003
  expand: !this.compact,
@@ -4000,7 +4008,7 @@ let q = class extends m {
4000
4008
  (o) => this.getReactionCount(o.value) > 0
4001
4009
  );
4002
4010
  return d`
4003
- <div class="${y(e)}">
4011
+ <div class="${w(e)}">
4004
4012
  ${this.renderTriggerButton()}
4005
4013
  ${t.length > 0 ? d`
4006
4014
  <div class="reaction-list">
@@ -4008,13 +4016,13 @@ let q = class extends m {
4008
4016
  (o) => this.renderReactionButton(o, this.showCounts)
4009
4017
  )}
4010
4018
  </div>
4011
- ` : u}
4019
+ ` : h}
4012
4020
  ${this.renderPopover()}
4013
4021
  </div>
4014
4022
  `;
4015
4023
  } else
4016
4024
  return d`
4017
- <div class="${y(e)}">
4025
+ <div class="${w(e)}">
4018
4026
  <div class="reaction-list">
4019
4027
  ${this.options.map((t) => this.renderReactionButton(t, this.showCounts))}
4020
4028
  </div>
@@ -4025,15 +4033,15 @@ let q = class extends m {
4025
4033
  * Render chart for reaction stats - simplified approach similar to pc-stars
4026
4034
  */
4027
4035
  renderChart() {
4028
- if (!this.displayController.shouldShowChart()) return u;
4036
+ if (!this.displayController.shouldShowChart()) return h;
4029
4037
  const e = this.dataController.getBreakdownInfo(), o = Object.entries(e.breakdownCount).filter(
4030
- ([l, p]) => this.options.some((c) => c.value === l)
4031
- ).map(([l, p]) => {
4032
- const c = this.options.find((h) => h.value === l);
4038
+ ([l, u]) => this.options.some((c) => c.value === l)
4039
+ ).map(([l, u]) => {
4040
+ const c = this.options.find((p) => p.value === l);
4033
4041
  return {
4034
4042
  label: l,
4035
4043
  // Use the reaction value as label
4036
- value: p,
4044
+ value: u,
4037
4045
  icon: (c == null ? void 0 : c.icon) || l
4038
4046
  // Use the icon or fall back to reaction value
4039
4047
  };
@@ -4058,9 +4066,9 @@ let q = class extends m {
4058
4066
  [`pc-flex-align-${o}`]: !0
4059
4067
  };
4060
4068
  return d`
4061
- <div class="${y(t)}" data-testid="reaction-container">
4069
+ <div class="${w(t)}" data-testid="reaction-container">
4062
4070
  ${this.renderLabelAtStart()}
4063
- <div class="${y(r)}" data-testid="reaction-body">
4071
+ <div class="${w(r)}" data-testid="reaction-body">
4064
4072
  ${this.renderStatusAtStart()} ${this.renderChart()} ${this.renderReactions()}
4065
4073
  ${this.renderStatusAtEnd()}
4066
4074
  </div>
@@ -4069,7 +4077,7 @@ let q = class extends m {
4069
4077
  `;
4070
4078
  }
4071
4079
  };
4072
- q.styles = [...m.styles, pt, Vo];
4080
+ q.styles = [...b.styles, pt, Vo];
4073
4081
  ht([
4074
4082
  f({ type: Boolean, attribute: "show-counts" })
4075
4083
  ], q.prototype, "showCounts", 2);
@@ -4163,12 +4171,12 @@ let H = class extends j {
4163
4171
  // REACTION widget uses options for the icon
4164
4172
  }));
4165
4173
  t && t.length > 0 && (r = Array.from(t).map((s) => {
4166
- const i = G(s, "value", "") || "", a = G(s, "label", Yo(s, i)) || "", n = G(s, "icon", void 0), l = G(s, "tooltip", void 0), p = G(s, "disabled", void 0), c = { value: i, label: a };
4174
+ const i = G(s, "value", "") || "", a = G(s, "label", Yo(s, i)) || "", n = G(s, "icon", void 0), l = G(s, "tooltip", void 0), u = G(s, "disabled", void 0), c = { value: i, label: a };
4167
4175
  if (n !== void 0) {
4168
- const h = Ce(n);
4169
- c.icon = h.icon;
4176
+ const p = Ce(n);
4177
+ c.icon = p.icon;
4170
4178
  }
4171
- return l !== void 0 && (c.tooltip = l), p !== void 0 && (c.disabled = !0), c;
4179
+ return l !== void 0 && (c.tooltip = l), u !== void 0 && (c.disabled = !0), c;
4172
4180
  })), this.parsedOptions = r;
4173
4181
  }
4174
4182
  /**
@@ -4187,7 +4195,7 @@ let H = class extends j {
4187
4195
  default:
4188
4196
  return console.warn(
4189
4197
  `poll-catch: Unknown widget type "${this.type}". Supported types: nps, poll, stars, reaction.`
4190
- ), u;
4198
+ ), h;
4191
4199
  }
4192
4200
  }
4193
4201
  };