@wral/report-it 0.1.4 → 0.2.1

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/index.mjs CHANGED
@@ -1,25 +1,66 @@
1
- import { W as j, b as K, a as z, c as G, d as J, e as Q } from "./wral-code-input-DCemMj53.js";
2
- const x = "weather", v = "Weather photo or report", q = "Weather reports routed to the weather desk queue; meteorologists are emailed. Severe weather flags urgent.", S = "2026-08-18.1", W = 1, _ = !0, C = "weather_type", T = { maxFiles: 5, maxFileBytes: 524288e3, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp", "video/mp4", "video/quicktime"] }, I = [{ id: "weather_type", type: "choice", prompt: "What kind of weather?", options: [{ id: "severe", label: "Tornado, flooding or hail", flags: ["urgent"], next: "weather_detail" }, { id: "winter", label: "Snow, ice or wind damage", flags: ["moderate"], next: "weather_detail" }, { id: "photo", label: "A photo, nothing severe", next: "weather_detail" }] }, { id: "weather_detail", type: "collect", prompt: "Where and when?", next: "verify", fields: [{ key: "location", kind: "location", label: "Where was this?", required: !0 }, { key: "observedAt", kind: "datetime", label: "When did you see it?" }, { key: "description", kind: "textarea", label: "What did you see?", required: !0, maxLength: 1e3 }, { key: "media", kind: "media", label: "Photos or video" }, { key: "rights", kind: "consent", label: "Rights confirmation", required: !0 }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "studio+email:weather", confirmation: { title: "Sent to the WRAL weather team.", body: "Your report goes to the weather desk queue and the meteorologists are emailed.", urgentNote: "Severe weather reports are pinned to the top of the queue." } }], R = {
3
- formId: x,
4
- title: v,
5
- description: q,
6
- flowVersion: S,
7
- order: W,
8
- enabled: _,
9
- start: C,
10
- budget: T,
11
- nodes: I
12
- }, $ = "consumer", F = "Consumer complaint", Y = "Consumer complaints routed to the 5 On Your Side queue; the consumer team is emailed.", A = "2026-08-18.1", D = 3, O = !0, E = "consumer_company_q", B = { maxFiles: 5, maxFileBytes: 26214400, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp", "application/pdf"] }, L = [{ id: "consumer_company_q", type: "choice", prompt: "Is your complaint about a company or business?", help: "This goes to the 5 On Your Side consumer team.", options: [{ id: "companyyes", label: "Yes, a company or business", next: "consumer_company" }, { id: "companyno", label: "No, something else", next: "consumer_detail" }] }, { id: "consumer_company", type: "collect", prompt: "Tell us about the company.", next: "consumer_detail", fields: [{ key: "company", kind: "text", label: "Company name", required: !0 }, { key: "companysite", kind: "url", label: "Company website or social media" }, { key: "inbusiness", kind: "select", label: "Is the company still in business?", required: !0, options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }, { id: "notsure", label: "Not sure" }] }, { key: "companyphone", kind: "text", label: "Company phone" }] }, { id: "consumer_detail", type: "collect", prompt: "What happened?", next: "consumer_resolution", fields: [{ key: "description", kind: "textarea", label: "Describe your complaint", required: !0, maxLength: 5e3 }, { key: "observedAt", kind: "datetime", label: "When did this happen?" }, { key: "media", kind: "media", label: "Receipts, photos or documents" }] }, { id: "consumer_resolution", type: "collect", prompt: "What has happened since?", help: "These answers help the team decide whether they can take your case.", next: "verify", fields: [{ key: "tried", kind: "textarea", label: "What have you done to try to resolve it?", required: !0, maxLength: 5e3 }, { key: "legal", kind: "select", label: "Have you pursued legal action or consulted an attorney?", required: !0, options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }, { key: "agency", kind: "select", label: "Have you filed with another agency or the Better Business Bureau?", required: !0, options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }, { key: "fair", kind: "textarea", label: "What result do you think is fair?", required: !0, maxLength: 5e3 }, { key: "phone", kind: "text", label: "Daytime phone number", required: !0 }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "studio+email:consumer", confirmation: { title: "Sent to 5 On Your Side.", body: "Your complaint goes to the 5 On Your Side consumer team. They read every complaint and follow up by phone on the ones they pursue." } }], N = {
13
- formId: $,
14
- title: F,
15
- description: Y,
16
- flowVersion: A,
17
- order: D,
18
- enabled: O,
19
- start: E,
20
- budget: B,
21
- nodes: L
22
- }, P = {
1
+ import { W as Oe, b as Be, a as Ce, c as De, d as je, e as Me } from "./wral-code-input-BH_1EP8b.js";
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
+ formId: v,
4
+ title: _,
5
+ description: I,
6
+ flowVersion: L,
7
+ order: $,
8
+ enabled: W,
9
+ start: A,
10
+ budget: S,
11
+ nodes: R
12
+ }, q = "weather", Y = "Weather photo or report", F = "Weather reports routed to the weather desk queue; meteorologists are emailed.", O = "2026-09-25.1", B = 1, C = !0, D = "weather_detail", j = { maxFiles: 5, maxFileBytes: 524288e3, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp", "video/mp4", "video/quicktime"] }, M = [{ id: "weather_detail", type: "collect", prompt: "Tell us about the weather.", next: "verify", fields: [{ key: "description", kind: "textarea", label: "What did you see?", required: !0, maxLength: 1e3 }, { key: "location", kind: "location", label: "Location of your weather report", required: !0 }, { key: "name", kind: "text", label: "Your name", autocomplete: "name", maxLength: 200 }, { key: "phone", kind: "text", label: "Your phone number", inputMode: "tel", autocomplete: "tel", maxLength: 40 }, { 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 or photos 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:weather", confirmation: { title: "Sent to the WRAL weather team.", body: "Your report goes to the weather desk queue and the meteorologists are emailed." } }], N = {
13
+ formId: q,
14
+ title: Y,
15
+ description: F,
16
+ flowVersion: O,
17
+ order: B,
18
+ enabled: C,
19
+ start: D,
20
+ budget: j,
21
+ nodes: M
22
+ }, V = "tech", E = "Technical issue", P = "Technical issues with structured platform, symptom and time fields. On-air problems go to broadcast engineering; digital problems go to tech support by email until Jira Service Management exists.", U = "2026-09-25.1", H = 2, z = !0, Z = "tech_platform", J = { maxFiles: 3, maxFileBytes: 26214400, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp"] }, K = [{ id: "tech_platform", type: "choice", prompt: "Where are you seeing the problem?", options: [{ id: "web", label: "wral.com", next: "tech_symptom" }, { id: "app", label: "iOS or Android app", next: "tech_symptom" }, { id: "ott", label: "Roku, Apple TV, Fire TV or Samsung TV Plus", next: "tech_symptom" }, { id: "onair", label: "On-air broadcast", next: "tech_symptom_onair" }] }, { id: "tech_symptom", type: "choice", prompt: "What is happening?", options: [{ id: "noaudio", label: "No audio", next: "tech_detail" }, { id: "blackscreen", label: "Black screen", next: "tech_detail" }, { id: "crash", label: "Crash or will not open", next: "tech_detail" }, { id: "buffering", label: "Buffering or freezing", next: "tech_detail" }, { id: "wrongcontent", label: "Wrong content playing", next: "tech_detail" }, { id: "other", label: "Something else", next: "tech_detail" }] }, { id: "tech_detail", type: "collect", prompt: "A few details help us reproduce it.", next: "verify", fields: [{ key: "observedAt", kind: "datetime", label: "When did you notice it?" }, { key: "description", kind: "textarea", label: "Describe the problem", placeholder: "What were you watching or doing when it happened?", required: !0, maxLength: 5e3 }, { key: "media", kind: "media", label: "Screenshot" }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "jsm:tech-support", confirmation: { title: "Sent to tech support.", body: "Tech support is emailed your platform, symptom and details." } }, { id: "tech_symptom_onair", type: "choice", prompt: "What is happening?", options: [{ id: "noaudio", label: "No audio", next: "tech_detail_onair" }, { id: "blackscreen", label: "Black screen", next: "tech_detail_onair" }, { id: "wrongcontent", label: "Wrong content playing", next: "tech_detail_onair" }, { id: "other", label: "Something else", next: "tech_detail_onair" }] }, { id: "tech_detail_onair", type: "collect", prompt: "A few details help us reproduce it.", next: "verify_onair", fields: [{ key: "observedAt", kind: "datetime", label: "When did you notice it?" }, { key: "description", kind: "textarea", label: "Describe the problem", placeholder: "What were you watching or doing when it happened?", required: !0, maxLength: 5e3 }, { key: "media", kind: "media", label: "Screenshot" }] }, { id: "verify_onair", type: "gate", next: "submit_onair" }, { id: "submit_onair", type: "terminal", route: "studio+email:tech-onair", confirmation: { title: "Sent to WRAL broadcast engineering.", body: "Broadcast engineering is emailed your symptom and details." } }], G = {
23
+ formId: V,
24
+ title: E,
25
+ description: P,
26
+ flowVersion: U,
27
+ order: H,
28
+ enabled: z,
29
+ start: Z,
30
+ budget: J,
31
+ nodes: K
32
+ }, Q = "consumer", X = "5 On Your Side or WRAL Investigates", ee = "The 5 On Your Side hub. Consumer complaints go to the 5 On Your Side queue and the consumer team is emailed; the Investigates option hands off to the investigates form.", te = "2026-09-25.1", ie = 3, oe = !0, ne = "consumer_kind", ae = { maxFiles: 5, maxFileBytes: 26214400, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp", "video/mp4", "video/quicktime", "application/pdf"] }, se = [{ id: "consumer_kind", type: "choice", prompt: "What would you like to send?", options: [{ id: "fiveoys", label: "5 On Your Side or consumer complaint", next: "consumer_detail" }, { id: "investigates", label: "Something for WRAL Investigates", form: "investigates" }] }, { id: "consumer_detail", type: "collect", prompt: "Tell us about your complaint.", help: "This goes to the 5 On Your Side consumer team.", next: "consumer_company_q", fields: [{ key: "subject", kind: "text", label: "Subject of your complaint", role: "subject", required: !0, maxLength: 200 }, { key: "description", kind: "textarea", label: "Describe your complaint. Be specific and include when this happened.", required: !0, maxLength: 5e3 }] }, { id: "consumer_company_q", type: "choice", prompt: "Is your complaint about a company?", options: [{ id: "companyyes", label: "Yes", next: "consumer_company" }, { id: "companyno", label: "No", next: "consumer_resolution" }] }, { id: "consumer_company", type: "collect", prompt: "Tell us about the company.", next: "consumer_resolution", fields: [{ key: "company", kind: "text", label: "What is the company name?", required: !0 }, { key: "inbusiness", kind: "select", label: "Is the company still in business?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }, { id: "notsure", label: "Not sure" }] }, { key: "companysite", kind: "url", label: "Link to the company's website or social media pages" }] }, { id: "consumer_resolution", type: "collect", prompt: "What has happened since?", next: "consumer_contact", fields: [{ key: "tried", kind: "textarea", label: "What have you done to try to resolve the issue?", maxLength: 5e3 }, { key: "legal", kind: "select", label: "Have you pursued legal action, retained or consulted with an attorney?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }, { key: "agency", kind: "select", label: "Have you filed a complaint with another agency or with the Better Business Bureau?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }, { key: "fair", kind: "textarea", label: "What result do you think is fair?", maxLength: 5e3 }, { 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: "consumer_contact", type: "collect", prompt: "How can the team reach you?", next: "verify", fields: [{ 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" }] }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "studio+email:consumer", confirmation: { title: "Sent to 5 On Your Side.", body: "Your complaint goes to the 5 On Your Side consumer team. They read every complaint and follow up on the ones they pursue." } }], re = {
33
+ formId: Q,
34
+ title: X,
35
+ description: ee,
36
+ flowVersion: te,
37
+ order: ie,
38
+ enabled: oe,
39
+ start: ne,
40
+ budget: ae,
41
+ nodes: se
42
+ }, le = "investigates", de = "Something for WRAL Investigates", me = "Tips for WRAL Investigates, routed to the Investigates queue and emailed to the team. Unlisted: reached from the news and 5 On Your Side forms, or ?flow=investigates.", ce = "2026-09-25.1", ue = 4, pe = !0, he = !1, ye = "investigates_detail", ge = { maxFiles: 10, maxFileBytes: 524288e3, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp", "video/mp4", "video/quicktime", "application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"] }, be = [{ id: "investigates_detail", type: "collect", prompt: "What should we look into?", help: "This goes to the WRAL Investigates team.", next: "investigates_material", fields: [{ key: "subject", kind: "text", label: "Subject of your investigation", role: "subject", required: !0, maxLength: 200 }, { key: "description", kind: "textarea", label: "Describe what we should look into. Be specific and include when this happened.", required: !0, maxLength: 5e3 }, { key: "legal", kind: "select", label: "Have you pursued legal action, retained or consulted with an attorney?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }, { key: "fair", kind: "textarea", label: "What result do you think is fair?", maxLength: 5e3 }] }, { id: "investigates_material", type: "collect", prompt: "Anything to share with us?", next: "investigates_contact", fields: [{ key: "media", kind: "media", label: "Documents, video or photos to upload, such as incident reports or legal paperwork" }, { 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: "investigates_contact", type: "collect", prompt: "How can the team reach you?", next: "verify", fields: [{ 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" }] }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "studio+email:investigates", confirmation: { title: "Sent to WRAL Investigates.", body: "Your tip goes to the WRAL Investigates team. They read every submission and follow up on the ones they pursue." } }], fe = {
43
+ formId: le,
44
+ title: de,
45
+ description: me,
46
+ flowVersion: ce,
47
+ order: ue,
48
+ enabled: pe,
49
+ listed: he,
50
+ start: ye,
51
+ budget: ge,
52
+ nodes: be
53
+ }, we = "community", ke = "Community event, photo or video", xe = "Community events, photos and video for the Studio community review queue (no email). Whether the event is upcoming or past is recorded in the path. Featured media is credited by name.", ve = "2026-09-25.1", _e = 5, Ie = !0, Le = "community_type", $e = { maxFiles: 5, maxFileBytes: 524288e3, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp", "video/mp4", "video/quicktime", "application/pdf"] }, We = [{ id: "community_type", type: "choice", prompt: "What would you like to share?", options: [{ id: "upcoming", label: "Something that's coming up", next: "community_upcoming" }, { id: "past", label: "Something that already happened", next: "community_past" }] }, { id: "community_upcoming", type: "collect", prompt: "Tell us about it.", next: "verify", fields: [{ key: "description", kind: "textarea", label: "Tell us about it. Please include a description, day, time and location.", required: !0, maxLength: 5e3 }, { key: "media", kind: "media", label: "Choose files: upload any photos, video or a press release to preview your event" }, { 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." }, { key: "name", kind: "text", label: "Your name", autocomplete: "name", maxLength: 200 }, { key: "phone", kind: "text", label: "Your phone number", inputMode: "tel", autocomplete: "tel", maxLength: 40 }] }, { id: "community_past", type: "collect", prompt: "Tell us about it.", next: "verify", fields: [{ key: "description", kind: "textarea", label: "Tell us about it. Please include a description, day, time and location.", required: !0, maxLength: 5e3 }, { key: "media", kind: "media", label: "Choose files: upload any photos, video or a press release from your event" }, { 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." }, { key: "name", kind: "text", label: "Your name", autocomplete: "name", maxLength: 200 }, { key: "phone", kind: "text", label: "Your phone number", inputMode: "tel", autocomplete: "tel", maxLength: 40 }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "studio:community", confirmation: { title: "Shared with our editors.", body: "Community submissions go to the review queue. If we feature yours, we credit you by name." } }], Ae = {
54
+ formId: we,
55
+ title: ke,
56
+ description: xe,
57
+ flowVersion: ve,
58
+ order: _e,
59
+ enabled: Ie,
60
+ start: Le,
61
+ budget: $e,
62
+ nodes: We
63
+ }, Se = {
23
64
  formId: "demo-redirect",
24
65
  title: "Demo: a redirect path",
25
66
  description: "Demonstrates the redirect dead-end card.",
@@ -64,119 +105,140 @@ const x = "weather", v = "Weather photo or report", q = "Weather reports routed
64
105
  confirmation: { title: "Thanks!", body: "This demo submission went nowhere." }
65
106
  }
66
107
  ]
67
- }, g = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
68
- function U() {
69
- const m = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10).replace(/-/g, "");
70
- let c = "";
71
- for (let s = 0; s < 5; s++)
72
- c += g[Math.floor(Math.random() * g.length)];
73
- return `RI-${m}-${c}`;
108
+ }, k = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
109
+ function Re(u, m = []) {
110
+ const a = new Map((u?.nodes || []).map((r) => [r.id, r])), h = [...m];
111
+ let o = a.get(u?.start);
112
+ for (let r = 0; o && r < 50; r++) {
113
+ if (o.type === "terminal") return o;
114
+ if (o.type === "choice") {
115
+ const n = String(h.shift() || "").split(":")[1];
116
+ o = a.get((o.options || []).find((y) => y.id === n)?.next);
117
+ continue;
118
+ }
119
+ o = a.get(o.next);
120
+ }
121
+ return null;
122
+ }
123
+ function Te() {
124
+ const u = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10).replace(/-/g, "");
125
+ let m = "";
126
+ for (let a = 0; a < 5; a++)
127
+ m += k[Math.floor(Math.random() * k.length)];
128
+ return `RI-${u}-${m}`;
74
129
  }
75
- function M({ latency: m = 250, anonymous: c = null } = {}) {
76
- const s = [R, N, P], p = /* @__PURE__ */ new Map();
77
- let y = 0, b = !1, i = { email: null, verified: !1 }, h = null;
78
- const a = (e = m) => new Promise((o) => setTimeout(o, e)), f = (e) => {
130
+ function qe({ latency: u = 250, anonymous: m = null } = {}) {
131
+ const a = [T, N, G, re, fe, Ae, Se], h = /* @__PURE__ */ new Map();
132
+ let o = 0, r = !1, n = { email: null, verified: !1 }, y = null, f = !1;
133
+ const l = (e = u) => new Promise((t) => setTimeout(t, e)), g = (e) => {
79
134
  try {
80
135
  return new URLSearchParams(globalThis.location?.search || "").get(e) === "1";
81
136
  } catch {
82
137
  return !1;
83
138
  }
84
- }, k = () => f("demofail"), w = c === null ? f("anon") : !!c;
139
+ }, x = () => g("demofail"), w = m === null ? g("anon") : !!m;
85
140
  return {
86
141
  demo: !0,
87
142
  // ── api surface ─────────────────────────────────────────────
88
- listForms: async () => (await a(), s),
89
- createUploads: async ({ formId: e, files: o }) => {
90
- await a();
91
- const n = s.find((t) => t.formId === e)?.budget || {};
92
- if (o.length > (n.maxFiles ?? 5)) {
93
- const t = new Error("demo: too many files");
94
- throw t.status = 400, t.body = [{ message: `This form accepts at most ${n.maxFiles} files` }], t;
143
+ listForms: async () => (await l(), a),
144
+ createUploads: async ({ formId: e, files: t }) => {
145
+ await l();
146
+ const d = a.find((i) => i.formId === e)?.budget || {};
147
+ if (t.length > (d.maxFiles ?? 5)) {
148
+ const i = new Error("demo: too many files");
149
+ throw i.status = 400, i.body = [{ message: `This form accepts at most ${d.maxFiles} files` }], i;
95
150
  }
96
- return o.map(() => {
97
- const t = crypto.randomUUID();
151
+ return t.map(() => {
152
+ const i = crypto.randomUUID();
98
153
  return {
99
- assetId: t,
100
- url: `demo:${t}`,
154
+ assetId: i,
155
+ url: `demo:${i}`,
101
156
  method: "PUT",
102
157
  expires: new Date(Date.now() + 6e5).toISOString(),
103
- assetUrl: `https://report-it.assets.wral.com/${t}`
158
+ assetUrl: `https://report-it.assets.wral.com/${i}`
104
159
  };
105
160
  });
106
161
  },
107
- uploadFile: ({ file: e, onProgress: o = () => {
162
+ uploadFile: ({ file: e, onProgress: t = () => {
108
163
  } }) => {
109
- y += 1;
110
- const l = y;
111
- let n = !1;
164
+ o += 1;
165
+ const s = o;
166
+ let d = !1;
112
167
  return { promise: (async () => {
113
- const r = e.size || 1;
114
- for (let u = 1; u <= 4; u++) {
115
- if (await a(300), n) {
116
- const d = new Error("aborted");
117
- throw d.status = 0, d.body = { aborted: !0 }, d;
168
+ const c = e.size || 1;
169
+ for (let b = 1; b <= 4; b++) {
170
+ if (await l(300), d) {
171
+ const p = new Error("aborted");
172
+ throw p.status = 0, p.body = { aborted: !0 }, p;
118
173
  }
119
- if (k() && l === 2 && !b && u === 2) {
120
- b = !0;
121
- const d = new Error("demo: simulated upload failure");
122
- throw d.status = 0, d;
174
+ if (x() && s === 2 && !r && b === 2) {
175
+ r = !0;
176
+ const p = new Error("demo: simulated upload failure");
177
+ throw p.status = 0, p;
123
178
  }
124
- o({ loaded: r * u / 4, total: r });
179
+ t({ loaded: c * b / 4, total: c });
125
180
  }
126
181
  return { status: 200 };
127
182
  })(), abort: () => {
128
- n = !0;
183
+ d = !0;
129
184
  } };
130
185
  },
131
- putRequest: async (e, o) => {
132
- if (await a(), !i.verified && h?.requestId !== e) {
133
- const r = new Error("demo: not signed in");
134
- throw r.status = 401, r;
186
+ putRequest: async (e, t) => {
187
+ if (await l(), !n.verified && y?.requestId !== e) {
188
+ const c = new Error("demo: not signed in");
189
+ throw c.status = 401, c;
135
190
  }
136
- if (p.has(e))
137
- return p.get(e);
138
- const n = (s.find((r) => r.formId === o.formId)?.nodes || []).find((r) => r.type === "terminal"), t = {
191
+ if (h.has(e))
192
+ return h.get(e);
193
+ const s = a.find((c) => c.formId === t.formId), d = Re(s, t.path), i = {
139
194
  requestId: e,
140
- reference: U(),
141
- confirmation: n?.confirmation || { title: "Report received.", body: "" },
142
- routing: { destination: n?.route || "email:general", state: "delivered" }
195
+ reference: Te(),
196
+ confirmation: d?.confirmation || { title: "Report received.", body: "" },
197
+ routing: { destination: d?.route || "email:general", state: "delivered" }
143
198
  };
144
- return p.set(e, t), t;
199
+ return h.set(e, i), i;
145
200
  },
146
201
  // ── auth surface ────────────────────────────────────────────
147
- isAuthenticated: async () => i.verified,
148
- signedInEmail: () => i.verified ? i.email : null,
149
- sendCode: async (e) => (await a(), i = { email: e, verified: !1 }, { challengeRequired: !0 }),
202
+ isAuthenticated: async () => n.verified,
203
+ signedInEmail: () => n.verified ? n.email : null,
204
+ sendCode: async (e) => (await l(), n = { email: e, verified: !1 }, { challengeRequired: !0, newAccount: !g("demoexisting") }),
150
205
  verifyCode: async (e) => {
151
- if (await a(), !/^\d{6}$/.test(e))
206
+ if (await l(), !/^\d{6}$/.test(e))
152
207
  throw new Error("Please enter the 6-digit code.");
153
- return i.verified = !0, { success: !0 };
208
+ return n.verified = !0, { success: !0 };
154
209
  },
155
210
  signOut: () => {
156
- i = { email: null, verified: !1 };
211
+ n = { email: null, verified: !1 };
212
+ },
213
+ saveUserFacts: async (e) => {
214
+ if (await l(), !n.verified)
215
+ throw Object.assign(new Error("demo: not signed in"), { status: 401 });
216
+ if (g("demofactsfail") && !f)
217
+ throw f = !0, Object.assign(new Error("demo: simulated user-facts failure"), { status: 0 });
218
+ n.facts = Object.fromEntries(e.map(({ factName: t, value: s }) => [t, s]));
157
219
  },
158
220
  // ── anonymous surface (DEV-1270) ────────────────────────────
159
221
  // The component reads this the way it reads a real server's
160
222
  // GET /v1/forms block: dark unless advertised.
161
223
  anonymousCapability: () => ({ enabled: w, humanCheck: null }),
162
- createAnonSession: async ({ formId: e, requestId: o }) => {
163
- if (await a(), !w) {
164
- const l = new Error("demo: anonymous submission is not available");
165
- throw l.status = 404, l;
224
+ createAnonSession: async ({ formId: e, requestId: t }) => {
225
+ if (await l(), !w) {
226
+ const s = new Error("demo: anonymous submission is not available");
227
+ throw s.status = 404, s;
166
228
  }
167
- return h = { formId: e, requestId: o }, { expiresIn: 900 };
229
+ return y = { formId: e, requestId: t }, { expiresIn: 900 };
168
230
  },
169
231
  endAnonSession: () => {
170
- h = null;
232
+ y = null;
171
233
  }
172
234
  };
173
235
  }
174
236
  export {
175
- j as WralCodeInput,
176
- K as WralReportIt,
177
- z as WralReportMedia,
178
- G as createAuthAdapter,
179
- J as createClient,
180
- M as createDemoClient,
181
- Q as createRealClient
237
+ Oe as WralCodeInput,
238
+ Be as WralReportIt,
239
+ Ce as WralReportMedia,
240
+ De as createAuthAdapter,
241
+ je as createClient,
242
+ qe as createDemoClient,
243
+ Me as createRealClient
182
244
  };