@guideai/react-native 0.9.0 → 0.10.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.
Files changed (49) hide show
  1. package/README.md +6 -3
  2. package/dist/{GuideAIChat-BFu10t6D.cjs → GuideAIChat-BtbkPIvE.cjs} +285 -26
  3. package/dist/GuideAIChat-BtbkPIvE.cjs.map +1 -0
  4. package/dist/{GuideAIChat-Ba6n1ePs.js → GuideAIChat-CKW6dgl_.js} +286 -27
  5. package/dist/GuideAIChat-CKW6dgl_.js.map +1 -0
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.d.ts +58 -6
  8. package/dist/index.mjs +2 -2
  9. package/dist/ui.cjs +2 -2
  10. package/dist/ui.d.ts +13 -3
  11. package/dist/ui.mjs +3 -3
  12. package/dist/{useConversations-C-OmzdeA.js → useConversations-BljCr0Od.js} +1067 -43
  13. package/dist/useConversations-BljCr0Od.js.map +1 -0
  14. package/dist/{useConversations-Chn_GKOz.cjs → useConversations-UiwD_WVF.cjs} +1067 -43
  15. package/dist/useConversations-UiwD_WVF.cjs.map +1 -0
  16. package/dist/voice.cjs +61 -23
  17. package/dist/voice.cjs.map +1 -1
  18. package/dist/voice.d.ts +13 -3
  19. package/dist/voice.mjs +62 -24
  20. package/dist/voice.mjs.map +1 -1
  21. package/package.json +1 -1
  22. package/dist/GuideAIChat-BFu10t6D.cjs.map +0 -1
  23. package/dist/GuideAIChat-BQQ8lUKs.js +0 -2795
  24. package/dist/GuideAIChat-BQQ8lUKs.js.map +0 -1
  25. package/dist/GuideAIChat-Ba6n1ePs.js.map +0 -1
  26. package/dist/GuideAIChat-CNmEo5bZ.cjs +0 -2794
  27. package/dist/GuideAIChat-CNmEo5bZ.cjs.map +0 -1
  28. package/dist/GuideAIChat-CxyWFl_o.cjs +0 -2493
  29. package/dist/GuideAIChat-CxyWFl_o.cjs.map +0 -1
  30. package/dist/GuideAIChat-DOC4zx-a.js +0 -2494
  31. package/dist/GuideAIChat-DOC4zx-a.js.map +0 -1
  32. package/dist/GuideAIChat-SU0CVNby.js +0 -2795
  33. package/dist/GuideAIChat-SU0CVNby.js.map +0 -1
  34. package/dist/GuideAIChat-W8KQ4Y6i.cjs +0 -2794
  35. package/dist/GuideAIChat-W8KQ4Y6i.cjs.map +0 -1
  36. package/dist/useConversations-B_7km_uH.js +0 -4243
  37. package/dist/useConversations-B_7km_uH.js.map +0 -1
  38. package/dist/useConversations-C-OmzdeA.js.map +0 -1
  39. package/dist/useConversations-CJEaVqch.cjs +0 -4290
  40. package/dist/useConversations-CJEaVqch.cjs.map +0 -1
  41. package/dist/useConversations-CTbQBTz-.cjs +0 -4242
  42. package/dist/useConversations-CTbQBTz-.cjs.map +0 -1
  43. package/dist/useConversations-Chn_GKOz.cjs.map +0 -1
  44. package/dist/useConversations-Ckyqbxqi.cjs +0 -4299
  45. package/dist/useConversations-Ckyqbxqi.cjs.map +0 -1
  46. package/dist/useConversations-DzhYCIiY.js +0 -4300
  47. package/dist/useConversations-DzhYCIiY.js.map +0 -1
  48. package/dist/useConversations-SbhtYN_R.js +0 -4291
  49. package/dist/useConversations-SbhtYN_R.js.map +0 -1
