@guideai/react-native 0.3.0 → 0.7.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/dist/ui.mjs CHANGED
@@ -1,2019 +1,9 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import React, { useReducer, useState, useRef, useMemo, useEffect, useCallback, useContext, createContext } from "react";
3
- import { View, StyleSheet, Text, ScrollView, Linking, AccessibilityInfo, Modal, ActivityIndicator, Pressable, Platform, KeyboardAvoidingView, Alert, FlatList, TextInput, StatusBar, Animated, Easing, Dimensions, PanResponder } from "react-native";
4
- import { r as requireConfigured, E as EP } from "./setup-CkXajERE.js";
5
- import { B as BOARD_W, b as useWhiteboard, c as BOARD_H, u as useGuideAI, a as useOnboarding } from "./useOnboarding-BAKQq8T_.js";
6
- import Svg, { G, Path } from "react-native-svg";
7
- function parseInline(text) {
8
- const spans = [];
9
- const pattern = /(`[^`]+`)|(\*\*[^*]+\*\*)|(__[^_]+__)|(\*[^*\n]+\*)|(_[^_\n]+_)|(\[[^\]]+\]\([^)]+\))/g;
10
- let cursor = 0;
11
- let match;
12
- while ((match = pattern.exec(text)) !== null) {
13
- if (match.index > cursor) {
14
- spans.push({ text: text.slice(cursor, match.index) });
15
- }
16
- const token = match[0];
17
- if (token.startsWith("`")) {
18
- spans.push({ text: token.slice(1, -1), code: true });
19
- } else if (token.startsWith("**") || token.startsWith("__")) {
20
- spans.push({ text: token.slice(2, -2), bold: true });
21
- } else if (token.startsWith("[")) {
22
- const split = token.indexOf("](");
23
- spans.push({
24
- text: token.slice(1, split),
25
- href: token.slice(split + 2, -1)
26
- });
27
- } else {
28
- spans.push({ text: token.slice(1, -1), italic: true });
29
- }
30
- cursor = match.index + token.length;
31
- }
32
- if (cursor < text.length) spans.push({ text: text.slice(cursor) });
33
- return spans.length ? spans : [{ text }];
34
- }
35
- function tableCells(line) {
36
- return line.replace(/^\s*\|/, "").replace(/\|\s*$/, "").split("|").map((cell) => parseInline(cell.trim()));
37
- }
38
- const TABLE_DIVIDER = /^\s*\|?[\s:-]*-[\s|:-]*\|?\s*$/;
39
- function parseMarkdown(source) {
40
- var _a, _b;
41
- const blocks = [];
42
- const lines = source.replace(/\r\n/g, "\n").split("\n");
43
- let index = 0;
44
- while (index < lines.length) {
45
- const line = lines[index];
46
- const trimmed = line.trim();
47
- if (!trimmed) {
48
- index += 1;
49
- continue;
50
- }
51
- const fence = /^```(\w+)?/.exec(trimmed);
52
- if (fence) {
53
- const language = fence[1];
54
- const body = [];
55
- index += 1;
56
- while (index < lines.length && !lines[index].trim().startsWith("```")) {
57
- body.push(lines[index]);
58
- index += 1;
59
- }
60
- index += 1;
61
- blocks.push({ type: "code", text: body.join("\n"), language });
62
- continue;
63
- }
64
- if (trimmed.includes("|") && index + 1 < lines.length && TABLE_DIVIDER.test(lines[index + 1])) {
65
- const header = tableCells(trimmed);
66
- const rows = [];
67
- index += 2;
68
- while (index < lines.length && lines[index].includes("|") && lines[index].trim()) {
69
- rows.push(tableCells(lines[index]));
70
- index += 1;
71
- }
72
- blocks.push({ type: "table", header, rows });
73
- continue;
74
- }
75
- const heading = /^(#{1,6})\s+(.*)$/.exec(trimmed);
76
- if (heading) {
77
- const level = Math.min(heading[1].length, 3);
78
- blocks.push({ type: "heading", level, spans: parseInline(heading[2]) });
79
- index += 1;
80
- continue;
81
- }
82
- if (/^(\*\s*){3,}$|^(-\s*){3,}$|^(_\s*){3,}$/.test(trimmed)) {
83
- blocks.push({ type: "rule" });
84
- index += 1;
85
- continue;
86
- }
87
- const quote = /^>\s?(.*)$/.exec(trimmed);
88
- if (quote) {
89
- blocks.push({ type: "quote", spans: parseInline(quote[1]) });
90
- index += 1;
91
- continue;
92
- }
93
- const indent = (_b = (_a = /^(\s*)/.exec(line)) == null ? void 0 : _a[1].length) != null ? _b : 0;
94
- const depth = Math.floor(indent / 2);
95
- const bullet = /^[-*+]\s+(.*)$/.exec(trimmed);
96
- if (bullet) {
97
- blocks.push({ type: "bullet", spans: parseInline(bullet[1]), depth });
98
- index += 1;
99
- continue;
100
- }
101
- const ordered = /^(\d+)[.)]\s+(.*)$/.exec(trimmed);
102
- if (ordered) {
103
- blocks.push({
104
- type: "ordered",
105
- spans: parseInline(ordered[2]),
106
- index: Number(ordered[1]),
107
- depth
108
- });
109
- index += 1;
110
- continue;
111
- }
112
- const paragraph = [trimmed];
113
- index += 1;
114
- while (index < lines.length) {
115
- const nextLine = lines[index].trim();
116
- if (!nextLine || /^(#{1,6})\s/.test(nextLine) || /^[-*+]\s/.test(nextLine) || /^\d+[.)]\s/.test(nextLine) || nextLine.startsWith("```") || nextLine.startsWith(">") || nextLine.includes("|")) break;
117
- paragraph.push(nextLine);
118
- index += 1;
119
- }
120
- blocks.push({ type: "paragraph", spans: parseInline(paragraph.join(" ")) });
121
- }
122
- return blocks;
123
- }
124
- function Spans({ spans, style, accentColor }) {
125
- return /* @__PURE__ */ jsx(Fragment, { children: spans.map((span, index) => {
126
- if (span.href) {
127
- return /* @__PURE__ */ jsx(
128
- Text,
129
- {
130
- style: [style, { color: accentColor, textDecorationLine: "underline" }],
131
- onPress: () => {
132
- void Linking.openURL(span.href);
133
- },
134
- accessibilityRole: "link",
135
- children: span.text
136
- },
137
- index
138
- );
139
- }
140
- return /* @__PURE__ */ jsx(
141
- Text,
142
- {
143
- style: [
144
- style,
145
- span.bold ? styles$4.bold : null,
146
- span.italic ? styles$4.italic : null,
147
- span.code ? styles$4.inlineCode : null
148
- ],
149
- children: span.text
150
- },
151
- index
152
- );
153
- }) });
154
- }
155
- function Markdown({
156
- children,
157
- color = "#0f172a",
158
- accentColor = "#2563eb",
159
- fontSize = 15
160
- }) {
161
- const blocks = React.useMemo(() => parseMarkdown(children), [children]);
162
- const body = { color, fontSize, lineHeight: fontSize * 1.45 };
163
- return /* @__PURE__ */ jsx(View, { style: styles$4.container, children: blocks.map((block, index) => /* @__PURE__ */ jsx(
164
- Block,
165
- {
166
- block,
167
- body,
168
- color,
169
- accentColor,
170
- fontSize
171
- },
172
- index
173
- )) });
174
- }
175
- function Block({ block, body, color, accentColor, fontSize }) {
176
- switch (block.type) {
177
- case "heading": {
178
- const sizes = { 1: fontSize + 6, 2: fontSize + 3, 3: fontSize + 1 };
179
- return /* @__PURE__ */ jsx(Text, { style: [styles$4.heading, { color, fontSize: sizes[block.level] }], children: /* @__PURE__ */ jsx(
180
- Spans,
181
- {
182
- spans: block.spans,
183
- accentColor,
184
- style: { color, fontSize: sizes[block.level], fontWeight: "700" }
185
- }
186
- ) });
187
- }
188
- case "paragraph":
189
- return /* @__PURE__ */ jsx(Text, { style: styles$4.paragraph, children: /* @__PURE__ */ jsx(Spans, { spans: block.spans, style: body, accentColor }) });
190
- case "bullet":
191
- return /* @__PURE__ */ jsxs(View, { style: [styles$4.listRow, { marginLeft: block.depth * 14 }], children: [
192
- /* @__PURE__ */ jsx(Text, { style: [body, { color: accentColor }], children: "•" }),
193
- /* @__PURE__ */ jsx(Text, { style: styles$4.listText, children: /* @__PURE__ */ jsx(Spans, { spans: block.spans, style: body, accentColor }) })
194
- ] });
195
- case "ordered":
196
- return /* @__PURE__ */ jsxs(View, { style: [styles$4.listRow, { marginLeft: block.depth * 14 }], children: [
197
- /* @__PURE__ */ jsxs(Text, { style: [body, { color: accentColor, fontVariant: ["tabular-nums"] }], children: [
198
- block.index,
199
- "."
200
- ] }),
201
- /* @__PURE__ */ jsx(Text, { style: styles$4.listText, children: /* @__PURE__ */ jsx(Spans, { spans: block.spans, style: body, accentColor }) })
202
- ] });
203
- case "code":
204
- return /* @__PURE__ */ jsx(View, { style: styles$4.codeBlock, children: /* @__PURE__ */ jsx(Text, { style: [styles$4.codeText, { fontSize: fontSize - 2 }], children: block.text }) });
205
- case "quote":
206
- return /* @__PURE__ */ jsx(View, { style: [styles$4.quote, { borderLeftColor: accentColor }], children: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx(
207
- Spans,
208
- {
209
- spans: block.spans,
210
- accentColor,
211
- style: { ...body, color: "#475569", fontStyle: "italic" }
212
- }
213
- ) }) });
214
- case "rule":
215
- return /* @__PURE__ */ jsx(View, { style: styles$4.rule });
216
- case "table": {
217
- const columns = Math.max(block.header.length, ...block.rows.map((r) => r.length), 1);
218
- const scrolls = columns > 3;
219
- const table = /* @__PURE__ */ jsxs(View, { style: [styles$4.table, scrolls ? { minWidth: columns * 116 } : null], children: [
220
- /* @__PURE__ */ jsx(View, { style: [styles$4.tableRow, styles$4.tableHeaderRow], children: block.header.map((cell, index) => /* @__PURE__ */ jsx(View, { style: styles$4.tableCell, children: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx(
221
- Spans,
222
- {
223
- spans: cell,
224
- accentColor,
225
- style: { ...body, fontWeight: "700", fontSize: fontSize - 1 }
226
- }
227
- ) }) }, index)) }),
228
- block.rows.map((row, rowIndex) => /* @__PURE__ */ jsx(View, { style: styles$4.tableRow, children: row.map((cell, cellIndex) => /* @__PURE__ */ jsx(View, { style: styles$4.tableCell, children: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx(
229
- Spans,
230
- {
231
- spans: cell,
232
- accentColor,
233
- style: { ...body, fontSize: fontSize - 1 }
234
- }
235
- ) }) }, cellIndex)) }, rowIndex))
236
- ] });
237
- return scrolls ? /* @__PURE__ */ jsx(
238
- ScrollView,
239
- {
240
- horizontal: true,
241
- showsHorizontalScrollIndicator: false,
242
- alwaysBounceHorizontal: false,
243
- children: table
244
- }
245
- ) : table;
246
- }
247
- default:
248
- return null;
249
- }
250
- }
251
- const mono = { fontFamily: "Menlo" };
252
- const styles$4 = StyleSheet.create({
253
- container: { gap: 6 },
254
- heading: { fontWeight: "700", marginTop: 4 },
255
- paragraph: {},
256
- listRow: { flexDirection: "row", gap: 8, alignItems: "flex-start" },
257
- listText: { flex: 1 },
258
- bold: { fontWeight: "700" },
259
- italic: { fontStyle: "italic" },
260
- inlineCode: {
261
- ...mono,
262
- backgroundColor: "rgba(100,116,139,0.14)",
263
- color: "#0f172a"
264
- },
265
- codeBlock: {
266
- backgroundColor: "#0f172a",
267
- borderRadius: 10,
268
- padding: 12,
269
- marginVertical: 2
270
- },
271
- codeText: { ...mono, color: "#e2e8f0" },
272
- quote: { borderLeftWidth: 3, paddingLeft: 10, paddingVertical: 2 },
273
- rule: { height: StyleSheet.hairlineWidth, backgroundColor: "#cbd5e1", marginVertical: 6 },
274
- table: {
275
- borderWidth: StyleSheet.hairlineWidth,
276
- borderColor: "#cbd5e1",
277
- borderRadius: 8,
278
- overflow: "hidden"
279
- },
280
- tableRow: {
281
- flexDirection: "row",
282
- borderBottomWidth: StyleSheet.hairlineWidth,
283
- borderBottomColor: "#e2e8f0"
284
- },
285
- tableHeaderRow: { backgroundColor: "rgba(100,116,139,0.10)" },
286
- tableCell: { flex: 1, padding: 8 }
287
- });
288
- const STEP_GAP_MS = 450;
289
- function readTime(text) {
290
- const words = text.trim().split(/\s+/).filter(Boolean).length;
291
- return Math.min(6500, Math.max(1500, words * 280));
292
- }
293
- const SPEEDS = [0.75, 1, 1.5, 2];
294
- class Player {
295
- constructor(steps, hooks, reducedMotion = false) {
296
- var _a, _b, _c;
297
- this.steps = steps;
298
- this.hooks = hooks;
299
- this.reducedMotion = reducedMotion;
300
- this.state = "idle";
301
- this.speed = 1;
302
- this.stepIndex = -1;
303
- this.opIndex = 0;
304
- this.opElapsed = 0;
305
- this.stepElapsed = 0;
306
- this.holdElapsed = 0;
307
- this.spoken = null;
308
- this.narrationToken = 0;
309
- this.frame = null;
310
- this.last = 0;
311
- this.requestFrame = (_a = hooks.requestFrame) != null ? _a : ((cb) => requestAnimationFrame(cb));
312
- this.cancelFrame = (_b = hooks.cancelFrame) != null ? _b : ((id) => cancelAnimationFrame(id));
313
- this.now = (_c = hooks.now) != null ? _c : (() => performance.now());
314
- }
315
- get current() {
316
- return this.stepIndex;
317
- }
318
- get status() {
319
- return this.state;
320
- }
321
- get rate() {
322
- return this.speed;
323
- }
324
- setSpeed(speed) {
325
- this.speed = Math.min(3, Math.max(0.25, speed));
326
- }
327
- play() {
328
- if (this.state === "playing") return;
329
- if (this.state === "done" || this.state === "idle") {
330
- this.restart();
331
- return;
332
- }
333
- this.setState("playing");
334
- this.schedule();
335
- }
336
- pause() {
337
- if (this.state !== "playing") return;
338
- this.setState("paused");
339
- this.unschedule();
340
- if (this.spoken === null) {
341
- this.narrationToken += 1;
342
- this.hooks.stopNarration();
343
- this.spoken = false;
344
- }
345
- }
346
- replay() {
347
- this.restart();
348
- }
349
- /**
350
- * Jump to step *index*, as a scrubber does: the board is rebuilt with every
351
- * step before it already drawn, then playback carries on from there.
352
- */
353
- seek(index) {
354
- const target = Math.max(0, Math.min(this.steps.length - 1, Math.floor(index)));
355
- this.unschedule();
356
- this.narrationToken += 1;
357
- this.hooks.stopNarration();
358
- this.hooks.reset();
359
- for (let i = 0; i < target; i += 1) {
360
- const step = this.steps[i];
361
- step.enter();
362
- for (const op of step.ops) op.run(1);
363
- }
364
- this.stepIndex = -1;
365
- this.setState("playing");
366
- this.enterStep(target);
367
- this.schedule();
368
- }
369
- /** Stop for good: no frames, no voice. */
370
- destroy() {
371
- this.unschedule();
372
- this.narrationToken += 1;
373
- this.hooks.stopNarration();
374
- this.state = "done";
375
- }
376
- restart() {
377
- this.unschedule();
378
- this.narrationToken += 1;
379
- this.hooks.stopNarration();
380
- this.hooks.reset();
381
- this.stepIndex = -1;
382
- this.setState("playing");
383
- this.enterStep(0);
384
- this.schedule();
385
- }
386
- setState(state) {
387
- var _a, _b;
388
- if (this.state === state) return;
389
- this.state = state;
390
- (_b = (_a = this.hooks).onState) == null ? void 0 : _b.call(_a, state);
391
- }
392
- enterStep(index) {
393
- var _a, _b;
394
- const step = this.steps[index];
395
- if (!step) {
396
- this.unschedule();
397
- this.setState("done");
398
- return;
399
- }
400
- this.stepIndex = index;
401
- this.opIndex = 0;
402
- this.opElapsed = 0;
403
- this.stepElapsed = 0;
404
- this.holdElapsed = 0;
405
- this.spoken = null;
406
- step.enter();
407
- (_b = (_a = this.hooks).onStep) == null ? void 0 : _b.call(_a, index, step);
408
- const token = ++this.narrationToken;
409
- this.hooks.narrate(step.say).then(
410
- (said) => {
411
- if (token === this.narrationToken) this.spoken = said;
412
- },
413
- () => {
414
- if (token === this.narrationToken) this.spoken = false;
415
- }
416
- );
417
- if (this.reducedMotion) {
418
- for (const op of step.ops) op.run(1);
419
- this.opIndex = step.ops.length;
420
- }
421
- }
422
- schedule() {
423
- if (this.frame !== null || this.state !== "playing") return;
424
- this.last = this.now();
425
- this.frame = this.requestFrame((t) => this.tick(t));
426
- }
427
- unschedule() {
428
- if (this.frame !== null) this.cancelFrame(this.frame);
429
- this.frame = null;
430
- }
431
- /** One frame. Public so tests can drive time by hand. */
432
- tick(now) {
433
- this.frame = null;
434
- if (this.state !== "playing") return;
435
- const dt = Math.max(0, Math.min(100, now - this.last)) * this.speed;
436
- this.last = now;
437
- this.advance(dt);
438
- if (this.state === "playing") this.frame = this.requestFrame((t) => this.tick(t));
439
- }
440
- advance(dt) {
441
- const step = this.steps[this.stepIndex];
442
- if (!step) return;
443
- this.stepElapsed += dt;
444
- let left = dt;
445
- while (this.opIndex < step.ops.length && left > 0) {
446
- const op = step.ops[this.opIndex];
447
- const remaining = op.duration - this.opElapsed;
448
- if (op.duration <= 0 || left >= remaining) {
449
- op.run(1);
450
- left -= Math.max(0, remaining);
451
- this.opIndex += 1;
452
- this.opElapsed = 0;
453
- } else {
454
- this.opElapsed += left;
455
- op.run(this.opElapsed / op.duration);
456
- left = 0;
457
- }
458
- }
459
- while (this.opIndex < step.ops.length && step.ops[this.opIndex].duration <= 0) {
460
- step.ops[this.opIndex].run(1);
461
- this.opIndex += 1;
462
- }
463
- if (this.opIndex < step.ops.length || this.spoken === null) return;
464
- const hold = this.spoken ? 0 : readTime(step.say);
465
- if (this.stepElapsed < hold) return;
466
- this.holdElapsed += dt;
467
- if (this.holdElapsed < STEP_GAP_MS) return;
468
- this.enterStep(this.stepIndex + 1);
469
- }
470
- }
471
- const STORYBOARD_ICON_STROKES = {
472
- phone: [
473
- "M 32 6 Q 24 6 24 14 L 24 86 Q 24 94 32 94 L 68 94 Q 76 94 76 86 L 76 14 Q 76 6 68 6 Z",
474
- "M 43 13 L 57 13",
475
- "M 41 88 L 59 88"
476
- ],
477
- screen: [
478
- "M 8 18 L 92 18 L 92 66 L 8 66 Z",
479
- "M 42 66 L 38 84 L 62 84 L 58 66",
480
- "M 30 84 L 70 84"
481
- ],
482
- window: [
483
- "M 6 16 L 94 16 L 94 84 L 6 84 Z",
484
- "M 6 32 L 94 32",
485
- "M 11 24 a 3 3 0 1 0 6 0 a 3 3 0 1 0 -6 0 M 23 24 a 3 3 0 1 0 6 0 a 3 3 0 1 0 -6 0 M 35 24 a 3 3 0 1 0 6 0 a 3 3 0 1 0 -6 0"
486
- ],
487
- video: [
488
- "M 8 20 L 92 20 L 92 80 L 8 80 Z",
489
- "M 20 20 L 20 80 M 80 20 L 80 80",
490
- "M 42 40 L 64 50 L 42 60 Z"
491
- ],
492
- play: [
493
- "M 8 50 a 42 42 0 1 0 84 0 a 42 42 0 1 0 -84 0",
494
- "M 40 32 L 70 50 L 40 68 Z"
495
- ],
496
- input: [
497
- "M 6 36 L 94 36 L 94 64 L 6 64 Z",
498
- "M 18 43 L 18 57",
499
- "M 28 50 L 66 50"
500
- ],
501
- cursor: [
502
- "M 24 12 L 24 74 L 39 60 L 49 82 L 60 77 L 50 56 L 70 55 Z"
503
- ],
504
- document: [
505
- "M 24 8 L 62 8 L 78 26 L 78 92 L 24 92 Z",
506
- "M 62 8 L 62 26 L 78 26",
507
- "M 36 44 L 66 44 M 36 58 L 66 58 M 36 72 L 54 72"
508
- ],
509
- image: [
510
- "M 10 20 L 90 20 L 90 80 L 10 80 Z",
511
- "M 10 68 L 36 44 L 56 64 L 68 54 L 90 74",
512
- "M 61 34 a 7 7 0 1 0 14 0 a 7 7 0 1 0 -14 0"
513
- ],
514
- gear: [
515
- "M 50.0 17.0 L 58.8 5.9 L 67.2 8.4 L 68.3 22.6 L 73.3 26.7 L 87.4 25.0 L 91.6 32.8 L 82.4 43.6 L 83.0 50.0 L 94.1 58.8 L 91.6 67.2 L 77.4 68.3 L 73.3 73.3 L 75.0 87.4 L 67.2 91.6 L 56.4 82.4 L 50.0 83.0 L 41.2 94.1 L 32.8 91.6 L 31.7 77.4 L 26.7 73.3 L 12.6 75.0 L 8.4 67.2 L 17.6 56.4 L 17.0 50.0 L 5.9 41.2 L 8.4 32.8 L 22.6 31.7 L 26.7 26.7 L 25.0 12.6 L 32.8 8.4 L 43.6 17.6 Z",
516
- "M 39 50 a 11 11 0 1 0 22 0 a 11 11 0 1 0 -22 0"
517
- ],
518
- cloud: [
519
- "M 28 74 Q 8 74 8 58 Q 8 44 24 42 Q 28 22 48 22 Q 68 22 72 42 Q 92 44 92 58 Q 92 74 74 74 Z"
520
- ],
521
- database: [
522
- "M 18 24 a 32 10 0 1 0 64 0 a 32 10 0 1 0 -64 0",
523
- "M 18 24 L 18 76 Q 18 88 50 88 Q 82 88 82 76 L 82 24",
524
- "M 18 50 Q 18 62 50 62 Q 82 62 82 50"
525
- ],
526
- user: [
527
- "M 33 31 a 17 17 0 1 0 34 0 a 17 17 0 1 0 -34 0",
528
- "M 16 88 Q 16 56 50 56 Q 84 56 84 88"
529
- ],
530
- sparkle: [
531
- "M 50 6 Q 56 40 90 50 Q 56 60 50 94 Q 44 60 10 50 Q 44 40 50 6 Z"
532
- ],
533
- check: [
534
- "M 16 54 L 40 78 L 86 22"
535
- ],
536
- clock: [
537
- "M 8 50 a 42 42 0 1 0 84 0 a 42 42 0 1 0 -84 0",
538
- "M 50 26 L 50 52 L 70 62"
539
- ],
540
- lock: [
541
- "M 22 46 L 78 46 L 78 90 L 22 90 Z",
542
- "M 34 46 L 34 30 Q 34 12 50 12 Q 66 12 66 30 L 66 46",
543
- "M 50 62 L 50 74"
544
- ],
545
- chat: [
546
- "M 10 20 L 90 20 L 90 68 L 46 68 L 26 86 L 28 68 L 10 68 Z",
547
- "M 28 38 L 72 38 M 28 52 L 60 52"
548
- ],
549
- cross: [
550
- "M 22 22 L 78 78",
551
- "M 78 22 L 22 78"
552
- ],
553
- server: [
554
- "M 16 10 L 84 10 L 84 34 L 16 34 Z",
555
- "M 16 38 L 84 38 L 84 62 L 16 62 Z",
556
- "M 16 66 L 84 66 L 84 90 L 16 90 Z",
557
- "M 26 22 L 32 22 M 26 50 L 32 50 M 26 78 L 32 78",
558
- "M 54 22 L 74 22 M 54 50 L 74 50 M 54 78 L 74 78"
559
- ],
560
- queue: [
561
- "M 6 32 L 94 32 M 6 68 L 94 68",
562
- "M 14 40 L 30 40 L 30 60 L 14 60 Z",
563
- "M 38 40 L 54 40 L 54 60 L 38 60 Z",
564
- "M 62 40 L 78 40 L 78 60 L 62 60 Z",
565
- "M 82 50 L 94 50 M 88 44 L 94 50 L 88 56"
566
- ],
567
- globe: [
568
- "M 8 50 a 42 42 0 1 0 84 0 a 42 42 0 1 0 -84 0",
569
- "M 50 8 Q 22 50 50 92 Q 78 50 50 8",
570
- "M 8 50 L 92 50",
571
- "M 16 28 L 84 28 M 16 72 L 84 72"
572
- ],
573
- balancer: [
574
- "M 36 8 L 64 8 L 64 30 L 36 30 Z",
575
- "M 50 30 L 50 46 M 18 46 L 82 46 M 18 46 L 18 62 M 50 46 L 50 62 M 82 46 L 82 62",
576
- "M 8 62 L 28 62 L 28 86 L 8 86 Z",
577
- "M 40 62 L 60 62 L 60 86 L 40 86 Z",
578
- "M 72 62 L 92 62 L 92 86 L 72 86 Z"
579
- ],
580
- cache: [
581
- "M 58 6 L 24 54 L 48 54 L 40 94 L 78 40 L 54 40 Z"
582
- ],
583
- container: [
584
- "M 50 8 L 88 28 L 88 72 L 50 92 L 12 72 L 12 28 Z",
585
- "M 12 28 L 50 48 L 88 28",
586
- "M 50 48 L 50 92"
587
- ]
588
- };
589
- function storyboardIconStrokes(icon) {
590
- var _a;
591
- return (_a = STORYBOARD_ICON_STROKES[icon]) != null ? _a : [];
592
- }
593
- const SHEET_W$1 = 1600;
594
- const SHEET_H$1 = 1e3;
595
- const sx = (x) => x * (SHEET_W$1 / 160);
596
- const sy = (y) => y * (SHEET_H$1 / 100);
597
- function seeded(seed) {
598
- let s = seed >>> 0 || 1;
599
- return () => {
600
- s ^= s << 13;
601
- s ^= s >>> 17;
602
- s ^= s << 5;
603
- return (s >>> 0) % 1e4 / 1e4;
604
- };
605
- }
606
- function strokeLength(stroke) {
607
- let length = 0;
608
- for (let i = 1; i < stroke.length; i += 1) {
609
- length += Math.hypot(stroke[i].x - stroke[i - 1].x, stroke[i].y - stroke[i - 1].y);
610
- }
611
- return length;
612
- }
613
- function totalLength(strokes) {
614
- return strokes.reduce((sum, s) => sum + strokeLength(s), 0);
615
- }
616
- function bounds(strokes) {
617
- let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
618
- for (const s of strokes) for (const p of s) {
619
- x0 = Math.min(x0, p.x);
620
- y0 = Math.min(y0, p.y);
621
- x1 = Math.max(x1, p.x);
622
- y1 = Math.max(y1, p.y);
623
- }
624
- return Number.isFinite(x0) ? { x0, y0, x1, y1 } : null;
625
- }
626
- function handLine(a, b, rand, steps = 14) {
627
- const length = Math.hypot(b.x - a.x, b.y - a.y) || 1;
628
- const nx = -(b.y - a.y) / length;
629
- const ny = (b.x - a.x) / length;
630
- const bow = (rand() - 0.5) * Math.min(18, length * 0.04);
631
- const out = [];
632
- for (let i = 0; i <= steps; i += 1) {
633
- const t = i / steps;
634
- const lift = Math.sin(Math.PI * t) * bow + (rand() - 0.5) * 1.6;
635
- out.push({ x: a.x + (b.x - a.x) * t + nx * lift, y: a.y + (b.y - a.y) * t + ny * lift });
636
- }
637
- return out;
638
- }
639
- function handEllipse(b, rand) {
640
- const cx = sx(b[0] + b[2] / 2);
641
- const cy = sy(b[1] + b[3] / 2);
642
- const rx = sx(b[2]) / 2 + 8;
643
- const ry = sy(b[3]) / 2 + 8;
644
- const start = -Math.PI * (0.55 + rand() * 0.2);
645
- const sweep = Math.PI * 2 * (1.06 + rand() * 0.05);
646
- const out = [];
647
- const n = 48;
648
- for (let i = 0; i <= n; i += 1) {
649
- const t = i / n;
650
- const a = start + sweep * t;
651
- const grow = 1 + (t - 0.5) * 0.06 + (rand() - 0.5) * 0.012;
652
- out.push({ x: cx + Math.cos(a) * rx * grow, y: cy + Math.sin(a) * ry * grow });
653
- }
654
- return out;
655
- }
656
- function smooth(points, per = 8) {
657
- if (points.length < 3) return points;
658
- const out = [];
659
- for (let i = 0; i < points.length - 1; i += 1) {
660
- const p0 = points[Math.max(0, i - 1)];
661
- const p1 = points[i];
662
- const p2 = points[i + 1];
663
- const p3 = points[Math.min(points.length - 1, i + 2)];
664
- for (let j = 0; j < per; j += 1) {
665
- const t = j / per;
666
- const t2 = t * t;
667
- const t3 = t2 * t;
668
- out.push({
669
- x: 0.5 * (2 * p1.x + (-p0.x + p2.x) * t + (2 * p0.x - 5 * p1.x + 4 * p2.x - p3.x) * t2 + (-p0.x + 3 * p1.x - 3 * p2.x + p3.x) * t3),
670
- y: 0.5 * (2 * p1.y + (-p0.y + p2.y) * t + (2 * p0.y - 5 * p1.y + 4 * p2.y - p3.y) * t2 + (-p0.y + 3 * p1.y - 3 * p2.y + p3.y) * t3)
671
- });
672
- }
673
- }
674
- out.push(points[points.length - 1]);
675
- return out;
676
- }
677
- function arrowHead(from, to, rand) {
678
- const angle = Math.atan2(to.y - from.y, to.x - from.x);
679
- const size = 26 + rand() * 6;
680
- const spread = 0.45;
681
- return [
682
- { x: to.x - size * Math.cos(angle - spread), y: to.y - size * Math.sin(angle - spread) },
683
- to,
684
- { x: to.x - size * Math.cos(angle + spread), y: to.y - size * Math.sin(angle + spread) }
685
- ];
686
- }
687
- const corner = (b) => {
688
- const x0 = sx(b[0]), y0 = sy(b[1]), x1 = sx(b[0] + b[2]), y1 = sy(b[1] + b[3]);
689
- return [{ x: x0, y: y0 }, { x: x1, y: y0 }, { x: x1, y: y1 }, { x: x0, y: y1 }];
690
- };
691
- function handPoly(points, closed, rand) {
692
- const corners = closed ? [...points, points[0]] : points;
693
- const out = [];
694
- for (let i = 1; i < corners.length; i += 1) {
695
- const length = Math.hypot(corners[i].x - corners[i - 1].x, corners[i].y - corners[i - 1].y);
696
- const segment = handLine(corners[i - 1], corners[i], rand, Math.max(6, Math.min(24, Math.round(length / 30))));
697
- out.push(...i === 1 ? segment : segment.slice(1));
698
- }
699
- return out;
700
- }
701
- function handOval(b, rand) {
702
- const cx = sx(b[0] + b[2] / 2);
703
- const cy = sy(b[1] + b[3] / 2);
704
- const rx = sx(b[2]) / 2;
705
- const ry = sy(b[3]) / 2;
706
- const start = -Math.PI * (0.6 + rand() * 0.2);
707
- const sweep = Math.PI * 2 * (1.03 + rand() * 0.03);
708
- const n = Math.max(32, Math.round((rx + ry) / 6));
709
- const out = [];
710
- for (let i = 0; i <= n; i += 1) {
711
- const a = start + sweep * i / n;
712
- const wobble = 1 + (rand() - 0.5) * 0.012;
713
- out.push({ x: cx + Math.cos(a) * rx * wobble, y: cy + Math.sin(a) * ry * wobble });
714
- }
715
- return out;
716
- }
717
- const unit = (from, to) => {
718
- const d = Math.hypot(to.x - from.x, to.y - from.y) || 1;
719
- return { x: (to.x - from.x) / d, y: (to.y - from.y) / d };
720
- };
721
- function rightAngle(a, v, b, rand) {
722
- const size = Math.min(44, 0.3 * Math.min(Math.hypot(a.x - v.x, a.y - v.y), Math.hypot(b.x - v.x, b.y - v.y)));
723
- const ua = unit(v, a);
724
- const ub = unit(v, b);
725
- const p1 = { x: v.x + ua.x * size, y: v.y + ua.y * size };
726
- const p2 = { x: p1.x + ub.x * size, y: p1.y + ub.y * size };
727
- const p3 = { x: v.x + ub.x * size, y: v.y + ub.y * size };
728
- return handPoly([p1, p2, p3], false, rand);
729
- }
730
- function angleArc(a, v, b, rand) {
731
- const r = Math.min(70, 0.3 * Math.min(Math.hypot(a.x - v.x, a.y - v.y), Math.hypot(b.x - v.x, b.y - v.y)));
732
- const from = Math.atan2(a.y - v.y, a.x - v.x);
733
- let delta = Math.atan2(b.y - v.y, b.x - v.x) - from;
734
- while (delta > Math.PI) delta -= 2 * Math.PI;
735
- while (delta < -Math.PI) delta += 2 * Math.PI;
736
- const n = 18;
737
- const out = [];
738
- for (let i = 0; i <= n; i += 1) {
739
- const t = from + delta * i / n;
740
- const rr = r * (1 + (rand() - 0.5) * 0.03);
741
- out.push({ x: v.x + Math.cos(t) * rr, y: v.y + Math.sin(t) * rr });
742
- }
743
- return out;
744
- }
745
- function handDot(c) {
746
- const out = [];
747
- for (let i = 0; i <= 14; i += 1) {
748
- const t = i / 14 * Math.PI * 4;
749
- const r = 7 * (1 - i / 16);
750
- out.push({ x: c.x + Math.cos(t) * r, y: c.y + Math.sin(t) * r });
751
- }
752
- return out;
753
- }
754
- function roughen(strokes, seed, amount = 2.2) {
755
- const rand = seeded(seed);
756
- return strokes.map((stroke) => {
757
- let dx = 0;
758
- let dy = 0;
759
- return stroke.map((p) => {
760
- dx = dx * 0.6 + (rand() - 0.5) * amount;
761
- dy = dy * 0.6 + (rand() - 0.5) * amount;
762
- return { x: p.x + dx, y: p.y + dy };
763
- });
764
- });
765
- }
766
- function inkStrokes(kind, geometry, seed) {
767
- var _a, _b, _c;
768
- const rand = seeded(seed);
769
- const p = (q) => ({ x: sx(q[0]), y: sy(q[1]) });
770
- const pts = (_b = (_a = geometry.pts) == null ? void 0 : _a.map(p)) != null ? _b : [];
771
- switch (kind) {
772
- case "line":
773
- case "arrow": {
774
- if (!geometry.at || geometry.at.length !== 2 || !geometry.to) return [];
775
- const a = p(geometry.at);
776
- const b2 = p(geometry.to);
777
- const shaft = handLine(a, b2, rand);
778
- return kind === "arrow" ? [shaft, arrowHead((_c = shaft[shaft.length - 2]) != null ? _c : a, b2, rand)] : [shaft];
779
- }
780
- case "free":
781
- case "curve":
782
- return pts.length >= 2 ? [smooth(pts)] : [];
783
- case "poly":
784
- return pts.length >= 2 ? [handPoly(pts, !!geometry.closed && pts.length > 2, rand)] : [];
785
- case "corner":
786
- return pts.length === 3 ? [rightAngle(pts[0], pts[1], pts[2], rand)] : [];
787
- case "arc":
788
- return pts.length === 3 ? [angleArc(pts[0], pts[1], pts[2], rand)] : [];
789
- case "dot":
790
- return geometry.at && geometry.at.length === 2 ? [handDot(p(geometry.at))] : [];
791
- }
792
- const b = geometry.at && geometry.at.length === 4 ? geometry.at : null;
793
- if (!b) return [];
794
- const [tl, tr, br, bl] = corner(b);
795
- switch (kind) {
796
- case "oval":
797
- return [handOval(b, rand)];
798
- case "circle":
799
- return [handEllipse(b, rand)];
800
- case "box":
801
- return [handLine(tl, tr, rand, 10), handLine(tr, br, rand, 8), handLine(br, bl, rand, 10), handLine(bl, tl, rand, 8)];
802
- case "underline": {
803
- const y = br.y + 6;
804
- return [handLine({ x: bl.x - 4, y }, { x: br.x + 4, y: y + (rand() - 0.5) * 6 }, rand, 18)];
805
- }
806
- case "cross":
807
- return [handLine(tl, br, rand, 10), handLine(tr, bl, rand, 10)];
808
- case "tick": {
809
- const mid = { x: tl.x + (br.x - tl.x) * 0.38, y: br.y };
810
- return [[...handLine({ x: tl.x, y: tl.y + (br.y - tl.y) * 0.55 }, mid, rand, 6), ...handLine(mid, tr, rand, 10).slice(1)]];
811
- }
812
- case "bracket": {
813
- const x = tr.x;
814
- const mid = (tr.y + br.y) / 2;
815
- return [smooth([{ x: x - 14, y: tr.y }, { x, y: tr.y + 12 }, { x, y: mid - 12 }, { x: x + 14, y: mid }, { x, y: mid + 12 }, { x, y: br.y - 12 }, { x: x - 14, y: br.y }], 5)];
816
- }
817
- default:
818
- return [];
819
- }
820
- }
821
- const TOKEN = /([MmLlHhVvCcSsQqTtAaZz])|(-?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?)/g;
822
- function flattenPath(d, curveSteps = 8) {
823
- var _a;
824
- const tokens = [];
825
- for (const m of d.matchAll(TOKEN)) tokens.push((_a = m[1]) != null ? _a : Number(m[2]));
826
- const strokes = [];
827
- let current = [];
828
- let x = 0, y = 0, startX = 0, startY = 0;
829
- let lastCtrl = null;
830
- let lastQuad = null;
831
- let cmd = "";
832
- let i = 0;
833
- const next = () => {
834
- const v = tokens[i++];
835
- return typeof v === "number" ? v : NaN;
836
- };
837
- const hasNumber = () => typeof tokens[i] === "number";
838
- const push = (px, py) => {
839
- current.push({ x: px, y: py });
840
- };
841
- const finish = () => {
842
- if (current.length > 1) strokes.push(current);
843
- current = [];
844
- };
845
- const cubic = (c1, c2, end) => {
846
- const sx0 = x, sy0 = y;
847
- for (let s = 1; s <= curveSteps; s += 1) {
848
- const t = s / curveSteps;
849
- const u = 1 - t;
850
- push(
851
- u * u * u * sx0 + 3 * u * u * t * c1.x + 3 * u * t * t * c2.x + t * t * t * end.x,
852
- u * u * u * sy0 + 3 * u * u * t * c1.y + 3 * u * t * t * c2.y + t * t * t * end.y
853
- );
854
- }
855
- x = end.x;
856
- y = end.y;
857
- };
858
- const quad = (c, end) => {
859
- const sx0 = x, sy0 = y;
860
- for (let s = 1; s <= curveSteps; s += 1) {
861
- const t = s / curveSteps;
862
- const u = 1 - t;
863
- push(u * u * sx0 + 2 * u * t * c.x + t * t * end.x, u * u * sy0 + 2 * u * t * c.y + t * t * end.y);
864
- }
865
- x = end.x;
866
- y = end.y;
867
- };
868
- while (i < tokens.length) {
869
- if (typeof tokens[i] === "string") cmd = tokens[i++];
870
- else if (!cmd) {
871
- i += 1;
872
- continue;
873
- }
874
- const rel = cmd === cmd.toLowerCase();
875
- const ox = rel ? x : 0;
876
- const oy = rel ? y : 0;
877
- switch (cmd.toUpperCase()) {
878
- case "M": {
879
- finish();
880
- x = ox + next();
881
- y = oy + next();
882
- startX = x;
883
- startY = y;
884
- push(x, y);
885
- cmd = rel ? "l" : "L";
886
- lastCtrl = lastQuad = null;
887
- break;
888
- }
889
- case "L":
890
- x = ox + next();
891
- y = oy + next();
892
- push(x, y);
893
- lastCtrl = lastQuad = null;
894
- break;
895
- case "H":
896
- x = ox + next();
897
- push(x, y);
898
- lastCtrl = lastQuad = null;
899
- break;
900
- case "V":
901
- y = oy + next();
902
- push(x, y);
903
- lastCtrl = lastQuad = null;
904
- break;
905
- case "C": {
906
- const c1 = { x: ox + next(), y: oy + next() };
907
- const c2 = { x: ox + next(), y: oy + next() };
908
- const end = { x: ox + next(), y: oy + next() };
909
- cubic(c1, c2, end);
910
- lastCtrl = c2;
911
- lastQuad = null;
912
- break;
913
- }
914
- case "S": {
915
- const c1 = lastCtrl ? { x: 2 * x - lastCtrl.x, y: 2 * y - lastCtrl.y } : { x, y };
916
- const c2 = { x: ox + next(), y: oy + next() };
917
- const end = { x: ox + next(), y: oy + next() };
918
- cubic(c1, c2, end);
919
- lastCtrl = c2;
920
- lastQuad = null;
921
- break;
922
- }
923
- case "Q": {
924
- const c = { x: ox + next(), y: oy + next() };
925
- const end = { x: ox + next(), y: oy + next() };
926
- quad(c, end);
927
- lastQuad = c;
928
- lastCtrl = null;
929
- break;
930
- }
931
- case "T": {
932
- const c = lastQuad ? { x: 2 * x - lastQuad.x, y: 2 * y - lastQuad.y } : { x, y };
933
- const end = { x: ox + next(), y: oy + next() };
934
- quad(c, end);
935
- lastQuad = c;
936
- lastCtrl = null;
937
- break;
938
- }
939
- case "A": {
940
- const rx = next(), ry = next(), rotation = next(), large = next(), sweep = next();
941
- const end = { x: ox + next(), y: oy + next() };
942
- for (const p of arcPoints({ x, y }, end, rx, ry, rotation, large !== 0, sweep !== 0, curveSteps * 2)) push(p.x, p.y);
943
- x = end.x;
944
- y = end.y;
945
- lastCtrl = lastQuad = null;
946
- break;
947
- }
948
- case "Z":
949
- push(startX, startY);
950
- x = startX;
951
- y = startY;
952
- finish();
953
- current = [{ x, y }];
954
- lastCtrl = lastQuad = null;
955
- if (hasNumber()) cmd = rel ? "l" : "L";
956
- else cmd = "";
957
- break;
958
- default:
959
- i += 1;
960
- }
961
- if (Number.isNaN(x) || Number.isNaN(y)) return strokes;
962
- }
963
- finish();
964
- return strokes;
965
- }
966
- function arcPoints(from, to, rx, ry, degrees, large, sweep, steps) {
967
- if (!rx || !ry || from.x === to.x && from.y === to.y) return [to];
968
- const phi = degrees * Math.PI / 180;
969
- const cos = Math.cos(phi), sin = Math.sin(phi);
970
- const dx = (from.x - to.x) / 2, dy = (from.y - to.y) / 2;
971
- const x1 = cos * dx + sin * dy, y1 = -sin * dx + cos * dy;
972
- let rxa = Math.abs(rx), rya = Math.abs(ry);
973
- const scale = x1 * x1 / (rxa * rxa) + y1 * y1 / (rya * rya);
974
- if (scale > 1) {
975
- rxa *= Math.sqrt(scale);
976
- rya *= Math.sqrt(scale);
977
- }
978
- const num = rxa * rxa * rya * rya - rxa * rxa * y1 * y1 - rya * rya * x1 * x1;
979
- const den = rxa * rxa * y1 * y1 + rya * rya * x1 * x1;
980
- const k = (large === sweep ? -1 : 1) * Math.sqrt(Math.max(0, num / den));
981
- const cx1 = k * rxa * y1 / rya, cy1 = -k * rya * x1 / rxa;
982
- const cx = cos * cx1 - sin * cy1 + (from.x + to.x) / 2;
983
- const cy = sin * cx1 + cos * cy1 + (from.y + to.y) / 2;
984
- const angle = (ux, uy, vx, vy) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);
985
- const start = angle(1, 0, (x1 - cx1) / rxa, (y1 - cy1) / rya);
986
- let delta = angle((x1 - cx1) / rxa, (y1 - cy1) / rya, (-x1 - cx1) / rxa, (-y1 - cy1) / rya);
987
- if (!sweep && delta > 0) delta -= 2 * Math.PI;
988
- if (sweep && delta < 0) delta += 2 * Math.PI;
989
- const out = [];
990
- for (let i = 1; i <= steps; i += 1) {
991
- const t = start + delta * i / steps;
992
- out.push({ x: cx + rxa * Math.cos(t) * cos - rya * Math.sin(t) * sin, y: cy + rxa * Math.cos(t) * sin + rya * Math.sin(t) * cos });
993
- }
994
- out[out.length - 1] = to;
995
- return out;
996
- }
997
- function parseTransform(transform) {
998
- const t = /translate\(\s*(-?[\d.]+)(?:[\s,]+(-?[\d.]+))?/.exec(transform);
999
- const s = /scale\(\s*(-?[\d.]+)(?:[\s,]+(-?[\d.]+))?/.exec(transform);
1000
- const kx = s ? Number(s[1]) : 1;
1001
- return {
1002
- tx: t ? Number(t[1]) : 0,
1003
- ty: t && t[2] !== void 0 ? Number(t[2]) : 0,
1004
- kx,
1005
- ky: s && s[2] !== void 0 ? Number(s[2]) : kx
1006
- };
1007
- }
1008
- function fit(strokes, viewBox, transform, b) {
1009
- const [vx, vy, vw, vh] = viewBox.split(/[\s,]+/).map(Number);
1010
- const w = vw > 0 ? vw : 100;
1011
- const h = vh > 0 ? vh : 100;
1012
- const { tx, ty, kx, ky } = parseTransform(transform);
1013
- const bx = sx(b[0]), by = sy(b[1]), bw = sx(b[2]), bh = sy(b[3]);
1014
- const k = Math.min(bw / w, bh / h);
1015
- const offX = bx + (bw - w * k) / 2;
1016
- const offY = by + (bh - h * k) / 2;
1017
- return strokes.map((stroke) => stroke.map((p) => ({
1018
- x: offX + (tx + kx * p.x - (vx || 0)) * k,
1019
- y: offY + (ty + ky * p.y - (vy || 0)) * k
1020
- })));
1021
- }
1022
- function artStrokes(ink, b, seed = 1) {
1023
- if ("icon" in ink) {
1024
- const paths = storyboardIconStrokes(ink.icon);
1025
- return roughen(fit(paths.flatMap((d) => flattenPath(d, 14)), "0 0 100 100", "", b), seed);
1026
- }
1027
- return fit(ink.contours.flatMap((d) => flattenPath(d, 6)), ink.view_box, ink.transform, b);
1028
- }
1029
- function pointAlong(strokes, length) {
1030
- let left = length;
1031
- for (const s of strokes) {
1032
- for (let i = 1; i < s.length; i += 1) {
1033
- const seg = Math.hypot(s[i].x - s[i - 1].x, s[i].y - s[i - 1].y);
1034
- if (left <= seg) {
1035
- const t = seg ? left / seg : 1;
1036
- return { x: s[i - 1].x + (s[i].x - s[i - 1].x) * t, y: s[i - 1].y + (s[i].y - s[i - 1].y) * t };
1037
- }
1038
- left -= seg;
1039
- }
1040
- }
1041
- const last = strokes[strokes.length - 1];
1042
- return last ? last[last.length - 1] : null;
1043
- }
1044
- const INK = { ink: "#1f2937", blue: "#2563eb", red: "#dc2626", green: "#059669" };
1045
- const MARKER = "rgba(250, 204, 21, 0.42)";
1046
- const TEXT_SIZE = { s: 2.3, m: 3.1, l: 4.3 };
1047
- const TRAVEL_MS = 200;
1048
- class BoardModel {
1049
- constructor(options) {
1050
- this.options = options;
1051
- this.inks = [];
1052
- this.words = [];
1053
- this.pen = null;
1054
- this.caption = "";
1055
- this.step = -1;
1056
- this.player = null;
1057
- this.scene = null;
1058
- this.nextKey = 1;
1059
- }
1060
- snapshot() {
1061
- var _a, _b, _c, _d, _e, _f, _g, _h;
1062
- return {
1063
- inks: this.inks,
1064
- words: this.words,
1065
- pen: this.pen,
1066
- caption: this.caption,
1067
- step: this.step,
1068
- steps: (_b = (_a = this.scene) == null ? void 0 : _a.steps.length) != null ? _b : 0,
1069
- state: (_d = (_c = this.player) == null ? void 0 : _c.status) != null ? _d : "idle",
1070
- title: (_f = (_e = this.scene) == null ? void 0 : _e.title) != null ? _f : "",
1071
- sample: (_h = (_g = this.scene) == null ? void 0 : _g.sample) != null ? _h : false
1072
- };
1073
- }
1074
- play(scene) {
1075
- var _a, _b, _c, _d, _e;
1076
- this.destroy();
1077
- this.scene = scene;
1078
- const steps = scene.steps.map((step, index) => this.buildStep(step, index));
1079
- this.player = new Player(steps, {
1080
- narrate: (_a = this.options.narrate) != null ? _a : (async () => false),
1081
- stopNarration: () => {
1082
- var _a2, _b2;
1083
- return (_b2 = (_a2 = this.options).stopNarration) == null ? void 0 : _b2.call(_a2);
1084
- },
1085
- reset: () => this.wipe(),
1086
- onStep: (index, step) => {
1087
- this.step = index;
1088
- this.caption = step.say;
1089
- this.changed();
1090
- },
1091
- onState: () => this.changed(),
1092
- requestFrame: (_b = this.options.requestFrame) != null ? _b : ((cb) => requestAnimationFrame(cb)),
1093
- cancelFrame: (_c = this.options.cancelFrame) != null ? _c : ((id) => cancelAnimationFrame(id)),
1094
- now: (_d = this.options.now) != null ? _d : (() => Date.now())
1095
- }, (_e = this.options.reducedMotion) != null ? _e : false);
1096
- this.player.play();
1097
- }
1098
- /** Pause, or carry on from where it was. */
1099
- toggle() {
1100
- if (!this.player) return;
1101
- if (this.player.status === "playing") this.player.pause();
1102
- else this.player.play();
1103
- }
1104
- replay() {
1105
- var _a;
1106
- (_a = this.player) == null ? void 0 : _a.replay();
1107
- }
1108
- seek(step) {
1109
- var _a;
1110
- (_a = this.player) == null ? void 0 : _a.seek(step);
1111
- }
1112
- setSpeed(speed) {
1113
- var _a;
1114
- (_a = this.player) == null ? void 0 : _a.setSpeed(speed);
1115
- }
1116
- get speed() {
1117
- var _a, _b;
1118
- return (_b = (_a = this.player) == null ? void 0 : _a.rate) != null ? _b : 1;
1119
- }
1120
- /** Stop for good: no frames, nothing on the board. */
1121
- destroy() {
1122
- var _a;
1123
- (_a = this.player) == null ? void 0 : _a.destroy();
1124
- this.player = null;
1125
- this.scene = null;
1126
- this.wipe();
1127
- this.step = -1;
1128
- this.caption = "";
1129
- }
1130
- changed() {
1131
- this.options.onChange();
1132
- }
1133
- wipe() {
1134
- this.inks = [];
1135
- this.words = [];
1136
- this.pen = null;
1137
- this.changed();
1138
- }
1139
- // ------------------------------------------------------------- steps → ops
1140
- buildStep(step, index) {
1141
- return {
1142
- say: step.say,
1143
- enter: () => {
1144
- if (step.clear) this.wipe();
1145
- },
1146
- ops: step.draw.map((item, i) => this.opFor(item, index * 100 + i + 1))
1147
- };
1148
- }
1149
- opFor(item, seed) {
1150
- var _a;
1151
- switch (item.kind) {
1152
- case "ink":
1153
- return this.inkOp(item.id, inkStrokes(item.ink, item, seed), INK[item.tone], item.ink === "dot" ? 9 : 7, item.ink === "dot" ? 250 : 350, 2600, 1.1);
1154
- case "art": {
1155
- const ink = (_a = this.scene) == null ? void 0 : _a.art[item.art];
1156
- if (!ink) {
1157
- const [x, y, w, h] = item.at;
1158
- return this.textOp({ kind: "text", id: item.id, text: item.art, at: [x + 1, y + h / 2], size: w < 15 ? "s" : "m", tone: item.tone });
1159
- }
1160
- return this.inkOp(item.id, artStrokes(ink, item.at, seed), INK[item.tone], "icon" in ink ? 7 : 4, 1100, 4500, 2.6);
1161
- }
1162
- case "text":
1163
- return this.textOp(item);
1164
- case "table":
1165
- return this.tableOp(item);
1166
- case "mark":
1167
- return this.markOp(item.mark);
1168
- case "erase":
1169
- return this.eraseOp(item.erase);
1170
- default:
1171
- return { duration: 0, run: () => void 0 };
1172
- }
1173
- }
1174
- inkOp(id, strokes, color, width, min, max, perMs, marker = false) {
1175
- const length = totalLength(strokes);
1176
- const duration = Math.min(max, Math.max(min, length / perMs)) + TRAVEL_MS;
1177
- const share = TRAVEL_MS / duration;
1178
- let obj = null;
1179
- return {
1180
- duration,
1181
- run: (progress) => {
1182
- var _a, _b;
1183
- if (!obj) {
1184
- obj = { key: this.nextKey++, id, strokes, length, color, width, marker, drawn: 0 };
1185
- this.inks = [...this.inks, obj];
1186
- }
1187
- if (!length) return;
1188
- const drawn = progress >= 1 ? 1 : Math.max(0, (progress - share) / (1 - share));
1189
- obj.drawn = drawn;
1190
- this.pen = drawn > 0 ? pointAlong(strokes, length * drawn) : (_b = (_a = strokes[0]) == null ? void 0 : _a[0]) != null ? _b : this.pen;
1191
- this.changed();
1192
- }
1193
- };
1194
- }
1195
- textOp(item) {
1196
- const duration = Math.min(2e3, Math.max(350, item.text.length * 60)) + TRAVEL_MS;
1197
- let word = null;
1198
- return {
1199
- duration,
1200
- run: (progress) => {
1201
- if (!word) {
1202
- word = { key: this.nextKey++, id: item.id, kind: "text", text: item.text, at: item.at, size: item.size, color: INK[item.tone], shown: 0, marked: false, gone: false };
1203
- this.words = [...this.words, word];
1204
- }
1205
- word.shown = progress >= 1 ? 1 : Math.max(0, (progress * duration - TRAVEL_MS) / (duration - TRAVEL_MS));
1206
- const height = TEXT_SIZE[item.size] / 100 * BOARD_W;
1207
- this.pen = { x: sx(item.at[0] + item.text.length * height * 0.55 * word.shown), y: sy(item.at[1]) };
1208
- this.changed();
1209
- }
1210
- };
1211
- }
1212
- tableOp(item) {
1213
- let table = null;
1214
- return {
1215
- duration: item.rows.length * 450 + TRAVEL_MS,
1216
- run: (progress) => {
1217
- if (!table) {
1218
- table = { key: this.nextKey++, id: item.id, kind: "table", rows: item.rows, at: item.at, color: INK[item.tone], rowsShown: 0, marked: false, gone: false };
1219
- this.words = [...this.words, table];
1220
- }
1221
- table.rowsShown = progress >= 1 ? item.rows.length : Math.max(progress > 0 ? 1 : 0, Math.floor(progress * item.rows.length));
1222
- this.pen = { x: sx(item.at[0] + item.at[2]), y: sy(item.at[1]) };
1223
- this.changed();
1224
- }
1225
- };
1226
- }
1227
- markOp(id) {
1228
- let done = false;
1229
- return {
1230
- duration: 650,
1231
- run: () => {
1232
- if (done) return;
1233
- done = true;
1234
- const word = this.words.find((w) => w.id === id);
1235
- if (word) {
1236
- word.marked = true;
1237
- this.changed();
1238
- return;
1239
- }
1240
- const ink = this.inks.find((obj) => obj.id === id && !obj.marker);
1241
- const box = ink ? bounds(ink.strokes) : null;
1242
- if (!box) return;
1243
- const mid = (box.y0 + box.y1) / 2;
1244
- const swipe = [{ x: box.x0 - 14, y: mid }, { x: box.x1 + 14, y: mid }];
1245
- this.inks = [{
1246
- key: this.nextKey++,
1247
- strokes: [swipe],
1248
- length: totalLength([swipe]),
1249
- color: MARKER,
1250
- width: Math.max(24, (box.y1 - box.y0) * 0.6),
1251
- marker: true,
1252
- drawn: 1
1253
- }, ...this.inks];
1254
- this.changed();
1255
- }
1256
- };
1257
- }
1258
- eraseOp(id) {
1259
- return {
1260
- duration: 350,
1261
- run: (progress) => {
1262
- if (progress < 1) return;
1263
- this.words = this.words.filter((w) => w.id !== id);
1264
- this.inks = this.inks.filter((obj) => obj.id !== id);
1265
- this.changed();
1266
- }
1267
- };
1268
- }
1269
- }
1270
- function inkPath(strokes, length, upTo) {
1271
- let left = length * upTo;
1272
- const parts = [];
1273
- for (const stroke of strokes) {
1274
- if (left <= 0 || stroke.length < 2) break;
1275
- let d = `M${stroke[0].x.toFixed(1)} ${stroke[0].y.toFixed(1)}`;
1276
- for (let i = 1; i < stroke.length; i += 1) {
1277
- const a = stroke[i - 1];
1278
- const b = stroke[i];
1279
- const seg = Math.hypot(b.x - a.x, b.y - a.y);
1280
- if (seg >= left) {
1281
- const t = seg ? left / seg : 1;
1282
- d += `L${(a.x + (b.x - a.x) * t).toFixed(1)} ${(a.y + (b.y - a.y) * t).toFixed(1)}`;
1283
- left = 0;
1284
- break;
1285
- }
1286
- d += `L${b.x.toFixed(1)} ${b.y.toFixed(1)}`;
1287
- left -= seg;
1288
- }
1289
- parts.push(d);
1290
- }
1291
- return parts.join("");
1292
- }
1293
- const darkTheme = {
1294
- background: "#0B0713",
1295
- surface: "rgba(255,255,255,0.06)",
1296
- surfaceRaised: "#1C1626",
1297
- text: "#F5F3FF",
1298
- textMuted: "#8B85A0",
1299
- accent: "#7C5CFF",
1300
- onAccent: "#FFFFFF",
1301
- userBubble: "#7C5CFF",
1302
- onUserBubble: "#FFFFFF",
1303
- error: "rgba(248,113,113,0.16)",
1304
- border: "rgba(255,255,255,0.10)",
1305
- radius: 22,
1306
- fontSize: 15
1307
- };
1308
- const lightTheme = {
1309
- background: "#FFFFFF",
1310
- surface: "#F1F5F9",
1311
- surfaceRaised: "#FFFFFF",
1312
- text: "#0F172A",
1313
- textMuted: "#64748B",
1314
- accent: "#7C5CFF",
1315
- onAccent: "#FFFFFF",
1316
- userBubble: "#7C5CFF",
1317
- onUserBubble: "#FFFFFF",
1318
- error: "#FEE2E2",
1319
- border: "#E2E8F0",
1320
- radius: 22,
1321
- fontSize: 15
1322
- };
1323
- function resolveTheme(overrides, base = lightTheme) {
1324
- return overrides ? { ...base, ...overrides } : base;
1325
- }
1326
- const SHEET_W = 1600;
1327
- const SHEET_H = 1e3;
1328
- const HAND = Platform.select({ ios: "Bradley Hand", android: "casual", default: void 0 });
1329
- const PEN = "M0 0 L-5 -22 L22 -70 L32 -63 L5 -16 Z";
1330
- function GuideAIWhiteboard({ theme: overrides }) {
1331
- const theme = resolveTheme(overrides);
1332
- const { state, close, retry } = useWhiteboard();
1333
- const [, repaint] = useReducer((n) => n + 1, 0);
1334
- const [width, setWidth] = useState(0);
1335
- const [expanded, setExpanded] = useState(false);
1336
- const motion = useRef({ reduced: false });
1337
- const model = useMemo(() => new BoardModel({
1338
- onChange: () => repaint(),
1339
- get reducedMotion() {
1340
- return motion.current.reduced;
1341
- }
1342
- }), []);
1343
- useEffect(() => {
1344
- var _a, _b;
1345
- void ((_b = (_a = AccessibilityInfo).isReduceMotionEnabled) == null ? void 0 : _b.call(_a).then((on) => {
1346
- motion.current.reduced = on;
1347
- }, () => void 0));
1348
- }, []);
1349
- useEffect(() => {
1350
- if (state.status === "playing" && state.scene) model.play(state.scene);
1351
- else model.destroy();
1352
- }, [model, state.status, state.scene]);
1353
- useEffect(() => () => model.destroy(), [model]);
1354
- if (state.status === "closed") return null;
1355
- const board = model.snapshot();
1356
- const height = width / (BOARD_W / BOARD_H);
1357
- const unit2 = width / 100;
1358
- const playing = board.state === "playing";
1359
- const title = state.status === "playing" ? board.title : state.question;
1360
- const shut = () => {
1361
- model.destroy();
1362
- close();
1363
- };
1364
- return /* @__PURE__ */ jsx(Modal, { visible: true, transparent: true, animationType: "fade", onRequestClose: shut, supportedOrientations: ["portrait", "landscape"], children: /* @__PURE__ */ jsx(View, { style: [styles$3.backdrop, expanded ? styles$3.centre : null], pointerEvents: "box-none", children: /* @__PURE__ */ jsxs(
1365
- View,
1366
- {
1367
- style: [styles$3.card, { backgroundColor: theme.surfaceRaised, borderColor: theme.border, maxWidth: expanded ? 1040 : 540 }],
1368
- accessibilityViewIsModal: true,
1369
- accessibilityLabel: `Whiteboard: ${title}`,
1370
- children: [
1371
- /* @__PURE__ */ jsxs(View, { style: styles$3.head, children: [
1372
- /* @__PURE__ */ jsx(Text, { style: [styles$3.title, { color: theme.text }], numberOfLines: 1, children: title || "Whiteboard" }),
1373
- board.sample && state.status === "playing" ? /* @__PURE__ */ jsx(Text, { style: styles$3.badge, accessibilityHint: "This board uses example numbers.", children: "Example" }) : null,
1374
- /* @__PURE__ */ jsx(IconButton, { label: expanded ? "Collapse whiteboard" : "Expand whiteboard", glyph: expanded ? "⤡" : "⤢", color: theme.textMuted, onPress: () => setExpanded((v) => !v) }),
1375
- /* @__PURE__ */ jsx(IconButton, { label: "Close whiteboard", glyph: "✕", color: theme.textMuted, onPress: shut })
1376
- ] }),
1377
- /* @__PURE__ */ jsxs(View, { style: styles$3.sheet, onLayout: (e) => setWidth(e.nativeEvent.layout.width), children: [
1378
- width > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
1379
- /* @__PURE__ */ jsxs(Svg, { width, height, viewBox: `0 0 ${SHEET_W} ${SHEET_H}`, children: [
1380
- board.inks.filter((obj) => obj.marker).map((obj) => /* @__PURE__ */ jsx(Ink, { obj }, obj.key)),
1381
- board.inks.filter((obj) => !obj.marker).map((obj) => /* @__PURE__ */ jsx(Ink, { obj }, obj.key)),
1382
- board.pen && playing && !motion.current.reduced ? /* @__PURE__ */ jsx(G, { transform: `translate(${board.pen.x.toFixed(1)} ${board.pen.y.toFixed(1)})`, children: /* @__PURE__ */ jsx(Path, { d: PEN, fill: "#fde68a", stroke: "#1f2937", strokeWidth: 3, strokeLinejoin: "round" }) }) : null
1383
- ] }),
1384
- board.words.map((word) => /* @__PURE__ */ jsx(Word, { word, width, height, unit: unit2 }, word.key))
1385
- ] }) : null,
1386
- state.status === "loading" ? /* @__PURE__ */ jsxs(View, { style: styles$3.status, accessibilityLiveRegion: "polite", children: [
1387
- /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.accent }),
1388
- /* @__PURE__ */ jsx(Text, { style: styles$3.statusText, children: "Drawing your board…" })
1389
- ] }) : null,
1390
- state.status === "error" ? /* @__PURE__ */ jsxs(View, { style: styles$3.status, accessibilityLiveRegion: "assertive", children: [
1391
- /* @__PURE__ */ jsx(Text, { style: styles$3.statusText, children: state.error }),
1392
- /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: retry, style: [styles$3.retry, { backgroundColor: theme.accent }], children: /* @__PURE__ */ jsx(Text, { style: { color: theme.onAccent, fontWeight: "600" }, children: "Try again" }) })
1393
- ] }) : null
1394
- ] }),
1395
- state.status === "playing" ? /* @__PURE__ */ jsxs(Fragment, { children: [
1396
- /* @__PURE__ */ jsx(Text, { style: [styles$3.caption, { color: theme.text }], accessibilityLiveRegion: "polite", children: board.caption }),
1397
- board.steps > 1 ? /* @__PURE__ */ jsx(View, { style: styles$3.track, accessibilityLabel: "Steps", children: Array.from({ length: board.steps }, (_, i) => /* @__PURE__ */ jsx(
1398
- Pressable,
1399
- {
1400
- accessibilityRole: "button",
1401
- accessibilityLabel: `Go to step ${i + 1}`,
1402
- accessibilityState: { selected: i === board.step },
1403
- onPress: () => model.seek(i),
1404
- hitSlop: 8,
1405
- style: [styles$3.segment, { backgroundColor: i <= board.step ? theme.accent : theme.border }]
1406
- },
1407
- i
1408
- )) }) : null,
1409
- /* @__PURE__ */ jsxs(View, { style: styles$3.bar, children: [
1410
- /* @__PURE__ */ jsx(
1411
- IconButton,
1412
- {
1413
- label: playing ? "Pause" : board.state === "done" ? "Play again" : "Resume",
1414
- glyph: playing ? "❚❚" : board.state === "done" ? "↻" : "▶",
1415
- color: theme.text,
1416
- onPress: () => model.toggle()
1417
- }
1418
- ),
1419
- /* @__PURE__ */ jsx(IconButton, { label: "Replay from the start", glyph: "↺", color: theme.text, onPress: () => model.replay() }),
1420
- /* @__PURE__ */ jsx(Text, { style: [styles$3.step, { color: theme.textMuted }], children: board.step >= 0 ? `Step ${board.step + 1} of ${board.steps}` : "" }),
1421
- /* @__PURE__ */ jsx(
1422
- Pressable,
1423
- {
1424
- accessibilityRole: "button",
1425
- accessibilityLabel: `Speed ${model.speed} times. Change speed`,
1426
- onPress: () => {
1427
- const at = SPEEDS.indexOf(model.speed);
1428
- model.setSpeed(SPEEDS[(at + 1) % SPEEDS.length]);
1429
- repaint();
1430
- },
1431
- style: [styles$3.speed, { borderColor: theme.border }],
1432
- children: /* @__PURE__ */ jsxs(Text, { style: { color: theme.text, fontSize: 12 }, children: [
1433
- model.speed,
1434
- "×"
1435
- ] })
1436
- }
1437
- )
1438
- ] })
1439
- ] }) : null
1440
- ]
1441
- }
1442
- ) }) });
1443
- }
1444
- function Ink({ obj }) {
1445
- if (obj.drawn <= 0) return null;
1446
- return /* @__PURE__ */ jsx(
1447
- Path,
1448
- {
1449
- d: inkPath(obj.strokes, obj.length, obj.drawn),
1450
- stroke: obj.color,
1451
- strokeWidth: obj.width,
1452
- fill: "none",
1453
- strokeLinecap: "round",
1454
- strokeLinejoin: "round"
1455
- }
1456
- );
1457
- }
1458
- function Word({ word, width, height, unit: unit2 }) {
1459
- const left = word.at[0] / BOARD_W * width;
1460
- const top = word.at[1] / BOARD_H * height;
1461
- if (word.kind === "text") {
1462
- const size2 = unit2 * TEXT_SIZE[word.size];
1463
- const shown = word.text.slice(0, Math.ceil(word.text.length * word.shown));
1464
- if (!shown) return null;
1465
- return /* @__PURE__ */ jsx(
1466
- Text,
1467
- {
1468
- style: [styles$3.word, {
1469
- left,
1470
- top: top - size2 * 0.62,
1471
- fontSize: size2,
1472
- color: word.color,
1473
- fontFamily: HAND,
1474
- backgroundColor: word.marked ? MARKER : "transparent"
1475
- }],
1476
- accessibilityLabel: word.text,
1477
- children: shown
1478
- }
1479
- );
1480
- }
1481
- if (word.rowsShown <= 0) return null;
1482
- const size = unit2 * 2.2;
1483
- return /* @__PURE__ */ jsx(View, { style: [styles$3.table, { left, top, width: word.at[2] / BOARD_W * width, borderColor: word.color, backgroundColor: word.marked ? MARKER : "transparent" }], children: word.rows.slice(0, word.rowsShown).map((row, r) => /* @__PURE__ */ jsx(View, { style: styles$3.row, children: row.map((cell, c) => /* @__PURE__ */ jsx(
1484
- Text,
1485
- {
1486
- style: [styles$3.cell, { fontSize: size, color: word.color, borderColor: word.color, fontFamily: HAND, fontWeight: r === 0 ? "700" : "400" }],
1487
- children: cell
1488
- },
1489
- c
1490
- )) }, r)) });
1491
- }
1492
- function IconButton({ label, glyph, color, onPress }) {
1493
- return /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: label, onPress, hitSlop: 8, style: styles$3.icon, children: /* @__PURE__ */ jsx(Text, { style: { color, fontSize: 16 }, children: glyph }) });
1494
- }
1495
- const styles$3 = StyleSheet.create({
1496
- backdrop: { flex: 1, justifyContent: "flex-end", alignItems: "center", padding: 12 },
1497
- centre: { justifyContent: "center" },
1498
- card: {
1499
- width: "100%",
1500
- borderRadius: 16,
1501
- borderWidth: StyleSheet.hairlineWidth,
1502
- overflow: "hidden",
1503
- shadowColor: "#0f172a",
1504
- shadowOpacity: 0.25,
1505
- shadowRadius: 24,
1506
- shadowOffset: { width: 0, height: 12 },
1507
- elevation: 12
1508
- },
1509
- head: { flexDirection: "row", alignItems: "center", paddingHorizontal: 12, paddingVertical: 8, gap: 6 },
1510
- title: { flex: 1, fontSize: 14, fontWeight: "600" },
1511
- badge: { fontSize: 11, fontWeight: "600", color: "#92400e", backgroundColor: "#fef3c7", borderRadius: 999, paddingHorizontal: 8, paddingVertical: 2, overflow: "hidden" },
1512
- sheet: { width: "100%", aspectRatio: BOARD_W / BOARD_H, backgroundColor: "#fcfcfd" },
1513
- status: { ...StyleSheet.absoluteFillObject, alignItems: "center", justifyContent: "center", gap: 10, backgroundColor: "rgba(252,252,253,0.92)", padding: 16 },
1514
- statusText: { color: "#475569", fontSize: 13, textAlign: "center" },
1515
- retry: { paddingHorizontal: 14, paddingVertical: 8, borderRadius: 8 },
1516
- caption: { paddingHorizontal: 14, paddingTop: 10, fontSize: 14, lineHeight: 20, minHeight: 46 },
1517
- track: { flexDirection: "row", gap: 4, paddingHorizontal: 14, paddingTop: 4 },
1518
- segment: { flex: 1, height: 6, borderRadius: 3 },
1519
- bar: { flexDirection: "row", alignItems: "center", paddingHorizontal: 8, paddingVertical: 6, gap: 4 },
1520
- step: { flex: 1, fontSize: 12, marginLeft: 4 },
1521
- speed: { borderWidth: 1, borderRadius: 8, paddingHorizontal: 8, paddingVertical: 4 },
1522
- icon: { width: 34, height: 34, alignItems: "center", justifyContent: "center" },
1523
- word: { position: "absolute", fontWeight: "600" },
1524
- table: { position: "absolute", borderWidth: 1.5 },
1525
- row: { flexDirection: "row" },
1526
- cell: { flex: 1, borderWidth: 0.75, paddingHorizontal: 6, paddingVertical: 3 }
1527
- });
1528
- function PersonIcon({ color }) {
1529
- return /* @__PURE__ */ jsxs(View, { style: styles$2.iconWrap, children: [
1530
- /* @__PURE__ */ jsx(View, { style: [styles$2.iconBand, { borderColor: color }] }),
1531
- /* @__PURE__ */ jsx(View, { style: [styles$2.iconCup, styles$2.iconCupLeft, { backgroundColor: color }] }),
1532
- /* @__PURE__ */ jsx(View, { style: [styles$2.iconCup, styles$2.iconCupRight, { backgroundColor: color }] })
1533
- ] });
1534
- }
1535
- function Orb({ theme, active }) {
1536
- const pulse = useRef(new Animated.Value(0)).current;
1537
- React.useEffect(() => {
1538
- if (!active) {
1539
- pulse.stopAnimation();
1540
- Animated.timing(pulse, { toValue: 0, duration: 240, useNativeDriver: true }).start();
1541
- return;
1542
- }
1543
- const loop = Animated.loop(
1544
- Animated.sequence([
1545
- Animated.timing(pulse, {
1546
- toValue: 1,
1547
- duration: 900,
1548
- easing: Easing.inOut(Easing.quad),
1549
- useNativeDriver: true
1550
- }),
1551
- Animated.timing(pulse, {
1552
- toValue: 0,
1553
- duration: 900,
1554
- easing: Easing.inOut(Easing.quad),
1555
- useNativeDriver: true
1556
- })
1557
- ])
1558
- );
1559
- loop.start();
1560
- return () => loop.stop();
1561
- }, [active, pulse]);
1562
- const scale = pulse.interpolate({ inputRange: [0, 1], outputRange: [1, 1.18] });
1563
- const glow = pulse.interpolate({ inputRange: [0, 1], outputRange: [0.35, 0.7] });
1564
- return /* @__PURE__ */ jsxs(View, { style: styles$2.orbWrap, children: [
1565
- /* @__PURE__ */ jsx(
1566
- Animated.View,
1567
- {
1568
- style: [
1569
- styles$2.orbGlow,
1570
- { backgroundColor: theme.accent, opacity: glow, transform: [{ scale }] }
1571
- ]
1572
- }
1573
- ),
1574
- /* @__PURE__ */ jsx(View, { style: [styles$2.orbCore, { backgroundColor: theme.accent }] })
1575
- ] });
1576
- }
1577
- function Bubble$1({ message, theme, onTalkToHuman, onWhiteboard }) {
1578
- if (message.role === "user") {
1579
- return /* @__PURE__ */ jsx(View, { style: [styles$2.row, styles$2.rowUser], children: /* @__PURE__ */ jsx(View, { style: [
1580
- styles$2.bubble,
1581
- { backgroundColor: theme.userBubble, borderRadius: theme.radius },
1582
- message.error ? { backgroundColor: theme.error } : null
1583
- ], children: /* @__PURE__ */ jsx(Text, { style: {
1584
- color: theme.onUserBubble,
1585
- fontSize: theme.fontSize,
1586
- lineHeight: theme.fontSize * 1.4
1587
- }, children: message.content }) }) });
1588
- }
1589
- return /* @__PURE__ */ jsx(View, { style: [styles$2.row, styles$2.rowAssistant], children: /* @__PURE__ */ jsxs(View, { style: [
1590
- styles$2.assistantBody,
1591
- message.error ? { backgroundColor: theme.error, borderRadius: theme.radius, padding: 12 } : null
1592
- ], children: [
1593
- /* @__PURE__ */ jsx(Markdown, { color: theme.text, accentColor: theme.accent, fontSize: theme.fontSize, children: message.content }),
1594
- onWhiteboard ? /* @__PURE__ */ jsx(
1595
- Pressable,
1596
- {
1597
- onPress: onWhiteboard,
1598
- accessibilityRole: "button",
1599
- accessibilityLabel: "Explain on whiteboard",
1600
- style: [styles$2.errorAction, { borderColor: theme.accent }],
1601
- hitSlop: 6,
1602
- children: /* @__PURE__ */ jsx(Text, { style: [styles$2.humanText, { color: theme.accent, fontSize: theme.fontSize - 1 }], children: "✎ Explain on whiteboard" })
1603
- }
1604
- ) : null,
1605
- message.error && onTalkToHuman ? /* @__PURE__ */ jsxs(
1606
- Pressable,
1607
- {
1608
- onPress: onTalkToHuman,
1609
- accessibilityRole: "button",
1610
- accessibilityLabel: "Talk to a person",
1611
- style: [styles$2.errorAction, { borderColor: theme.accent }],
1612
- hitSlop: 6,
1613
- children: [
1614
- /* @__PURE__ */ jsx(PersonIcon, { color: theme.accent }),
1615
- /* @__PURE__ */ jsx(Text, { style: [styles$2.humanText, {
1616
- color: theme.accent,
1617
- fontSize: theme.fontSize - 1
1618
- }], children: "Talk to a human" })
1619
- ]
1620
- }
1621
- ) : null
1622
- ] }) });
1623
- }
1624
- function resolveTopInset(explicit) {
1625
- var _a;
1626
- if (explicit !== void 0) return explicit;
1627
- if (Platform.OS === "android") return (_a = StatusBar.currentHeight) != null ? _a : 24;
1628
- return 8;
1629
- }
1630
- function useHumanHandover(onTalkToHuman, available) {
1631
- const [reachable, setReachable] = useState(false);
1632
- useEffect(() => {
1633
- if (!onTalkToHuman || available !== void 0) return;
1634
- let cancelled = false;
1635
- void (async () => {
1636
- try {
1637
- const { api } = requireConfigured();
1638
- const status = await api.get(
1639
- EP.supportStatus()
1640
- );
1641
- if (!cancelled) setReachable(!!(status == null ? void 0 : status.enabled));
1642
- } catch {
1643
- }
1644
- })();
1645
- return () => {
1646
- cancelled = true;
1647
- };
1648
- }, [onTalkToHuman, available]);
1649
- if (!onTalkToHuman) return false;
1650
- return available != null ? available : reachable;
1651
- }
1652
- function GuideAIChat({
1653
- theme: overrides,
1654
- placeholder = "Ask me anything",
1655
- greeting = "Ask me anything",
1656
- emptyState,
1657
- showMic = false,
1658
- leadingAccessory,
1659
- title,
1660
- onClose,
1661
- onTalkToHuman,
1662
- humanHandoverAvailable,
1663
- topInset
1664
- }) {
1665
- const { harness, debug } = requireConfigured();
1666
- const {
1667
- messages,
1668
- input,
1669
- setInput,
1670
- send,
1671
- busy,
1672
- canSend,
1673
- status,
1674
- typing,
1675
- followUps,
1676
- explainOnWhiteboard
1677
- } = useGuideAI({ harness, trace: debug });
1678
- const theme = resolveTheme(overrides);
1679
- const listRef = useRef(null);
1680
- const showHuman = useHumanHandover(onTalkToHuman, humanHandoverAvailable);
1681
- const { checklist, dismiss } = useOnboarding();
1682
- const nextSetupStep = checklist == null ? void 0 : checklist.steps.find((step) => step.state === "available");
1683
- const headerTop = resolveTopInset(topInset);
1684
- const submit = () => {
1685
- void send();
1686
- };
1687
- return /* @__PURE__ */ jsxs(
1688
- KeyboardAvoidingView,
1689
- {
1690
- style: [styles$2.container, { backgroundColor: theme.background }],
1691
- behavior: Platform.OS === "ios" ? "padding" : void 0,
1692
- children: [
1693
- title || onClose || showHuman ? /* @__PURE__ */ jsxs(View, { style: [
1694
- styles$2.header,
1695
- { borderBottomColor: theme.border, paddingTop: headerTop + 14 }
1696
- ], children: [
1697
- /* @__PURE__ */ jsx(View, { style: styles$2.headerSide, children: title ? /* @__PURE__ */ jsx(
1698
- Text,
1699
- {
1700
- numberOfLines: 1,
1701
- style: [styles$2.title, { color: theme.text, fontSize: theme.fontSize + 1 }],
1702
- children: title
1703
- }
1704
- ) : null }),
1705
- /* @__PURE__ */ jsxs(View, { style: styles$2.headerActions, children: [
1706
- showHuman ? /* @__PURE__ */ jsxs(
1707
- Pressable,
1708
- {
1709
- onPress: onTalkToHuman,
1710
- accessibilityRole: "button",
1711
- accessibilityLabel: "Talk to a person",
1712
- style: [styles$2.human, {
1713
- backgroundColor: theme.surface,
1714
- borderColor: theme.border
1715
- }],
1716
- hitSlop: 8,
1717
- children: [
1718
- /* @__PURE__ */ jsx(PersonIcon, { color: theme.accent }),
1719
- /* @__PURE__ */ jsx(Text, { style: [styles$2.humanText, {
1720
- color: theme.accent,
1721
- fontSize: theme.fontSize - 2
1722
- }], children: "Talk to human" })
1723
- ]
1724
- }
1725
- ) : null,
1726
- onClose ? /* @__PURE__ */ jsx(
1727
- Pressable,
1728
- {
1729
- onPress: onClose,
1730
- accessibilityRole: "button",
1731
- accessibilityLabel: "Close assistant",
1732
- style: [styles$2.close, { backgroundColor: theme.surface }],
1733
- hitSlop: 10,
1734
- children: /* @__PURE__ */ jsx(Text, { style: [styles$2.closeIcon, { color: theme.text }], children: "✕" })
1735
- }
1736
- ) : null
1737
- ] })
1738
- ] }) : null,
1739
- checklist && !checklist.completed && !checklist.dismissed ? /* @__PURE__ */ jsxs(View, { style: { margin: 14, padding: 14, borderRadius: 12, borderWidth: 1, borderColor: theme.border, backgroundColor: theme.surface }, accessibilityLabel: "Setup checklist", children: [
1740
- /* @__PURE__ */ jsx(Text, { style: { color: theme.text, fontWeight: "700", fontSize: theme.fontSize + 2 }, children: checklist.title }),
1741
- /* @__PURE__ */ jsx(Text, { style: { color: theme.textMuted, marginTop: 3 }, children: checklist.goal }),
1742
- /* @__PURE__ */ jsxs(Text, { style: { color: theme.textMuted, marginTop: 8 }, children: [
1743
- checklist.completed_required,
1744
- " of ",
1745
- checklist.total_required,
1746
- " required steps complete"
1747
- ] }),
1748
- checklist.steps.map((step) => /* @__PURE__ */ jsxs(Text, { style: { color: step.state === "locked" ? theme.textMuted : theme.text, marginTop: 5 }, children: [
1749
- step.state === "complete" ? "✓" : step.state === "locked" ? "–" : "○",
1750
- " ",
1751
- step.title
1752
- ] }, step.id)),
1753
- nextSetupStep ? /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: `Help with ${nextSetupStep.title}`, onPress: () => void send(`Help me with ${nextSetupStep.title}`), style: { alignSelf: "flex-start", marginTop: 10, padding: 10, borderRadius: 8, backgroundColor: theme.accent }, children: /* @__PURE__ */ jsx(Text, { style: { color: theme.onAccent, fontWeight: "600" }, children: "Continue setup" }) }) : null,
1754
- checklist.allow_dismissal ? /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: "I don't need this setup", onPress: () => Alert.alert("Stop showing setup?", "This checklist will not appear again on future visits.", [
1755
- { text: "Keep setup", style: "cancel" },
1756
- { text: "I don't need it", onPress: () => {
1757
- void dismiss().catch(() => Alert.alert("Could not dismiss setup", "Please try again."));
1758
- } }
1759
- ]), style: { alignSelf: "flex-start", marginTop: 10, padding: 10 }, children: /* @__PURE__ */ jsx(Text, { style: { color: theme.textMuted, textDecorationLine: "underline" }, children: "I don't need this setup" }) }) : null
1760
- ] }) : null,
1761
- messages.length === 0 ? /* @__PURE__ */ jsx(View, { style: styles$2.empty, children: emptyState != null ? emptyState : /* @__PURE__ */ jsxs(View, { style: styles$2.greetingRow, children: [
1762
- /* @__PURE__ */ jsx(Orb, { theme, active: busy }),
1763
- /* @__PURE__ */ jsx(Text, { style: [
1764
- styles$2.greeting,
1765
- { color: theme.textMuted, fontSize: theme.fontSize + 3 }
1766
- ], children: greeting })
1767
- ] }) }) : /* @__PURE__ */ jsx(
1768
- FlatList,
1769
- {
1770
- ref: listRef,
1771
- data: messages,
1772
- keyExtractor: (message) => message.id,
1773
- renderItem: ({ item }) => /* @__PURE__ */ jsx(
1774
- Bubble$1,
1775
- {
1776
- message: item,
1777
- theme,
1778
- onTalkToHuman,
1779
- onWhiteboard: item.whiteboard ? () => {
1780
- void explainOnWhiteboard(item.id);
1781
- } : void 0
1782
- }
1783
- ),
1784
- ListFooterComponent: typing || followUps.length ? /* @__PURE__ */ jsxs(View, { style: styles$2.footer, children: [
1785
- typing ? /* @__PURE__ */ jsx(Text, { style: { color: theme.textMuted, fontSize: theme.fontSize }, children: "…" }) : null,
1786
- followUps.map((label) => /* @__PURE__ */ jsx(
1787
- Pressable,
1788
- {
1789
- onPress: () => {
1790
- void send(label);
1791
- },
1792
- accessibilityRole: "button",
1793
- style: [styles$2.chip, { borderColor: theme.accent, borderRadius: theme.radius }],
1794
- hitSlop: 4,
1795
- children: /* @__PURE__ */ jsx(Text, { style: { color: theme.accent, fontSize: theme.fontSize - 1 }, children: label })
1796
- },
1797
- label
1798
- ))
1799
- ] }) : null,
1800
- contentContainerStyle: styles$2.list,
1801
- onContentSizeChange: () => {
1802
- var _a;
1803
- return (_a = listRef.current) == null ? void 0 : _a.scrollToEnd({ animated: true });
1804
- },
1805
- keyboardShouldPersistTaps: "handled"
1806
- }
1807
- ),
1808
- status ? /* @__PURE__ */ jsxs(View, { style: styles$2.status, children: [
1809
- /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: theme.accent }),
1810
- /* @__PURE__ */ jsx(Text, { style: { color: theme.textMuted, fontSize: theme.fontSize - 2 }, children: status })
1811
- ] }) : null,
1812
- /* @__PURE__ */ jsxs(View, { style: styles$2.composerRow, children: [
1813
- /* @__PURE__ */ jsxs(View, { style: [
1814
- styles$2.composer,
1815
- {
1816
- backgroundColor: theme.surface,
1817
- borderRadius: theme.radius + 6,
1818
- borderColor: theme.border
1819
- }
1820
- ], children: [
1821
- leadingAccessory ? /* @__PURE__ */ jsx(View, { style: styles$2.leading, children: leadingAccessory }) : null,
1822
- /* @__PURE__ */ jsx(
1823
- TextInput,
1824
- {
1825
- style: [styles$2.input, { color: theme.text, fontSize: theme.fontSize }],
1826
- value: input,
1827
- onChangeText: setInput,
1828
- placeholder: checklist && !checklist.completed && checklist.chat_policy === "setup_only" ? "Ask about your setup" : placeholder,
1829
- placeholderTextColor: theme.textMuted,
1830
- editable: !busy,
1831
- onSubmitEditing: submit,
1832
- returnKeyType: "send",
1833
- multiline: true,
1834
- accessibilityLabel: placeholder
1835
- }
1836
- ),
1837
- /* @__PURE__ */ jsx(
1838
- Pressable,
1839
- {
1840
- onPress: submit,
1841
- disabled: !canSend,
1842
- accessibilityRole: "button",
1843
- accessibilityLabel: "Send",
1844
- style: [styles$2.send, { backgroundColor: canSend ? theme.accent : theme.border }],
1845
- hitSlop: 6,
1846
- children: /* @__PURE__ */ jsx(Text, { style: [
1847
- styles$2.sendIcon,
1848
- { color: canSend ? theme.onAccent : theme.textMuted }
1849
- ], children: "↑" })
1850
- }
1851
- )
1852
- ] }),
1853
- showMic ? /* @__PURE__ */ jsx(
1854
- Pressable,
1855
- {
1856
- accessibilityRole: "button",
1857
- accessibilityLabel: "Voice input",
1858
- style: [styles$2.mic, { backgroundColor: theme.surface, borderColor: theme.border }],
1859
- children: /* @__PURE__ */ jsx(Text, { style: { color: theme.textMuted, fontSize: 18 }, children: "🎤" })
1860
- }
1861
- ) : null
1862
- ] }),
1863
- /* @__PURE__ */ jsx(GuideAIWhiteboard, { theme: overrides })
1864
- ]
1865
- }
1866
- );
1867
- }
1868
- const styles$2 = StyleSheet.create({
1869
- container: { flex: 1 },
1870
- header: {
1871
- flexDirection: "row",
1872
- alignItems: "center",
1873
- justifyContent: "space-between",
1874
- // paddingTop is set inline from the status-bar inset; only the
1875
- // bottom half of the navbar's breathing room lives here.
1876
- paddingHorizontal: 16,
1877
- paddingBottom: 14,
1878
- borderBottomWidth: StyleSheet.hairlineWidth
1879
- },
1880
- headerSide: { flex: 1, minWidth: 0 },
1881
- headerActions: { flexDirection: "row", alignItems: "center", gap: 8 },
1882
- title: { fontWeight: "600" },
1883
- human: {
1884
- flexDirection: "row",
1885
- alignItems: "center",
1886
- gap: 6,
1887
- paddingHorizontal: 10,
1888
- paddingVertical: 6,
1889
- borderRadius: 999,
1890
- borderWidth: StyleSheet.hairlineWidth
1891
- },
1892
- humanText: { fontWeight: "600" },
1893
- errorAction: {
1894
- flexDirection: "row",
1895
- alignItems: "center",
1896
- gap: 6,
1897
- alignSelf: "flex-start",
1898
- marginTop: 10,
1899
- paddingHorizontal: 12,
1900
- paddingVertical: 7,
1901
- borderRadius: 999,
1902
- borderWidth: StyleSheet.hairlineWidth
1903
- },
1904
- iconWrap: { width: 14, height: 14, alignItems: "center", justifyContent: "center" },
1905
- iconBand: {
1906
- position: "absolute",
1907
- top: 1,
1908
- width: 12,
1909
- height: 9,
1910
- borderWidth: 1.6,
1911
- borderBottomWidth: 0,
1912
- borderTopLeftRadius: 6,
1913
- borderTopRightRadius: 6
1914
- },
1915
- iconCup: { position: "absolute", bottom: 1, width: 3.5, height: 6, borderRadius: 1.5 },
1916
- iconCupLeft: { left: 0 },
1917
- iconCupRight: { right: 0 },
1918
- close: {
1919
- width: 32,
1920
- height: 32,
1921
- borderRadius: 16,
1922
- alignItems: "center",
1923
- justifyContent: "center"
1924
- },
1925
- closeIcon: { fontSize: 15, fontWeight: "600", lineHeight: 18 },
1926
- list: { padding: 16, paddingBottom: 8, gap: 14 },
1927
- empty: {
1928
- // Centred, not pinned near the top: before the first message the
1929
- // greeting is the only thing on screen, and hanging it under the
1930
- // navbar leaves the rest of the display empty.
1931
- flex: 1,
1932
- alignItems: "center",
1933
- justifyContent: "center",
1934
- paddingHorizontal: 24,
1935
- paddingBottom: 24
1936
- },
1937
- greetingRow: { flexDirection: "row", alignItems: "center", gap: 14 },
1938
- greeting: { fontWeight: "400", textAlign: "center", flexShrink: 1 },
1939
- orbWrap: { width: 34, height: 34, alignItems: "center", justifyContent: "center" },
1940
- orbGlow: { position: "absolute", width: 34, height: 34, borderRadius: 17 },
1941
- orbCore: { width: 20, height: 20, borderRadius: 10 },
1942
- row: { flexDirection: "row" },
1943
- rowUser: { justifyContent: "flex-end" },
1944
- rowAssistant: { justifyContent: "flex-start" },
1945
- // The user's bubble hugs its text: a three-word question drawn as a
1946
- // full-width block reads as a paragraph, not a chat message. It is
1947
- // capped at 80% so a long one still leaves the reply side legible.
1948
- bubble: { maxWidth: "80%", paddingHorizontal: 16, paddingVertical: 11 },
1949
- // The assistant's body does NOT hug its content, and that is the whole
1950
- // point of `width` here rather than `maxWidth` alone.
1951
- //
1952
- // A View with only maxWidth shrink-wraps — React Native's equivalent of
1953
- // width: fit-content. For a paragraph that looks fine, because the text
1954
- // fills the measure anyway. For anything that lays itself out against
1955
- // its parent — a table whose cells are `flex: 1`, a fenced code block,
1956
- // a numbered list — the parent has collapsed to nothing by the time the
1957
- // child is measured, so the table renders as an empty sliver and every
1958
- // reply ends up a different width.
1959
- //
1960
- // Fixing it here rather than on the table keeps every block type
1961
- // consistent: one column, the same measure for prose, code and tables.
1962
- assistantBody: { width: "80%" },
1963
- status: {
1964
- flexDirection: "row",
1965
- alignItems: "center",
1966
- gap: 8,
1967
- paddingHorizontal: 22,
1968
- paddingBottom: 8
1969
- },
1970
- composerRow: {
1971
- flexDirection: "row",
1972
- alignItems: "flex-end",
1973
- gap: 10,
1974
- paddingHorizontal: 14,
1975
- paddingBottom: Platform.OS === "ios" ? 10 : 14,
1976
- paddingTop: 4
1977
- },
1978
- composer: {
1979
- flex: 1,
1980
- flexDirection: "row",
1981
- alignItems: "center",
1982
- paddingLeft: 8,
1983
- paddingRight: 6,
1984
- paddingVertical: 6,
1985
- borderWidth: StyleSheet.hairlineWidth,
1986
- gap: 6
1987
- },
1988
- leading: { paddingLeft: 4 },
1989
- input: {
1990
- flex: 1,
1991
- paddingHorizontal: 8,
1992
- paddingVertical: Platform.OS === "ios" ? 8 : 4,
1993
- maxHeight: 120
1994
- },
1995
- send: { width: 34, height: 34, borderRadius: 17, alignItems: "center", justifyContent: "center" },
1996
- sendIcon: { fontSize: 17, fontWeight: "700", lineHeight: 20 },
1997
- footer: {
1998
- flexDirection: "row",
1999
- flexWrap: "wrap",
2000
- gap: 8,
2001
- paddingTop: 4
2002
- },
2003
- chip: {
2004
- borderWidth: 1,
2005
- paddingHorizontal: 12,
2006
- paddingVertical: 7
2007
- },
2008
- mic: {
2009
- width: 46,
2010
- height: 46,
2011
- borderRadius: 23,
2012
- alignItems: "center",
2013
- justifyContent: "center",
2014
- borderWidth: StyleSheet.hairlineWidth
2015
- }
2016
- });
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { useState, useRef, useEffect, useCallback, useMemo, useContext, createContext } from "react";
3
+ import { Platform, StatusBar, KeyboardAvoidingView, View, Text, Pressable, ScrollView, TextInput, ActivityIndicator, FlatList, StyleSheet, Dimensions, Animated, PanResponder, Modal, Easing } from "react-native";
4
+ import { r as resolveTheme, G as GuideAIChat } from "./GuideAIChat-DOC4zx-a.js";
5
+ import { D, a, b, c, d, M, e, l } from "./GuideAIChat-DOC4zx-a.js";
6
+ import { r as requireConfigured, E as EP, d as useOnboarding } from "./useConversations-B_7km_uH.js";
2017
7
  const POLL_INTERVAL_MS = 3e3;
2018
8
  const CONVERSATION_KEY = "guideai_support_conversation";
2019
9
  function useStoredConversation() {
@@ -2770,14 +760,18 @@ const styles = StyleSheet.create({
2770
760
  nudgeText: { lineHeight: 19 }
2771
761
  });
2772
762
  export {
763
+ D as DEFAULT_LANGUAGE_PICKER_LABELS,
764
+ a as DEFAULT_LIVE_VOICE_LABELS,
2773
765
  GuideAIButton,
2774
766
  GuideAIChat,
767
+ b as GuideAILanguagePicker,
2775
768
  GuideAILauncher,
769
+ c as GuideAILiveVoice,
2776
770
  GuideAISupportChat,
2777
- GuideAIWhiteboard,
2778
- Markdown,
2779
- darkTheme,
2780
- lightTheme,
771
+ d as GuideAIWhiteboard,
772
+ M as Markdown,
773
+ e as darkTheme,
774
+ l as lightTheme,
2781
775
  resolveTheme,
2782
776
  useGuideAISheet
2783
777
  };