@wral/report-it 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/define.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as n from "amazon-cognito-identity-js";
2
- import { W as i, a as r, b as a } from "./wral-code-input-BA1oCHMu.js";
2
+ import { W as i, a as r, b as a } from "./wral-code-input-ykUMYxPb.js";
3
3
  typeof window < "u" && !window.AmazonCognitoIdentity && (window.AmazonCognitoIdentity = n);
4
4
  const d = {
5
5
  "wral-report-it": a,
@@ -40,7 +40,7 @@ function $t(n) {
40
40
  });
41
41
  }), t;
42
42
  }
43
- var tt = {}, be = {}, Gt;
43
+ var rt = {}, be = {}, Gt;
44
44
  function An() {
45
45
  if (Gt) return be;
46
46
  Gt = 1, be.byteLength = u, be.toByteArray = d, be.fromByteArray = y;
@@ -114,14 +114,14 @@ function Cn() {
114
114
  n[t + v - b] |= _ * 128;
115
115
  }), Ve;
116
116
  }
117
- var rt, Zt;
117
+ var nt, Zt;
118
118
  function xn() {
119
- if (Zt) return rt;
119
+ if (Zt) return nt;
120
120
  Zt = 1;
121
121
  var n = {}.toString;
122
- return rt = Array.isArray || function(e) {
122
+ return nt = Array.isArray || function(e) {
123
123
  return n.call(e) == "[object Array]";
124
- }, rt;
124
+ }, nt;
125
125
  }
126
126
  var Xt;
127
127
  function En() {
@@ -550,10 +550,10 @@ function En() {
550
550
  }
551
551
  S === null ? (S = 65533, I = 1) : S > 65535 && (S -= 65536, f.push(S >>> 10 & 1023 | 55296), S = 56320 | S & 1023), f.push(S), g += I;
552
552
  }
553
- return et(f);
553
+ return tt(f);
554
554
  }
555
555
  var re = 4096;
556
- function et(h) {
556
+ function tt(h) {
557
557
  var a = h.length;
558
558
  if (a <= re)
559
559
  return String.fromCharCode.apply(String, h);
@@ -886,7 +886,7 @@ function En() {
886
886
  function Sn(h) {
887
887
  return h !== h;
888
888
  }
889
- })(tt)), tt;
889
+ })(rt)), rt;
890
890
  }
891
891
  var k = En(), z;
892
892
  typeof window < "u" && window.crypto && (z = window.crypto);
@@ -931,7 +931,7 @@ var Mr = /* @__PURE__ */ (function() {
931
931
  }, e.toString = function() {
932
932
  return Tn(this);
933
933
  }, n;
934
- })(), nt = {};
934
+ })(), it = {};
935
935
  var ft = function(n, e) {
936
936
  return ft = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, r) {
937
937
  t.__proto__ = r;
@@ -1358,7 +1358,7 @@ function Gn() {
1358
1358
  );
1359
1359
  return _e.RawSha256 = e, _e;
1360
1360
  }
1361
- var it = {}, Ae = {};
1361
+ var st = {}, Ae = {};
1362
1362
  const Jn = (n) => {
1363
1363
  const e = [];
1364
1364
  for (let t = 0, r = n.length; t < r; t++) {
@@ -1471,7 +1471,7 @@ function ui() {
1471
1471
  Object.defineProperty(n, "uint32ArrayFrom", { enumerable: !0, get: function() {
1472
1472
  return i.uint32ArrayFrom;
1473
1473
  } });
1474
- })(it)), it;
1474
+ })(st)), st;
1475
1475
  }
1476
1476
  var or;
1477
1477
  function li() {
@@ -1530,7 +1530,7 @@ function ci() {
1530
1530
  Object.defineProperty(n, "__esModule", { value: !0 });
1531
1531
  var e = Lr;
1532
1532
  (0, e.__exportStar)(li(), n);
1533
- })(nt)), nt;
1533
+ })(it)), it;
1534
1534
  }
1535
1535
  var De = ci();
1536
1536
  function C(n, e) {
@@ -1570,18 +1570,18 @@ var Rt = 52;
1570
1570
  C.prototype.FV = Math.pow(2, Rt);
1571
1571
  C.prototype.F1 = Rt - Q;
1572
1572
  C.prototype.F2 = 2 * Q - Rt;
1573
- var gi = "0123456789abcdefghijklmnopqrstuvwxyz", Ge = new Array(), ge, W;
1573
+ var gi = "0123456789abcdefghijklmnopqrstuvwxyz", Je = new Array(), ge, W;
1574
1574
  ge = 48;
1575
- for (W = 0; W <= 9; ++W) Ge[ge++] = W;
1575
+ for (W = 0; W <= 9; ++W) Je[ge++] = W;
1576
1576
  ge = 97;
1577
- for (W = 10; W < 36; ++W) Ge[ge++] = W;
1577
+ for (W = 10; W < 36; ++W) Je[ge++] = W;
1578
1578
  ge = 65;
1579
- for (W = 10; W < 36; ++W) Ge[ge++] = W;
1579
+ for (W = 10; W < 36; ++W) Je[ge++] = W;
1580
1580
  function cr(n) {
1581
1581
  return gi.charAt(n);
1582
1582
  }
1583
1583
  function mi(n, e) {
1584
- var t = Ge[n.charCodeAt(e)];
1584
+ var t = Je[n.charCodeAt(e)];
1585
1585
  return t ?? -1;
1586
1586
  }
1587
1587
  function yi(n) {
@@ -1867,7 +1867,7 @@ C.prototype.divide = qi;
1867
1867
  C.prototype.modPow = Wi;
1868
1868
  C.ZERO = Pt(0);
1869
1869
  C.ONE = Pt(1);
1870
- function st(n) {
1870
+ function ot(n) {
1871
1871
  return k.Buffer.from(new Mr().random(n).toString(), "hex");
1872
1872
  }
1873
1873
  var Yi = /^[89a-f]/i, Gi = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF", Ji = "userAttributes.", se = /* @__PURE__ */ (function() {
@@ -1884,10 +1884,10 @@ var Yi = /^[89a-f]/i, Gi = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD12902
1884
1884
  s && r(s, null), i.largeAValue = o, r(null, i.largeAValue);
1885
1885
  });
1886
1886
  }, e.generateRandomSmallA = function() {
1887
- var r = st(128).toString("hex"), i = new C(r, 16);
1887
+ var r = ot(128).toString("hex"), i = new C(r, 16);
1888
1888
  return i;
1889
1889
  }, e.generateRandomString = function() {
1890
- return st(40).toString("base64");
1890
+ return ot(40).toString("base64");
1891
1891
  }, e.getRandomPassword = function() {
1892
1892
  return this.randomPassword;
1893
1893
  }, e.getSaltDevices = function() {
@@ -1897,7 +1897,7 @@ var Yi = /^[89a-f]/i, Gi = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD12902
1897
1897
  }, e.generateHashDevice = function(r, i, s) {
1898
1898
  var o = this;
1899
1899
  this.randomPassword = this.generateRandomString();
1900
- var u = "" + r + i + ":" + this.randomPassword, c = this.hash(u), d = st(16).toString("hex");
1900
+ var u = "" + r + i + ":" + this.randomPassword, c = this.hash(u), d = ot(16).toString("hex");
1901
1901
  this.SaltToHashDevices = this.padHex(new C(d, 16)), this.g.modPow(new C(this.hexHash(this.SaltToHashDevices + c), 16), this.N, function(p, m) {
1902
1902
  p && s(p, null), o.verifierDevices = o.padHex(m), s(null, null);
1903
1903
  });
@@ -2169,8 +2169,8 @@ var ss = typeof navigator < "u", hr = ss ? Vr.isReactNative ? "react-native" : n
2169
2169
  var ye = ee.digestSync(), G = k.Buffer.from(ye).toString("base64"), V = {};
2170
2170
  V.USERNAME = s.username, V.PASSWORD_CLAIM_SECRET_BLOCK = U.SECRET_BLOCK, V.TIMESTAMP = B, V.PASSWORD_CLAIM_SIGNATURE = G, s.deviceKey != null && (V.DEVICE_KEY = s.deviceKey);
2171
2171
  var te = function(ce, we) {
2172
- return s.client.request("RespondToAuthChallenge", ce, function(re, et) {
2173
- return re && re.code === "ResourceNotFoundException" && re.message.toLowerCase().indexOf("device") !== -1 ? (V.DEVICE_KEY = null, s.deviceKey = null, s.randomPassword = null, s.deviceGroupKey = null, s.clearCachedDeviceKeyAndPassword(), te(ce, we)) : we(re, et);
2172
+ return s.client.request("RespondToAuthChallenge", ce, function(re, tt) {
2173
+ return re && re.code === "ResourceNotFoundException" && re.message.toLowerCase().indexOf("device") !== -1 ? (V.DEVICE_KEY = null, s.deviceKey = null, s.randomPassword = null, s.deviceGroupKey = null, s.clearCachedDeviceKeyAndPassword(), te(ce, we)) : we(re, tt);
2174
2174
  });
2175
2175
  }, le = {
2176
2176
  ChallengeName: "PASSWORD_VERIFIER",
@@ -2856,9 +2856,9 @@ const as = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2856
2856
  __proto__: null,
2857
2857
  default: os
2858
2858
  }, Symbol.toStringTag, { value: "Module" })), fr = /* @__PURE__ */ $t(as);
2859
- var ot, dr;
2859
+ var at, dr;
2860
2860
  function us() {
2861
- return dr || (dr = 1, ot = self.fetch || (self.fetch = fr.default || fr)), ot;
2861
+ return dr || (dr = 1, at = self.fetch || (self.fetch = fr.default || fr)), at;
2862
2862
  }
2863
2863
  us();
2864
2864
  function j() {
@@ -3216,7 +3216,7 @@ const As = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3216
3216
  WordArray: Mr,
3217
3217
  appendToCognitoUserAgent: ls
3218
3218
  }, Symbol.toStringTag, { value: "Module" }));
