screw-bugs 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +83 -13
  2. package/dist/browser-playwright/page.d.ts +2 -2
  3. package/dist/browser-playwright/page.js +15 -2
  4. package/dist/build-info.json +3 -3
  5. package/dist/cli/commands.js +56 -11
  6. package/dist/cli/mcp.d.ts +11 -4
  7. package/dist/cli/mcp.js +86 -23
  8. package/dist/cli/operations.d.ts +30 -2
  9. package/dist/cli/operations.js +126 -20
  10. package/dist/cli/report-links.js +2 -2
  11. package/dist/cli/report-server.d.ts +41 -9
  12. package/dist/cli/report-server.js +139 -23
  13. package/dist/cli/share.d.ts +71 -4
  14. package/dist/cli/share.js +540 -109
  15. package/dist/cli/sign-in.d.ts +22 -10
  16. package/dist/cli/sign-in.js +23 -23
  17. package/dist/core/engine.js +45 -10
  18. package/dist/core/liveness.js +3 -1
  19. package/dist/core/services.d.ts +24 -4
  20. package/dist/core/share.d.ts +31 -0
  21. package/dist/core/share.js +139 -0
  22. package/dist/core/steps.d.ts +5 -0
  23. package/dist/core/steps.js +15 -1
  24. package/dist/report/html.d.ts +4 -2
  25. package/dist/report/html.js +36 -13
  26. package/dist/report/icons.d.ts +3 -0
  27. package/dist/report/icons.js +5 -1
  28. package/dist/report/index.d.ts +3 -1
  29. package/dist/report/index.js +3 -1
  30. package/dist/report/live.d.ts +7 -0
  31. package/dist/report/live.js +135 -0
  32. package/dist/report/menu-bar.d.ts +3 -3
  33. package/dist/report/menu-bar.js +3 -3
  34. package/dist/report/player.d.ts +3 -3
  35. package/dist/report/player.js +3 -3
  36. package/dist/report/share-page.d.ts +48 -0
  37. package/dist/report/share-page.js +291 -0
  38. package/dist/report/styles.d.ts +2 -0
  39. package/dist/report/styles.js +2 -2
  40. package/dist/report/view.js +2 -0
  41. package/dist/report/walkthrough.d.ts +5 -2
  42. package/dist/report/walkthrough.js +17 -5
  43. package/dist/schema/accounts.js +10 -1
  44. package/dist/schema/evidence.d.ts +15 -8
  45. package/dist/schema/evidence.js +9 -4
  46. package/dist/schema/findings.js +1 -1
  47. package/dist/schema/job.d.ts +205 -65
  48. package/dist/schema/job.js +63 -11
  49. package/dist/schema/ledger.d.ts +80 -16
  50. package/dist/schema/ledger.js +36 -0
  51. package/dist/schema/share.d.ts +17 -0
  52. package/dist/schema/share.js +22 -0
  53. package/package.json +1 -1