package/README.md CHANGED
@@ -43,7 +43,7 @@ GuideAI.configure({ apiKey: 'pk_live_…', origin: 'https://app.example.com', st
43
43
  <GuideAIVoiceChat title="Tutor" />
44
44
  ```
45
45
 
46
- That screen has streaming answers, follow-up chips, Explain on whiteboard (spoken), the mic (asks which language once), live voice, and a chat history (new chat, previous chats). `<GuideAIChat />` from `@guideai/react-native/ui` is the same without voice. Colours come from `theme`.
46
+ That screen has streaming answers, follow-up chips, Explain on whiteboard and Full lesson (spoken), the mic (asks which language once), live voice, and a chat history (new chat, previous chats). `<GuideAIChat />` from `@guideai/react-native/ui` is the same without voice. Colours come from `theme`.
47
47
 
48
48
  ## Set up once, at startup
49
49
 
@@ -118,6 +118,7 @@ function Tutor() {
118
118
  <YourMarkdown text={m.content} /> {/* pictures are Markdown images here */}
119
119
  <Text>{formatTime(m.createdAt)}</Text>
120
120
  {m.whiteboard && <Button title="Explain on whiteboard" onPress={() => chat.explainOnWhiteboard(m.id)} />}
121
+ {m.lesson && <Button title="Full lesson" onPress={() => chat.explainOnWhiteboard(m.id, { lesson: true })} />}
121
122
  {m.pendingAction && (
122
123
  <ApproveBar label={m.pendingAction.label}
123
124
  onApprove={() => chat.confirm(m.id)} onCancel={() => chat.cancel(m.id)} />
@@ -140,9 +141,9 @@ function Tutor() {
140
141
 
141
142
  | On `useGuideAI()` | |
142
143
  |---|---|
143
- | `messages` | Ready to draw: `{ id, role, content, createdAt, question, streaming, error, suggestions, whiteboard, images, pendingAction }`. An answer with no text yet is left out (`typing`). |
144
+ | `messages` | Ready to draw: `{ id, role, content, createdAt, question, streaming, error, suggestions, whiteboard, lesson, images, pendingAction }`. An answer with no text yet is left out (`typing`). |
144
145
  | `typing`, `followUps` | Typing indicator; chips under the latest answer (its suggestions, else `followUps` from configure). |
145
- | `explainOnWhiteboard(id)`, `whiteboardAvailable` | The board for an answer, with the question it answered. |
146
+ | `explainOnWhiteboard(id, { lesson? })`, `whiteboardAvailable`, `lessonsAvailable` | The board for an answer, with the question it answered; `{ lesson: true }` for the Full lesson. |
146
147
  | `send(text?)`, `input`, `setInput`, `canSend`, `busy`, `status` | The conversation. `send` resolves with the answer. |
147
148
  | `confirm(id)`, `cancel(id)` | Answer a `pendingAction`. Nothing is written until `confirm`. |
148
149
  | `retry()`, `clear()` | `clear()` starts a new chat; the old one stays in the history. |
@@ -168,6 +169,8 @@ function Tutor() {
168
169
 
169
170
  `suggestions` appear when the agent's Blueprint has the **Suggest follow-ups** node, `whiteboard` when it has **Explain on a whiteboard**, and `images` when it has **Draw images**. The whiteboard reads each step aloud when `speech` is configured. A board shows complex things the way a teacher would: drawn by the pen from a line drawing found on the web, or as the real photo, with labels on their parts (an arrow, a ring or a box). Nothing on a board is ever generated. With **Animate** on in that node, a board about how something works shows it moving: a payment travelling along an arrow, gears turning, a balance counting up.
170
171
 
172
+ The node's **Style** decides when a board is a living 3D model instead of a pen drawing (2D only, 3D when it fits, 3D always): servers, databases, queues and people on a floor, traffic flowing between them, parts overloading or going down, and a metrics bar that turns green as things improve. With **Full lesson** on, answers also get `lesson`: a longer 3D lesson that plays by itself, each step with a chapter, text to read, a key idea and what changed. 3D boards need `react-native-svg` 13 or later (they draw with `SvgXml`).
173
+
171
174
  ## Or a floating button
172
175
 
173
176
  ```tsx
@@ -2,7 +2,7 @@
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const React = require("react");
4
4
  const reactNative = require("react-native");
5
- const useConversations = require("./useConversations-Ckyqbxqi.cjs");
5
+ const useConversations = require("./useConversations-UiwD_WVF.cjs");
6
6
  const reactNativeSvg = require("react-native-svg");
7
7
  function parseInline(text) {
8
8
  const spans = [];
@@ -468,6 +468,136 @@ class Player {
468
468
  this.enterStep(this.stepIndex + 1);
469
469
  }
470
470
  }
471
+ const REPAINT_MS = 80;
472
+ class IsoModel {
473
+ constructor(options) {
474
+ this.options = options;
475
+ this.plan = null;
476
+ this.drawing = null;
477
+ this.player = null;
478
+ this.shown = [0, 0];
479
+ this.caption = "";
480
+ this.step = -1;
481
+ this.ticker = null;
482
+ this.born = 0;
483
+ this.lastPaint = 0;
484
+ }
485
+ now() {
486
+ var _a, _b, _c;
487
+ return (_c = (_b = (_a = this.options).now) == null ? void 0 : _b.call(_a)) != null ? _c : Date.now();
488
+ }
489
+ snapshot() {
490
+ var _a, _b, _c, _d, _e, _f;
491
+ const plan = this.plan;
492
+ const drawing = this.drawing;
493
+ const step = Math.max(0, this.step);
494
+ return {
495
+ svg: drawing ? drawing.svg(this.shown[0], this.shown[1], (this.now() - this.born) / 1e3) : "",
496
+ metrics: drawing ? drawing.metrics(step) : [],
497
+ legend: drawing ? drawing.legend() : [],
498
+ caption: this.caption,
499
+ step: this.step,
500
+ steps: (_a = plan == null ? void 0 : plan.steps.length) != null ? _a : 0,
501
+ state: (_c = (_b = this.player) == null ? void 0 : _b.status) != null ? _c : "idle",
502
+ title: (_d = plan == null ? void 0 : plan.title) != null ? _d : "",
503
+ sample: (plan == null ? void 0 : plan.sample) === true,
504
+ lesson: (plan == null ? void 0 : plan.lesson) === true,
505
+ reading: (plan == null ? void 0 : plan.lesson) && this.step >= 0 ? (_e = plan.steps[this.step]) != null ? _e : null : null,
506
+ goals: ((_f = plan == null ? void 0 : plan.goals) != null ? _f : []).map((g) => ({ text: g.text, done: step + 1 >= g.step }))
507
+ };
508
+ }
509
+ play(plan) {
510
+ var _a, _b, _c, _d;
511
+ this.destroy();
512
+ this.plan = plan;
513
+ const reduced = (_a = this.options.reducedMotion) != null ? _a : false;
514
+ const drawing = new useConversations.IsoDrawing(plan, reduced);
515
+ this.drawing = drawing;
516
+ this.born = this.now();
517
+ const steps = plan.steps.map((step, index) => {
518
+ const duration = drawing.stepDuration(index);
519
+ return {
520
+ say: step.say,
521
+ enter: () => this.show(index, 0, true),
522
+ ops: [{ duration, run: (progress) => this.show(index, duration ? progress * duration : Infinity, progress >= 1) }]
523
+ };
524
+ });
525
+ this.player = new Player(steps, {
526
+ narrate: (_b = this.options.narrate) != null ? _b : (async () => false),
527
+ stopNarration: () => {
528
+ var _a2, _b2;
529
+ return (_b2 = (_a2 = this.options).stopNarration) == null ? void 0 : _b2.call(_a2);
530
+ },
531
+ reset: () => this.show(0, 0, true),
532
+ onStep: (index, step) => {
533
+ this.step = index;
534
+ this.caption = step.say;
535
+ this.options.onChange();
536
+ },
537
+ onState: (state) => {
538
+ this.live(state === "playing" || state === "done");
539
+ this.options.onChange();
540
+ },
541
+ requestFrame: (_c = this.options.requestFrame) != null ? _c : ((cb) => requestAnimationFrame(cb)),
542
+ cancelFrame: (_d = this.options.cancelFrame) != null ? _d : ((id) => cancelAnimationFrame(id)),
543
+ now: () => this.now()
544
+ }, reduced);
545
+ this.player.play();
546
+ }
547
+ toggle() {
548
+ if (!this.player) return;
549
+ if (this.player.status === "playing") this.player.pause();
550
+ else this.player.play();
551
+ }
552
+ replay() {
553
+ var _a;
554
+ (_a = this.player) == null ? void 0 : _a.replay();
555
+ }
556
+ seek(step) {
557
+ var _a;
558
+ (_a = this.player) == null ? void 0 : _a.seek(step);
559
+ }
560
+ setSpeed(speed) {
561
+ var _a;
562
+ (_a = this.player) == null ? void 0 : _a.setSpeed(speed);
563
+ }
564
+ get speed() {
565
+ var _a, _b;
566
+ return (_b = (_a = this.player) == null ? void 0 : _a.rate) != null ? _b : 1;
567
+ }
568
+ destroy() {
569
+ var _a;
570
+ this.live(false);
571
+ (_a = this.player) == null ? void 0 : _a.destroy();
572
+ this.player = null;
573
+ this.plan = null;
574
+ this.drawing = null;
575
+ this.step = -1;
576
+ this.caption = "";
577
+ this.shown = [0, 0];
578
+ }
579
+ /** Step *index* at *t* ms; repaint now when it matters, else at most every REPAINT_MS. */
580
+ show(index, t, force) {
581
+ this.shown = [index, t];
582
+ const now = this.now();
583
+ if (!force && now - this.lastPaint < REPAINT_MS) return;
584
+ this.lastPaint = now;
585
+ this.options.onChange();
586
+ }
587
+ /** Keep traffic moving between the Player's frames. */
588
+ live(on) {
589
+ var _a, _b;
590
+ const clear = (_a = this.options.clearInterval) != null ? _a : ((id) => clearInterval(id));
591
+ if (this.ticker !== null) clear(this.ticker);
592
+ this.ticker = null;
593
+ if (!on || this.options.reducedMotion) return;
594
+ const every = (_b = this.options.setInterval) != null ? _b : ((cb, ms) => setInterval(cb, ms));
595
+ this.ticker = every(() => {
596
+ this.lastPaint = this.now();
597
+ this.options.onChange();
598
+ }, REPAINT_MS);
599
+ }
600
+ }
471
601
  const STORYBOARD_ICON_STROKES = {
472
602
  phone: [
473
603
  "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",
@@ -1647,6 +1777,22 @@ const SHEET_W = 1600;
1647
1777
  const SHEET_H = 1e3;
1648
1778
  const HAND = reactNative.Platform.select({ ios: "Bradley Hand", android: "casual", default: void 0 });
1649
1779
  const PEN = "M0 0 L-5 -22 L22 -70 L32 -63 L5 -16 Z";
1780
+ const isIso = (scene) => !!scene && "kind" in scene && scene.kind === "iso";
1781
+ const TONE_INK = { good: "#15803d", bad: "#b91c1c", warn: "#b45309" };
1782
+ const CHAPTER = {
1783
+ problem: ["#fee2e2", "#b91c1c"],
1784
+ solution: ["#dcfce7", "#15803d"],
1785
+ technique: ["#dbeafe", "#1d4ed8"],
1786
+ tradeoff: ["#fef3c7", "#b45309"],
1787
+ insight: ["#ede9fe", "#6d28d9"],
1788
+ recap: ["#0f172a", "#ffffff"],
1789
+ setup: ["#e2e8f0", "#334155"]
1790
+ };
1791
+ const CALLOUT = {
1792
+ insight: ["Key idea", "#f5f3ff", "#ddd6fe", "#6d28d9"],
1793
+ warn: ["Watch out", "#fef2f2", "#fecaca", "#b91c1c"],
1794
+ tip: ["Good to know", "#f0fdf4", "#bbf7d0", "#15803d"]
1795
+ };
1650
1796
  function GuideAIWhiteboard({ theme: overrides }) {
1651
1797
  const theme = resolveTheme(overrides);
1652
1798
  const { state, close, retry } = useConversations.useWhiteboard();
@@ -1666,6 +1812,14 @@ function GuideAIWhiteboard({ theme: overrides }) {
1666
1812
  narrate: async (text) => speech && !voice.current.muted ? speech.say(text) : false,
1667
1813
  stopNarration: () => speech == null ? void 0 : speech.stop()
1668
1814
  }), [speech]);
1815
+ const isoModel = React.useMemo(() => new IsoModel({
1816
+ onChange: () => repaint(),
1817
+ get reducedMotion() {
1818
+ return motion.current.reduced;
1819
+ },
1820
+ narrate: async (text) => speech && !voice.current.muted ? speech.say(text) : false,
1821
+ stopNarration: () => speech == null ? void 0 : speech.stop()
1822
+ }), [speech]);
1669
1823
  const toggleVoice = () => {
1670
1824
  if (!muted) speech == null ? void 0 : speech.stop();
1671
1825
  setMuted((on) => !on);
@@ -1677,18 +1831,34 @@ function GuideAIWhiteboard({ theme: overrides }) {
1677
1831
  }, () => void 0));
1678
1832
  }, []);