3219
- const ze = globalThis, Bt = ze.ShadowRoot && (ze.ShadyCSS === void 0 || ze.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ot = /* @__PURE__ */ Symbol(), pr = /* @__PURE__ */ new WeakMap();
3219
+ const We = globalThis, Bt = We.ShadowRoot && (We.ShadyCSS === void 0 || We.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ot = /* @__PURE__ */ Symbol(), pr = /* @__PURE__ */ new WeakMap();
3220
3220
  let Yr = class {
3221
3221
  constructor(e, t, r) {
3222
3222
  if (this._$cssResult$ = !0, r !== Ot) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
@@ -3245,7 +3245,7 @@ const Cs = (n) => new Yr(typeof n == "string" ? n : n + "", void 0, Ot), Y = (n,
3245
3245
  }, xs = (n, e) => {
3246
3246
  if (Bt) n.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
3247
3247
  else for (const t of e) {
3248
- const r = document.createElement("style"), i = ze.litNonce;
3248
+ const r = document.createElement("style"), i = We.litNonce;
3249
3249
  i !== void 0 && r.setAttribute("nonce", i), r.textContent = t.cssText, n.appendChild(r);
3250
3250
  }
3251
3251
  }, gr = Bt ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((e) => {
@@ -3253,7 +3253,7 @@ const Cs = (n) => new Yr(typeof n == "string" ? n : n + "", void 0, Ot), Y = (n,
3253
3253
  for (const r of e.cssRules) t += r.cssText;
3254
3254
  return Cs(t);
3255
3255
  })(n) : n;
3256
- const { is: Es, defineProperty: Us, getOwnPropertyDescriptor: Ts, getOwnPropertyNames: Is, getOwnPropertySymbols: Ds, getPrototypeOf: ks } = Object, Je = globalThis, mr = Je.trustedTypes, $s = mr ? mr.emptyScript : "", Rs = Je.reactiveElementPolyfillSupport, ke = (n, e) => n, Et = { toAttribute(n, e) {
3256
+ const { is: Es, defineProperty: Us, getOwnPropertyDescriptor: Ts, getOwnPropertyNames: Is, getOwnPropertySymbols: Ds, getPrototypeOf: ks } = Object, Ze = globalThis, mr = Ze.trustedTypes, $s = mr ? mr.emptyScript : "", Rs = Ze.reactiveElementPolyfillSupport, ke = (n, e) => n, Et = { toAttribute(n, e) {
3257
3257
  switch (e) {
3258
3258
  case Boolean:
3259
3259
  n = n ? $s : null;
@@ -3282,7 +3282,7 @@ const { is: Es, defineProperty: Us, getOwnPropertyDescriptor: Ts, getOwnProperty
3282
3282
  }
3283
3283
  return t;
3284
3284
  } }, Gr = (n, e) => !Es(n, e), yr = { attribute: !0, type: String, converter: Et, reflect: !1, useDefault: !1, hasChanged: Gr };
3285
- Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), Je.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
3285
+ Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), Ze.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
3286
3286
  let fe = class extends HTMLElement {
3287
3287
  static addInitializer(e) {
3288
3288
  this._$Ei(), (this.l ??= []).push(e);
@@ -3464,9 +3464,9 @@ let fe = class extends HTMLElement {
3464
3464
  firstUpdated(e) {
3465
3465
  }
3466
3466
  };
3467
- fe.elementStyles = [], fe.shadowRootOptions = { mode: "open" }, fe[ke("elementProperties")] = /* @__PURE__ */ new Map(), fe[ke("finalized")] = /* @__PURE__ */ new Map(), Rs?.({ ReactiveElement: fe }), (Je.reactiveElementVersions ??= []).push("2.1.2");
3468
- const Mt = globalThis, vr = (n) => n, Ye = Mt.trustedTypes, wr = Ye ? Ye.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, Jr = "$lit$", X = `lit$${Math.random().toFixed(9).slice(2)}$`, Zr = "?" + X, Ps = `<${Zr}>`, ue = document, Pe = () => ue.createComment(""), Fe = (n) => n === null || typeof n != "object" && typeof n != "function", Nt = Array.isArray, Fs = (n) => Nt(n) || typeof n?.[Symbol.iterator] == "function", at = `[
3469
- \f\r]`, Te = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, br = /-->/g, Sr = />/g, ie = RegExp(`>|${at}(?:([^\\s"'>=/]+)(${at}*=${at}*(?:[^
3467
+ fe.elementStyles = [], fe.shadowRootOptions = { mode: "open" }, fe[ke("elementProperties")] = /* @__PURE__ */ new Map(), fe[ke("finalized")] = /* @__PURE__ */ new Map(), Rs?.({ ReactiveElement: fe }), (Ze.reactiveElementVersions ??= []).push("2.1.2");
3468
+ const Mt = globalThis, vr = (n) => n, Ge = Mt.trustedTypes, wr = Ge ? Ge.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, Jr = "$lit$", X = `lit$${Math.random().toFixed(9).slice(2)}$`, Zr = "?" + X, Ps = `<${Zr}>`, ue = document, Pe = () => ue.createComment(""), Fe = (n) => n === null || typeof n != "object" && typeof n != "function", Nt = Array.isArray, Fs = (n) => Nt(n) || typeof n?.[Symbol.iterator] == "function", ut = `[
3469
+ \f\r]`, Te = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, br = /-->/g, Sr = />/g, ie = RegExp(`>|${ut}(?:([^\\s"'>=/]+)(${ut}*=${ut}*(?:[^
3470
3470
  \f\r"'\`<>=]|("|')|))|$)`, "g"), _r = /'/g, Ar = /"/g, Xr = /^(?:script|style|textarea|title)$/i, Bs = (n) => (e, ...t) => ({ _$litType$: n, strings: e, values: t }), A = Bs(1), de = /* @__PURE__ */ Symbol.for("lit-noChange"), E = /* @__PURE__ */ Symbol.for("lit-nothing"), Cr = /* @__PURE__ */ new WeakMap(), oe = ue.createTreeWalker(ue, 129);
3471
3471
  function Qr(n, e) {
3472
3472
  if (!Nt(n) || !n.hasOwnProperty("raw")) throw Error("invalid template strings array");
@@ -3498,12 +3498,12 @@ class Be {
3498
3498
  if (i.nodeType === 1) {
3499
3499
  if (i.hasAttributes()) for (const m of i.getAttributeNames()) if (m.endsWith(Jr)) {
3500
3500
  const y = p[o++], v = i.getAttribute(m).split(X), b = /([.?@])?(.*)/.exec(y);
3501
- c.push({ type: 1, index: s, name: b[2], strings: v, ctor: b[1] === "." ? Ns : b[1] === "?" ? Ls : b[1] === "@" ? qs : Ze }), i.removeAttribute(m);
3501
+ c.push({ type: 1, index: s, name: b[2], strings: v, ctor: b[1] === "." ? Ns : b[1] === "?" ? Ls : b[1] === "@" ? qs : Xe }), i.removeAttribute(m);
3502
3502
  } else m.startsWith(X) && (c.push({ type: 6, index: s }), i.removeAttribute(m));
3503
3503
  if (Xr.test(i.tagName)) {
3504
3504
  const m = i.textContent.split(X), y = m.length - 1;
3505
3505
  if (y > 0) {
3506
- i.textContent = Ye ? Ye.emptyScript : "";
3506
+ i.textContent = Ge ? Ge.emptyScript : "";
3507
3507
  for (let v = 0; v < y; v++) i.append(m[v], Pe()), oe.nextNode(), c.push({ type: 2, index: ++s });
3508
3508
  i.append(m[y], Pe());
3509
3509
  }
@@ -3614,7 +3614,7 @@ class Oe {
3614
3614
  this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
3615
3615
  }
3616
3616
  }
3617
- class Ze {
3617
+ class Xe {
3618
3618
  get tagName() {
3619
3619
  return this.element.tagName;
3620
3620
  }
@@ -3639,7 +3639,7 @@ class Ze {
3639
3639
  e === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
3640
3640
  }
3641
3641
  }
3642
- class Ns extends Ze {
3642
+ class Ns extends Xe {
3643
3643
  constructor() {
3644
3644
  super(...arguments), this.type = 3;
3645
3645
  }
@@ -3647,7 +3647,7 @@ class Ns extends Ze {
3647
3647
  this.element[this.name] = e === E ? void 0 : e;
3648
3648
  }
3649
3649
  }
3650
- class Ls extends Ze {
3650
+ class Ls extends Xe {
3651
3651
  constructor() {
3652
3652
  super(...arguments), this.type = 4;
3653
3653
  }
@@ -3655,7 +3655,7 @@ class Ls extends Ze {
3655
3655
  this.element.toggleAttribute(this.name, !!e && e !== E);
3656
3656
  }
3657
3657
  }
3658
- class qs extends Ze {
3658
+ class qs extends Xe {
3659
3659
  constructor(e, t, r, i, s) {
3660
3660
  super(e, t, r, i, s), this.type = 5;
3661
3661
  }
@@ -4099,7 +4099,7 @@ function M(n, e, { noAnim: t = !1, error: r = !1 } = {}) {
4099
4099
  function Z(n, { noAnim: e = !1 } = {}) {
4100
4100
  return A`<div class="msg user ${e ? "no-anim" : ""}">${n}</div>`;
4101
4101
  }
4102
- function ut() {
4102
+ function ze() {
4103
4103
  return A`<div class="msg bot typing"><span></span><span></span><span></span></div>`;
4104
4104
  }
4105
4105
  function no(n) {
@@ -4525,10 +4525,10 @@ function Eo({ baseUrl: n, factsBaseUrl: e }) {
4525
4525
  function J(n, e) {
4526
4526
  return (n?.nodes || []).find((t) => t.id === e);
4527
4527
  }
4528
- function Xe(n) {
4528
+ function Qe(n) {
4529
4529
  return n?.form ? { formId: n.form, path: [...n.path || []] } : null;
4530
4530
  }
4531
- function Qe(n, e = []) {
4531
+ function et(n, e = []) {
4532
4532
  const t = [];
4533
4533
  let r = n?.start;
4534
4534
  for (const s of e) {
@@ -4543,7 +4543,7 @@ function Qe(n, e = []) {
4543
4543
  const u = (o.options || []).find((c) => c.id === s.optionId);
4544
4544
  if (!u)
4545
4545
  return { nodeId: null, node: null, flags: t, error: { step: s, reason: `unknown option: ${s.optionId}` } };
4546
- if (Xe(u))
4546
+ if (Qe(u))
4547
4547
  return { nodeId: null, node: null, flags: t, error: { step: s, reason: `steps continue past a hand-off: ${s.optionId}` } };
4548
4548
  t.push(...u.flags || []), r = u.next;
4549
4549
  continue;
@@ -4594,11 +4594,11 @@ function Io(n, e = []) {
4594
4594
  return { steps: [], error: `unknown preset step: ${i}` };
4595
4595
  t.push({ nodeId: s, kind: "choice", optionId: o, label: c.label, preset: !0 });
4596
4596
  }
4597
- const { error: r } = Qe(n, t);
4597
+ const { error: r } = et(n, t);
4598
4598
  return r ? { steps: [], error: r.reason } : { steps: t, error: null };
4599
4599
  }
4600
4600
  function Do(n, e) {
4601
- const t = Xe(e);
4601
+ const t = Qe(e);
4602
4602
  if (!t) return { form: null, steps: [], error: "not a hand-off" };
4603
4603
  const r = (n || []).find((o) => o.formId === t.formId);
4604
4604
  if (!r) return { form: null, steps: [], error: `unknown form: ${t.formId}` };
@@ -4621,10 +4621,10 @@ function Ro(n, e, t) {
4621
4621
  for (let i = 0; i < n.length; i++) {
4622
4622
  const s = n[i], o = (e || []).find((m) => m.formId === s?.formId);
4623
4623
  if (!o) return [];
4624
- const { node: u, error: c } = Qe(o, s.steps || []);
4624
+ const { node: u, error: c } = et(o, s.steps || []);
4625
4625
  if (c || u?.id !== s.option?.nodeId) return [];
4626
4626
  const d = (u.options || []).find((m) => m.id === s.option.optionId), p = i + 1 < n.length ? n[i + 1].formId : t;
4627
- if (Xe(d)?.formId !== p) return [];
4627
+ if (Qe(d)?.formId !== p) return [];
4628
4628
  r.push({ form: o, steps: s.steps || [], option: s.option });
4629
4629
  }
4630
4630
  return r;
@@ -4891,7 +4891,7 @@ function ta(n, e, { apiOrigin: t } = {}) {
4891
4891
  return { status: "discarded" };
4892
4892
  const r = (e || []).find((o) => o.formId === n.formId);
4893
4893
  if (!r) return { status: "discarded" };
4894
- const { error: i } = Qe(r, n.steps || []);
4894
+ const { error: i } = et(r, n.steps || []);
4895
4895
  if (i) return { status: "discarded" };
4896
4896
  const s = {};
4897
4897
  for (const [o, u] of Object.entries(n.media || {}))
@@ -4905,7 +4905,7 @@ function ta(n, e, { apiOrigin: t } = {}) {
4905
4905
  origins: Ro(n.origins, e, r.formId)
4906
4906
  };
4907
4907
  }
4908
- function We(n = []) {
4908
+ function Ye(n = []) {
4909
4909
  return {
4910
4910
  stage: "idle",
4911
4911
  resumeStage: null,
@@ -4984,7 +4984,7 @@ function ra(n, e) {
4984
4984
  case "REQUEST_FAIL":
4985
4985
  return { ...n, stage: "requesting-error", error: e.error };
4986
4986
  case "RESET":
4987
- return We([]);
4987
+ return Ye([]);
4988
4988
  default:
4989
4989
  return n;
4990
4990
  }
@@ -5065,7 +5065,7 @@ class da extends ae {
5065
5065
  /* The gate was passed with an account created on this page load; offered once. */
5066
5066
  #d = !1;
5067
5067
  constructor() {
5068
- super(), this.api = ua, this.factsApi = null, this.flow = null, this._phase = "loading", this._forms = [], this._form = null, this._steps = [], this._origins = [], this._handoffError = !1, this._typing = !1, this._loadingSlow = !1, this._cardValues = {}, this._fieldErrors = {}, this._gate = { stage: null, email: "", error: "", loading: !1 }, this._submit = We([]), this._banner = null, this._notice = null, this._result = null, this._factsOffer = null;
5068
+ super(), this.api = ua, this.factsApi = null, this.flow = null, this._phase = "loading", this._forms = [], this._form = null, this._steps = [], this._origins = [], this._handoffError = !1, this._typing = !1, this._loadingSlow = !1, this._cardValues = {}, this._fieldErrors = {}, this._gate = { stage: null, email: "", error: "", loading: !1 }, this._submit = Ye([]), this._banner = null, this._notice = null, this._result = null, this._factsOffer = null;
5069
5069
  }
5070
5070
  get client() {
5071
5071
  if (this.#l) return this.#l;
@@ -5163,7 +5163,7 @@ ${this.factsApi || ""}`;
5163
5163
  }, la)) : this._typing = !1;
5164
5164
  }
5165
5165
  get #_() {
5166
- return this._form ? Qe(this._form, this._steps) : { node: null };
5166
+ return this._form ? et(this._form, this._steps) : { node: null };
5167
5167
  }
5168
5168
  #T(e) {
5169
5169
  this._form = e, this._steps = [], this._origins = [], this._handoffError = !1, this.#t = null, this.#r = {}, this.#n = {}, this._notice = null, this.#o(), this.#i();
@@ -5172,7 +5172,7 @@ ${this.factsApi || ""}`;
5172
5172
  this._steps = [...this._steps, e], this.#o(), this.#i();
5173
5173
  }
5174
5174
  #K(e, t) {
5175
- if (Xe(t)) {
5175
+ if (Qe(t)) {
5176
5176
  this.#V(e, t);
5177
5177
  return;
5178
5178
  }
@@ -5225,7 +5225,7 @@ ${this.factsApi || ""}`;
5225
5225
  this._steps = this._steps.slice(0, -1), e.kind === "collect" && (this._cardValues = { ...e.values }), this.#o(), this.#i({ animate: !1 });
5226
5226
  }
5227
5227
  #A() {
5228
- this.client.endAnonSession?.(), this._form = null, this._steps = [], this._origins = [], this._handoffError = !1, this.#t = null, this.#r = {}, this.#n = {}, this._result = null, this._banner = null, this._notice = null, this._submit = We([]), this._factsOffer = null, Fr(this.#p), this._phase = "pick";
5228
+ this.client.endAnonSession?.(), this._form = null, this._steps = [], this._origins = [], this._handoffError = !1, this.#t = null, this.#r = {}, this.#n = {}, this._result = null, this._banner = null, this._notice = null, this._submit = Ye([]), this._factsOffer = null, Fr(this.#p), this._phase = "pick";
5229
5229
  }
5230
5230
  // ── Collect card ────────────────────────────────────────────────
5231
5231
  #C(e, t) {
@@ -5391,7 +5391,7 @@ ${this.factsApi || ""}`;
5391
5391
  if (!await this.#P()) return;
5392
5392
  } else
5393
5393
  this.client.endAnonSession?.();
5394
- if (this._submit = We(this.#y), this._phase = "submitting", this.#g) {
5394
+ if (this._submit = Ye(this.#y), this._phase = "submitting", this.#g) {
5395
5395
  this.#e({ type: "START" }), this.#a();
5396
5396
  return;
5397
5397
  }
@@ -5531,7 +5531,7 @@ ${this.factsApi || ""}`;
5531
5531
  switch (this._phase) {
5532
5532
  case "loading":
5533
5533
  return A`${M(ct, this._loadingSlow ? "Loading the form list…" : ht)}
5534
- ${ut()}`;
5534
+ ${ze()}`;
5535
5535
  case "load-error":
5536
5536
  return A`
5537
5537
  ${M("We could not load the forms.", "Check your connection and try again.", { error: !0 })}
@@ -5542,7 +5542,7 @@ ${this.factsApi || ""}`;
5542
5542
  case "pick":
5543
5543
  return this.#ue();
5544
5544
  case "walk":
5545
- return A`${this.#v()}${this._typing ? ut() : this.#le()}`;
5545
+ return A`${this.#v()}${this._typing ? ze() : this.#le()}`;
5546
5546
  case "review":
5547
5547
  return A`${this.#v()}${this.#M()}`;
5548
5548
  case "submitting":
@@ -5806,7 +5806,7 @@ ${this.factsApi || ""}`;
5806
5806
  <button type="button" @click=${() => this.#x()}>resend a new code</button>.
5807
5807
  </p>
5808
5808
  </div>
5809
- ` : A`${r}${ut()}`;
5809
+ ` : A`${r}${ze()}`;
5810
5810
  }
5811
5811
  /* Collapsed by default: findable for whoever needs it, never the
5812
5812
  * first thing a viewer reaches for. */
@@ -5904,23 +5904,23 @@ ${this.factsApi || ""}`;
5904
5904
  "uploading-error": "One of your files did not upload.",
5905
5905
  requesting: "Sending your report…",
5906
5906
  "requesting-error": this._banner?.message || "We could not send your report."
5907
- }[e.stage] || "Working…";
5907
+ }[e.stage] || "Working…", r = e.stage.endsWith("-error");
5908
5908
  return A`
5909
5909
  ${M("Submitting your report.", t)}
5910
- <div class="form-card">
5911
- ${e.files.map((r, i) => A`
5910
+ ${e.files.length || r ? A`<div class="form-card">
5911
+ ${e.files.map((i, s) => A`
5912
5912
  <div class="upload-row">
5913
- <span class="name">${r.name}</span>
5913
+ <span class="name">${i.name}</span>
5914
5914
  <div class="upload-bar" role="progressbar"
5915
5915
  aria-valuemin="0" aria-valuemax="100"
5916
- aria-valuenow=${Math.round((r.status === "done" ? 1 : r.progress) * 100)}>
5917
- <div class="fill" style="width: ${(r.status === "done" ? 1 : r.progress) * 100}%"></div>
5916
+ aria-valuenow=${Math.round((i.status === "done" ? 1 : i.progress) * 100)}>
5917
+ <div class="fill" style="width: ${(i.status === "done" ? 1 : i.progress) * 100}%"></div>
5918
5918
  </div>
5919
- <span class="state ${r.status === "failed" ? "failed" : ""}">
5920
- ${r.status === "done" ? "Done" : r.status === "failed" ? "Failed" : "Uploading"}
5919
+ <span class="state ${i.status === "failed" ? "failed" : ""}">
5920
+ ${i.status === "done" ? "Done" : i.status === "failed" ? "Failed" : "Uploading"}
5921
5921
  </span>
5922
- ${r.status === "failed" ? A`
5923
- <button type="button" class="retry-chip" @click=${() => this.#te(i)}>
5922
+ ${i.status === "failed" ? A`
5923
+ <button type="button" class="retry-chip" @click=${() => this.#te(s)}>
5924
5924
  Retry
5925
5925
  </button>
5926
5926
  ` : E}
@@ -5939,7 +5939,8 @@ ${this.factsApi || ""}`;
5939
5939
  <div class="err" role="alert">Retry the failed
5940
5940
  ${Br(e).length === 1 ? "file" : "files"} to continue.</div>
5941
5941
  ` : E}
5942
- </div>
5942
+ </div>` : E}
5943
+ ${r ? E : ze()}
5943
5944
  `;
5944
5945
  }
5945
5946
  #we() {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { W as Oe, b as Be, a as Ce, c as De, d as je, e as Me } from "./wral-code-input-BA1oCHMu.js";
1
+ import { W as Oe, b as Be, a as Ce, c as De, d as je, e as Me } from "./wral-code-input-ykUMYxPb.js";
2
2
  const v = "news", _ = "News tip or story idea", I = "News tips and story ideas routed to the news desk queue; assignment editors are emailed. Breaking reports flag urgent. The 5 On Your Side and Investigates options hand off to those forms.", L = "2026-09-25.1", $ = 0, W = !0, A = "news_type", S = { maxFiles: 5, maxFileBytes: 524288e3, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp", "video/mp4", "video/quicktime", "application/pdf"] }, R = [{ id: "news_type", type: "choice", prompt: "What kind of news?", options: [{ id: "breaking", label: "Breaking or happening now", flags: ["urgent"], next: "news_detail" }, { id: "idea", label: "Story idea", next: "news_detail" }, { id: "fiveoys", label: "5 On Your Side or consumer complaint", form: "consumer", path: ["consumer_kind:fiveoys"] }, { id: "investigates", label: "Something for WRAL Investigates", form: "investigates" }] }, { id: "news_detail", type: "collect", prompt: "Tell us what happened.", next: "verify", fields: [{ key: "description", kind: "textarea", label: "What happened? Include when and where.", required: !0, maxLength: 5e3 }, { key: "name", kind: "text", label: "Your name", autocomplete: "name", maxLength: 200 }, { key: "phone", kind: "text", label: "Phone number", inputMode: "tel", autocomplete: "tel", maxLength: 40 }, { key: "address", kind: "text", label: "Address", autocomplete: "street-address", maxLength: 500 }, { key: "zip", kind: "text", label: "Zip code", inputMode: "numeric", autocomplete: "postal-code", pattern: "^\\d{5}(-\\d{4})?$", maxLength: 10 }, { key: "willing", kind: "select", label: "Are you willing to talk with a reporter?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }, { key: "media", kind: "media", label: "Do you have video, photos or files to upload?" }, { key: "rights", kind: "consent", label: "Rights confirmation", requiredIf: "media", text: "I have obtained the attached materials in a lawful manner and have the necessary rights to submit them here. I give WRAL permission to use, copy, modify, and distribute the attached materials as WRAL sees fit, and to use my name in connection with the materials." }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "studio+email:news", confirmation: { title: "Your tip is on its way to the newsroom.", body: "It goes to the news desk queue and the assignment editors are emailed.", urgentNote: "Breaking reports are pinned to the top of the queue." } }], T = {
3
3
  formId: v,
4
4
  title: _,
@@ -1,7 +1,7 @@
1
- import { css as b, html as c, nothing as f, LitElement as G } from "lit";
1
+ import { css as b, html as c, nothing as p, LitElement as G } from "lit";
2
2
  import { getAuthContext as Re, createStorage as Oe, verifyCode as Me, extractTokens as J, saveTokens as X, decodeJwtPayload as ee, refreshTokenSimple as te, sendCode as Ne, createUserPool as De, createCognitoUser as Pe, STORAGE_KEYS as S, isAuthenticatedSimple as Ue, signUpIfNeeded as ze } from "@wral/sdk-auth-audience";
3
- const K = globalThis, se = (r) => r, P = K.trustedTypes, re = P ? P.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, ve = "$lit$", _ = `lit$${Math.random().toFixed(9).slice(2)}$`, _e = "?" + _, Be = `<${_e}>`, F = document, U = () => F.createComment(""), R = (r) => r === null || typeof r != "object" && typeof r != "function", Q = Array.isArray, Le = (r) => Q(r) || typeof r?.[Symbol.iterator] == "function", q = `[
4
- \f\r]`, C = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ne = /-->/g, ie = />/g, k = RegExp(`>|${q}(?:([^\\s"'>=/]+)(${q}*=${q}*(?:[^
3
+ const K = globalThis, se = (r) => r, U = K.trustedTypes, re = U ? U.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, ve = "$lit$", _ = `lit$${Math.random().toFixed(9).slice(2)}$`, _e = "?" + _, Be = `<${_e}>`, F = document, z = () => F.createComment(""), R = (r) => r === null || typeof r != "object" && typeof r != "function", Q = Array.isArray, Le = (r) => Q(r) || typeof r?.[Symbol.iterator] == "function", W = `[
4
+ \f\r]`, C = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ne = /-->/g, ie = />/g, k = RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
5
5
  \f\r"'\`<>=]|("|')|))|$)`, "g"), oe = /'/g, ae = /"/g, $e = /^(?:script|style|textarea|title)$/i, O = /* @__PURE__ */ Symbol.for("lit-noChange"), g = /* @__PURE__ */ Symbol.for("lit-nothing"), le = /* @__PURE__ */ new WeakMap(), A = F.createTreeWalker(F, 129);
6
6
  function ke(r, e) {
7
7
  if (!Q(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
@@ -12,8 +12,8 @@ const He = (r, e) => {
12
12
  let n, i = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", o = C;
13
13
  for (let a = 0; a < t; a++) {
14
14
  const l = r[a];
15
- let d, h, u = -1, p = 0;
16
- for (; p < l.length && (o.lastIndex = p, h = o.exec(l), h !== null); ) p = o.lastIndex, o === C ? h[1] === "!--" ? o = ne : h[1] !== void 0 ? o = ie : h[2] !== void 0 ? ($e.test(h[2]) && (n = RegExp("</" + h[2], "g")), o = k) : h[3] !== void 0 && (o = k) : o === k ? h[0] === ">" ? (o = n ?? C, u = -1) : h[1] === void 0 ? u = -2 : (u = o.lastIndex - h[2].length, d = h[1], o = h[3] === void 0 ? k : h[3] === '"' ? ae : oe) : o === ae || o === oe ? o = k : o === ne || o === ie ? o = C : (o = k, n = void 0);
15
+ let d, h, u = -1, f = 0;
16
+ for (; f < l.length && (o.lastIndex = f, h = o.exec(l), h !== null); ) f = o.lastIndex, o === C ? h[1] === "!--" ? o = ne : h[1] !== void 0 ? o = ie : h[2] !== void 0 ? ($e.test(h[2]) && (n = RegExp("</" + h[2], "g")), o = k) : h[3] !== void 0 && (o = k) : o === k ? h[0] === ">" ? (o = n ?? C, u = -1) : h[1] === void 0 ? u = -2 : (u = o.lastIndex - h[2].length, d = h[1], o = h[3] === void 0 ? k : h[3] === '"' ? ae : oe) : o === ae || o === oe ? o = k : o === ne || o === ie ? o = C : (o = k, n = void 0);
17
17
  const y = o === k && r[a + 1].startsWith("/>") ? " " : "";
18
18
  i += o === C ? l + Be : u >= 0 ? (s.push(d), l.slice(0, u) + ve + l.slice(u) + _ + y) : l + _ + (u === -2 ? a : y);
19
19
  }
@@ -32,15 +32,15 @@ class M {
32
32
  for (; (n = A.nextNode()) !== null && l.length < a; ) {
33
33
  if (n.nodeType === 1) {
34
34
  if (n.hasAttributes()) for (const u of n.getAttributeNames()) if (u.endsWith(ve)) {
35
- const p = h[o++], y = n.getAttribute(u).split(_), w = /([.?@])?(.*)/.exec(p);
36
- l.push({ type: 1, index: i, name: w[2], strings: y, ctor: w[1] === "." ? We : w[1] === "?" ? Ve : w[1] === "@" ? je : B }), n.removeAttribute(u);
35
+ const f = h[o++], y = n.getAttribute(u).split(_), w = /([.?@])?(.*)/.exec(f);
36
+ l.push({ type: 1, index: i, name: w[2], strings: y, ctor: w[1] === "." ? We : w[1] === "?" ? Ve : w[1] === "@" ? je : L }), n.removeAttribute(u);
37
37
  } else u.startsWith(_) && (l.push({ type: 6, index: i }), n.removeAttribute(u));
38
38
  if ($e.test(n.tagName)) {
39
- const u = n.textContent.split(_), p = u.length - 1;
40
- if (p > 0) {
41
- n.textContent = P ? P.emptyScript : "";
42
- for (let y = 0; y < p; y++) n.append(u[y], U()), A.nextNode(), l.push({ type: 2, index: ++i });
43
- n.append(u[p], U());
39
+ const u = n.textContent.split(_), f = u.length - 1;
40
+ if (f > 0) {
41
+ n.textContent = U ? U.emptyScript : "";
42
+ for (let y = 0; y < f; y++) n.append(u[y], z()), A.nextNode(), l.push({ type: 2, index: ++i });
43
+ n.append(u[f], z());
44
44
  }
45
45
  }
46
46
  } else if (n.nodeType === 8) if (n.data === _e) l.push({ type: 2, index: i });
@@ -79,7 +79,7 @@ class qe {
79
79
  for (; l !== void 0; ) {
80
80
  if (o === l.index) {
81
81
  let d;
82
- l.type === 2 ? d = new z(i, i.nextSibling, this, e) : l.type === 1 ? d = new l.ctor(i, l.name, l.strings, this, e) : l.type === 6 && (d = new Ye(i, this, e)), this._$AV.push(d), l = s[++a];
82
+ l.type === 2 ? d = new B(i, i.nextSibling, this, e) : l.type === 1 ? d = new l.ctor(i, l.name, l.strings, this, e) : l.type === 6 && (d = new Ye(i, this, e)), this._$AV.push(d), l = s[++a];
83
83
  }
84
84
  o !== l?.index && (i = A.nextNode(), o++);
85
85
  }
@@ -90,7 +90,7 @@ class qe {
90
90
  for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(e, s, t), t += s.strings.length - 2) : s._$AI(e[t])), t++;
91
91
  }
92
92
  }
93
- class z {
93
+ class B {
94
94
  get _$AU() {
95
95
  return this._$AM?._$AU ?? this._$Cv;
96
96
  }
@@ -136,7 +136,7 @@ class z {
136
136
  Q(this._$AH) || (this._$AH = [], this._$AR());
137
137
  const t = this._$AH;
138
138
  let s, n = 0;
139
- for (const i of e) n === t.length ? t.push(s = new z(this.O(U()), this.O(U()), this, this.options)) : s = t[n], s._$AI(i), n++;
139
+ for (const i of e) n === t.length ? t.push(s = new B(this.O(z()), this.O(z()), this, this.options)) : s = t[n], s._$AI(i), n++;
140
140
  n < t.length && (this._$AR(s && s._$AB.nextSibling, n), t.length = n);
141
141
  }
142
142
  _$AR(e = this._$AA.nextSibling, t) {
@@ -149,7 +149,7 @@ class z {
149
149
  this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
150
150
  }
151
151
  }
152
- class B {
152
+ class L {
153
153
  get tagName() {
154
154
  return this.element.tagName;
155
155
  }
@@ -174,7 +174,7 @@ class B {
174
174
  e === g ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
175
175
  }
176
176
  }
177
- class We extends B {
177
+ class We extends L {
178
178
  constructor() {
179
179
  super(...arguments), this.type = 3;
180
180
  }
@@ -182,7 +182,7 @@ class We extends B {
182
182
  this.element[this.name] = e === g ? void 0 : e;
183
183
  }
184
184
  }
185
- class Ve extends B {
185
+ class Ve extends L {
186
186
  constructor() {
187
187
  super(...arguments), this.type = 4;
188
188
  }
@@ -190,7 +190,7 @@ class Ve extends B {
190
190
  this.element.toggleAttribute(this.name, !!e && e !== g);
191
191
  }
192
192
  }
193
- class je extends B {
193
+ class je extends L {
194
194
  constructor(e, t, s, n, i) {
195
195
  super(e, t, s, n, i), this.type = 5;
196
196
  }
@@ -215,7 +215,7 @@ class Ye {
215
215
  }
216
216
  }
217
217
  const Ge = K.litHtmlPolyfillSupport;
218
- Ge?.(M, z), (K.litHtmlVersions ??= []).push("3.3.3");
218
+ Ge?.(M, B), (K.litHtmlVersions ??= []).push("3.3.3");
219
219
  const ce = (r) => r ?? g, Ke = b`
220
220
  :host {
221
221
  display: block;
@@ -591,18 +591,18 @@ function m(r, e, { noAnim: t = !1, error: s = !1 } = {}) {
591
591
  return c`
592
592
  <div class="msg bot ${t ? "no-anim" : ""} ${s ? "error" : ""}">
593
593
  <span class="lead">${r}</span>
594
- ${e ? c`<span class="sub">${e}</span>` : f}
594
+ ${e ? c`<span class="sub">${e}</span>` : p}
595
595
  </div>
596
596
  `;
597
597
  }
598
598
  function v(r, { noAnim: e = !1 } = {}) {
599
599
  return c`<div class="msg user ${e ? "no-anim" : ""}">${r}</div>`;
600
600
  }
601
- function W() {
601
+ function D() {
602
602
  return c`<div class="msg bot typing"><span></span><span></span><span></span></div>`;
603
603
  }
604
604
  function ot(r) {
605
- return r ? c`<span class="flag-pill ${r}">${r === "urgent" ? "Urgent" : "Moderate"}</span>` : f;
605
+ return r ? c`<span class="flag-pill ${r}">${r === "urgent" ? "Urgent" : "Moderate"}</span>` : p;
606
606
  }
607
607
  function at() {
608
608
  return c`
@@ -637,7 +637,7 @@ function dt({
637
637
  }) {
638
638
  const n = String(r || "").replace(/\/+$/, "");
639
639
  let i = de, o = null;
640
- async function a(l, { method: d = "GET", body: h, auth: u = !1, timeoutMs: p } = {}) {
640
+ async function a(l, { method: d = "GET", body: h, auth: u = !1, timeoutMs: f } = {}) {
641
641
  const y = { Accept: "application/json" };
642
642
  u && Object.assign(y, o ? { Authorization: `Bearer ${o}` } : await s()), h !== void 0 && (y["Content-Type"] = "application/json");
643
643
  let w;
@@ -645,7 +645,7 @@ function dt({
645
645
  w = await e(`${n}${l}`, {
646
646
  method: d,
647
647
  headers: y,
648
- ...p ? { signal: AbortSignal.timeout(p) } : {},
648
+ ...f ? { signal: AbortSignal.timeout(f) } : {},
649
649
  ...h !== void 0 ? { body: JSON.stringify(h) } : {}
650
650
  });
651
651
  } catch (N) {
@@ -701,14 +701,14 @@ function dt({
701
701
  */
702
702
  uploadFile: ({ url: l, file: d, contentType: h, onProgress: u = () => {
703
703
  } }) => {
704
- const p = t();
704
+ const f = t();
705
705
  return { promise: new Promise((w, $) => {
706
- p.open("PUT", l), p.setRequestHeader("Content-Type", h || d.type), p.upload && (p.upload.onprogress = (N) => {
706
+ f.open("PUT", l), f.setRequestHeader("Content-Type", h || d.type), f.upload && (f.upload.onprogress = (N) => {
707
707
  u({ loaded: N.loaded, total: N.total || d.size });
708
- }), p.onload = () => {
709
- p.status >= 200 && p.status < 300 ? w({ status: p.status }) : $(new I(p.status, null));
710
- }, p.onerror = () => $(new I(0, null)), p.onabort = () => $(new I(0, { aborted: !0 })), p.send(d);
711
- }), abort: () => p.abort() };
708
+ }), f.onload = () => {
709
+ f.status >= 200 && f.status < 300 ? w({ status: f.status }) : $(new I(f.status, null));
710
+ }, f.onerror = () => $(new I(0, null)), f.onabort = () => $(new I(0, { aborted: !0 })), f.send(d);
711
+ }), abort: () => f.abort() };
712
712
  },
713
713
  /** @returns {Promise<{requestId,reference,confirmation,routing}>} */
714
714
  putRequest: async (l, d) => await a(`/v1/requests/${l}`, { method: "PUT", body: d, auth: !0 })
@@ -903,10 +903,10 @@ function vt({ baseUrl: r, factsBaseUrl: e }) {
903
903
  function x(r, e) {
904
904
  return (r?.nodes || []).find((t) => t.id === e);
905
905
  }
906
- function L(r) {
906
+ function H(r) {
907
907
  return r?.form ? { formId: r.form, path: [...r.path || []] } : null;
908
908
  }
909
- function H(r, e = []) {
909
+ function q(r, e = []) {
910
910
  const t = [];
911
911
  let s = r?.start;
912
912
  for (const i of e) {
@@ -921,7 +921,7 @@ function H(r, e = []) {
921
921
  const a = (o.options || []).find((l) => l.id === i.optionId);
922
922
  if (!a)
923
923
  return { nodeId: null, node: null, flags: t, error: { step: i, reason: `unknown option: ${i.optionId}` } };
924
- if (L(a))
924
+ if (H(a))
925
925
  return { nodeId: null, node: null, flags: t, error: { step: i, reason: `steps continue past a hand-off: ${i.optionId}` } };
926
926
  t.push(...a.flags || []), s = a.next;
927
927
  continue;
@@ -972,11 +972,11 @@ function kt(r, e = []) {
972
972
  return { steps: [], error: `unknown preset step: ${n}` };
973
973
  t.push({ nodeId: i, kind: "choice", optionId: o, label: l.label, preset: !0 });
974
974
  }
975
- const { error: s } = H(r, t);
975
+ const { error: s } = q(r, t);
976
976
  return s ? { steps: [], error: s.reason } : { steps: t, error: null };
977
977
  }
978
978
  function At(r, e) {
979
- const t = L(e);
979
+ const t = H(e);
980
980
  if (!t) return { form: null, steps: [], error: "not a hand-off" };
981
981
  const s = (r || []).find((o) => o.formId === t.formId);
982
982
  if (!s) return { form: null, steps: [], error: `unknown form: ${t.formId}` };
@@ -999,10 +999,10 @@ function Et(r, e, t) {
999
999
  for (let n = 0; n < r.length; n++) {
1000
1000
  const i = r[n], o = (e || []).find((u) => u.formId === i?.formId);
1001
1001
  if (!o) return [];
1002
- const { node: a, error: l } = H(o, i.steps || []);
1002
+ const { node: a, error: l } = q(o, i.steps || []);
1003
1003
  if (l || a?.id !== i.option?.nodeId) return [];
1004
1004
  const d = (a.options || []).find((u) => u.id === i.option.optionId), h = n + 1 < r.length ? r[n + 1].formId : t;
1005
- if (L(d)?.formId !== h) return [];
1005
+ if (H(d)?.formId !== h) return [];
1006
1006
  s.push({ form: o, steps: i.steps || [], option: i.option });
1007
1007
  }
1008
1008
  return s;
@@ -1269,7 +1269,7 @@ function Qt(r, e, { apiOrigin: t } = {}) {
1269
1269
  return { status: "discarded" };
1270
1270
  const s = (e || []).find((o) => o.formId === r.formId);
1271
1271
  if (!s) return { status: "discarded" };
1272
- const { error: n } = H(s, r.steps || []);
1272
+ const { error: n } = q(s, r.steps || []);
1273
1273
  if (n) return { status: "discarded" };
1274
1274
  const i = {};
1275
1275
  for (const [o, a] of Object.entries(r.media || {}))
@@ -1283,7 +1283,7 @@ function Qt(r, e, { apiOrigin: t } = {}) {
1283
1283
  origins: Et(r.origins, e, s.formId)
1284
1284
  };
1285
1285
  }
1286
- function D(r = []) {
1286
+ function P(r = []) {
1287
1287
  return {
1288
1288
  stage: "idle",
1289
1289
  resumeStage: null,
@@ -1362,7 +1362,7 @@ function Zt(r, e) {
1362
1362
  case "REQUEST_FAIL":
1363
1363
  return { ...r, stage: "requesting-error", error: e.error };
1364
1364
  case "RESET":
1365
- return D([]);
1365
+ return P([]);
1366
1366
  default:
1367
1367
  return r;
1368
1368
  }
@@ -1443,7 +1443,7 @@ class fs extends G {
1443
1443
  /* The gate was passed with an account created on this page load; offered once. */
1444
1444
  #p = !1;
1445
1445
  constructor() {
1446
- super(), this.api = rs, this.factsApi = null, this.flow = null, this._phase = "loading", this._forms = [], this._form = null, this._steps = [], this._origins = [], this._handoffError = !1, this._typing = !1, this._loadingSlow = !1, this._cardValues = {}, this._fieldErrors = {}, this._gate = { stage: null, email: "", error: "", loading: !1 }, this._submit = D([]), this._banner = null, this._notice = null, this._result = null, this._factsOffer = null;
1446
+ super(), this.api = rs, this.factsApi = null, this.flow = null, this._phase = "loading", this._forms = [], this._form = null, this._steps = [], this._origins = [], this._handoffError = !1, this._typing = !1, this._loadingSlow = !1, this._cardValues = {}, this._fieldErrors = {}, this._gate = { stage: null, email: "", error: "", loading: !1 }, this._submit = P([]), this._banner = null, this._notice = null, this._result = null, this._factsOffer = null;
1447
1447
  }
1448
1448
  get client() {
1449
1449
  if (this.#c) return this.#c;
@@ -1541,7 +1541,7 @@ ${this.factsApi || ""}`;
1541
1541
  }, ns)) : this._typing = !1;
1542
1542
  }
1543
1543
  get #_() {
1544
- return this._form ? H(this._form, this._steps) : { node: null };
1544
+ return this._form ? q(this._form, this._steps) : { node: null };
1545
1545
  }
1546
1546
  #E(e) {
1547
1547
  this._form = e, this._steps = [], this._origins = [], this._handoffError = !1, this.#t = null, this.#s = {}, this.#r = {}, this._notice = null, this.#o(), this.#n();
@@ -1550,7 +1550,7 @@ ${this.factsApi || ""}`;
1550
1550
  this._steps = [...this._steps, e], this.#o(), this.#n();
1551
1551
  }
1552
1552
  #H(e, t) {
1553
- if (L(t)) {
1553
+ if (H(t)) {
1554
1554
  this.#q(e, t);
1555
1555
  return;
1556
1556
  }
@@ -1603,7 +1603,7 @@ ${this.factsApi || ""}`;
1603
1603
  this._steps = this._steps.slice(0, -1), e.kind === "collect" && (this._cardValues = { ...e.values }), this.#o(), this.#n({ animate: !1 });
1604
1604
  }
1605
1605
  #$() {
1606
- this.client.endAnonSession?.(), this._form = null, this._steps = [], this._origins = [], this._handoffError = !1, this.#t = null, this.#s = {}, this.#r = {}, this._result = null, this._banner = null, this._notice = null, this._submit = D([]), this._factsOffer = null, be(this.#f), this._phase = "pick";
1606
+ this.client.endAnonSession?.(), this._form = null, this._steps = [], this._origins = [], this._handoffError = !1, this.#t = null, this.#s = {}, this.#r = {}, this._result = null, this._banner = null, this._notice = null, this._submit = P([]), this._factsOffer = null, be(this.#f), this._phase = "pick";
1607
1607
  }
1608
1608
  // ── Collect card ────────────────────────────────────────────────
1609
1609
  #k(e, t) {
@@ -1769,7 +1769,7 @@ ${this.factsApi || ""}`;
1769
1769
  if (!await this.#M()) return;
1770
1770
  } else
1771
1771
  this.client.endAnonSession?.();
1772
- if (this._submit = D(this.#y), this._phase = "submitting", this.#g) {
1772
+ if (this._submit = P(this.#y), this._phase = "submitting", this.#g) {
1773
1773
  this.#e({ type: "START" }), this.#a();
1774
1774
  return;
1775
1775
  }
@@ -1909,7 +1909,7 @@ ${this.factsApi || ""}`;
1909
1909
  switch (this._phase) {
1910
1910
  case "loading":
1911
1911
  return c`${m(V, this._loadingSlow ? "Loading the form list…" : j)}
1912
- ${W()}`;
1912
+ ${D()}`;
1913
1913
  case "load-error":
1914
1914
  return c`
1915
1915
  ${m("We could not load the forms.", "Check your connection and try again.", { error: !0 })}
@@ -1920,7 +1920,7 @@ ${this.factsApi || ""}`;
1920
1920
  case "pick":
1921
1921
  return this.#le();
1922
1922
  case "walk":
1923
- return c`${this.#b()}${this._typing ? W() : this.#ce()}`;
1923
+ return c`${this.#b()}${this._typing ? D() : this.#ce()}`;
1924
1924
  case "review":
1925
1925
  return c`${this.#b()}${this.#U()}`;
1926
1926
  case "submitting":
@@ -1928,7 +1928,7 @@ ${this.factsApi || ""}`;
1928
1928
  case "done":
1929
1929
  return c`${this.#b()}${this.#xe ? this.#_e() : c`${this.#ve()}${this.#we()}`}`;
1930
1930
  default:
1931
- return f;
1931
+ return p;
1932
1932
  }
1933
1933
  }
1934
1934
  #le() {
@@ -1985,12 +1985,12 @@ ${this.factsApi || ""}`;
1985
1985
  }
1986
1986
  #ce() {
1987
1987
  const { node: e, error: t } = this.#_;
1988
- return t || !e ? m("Something went sideways with this form.", "Please start over.", { error: !0 }) : e.type === "choice" ? this.#de(e) : e.type === "collect" ? this.#ue(e) : e.type === "gate" ? this.#P(e) : e.type === "redirect" ? this.#ye(e) : e.type === "terminal" ? this.#U() : f;
1988
+ return t || !e ? m("Something went sideways with this form.", "Please start over.", { error: !0 }) : e.type === "choice" ? this.#de(e) : e.type === "collect" ? this.#ue(e) : e.type === "gate" ? this.#P(e) : e.type === "redirect" ? this.#ye(e) : e.type === "terminal" ? this.#U() : p;
1989
1989
  }
1990
1990
  #de(e) {
1991
1991
  return c`
1992
1992
  ${m(e.prompt, e.help)}
1993
- ${this._handoffError ? m("We could not load the forms.", "Check your connection and try again.", { error: !0 }) : f}
1993
+ ${this._handoffError ? m("We could not load the forms.", "Check your connection and try again.", { error: !0 }) : p}
1994
1994
  <div class="options" role="group" aria-label=${e.prompt || "Choose one"}>
1995
1995
  ${(e.options || []).map((t, s) => c`
1996
1996
  <button type="button" class="chip" style="animation-delay: ${60 + s * 50}ms"
@@ -2021,15 +2021,15 @@ ${this.factsApi || ""}`;
2021
2021
  #he(e, t) {
2022
2022
  const s = this.#C(e.id);
2023
2023
  if (t.kind === "consent" && t.requiredIf === "media" && s === 0)
2024
- return f;
2025
- const n = this._cardValues[t.key], i = this._fieldErrors[t.key], o = !Se(t, { mediaCount: s }) && t.kind !== "consent" ? c` <span class="opt">optional</span>` : f, a = t.kind === "consent" ? f : c`
2024
+ return p;
2025
+ const n = this._cardValues[t.key], i = this._fieldErrors[t.key], o = !Se(t, { mediaCount: s }) && t.kind !== "consent" ? c` <span class="opt">optional</span>` : p, a = t.kind === "consent" ? p : c`
2026
2026
  <label for="f-${t.key}">${t.label}${o}</label>
2027
2027
  `;
2028
2028
  return c`
2029
2029
  <div class="field">
2030
2030
  ${a}
2031
2031
  ${this.#pe(e, t, n)}
2032
- ${i ? c`<div class="err" role="alert">${i}</div>` : f}
2032
+ ${i ? c`<div class="err" role="alert">${i}</div>` : p}
2033
2033
  </div>
2034
2034
  `;
2035
2035
  }
@@ -2083,7 +2083,7 @@ ${this.factsApi || ""}`;
2083
2083
  }}></wral-report-media>
2084
2084
  `;
2085
2085
  default:
2086
- return f;
2086
+ return p;
2087
2087
  }
2088
2088
  }
2089
2089
  #fe(e, t) {
@@ -2138,7 +2138,7 @@ ${this.factsApi || ""}`;
2138
2138
  n.key === "Enter" && this.#A();
2139
2139
  }}>
2140
2140
  </div>
2141
- ${t.error ? c`<div class="err" role="alert">${t.error}</div>` : f}
2141
+ ${t.error ? c`<div class="err" role="alert">${t.error}</div>` : p}
2142
2142
  <button type="button" class="login-btn" ?disabled=${t.loading}
2143
2143
  @click=${() => this.#A()}>
2144
2144
  ${t.loading ? "Sending…" : "Continue with email"}
@@ -2152,7 +2152,7 @@ ${this.factsApi || ""}`;
2152
2152
  <li><a href=${es} target="_blank" rel="noopener">All other My WRAL account benefits</a></li>
2153
2153
  </ul>
2154
2154
  </div>
2155
- ${this._submit.stage === "auth" ? f : this.#ge()}
2155
+ ${this._submit.stage === "auth" ? p : this.#ge()}
2156
2156
  </div>
2157
2157
  ` : t.stage === "anon-confirm" ? this.#me(s) : c`
2158
2158
  ${s}
@@ -2171,7 +2171,7 @@ ${this.factsApi || ""}`;
2171
2171
  @code-complete=${(n) => this.#R(n.detail?.code ?? n.detail?.value ?? n.target.value)}>
2172
2172
  </wral-code-input>
2173
2173
  </div>
2174
- ${t.error ? c`<div class="err" role="alert">${t.error}</div>` : f}
2174
+ ${t.error ? c`<div class="err" role="alert">${t.error}</div>` : p}
2175
2175
  <button type="button" class="login-btn" ?disabled=${t.loading}
2176
2176
  @click=${() => {
2177
2177
  const n = this.renderRoot.querySelector("wral-code-input");
@@ -2184,7 +2184,7 @@ ${this.factsApi || ""}`;
2184
2184
  <button type="button" @click=${() => this.#A()}>resend a new code</button>.
2185
2185
  </p>
2186
2186
  </div>
2187
- ` : c`${s}${W()}`;
2187
+ ` : c`${s}${D()}`;
2188
2188
  }
2189
2189
  /* Collapsed by default: findable for whoever needs it, never the
2190
2190
  * first thing a viewer reaches for. */
@@ -2203,7 +2203,7 @@ ${this.factsApi || ""}`;
2203
2203
  @click=${() => this.#G()}>Send this anonymously</button>
2204
2204
  — no follow-up, and no credit if we use your photos or video.
2205
2205
  </p>
2206
- ` : f}
2206
+ ` : p}
2207
2207
  </div>
2208
2208
  </details>
2209
2209
  `;
@@ -2264,7 +2264,7 @@ ${this.factsApi || ""}`;
2264
2264
  </ul>
2265
2265
  ${this._banner ? c`
2266
2266
  <div class="err" role="alert" style="margin-top: 12px;">${this._banner.message}</div>
2267
- ` : f}
2267
+ ` : p}
2268
2268
  <div style="margin-top: 16px;">
2269
2269
  <button type="button" class="btn-primary" @click=${() => this.#J()}>
2270
2270
  Submit report
@@ -2282,26 +2282,26 @@ ${this.factsApi || ""}`;
2282
2282
  "uploading-error": "One of your files did not upload.",
2283
2283
  requesting: "Sending your report…",
2284
2284
  "requesting-error": this._banner?.message || "We could not send your report."
2285
- }[e.stage] || "Working…";
2285
+ }[e.stage] || "Working…", s = e.stage.endsWith("-error");
2286
2286
  return c`
2287
2287
  ${m("Submitting your report.", t)}
2288
- <div class="form-card">
2289
- ${e.files.map((s, n) => c`
2288
+ ${e.files.length || s ? c`<div class="form-card">
2289
+ ${e.files.map((n, i) => c`
2290
2290
  <div class="upload-row">
2291
- <span class="name">${s.name}</span>
2291
+ <span class="name">${n.name}</span>
2292
2292
  <div class="upload-bar" role="progressbar"
2293
2293
  aria-valuemin="0" aria-valuemax="100"
2294
- aria-valuenow=${Math.round((s.status === "done" ? 1 : s.progress) * 100)}>
2295
- <div class="fill" style="width: ${(s.status === "done" ? 1 : s.progress) * 100}%"></div>
2294
+ aria-valuenow=${Math.round((n.status === "done" ? 1 : n.progress) * 100)}>
2295
+ <div class="fill" style="width: ${(n.status === "done" ? 1 : n.progress) * 100}%"></div>
2296
2296
  </div>
2297
- <span class="state ${s.status === "failed" ? "failed" : ""}">
2298
- ${s.status === "done" ? "Done" : s.status === "failed" ? "Failed" : "Uploading"}
2297
+ <span class="state ${n.status === "failed" ? "failed" : ""}">
2298
+ ${n.status === "done" ? "Done" : n.status === "failed" ? "Failed" : "Uploading"}
2299
2299
  </span>
2300
- ${s.status === "failed" ? c`
2301
- <button type="button" class="retry-chip" @click=${() => this.#te(n)}>
2300
+ ${n.status === "failed" ? c`
2301
+ <button type="button" class="retry-chip" @click=${() => this.#te(i)}>
2302
2302
  Retry
2303
2303
  </button>
2304
- ` : f}
2304
+ ` : p}
2305
2305
  </div>
2306
2306
  `)}
2307
2307
  ${e.stage === "requesting-error" ? c`
@@ -2309,15 +2309,16 @@ ${this.factsApi || ""}`;
2309
2309
  ${this._banner?.retryAfter ? c`
2310
2310
  <div class="file-note">You can try again in about
2311
2311
  ${Math.ceil(this._banner.retryAfter / 60)} minutes.</div>
2312
- ` : f}
2312
+ ` : p}
2313
2313
  <button type="button" class="btn-primary" style="margin-top: 8px;"
2314
2314
  @click=${() => this.#oe()}>Try again</button>
2315
- ` : f}
2315
+ ` : p}
2316
2316
  ${we(e).length && e.stage === "uploading-error" ? c`
2317
2317
  <div class="err" role="alert">Retry the failed
2318
2318
  ${we(e).length === 1 ? "file" : "files"} to continue.</div>
2319
- ` : f}
2320
- </div>
2319
+ ` : p}
2320
+ </div>` : p}
2321
+ ${s ? p : D()}
2321
2322
  `;
2322
2323
  }
2323
2324
  #we() {
@@ -2332,11 +2333,11 @@ ${this.factsApi || ""}`;
2332
2333
  </div>
2333
2334
  </div>
2334
2335
  <p>${t.body}</p>
2335
- ${t.urgentNote ? c`<p>${t.urgentNote}</p>` : f}
2336
+ ${t.urgentNote ? c`<p>${t.urgentNote}</p>` : p}
2336
2337
  ${this._factsOffer?.stage === "saved" ? c`
2337
2338
  <p role="status">Your ${this.#z} ${this._factsOffer.facts.length === 1 ? "is" : "are"}
2338
2339
  saved to your My WRAL account.</p>
2339
- ` : f}
2340
+ ` : p}
2340
2341
  <div class="refs">
2341
2342
  <span class="ref"><span class="rk">Reference</span>${this._result?.reference || ""}</span>
2342
2343
  </div>
@@ -2355,7 +2356,7 @@ ${this.factsApi || ""}`;
2355
2356
  }
2356
2357
  #ve() {
2357
2358
  const e = this._factsOffer?.stage;
2358
- return e === "saved" ? v("Save to my account", { noAnim: !0 }) : e === "dismissed" ? v("No thanks", { noAnim: !0 }) : f;
2359
+ return e === "saved" ? v("Save to my account", { noAnim: !0 }) : e === "dismissed" ? v("No thanks", { noAnim: !0 }) : p;
2359
2360
  }
2360
2361
  #_e() {
2361
2362
  const e = this._factsOffer, t = e.stage === "saving";
@@ -2374,7 +2375,7 @@ ${this.factsApi || ""}`;
2374
2375
  </p>
2375
2376
  ${e.stage === "error" ? c`
2376
2377
  <div class="err" role="alert">We couldn't save these. Please try again.</div>
2377
- ` : f}
2378
+ ` : p}
2378
2379
  <div class="actions">
2379
2380
  <button type="button" class="btn-primary" ?disabled=${t}
2380
2381
  @click=${() => this.#ne()}>
@@ -2460,7 +2461,7 @@ class gs extends G {
2460
2461
  const e = this.files || [], { errors: t } = Y(e, this.budget, { required: !1 });
2461
2462
  return c`
2462
2463
  <input type="file" multiple
2463
- accept=${this.#c || f}
2464
+ accept=${this.#c || p}
2464
2465
  aria-label=${this.label}
2465
2466
  @change=${this.#u}>
2466
2467
  ${e.length ? c`
@@ -2475,14 +2476,14 @@ class gs extends G {
2475
2476
  </li>
2476
2477
  `)}
2477
2478
  </ul>
2478
- ` : f}
2479
+ ` : p}
2479
2480
  ${(this.lostMeta || []).length ? c`
2480
2481
  <div class="lost">
2481
2482
  Please re-attach your ${this.lostMeta.length === 1 ? "file" : "files"}
2482
2483
  (${this.lostMeta.map((s) => s.name).join(", ")}) —
2483
2484
  attachments can't be saved between visits.
2484
2485
  </div>
2485
- ` : f}
2486
+ ` : p}
2486
2487
  ${t.map((s) => c`<div class="err">${s.message}</div>`)}
2487
2488
  `;
2488
2489
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wral/report-it",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "description": "Lit web component for the Report It guided viewer-submission flow on WRAL.com: chat-style form walking, embedded My WRAL sign-in, submit-time media uploads, rendered against api-forms.",
6
6
  "author": "Dominick Jones <djones@wral.com>",