@@ -0,0 +1,48 @@
1
+ /** The quality the upload's page encodes screenshots with (0 to 1). */
2
+ export declare const SHARE_WEBP_QUALITY = 0.8;
3
+ /** How often the upload's page asks how the share is going, in milliseconds. */
4
+ export declare const SHARE_POLL_MS = 500;
5
+ /** Plain ES2020, without backslashes. */
6
+ export declare const SHARE_PAGE_SCRIPT = "(() => {\n const d = document, r = d.documentElement, K = 'screw-bugs-theme';\n let theme = 'system'; try { theme = localStorage.getItem(K) || theme; } catch (e) {} r.dataset.theme = theme;\n const themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\n const t = d.querySelector('.menubar .theme'); if (t) { themeCycle(t, K); t.hidden = false; }\n const c = d.getElementById('copy');\n if (c) {\n const label = c.querySelector('.copy-label'), was = label.textContent;\n let timer;\n c.hidden = false;\n c.addEventListener('click', async () => {\n const code = c.dataset.code;\n let ok = false;\n try { await navigator.clipboard.writeText(code); ok = true; } catch (e) {}\n if (!ok) {\n const a = d.createElement('textarea');\n a.value = code; a.setAttribute('readonly', ''); a.style.position = 'fixed'; a.style.opacity = '0';\n d.body.append(a); a.select();\n try { ok = d.execCommand('copy'); } catch (e) {}\n a.remove();\n }\n label.textContent = ok ? 'Copied' : 'Select the code to copy it';\n c.classList.toggle('copied', ok);\n clearTimeout(timer);\n timer = setTimeout(() => { label.textContent = was; c.classList.remove('copied'); }, 2000);\n });\n }\n const b = d.body.dataset;\n if (b.refresh) setTimeout(() => location.reload(), Number(b.refresh) * 1000);\n if (b.wait) {\n const tick = async () => {\n try {\n const res = await fetch(location.href, { redirect: 'manual', cache: 'no-store' });\n if (res.type === 'opaqueredirect' || res.status !== 200) return location.reload();\n // The page's own phase, read from its body (the text also holds this script).\n const next = new DOMParser().parseFromString(await res.text(), 'text/html').body;\n if (next.dataset.phase !== 'pairing') return location.reload();\n } catch (e) {}\n setTimeout(tick, Number(b.wait) * 1000);\n };\n setTimeout(tick, Number(b.wait) * 1000);\n }\n if (b.phase === 'following') {\n const ask = (route, path) =>\n route + '?state=' + encodeURIComponent(b.state) +\n (path === undefined ? '' : '&path=' + encodeURIComponent(path));\n const text = d.getElementById('text'), bar = d.getElementById('bar');\n const shot = d.getElementById('shot'), name = d.getElementById('name');\n let shown;\n const show = (path) => {\n if (path === shown) return;\n shown = path;\n name.textContent = path === undefined ? '' : path;\n if (path !== undefined && /[.](png|jpe?g|webp)$/i.test(path)) {\n shot.src = '/' + encodeURIComponent(b.run) + '/' + path.split('/').map(encodeURIComponent).join('/');\n shot.hidden = false;\n } else {\n shot.hidden = true;\n shot.removeAttribute('src');\n }\n };\n const say = (sentence, done, total) => {\n text.textContent = sentence;\n if (total > 0) { bar.max = total; bar.value = done; } else bar.removeAttribute('value');\n };\n const webp = async (blob) => {\n const bitmap = await createImageBitmap(blob);\n try {\n if (typeof OffscreenCanvas === 'function') {\n const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);\n canvas.getContext('2d', { alpha: false }).drawImage(bitmap, 0, 0);\n return await canvas.convertToBlob({ type: 'image/webp', quality: 0.8 });\n }\n const canvas = d.createElement('canvas');\n canvas.width = bitmap.width;\n canvas.height = bitmap.height;\n canvas.getContext('2d', { alpha: false }).drawImage(bitmap, 0, 0);\n return await new Promise((done) => canvas.toBlob(done, 'image/webp', 0.8));\n } finally {\n bitmap.close();\n }\n };\n // Each screenshot once, one at a time; anything that goes wrong hands back nothing, and the\n // original goes up instead. A 410 means the server stopped waiting.\n let encoding = false;\n const encode = async (files) => {\n encoding = true;\n for (const file of files) {\n show(file.path);\n let made = null;\n try {\n const source = await fetch(ask(b.source, file.path), { cache: 'no-store' });\n if (source.ok) {\n const blob = await webp(await source.blob());\n if (blob && blob.type === 'image/webp' && blob.size < file.size) made = blob;\n }\n } catch (e) {}\n let answer;\n try {\n answer = await fetch(ask(b.encoded, file.path), {\n method: 'POST',\n headers: { 'content-type': 'image/webp' },\n body: made || new Blob([]),\n });\n } catch (e) {\n return;\n }\n if (answer.status === 410) return;\n }\n };\n const poll = async () => {\n let status;\n try {\n const answer = await fetch(ask(b.status), { cache: 'no-store' });\n if (answer.status !== 200) return location.reload();\n status = await answer.json();\n } catch (e) {\n return setTimeout(poll, 500 * 4);\n }\n if (status.phase === 'preparing') {\n say('Making the screenshots smaller: ' + status.settled + ' of ' + status.files.length + '.', status.settled, status.files.length);\n if (!encoding) encode(status.files);\n } else if (status.phase === 'uploading') {\n say(\n status.total === 0\n ? 'Uploading the report\u2026'\n : 'Uploading screenshots and videos: ' + status.done + ' of ' + status.total + '.',\n status.done,\n status.total,\n );\n show(status.current[status.current.length - 1]);\n } else return location.reload();\n setTimeout(poll, 500);\n };\n poll();\n }\n})();";
7
+ /**
8
+ * The pages' policy: their own styles and script, the fonts, nothing else; never in a frame. A
9
+ * page with a form may post it to this server, then follow its redirect to `formTo` (Cloud).
10
+ */
11
+ export declare const sharePageCsp: (formTo?: string) => string;
12
+ export interface SharePage {
13
+ readonly title: string;
14
+ /** Plain text under the title. */
15
+ readonly text: string;
16
+ /** A failure: the title in the failure color. */
17
+ readonly failed?: boolean;
18
+ /** A pairing code to show large, with a Copy button; the page then waits for it to be used. */
19
+ readonly code?: string;
20
+ /** How often the code's page asks whether it moved on, in seconds. */
21
+ readonly wait?: number;
22
+ /** A link to open in a new tab, as the main button. */
23
+ readonly link?: {
24
+ readonly href: string;
25
+ readonly text: string;
26
+ };
27
+ /** A button that posts to `action` on this server, as the main button. */
28
+ readonly form?: {
29
+ readonly action: string;
30
+ readonly label: string;
31
+ };
32
+ /** The report to go back to. */
33
+ readonly back?: string;
34
+ /** Reload after this many seconds (without script, for the upload's page). */
35
+ readonly refresh?: number;
36
+ /** The upload's page: it follows the share `state` of the run `run` live, at `routes`. */
37
+ readonly follow?: {
38
+ readonly state: string;
39
+ readonly run: string;
40
+ readonly routes: {
41
+ readonly status: string;
42
+ readonly source: string;
43
+ readonly encoded: string;
44
+ };
45
+ };
46
+ }
47
+ /** A page of the Share button's routes (see the top of this file). */
48
+ export declare const renderSharePage: (page: SharePage) => string;
@@ -0,0 +1,291 @@
1
+ import { favicon, html, icon, Markup, webFonts } from './markup.js';
2
+ import { githubLink, menuBar, THEME_BUTTON_JS, themeButton } from './menu-bar.js';
3
+ import { cspHash } from './sha256.js';
4
+ import { styles } from './styles.js';
5
+ /*
6
+ * The pages of the Share button's routes on the local report server (`src/cli/share.ts`): asking
7
+ * before a share, the pairing code to type on Screw Bugs Cloud, the upload's progress, and what
8
+ * went wrong. In the reports' look: their menu bar, tokens and type, one card in the middle.
9
+ *
10
+ * Their one script (`SHARE_PAGE_SCRIPT`, allowed by its hash) keeps the theme the reports keep,
11
+ * copies the pairing code (`navigator.clipboard`, which an `http:` tailnet address does not have,
12
+ * else a selected text area), and moves the page on: a page with `data-refresh` reloads after that
13
+ * many seconds; the pairing code's page (`data-phase="pairing"`) asks for itself again every
14
+ * `data-wait` seconds and reloads only once it is no longer the code (so a copy or a selection is
15
+ * not lost every few seconds). Without the script, a meta refresh does both.
16
+ *
17
+ * The upload's page (`data-phase="following"`) follows the share live instead: it asks how it is
18
+ * going (`status`, as JSON) and shows the screenshot going up right now. While the server prepares
19
+ * the share, it makes the screenshots smaller: it fetches each one (`source`), encodes it as WebP
20
+ * at its own size and hands it back (`encoded`), or hands back nothing when it cannot (an empty
21
+ * body: a browser without a WebP encoder, such as Safari, or one that fails). The upload never
22
+ * needs the page; it goes on with the original files when the page is closed or has no script.
23
+ */
24
+ /** The quality the upload's page encodes screenshots with (0 to 1). */
25
+ export const SHARE_WEBP_QUALITY = 0.8;
26
+ /** How often the upload's page asks how the share is going, in milliseconds. */
27
+ export const SHARE_POLL_MS = 500;
28
+ /** Plain ES2020, without backslashes. */
29
+ export const SHARE_PAGE_SCRIPT = `(() => {
30
+ const d = document, r = d.documentElement, K = 'screw-bugs-theme';
31
+ let theme = 'system'; try { theme = localStorage.getItem(K) || theme; } catch (e) {} r.dataset.theme = theme;
32
+ ${THEME_BUTTON_JS}
33
+ const t = d.querySelector('.menubar .theme'); if (t) { themeCycle(t, K); t.hidden = false; }
34
+ const c = d.getElementById('copy');
35
+ if (c) {
36
+ const label = c.querySelector('.copy-label'), was = label.textContent;
37
+ let timer;
38
+ c.hidden = false;
39
+ c.addEventListener('click', async () => {
40
+ const code = c.dataset.code;
41
+ let ok = false;
42
+ try { await navigator.clipboard.writeText(code); ok = true; } catch (e) {}
43
+ if (!ok) {
44
+ const a = d.createElement('textarea');
45
+ a.value = code; a.setAttribute('readonly', ''); a.style.position = 'fixed'; a.style.opacity = '0';
46
+ d.body.append(a); a.select();
47
+ try { ok = d.execCommand('copy'); } catch (e) {}
48
+ a.remove();
49
+ }
50
+ label.textContent = ok ? 'Copied' : 'Select the code to copy it';
51
+ c.classList.toggle('copied', ok);
52
+ clearTimeout(timer);
53
+ timer = setTimeout(() => { label.textContent = was; c.classList.remove('copied'); }, 2000);
54
+ });
55
+ }
56
+ const b = d.body.dataset;
57
+ if (b.refresh) setTimeout(() => location.reload(), Number(b.refresh) * 1000);
58
+ if (b.wait) {
59
+ const tick = async () => {
60
+ try {
61
+ const res = await fetch(location.href, { redirect: 'manual', cache: 'no-store' });
62
+ if (res.type === 'opaqueredirect' || res.status !== 200) return location.reload();
63
+ // The page's own phase, read from its body (the text also holds this script).
64
+ const next = new DOMParser().parseFromString(await res.text(), 'text/html').body;
65
+ if (next.dataset.phase !== 'pairing') return location.reload();
66
+ } catch (e) {}
67
+ setTimeout(tick, Number(b.wait) * 1000);
68
+ };
69
+ setTimeout(tick, Number(b.wait) * 1000);
70
+ }
71
+ if (b.phase === 'following') {
72
+ const ask = (route, path) =>
73
+ route + '?state=' + encodeURIComponent(b.state) +
74
+ (path === undefined ? '' : '&path=' + encodeURIComponent(path));
75
+ const text = d.getElementById('text'), bar = d.getElementById('bar');
76
+ const shot = d.getElementById('shot'), name = d.getElementById('name');
77
+ let shown;
78
+ const show = (path) => {
79
+ if (path === shown) return;
80
+ shown = path;
81
+ name.textContent = path === undefined ? '' : path;
82
+ if (path !== undefined && /[.](png|jpe?g|webp)$/i.test(path)) {
83
+ shot.src = '/' + encodeURIComponent(b.run) + '/' + path.split('/').map(encodeURIComponent).join('/');
84
+ shot.hidden = false;
85
+ } else {
86
+ shot.hidden = true;
87
+ shot.removeAttribute('src');
88
+ }
89
+ };
90
+ const say = (sentence, done, total) => {
91
+ text.textContent = sentence;
92
+ if (total > 0) { bar.max = total; bar.value = done; } else bar.removeAttribute('value');
93
+ };
94
+ const webp = async (blob) => {
95
+ const bitmap = await createImageBitmap(blob);
96
+ try {
97
+ if (typeof OffscreenCanvas === 'function') {
98
+ const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
99
+ canvas.getContext('2d', { alpha: false }).drawImage(bitmap, 0, 0);
100
+ return await canvas.convertToBlob({ type: 'image/webp', quality: ${SHARE_WEBP_QUALITY} });
101
+ }
102
+ const canvas = d.createElement('canvas');
103
+ canvas.width = bitmap.width;
104
+ canvas.height = bitmap.height;
105
+ canvas.getContext('2d', { alpha: false }).drawImage(bitmap, 0, 0);
106
+ return await new Promise((done) => canvas.toBlob(done, 'image/webp', ${SHARE_WEBP_QUALITY}));
107
+ } finally {
108
+ bitmap.close();
109
+ }
110
+ };
111
+ // Each screenshot once, one at a time; anything that goes wrong hands back nothing, and the
112
+ // original goes up instead. A 410 means the server stopped waiting.
113
+ let encoding = false;
114
+ const encode = async (files) => {
115
+ encoding = true;
116
+ for (const file of files) {
117
+ show(file.path);
118
+ let made = null;
119
+ try {
120
+ const source = await fetch(ask(b.source, file.path), { cache: 'no-store' });
121
+ if (source.ok) {
122
+ const blob = await webp(await source.blob());
123
+ if (blob && blob.type === 'image/webp' && blob.size < file.size) made = blob;
124
+ }
125
+ } catch (e) {}
126
+ let answer;
127
+ try {
128
+ answer = await fetch(ask(b.encoded, file.path), {
129
+ method: 'POST',
130
+ headers: { 'content-type': 'image/webp' },
131
+ body: made || new Blob([]),
132
+ });
133
+ } catch (e) {
134
+ return;
135
+ }
136
+ if (answer.status === 410) return;
137
+ }
138
+ };
139
+ const poll = async () => {
140
+ let status;
141
+ try {
142
+ const answer = await fetch(ask(b.status), { cache: 'no-store' });
143
+ if (answer.status !== 200) return location.reload();
144
+ status = await answer.json();
145
+ } catch (e) {
146
+ return setTimeout(poll, ${SHARE_POLL_MS} * 4);
147
+ }
148
+ if (status.phase === 'preparing') {
149
+ say('Making the screenshots smaller: ' + status.settled + ' of ' + status.files.length + '.', status.settled, status.files.length);
150
+ if (!encoding) encode(status.files);
151
+ } else if (status.phase === 'uploading') {
152
+ say(
153
+ status.total === 0
154
+ ? 'Uploading the report…'
155
+ : 'Uploading screenshots and videos: ' + status.done + ' of ' + status.total + '.',
156
+ status.done,
157
+ status.total,
158
+ );
159
+ show(status.current[status.current.length - 1]);
160
+ } else return location.reload();
161
+ setTimeout(poll, ${SHARE_POLL_MS});
162
+ };
163
+ poll();
164
+ }
165
+ })();`;
166
+ /**
167
+ * The pages' policy: their own styles and script, the fonts, nothing else; never in a frame. A
168
+ * page with a form may post it to this server, then follow its redirect to `formTo` (Cloud).
169
+ */
170
+ export const sharePageCsp = (formTo) => "default-src 'none'; img-src 'self' data:; font-src https://fonts.gstatic.com; " +
171
+ "style-src 'unsafe-inline' https://fonts.googleapis.com; " +
172
+ `script-src ${cspHash(SHARE_PAGE_SCRIPT)}; connect-src 'self'; base-uri 'none'; ` +
173
+ "frame-ancestors 'none'; " +
174
+ (formTo === undefined ? "form-action 'none'" : `form-action 'self' ${formTo}`);
175
+ const sharePageStyles = /* css */ `
176
+ html, body { height: 100%; }
177
+ body { display: flex; flex-direction: column; margin: 0; background: var(--bg); color: var(--text); font: var(--t-body); }
178
+ main { display: flex; flex: 1; align-items: center; justify-content: center; padding: 24px 16px 88px; }
179
+ .card { box-sizing: border-box; width: 420px; max-width: 100%; padding: 40px 40px 32px; border: 1px solid var(--border); border-radius: 28px; background: var(--panel); text-align: center; }
180
+ .card h1 { margin: 0 0 16px; font: 700 24px/30px var(--sans); letter-spacing: -0.7px; }
181
+ .card p { margin: 0 0 16px; font: var(--t-body-lg); color: var(--muted); }
182
+ .card.failed h1 { color: var(--fail-text); }
183
+ .code { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin: 28px 0; }
184
+ .code output { font: 500 32px/40px var(--mono); letter-spacing: 0.08em; color: var(--text); white-space: nowrap; user-select: all; }
185
+ @media (max-width: 479px) { .card { padding: 32px 20px 24px; } }
186
+ .acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 28px; }
187
+ .acts form { margin: 0; }
188
+ .pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border: 0; border-radius: 999px; font: var(--t-control); text-decoration: none; cursor: pointer; }
189
+ .pill.primary { background: var(--accent); color: var(--on-accent); font-weight: 500; }
190
+ .pill.primary:hover { filter: brightness(.95); }
191
+ .pill.quiet { background: var(--subtle); color: var(--text); }
192
+ .pill.quiet:hover { background: var(--subtle-hover); }
193
+ .pill.copied { background: var(--accent-subtle); }
194
+ .pill .i-copy, .pill .i-check { display: inline-flex; }
195
+ .pill .i-check, .pill.copied .i-copy { display: none; }
196
+ .pill.copied .i-check { display: inline-flex; }
197
+ .pill .icon { width: 16px; height: 16px; }
198
+ .pill:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
199
+ .follow progress { display: block; width: 100%; height: 6px; margin: 4px 0 20px; accent-color: var(--accent); }
200
+ .follow figure { margin: 0; }
201
+ .follow img { display: block; width: 100%; max-height: 40vh; object-fit: contain; object-position: center top; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
202
+ .follow figcaption { margin-top: 8px; font: 12px/16px var(--mono); color: var(--muted); overflow-wrap: anywhere; }
203
+ `;
204
+ /** A page of the Share button's routes (see the top of this file). */
205
+ export const renderSharePage = (page) => {
206
+ const again = page.code === undefined ? page.refresh : page.wait;
207
+ return `<!doctype html>\n${html `<html lang="en">
208
+ <head>
209
+ <meta charset="utf-8" />
210
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
211
+ ${again === undefined
212
+ ? ''
213
+ : html `<noscript><meta http-equiv="refresh" content="${String(again)}" /></noscript>`}
214
+ <title>${`${page.title} · screw-bugs`}</title>
215
+ ${favicon} ${webFonts}
216
+ <style>
217
+ ${new Markup(styles + sharePageStyles)}
218
+ </style>
219
+ </head>
220
+ <body
221
+ ${page.code === undefined ? '' : new Markup('data-phase="pairing"')}
222
+ ${page.follow === undefined
223
+ ? ''
224
+ : html `data-phase="following" data-state="${page.follow.state}"
225
+ data-run="${page.follow.run}" data-status="${page.follow.routes.status}"
226
+ data-source="${page.follow.routes.source}" data-encoded="${page.follow.routes.encoded}"`}
227
+ ${page.code === undefined || page.wait === undefined
228
+ ? ''
229
+ : new Markup(`data-wait="${page.wait}"`)}
230
+ ${page.code === undefined && page.follow === undefined && page.refresh !== undefined
231
+ ? new Markup(`data-refresh="${page.refresh}"`)
232
+ : ''}
233
+ >
234
+ ${menuBar({ ends: html `${githubLink(640)}${themeButton(true)}` })}
235
+ <main>
236
+ <section
237
+ class="${['card', page.failed ? 'failed' : '', page.follow ? 'follow' : ''].filter(Boolean).join(' ')}"
238
+ aria-labelledby="title"
239
+ >
240
+ <h1 id="title">${page.title}</h1>
241
+ <p id="text" aria-live="polite">${page.text}</p>
242
+ ${page.follow === undefined
243
+ ? ''
244
+ : html `<progress id="bar" aria-label="Upload progress"></progress>
245
+ <figure>
246
+ <img id="shot" alt="The screenshot going up now" hidden />
247
+ <figcaption id="name"></figcaption>
248
+ </figure>`}
249
+ ${page.code === undefined
250
+ ? ''
251
+ : html `<div class="code">
252
+ <output aria-label="Pairing code">${page.code}</output>
253
+ <button
254
+ id="copy"
255
+ type="button"
256
+ class="pill quiet"
257
+ data-code="${page.code}"
258
+ hidden
259
+ >
260
+ <span class="i-copy">${icon('copy', { size: 16 })}</span
261
+ ><span class="i-check">${icon('check', { size: 16 })}</span
262
+ ><span class="copy-label">Copy</span>
263
+ </button>
264
+ </div>`}
265
+ ${page.link === undefined && page.form === undefined && page.back === undefined
266
+ ? ''
267
+ : html `<div class="acts">
268
+ ${page.form === undefined
269
+ ? ''
270
+ : html `<form method="post" action="${page.form.action}">
271
+ <button type="submit" class="pill primary">${page.form.label}</button>
272
+ </form>`}
273
+ ${page.link === undefined
274
+ ? ''
275
+ : html `<a
276
+ class="pill primary"
277
+ href="${page.link.href}"
278
+ target="_blank"
279
+ rel="noopener noreferrer"
280
+ >${page.link.text}${icon('external-link', { size: 16 })}</a
281
+ >`}
282
+ ${page.back === undefined
283
+ ? ''
284
+ : html `<a class="pill quiet" href="${page.back}">Back to the report</a>`}
285
+ </div>`}
286
+ </section>
287
+ </main>
288
+ ${new Markup(`<script>${SHARE_PAGE_SCRIPT}</script>`)}
289
+ </body>
290
+ </html>`}`;
291
+ };
@@ -1 +1,3 @@
1
+ export declare const light = "\n --bg: #ffffff; --bg-2: #f9f9f9; --panel: #fcfdfc; --subtle: #eff1ef;\n --border: #d7dad7; --border-strong: #b9bcb8;\n --muted: #60655f; --header: #9a9e98; --text: #1d211c;\n --accent: #94f20d; --on-accent: #1d211c; --accent-subtle: #eef6d6; --accent-border: #abc978;\n --fail: #e54d2e; --fail-text: #d13415; --pass: #8d8d8d;\n --link: #1d211c;\n --input: var(--border-strong); --ring: var(--header);\n --shadow: 0 16px 40px -4px rgba(29, 33, 28, .14), 0 2px 6px rgba(29, 33, 28, .08);\n --scrim: rgba(29, 33, 28, .55);\n --caption: #d7dad7; --caption-border: #b9bcb8; --video-edge: #111210;\n color-scheme: light;\n";
2
+ export declare const dark = "\n --bg: #111210; --bg-2: #181917; --panel: #181917; --subtle: #212220;\n --border: #383a36; --border-strong: #5c625b;\n --muted: #afb5ad; --header: #5c625b; --text: #eceeec;\n --accent: #94f20d; --on-accent: #1d211c; --accent-subtle: #1f2917; --accent-border: #496231;\n --fail: #e54d2e; --fail-text: #ff977d; --pass: #8d8d8d;\n --link: #eceeec;\n --input: var(--border-strong); --ring: var(--muted);\n --shadow: 0 20px 48px -4px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .4);\n --scrim: rgba(0, 0, 0, .7);\n --caption: #181917; --caption-border: #383a36; --video-edge: #383a36;\n color-scheme: dark;\n";
1
3
  export declare const styles: string;