1679
1833
  React.useEffect(() => {
1680
- if (state.status === "playing" && state.scene) model.play(state.scene);
1681
- else model.destroy();
1682
- }, [model, state.status, state.scene]);
1683
- React.useEffect(() => () => model.destroy(), [model]);
1834
+ const scene = state.status === "playing" ? state.scene : null;
1835
+ if (isIso(scene)) {
1836
+ model.destroy();
1837
+ isoModel.play(scene);
1838
+ } else if (scene) {
1839
+ isoModel.destroy();
1840
+ model.play(scene);
1841
+ } else {
1842
+ model.destroy();
1843
+ isoModel.destroy();
1844
+ }
1845
+ }, [model, isoModel, state.status, state.scene]);
1846
+ React.useEffect(() => () => {
1847
+ model.destroy();
1848
+ isoModel.destroy();
1849
+ }, [model, isoModel]);
1684
1850
  if (state.status === "closed") return null;
1685
1851
  const board = model.snapshot();
1852
+ const iso = state.status === "playing" && isIso(state.scene) ? isoModel.snapshot() : null;
1853
+ const ctl = iso ? isoModel : model;
1854
+ const view = iso != null ? iso : board;
1686
1855
  const height = width / (useConversations.BOARD_W / useConversations.BOARD_H);
