@mushi-mushi/web 1.29.0 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -64,7 +64,8 @@ maintainer deep-dive: [SDK_RUNTIME_CONFIG.md](https://github.com/kensaurus/mushi
64
64
 
65
65
  ## Features
66
66
 
67
- - Shadow-DOM widget with CSS isolation, light/dark auto-theme, keyboard-first (`Esc` / `⌘+Enter`), and `prefers-reduced-motion`.
67
+ - One-screen report: free text first, optional type chips, one attachments row, Send. Reporters see their reports, plain-English statuses, developer replies, and "Fixed in v1.4 — does it work now?" in **Your reports**.
68
+ - Shadow-DOM widget with CSS isolation, host-adaptive theming (CSS tokens), light/dark, keyboard-first (`Esc` / `⌘+Enter`, focus trap), and `prefers-reduced-motion`.
68
69
  - Screenshot, console ring buffer, network (fetch interceptor), Web Vitals, and a repro timeline of routes + clicks.
69
70
  - IndexedDB offline queue with auto-sync, on-device spam pre-filter, client-side rate limiting, and a payload-size guard that degrades instead of wedging the queue.
70
71
  - Host element is zero-sized with `pointer-events: none`; only visible controls opt back in. Verify with `Mushi.diagnose()`.
@@ -121,7 +122,7 @@ Mushi.init({
121
122
  });
122
123
  ```
123
124
 
124
- The details step renders the attached screenshot as a visible preview (not just a checkmark) with a **Remove** control and a configurable privacy caption (`widget.screenshotSensitiveHint`). A "Mark up" overlay lets reporters highlight / blur / arrow before submitting.
125
+ The report screen renders the attached screenshot as a thumbnail (tap to enlarge) with a **Remove** control and a configurable privacy caption (`widget.screenshotSensitiveHint`). A "Mark up" overlay lets reporters highlight / blur / arrow before submitting.
125
126
  </details>
126
127
 
127
128
  <details>
@@ -217,7 +218,7 @@ const mushi = Mushi.init({
217
218
  mushi.show();
218
219
  mushi.hide();
219
220
  mushi.setTrigger('manual'); // switch posture at runtime
220
- mushi.openWith('bug'); // open straight into a category
221
+ mushi.openWith('bug'); // open the report screen with the Bug type picked
221
222
  mushi.attachTo('#support-menu'); // bind the launcher to your element
222
223
  ```
223
224
 
@@ -314,7 +315,20 @@ Screenshot capture uses canvas / SVG `foreignObject` serialization — it does n
314
315
 
315
316
  ## Bundle size
316
317
 
317
- ~7 KB brotli, enforced at 89.5 KB gzipped (105 KB uncompressed) in CI. Requires `@mushi-mushi/core` (installed automatically, not bundled inline). The widget's visual system — washi paper, sumi ink, vermillion 朱 accent, system serif — lives in [`src/styles.ts`](./src/styles.ts).
318
+ ~7 KB brotli, enforced at 89.5 KB gzipped (105 KB uncompressed) in CI. Requires `@mushi-mushi/core` (installed automatically, not bundled inline). The widget looks like part of your app by default: your page's font, system light/dark colours, and an accent taken from `widget.accent`, then your `--mushi-accent`, `accent-color` or `<meta name="theme-color">` (ignored when it would vanish against the panel). Every colour is a CSS token you can set on `:root` or `#mushi-mushi-widget`, and CSS wins over JS config:
319
+
320
+ ```css
321
+ #mushi-mushi-widget {
322
+ --mushi-accent: #b8860b; /* Send button, focus ring */
323
+ --mushi-accent-fg: #000; /* text on the accent */
324
+ --mushi-font: Georgia, serif; /* default: inherit */
325
+ --mushi-bg: Canvas; --mushi-fg: CanvasText;
326
+ /* also: --mushi-muted, --mushi-surface, --mushi-border, --mushi-success,
327
+ --mushi-error, --mushi-radius, --mushi-shadow, --mushi-font-size */
328
+ }
329
+ ```
330
+
331
+ Styles live in [`src/styles.ts`](./src/styles.ts).
318
332
 
319
333
  ## License
320
334
 
@@ -323,4 +337,4 @@ MIT
323
337
  <!-- mushi-readme-stats-footer -->
324
338
  ---
325
339
 
326
- <sub>Monorepo scale (July 2026): 59 edge functions · 374 SQL migrations · 13 outbound plugins · 11 inbound adapters · 19 pipeline agents. Canonical counts: <a href="https://github.com/kensaurus/mushi-mushi/blob/master/docs/stats.md">docs/stats.md</a> · <code>pnpm docs-stats</code></sub>
340
+ <sub>Monorepo scale (July 2026): 64 edge functions · 410 SQL migrations · 13 outbound plugins · 11 inbound adapters · 19 pipeline agents. Canonical counts: <a href="https://github.com/kensaurus/mushi-mushi/blob/master/docs/stats.md">docs/stats.md</a> · <code>pnpm docs-stats</code></sub>
@@ -0,0 +1,34 @@
1
+ // src/capture/display-capture.ts
2
+ async function grabMaskedTabFrame(pendingStream, maskSelectors) {
3
+ const stream = await pendingStream;
4
+ const surface = stream.getVideoTracks?.()[0]?.getSettings?.().displaySurface;
5
+ if (surface && surface !== "browser") {
6
+ stream.getTracks().forEach((track) => track.stop());
7
+ throw Object.assign(new Error("Only this tab can be captured"), { name: "NotAllowedError" });
8
+ }
9
+ const selectors = maskSelectors.join(",");
10
+ const mask = document.createElement("style");
11
+ mask.setAttribute("data-mushi-capture-mask", "");
12
+ mask.textContent = `:is(${selectors}){background:#000!important;color:transparent!important;-webkit-text-fill-color:transparent!important;text-shadow:none!important}:is(${selectors}) *{visibility:hidden!important}`;
13
+ document.head.appendChild(mask);
14
+ const video = document.createElement("video");
15
+ try {
16
+ video.muted = true;
17
+ video.srcObject = stream;
18
+ await video.play();
19
+ await new Promise((resolve) => setTimeout(resolve, 150));
20
+ const canvas = document.createElement("canvas");
21
+ canvas.width = video.videoWidth;
22
+ canvas.height = video.videoHeight;
23
+ canvas.getContext("2d")?.drawImage(video, 0, 0);
24
+ return canvas.toDataURL("image/jpeg", 0.7);
25
+ } finally {
26
+ stream.getTracks().forEach((track) => track.stop());
27
+ video.srcObject = null;
28
+ mask.remove();
29
+ }
30
+ }
31
+
32
+ export { grabMaskedTabFrame };
33
+ //# sourceMappingURL=display-capture-5ZJSTBUK.js.map
34
+ //# sourceMappingURL=display-capture-5ZJSTBUK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/capture/display-capture.ts"],"names":[],"mappings":";AAiBA,eAAsB,kBAAA,CACpB,eACA,aAAA,EACiB;AACjB,EAAA,MAAM,SAAS,MAAM,aAAA;AAKrB,EAAA,MAAM,UAAU,MAAA,CAAO,cAAA,KAAmB,CAAC,CAAA,EAAG,eAAc,CAAE,cAAA;AAC9D,EAAA,IAAI,OAAA,IAAW,YAAY,SAAA,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AA,CAAO,WAAU,CAAE,OAAA,CAAQ,CAAC,KAAA,KAAU,KAAA,CAAM,MAAM,CAAA;AAClD,IAAA,KAAA,CAAM,SAAA,GAAY,IAAA;AAClB,IAAA,IAAA,CAAK,MAAA,EAAO;AAAA,EACd;AACF","file":"display-capture-5ZJSTBUK.js","sourcesContent":["/**\n * Explicit, user-consented fallback for when the DOM capturer can't produce an\n * image: the browser's own picker asks the reporter to share this tab, one\n * frame is grabbed, and every track stops immediately. Loaded lazily — only a\n * reporter who clicks \"Share this tab instead\" pays for it.\n *\n * The caller requests the stream itself, synchronously inside the click\n * (getDisplayMedia needs the transient user activation, which an awaited\n * dynamic import would lose), and passes the pending stream in.\n *\n * A tab share is real pixels, so DOM-level redaction can't reach it. While the\n * frame is taken, a temporary stylesheet blacks out the same sensitive\n * selectors on the live page; the caller passes them (the always-on baseline\n * plus the host's lists) so this chunk imports nothing from the main bundle.\n * The reporter still reviews the preview before anything is sent.\n * Rejects with the browser's error (NotAllowedError when the reporter cancels).\n */\nexport async function grabMaskedTabFrame(\n pendingStream: Promise<MediaStream>,\n maskSelectors: readonly string[],\n): Promise<string> {\n const stream = await pendingStream;\n // Masking only reaches this page: refuse a window or the whole screen rather\n // than capture it unmasked. (A different browser tab also reports 'browser'\n // and can't be told apart here; preferCurrentTab makes this tab the default\n // choice, and the reporter reviews the preview before sending.)\n const surface = stream.getVideoTracks?.()[0]?.getSettings?.().displaySurface;\n if (surface && surface !== 'browser') {\n stream.getTracks().forEach((track) => track.stop());\n throw Object.assign(new Error('Only this tab can be captured'), { name: 'NotAllowedError' });\n }\n const selectors = maskSelectors.join(',');\n const mask = document.createElement('style');\n mask.setAttribute('data-mushi-capture-mask', '');\n mask.textContent =\n `:is(${selectors}){background:#000!important;color:transparent!important;-webkit-text-fill-color:transparent!important;text-shadow:none!important}` +\n `:is(${selectors}) *{visibility:hidden!important}`;\n document.head.appendChild(mask);\n const video = document.createElement('video');\n try {\n video.muted = true;\n video.srcObject = stream;\n await video.play();\n // Let the masked page reach the stream before grabbing a frame.\n await new Promise((resolve) => setTimeout(resolve, 150));\n const canvas = document.createElement('canvas');\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n canvas.getContext('2d')?.drawImage(video, 0, 0);\n return canvas.toDataURL('image/jpeg', 0.7);\n } finally {\n stream.getTracks().forEach((track) => track.stop());\n video.srcObject = null;\n mask.remove();\n }\n}\n"]}
@@ -0,0 +1,132 @@
1
+ // src/capture/screenshot-annotation.ts
2
+ function createScreenshotAnnotation(imageDataUrl, container) {
3
+ return new Promise((resolve, reject) => {
4
+ const img = new Image();
5
+ img.onload = () => {
6
+ const wrap = document.createElement("div");
7
+ wrap.style.position = "relative";
8
+ wrap.style.display = "inline-block";
9
+ wrap.style.maxWidth = "100%";
10
+ const base = document.createElement("canvas");
11
+ const overlay = document.createElement("canvas");
12
+ const scale = Math.min(1, 720 / img.width);
13
+ const w = Math.round(img.width * scale);
14
+ const h = Math.round(img.height * scale);
15
+ for (const c of [base, overlay]) {
16
+ c.width = w;
17
+ c.height = h;
18
+ c.style.width = "100%";
19
+ c.style.height = "auto";
20
+ c.style.display = "block";
21
+ }
22
+ overlay.style.position = "absolute";
23
+ overlay.style.left = "0";
24
+ overlay.style.top = "0";
25
+ overlay.style.cursor = "crosshair";
26
+ const bctx = base.getContext("2d");
27
+ const octx = overlay.getContext("2d");
28
+ if (!bctx || !octx) {
29
+ reject(new Error("Canvas not supported"));
30
+ return;
31
+ }
32
+ bctx.drawImage(img, 0, 0, w, h);
33
+ wrap.appendChild(base);
34
+ wrap.appendChild(overlay);
35
+ container.appendChild(wrap);
36
+ let tool = "highlight";
37
+ let drawing = false;
38
+ let start = null;
39
+ const strokes = [];
40
+ const toLocal = (ev) => {
41
+ const rect = overlay.getBoundingClientRect();
42
+ const touch = "touches" in ev ? ev.touches[0] ?? ev.changedTouches[0] : null;
43
+ const clientX = touch ? touch.clientX : ev.clientX;
44
+ const clientY = touch ? touch.clientY : ev.clientY;
45
+ return {
46
+ x: (clientX - rect.left) / rect.width * w,
47
+ y: (clientY - rect.top) / rect.height * h
48
+ };
49
+ };
50
+ const redraw = () => {
51
+ octx.clearRect(0, 0, w, h);
52
+ for (const s of strokes) {
53
+ if (s.tool === "highlight" && s.points.length >= 2) {
54
+ const [a, b] = s.points;
55
+ octx.fillStyle = "rgba(255, 230, 0, 0.35)";
56
+ octx.fillRect(
57
+ Math.min(a.x, b.x),
58
+ Math.min(a.y, b.y),
59
+ Math.abs(b.x - a.x),
60
+ Math.abs(b.y - a.y)
61
+ );
62
+ } else if (s.tool === "arrow" && s.points.length >= 2) {
63
+ const [a, b] = s.points;
64
+ octx.strokeStyle = "#ef4444";
65
+ octx.lineWidth = 3;
66
+ octx.beginPath();
67
+ octx.moveTo(a.x, a.y);
68
+ octx.lineTo(b.x, b.y);
69
+ octx.stroke();
70
+ }
71
+ }
72
+ };
73
+ const onDown = (ev) => {
74
+ drawing = true;
75
+ start = toLocal(ev);
76
+ };
77
+ const onUp = (ev) => {
78
+ if (!drawing || !start) return;
79
+ drawing = false;
80
+ const end = toLocal(ev);
81
+ if (tool === "blur") {
82
+ const x = Math.min(start.x, end.x);
83
+ const y = Math.min(start.y, end.y);
84
+ const bw = Math.abs(end.x - start.x);
85
+ const bh = Math.abs(end.y - start.y);
86
+ if (bw >= 1 && bh >= 1) {
87
+ bctx.filter = "blur(8px)";
88
+ bctx.drawImage(base, x, y, bw, bh, x, y, bw, bh);
89
+ bctx.filter = "none";
90
+ }
91
+ } else {
92
+ strokes.push({ tool, points: [start, end] });
93
+ }
94
+ start = null;
95
+ redraw();
96
+ };
97
+ overlay.addEventListener("mousedown", onDown);
98
+ overlay.addEventListener("mouseup", onUp);
99
+ overlay.addEventListener("touchstart", onDown, { passive: true });
100
+ overlay.addEventListener("touchend", onUp);
101
+ resolve({
102
+ canvas: base,
103
+ setTool(t) {
104
+ tool = t;
105
+ },
106
+ getDataUrl() {
107
+ const out = document.createElement("canvas");
108
+ out.width = w;
109
+ out.height = h;
110
+ const ctx = out.getContext("2d");
111
+ if (!ctx) return imageDataUrl;
112
+ ctx.drawImage(base, 0, 0);
113
+ ctx.drawImage(overlay, 0, 0);
114
+ return out.toDataURL("image/jpeg", 0.85);
115
+ },
116
+ destroy() {
117
+ overlay.removeEventListener("mousedown", onDown);
118
+ overlay.removeEventListener("mouseup", onUp);
119
+ overlay.removeEventListener("touchstart", onDown);
120
+ overlay.removeEventListener("touchend", onUp);
121
+ wrap.remove();
122
+ }
123
+ });
124
+ };
125
+ img.onerror = () => reject(new Error("Failed to load screenshot"));
126
+ img.src = imageDataUrl;
127
+ });
128
+ }
129
+
130
+ export { createScreenshotAnnotation };
131
+ //# sourceMappingURL=screenshot-annotation-IG7C5B6Z.js.map
132
+ //# sourceMappingURL=screenshot-annotation-IG7C5B6Z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/capture/screenshot-annotation.ts"],"names":[],"mappings":";AAoBO,SAAS,0BAAA,CACd,cACA,SAAA,EAC4B;AAC5B,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,EAAS,MAAA,KAAW;AACtC,IAAA,MAAM,GAAA,GAAM,IAAI,KAAA,EAAM;AACtB,IAAA,GAAA,CAAI,SAAS,MAAM;AACjB,MAAA,MAAM,IAAA,GAAO,QAAA,CAAS,aAAA,CAAc,KAAK,CAAA;AACzC,MAAA,IAAA,CAAK,MAAM,QAAA,GAAW,UAAA;AACtB,MAAA,IAAA,CAAK,MAAM,OAAA,GAAU,cAAA;AACrB,MAAA,IAAA,CAAK,MAAM,QAAA,GAAW,MAAA;AAEtB,MAAA,MAAM,IAAA,GAAO,QAAA,CAAS,aAAA,CAAc,QAAQ,CAAA;AAC5C,MAAA,MAAM,OAAA,GAAU,QAAA,CAAS,aAAA,CAAc,QAAQ,CAAA;AAC/C,MAAA,MAAM,QAAQ,IAAA,CAAK,GAAA,CAAI,CAAA,EAAG,GAAA,GAAM,IAAI,KAAK,CAAA;AACzC,MAAA,MAAM,CA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Q,CAAA;AACZ,UAAA,GAAA,CAAI,MAAA,GAAS,CAAA;AACb,UAAA,MAAM,GAAA,GAAM,GAAA,CAAI,UAAA,CAAW,IAAI,CAAA;AAC/B,UAAA,IAAI,CAAC,KAAK,OAAO,YAAA;AACjB,UAAA,GAAA,CAAI,SAAA,CAAU,IAAA,EAAM,CAAA,EAAG,CAAC,CAAA;AACxB,UAAA,GAAA,CAAI,SAAA,CAAU,OAAA,EAAS,CAAA,EAAG,CAAC,CAAA;AAC3B,UAAA,OAAO,GAAA,CAAI,SAAA,CAAU,YAAA,EAAc,IAAI,CAAA;AAAA,QACzC,CAAA;AAAA,QACA,OAAA,GAAU;AACR,UAAA,OAAA,CAAQ,mBAAA,CAAoB,aAAa,MAAM,CAAA;AAC/C,UAAA,OAAA,CAAQ,mBAAA,CAAoB,WAAW,IAAI,CAAA;AAC3C,UAAA,OAAA,CAAQ,mBAAA,CAAoB,cAAc,MAAM,CAAA;AAChD,UAAA,OAAA,CAAQ,mBAAA,CAAoB,YAAY,IAAI,CAAA;AAC5C,UAAA,IAAA,CAAK,MAAA,EAAO;AAAA,QACd;AAAA,OACD,CAAA;AAAA,IACH,CAAA;AACA,IAAA,GAAA,CAAI,UAAU,MAAM,MAAA,CAAO,IAAI,KAAA,CAAM,2BAA2B,CAAC,CAAA;AACjE,IAAA,GAAA,CAAI,GAAA,GAAM,YAAA;AAAA,EACZ,CAAC,CAAA;AACH","file":"screenshot-annotation-IG7C5B6Z.js","sourcesContent":["/**\n * Lightweight canvas overlay for screenshot markup (highlight / blur / arrow).\n * Blur doubles as client-side PII redaction before upload.\n */\n\nexport type AnnotationTool = 'highlight' | 'blur' | 'arrow'\n\nexport interface AnnotationStroke {\n tool: AnnotationTool\n points: Array<{ x: number; y: number }>\n color?: string\n}\n\nexport interface AnnotationSession {\n canvas: HTMLCanvasElement\n getDataUrl(): string\n setTool(tool: AnnotationTool): void\n destroy(): void\n}\n\nexport function createScreenshotAnnotation(\n imageDataUrl: string,\n container: HTMLElement,\n): Promise<AnnotationSession> {\n return new Promise((resolve, reject) => {\n const img = new Image()\n img.onload = () => {\n const wrap = document.createElement('div')\n wrap.style.position = 'relative'\n wrap.style.display = 'inline-block'\n wrap.style.maxWidth = '100%'\n\n const base = document.createElement('canvas')\n const overlay = document.createElement('canvas')\n const scale = Math.min(1, 720 / img.width)\n const w = Math.round(img.width * scale)\n const h = Math.round(img.height * scale)\n for (const c of [base, overlay]) {\n c.width = w\n c.height = h\n c.style.width = '100%'\n c.style.height = 'auto'\n c.style.display = 'block'\n }\n overlay.style.position = 'absolute'\n overlay.style.left = '0'\n overlay.style.top = '0'\n overlay.style.cursor = 'crosshair'\n\n const bctx = base.getContext('2d')\n const octx = overlay.getContext('2d')\n if (!bctx || !octx) {\n reject(new Error('Canvas not supported'))\n return\n }\n bctx.drawImage(img, 0, 0, w, h)\n\n wrap.appendChild(base)\n wrap.appendChild(overlay)\n container.appendChild(wrap)\n\n let tool: AnnotationTool = 'highlight'\n let drawing = false\n let start: { x: number; y: number } | null = null\n const strokes: AnnotationStroke[] = []\n\n const toLocal = (ev: MouseEvent | TouchEvent): { x: number; y: number } => {\n const rect = overlay.getBoundingClientRect()\n // On `touchend`, `ev.touches` is empty (the finger lifted) — the final\n // coordinates live in `changedTouches`. Reading `touches[0]` there\n // would land every stroke at (0,0) on touch devices.\n const touch = 'touches' in ev ? (ev.touches[0] ?? ev.changedTouches[0]) : null\n const clientX = touch ? touch.clientX : (ev as MouseEvent).clientX\n const clientY = touch ? touch.clientY : (ev as MouseEvent).clientY\n return {\n x: ((clientX - rect.left) / rect.width) * w,\n y: ((clientY - rect.top) / rect.height) * h,\n }\n }\n\n // Blur is baked destructively into `base` (see onUp) so the exported\n // pixels contain no original PII — keep only highlight/arrow on the\n // re-drawable overlay here.\n const redraw = () => {\n octx.clearRect(0, 0, w, h)\n for (const s of strokes) {\n if (s.tool === 'highlight' && s.points.length >= 2) {\n const [a, b] = s.points\n octx.fillStyle = 'rgba(255, 230, 0, 0.35)'\n octx.fillRect(\n Math.min(a.x, b.x),\n Math.min(a.y, b.y),\n Math.abs(b.x - a.x),\n Math.abs(b.y - a.y),\n )\n } else if (s.tool === 'arrow' && s.points.length >= 2) {\n const [a, b] = s.points\n octx.strokeStyle = '#ef4444'\n octx.lineWidth = 3\n octx.beginPath()\n octx.moveTo(a.x, a.y)\n octx.lineTo(b.x, b.y)\n octx.stroke()\n }\n }\n }\n\n const onDown = (ev: MouseEvent | TouchEvent) => {\n drawing = true\n start = toLocal(ev)\n }\n const onUp = (ev: MouseEvent | TouchEvent) => {\n if (!drawing || !start) return\n drawing = false\n const end = toLocal(ev)\n if (tool === 'blur') {\n // Redaction must be irreversible in the exported image: bake an\n // opaque blurred patch into the base canvas, overwriting the\n // original pixels (the overlay's feathered alpha would otherwise\n // leak the source pixels around the region's edge).\n const x = Math.min(start.x, end.x)\n const y = Math.min(start.y, end.y)\n const bw = Math.abs(end.x - start.x)\n const bh = Math.abs(end.y - start.y)\n if (bw >= 1 && bh >= 1) {\n bctx.filter = 'blur(8px)'\n bctx.drawImage(base, x, y, bw, bh, x, y, bw, bh)\n bctx.filter = 'none'\n }\n } else {\n strokes.push({ tool, points: [start, end] })\n }\n start = null\n redraw()\n }\n\n overlay.addEventListener('mousedown', onDown)\n overlay.addEventListener('mouseup', onUp)\n overlay.addEventListener('touchstart', onDown, { passive: true })\n overlay.addEventListener('touchend', onUp)\n\n resolve({\n canvas: base,\n setTool(t: AnnotationTool) {\n tool = t\n },\n getDataUrl() {\n const out = document.createElement('canvas')\n out.width = w\n out.height = h\n const ctx = out.getContext('2d')\n if (!ctx) return imageDataUrl\n ctx.drawImage(base, 0, 0)\n ctx.drawImage(overlay, 0, 0)\n return out.toDataURL('image/jpeg', 0.85)\n },\n destroy() {\n overlay.removeEventListener('mousedown', onDown)\n overlay.removeEventListener('mouseup', onUp)\n overlay.removeEventListener('touchstart', onDown)\n overlay.removeEventListener('touchend', onUp)\n wrap.remove()\n },\n })\n }\n img.onerror = () => reject(new Error('Failed to load screenshot'))\n img.src = imageDataUrl\n })\n}\n"]}
@@ -0,0 +1,233 @@
1
+ import { reporterStatus, fillReporterTemplate, reporterCopy, isReporterConversation, reporterTimelineEntryText } from '@mushi-mushi/core/reporter-ui';
2
+
3
+ // src/widget-views.ts
4
+ var esc;
5
+ var btn;
6
+ var renderHeader;
7
+ var chipLabel;
8
+ var skeleton;
9
+ var formatRelativeTime;
10
+ var renderAppIconHtml;
11
+ function initViews(kit) {
12
+ ({ esc, btn, renderHeader, chipLabel, skeleton, formatRelativeTime, renderAppIconHtml } = kit);
13
+ }
14
+ function pickUpdateToast(reports, lang, repliedText) {
15
+ const unread = reports.filter((r) => (r.unread_count ?? 0) > 0 && !reporterStatus(r, lang).hidden);
16
+ const total = unread.reduce((n, r) => n + (r.unread_count ?? 0), 0);
17
+ if (!total) return null;
18
+ if (unread.length > 1) return { text: fillReporterTemplate(reporterCopy(lang).ui.updates, { n: total }), reportId: null };
19
+ const report = unread[0];
20
+ const status = reporterStatus(report, lang);
21
+ const statusNews = status.key === "fixing" || status.canVerify || !report.last_admin_reply_at && status.key !== "waiting";
22
+ const detail = report.title ?? report.summary ?? void 0;
23
+ return { text: statusNews ? status.label : repliedText, reportId: report.id, ...detail ? { detail } : {} };
24
+ }
25
+ function renderOptIns(ctx) {
26
+ const p = ctx.locale.panel;
27
+ const out = [];
28
+ if (ctx.channels.email && ctx.callbacks.onReporterEmailOptIn) {
29
+ const ui = ctx.rc.ui;
30
+ if (ctx.emailState === "saved") out.push(`<p class="mushi-note" role="status">\u2709 ${esc(ui.emailCheckInbox)}</p>`);
31
+ else {
32
+ out.push(`<label class="mushi-check"><input type="checkbox" data-action="email-optin"${ctx.emailOptInOpen ? " checked" : ""} /> ${esc(ui.emailOptIn)}</label>`);
33
+ if (ctx.emailOptInOpen) {
34
+ out.push(`<div class="mushi-inline-form"><input type="email" class="mushi-input" data-role="optin-email" autocomplete="email" aria-label="${esc(ui.emailOptIn)}" placeholder="${esc(ui.emailPlaceholder)}" value="${esc(ctx.channels.emailPrefill)}" />${btn("save-email", esc(ui.emailSubmit), "mushi-btn", ctx.emailState === "saving" ? ' aria-busy="true"' : "")}</div>${ctx.emailState === "invalid" || ctx.emailState === "error" ? `<p class="mushi-note mushi-error-inline" role="alert">${esc(ctx.emailState === "invalid" ? ui.emailInvalid : ui.emailFailed)}</p>` : ""}`);
35
+ }
36
+ }
37
+ }
38
+ if (ctx.channels.push && ctx.callbacks.onReporterPushSubscribe) {
39
+ out.push(ctx.pushState === "on" ? `<p class="mushi-note" role="status">\u{1F514} ${esc(p.notifyOn)}</p>` : btn("notify-me", `\u{1F514} ${esc(p.notifyMe)}`, "mushi-btn", ctx.pushState === "asking" ? ' aria-busy="true"' : ""));
40
+ if (ctx.pushState === "error") out.push(`<p class="mushi-note mushi-error-inline" role="alert">${esc(ctx.rc.ui.sendFailed)}</p>`);
41
+ }
42
+ return out.length ? `<div class="mushi-optins">${out.join("")}</div>` : "";
43
+ }
44
+ function statusPill(label, tone) {
45
+ return `<span class="mushi-pill mushi-tone-${tone}">${esc(label)}</span>`;
46
+ }
47
+ function reportTitle(r) {
48
+ return r.title ?? r.summary ?? r.description ?? `#${r.id.slice(0, 8)}`;
49
+ }
50
+ function typeLabel(ctx, userCategory) {
51
+ const id = (userCategory ?? "").toLowerCase();
52
+ if (!id || id === "other") return "";
53
+ return chipLabel(ctx, id === "feature_request" ? "idea" : id);
54
+ }
55
+ function orderReports(reports) {
56
+ const at = (r) => Date.parse(r.last_event_at ?? r.created_at) || 0;
57
+ return [...reports].sort((a, b) => Number((b.unread_count ?? 0) > 0) - Number((a.unread_count ?? 0) > 0) || at(b) - at(a));
58
+ }
59
+ function reportRow(ctx, r) {
60
+ const st = reporterStatus(r, ctx.lang);
61
+ if (st.hidden) return "";
62
+ const unread = (r.unread_count ?? 0) > 0;
63
+ const meta = [typeLabel(ctx, r.user_category), r.page, st.othersNote].filter(Boolean).map((x) => esc(String(x))).join(" \xB7 ");
64
+ const news = r.last_event_preview && (unread || st.key === "waiting") ? ctx.rc.ui.developerReplied.replace("{text}", r.last_event_preview) : st.canVerify && st.key !== "fixed_next" ? st.detail : "";
65
+ const title = reportTitle(r);
66
+ return `<button type="button" class="mushi-report-row${unread ? " unread" : ""}" data-report-id="${esc(r.id)}" aria-label="${esc(`${st.label}: ${title}`)}"><span class="mushi-row-top">${statusPill(st.label, st.tone)}<span class="mushi-row-title">${esc(title)}</span><span class="mushi-row-when">${esc(formatRelativeTime(r.last_event_at ?? r.created_at))}</span></span>${meta ? `<span class="mushi-row-meta">${meta}</span>` : ""}${news ? `<span class="mushi-row-news">${esc(news)}</span>` : ""}</button>`;
67
+ }
68
+ function reportsView(ctx) {
69
+ const rc = ctx.rc;
70
+ const rows = orderReports(ctx.reporterReports).map((r) => reportRow(ctx, r)).join("");
71
+ const body = ctx.reporterError ? `<p class="mushi-error-inline" role="alert">${esc(rc.ui.loadError)} ${btn("retry-list", esc(rc.ui.retry), "mushi-link-btn")}</p>${rows}` : rows || (ctx.listLoading ? skeleton(ctx.locale.flows.reports.loading) : `<p class="mushi-empty">${esc(rc.ui.empty)}</p>`);
72
+ return { header: renderHeader(ctx, ctx.locale.flows.reports.title, true), lead: "", body: `<div class="mushi-report-list">${body}</div>`, footer: "" };
73
+ }
74
+ function buildTimeline(ctx, report) {
75
+ const rc = ctx.rc;
76
+ const out = [];
77
+ if (ctx.timeline) {
78
+ for (const e of ctx.timeline) {
79
+ const mine = e.kind === "reporter_comment";
80
+ out.push({
81
+ kind: e.kind,
82
+ at: e.at,
83
+ // Pipeline events re-render from the template in the reporter's
84
+ // language; developer and reporter words are shown as written.
85
+ text: isReporterConversation(e) ? e.body ?? e.text : reporterTimelineEntryText(e, ctx.lang),
86
+ talk: isReporterConversation(e),
87
+ mine,
88
+ who: mine ? rc.ui.you : rc.ui.developer
89
+ });
90
+ }
91
+ } else {
92
+ if (report) out.push({ kind: "received", at: report.created_at, text: rc.timeline.received });
93
+ for (const c of ctx.reporterComments) {
94
+ const mine = c.author_kind === "reporter";
95
+ out.push({ kind: mine ? "reporter_comment" : "comment", at: c.created_at, text: c.body, talk: true, mine, who: mine ? rc.ui.you : c.author_name ?? rc.ui.developer });
96
+ }
97
+ }
98
+ out.sort((a, b) => (Date.parse(a.at) || 0) - (Date.parse(b.at) || 0));
99
+ for (const r of ctx.pendingReplies) out.push({ kind: "reporter_comment", at: "", text: r.body, who: rc.ui.you, talk: true, mine: true, pending: r });
100
+ return out;
101
+ }
102
+ function entryHtml(ctx, e) {
103
+ const when = e.at ? `<time datetime="${esc(e.at)}">${esc(formatRelativeTime(e.at))}</time>` : "";
104
+ if (!e.talk) return `<li class="mushi-event"><span>${esc(e.text)}</span>${when}</li>`;
105
+ const mine = Boolean(e.mine);
106
+ const state = e.pending ? e.pending.state === "sending" ? `<span class="mushi-bubble-state">${esc(ctx.rc.ui.sending)}</span>` : `<span class="mushi-bubble-state mushi-error-inline">${esc(ctx.rc.ui.sendFailed)} \xB7 ${btn("retry-reply", esc(ctx.rc.ui.retry), "mushi-link-btn", ` data-value="${e.pending.id}"`)}</span>` : when;
107
+ return `<li class="mushi-bubble ${mine ? "mine" : "dev"}"><strong>${esc(e.who ?? "")}</strong><p>${esc(e.text)}</p>${state}</li>`;
108
+ }
109
+ function detailView(ctx) {
110
+ const rc = ctx.rc;
111
+ const report = ctx.reporterReports.find((r) => r.id === ctx.selectedReportId);
112
+ const st = reporterStatus(report ?? { status: "new" }, ctx.lang);
113
+ const meta = [report?.page, report?.app_version ? `v${report.app_version}` : "", report ? formatRelativeTime(report.created_at) : ""].filter(Boolean).map((x) => esc(String(x))).join(" \xB7 ");
114
+ const lead = `<div class="mushi-thread-summary"><p class="mushi-card-status">${statusPill(st.label, st.tone)}</p><p class="mushi-note">${esc(st.detail)}${st.othersNote ? ` ${esc(st.othersNote)}.` : ""}</p><p class="mushi-summary-text">${esc(report ? report.description ?? reportTitle(report) : `#${(ctx.selectedReportId ?? "").slice(0, 8)}`)}</p>${report?.screenshot_thumb_url ? `<img class="mushi-card-thumb" src="${esc(report.screenshot_thumb_url)}" alt="" />` : ""}${meta ? `<p class="mushi-note">${meta}</p>` : ""}</div>`;
115
+ const entries = buildTimeline(ctx, report);
116
+ const hasDev = entries.some((e) => e.talk && !e.mine);
117
+ let body;
118
+ if (ctx.threadLoading && entries.length <= 1 && !ctx.pendingReplies.length) {
119
+ body = skeleton(ctx.locale.flows.thread.loading);
120
+ } else {
121
+ body = `${ctx.threadError ? `<p class="mushi-error-inline" role="alert">${esc(rc.ui.loadError)} ${btn("retry-thread", esc(rc.ui.retry), "mushi-link-btn")}</p>` : ""}<ol class="mushi-timeline">${entries.map((e) => entryHtml(ctx, e)).join("")}</ol>${!hasDev && !ctx.threadError && !ctx.threadLoading ? `<p class="mushi-empty">${esc(rc.ui.noReplies)}</p>` : ""}`;
122
+ }
123
+ const busy = ctx.actionPending ? ' disabled aria-busy="true"' : "";
124
+ const verify = st.canVerify ? `<div class="mushi-verify" role="group" aria-label="${esc(st.detail)}">${btn("reporter-confirms", esc(rc.ui.yes), "mushi-btn", busy)}${btn("reporter-not-fixed", esc(rc.ui.notYet), "mushi-btn", busy)}</div>` : "";
125
+ return {
126
+ header: renderHeader(ctx, ctx.locale.panel.reportTitle, true),
127
+ lead,
128
+ body: `<div class="mushi-thread">${body}</div>${renderOptIns(ctx)}`,
129
+ footer: `${verify}${ctx.actionError ? `<p class="mushi-error-inline mushi-thread-action-error" role="alert">${esc(ctx.actionError)}</p>` : ""}<div class="mushi-thread-composer"><textarea class="mushi-input mushi-reply" data-role="reporter-reply" rows="1" maxlength="2000" placeholder="${esc(ctx.locale.flows.thread.replyPlaceholder)}" aria-label="${esc(ctx.locale.flows.thread.replyPlaceholder)}"></textarea>${btn("reporter-reply", "\u2191", "mushi-submit mushi-send", ` aria-label="${esc(ctx.locale.panel.send)}"`)}</div>`
130
+ };
131
+ }
132
+ function assistantView(ctx) {
133
+ const t = ctx.locale.assistant;
134
+ const greeting = ctx.callbacks.assistantGreeting || t.defaultGreeting;
135
+ const chips = (opts) => opts.length ? `<div class="mushi-chips">${opts.map((s) => `<button type="button" class="mushi-chip mushi-chip-sm" data-action="assistant-suggest" data-value="${esc(s)}">${esc(s)}</button>`).join("")}</div>` : "";
136
+ const report = (label, cls = "mushi-link-btn") => btn("assistant-report", esc(label), cls);
137
+ const turns = ctx.assistantTurns.length === 0 ? `<p class="mushi-assistant-greeting">${esc(greeting)}</p>${chips(ctx.callbacks.assistantSuggestions ?? [])}` : ctx.assistantTurns.map((turn) => `<div class="mushi-assistant-msg ${turn.role === "user" ? "mine" : "dev"}">${esc(turn.text)}</div>${chips(turn.options ?? [])}${turn.offerReport ? report(t.fileReportCta, "mushi-btn") : ""}`).join("");
138
+ const thinking = ctx.assistantSending ? `<div class="mushi-assistant-msg dev" role="status" aria-live="polite">${esc(t.thinking)}</div>` : "";
139
+ const error = ctx.assistantError ? `<p class="mushi-error-inline" role="alert">${esc(ctx.assistantError)} ${report(t.fileReportCta)}</p>` : "";
140
+ const stuck = ctx.assistantTurns.length && !ctx.assistantSending && !ctx.assistantError ? report(t.stillStuckCta) : "";
141
+ return {
142
+ header: renderHeader(ctx, ctx.callbacks.assistantLabel || t.defaultLabel, true),
143
+ lead: "",
144
+ body: `<div class="mushi-assistant-log">${turns}${thinking}${error}${stuck}</div>`,
145
+ footer: `<form class="mushi-thread-composer" data-action="assistant-send"><textarea class="mushi-input mushi-reply mushi-assistant-input" rows="1" placeholder="${esc(t.inputPlaceholder)}" aria-label="${esc(t.inputPlaceholder)}"${ctx.assistantSending ? " disabled" : ""}></textarea><button type="submit" class="mushi-submit mushi-send" aria-label="${esc(t.sendAriaLabel)}"${ctx.assistantSending ? " disabled" : ""}>\u2191</button></form>`
146
+ };
147
+ }
148
+ function roadmapView(ctx) {
149
+ const f = ctx.locale.flows.roadmap;
150
+ const rows = ctx.featureBoard.map((ticket) => {
151
+ const id = String(ticket.id ?? "");
152
+ const voted = Boolean(ticket.my_vote);
153
+ const status = ticket.shipped_at ? f.shipped : String(ticket.status_label ?? ticket.status ?? "open");
154
+ return `<div class="mushi-report-row mushi-roadmap-row"><span class="mushi-row-top"><span class="mushi-row-title">${esc(String(ticket.subject ?? f.untitled))}</span></span><span class="mushi-row-meta">${esc(status)} \xB7 ${esc(f.voteCount.replace("{n}", String(Number(ticket.vote_count ?? 0))))}</span>${ctx.callbacks.onFeatureBoardVote ? `<button type="button" class="mushi-btn" data-vote-id="${esc(id)}" aria-pressed="${voted}">${esc(voted ? f.voted : f.vote)}</button>` : ""}</div>`;
155
+ }).join("");
156
+ return {
157
+ header: renderHeader(ctx, f.title, true),
158
+ lead: "",
159
+ body: `${ctx.reporterError ? `<p class="mushi-error-inline" role="alert">${esc(ctx.reporterError)}</p>` : ""}${rows || (ctx.listLoading ? skeleton(f.loading) : `<p class="mushi-empty">${esc(f.empty)}</p>`)}`,
160
+ footer: ""
161
+ };
162
+ }
163
+ function leaderboardView(ctx) {
164
+ const f = ctx.locale.flows.leaderboard;
165
+ const isGlobal = ctx.globalLeaderboard !== null || ctx.globalLeaderboardLoading;
166
+ const entries = isGlobal ? ctx.globalLeaderboard ?? [] : ctx.leaderboardEntries ?? [];
167
+ const loading = isGlobal ? ctx.globalLeaderboardLoading : ctx.leaderboardLoading;
168
+ const rows = entries.map((e, i) => {
169
+ const rank = e.rank || i + 1;
170
+ const me = ctx.testerReputation && e.tester_id === ctx.testerReputation.tester_id;
171
+ return `<li class="mushi-lb-row${me ? " me" : ""}"><span>#${rank}</span><span class="mushi-row-title">${esc(e.public_handle ?? e.display_name ?? f.anon)}</span><span>${(e.points_30d ?? e.total_points).toLocaleString()} pts</span></li>`;
172
+ }).join("");
173
+ const myRank = ctx.testerReputation?.rank;
174
+ return {
175
+ header: renderHeader(ctx, f.title, true),
176
+ lead: "",
177
+ body: `${loading ? skeleton(f.loading) : ""}${!loading && !entries.length ? `<p class="mushi-empty">${esc(f.empty)}</p>` : ""}<ol class="mushi-lb">${rows}</ol>${myRank ? `<p class="mushi-note">${esc(f.myRank.replace("{rank}", String(myRank)))}</p>` : !ctx.testerJwt ? btn("open-account", esc(f.signInPrompt), "mushi-link-btn") : ""}<p class="mushi-note">${esc(f.footer)}</p>`,
178
+ footer: ""
179
+ };
180
+ }
181
+ function accountView(ctx) {
182
+ const f = ctx.locale.flows.account;
183
+ const tester = ctx.testerInfo;
184
+ if (tester) {
185
+ const handle = tester.public_handle ?? tester.display_name ?? ctx.locale.flows.leaderboard.anon;
186
+ const rep = ctx.testerReputation;
187
+ const rank = rep ? f.rankSummary.replace("{rank}", String(rep.rank ?? "\u2014")).replace("{points}", (rep.points_30d ?? 0).toLocaleString()) : "";
188
+ return {
189
+ header: renderHeader(ctx, f.title, true),
190
+ lead: "",
191
+ body: `<div class="mushi-thread-summary"><p class="mushi-summary-text">${esc(handle)}</p>${rank ? `<p class="mushi-note">${esc(rank)}</p>` : ""}</div>${btn("open-cross-app-reports", esc(f.crossAppReports), "mushi-menu-item")}${btn("open-global-leaderboard", esc(f.viewLeaderboard), "mushi-menu-item")}${btn("sign-out-tester", esc(f.signOut), "mushi-link-btn")}`,
192
+ footer: ""
193
+ };
194
+ }
195
+ if (ctx.magicLinkSent) {
196
+ return {
197
+ header: renderHeader(ctx, f.checkEmailTitle, true),
198
+ lead: "",
199
+ body: `<p class="mushi-note">${esc(f.magicLinkSent.replace("{email}", ctx.magicLinkEmail))}</p>${btn("resend-magic-link", esc(f.resendEmail), "mushi-link-btn")}${ctx.magicLinkError ? `<p class="mushi-error-inline" role="alert">${esc(ctx.magicLinkError)}</p>` : ""}`,
200
+ footer: ""
201
+ };
202
+ }
203
+ return {
204
+ header: renderHeader(ctx, f.joinTitle, true),
205
+ lead: "",
206
+ body: `<p class="mushi-note">${esc(f.signInPrompt)}</p><input type="email" class="mushi-input" data-role="magic-link-email" aria-label="${esc(f.emailLabel)}" placeholder="${esc(f.emailPlaceholder)}" autocomplete="email" value="${esc(ctx.magicLinkEmail)}" />${ctx.magicLinkError ? `<p class="mushi-error-inline" role="alert">${esc(ctx.magicLinkError)}</p>` : ""}`,
207
+ footer: `<span></span>${btn("send-magic-link", esc(ctx.magicLinkSending ? f.sending : f.sendLink), "mushi-submit", ctx.magicLinkSending ? ' aria-busy="true"' : "")}`
208
+ };
209
+ }
210
+ function crossAppView(ctx) {
211
+ const f = ctx.locale.flows.crossApp;
212
+ const reports = ctx.crossAppReports ?? [];
213
+ const groups = /* @__PURE__ */ new Map();
214
+ for (const r of reports) {
215
+ const key = r.project_id ?? "unknown";
216
+ if (!groups.has(key)) groups.set(key, { name: r.app_name ?? f.unknownApp, slug: r.app_slug ?? null, domain: r.app_domain ?? null, reports: [] });
217
+ groups.get(key).reports.push(r);
218
+ }
219
+ const html = [...groups.entries()].map(([projectId, g]) => `<section class="mushi-xapp-group"><h3 class="mushi-xapp-app-name">${renderAppIconHtml({ projectId, appName: g.name, appSlug: g.slug, appDomain: g.domain })} ${esc(g.name)}</h3>${g.reports.map((r) => {
220
+ const st = reporterStatus(r, ctx.lang);
221
+ return `<div class="mushi-report-row"><span class="mushi-row-top">${statusPill(st.label, st.tone)}<span class="mushi-row-title">${esc(r.title ?? `#${r.short_id ?? r.id.slice(0, 8)}`)}</span><span class="mushi-row-when">${esc(formatRelativeTime(r.created_at))}</span></span></div>`;
222
+ }).join("")}</section>`).join("");
223
+ return {
224
+ header: renderHeader(ctx, f.title, true),
225
+ lead: "",
226
+ body: `${ctx.crossAppLoading ? skeleton(f.loading) : ""}${!ctx.crossAppLoading && !reports.length ? `<p class="mushi-empty">${esc(f.empty)}</p>` : ""}${html}`,
227
+ footer: ""
228
+ };
229
+ }
230
+
231
+ export { accountView, assistantView, crossAppView, detailView, initViews, leaderboardView, pickUpdateToast, renderOptIns, reportsView, roadmapView };
232
+ //# sourceMappingURL=widget-views-DX3OYHGR.js.map
233
+ //# sourceMappingURL=widget-views-DX3OYHGR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/widget-views.ts"],"names":[],"mappings":";;;AA0BA,IA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,CAAC,CAAA,IAAA,CAAA,GAAS,EAAE,CAAA,EAAG,IAAI,CAAA,CAAA;AAAA,IAC5J,MAAA,EAAQ;AAAA,GACR;AACA","file":"widget-views-DX3OYHGR.js","sourcesContent":["/**\n* FILE: packages/web/src/widget-views.ts\n* PURPOSE: The panel views most visits never open — Your reports (list, detail,\n* timeline, composer), the email / push opt-ins, the update-toast text\n* and the overflow views (Ask, Community ideas, leaderboard, account,\n* cross-app reports). Loaded on demand into dist/chunks/ so a host\n* whose users never open them pays no bytes for them.\n*\n* Runtime imports are limited to the external `@mushi-mushi/core/reporter-ui`:\n* the shared render helpers arrive through `initViews(renderKit)`, so esbuild\n* never hoists main-entry code into a shared chunk.\n*/\nimport type {\nMushiCrossAppReport,\nMushiLeaderboardEntry,\nMushiReporterReport,\n} from '@mushi-mushi/core';\nimport {\nfillReporterTemplate,\nisReporterConversation,\nreporterCopy,\nreporterStatus,\nreporterTimelineEntryText,\n} from '@mushi-mushi/core/reporter-ui';\nimport type { PendingReply } from './widget-helpers';\nimport type { RenderKit, ViewRegions, WidgetRenderCtx } from './widget-render';\nlet esc: RenderKit['esc'];\nlet btn: RenderKit['btn'];\nlet renderHeader: RenderKit['renderHeader'];\nlet chipLabel: RenderKit['chipLabel'];\nlet skeleton: RenderKit['skeleton'];\nlet formatRelativeTime: RenderKit['formatRelativeTime'];\nlet renderAppIconHtml: RenderKit['renderAppIconHtml'];\n/** Called once by the widget right after the chunk loads. */\nexport function initViews(kit: RenderKit): void {\n({ esc, btn, renderHeader, chipLabel, skeleton, formatRelativeTime, renderAppIconHtml } = kit);\n}\n/**\n* The toast for unread updates, or null when there are none. One report:\n* what happened to it (\"Fixed in v1.4\", \"The developer replied…\"). Several:\n* \"3 updates on your reports\".\n*/\nexport function pickUpdateToast(\nreports: MushiReporterReport[],\nlang: string,\nrepliedText: string,\n): { text: string; reportId: string | null; detail?: string } | null {\nconst unread = reports.filter((r) => (r.unread_count ?? 0) > 0 && !reporterStatus(r, lang).hidden);\nconst total = unread.reduce((n, r) => n + (r.unread_count ?? 0), 0);\nif (!total) return null;\nif (unread.length > 1) return { text: fillReporterTemplate(reporterCopy(lang).ui.updates, { n: total }), reportId: null };\nconst report = unread[0]!;\nconst status = reporterStatus(report, lang);\n// A fix (or work on one) is the news; a question or any other update is the\n// developer talking. The report's own title says which report it is.\nconst statusNews = status.key === 'fixing' || status.canVerify || (!report.last_admin_reply_at && status.key !== 'waiting');\nconst detail = report.title ?? report.summary ?? undefined;\nreturn { text: statusNews ? status.label : repliedText, reportId: report.id, ...(detail ? { detail } : {}) };\n}\n/** Email + push opt-ins (§4.1). Never pre-ticked; shown only for configured channels. */\nexport function renderOptIns(ctx: WidgetRenderCtx): string {\nconst p = ctx.locale.panel;\nconst out: string[] = [];\nif (ctx.channels.email && ctx.callbacks.onReporterEmailOptIn) {\nconst ui = ctx.rc.ui;\nif (ctx.emailState === 'saved') out.push(`<p class=\"mushi-note\" role=\"status\">✉ ${esc(ui.emailCheckInbox)}</p>`);\nelse {\nout.push(`<label class=\"mushi-check\"><input type=\"checkbox\" data-action=\"email-optin\"${ctx.emailOptInOpen ? ' checked' : ''} /> ${esc(ui.emailOptIn)}</label>`);\nif (ctx.emailOptInOpen) {\nout.push(`<div class=\"mushi-inline-form\"><input type=\"email\" class=\"mushi-input\" data-role=\"optin-email\" autocomplete=\"email\" aria-label=\"${esc(ui.emailOptIn)}\" placeholder=\"${esc(ui.emailPlaceholder)}\" value=\"${esc(ctx.channels.emailPrefill)}\" />${btn('save-email', esc(ui.emailSubmit), 'mushi-btn', ctx.emailState === 'saving' ? ' aria-busy=\"true\"' : '')}</div>${ctx.emailState === 'invalid' || ctx.emailState === 'error' ? `<p class=\"mushi-note mushi-error-inline\" role=\"alert\">${esc(ctx.emailState === 'invalid' ? ui.emailInvalid : ui.emailFailed)}</p>` : ''}`);\n}\n}\n}\nif (ctx.channels.push && ctx.callbacks.onReporterPushSubscribe) {\nout.push(ctx.pushState === 'on'\n? `<p class=\"mushi-note\" role=\"status\">🔔 ${esc(p.notifyOn)}</p>`\n: btn('notify-me', `🔔 ${esc(p.notifyMe)}`, 'mushi-btn', ctx.pushState === 'asking' ? ' aria-busy=\"true\"' : ''));\nif (ctx.pushState === 'error') out.push(`<p class=\"mushi-note mushi-error-inline\" role=\"alert\">${esc(ctx.rc.ui.sendFailed)}</p>`);\n}\nreturn out.length ? `<div class=\"mushi-optins\">${out.join('')}</div>` : '';\n}\n// ─── Your reports (§2.2) ──────────────────────────────────────────\nfunction statusPill(label: string, tone: string): string {\nreturn `<span class=\"mushi-pill mushi-tone-${tone}\">${esc(label)}</span>`;\n}\nfunction reportTitle(r: MushiReporterReport): string {\nreturn r.title ?? r.summary ?? r.description ?? `#${r.id.slice(0, 8)}`;\n}\n/** Type label for a row: the reporter's own pick, never the internal category. */\nfunction typeLabel(ctx: WidgetRenderCtx, userCategory: string | null | undefined): string {\nconst id = (userCategory ?? '').toLowerCase();\nif (!id || id === 'other') return '';\nreturn chipLabel(ctx, id === 'feature_request' ? 'idea' : id);\n}\n/** Unread first, then newest activity. */\nfunction orderReports(reports: MushiReporterReport[]): MushiReporterReport[] {\nconst at = (r: MushiReporterReport) => Date.parse(r.last_event_at ?? r.created_at) || 0;\nreturn [...reports].sort((a, b) => Number((b.unread_count ?? 0) > 0) - Number((a.unread_count ?? 0) > 0) || at(b) - at(a));\n}\nfunction reportRow(ctx: WidgetRenderCtx, r: MushiReporterReport): string {\nconst st = reporterStatus(r, ctx.lang);\nif (st.hidden) return '';\nconst unread = (r.unread_count ?? 0) > 0;\nconst meta = [typeLabel(ctx, r.user_category), r.page, st.othersNote].filter(Boolean).map((x) => esc(String(x))).join(' · ');\n// Line 3 is the news itself, never a repeat of the pill: the developer's\n// words, or what to do about a fix.\nconst news = r.last_event_preview && (unread || st.key === 'waiting')\n? ctx.rc.ui.developerReplied.replace('{text}', r.last_event_preview)\n: st.canVerify && st.key !== 'fixed_next' ? st.detail : '';\nconst title = reportTitle(r);\nreturn `<button type=\"button\" class=\"mushi-report-row${unread ? ' unread' : ''}\" data-report-id=\"${esc(r.id)}\" aria-label=\"${esc(`${st.label}: ${title}`)}\"><span class=\"mushi-row-top\">${statusPill(st.label, st.tone)}<span class=\"mushi-row-title\">${esc(title)}</span><span class=\"mushi-row-when\">${esc(formatRelativeTime(r.last_event_at ?? r.created_at))}</span></span>${meta ? `<span class=\"mushi-row-meta\">${meta}</span>` : ''}${news ? `<span class=\"mushi-row-news\">${esc(news)}</span>` : ''}</button>`;\n}\nexport function reportsView(ctx: WidgetRenderCtx): ViewRegions {\nconst rc = ctx.rc;\nconst rows = orderReports(ctx.reporterReports).map((r) => reportRow(ctx, r)).join('');\nconst body = ctx.reporterError\n? `<p class=\"mushi-error-inline\" role=\"alert\">${esc(rc.ui.loadError)} ${btn('retry-list', esc(rc.ui.retry), 'mushi-link-btn')}</p>${rows}`\n: rows || (ctx.listLoading ? skeleton(ctx.locale.flows.reports.loading) : `<p class=\"mushi-empty\">${esc(rc.ui.empty)}</p>`);\nreturn { header: renderHeader(ctx, ctx.locale.flows.reports.title, true), lead: '', body: `<div class=\"mushi-report-list\">${body}</div>`, footer: '' };\n}\n// ─── Report detail: card, timeline, composer (§2.3) ──────────────\ninterface Entry { kind: string; at: string; text: string; who?: string; mine?: boolean; talk?: boolean; pending?: PendingReply }\n/** Merge the server timeline (or the comments, on older servers) with replies still in flight. */\nfunction buildTimeline(ctx: WidgetRenderCtx, report: MushiReporterReport | undefined): Entry[] {\nconst rc = ctx.rc;\nconst out: Entry[] = [];\nif (ctx.timeline) {\nfor (const e of ctx.timeline) {\nconst mine = e.kind === 'reporter_comment';\nout.push({\nkind: e.kind,\nat: e.at,\n// Pipeline events re-render from the template in the reporter's\n// language; developer and reporter words are shown as written.\ntext: isReporterConversation(e) ? (e.body ?? e.text) : reporterTimelineEntryText(e, ctx.lang),\ntalk: isReporterConversation(e),\nmine,\nwho: mine ? rc.ui.you : rc.ui.developer,\n});\n}\n} else {\nif (report) out.push({ kind: 'received', at: report.created_at, text: rc.timeline.received });\nfor (const c of ctx.reporterComments) {\nconst mine = c.author_kind === 'reporter';\nout.push({ kind: mine ? 'reporter_comment' : 'comment', at: c.created_at, text: c.body, talk: true, mine, who: mine ? rc.ui.you : (c.author_name ?? rc.ui.developer) });\n}\n}\nout.sort((a, b) => (Date.parse(a.at) || 0) - (Date.parse(b.at) || 0));\nfor (const r of ctx.pendingReplies) out.push({ kind: 'reporter_comment', at: '', text: r.body, who: rc.ui.you, talk: true, mine: true, pending: r });\nreturn out;\n}\nfunction entryHtml(ctx: WidgetRenderCtx, e: Entry): string {\nconst when = e.at ? `<time datetime=\"${esc(e.at)}\">${esc(formatRelativeTime(e.at))}</time>` : '';\nif (!e.talk) return `<li class=\"mushi-event\"><span>${esc(e.text)}</span>${when}</li>`;\nconst mine = Boolean(e.mine);\nconst state = e.pending\n? e.pending.state === 'sending'\n? `<span class=\"mushi-bubble-state\">${esc(ctx.rc.ui.sending)}</span>`\n: `<span class=\"mushi-bubble-state mushi-error-inline\">${esc(ctx.rc.ui.sendFailed)} · ${btn('retry-reply', esc(ctx.rc.ui.retry), 'mushi-link-btn', ` data-value=\"${e.pending.id}\"`)}</span>`\n: when;\nreturn `<li class=\"mushi-bubble ${mine ? 'mine' : 'dev'}\"><strong>${esc(e.who ?? '')}</strong><p>${esc(e.text)}</p>${state}</li>`;\n}\nexport function detailView(ctx: WidgetRenderCtx): ViewRegions {\nconst rc = ctx.rc;\nconst report = ctx.reporterReports.find((r) => r.id === ctx.selectedReportId);\n// Opened via \"Track it\" before the list caught up → it's new.\nconst st = reporterStatus(report ?? { status: 'new' }, ctx.lang);\nconst meta = [report?.page, report?.app_version ? `v${report.app_version}` : '', report ? formatRelativeTime(report.created_at) : '']\n.filter(Boolean).map((x) => esc(String(x))).join(' · ');\nconst lead = `<div class=\"mushi-thread-summary\"><p class=\"mushi-card-status\">${statusPill(st.label, st.tone)}</p><p class=\"mushi-note\">${esc(st.detail)}${st.othersNote ? ` ${esc(st.othersNote)}.` : ''}</p><p class=\"mushi-summary-text\">${esc(report ? (report.description ?? reportTitle(report)) : `#${(ctx.selectedReportId ?? '').slice(0, 8)}`)}</p>${report?.screenshot_thumb_url ? `<img class=\"mushi-card-thumb\" src=\"${esc(report.screenshot_thumb_url)}\" alt=\"\" />` : ''}${meta ? `<p class=\"mushi-note\">${meta}</p>` : ''}</div>`;\nconst entries = buildTimeline(ctx, report);\nconst hasDev = entries.some((e) => e.talk && !e.mine);\nlet body: string;\nif (ctx.threadLoading && entries.length <= 1 && !ctx.pendingReplies.length) {\nbody = skeleton(ctx.locale.flows.thread.loading);\n} else {\nbody = `${ctx.threadError ? `<p class=\"mushi-error-inline\" role=\"alert\">${esc(rc.ui.loadError)} ${btn('retry-thread', esc(rc.ui.retry), 'mushi-link-btn')}</p>` : ''}<ol class=\"mushi-timeline\">${entries.map((e) => entryHtml(ctx, e)).join('')}</ol>${!hasDev && !ctx.threadError && !ctx.threadLoading ? `<p class=\"mushi-empty\">${esc(rc.ui.noReplies)}</p>` : ''}`;\n}\nconst busy = ctx.actionPending ? ' disabled aria-busy=\"true\"' : '';\nconst verify = st.canVerify\n? `<div class=\"mushi-verify\" role=\"group\" aria-label=\"${esc(st.detail)}\">${btn('reporter-confirms', esc(rc.ui.yes), 'mushi-btn', busy)}${btn('reporter-not-fixed', esc(rc.ui.notYet), 'mushi-btn', busy)}</div>`\n: '';\nreturn {\nheader: renderHeader(ctx, ctx.locale.panel.reportTitle, true),\nlead,\nbody: `<div class=\"mushi-thread\">${body}</div>${renderOptIns(ctx)}`,\nfooter: `${verify}${ctx.actionError ? `<p class=\"mushi-error-inline mushi-thread-action-error\" role=\"alert\">${esc(ctx.actionError)}</p>` : ''}<div class=\"mushi-thread-composer\"><textarea class=\"mushi-input mushi-reply\" data-role=\"reporter-reply\" rows=\"1\" maxlength=\"2000\" placeholder=\"${esc(ctx.locale.flows.thread.replyPlaceholder)}\" aria-label=\"${esc(ctx.locale.flows.thread.replyPlaceholder)}\"></textarea>${btn('reporter-reply', '↑', 'mushi-submit mushi-send', ` aria-label=\"${esc(ctx.locale.panel.send)}\"`)}</div>`,\n};\n}\n// ─── Secondary views (overflow menu) ──────────────────────────────\nexport function assistantView(ctx: WidgetRenderCtx): ViewRegions {\nconst t = ctx.locale.assistant;\nconst greeting = ctx.callbacks.assistantGreeting || t.defaultGreeting;\nconst chips = (opts: string[]) => opts.length\n? `<div class=\"mushi-chips\">${opts.map((s) => `<button type=\"button\" class=\"mushi-chip mushi-chip-sm\" data-action=\"assistant-suggest\" data-value=\"${esc(s)}\">${esc(s)}</button>`).join('')}</div>`\n: '';\nconst report = (label: string, cls = 'mushi-link-btn') => btn('assistant-report', esc(label), cls);\nconst turns = ctx.assistantTurns.length === 0\n? `<p class=\"mushi-assistant-greeting\">${esc(greeting)}</p>${chips(ctx.callbacks.assistantSuggestions ?? [])}`\n: ctx.assistantTurns.map((turn) => `<div class=\"mushi-assistant-msg ${turn.role === 'user' ? 'mine' : 'dev'}\">${esc(turn.text)}</div>${chips(turn.options ?? [])}${turn.offerReport ? report(t.fileReportCta, 'mushi-btn') : ''}`).join('');\nconst thinking = ctx.assistantSending ? `<div class=\"mushi-assistant-msg dev\" role=\"status\" aria-live=\"polite\">${esc(t.thinking)}</div>` : '';\nconst error = ctx.assistantError ? `<p class=\"mushi-error-inline\" role=\"alert\">${esc(ctx.assistantError)} ${report(t.fileReportCta)}</p>` : '';\nconst stuck = ctx.assistantTurns.length && !ctx.assistantSending && !ctx.assistantError ? report(t.stillStuckCta) : '';\nreturn {\nheader: renderHeader(ctx, ctx.callbacks.assistantLabel || t.defaultLabel, true),\nlead: '',\nbody: `<div class=\"mushi-assistant-log\">${turns}${thinking}${error}${stuck}</div>`,\nfooter: `<form class=\"mushi-thread-composer\" data-action=\"assistant-send\"><textarea class=\"mushi-input mushi-reply mushi-assistant-input\" rows=\"1\" placeholder=\"${esc(t.inputPlaceholder)}\" aria-label=\"${esc(t.inputPlaceholder)}\"${ctx.assistantSending ? ' disabled' : ''}></textarea><button type=\"submit\" class=\"mushi-submit mushi-send\" aria-label=\"${esc(t.sendAriaLabel)}\"${ctx.assistantSending ? ' disabled' : ''}>↑</button></form>`,\n};\n}\nexport function roadmapView(ctx: WidgetRenderCtx): ViewRegions {\nconst f = ctx.locale.flows.roadmap;\nconst rows = ctx.featureBoard.map((ticket) => {\nconst id = String(ticket.id ?? '');\nconst voted = Boolean(ticket.my_vote);\nconst status = ticket.shipped_at ? f.shipped : String(ticket.status_label ?? ticket.status ?? 'open');\nreturn `<div class=\"mushi-report-row mushi-roadmap-row\"><span class=\"mushi-row-top\"><span class=\"mushi-row-title\">${esc(String(ticket.subject ?? f.untitled))}</span></span><span class=\"mushi-row-meta\">${esc(status)} · ${esc(f.voteCount.replace('{n}', String(Number(ticket.vote_count ?? 0))))}</span>${ctx.callbacks.onFeatureBoardVote ? `<button type=\"button\" class=\"mushi-btn\" data-vote-id=\"${esc(id)}\" aria-pressed=\"${voted}\">${esc(voted ? f.voted : f.vote)}</button>` : ''}</div>`;\n}).join('');\nreturn {\nheader: renderHeader(ctx, f.title, true),\nlead: '',\nbody: `${ctx.reporterError ? `<p class=\"mushi-error-inline\" role=\"alert\">${esc(ctx.reporterError)}</p>` : ''}${rows || (ctx.listLoading ? skeleton(f.loading) : `<p class=\"mushi-empty\">${esc(f.empty)}</p>`)}`,\nfooter: '',\n};\n}\nexport function leaderboardView(ctx: WidgetRenderCtx): ViewRegions {\nconst f = ctx.locale.flows.leaderboard;\nconst isGlobal = ctx.globalLeaderboard !== null || ctx.globalLeaderboardLoading;\nconst entries: Array<Partial<MushiLeaderboardEntry> & { display_name: string | null; points_30d: number; total_points: number }> = isGlobal\n? (ctx.globalLeaderboard ?? [])\n: (ctx.leaderboardEntries ?? []);\nconst loading = isGlobal ? ctx.globalLeaderboardLoading : ctx.leaderboardLoading;\nconst rows = entries.map((e, i) => {\nconst rank = e.rank || i + 1;\nconst me = ctx.testerReputation && e.tester_id === ctx.testerReputation.tester_id;\nreturn `<li class=\"mushi-lb-row${me ? ' me' : ''}\"><span>#${rank}</span><span class=\"mushi-row-title\">${esc(e.public_handle ?? e.display_name ?? f.anon)}</span><span>${(e.points_30d ?? e.total_points).toLocaleString()} pts</span></li>`;\n}).join('');\nconst myRank = ctx.testerReputation?.rank;\nreturn {\nheader: renderHeader(ctx, f.title, true),\nlead: '',\nbody: `${loading ? skeleton(f.loading) : ''}${!loading && !entries.length ? `<p class=\"mushi-empty\">${esc(f.empty)}</p>` : ''}<ol class=\"mushi-lb\">${rows}</ol>${myRank ? `<p class=\"mushi-note\">${esc(f.myRank.replace('{rank}', String(myRank)))}</p>` : !ctx.testerJwt ? btn('open-account', esc(f.signInPrompt), 'mushi-link-btn') : ''}<p class=\"mushi-note\">${esc(f.footer)}</p>`,\nfooter: '',\n};\n}\nexport function accountView(ctx: WidgetRenderCtx): ViewRegions {\nconst f = ctx.locale.flows.account;\nconst tester = ctx.testerInfo;\nif (tester) {\nconst handle = tester.public_handle ?? tester.display_name ?? ctx.locale.flows.leaderboard.anon;\nconst rep = ctx.testerReputation;\nconst rank = rep ? f.rankSummary.replace('{rank}', String(rep.rank ?? '—')).replace('{points}', (rep.points_30d ?? 0).toLocaleString()) : '';\nreturn {\nheader: renderHeader(ctx, f.title, true),\nlead: '',\nbody: `<div class=\"mushi-thread-summary\"><p class=\"mushi-summary-text\">${esc(handle)}</p>${rank ? `<p class=\"mushi-note\">${esc(rank)}</p>` : ''}</div>${btn('open-cross-app-reports', esc(f.crossAppReports), 'mushi-menu-item')}${btn('open-global-leaderboard', esc(f.viewLeaderboard), 'mushi-menu-item')}${btn('sign-out-tester', esc(f.signOut), 'mushi-link-btn')}`,\nfooter: '',\n};\n}\nif (ctx.magicLinkSent) {\nreturn {\nheader: renderHeader(ctx, f.checkEmailTitle, true),\nlead: '',\nbody: `<p class=\"mushi-note\">${esc(f.magicLinkSent.replace('{email}', ctx.magicLinkEmail))}</p>${btn('resend-magic-link', esc(f.resendEmail), 'mushi-link-btn')}${ctx.magicLinkError ? `<p class=\"mushi-error-inline\" role=\"alert\">${esc(ctx.magicLinkError)}</p>` : ''}`,\nfooter: '',\n};\n}\nreturn {\nheader: renderHeader(ctx, f.joinTitle, true),\nlead: '',\nbody: `<p class=\"mushi-note\">${esc(f.signInPrompt)}</p><input type=\"email\" class=\"mushi-input\" data-role=\"magic-link-email\" aria-label=\"${esc(f.emailLabel)}\" placeholder=\"${esc(f.emailPlaceholder)}\" autocomplete=\"email\" value=\"${esc(ctx.magicLinkEmail)}\" />${ctx.magicLinkError ? `<p class=\"mushi-error-inline\" role=\"alert\">${esc(ctx.magicLinkError)}</p>` : ''}`,\nfooter: `<span></span>${btn('send-magic-link', esc(ctx.magicLinkSending ? f.sending : f.sendLink), 'mushi-submit', ctx.magicLinkSending ? ' aria-busy=\"true\"' : '')}`,\n};\n}\nexport function crossAppView(ctx: WidgetRenderCtx): ViewRegions {\nconst f = ctx.locale.flows.crossApp;\nconst reports = ctx.crossAppReports ?? [];\nconst groups = new Map<string, { name: string; slug: string | null; domain: string | null; reports: MushiCrossAppReport[] }>();\nfor (const r of reports) {\nconst key = r.project_id ?? 'unknown';\nif (!groups.has(key)) groups.set(key, { name: r.app_name ?? f.unknownApp, slug: r.app_slug ?? null, domain: r.app_domain ?? null, reports: [] });\ngroups.get(key)!.reports.push(r);\n}\nconst html = [...groups.entries()].map(([projectId, g]) => `<section class=\"mushi-xapp-group\"><h3 class=\"mushi-xapp-app-name\">${renderAppIconHtml({ projectId, appName: g.name, appSlug: g.slug, appDomain: g.domain })} ${esc(g.name)}</h3>${g.reports.map((r) => {\nconst st = reporterStatus(r, ctx.lang);\n// The internal category never reaches a reporter: untitled rows show their short id.\nreturn `<div class=\"mushi-report-row\"><span class=\"mushi-row-top\">${statusPill(st.label, st.tone)}<span class=\"mushi-row-title\">${esc(r.title ?? `#${r.short_id ?? r.id.slice(0, 8)}`)}</span><span class=\"mushi-row-when\">${esc(formatRelativeTime(r.created_at))}</span></span></div>`;\n}).join('')}</section>`).join('');\nreturn {\nheader: renderHeader(ctx, f.title, true),\nlead: '',\nbody: `${ctx.crossAppLoading ? skeleton(f.loading) : ''}${!ctx.crossAppLoading && !reports.length ? `<p class=\"mushi-empty\">${esc(f.empty)}</p>` : ''}${html}`,\nfooter: '',\n};\n}\n"]}