@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
@@ -1,8 +1,8 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import React, { useReducer, useState, useRef, useMemo, useEffect } from "react";
3
3
  import { View, StyleSheet, Text, ScrollView, Linking, AccessibilityInfo, Modal, ActivityIndicator, Pressable, Platform, Animated, Easing, KeyboardAvoidingView, Alert, FlatList, TextInput, StatusBar } from "react-native";
4
- import { m as motionTarget, B as BOARD_W, e as useWhiteboard, G as GuideAI, r as requireConfigured, f as BOARD_H, c as useGuideAI, d as useOnboarding, E as EP, b as useConversations } from "./useConversations-SbhtYN_R.js";
5
- import { Svg, G, Path, Defs, ClipPath, Rect, Image } from "react-native-svg";
4
+ import { I as IsoDrawing, m as motionTarget, B as BOARD_W, e as useWhiteboard, G as GuideAI, r as requireConfigured, f as BOARD_H, c as useGuideAI, d as useOnboarding, E as EP, b as useConversations } from "./useConversations-BljCr0Od.js";
5
+ import { Svg, G, Path, SvgXml, Defs, ClipPath, Rect, Image } from "react-native-svg";
6
6
  function parseInline(text) {
7
7
  const spans = [];
8
8
  const pattern = /(`[^`]+`)|(\*\*[^*]+\*\*)|(__[^_]+__)|(\*[^*\n]+\*)|(_[^_\n]+_)|(\[[^\]]+\]\([^)]+\))/g;
@@ -467,6 +467,136 @@ class Player {
467
467
  this.enterStep(this.stepIndex + 1);
468
468
  }
469
469
  }
470
+ const REPAINT_MS = 80;
471
+ class IsoModel {
472
+ constructor(options) {
473
+ this.options = options;
474
+ this.plan = null;
475
+ this.drawing = null;
476
+ this.player = null;
477
+ this.shown = [0, 0];
478
+ this.caption = "";
479
+ this.step = -1;
480
+ this.ticker = null;
481
+ this.born = 0;
482
+ this.lastPaint = 0;
483
+ }
484
+ now() {
485
+ var _a, _b, _c;
486
+ return (_c = (_b = (_a = this.options).now) == null ? void 0 : _b.call(_a)) != null ? _c : Date.now();
487
+ }
488
+ snapshot() {
489
+ var _a, _b, _c, _d, _e, _f;
490
+ const plan = this.plan;
491
+ const drawing = this.drawing;
492
+ const step = Math.max(0, this.step);
493
+ return {
494
+ svg: drawing ? drawing.svg(this.shown[0], this.shown[1], (this.now() - this.born) / 1e3) : "",
495
+ metrics: drawing ? drawing.metrics(step) : [],
496
+ legend: drawing ? drawing.legend() : [],
497
+ caption: this.caption,
498
+ step: this.step,
499
+ steps: (_a = plan == null ? void 0 : plan.steps.length) != null ? _a : 0,
500
+ state: (_c = (_b = this.player) == null ? void 0 : _b.status) != null ? _c : "idle",
501
+ title: (_d = plan == null ? void 0 : plan.title) != null ? _d : "",
502
+ sample: (plan == null ? void 0 : plan.sample) === true,
503
+ lesson: (plan == null ? void 0 : plan.lesson) === true,
504
+ reading: (plan == null ? void 0 : plan.lesson) && this.step >= 0 ? (_e = plan.steps[this.step]) != null ? _e : null : null,
505
+ goals: ((_f = plan == null ? void 0 : plan.goals) != null ? _f : []).map((g) => ({ text: g.text, done: step + 1 >= g.step }))
506
+ };
507
+ }
508
+ play(plan) {
509
+ var _a, _b, _c, _d;
510
+ this.destroy();
511
+ this.plan = plan;
512
+ const reduced = (_a = this.options.reducedMotion) != null ? _a : false;
513
+ const drawing = new IsoDrawing(plan, reduced);
514
+ this.drawing = drawing;
515
+ this.born = this.now();
516
+ const steps = plan.steps.map((step, index) => {
517
+ const duration = drawing.stepDuration(index);
518
+ return {
519
+ say: step.say,
520
+ enter: () => this.show(index, 0, true),
521
+ ops: [{ duration, run: (progress) => this.show(index, duration ? progress * duration : Infinity, progress >= 1) }]
522
+ };
523
+ });
524
+ this.player = new Player(steps, {
525
+ narrate: (_b = this.options.narrate) != null ? _b : (async () => false),
526
+ stopNarration: () => {
527
+ var _a2, _b2;
528
+ return (_b2 = (_a2 = this.options).stopNarration) == null ? void 0 : _b2.call(_a2);
529
+ },
530
+ reset: () => this.show(0, 0, true),
531
+ onStep: (index, step) => {
532
+ this.step = index;
533
+ this.caption = step.say;
534
+ this.options.onChange();
535
+ },
536
+ onState: (state) => {
537
+ this.live(state === "playing" || state === "done");
538
+ this.options.onChange();
539
+ },
540
+ requestFrame: (_c = this.options.requestFrame) != null ? _c : ((cb) => requestAnimationFrame(cb)),
541
+ cancelFrame: (_d = this.options.cancelFrame) != null ? _d : ((id) => cancelAnimationFrame(id)),
542
+ now: () => this.now()
543
+ }, reduced);
544
+ this.player.play();
545
+ }
546
+ toggle() {
547
+ if (!this.player) return;
548
+ if (this.player.status === "playing") this.player.pause();
549
+ else this.player.play();
550
+ }
551
+ replay() {
552
+ var _a;
553
+ (_a = this.player) == null ? void 0 : _a.replay();
554
+ }
555
+ seek(step) {
556
+ var _a;
557
+ (_a = this.player) == null ? void 0 : _a.seek(step);
558
+ }
559
+ setSpeed(speed) {
560
+ var _a;
561
+ (_a = this.player) == null ? void 0 : _a.setSpeed(speed);
562
+ }
563
+ get speed() {
564
+ var _a, _b;
565
+ return (_b = (_a = this.player) == null ? void 0 : _a.rate) != null ? _b : 1;
566
+ }
567
+ destroy() {
568
+ var _a;
569
+ this.live(false);
570
+ (_a = this.player) == null ? void 0 : _a.destroy();
571
+ this.player = null;
572
+ this.plan = null;
573
+ this.drawing = null;
574
+ this.step = -1;
575
+ this.caption = "";
576
+ this.shown = [0, 0];
577
+ }
578
+ /** Step *index* at *t* ms; repaint now when it matters, else at most every REPAINT_MS. */
579
+ show(index, t, force) {
580
+ this.shown = [index, t];
581
+ const now = this.now();
582
+ if (!force && now - this.lastPaint < REPAINT_MS) return;
583
+ this.lastPaint = now;
584
+ this.options.onChange();
585
+ }
586
+ /** Keep traffic moving between the Player's frames. */
587
+ live(on) {
588
+ var _a, _b;
589
+ const clear = (_a = this.options.clearInterval) != null ? _a : ((id) => clearInterval(id));
590
+ if (this.ticker !== null) clear(this.ticker);
591
+ this.ticker = null;
592
+ if (!on || this.options.reducedMotion) return;
593
+ const every = (_b = this.options.setInterval) != null ? _b : ((cb, ms) => setInterval(cb, ms));
594
+ this.ticker = every(() => {
595
+ this.lastPaint = this.now();
596
+ this.options.onChange();
597
+ }, REPAINT_MS);
598
+ }
599
+ }
470
600
  const STORYBOARD_ICON_STROKES = {
471
601
  phone: [
472
602
  "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",
@@ -1646,6 +1776,22 @@ const SHEET_W = 1600;
1646
1776
  const SHEET_H = 1e3;
1647
1777
  const HAND = Platform.select({ ios: "Bradley Hand", android: "casual", default: void 0 });
1648
1778
  const PEN = "M0 0 L-5 -22 L22 -70 L32 -63 L5 -16 Z";
1779
+ const isIso = (scene) => !!scene && "kind" in scene && scene.kind === "iso";
1780
+ const TONE_INK = { good: "#15803d", bad: "#b91c1c", warn: "#b45309" };
1781
+ const CHAPTER = {
1782
+ problem: ["#fee2e2", "#b91c1c"],
1783
+ solution: ["#dcfce7", "#15803d"],
1784
+ technique: ["#dbeafe", "#1d4ed8"],
1785
+ tradeoff: ["#fef3c7", "#b45309"],
1786
+ insight: ["#ede9fe", "#6d28d9"],
1787
+ recap: ["#0f172a", "#ffffff"],
1788
+ setup: ["#e2e8f0", "#334155"]
1789
+ };
1790
+ const CALLOUT = {
1791
+ insight: ["Key idea", "#f5f3ff", "#ddd6fe", "#6d28d9"],
1792
+ warn: ["Watch out", "#fef2f2", "#fecaca", "#b91c1c"],
1793
+ tip: ["Good to know", "#f0fdf4", "#bbf7d0", "#15803d"]
1794
+ };
1649
1795
  function GuideAIWhiteboard({ theme: overrides }) {
1650
1796
  const theme = resolveTheme(overrides);
1651
1797
  const { state, close, retry } = useWhiteboard();
@@ -1665,6 +1811,14 @@ function GuideAIWhiteboard({ theme: overrides }) {
1665
1811
  narrate: async (text) => speech && !voice.current.muted ? speech.say(text) : false,
1666
1812
  stopNarration: () => speech == null ? void 0 : speech.stop()
1667
1813
  }), [speech]);
1814
+ const isoModel = useMemo(() => new IsoModel({
1815
+ onChange: () => repaint(),
1816
+ get reducedMotion() {
1817
+ return motion.current.reduced;
1818
+ },
1819
+ narrate: async (text) => speech && !voice.current.muted ? speech.say(text) : false,
1820
+ stopNarration: () => speech == null ? void 0 : speech.stop()
1821
+ }), [speech]);
1668
1822
  const toggleVoice = () => {
1669
1823
  if (!muted) speech == null ? void 0 : speech.stop();
1670
1824
  setMuted((on) => !on);
@@ -1676,18 +1830,34 @@ function GuideAIWhiteboard({ theme: overrides }) {
1676
1830
  }, () => void 0));
1677
1831
  }, []);
1678
1832
  useEffect(() => {
1679
- if (state.status === "playing" && state.scene) model.play(state.scene);
1680
- else model.destroy();
1681
- }, [model, state.status, state.scene]);
1682
- useEffect(() => () => model.destroy(), [model]);
1833
+ const scene = state.status === "playing" ? state.scene : null;
1834
+ if (isIso(scene)) {
1835
+ model.destroy();
1836
+ isoModel.play(scene);
1837
+ } else if (scene) {
1838
+ isoModel.destroy();
1839
+ model.play(scene);
1840
+ } else {
1841
+ model.destroy();
1842
+ isoModel.destroy();
1843
+ }
1844
+ }, [model, isoModel, state.status, state.scene]);
1845
+ useEffect(() => () => {
1846
+ model.destroy();
1847
+ isoModel.destroy();
1848
+ }, [model, isoModel]);
1683
1849
  if (state.status === "closed") return null;
1684
1850
  const board = model.snapshot();
1851
+ const iso = state.status === "playing" && isIso(state.scene) ? isoModel.snapshot() : null;
1852
+ const ctl = iso ? isoModel : model;
1853
+ const view = iso != null ? iso : board;
1685
1854
  const height = width / (BOARD_W / BOARD_H);
1686
1855
  const unit2 = width / 100;
1687
- const playing = board.state === "playing";
1688
- const title = state.status === "playing" ? board.title : state.question;
1856
+ const playing = view.state === "playing";
1857
+ const title = state.status === "playing" ? view.title : state.question;
1689
1858
  const shut = () => {
1690
1859
  model.destroy();
1860
+ isoModel.destroy();
1691
1861
  close();
1692
1862
  };
1693
1863
  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(
@@ -1699,13 +1869,14 @@ function GuideAIWhiteboard({ theme: overrides }) {
1699
1869
  children: [
1700
1870
  /* @__PURE__ */ jsxs(View, { style: styles$3.head, children: [
1701
1871
  /* @__PURE__ */ jsx(Text, { style: [styles$3.title, { color: theme.text }], numberOfLines: 1, children: title || "Whiteboard" }),
1702
- board.sample && state.status === "playing" ? /* @__PURE__ */ jsx(Text, { style: styles$3.badge, accessibilityHint: "This board uses example numbers.", children: "Example" }) : null,
1872
+ view.sample && state.status === "playing" ? /* @__PURE__ */ jsx(Text, { style: styles$3.badge, accessibilityHint: "This board uses example numbers.", children: "Example" }) : null,
1703
1873
  speech ? /* @__PURE__ */ jsx(IconButton, { label: muted ? "Read the board aloud" : "Mute the board", glyph: muted ? "🔇" : "🔈", color: theme.textMuted, onPress: toggleVoice }) : null,
1704
1874
  /* @__PURE__ */ jsx(IconButton, { label: expanded ? "Collapse whiteboard" : "Expand whiteboard", glyph: expanded ? "⤡" : "⤢", color: theme.textMuted, onPress: () => setExpanded((v) => !v) }),
1705
1875
  /* @__PURE__ */ jsx(IconButton, { label: "Close whiteboard", glyph: "✕", color: theme.textMuted, onPress: shut })
1706
1876
  ] }),
1707
1877
  /* @__PURE__ */ jsxs(View, { style: styles$3.sheet, onLayout: (e) => setWidth(e.nativeEvent.layout.width), children: [
1708
- width > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
1878
+ width > 0 && iso ? /* @__PURE__ */ jsx(IsoSheet, { snap: iso, width, height }) : null,
1879
+ width > 0 && !iso ? /* @__PURE__ */ jsxs(Fragment, { children: [
1709
1880
  /* @__PURE__ */ jsxs(Svg, { width, height, viewBox: `0 0 ${SHEET_W} ${SHEET_H}`, children: [
1710
1881
  board.pictures.map((pic) => /* @__PURE__ */ jsx(Picture, { pic }, pic.key)),
1711
1882
  board.inks.filter((obj) => obj.marker).map((obj) => /* @__PURE__ */ jsx(Ink, { obj }, obj.key)),
@@ -1729,16 +1900,16 @@ function GuideAIWhiteboard({ theme: overrides }) {
1729
1900
  ] }) : null
1730
1901
  ] }),
1731
1902
  state.status === "playing" ? /* @__PURE__ */ jsxs(Fragment, { children: [
1732
- /* @__PURE__ */ jsx(Text, { style: [styles$3.caption, { color: theme.text }], accessibilityLiveRegion: "polite", children: board.caption }),
1733
- board.steps > 1 ? /* @__PURE__ */ jsx(View, { style: styles$3.track, accessibilityLabel: "Steps", children: Array.from({ length: board.steps }, (_, i) => /* @__PURE__ */ jsx(
1903
+ (iso == null ? void 0 : iso.lesson) ? /* @__PURE__ */ jsx(LessonReading, { snap: iso, text: theme.text, muted: theme.textMuted }) : /* @__PURE__ */ jsx(Text, { style: [styles$3.caption, { color: theme.text }], accessibilityLiveRegion: "polite", children: view.caption }),
1904
+ view.steps > 1 ? /* @__PURE__ */ jsx(View, { style: styles$3.track, accessibilityLabel: "Steps", children: Array.from({ length: view.steps }, (_, i) => /* @__PURE__ */ jsx(
1734
1905
  Pressable,
1735
1906
  {
1736
1907
  accessibilityRole: "button",
1737
1908
  accessibilityLabel: `Go to step ${i + 1}`,
1738
- accessibilityState: { selected: i === board.step },
1739
- onPress: () => model.seek(i),
1909
+ accessibilityState: { selected: i === view.step },
1910
+ onPress: () => ctl.seek(i),
1740
1911
  hitSlop: 8,
1741
- style: [styles$3.segment, { backgroundColor: i <= board.step ? theme.accent : theme.border }]
1912
+ style: [styles$3.segment, { backgroundColor: i <= view.step ? theme.accent : theme.border }]
1742
1913
  },
1743
1914
  i
1744
1915
  )) }) : null,
@@ -1746,27 +1917,27 @@ function GuideAIWhiteboard({ theme: overrides }) {
1746
1917
  /* @__PURE__ */ jsx(
1747
1918
  IconButton,
1748
1919
  {
1749
- label: playing ? "Pause" : board.state === "done" ? "Play again" : "Resume",
1750
- glyph: playing ? "❚❚" : board.state === "done" ? "↻" : "▶",
1920
+ label: playing ? "Pause" : view.state === "done" ? "Play again" : "Resume",
1921
+ glyph: playing ? "❚❚" : view.state === "done" ? "↻" : "▶",
1751
1922
  color: theme.text,
1752
- onPress: () => model.toggle()
1923
+ onPress: () => ctl.toggle()
1753
1924
  }
1754
1925
  ),
1755
- /* @__PURE__ */ jsx(IconButton, { label: "Replay from the start", glyph: "↺", color: theme.text, onPress: () => model.replay() }),
1756
- /* @__PURE__ */ jsx(Text, { style: [styles$3.step, { color: theme.textMuted }], children: board.step >= 0 ? `Step ${board.step + 1} of ${board.steps}` : "" }),
1926
+ /* @__PURE__ */ jsx(IconButton, { label: "Replay from the start", glyph: "↺", color: theme.text, onPress: () => ctl.replay() }),
1927
+ /* @__PURE__ */ jsx(Text, { style: [styles$3.step, { color: theme.textMuted }], children: view.step >= 0 ? `Step ${view.step + 1} of ${view.steps}` : "" }),
1757
1928
  /* @__PURE__ */ jsx(
1758
1929
  Pressable,
1759
1930
  {
1760
1931
  accessibilityRole: "button",
1761
- accessibilityLabel: `Speed ${model.speed} times. Change speed`,
1932
+ accessibilityLabel: `Speed ${ctl.speed} times. Change speed`,
1762
1933
  onPress: () => {
1763
- const at = SPEEDS.indexOf(model.speed);
1764
- model.setSpeed(SPEEDS[(at + 1) % SPEEDS.length]);
1934
+ const at = SPEEDS.indexOf(ctl.speed);
1935
+ ctl.setSpeed(SPEEDS[(at + 1) % SPEEDS.length]);
1765
1936
  repaint();
1766
1937
  },
1767
1938
  style: [styles$3.speed, { borderColor: theme.border }],
1768
1939
  children: /* @__PURE__ */ jsxs(Text, { style: { color: theme.text, fontSize: 12 }, children: [
1769
- model.speed,
1940
+ ctl.speed,
1770
1941
  "×"
1771
1942
  ] })
1772
1943
  }
@@ -1777,6 +1948,64 @@ function GuideAIWhiteboard({ theme: overrides }) {
1777
1948
  }
1778
1949
  ) }) });
1779
1950
  }
1951
+ function IsoSheet({ snap, width, height }) {
1952
+ return /* @__PURE__ */ jsxs(View, { style: { width, height, backgroundColor: "#f7f6f2" }, accessibilityLabel: snap.title, accessible: true, children: [
1953
+ /* @__PURE__ */ jsx(SvgXml, { xml: snap.svg, width, height }),
1954
+ snap.metrics.length ? /* @__PURE__ */ jsx(View, { style: styles$3.hud, pointerEvents: "none", children: snap.metrics.map((m) => /* @__PURE__ */ jsxs(
1955
+ View,
1956
+ {
1957
+ style: [styles$3.tile, m.tone ? { borderLeftWidth: 4, borderLeftColor: TONE_INK[m.tone] } : null, m.changed ? { backgroundColor: "#fefce8" } : null],
1958
+ children: [
1959
+ /* @__PURE__ */ jsx(Text, { style: styles$3.tileLabel, numberOfLines: 1, children: m.label.toUpperCase() }),
1960
+ /* @__PURE__ */ jsx(Text, { style: [styles$3.tileValue, m.tone ? { color: TONE_INK[m.tone] } : null], numberOfLines: 1, children: m.text })
1961
+ ]
1962
+ },
1963
+ m.id
1964
+ )) }) : null,
1965
+ snap.legend.length ? /* @__PURE__ */ jsx(View, { style: styles$3.legend, pointerEvents: "none", children: snap.legend.map((k) => /* @__PURE__ */ jsxs(View, { style: styles$3.legendItem, children: [
1966
+ /* @__PURE__ */ jsx(View, { style: [styles$3.legendDot, k.ring ? { borderColor: k.color, borderWidth: 2 } : { backgroundColor: k.color }] }),
1967
+ /* @__PURE__ */ jsx(Text, { style: styles$3.legendText, children: k.label })
1968
+ ] }, k.kind)) }) : null
1969
+ ] });
1970
+ }
1971
+ function LessonReading({ snap, text, muted }) {
1972
+ var _a, _b, _c, _d, _e, _f;
1973
+ const step = snap.reading;
1974
+ if (!step) return null;
1975
+ const [chapterBg, chapterInk] = (_b = CHAPTER[(_a = step.chapter) != null ? _a : ""]) != null ? _b : CHAPTER.setup;
1976
+ const callout = ((_c = step.callout) == null ? void 0 : _c.text) ? (_d = CALLOUT[step.callout.kind]) != null ? _d : CALLOUT.insight : null;
1977
+ return /* @__PURE__ */ jsxs(ScrollView, { style: styles$3.lesson, contentContainerStyle: { paddingBottom: 6 }, accessibilityLiveRegion: "polite", children: [
1978
+ /* @__PURE__ */ jsx(Text, { style: [styles$3.chapter, { backgroundColor: chapterBg, color: chapterInk }], children: (step.chapter || "step").toUpperCase() }),
1979
+ /* @__PURE__ */ jsx(Text, { style: [styles$3.lessonTitle, { color: text }], children: step.title || snap.title }),
1980
+ ((_e = step.body) != null ? _e : []).map((paragraph, i) => /* @__PURE__ */ jsx(Text, { style: [styles$3.paragraph, { color: text }], children: paragraph }, i)),
1981
+ callout && step.callout ? /* @__PURE__ */ jsxs(View, { style: [styles$3.callout, { backgroundColor: callout[1], borderColor: callout[2] }], children: [
1982
+ /* @__PURE__ */ jsx(Text, { style: [styles$3.calloutLabel, { color: callout[3] }], children: callout[0].toUpperCase() }),
1983
+ /* @__PURE__ */ jsx(Text, { style: { color: text, fontSize: 13 }, children: step.callout.text })
1984
+ ] }) : null,
1985
+ ((_f = step.changes) == null ? void 0 : _f.length) ? /* @__PURE__ */ jsxs(Fragment, { children: [
1986
+ /* @__PURE__ */ jsx(Text, { style: [styles$3.lessonHead, { color: muted }], children: "WHAT CHANGED" }),
1987
+ step.changes.map((change, i) => {
1988
+ const mark = change.trim()[0];
1989
+ const [glyph, ink] = mark === "+" ? ["+", "#15803d"] : mark === "-" || mark === "−" ? ["−", "#b91c1c"] : ["~", "#b45309"];
1990
+ return /* @__PURE__ */ jsxs(Text, { style: { color: text, fontSize: 13 }, children: [
1991
+ /* @__PURE__ */ jsxs(Text, { style: { color: ink, fontWeight: "700" }, children: [
1992
+ glyph,
1993
+ " "
1994
+ ] }),
1995
+ change.trim().replace(/^[+\-~−]\s*/, "")
1996
+ ] }, i);
1997
+ })
1998
+ ] }) : null,
1999
+ snap.goals.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
2000
+ /* @__PURE__ */ jsx(Text, { style: [styles$3.lessonHead, { color: muted }], children: "YOU'LL LEARN" }),
2001
+ snap.goals.map((goal, i) => /* @__PURE__ */ jsxs(Text, { style: { color: text, fontSize: 13 }, children: [
2002
+ goal.done ? "☑" : "☐",
2003
+ " ",
2004
+ goal.text
2005
+ ] }, i))
2006
+ ] }) : null
2007
+ ] });
2008
+ }
1780
2009
  function Ink({ obj }) {
1781
2010
  if (obj.drawn <= 0) return null;
1782
2011
  return /* @__PURE__ */ jsx(G, { transform: poseTransform(obj.placed), children: /* @__PURE__ */ jsx(
@@ -1889,7 +2118,22 @@ const styles$3 = StyleSheet.create({
1889
2118
  credit: { position: "absolute", right: 6, bottom: 3, fontSize: 9, color: "#94a3b8", maxWidth: "60%" },
1890
2119
  table: { position: "absolute", borderWidth: 1.5 },
1891
2120
  row: { flexDirection: "row" },
1892
- cell: { flex: 1, borderWidth: 0.75, paddingHorizontal: 6, paddingVertical: 3 }
2121
+ cell: { flex: 1, borderWidth: 0.75, paddingHorizontal: 6, paddingVertical: 3 },
2122
+ hud: { position: "absolute", top: 6, left: 6, right: 6, flexDirection: "row", flexWrap: "wrap", gap: 4 },
2123
+ tile: { backgroundColor: "#ffffff", borderWidth: 1, borderColor: "#1f2430", borderRadius: 6, paddingHorizontal: 6, paddingVertical: 2, minWidth: 64 },
2124
+ tileLabel: { fontSize: 7, color: "#64748b", letterSpacing: 0.5 },
2125
+ tileValue: { fontSize: 11, fontWeight: "700", color: "#1f2430" },
2126
+ legend: { position: "absolute", left: 8, bottom: 4, flexDirection: "row", flexWrap: "wrap", gap: 8 },
2127
+ legendItem: { flexDirection: "row", alignItems: "center", gap: 3 },
2128
+ legendDot: { width: 7, height: 7, borderRadius: 4 },
2129
+ legendText: { fontSize: 9, color: "#64748b" },
2130
+ lesson: { maxHeight: 240, paddingHorizontal: 14, paddingTop: 10 },
2131
+ chapter: { alignSelf: "flex-start", fontSize: 10, fontWeight: "700", letterSpacing: 0.8, paddingHorizontal: 8, paddingVertical: 3, borderRadius: 999, overflow: "hidden" },
2132
+ lessonTitle: { fontSize: 15, fontWeight: "700", marginTop: 6, marginBottom: 4 },
2133
+ paragraph: { fontSize: 13, lineHeight: 19, marginBottom: 6 },
2134
+ callout: { borderWidth: 1, borderRadius: 10, padding: 8, marginVertical: 4 },
2135
+ calloutLabel: { fontSize: 10, fontWeight: "700", letterSpacing: 0.8, marginBottom: 2 },
2136
+ lessonHead: { fontSize: 10, fontWeight: "700", letterSpacing: 0.8, marginTop: 6, marginBottom: 2 }
1893
2137
  });
1894
2138
  const DEFAULT_LIVE_VOICE_LABELS = {
1895
2139
  eyebrow: "Live conversation",
@@ -2221,7 +2465,7 @@ function Orb({ theme, active }) {
2221
2465
  /* @__PURE__ */ jsx(View, { style: [styles.orbCore, { backgroundColor: theme.accent }] })
2222
2466
  ] });
2223
2467
  }
2224
- function Bubble({ message, theme, onTalkToHuman, onWhiteboard }) {
2468
+ function Bubble({ message, theme, onTalkToHuman, onWhiteboard, onLesson }) {
2225
2469
  if (message.role === "user") {
2226
2470
  return /* @__PURE__ */ jsx(View, { style: [styles.row, styles.rowUser], children: /* @__PURE__ */ jsx(View, { style: [
2227
2471
  styles.bubble,
@@ -2249,6 +2493,18 @@ function Bubble({ message, theme, onTalkToHuman, onWhiteboard }) {
2249
2493
  children: /* @__PURE__ */ jsx(Text, { style: [styles.humanText, { color: theme.accent, fontSize: theme.fontSize - 1 }], children: "✎ Explain on whiteboard" })
2250
2494
  }
2251
2495
  ) : null,
2496
+ onLesson ? /* @__PURE__ */ jsx(
2497
+ Pressable,
2498
+ {
2499
+ onPress: onLesson,
2500
+ accessibilityRole: "button",
2501
+ accessibilityLabel: "Full lesson",
2502
+ accessibilityHint: "A step-by-step lesson on this answer that plays by itself",
2503
+ style: [styles.errorAction, { borderColor: theme.accent }],
2504
+ hitSlop: 6,
2505
+ children: /* @__PURE__ */ jsx(Text, { style: [styles.humanText, { color: theme.accent, fontSize: theme.fontSize - 1 }], children: "🎓 Full lesson" })
2506
+ }
2507
+ ) : null,
2252
2508
  message.error && onTalkToHuman ? /* @__PURE__ */ jsxs(
2253
2509
  Pressable,
2254
2510
  {
@@ -2494,6 +2750,9 @@ function GuideAIChat({
2494
2750
  onTalkToHuman,
2495
2751
  onWhiteboard: item.whiteboard ? () => {
2496
2752
  void explainOnWhiteboard(item.id);
2753
+ } : void 0,
2754
+ onLesson: item.lesson ? () => {
2755
+ void explainOnWhiteboard(item.id, { lesson: true });
2497
2756
  } : void 0
2498
2757
  }
2499
2758
  ),
@@ -2792,4 +3051,4 @@ export {
2792
3051
  lightTheme as l,
2793
3052
  resolveTheme as r
2794
3053
  };
2795
- //# sourceMappingURL=GuideAIChat-Ba6n1ePs.js.map
3054
+ //# sourceMappingURL=GuideAIChat-CKW6dgl_.js.map