1687
1856
  const unit2 = width / 100;
1688
- const playing = board.state === "playing";
1689
- const title = state.status === "playing" ? board.title : state.question;
1857
+ const playing = view.state === "playing";
1858
+ const title = state.status === "playing" ? view.title : state.question;
1690
1859
  const shut = () => {
1691
1860
  model.destroy();
1861
+ isoModel.destroy();
1692
1862
  close();
1693
1863
  };
1694
1864
  return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { visible: true, transparent: true, animationType: "fade", onRequestClose: shut, supportedOrientations: ["portrait", "landscape"], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles$3.backdrop, expanded ? styles$3.centre : null], pointerEvents: "box-none", children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1700,13 +1870,14 @@ function GuideAIWhiteboard({ theme: overrides }) {
1700
1870
  children: [
1701
1871
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles$3.head, children: [
1702
1872
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles$3.title, { color: theme.text }], numberOfLines: 1, children: title || "Whiteboard" }),
1703
- board.sample && state.status === "playing" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles$3.badge, accessibilityHint: "This board uses example numbers.", children: "Example" }) : null,
1873
+ view.sample && state.status === "playing" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles$3.badge, accessibilityHint: "This board uses example numbers.", children: "Example" }) : null,
1704
1874
  speech ? /* @__PURE__ */ jsxRuntime.jsx(IconButton, { label: muted ? "Read the board aloud" : "Mute the board", glyph: muted ? "🔇" : "🔈", color: theme.textMuted, onPress: toggleVoice }) : null,