@@ -12,7 +12,7 @@ import { CROP_WIDE } from './view.js';
12
12
  * markup.ts). Offline, the system's fonts after them in `--sans` and `--mono` take their place,
13
13
  * and no weight or slant is ever faked (`font-synthesis: none`).
14
14
  */
15
- const light = `
15
+ export const light = `
16
16
  --bg: #ffffff; --bg-2: #f9f9f9; --panel: #fcfdfc; --subtle: #eff1ef;
17
17
  --border: #d7dad7; --border-strong: #b9bcb8;
18
18
  --muted: #60655f; --header: #9a9e98; --text: #1d211c;
@@ -25,7 +25,7 @@ const light = `
25
25
  --caption: #d7dad7; --caption-border: #b9bcb8; --video-edge: #111210;
26
26
  color-scheme: light;
27
27
  `;
28
- const dark = `
28
+ export const dark = `
29
29
  --bg: #111210; --bg-2: #181917; --panel: #181917; --subtle: #212220;
30
30
  --border: #383a36; --border-strong: #5c625b;
31
31
  --muted: #afb5ad; --header: #5c625b; --text: #eceeec;
@@ -67,6 +67,8 @@ export const stepParts = (step) => {
67
67
  return [t('Reload the page')];
68
68
  case 'click':
69
69
  return [t('Click '), ...targetParts(step.target)];
70
+ case 'hover':
71
+ return [t('Hover over '), ...targetParts(step.target)];
70
72
  case 'fill':
71
73
  return step.value === ''
72
74
  ? [t('Clear '), ...targetParts(step.target)]
@@ -36,12 +36,15 @@ export declare const GLIDE_S = 0.6;
36
36
  * typed into (when that box shows: a fill records no time or element of its own), and a short
37
37
  * label of the action (the latest one that happened, else the one the cursor is gliding to; the
38
38
  * box's own label gives way to it; one whose time was not recorded is labelled while its step
39
- * plays, and has no cursor or ripple). All of it follows the player's time, so seeking or pausing
39
+ * plays, and has no cursor or ripple). A hover moves the mouse but records no point (see
40
+ * `StepAction.atMs`), so from when its step starts (any hover step that ran, also one that failed
41
+ * or was blocked, which may have moved the mouse all the same; its row's `data-hv`) the cursor is
42
+ * hidden until the next point the mouse pressed, rather than shown where the mouse no longer is. All of it follows the player's time, so seeking or pausing
40
43
  * shows the state at that moment. With less motion preferred, the cursor jumps instead of gliding
41
44
  * and there is no ripple. A "Cursor" switch turns it off, remembered like the theme. Nothing is
42
45
  * added to the page under test or to the video.
43
46
  */
44
- export declare const WALKTHROUGH_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();\n const stg=d.querySelector('.wt-stage');let fr=0;\n const fit=()=>{fr=0;if(!stg)return;const t=stg.getBoundingClientRect().top;stg.style.setProperty('--wt-top',Math.round(t)+'px');stg.style.setProperty('--wt-y',Math.round(t+scrollY)+'px')};\n const refit=()=>{if(!fr)fr=requestAnimationFrame(fit)};\n fit();addEventListener('resize',refit);addEventListener('load',refit);addEventListener('scroll',refit,{passive:true});d.addEventListener('fullscreenchange',refit);\n if(window.ResizeObserver)new ResizeObserver(refit).observe(d.body);\n const v=d.getElementById('wt-video');if(!v)return;\n const w=d.querySelector('.wt'),panel=d.getElementById('wt-script'),box=d.getElementById('wt-box'),cap=d.getElementById('wt-cap');\n const say=a=>{const x=a&&a.querySelector('.wt-text');cap.replaceChildren(...(x?[...x.childNodes].filter(n=>!(n instanceof Element&&n.classList.contains('wt-state'))).map(n=>n.cloneNode(true)):[]));cap.hidden=!x};\n const steps=[...d.querySelectorAll('.wt-step[data-t]')];\n const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));\n const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');\n let on=null,skip=!!skipB,P=null;const sk='screw-bugs-skip';try{skip=skip&&localStorage.getItem(sk)!=='off'}catch(e){}if(skipB)skipB.setAttribute('aria-pressed',String(skip));\n w.classList.add('live');\n const hide=()=>{box.hidden=true};\n const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};\n const put=(e,x,y,bw,bh)=>{e.style.left=x+'px';e.style.top=y+'px';if(bw!==undefined){e.style.width=bw+'px';e.style.height=bh+'px'}};\n const draw=(t,g)=>{if(P.down()!==null||!g||!on||!on.dataset.box||t<Number(on.dataset.b0)||t>Number(on.dataset.b1))return hide();const b=on.dataset.box.split(' ').map(Number);put(box,g.x+b[0]*g.w,g.y+b[1]*g.h,b[2]*g.w,b[3]*g.h);box.querySelector('span').textContent=on.dataset.label||'';box.hidden=false};\n const C=d.getElementById('wt-cursor'),R=d.getElementById('wt-ripple'),G=d.getElementById('wt-ring'),L=d.getElementById('wt-act'),T=d.getElementById('wt-cursor-on'),ck='screw-bugs-cursor';\n const nums=x=>x?x.split(' ').map(Number):null;\n const acts=[...d.querySelectorAll('.wt-step[data-act][data-s]')].map(e=>({s:e.dataset.s,at:e.dataset.at?Number(e.dataset.at):NaN,t0:Number(e.dataset.t),t1:Number(e.dataset.a1),b0:Number(e.dataset.b0),b1:Number(e.dataset.b1),k:e.dataset.act,p:nums(e.dataset.pt),b:nums(e.dataset.tb),l:e.dataset.al||''})).sort((a,b)=>(a.at>=0?a.at:a.t0)-(b.at>=0?b.at:b.t0));\n let fon=true;try{fon=localStorage.getItem(ck)!=='off'}catch(e){}\n const fx=(t,g)=>{\n C.hidden=R.hidden=G.hidden=L.hidden=true;box.querySelector('span').hidden=false;\n if(!fon||P.down()!==null||!g)return;\n const m=still(),mine=acts.filter(a=>a.s===P.cur()),ptr=mine.filter(a=>a.p),xy=p=>[g.x+p[0]*g.w,g.y+p[1]*g.h];\n let i=-1;ptr.forEach((a,j)=>{if(a.at<=t)i=j});\n const a=ptr[i],n=ptr[i+1];let c=a?a.p:null;\n if(n&&a){const gw=Math.min(0.6,n.at-a.at),q=gw>0?(t-n.at+gw)/gw:1;if(q>=0){const e=q<.5?4*q*q*q:1-Math.pow(2-2*q,3)/2;c=!m&&q<1?[a.p[0]+(n.p[0]-a.p[0])*e,a.p[1]+(n.p[1]-a.p[1])*e]:n.p}}\n if(c){const xy0=xy(c);put(C,xy0[0]-3,xy0[1]-2);C.hidden=false}\n if(a&&!m&&t-a.at<.6){const q=(t-a.at)/.6,xy1=xy(a.p);put(R,xy1[0],xy1[1]);R.style.transform='translate(-50%,-50%) scale('+(.35+q*1.3)+')';R.style.opacity=String(1-q);R.hidden=false}\n let f=null,l=null,u=null;\n for(const x of mine){if(x.k==='fill'&&x.b&&t>=x.b0&&t<=x.b1)f=x;if(x.k==='fill'||!(x.at>=0)?t>=x.t0&&t<=x.t1:t>=x.at&&t<=x.at+1.5)l=x;else if(!u&&x.p&&x.at>t&&x.at-t<=0.6)u=x}\n l=l||u;\n if(f){const xy2=xy(f.b);put(G,xy2[0],xy2[1],f.b[2]*g.w,f.b[3]*g.h);G.hidden=false;box.hidden=true}\n if(l&&l.l){L.textContent=l.l;L.hidden=false;let x=g.x+10,y=g.y+10;if(l.p){const q=xy(l.p);x=q[0]+14;y=q[1]+20}else if(l.b){const q=xy(l.b);x=q[0];y=q[1]+l.b[3]*g.h+10}if(y+L.offsetHeight>g.y+g.h-4)y=l.b?g.y+l.b[1]*g.h-L.offsetHeight-10:g.y+g.h-L.offsetHeight-4;put(L,Math.max(g.x+4,Math.min(x,g.x+g.w-L.offsetWidth-4)),Math.max(g.y+4,y))}\n box.querySelector('span').hidden=!L.hidden;\n };\n const stage=d.querySelector('.wt-stage');\n const cover=()=>{let y=topEdge();if(stage&&getComputedStyle(stage).position==='sticky')y=Math.max(y,stage.getBoundingClientRect().bottom+16);return y};\n const anchor=a=>{const hid=Math.max(0,cover()-panel.getBoundingClientRect().top);panel.scrollTo({top:Math.max(0,a.offsetTop-6-hid),behavior:still()?'auto':'smooth'})};\n const tick=t=>{\n const cur=P.cur();\n if(skip&&!v.paused&&!v.seeking){const gap=idle.find(x=>x.s===cur&&t>=x.a&&t<x.b-0.05);if(gap){v.currentTime=gap.b;return}}\n let a=null;for(const s of steps){if(s.dataset.s===cur&&Number(s.dataset.t)<=t+0.02)a=s}\n if(a!==on){if(on){on.classList.remove('on');on.removeAttribute('aria-current');on.closest('.wt-case').classList.remove('on')}on=a;say(a);if(a){a.classList.add('on');a.setAttribute('aria-current','step');a.closest('.wt-case').classList.add('on');anchor(a)}}\n const g=geo();draw(t,g);fx(t,g);\n };\n P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});\n if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}\n if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip));try{localStorage.setItem(sk,skip?'on':'off')}catch(e){}});\n if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const a=t.closest('a[data-t][data-s],.wt-step[data-t][data-s]');if(!a||!P.has(a.dataset.s))return;\n e.preventDefault();const fig=v.closest('.player');\n if(fig.getBoundingClientRect().bottom<topEdge())fig.scrollIntoView({block:'start',behavior:still()?'auto':'smooth'});\n P.load(a.dataset.s,Number(a.dataset.t),P.playing());\n });\n P.update();\n});\n})();";
47
+ export declare const WALKTHROUGH_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:')d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();\n const stg=d.querySelector('.wt-stage');let fr=0;\n const fit=()=>{fr=0;if(!stg)return;const t=stg.getBoundingClientRect().top;stg.style.setProperty('--wt-top',Math.round(t)+'px');stg.style.setProperty('--wt-y',Math.round(t+scrollY)+'px')};\n const refit=()=>{if(!fr)fr=requestAnimationFrame(fit)};\n fit();addEventListener('resize',refit);addEventListener('load',refit);addEventListener('scroll',refit,{passive:true});d.addEventListener('fullscreenchange',refit);\n if(window.ResizeObserver)new ResizeObserver(refit).observe(d.body);\n const v=d.getElementById('wt-video');if(!v)return;\n const w=d.querySelector('.wt'),panel=d.getElementById('wt-script'),box=d.getElementById('wt-box'),cap=d.getElementById('wt-cap');\n const say=a=>{const x=a&&a.querySelector('.wt-text');cap.replaceChildren(...(x?[...x.childNodes].filter(n=>!(n instanceof Element&&n.classList.contains('wt-state'))).map(n=>n.cloneNode(true)):[]));cap.hidden=!x};\n const steps=[...d.querySelectorAll('.wt-step[data-t]')];\n const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));\n const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');\n let on=null,skip=!!skipB,P=null;const sk='screw-bugs-skip';try{skip=skip&&localStorage.getItem(sk)!=='off'}catch(e){}if(skipB)skipB.setAttribute('aria-pressed',String(skip));\n w.classList.add('live');\n const hide=()=>{box.hidden=true};\n const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};\n const put=(e,x,y,bw,bh)=>{e.style.left=x+'px';e.style.top=y+'px';if(bw!==undefined){e.style.width=bw+'px';e.style.height=bh+'px'}};\n const draw=(t,g)=>{if(P.down()!==null||!g||!on||!on.dataset.box||t<Number(on.dataset.b0)||t>Number(on.dataset.b1))return hide();const b=on.dataset.box.split(' ').map(Number);put(box,g.x+b[0]*g.w,g.y+b[1]*g.h,b[2]*g.w,b[3]*g.h);box.querySelector('span').textContent=on.dataset.label||'';box.hidden=false};\n const C=d.getElementById('wt-cursor'),R=d.getElementById('wt-ripple'),G=d.getElementById('wt-ring'),L=d.getElementById('wt-act'),T=d.getElementById('wt-cursor-on'),ck='screw-bugs-cursor';\n const nums=x=>x?x.split(' ').map(Number):null;\n const acts=[...d.querySelectorAll('.wt-step[data-act][data-s]')].map(e=>({s:e.dataset.s,at:e.dataset.at?Number(e.dataset.at):NaN,t0:Number(e.dataset.t),t1:Number(e.dataset.a1),b0:Number(e.dataset.b0),b1:Number(e.dataset.b1),k:e.dataset.act,p:nums(e.dataset.pt),b:nums(e.dataset.tb),l:e.dataset.al||''})).sort((a,b)=>(a.at>=0?a.at:a.t0)-(b.at>=0?b.at:b.t0));\n const hv=[...d.querySelectorAll('.wt-step[data-hv][data-s]')].map(e=>({s:e.dataset.s,t0:Number(e.dataset.t)}));\n let fon=true;try{fon=localStorage.getItem(ck)!=='off'}catch(e){}\n const fx=(t,g)=>{\n C.hidden=R.hidden=G.hidden=L.hidden=true;box.querySelector('span').hidden=false;\n if(!fon||P.down()!==null||!g)return;\n const m=still(),mine=acts.filter(a=>a.s===P.cur()),ptr=mine.filter(a=>a.p),xy=p=>[g.x+p[0]*g.w,g.y+p[1]*g.h];\n let i=-1;ptr.forEach((a,j)=>{if(a.at<=t)i=j});\n const a=ptr[i],n=ptr[i+1];let c=a?a.p:null;\n if(n&&a){const gw=Math.min(0.6,n.at-a.at),q=gw>0?(t-n.at+gw)/gw:1;if(q>=0){const e=q<.5?4*q*q*q:1-Math.pow(2-2*q,3)/2;c=!m&&q<1?[a.p[0]+(n.p[0]-a.p[0])*e,a.p[1]+(n.p[1]-a.p[1])*e]:n.p}}\n if(a&&hv.some(x=>x.s===P.cur()&&x.t0>a.at&&x.t0<=t))c=null;\n if(c){const xy0=xy(c);put(C,xy0[0]-3,xy0[1]-2);C.hidden=false}\n if(a&&!m&&t-a.at<.6){const q=(t-a.at)/.6,xy1=xy(a.p);put(R,xy1[0],xy1[1]);R.style.transform='translate(-50%,-50%) scale('+(.35+q*1.3)+')';R.style.opacity=String(1-q);R.hidden=false}\n let f=null,l=null,u=null;\n for(const x of mine){if(x.k==='fill'&&x.b&&t>=x.b0&&t<=x.b1)f=x;if(x.k==='fill'||!(x.at>=0)?t>=x.t0&&t<=x.t1:t>=x.at&&t<=x.at+1.5)l=x;else if(!u&&x.p&&x.at>t&&x.at-t<=0.6)u=x}\n l=l||u;\n if(f){const xy2=xy(f.b);put(G,xy2[0],xy2[1],f.b[2]*g.w,f.b[3]*g.h);G.hidden=false;box.hidden=true}\n if(l&&l.l){L.textContent=l.l;L.hidden=false;let x=g.x+10,y=g.y+10;if(l.p){const q=xy(l.p);x=q[0]+14;y=q[1]+20}else if(l.b){const q=xy(l.b);x=q[0];y=q[1]+l.b[3]*g.h+10}if(y+L.offsetHeight>g.y+g.h-4)y=l.b?g.y+l.b[1]*g.h-L.offsetHeight-10:g.y+g.h-L.offsetHeight-4;put(L,Math.max(g.x+4,Math.min(x,g.x+g.w-L.offsetWidth-4)),Math.max(g.y+4,y))}\n box.querySelector('span').hidden=!L.hidden;\n };\n const stage=d.querySelector('.wt-stage');\n const cover=()=>{let y=topEdge();if(stage&&getComputedStyle(stage).position==='sticky')y=Math.max(y,stage.getBoundingClientRect().bottom+16);return y};\n const anchor=a=>{const hid=Math.max(0,cover()-panel.getBoundingClientRect().top);panel.scrollTo({top:Math.max(0,a.offsetTop-6-hid),behavior:still()?'auto':'smooth'})};\n const tick=t=>{\n const cur=P.cur();\n if(skip&&!v.paused&&!v.seeking){const gap=idle.find(x=>x.s===cur&&t>=x.a&&t<x.b-0.05);if(gap){v.currentTime=gap.b;return}}\n let a=null;for(const s of steps){if(s.dataset.s===cur&&Number(s.dataset.t)<=t+0.02)a=s}\n if(a!==on){if(on){on.classList.remove('on');on.removeAttribute('aria-current');on.closest('.wt-case').classList.remove('on')}on=a;say(a);if(a){a.classList.add('on');a.setAttribute('aria-current','step');a.closest('.wt-case').classList.add('on');anchor(a)}}\n const g=geo();draw(t,g);fx(t,g);\n };\n P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});\n if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}\n if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip));try{localStorage.setItem(sk,skip?'on':'off')}catch(e){}});\n if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const a=t.closest('a[data-t][data-s],.wt-step[data-t][data-s]');if(!a||!P.has(a.dataset.s))return;\n e.preventDefault();const fig=v.closest('.player');\n if(fig.getBoundingClientRect().bottom<topEdge())fig.scrollIntoView({block:'start',behavior:still()?'auto':'smooth'});\n P.load(a.dataset.s,Number(a.dataset.t),P.playing());\n });\n P.update();\n});\n})();";
45
48
  /**
46
49
  * As the report's: the video by relative path, one script by hash, and from the network only
47
50
  * Google Fonts' stylesheet and its fonts.
@@ -50,7 +50,10 @@ export const GLIDE_S = 0.6;
50
50
  * typed into (when that box shows: a fill records no time or element of its own), and a short
51
51
  * label of the action (the latest one that happened, else the one the cursor is gliding to; the
52
52
  * box's own label gives way to it; one whose time was not recorded is labelled while its step
53
- * plays, and has no cursor or ripple). All of it follows the player's time, so seeking or pausing
53
+ * plays, and has no cursor or ripple). A hover moves the mouse but records no point (see
54
+ * `StepAction.atMs`), so from when its step starts (any hover step that ran, also one that failed
55
+ * or was blocked, which may have moved the mouse all the same; its row's `data-hv`) the cursor is
56
+ * hidden until the next point the mouse pressed, rather than shown where the mouse no longer is. All of it follows the player's time, so seeking or pausing
54
57
  * shows the state at that moment. With less motion preferred, the cursor jumps instead of gliding
55
58
  * and there is no ripple. A "Cursor" switch turns it off, remembered like the theme. Nothing is
56
59
  * added to the page under test or to the video.
@@ -78,6 +81,7 @@ d.addEventListener('DOMContentLoaded',()=>{
78
81
  const C=d.getElementById('wt-cursor'),R=d.getElementById('wt-ripple'),G=d.getElementById('wt-ring'),L=d.getElementById('wt-act'),T=d.getElementById('wt-cursor-on'),ck='screw-bugs-cursor';
79
82
  const nums=x=>x?x.split(' ').map(Number):null;
80
83
  const acts=[...d.querySelectorAll('.wt-step[data-act][data-s]')].map(e=>({s:e.dataset.s,at:e.dataset.at?Number(e.dataset.at):NaN,t0:Number(e.dataset.t),t1:Number(e.dataset.a1),b0:Number(e.dataset.b0),b1:Number(e.dataset.b1),k:e.dataset.act,p:nums(e.dataset.pt),b:nums(e.dataset.tb),l:e.dataset.al||''})).sort((a,b)=>(a.at>=0?a.at:a.t0)-(b.at>=0?b.at:b.t0));
84
+ const hv=[...d.querySelectorAll('.wt-step[data-hv][data-s]')].map(e=>({s:e.dataset.s,t0:Number(e.dataset.t)}));
81
85
  let fon=true;try{fon=localStorage.getItem(ck)!=='off'}catch(e){}
82
86
  const fx=(t,g)=>{
83
87
  C.hidden=R.hidden=G.hidden=L.hidden=true;box.querySelector('span').hidden=false;
@@ -86,6 +90,7 @@ d.addEventListener('DOMContentLoaded',()=>{
86
90
  let i=-1;ptr.forEach((a,j)=>{if(a.at<=t)i=j});
87
91
  const a=ptr[i],n=ptr[i+1];let c=a?a.p:null;
88
92
  if(n&&a){const gw=Math.min(${GLIDE_S},n.at-a.at),q=gw>0?(t-n.at+gw)/gw:1;if(q>=0){const e=q<.5?4*q*q*q:1-Math.pow(2-2*q,3)/2;c=!m&&q<1?[a.p[0]+(n.p[0]-a.p[0])*e,a.p[1]+(n.p[1]-a.p[1])*e]:n.p}}
93
+ if(a&&hv.some(x=>x.s===P.cur()&&x.t0>a.at&&x.t0<=t))c=null;
89
94
  if(c){const xy0=xy(c);put(C,xy0[0]-3,xy0[1]-2);C.hidden=false}
90
95
  if(a&&!m&&t-a.at<.6){const q=(t-a.at)/.6,xy1=xy(a.p);put(R,xy1[0],xy1[1]);R.style.transform='translate(-50%,-50%) scale('+(.35+q*1.3)+')';R.style.opacity=String(1-q);R.hidden=false}
91
96
  let f=null,l=null,u=null;
@@ -380,6 +385,8 @@ export const actionLabel = (step) => {
380
385
  switch (step.action) {
381
386
  case 'click':
382
387
  return quoted(0) === undefined ? undefined : `Click ${quoted(0)}`;
388
+ case 'hover':
389
+ return quoted(0) === undefined ? undefined : `Hover ${quoted(0)}`;
383
390
  case 'fill':
384
391
  return step.value === ''
385
392
  ? quoted(0) === undefined
@@ -445,10 +452,12 @@ const agentWhy = (view) => html `<p class="wt-why s-failed wt-case-why">
445
452
  </p>`;
446
453
  /**
447
454
  * The input a step gives the page, as an icon by its words in the fullscreen caption: a left
448
- * click, typing, a key or the mouse wheel. Steps that only look or wait have none.
455
+ * click, a pointer moved over something, typing, a key or the mouse wheel. Steps that only look
456
+ * or wait have none.
449
457
  */