1705
1875
  /* @__PURE__ */ jsxRuntime.jsx(IconButton, { label: expanded ? "Collapse whiteboard" : "Expand whiteboard", glyph: expanded ? "⤡" : "⤢", color: theme.textMuted, onPress: () => setExpanded((v) => !v) }),
1706
1876
  /* @__PURE__ */ jsxRuntime.jsx(IconButton, { label: "Close whiteboard", glyph: "✕", color: theme.textMuted, onPress: shut })
1707
1877
  ] }),
1708
1878
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles$3.sheet, onLayout: (e) => setWidth(e.nativeEvent.layout.width), children: [
1709
- width > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1879
+ width > 0 && iso ? /* @__PURE__ */ jsxRuntime.jsx(IsoSheet, { snap: iso, width, height }) : null,
1880
+ width > 0 && !iso ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1710
1881
  /* @__PURE__ */ jsxRuntime.jsxs(reactNativeSvg.Svg, { width, height, viewBox: `0 0 ${SHEET_W} ${SHEET_H}`, children: [
1711
1882
  board.pictures.map((pic) => /* @__PURE__ */ jsxRuntime.jsx(Picture, { pic }, pic.key)),
1712
1883
  board.inks.filter((obj) => obj.marker).map((obj) => /* @__PURE__ */ jsxRuntime.jsx(Ink, { obj }, obj.key)),
@@ -1730,16 +1901,16 @@ function GuideAIWhiteboard({ theme: overrides }) {
1730
1901
  ] }) : null
1731
1902
  ] }),
1732
1903
  state.status === "playing" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1733
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles$3.caption, { color: theme.text }], accessibilityLiveRegion: "polite", children: board.caption }),
1734
- board.steps > 1 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles$3.track, accessibilityLabel: "Steps", children: Array.from({ length: board.steps }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx(
1904
+ (iso == null ? void 0 : iso.lesson) ? /* @__PURE__ */ jsxRuntime.jsx(LessonReading, { snap: iso, text: theme.text, muted: theme.textMuted }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles$3.caption, { color: theme.text }], accessibilityLiveRegion: "polite", children: view.caption }),
1905
+ view.steps > 1 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles$3.track, accessibilityLabel: "Steps", children: Array.from({ length: view.steps }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx(
1735
1906
  reactNative.Pressable,
1736
1907
  {
1737
1908
  accessibilityRole: "button",
1738
1909
  accessibilityLabel: `Go to step ${i + 1}`,
1739
- accessibilityState: { selected: i === board.step },
1740
- onPress: () => model.seek(i),
1910
+ accessibilityState: { selected: i === view.step },
1911
+ onPress: () => ctl.seek(i),
1741
1912
  hitSlop: 8,
1742
- style: [styles$3.segment, { backgroundColor: i <= board.step ? theme.accent : theme.border }]
1913
+ style: [styles$3.segment, { backgroundColor: i <= view.step ? theme.accent : theme.border }]
1743
1914
  },
1744
1915
  i
1745
1916
  )) }) : null,
@@ -1747,27 +1918,27 @@ function GuideAIWhiteboard({ theme: overrides }) {
1747
1918
  /* @__PURE__ */ jsxRuntime.jsx(
1748
1919
  IconButton,
1749
1920
  {
1750
- label: playing ? "Pause" : board.state === "done" ? "Play again" : "Resume",
1751
- glyph: playing ? "❚❚" : board.state === "done" ? "↻" : "▶",
1921
+ label: playing ? "Pause" : view.state === "done" ? "Play again" : "Resume",
1922
+ glyph: playing ? "❚❚" : view.state === "done" ? "↻" : "▶",
1752
1923
  color: theme.text,
1753
- onPress: () => model.toggle()
1924
+ onPress: () => ctl.toggle()
1754
1925
  }
1755
1926
  ),
1756
- /* @__PURE__ */ jsxRuntime.jsx(IconButton, { label: "Replay from the start", glyph: "↺", color: theme.text, onPress: () => model.replay() }),
1757
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles$3.step, { color: theme.textMuted }], children: board.step >= 0 ? `Step ${board.step + 1} of ${board.steps}` : "" }),
1927
+ /* @__PURE__ */ jsxRuntime.jsx(IconButton, { label: "Replay from the start", glyph: "↺", color: theme.text, onPress: () => ctl.replay() }),
1928
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles$3.step, { color: theme.textMuted }], children: view.step >= 0 ? `Step ${view.step + 1} of ${view.steps}` : "" }),
1758
1929
  /* @__PURE__ */ jsxRuntime.jsx(
1759
1930
  reactNative.Pressable,
1760
1931
  {
1761
1932
  accessibilityRole: "button",
1762
- accessibilityLabel: `Speed ${model.speed} times. Change speed`,
1933
+ accessibilityLabel: `Speed ${ctl.speed} times. Change speed`,
1763
1934
  onPress: () => {
1764
- const at = SPEEDS.indexOf(model.speed);
1765
- model.setSpeed(SPEEDS[(at + 1) % SPEEDS.length]);
1935
+ const at = SPEEDS.indexOf(ctl.speed);
1936
+ ctl.setSpeed(SPEEDS[(at + 1) % SPEEDS.length]);
1766
1937
  repaint();
1767
1938
  },
1768
1939
  style: [styles$3.speed, { borderColor: theme.border }],
1769
1940
  children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { style: { color: theme.text, fontSize: 12 }, children: [
1770
- model.speed,
1941
+ ctl.speed,
1771
1942
  "×"
1772
1943
  ] })
1773
1944
  }
@@ -1778,6 +1949,64 @@ function GuideAIWhiteboard({ theme: overrides }) {
1778
1949
  }
1779
1950
  ) }) });
1780
1951
  }