450
458
  const stepIcon = {
451
459
  click: 'mouse-left',
460
+ hover: 'mouse-pointer-2',
452
461
  fill: 'text-cursor',
453
462
  press: 'keyboard',
454
463
  scroll: 'mouse',
@@ -462,9 +471,11 @@ const stepRow = (view, step, sessions) => {
462
471
  const timed = ms !== undefined && sessions.has(session);
463
472
  const box = timed ? stepBox(entry, step) : undefined;
464
473
  const acted = timed ? stepAction(step.timing?.action) : undefined;
465
- // A fill records no element of its own (its input is not watched): its ring is the step's box,
466
- // drawn when that is, from the screenshot taken at the step.
467
- const action = acted !== undefined && acted.tb === undefined && step.timing?.action?.kind === 'fill' && box
474
+ // A fill or a hover records no element of its own (its input is not watched): its ring (a
475
+ // fill's) and its label are placed by the step's box, when there is one, from the screenshot
476
+ // taken at the step.
477
+ const unwatched = step.timing?.action?.kind === 'fill' || step.timing?.action?.kind === 'hover';
478
+ const action = acted !== undefined && acted.tb === undefined && unwatched && box
468
479
  ? { ...acted, tb: box.box }
469
480
  : acted;
470
481
  const decided = step.state === 'decided';
@@ -473,6 +484,7 @@ const stepRow = (view, step, sessions) => {
473
484
  class="wt-step st-${step.state}${decided ? ` s-${view.checkStatus}` : ''}"
474
485
  id="${`wt-${entry.id}-${step.index}`}"
475
486
  ${timed ? html ` data-s="${String(session)}" data-t="${fragmentSeconds(ms)}"` : ''}
487
+ ${timed && step.step.action === 'hover' ? html ` data-hv` : ''}
476
488
  ${box
477
489
  ? html ` data-box="${box.box}" data-b0="${fragmentSeconds(box.from)}"
478
490
  data-b1="${fragmentSeconds(box.to)}" data-label="${stepLabel(step)}"`
@@ -10,6 +10,8 @@ export const ACCOUNT_ABOUT_MAX = 200;
10
10
  /** A label such as `trial-user`: lower-case letters, digits and dashes, also a file name. */
11
11
  export const AccountLabel = Schema.String.check(Schema.isPattern(/^[a-z0-9][a-z0-9-]{0,39}$/, {
12
12
  message: 'Use 1-40 lower-case letters, digits or dashes, starting with a letter or digit',
13
+ // Effect leaves isPattern out of JSON Schema; this puts it in.
14
+ toJsonSchema: () => ({ pattern: '^[a-z0-9][a-z0-9-]{0,39}$' }),
13
15
  })).annotate({ description: 'Label of a test account, such as trial-user.' });
14
16
  /** What kind of user an account is, for the agent picking one: one line. */
15
17
  export const AccountAbout = Schema.String.check(Schema.makeFilter((text) => !text.trim()
@@ -18,7 +20,14 @@ export const AccountAbout = Schema.String.check(Schema.makeFilter((text) => !tex
18
20
  ? `At most ${ACCOUNT_ABOUT_MAX} characters`
19
21
  : /[\r\n]/.test(text)
20
22
  ? 'Must be one line'
21
- : undefined)).annotate({
23
+ : undefined, {
24
+ // Approximate (looser): JSON Schema's maxLength counts characters, the filter counts
25
+ // UTF-16 code units, where an emoji can count as 2.
26
+ toJsonSchema: () => [
27
+ { maxLength: ACCOUNT_ABOUT_MAX, pattern: '^[^\\r\\n]*\\S[^\\r\\n]*$' },
28
+ true,
29
+ ],
30
+ })).annotate({
22
31
  description: 'What kind of user this is, such as "On a 14-day trial, no card on file".',
23
32
  });
24
33
  /** A job's account: its label, or the label with what it is and whether to sign in again. */