1952
+ function IsoSheet({ snap, width, height }) {
1953
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { width, height, backgroundColor: "#f7f6f2" }, accessibilityLabel: snap.title, accessible: true, children: [
1954
+ /* @__PURE__ */ jsxRuntime.jsx(reactNativeSvg.SvgXml, { xml: snap.svg, width, height }),
1955
+ snap.metrics.length ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles$3.hud, pointerEvents: "none", children: snap.metrics.map((m) => /* @__PURE__ */ jsxRuntime.jsxs(
1956
+ reactNative.View,
1957
+ {
1958
+ style: [styles$3.tile, m.tone ? { borderLeftWidth: 4, borderLeftColor: TONE_INK[m.tone] } : null, m.changed ? { backgroundColor: "#fefce8" } : null],
1959
+ children: [
1960
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles$3.tileLabel, numberOfLines: 1, children: m.label.toUpperCase() }),
1961
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles$3.tileValue, m.tone ? { color: TONE_INK[m.tone] } : null], numberOfLines: 1, children: m.text })
1962
+ ]
1963
+ },
1964
+ m.id
1965
+ )) }) : null,
1966
+ snap.legend.length ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles$3.legend, pointerEvents: "none", children: snap.legend.map((k) => /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles$3.legendItem, children: [
1967
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles$3.legendDot, k.ring ? { borderColor: k.color, borderWidth: 2 } : { backgroundColor: k.color }] }),
1968
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles$3.legendText, children: k.label })
1969
+ ] }, k.kind)) }) : null
1970
+ ] });
1971
+ }
1972
+ function LessonReading({ snap, text, muted }) {
1973
+ var _a, _b, _c, _d, _e, _f;
1974
+ const step = snap.reading;
1975
+ if (!step) return null;
1976
+ const [chapterBg, chapterInk] = (_b = CHAPTER[(_a = step.chapter) != null ? _a : ""]) != null ? _b : CHAPTER.setup;
1977
+ const callout = ((_c = step.callout) == null ? void 0 : _c.text) ? (_d = CALLOUT[step.callout.kind]) != null ? _d : CALLOUT.insight : null;
1978
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.ScrollView, { style: styles$3.lesson, contentContainerStyle: { paddingBottom: 6 }, accessibilityLiveRegion: "polite", children: [
1979
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles$3.chapter, { backgroundColor: chapterBg, color: chapterInk }], children: (step.chapter || "step").toUpperCase() }),
1980
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles$3.lessonTitle, { color: text }], children: step.title || snap.title }),
1981
+ ((_e = step.body) != null ? _e : []).map((paragraph, i) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles$3.paragraph, { color: text }], children: paragraph }, i)),
1982
+ callout && step.callout ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles$3.callout, { backgroundColor: callout[1], borderColor: callout[2] }], children: [
1983
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles$3.calloutLabel, { color: callout[3] }], children: callout[0].toUpperCase() }),
1984
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: text, fontSize: 13 }, children: step.callout.text })
1985
+ ] }) : null,
1986
+ ((_f = step.changes) == null ? void 0 : _f.length) ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1987
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles$3.lessonHead, { color: muted }], children: "WHAT CHANGED" }),
1988
+ step.changes.map((change, i) => {
1989
+ const mark = change.trim()[0];
1990
+ const [glyph, ink] = mark === "+" ? ["+", "#15803d"] : mark === "-" || mark === "−" ? ["−", "#b91c1c"] : ["~", "#b45309"];
1991
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { style: { color: text, fontSize: 13 }, children: [
1992
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { style: { color: ink, fontWeight: "700" }, children: [
1993
+ glyph,
1994
+ " "
1995
+ ] }),
1996
+ change.trim().replace(/^[+\-~−]\s*/, "")
1997
+ ] }, i);
1998
+ })
1999
+ ] }) : null,
2000
+ snap.goals.length ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2001
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles$3.lessonHead, { color: muted }], children: "YOU'LL LEARN" }),
2002
+ snap.goals.map((goal, i) => /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { style: { color: text, fontSize: 13 }, children: [
2003
+ goal.done ? "☑" : "☐",
2004
+ " ",
2005
+ goal.text
2006
+ ] }, i))
2007
+ ] }) : null
2008
+ ] });
2009
+ }
1781
2010
  function Ink({ obj }) {
1782
2011
  if (obj.drawn <= 0) return null;
1783
2012
  return /* @__PURE__ */ jsxRuntime.jsx(reactNativeSvg.G, { transform: poseTransform(obj.placed), children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -1890,7 +2119,22 @@ const styles$3 = reactNative.StyleSheet.create({
1890
2119
  credit: { position: "absolute", right: 6, bottom: 3, fontSize: 9, color: "#94a3b8", maxWidth: "60%" },
1891
2120
  table: { position: "absolute", borderWidth: 1.5 },
1892
2121
  row: { flexDirection: "row" },
1893
- cell: { flex: 1, borderWidth: 0.75, paddingHorizontal: 6, paddingVertical: 3 }
2122
+ cell: { flex: 1, borderWidth: 0.75, paddingHorizontal: 6, paddingVertical: 3 },
2123
+ hud: { position: "absolute", top: 6, left: 6, right: 6, flexDirection: "row", flexWrap: "wrap", gap: 4 },
2124
+ tile: { backgroundColor: "#ffffff", borderWidth: 1, borderColor: "#1f2430", borderRadius: 6, paddingHorizontal: 6, paddingVertical: 2, minWidth: 64 },
2125
+ tileLabel: { fontSize: 7, color: "#64748b", letterSpacing: 0.5 },
2126
+ tileValue: { fontSize: 11, fontWeight: "700", color: "#1f2430" },
2127
+ legend: { position: "absolute", left: 8, bottom: 4, flexDirection: "row", flexWrap: "wrap", gap: 8 },
2128
+ legendItem: { flexDirection: "row", alignItems: "center", gap: 3 },
2129
+ legendDot: { width: 7, height: 7, borderRadius: 4 },
2130
+ legendText: { fontSize: 9, color: "#64748b" },
2131
+ lesson: { maxHeight: 240, paddingHorizontal: 14, paddingTop: 10 },
2132
+ chapter: { alignSelf: "flex-start", fontSize: 10, fontWeight: "700", letterSpacing: 0.8, paddingHorizontal: 8, paddingVertical: 3, borderRadius: 999, overflow: "hidden" },
2133
+ lessonTitle: { fontSize: 15, fontWeight: "700", marginTop: 6, marginBottom: 4 },
2134
+ paragraph: { fontSize: 13, lineHeight: 19, marginBottom: 6 },
2135
+ callout: { borderWidth: 1, borderRadius: 10, padding: 8, marginVertical: 4 },
2136
+ calloutLabel: { fontSize: 10, fontWeight: "700", letterSpacing: 0.8, marginBottom: 2 },
2137
+ lessonHead: { fontSize: 10, fontWeight: "700", letterSpacing: 0.8, marginTop: 6, marginBottom: 2 }
1894
2138
  });
1895
2139
  const DEFAULT_LIVE_VOICE_LABELS = {
1896
2140
  eyebrow: "Live conversation",
@@ -2222,7 +2466,7 @@ function Orb({ theme, active }) {
2222
2466
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles.orbCore, { backgroundColor: theme.accent }] })
2223
2467
  ] });
2224
2468
  }
2225
- function Bubble({ message, theme, onTalkToHuman, onWhiteboard }) {
2469
+ function Bubble({ message, theme, onTalkToHuman, onWhiteboard, onLesson }) {
2226
2470
  if (message.role === "user") {
2227
2471
  return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles.row, styles.rowUser], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [
2228
2472
  styles.bubble,
@@ -2250,6 +2494,18 @@ function Bubble({ message, theme, onTalkToHuman, onWhiteboard }) {
2250
2494
  children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles.humanText, { color: theme.accent, fontSize: theme.fontSize - 1 }], children: "✎ Explain on whiteboard" })
2251
2495
  }
2252
2496
  ) : null,
2497
+ onLesson ? /* @__PURE__ */ jsxRuntime.jsx(
2498
+ reactNative.Pressable,
2499
+ {
2500
+ onPress: onLesson,
2501
+ accessibilityRole: "button",
2502
+ accessibilityLabel: "Full lesson",
2503
+ accessibilityHint: "A step-by-step lesson on this answer that plays by itself",
2504
+ style: [styles.errorAction, { borderColor: theme.accent }],
2505
+ hitSlop: 6,
2506
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles.humanText, { color: theme.accent, fontSize: theme.fontSize - 1 }], children: "🎓 Full lesson" })
2507
+ }
2508
+ ) : null,
2253
2509
  message.error && onTalkToHuman ? /* @__PURE__ */ jsxRuntime.jsxs(
2254
2510
  reactNative.Pressable,
2255
2511
  {
@@ -2495,6 +2751,9 @@ function GuideAIChat({
2495
2751
  onTalkToHuman,
2496
2752
  onWhiteboard: item.whiteboard ? () => {
2497
2753
  void explainOnWhiteboard(item.id);
2754
+ } : void 0,
2755
+ onLesson: item.lesson ? () => {
2756
+ void explainOnWhiteboard(item.id, { lesson: true });
2498
2757
  } : void 0
2499
2758
  }
2500
2759
  ),
@@ -2791,4 +3050,4 @@ exports.Markdown = Markdown;
2791
3050
  exports.darkTheme = darkTheme;
2792
3051
  exports.lightTheme = lightTheme;
2793
3052
  exports.resolveTheme = resolveTheme;
2794
- //# sourceMappingURL=GuideAIChat-BFu10t6D.cjs.map
3053
+ //# sourceMappingURL=GuideAIChat-BtbkPIvE.cjs.map