@mechane-ai/elements 0.47.0 → 0.49.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 (250) hide show
  1. package/README.md +288 -5
  2. package/bin/mechane-elements-catalog.mjs +104 -12
  3. package/dist/ai.js +5 -5
  4. package/dist/article-yyNPg6VU.js +1904 -0
  5. package/dist/article.js +1 -0
  6. package/dist/catalog.json +1691 -163
  7. package/dist/{categorical-values-DdfGIowV.js → categorical-values-DCznViFp.js} +1 -1
  8. package/dist/{cells--Bd1fQFR.js → cells-CNZE4us2.js} +2 -2
  9. package/dist/charts/cartesian.js +1 -1
  10. package/dist/charts/cells.js +1 -1
  11. package/dist/charts/comparison.js +1 -1
  12. package/dist/charts/distribution.js +1 -1
  13. package/dist/charts/figure.js +12 -12
  14. package/dist/charts/graph.js +1 -1
  15. package/dist/charts/hierarchy.js +1 -1
  16. package/dist/charts/image.js +1 -1
  17. package/dist/charts/matrix.js +3 -2
  18. package/dist/charts/plot.js +6 -6
  19. package/dist/charts/relationship.js +1 -1
  20. package/dist/charts/text.js +1 -1
  21. package/dist/charts/timeline.js +1 -1
  22. package/dist/charts/trend.js +1 -1
  23. package/dist/charts.js +2 -2
  24. package/dist/clock-DSm5lkNE.js +16 -0
  25. package/dist/{code-block-DioAM2bZ.js → code-block-BZsY2sh3.js} +1 -1
  26. package/dist/collections.js +1 -1
  27. package/dist/content/code.js +1 -1
  28. package/dist/content/diff.js +3 -3
  29. package/dist/content/link.js +1 -1
  30. package/dist/content/markdown.js +2 -2
  31. package/dist/content/tree.js +1 -1
  32. package/dist/{content-link-NWuHp5rC.js → content-link-PnpcnTCx.js} +1 -1
  33. package/dist/content.js +1 -1
  34. package/dist/{dates-Cww8UR_n.js → dates-ckJdYF7t.js} +1 -1
  35. package/dist/describe-lesson-BmREzDpt.js +175 -0
  36. package/dist/{dumbbell-plot-B2ZTgQaI.js → dumbbell-plot-CMv9llfd.js} +9 -7
  37. package/dist/{embedding-map-CGM_k6lC.js → embedding-map-DC-lgzCq.js} +8 -8
  38. package/dist/feedback.js +1 -1
  39. package/dist/{figure-frame-wRkIEAwe.js → figure-frame-BjFzbl3m.js} +3 -3
  40. package/dist/forms/dates.js +1 -1
  41. package/dist/forms.js +3 -3
  42. package/dist/{image-grid-CVA4SOy_.js → image-grid-DHqtj_zs.js} +4 -4
  43. package/dist/index.js +1 -1
  44. package/dist/kits/evaluation.js +5 -5
  45. package/dist/kits/interpretability.js +320 -302
  46. package/dist/kits/operations.js +6 -6
  47. package/dist/kits/research.js +558 -0
  48. package/dist/kits/training.js +6 -6
  49. package/dist/layout.js +205 -110
  50. package/dist/lesson/agent.js +811 -0
  51. package/dist/lesson/spec.js +661 -0
  52. package/dist/lesson.js +5 -0
  53. package/dist/mdx.js +227 -0
  54. package/dist/navigation.js +2 -2
  55. package/dist/packages/charts/src/cartesian/index.d.ts +1 -1
  56. package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +18 -0
  57. package/dist/packages/charts/src/chart-theme.d.ts +1 -1
  58. package/dist/packages/charts/src/matrix/index.d.ts +1 -0
  59. package/dist/packages/charts/src/plot/plot-marks.d.ts +7 -3
  60. package/dist/packages/charts/src/plot/plot-surface.d.ts +3 -1
  61. package/dist/packages/collections/src/index.d.ts +1 -1
  62. package/dist/packages/collections/src/metrics.d.ts +9 -1
  63. package/dist/packages/content/src/index.d.ts +2 -0
  64. package/dist/packages/content/src/text-match.d.ts +22 -0
  65. package/dist/packages/core/src/index.d.ts +1 -0
  66. package/dist/packages/core/src/surfaces.d.ts +12 -2
  67. package/dist/packages/forms/src/index.d.ts +2 -0
  68. package/dist/packages/forms/src/token-input.d.ts +24 -0
  69. package/dist/packages/kits/src/interpretability/index.d.ts +1 -1
  70. package/dist/packages/kits/src/interpretability/logit-lens.d.ts +10 -1
  71. package/dist/packages/kits/src/research/finding-card.d.ts +43 -0
  72. package/dist/packages/kits/src/research/index.d.ts +8 -0
  73. package/dist/packages/kits/src/research/milestone-path.d.ts +36 -0
  74. package/dist/packages/kits/src/research/specimen-diff.d.ts +41 -0
  75. package/dist/packages/kits/src/research/work-heartbeat.d.ts +34 -0
  76. package/dist/packages/layout/src/figure-grid.d.ts +8 -0
  77. package/dist/packages/layout/src/index.d.ts +4 -1
  78. package/dist/packages/layout/src/sidebar.d.ts +7 -0
  79. package/dist/packages/layout/src/workbench.d.ts +4 -1
  80. package/dist/packages/teaching/src/agent/index.d.ts +11 -0
  81. package/dist/packages/teaching/src/agent/learner-trace.d.ts +84 -0
  82. package/dist/packages/teaching/src/agent/lesson-bridge.d.ts +59 -0
  83. package/dist/packages/teaching/src/agent/lesson-tour.d.ts +63 -0
  84. package/dist/packages/teaching/src/agent/tutor-tools.d.ts +86 -0
  85. package/dist/packages/teaching/src/article/article-checks.d.ts +9 -0
  86. package/dist/packages/teaching/src/article/article-context.d.ts +49 -0
  87. package/dist/packages/teaching/src/article/article-error.d.ts +12 -0
  88. package/dist/packages/teaching/src/article/article-labels.d.ts +54 -0
  89. package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +14 -0
  90. package/dist/packages/teaching/src/article/article-outline.d.ts +9 -0
  91. package/dist/packages/teaching/src/article/article.d.ts +42 -0
  92. package/dist/packages/teaching/src/article/beat-steps.d.ts +18 -0
  93. package/dist/packages/teaching/src/article/beat.d.ts +16 -0
  94. package/dist/packages/teaching/src/article/challenge.d.ts +29 -0
  95. package/dist/packages/teaching/src/article/exercise-styles.d.ts +76 -0
  96. package/dist/packages/teaching/src/article/figure.d.ts +51 -0
  97. package/dist/packages/teaching/src/article/index.d.ts +31 -0
  98. package/dist/packages/teaching/src/article/lesson-values.d.ts +5 -0
  99. package/dist/packages/teaching/src/article/notes.d.ts +36 -0
  100. package/dist/packages/teaching/src/article/outline-types.d.ts +73 -0
  101. package/dist/packages/teaching/src/article/predict.d.ts +58 -0
  102. package/dist/packages/teaching/src/article/progress-store.d.ts +64 -0
  103. package/dist/packages/teaching/src/article/scrolly.d.ts +26 -0
  104. package/dist/packages/{kits/src/explainers → teaching/src/article}/term.d.ts +8 -2
  105. package/dist/packages/teaching/src/article/tex.d.ts +12 -0
  106. package/dist/packages/teaching/src/article/view-essay.d.ts +13 -0
  107. package/dist/packages/teaching/src/article/view-present.d.ts +8 -0
  108. package/dist/packages/teaching/src/article/view-sheet.d.ts +7 -0
  109. package/dist/packages/teaching/src/article/view-static.d.ts +7 -0
  110. package/dist/packages/teaching/src/article/walk.d.ts +34 -0
  111. package/dist/packages/teaching/src/lesson/define-lesson.d.ts +136 -0
  112. package/dist/packages/teaching/src/lesson/index.d.ts +24 -0
  113. package/dist/packages/teaching/src/lesson/inline-choice.d.ts +12 -0
  114. package/dist/packages/teaching/src/lesson/lesson-context.d.ts +18 -0
  115. package/dist/packages/teaching/src/lesson/lesson-error.d.ts +12 -0
  116. package/dist/packages/teaching/src/lesson/lesson-locale.d.ts +4 -0
  117. package/dist/packages/teaching/src/lesson/lesson-persistence.d.ts +17 -0
  118. package/dist/packages/teaching/src/lesson/lesson-player.d.ts +51 -0
  119. package/dist/packages/teaching/src/lesson/lesson-store.d.ts +84 -0
  120. package/dist/packages/teaching/src/lesson/lesson.d.ts +39 -0
  121. package/dist/packages/teaching/src/lesson/param-controls.d.ts +14 -0
  122. package/dist/packages/teaching/src/lesson/param.d.ts +34 -0
  123. package/dist/packages/teaching/src/lesson/playback.d.ts +42 -0
  124. package/dist/packages/teaching/src/lesson/transport.d.ts +19 -0
  125. package/dist/packages/teaching/src/lesson/use-lesson.d.ts +36 -0
  126. package/dist/packages/teaching/src/mdx/essay-components.d.ts +79 -0
  127. package/dist/packages/teaching/src/mdx/essay-markdown.d.ts +41 -0
  128. package/dist/packages/teaching/src/mdx/essay.d.ts +32 -0
  129. package/dist/packages/teaching/src/mdx/index.d.ts +9 -0
  130. package/dist/packages/teaching/src/mdx/requested-view.d.ts +6 -0
  131. package/dist/packages/teaching/src/scene/flow/flow-layout.d.ts +38 -0
  132. package/dist/packages/teaching/src/scene/flow/flow-pulse.d.ts +16 -0
  133. package/dist/packages/teaching/src/scene/flow/scene-flow.d.ts +81 -0
  134. package/dist/packages/teaching/src/scene/index.d.ts +77 -0
  135. package/dist/packages/teaching/src/scene/morph/morph-scope.d.ts +28 -0
  136. package/dist/packages/teaching/src/scene/plane/plane-hit.d.ts +22 -0
  137. package/dist/packages/teaching/src/scene/plane/plane-label.d.ts +23 -0
  138. package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +42 -0
  139. package/dist/packages/teaching/src/scene/plane/plane-math.d.ts +45 -0
  140. package/dist/packages/teaching/src/scene/plane/scene-axes.d.ts +30 -0
  141. package/dist/packages/teaching/src/scene/plane/scene-curve.d.ts +42 -0
  142. package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +59 -0
  143. package/dist/packages/teaching/src/scene/plane/scene-projection.d.ts +27 -0
  144. package/dist/packages/teaching/src/scene/plane/scene-region.d.ts +38 -0
  145. package/dist/packages/teaching/src/scene/plane/scene-rule.d.ts +35 -0
  146. package/dist/packages/teaching/src/scene/plane/scene-vector.d.ts +39 -0
  147. package/dist/packages/teaching/src/scene/scene-bracket.d.ts +24 -0
  148. package/dist/packages/teaching/src/scene/scene-callout.d.ts +26 -0
  149. package/dist/packages/teaching/src/scene/scene-context.d.ts +179 -0
  150. package/dist/packages/teaching/src/scene/scene-custom.d.ts +31 -0
  151. package/dist/packages/teaching/src/scene/scene-geometry.d.ts +181 -0
  152. package/dist/packages/teaching/src/scene/scene-group.d.ts +28 -0
  153. package/dist/packages/teaching/src/scene/scene-highlight.d.ts +19 -0
  154. package/dist/packages/teaching/src/scene/scene-layer.d.ts +16 -0
  155. package/dist/packages/teaching/src/scene/scene-node.d.ts +67 -0
  156. package/dist/packages/teaching/src/scene/scene-obstacles.d.ts +27 -0
  157. package/dist/packages/teaching/src/scene/scene-registry.d.ts +79 -0
  158. package/dist/packages/teaching/src/scene/scene-stagger.d.ts +43 -0
  159. package/dist/packages/teaching/src/scene/scene-style.d.ts +14 -0
  160. package/dist/packages/teaching/src/scene/scene-validate.d.ts +65 -0
  161. package/dist/packages/teaching/src/scene/scene-wire.d.ts +45 -0
  162. package/dist/packages/teaching/src/scene/scene.d.ts +36 -0
  163. package/dist/packages/teaching/src/scene/shapes/cell-color.d.ts +11 -0
  164. package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +69 -0
  165. package/dist/packages/teaching/src/scene/shapes/scene-card.d.ts +114 -0
  166. package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +84 -0
  167. package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +37 -0
  168. package/dist/packages/teaching/src/scene/shapes/scene-stack.d.ts +46 -0
  169. package/dist/packages/teaching/src/scene/shapes/scene-token.d.ts +63 -0
  170. package/dist/packages/teaching/src/scene/shapes/scene-tokens.d.ts +40 -0
  171. package/dist/packages/teaching/src/scene/shapes/stack-book.d.ts +35 -0
  172. package/dist/packages/teaching/src/scene/shapes/stack-layout.d.ts +63 -0
  173. package/dist/packages/teaching/src/scene/shapes/token-layout.d.ts +39 -0
  174. package/dist/packages/teaching/src/spec/advice.d.ts +23 -0
  175. package/dist/packages/teaching/src/spec/chart-names.d.ts +2 -0
  176. package/dist/packages/teaching/src/spec/describe-lesson.d.ts +85 -0
  177. package/dist/packages/teaching/src/spec/explainer-guide.d.ts +21 -0
  178. package/dist/packages/teaching/src/spec/findings.d.ts +39 -0
  179. package/dist/packages/teaching/src/spec/index.d.ts +14 -0
  180. package/dist/packages/teaching/src/spec/lesson-plan.d.ts +43 -0
  181. package/dist/packages/teaching/src/spec/validate-plan.d.ts +11 -0
  182. package/dist/packages/teaching/src/time/clock.d.ts +7 -0
  183. package/dist/packages/teaching/src/time/tween.d.ts +19 -0
  184. package/dist/packages/teaching/src/time/use-tween.d.ts +6 -0
  185. package/dist/param-BE3VMSkH.js +450 -0
  186. package/dist/{pierre-diff-DlvjyuJn.js → pierre-diff-aGyQK5xK.js} +1 -1
  187. package/dist/{plot-axes-DJkLW4wk.js → plot-axes-D5S9BnBa.js} +1 -1
  188. package/dist/{plot-layout-BEuoOHbs.js → plot-layout-Bqe4-0qZ.js} +4 -3
  189. package/dist/{plot-marks-A64v7aTw.js → plot-marks-FVsbFkUs.js} +18 -15
  190. package/dist/{plot-surface-CJTIqtck.js → plot-surface-DON6WUmk.js} +11 -11
  191. package/dist/{plot-width-DcqtSgzb.js → plot-width-D3hTycYX.js} +1 -1
  192. package/dist/{reference-lines-CWA8VeUR.js → reference-lines-hjuD1rRZ.js} +2 -2
  193. package/dist/scene-BP0Ue0R5.js +4938 -0
  194. package/dist/scene.js +1 -0
  195. package/dist/{slope-chart-DT22h_ym.js → slope-chart-C8eeSgL4.js} +7 -7
  196. package/dist/{src-CpdJlDhO.js → src-9EJskqB_.js} +73 -31
  197. package/dist/{src-D5NXRJZe.js → src-B2rgpWap.js} +48 -14
  198. package/dist/{src-BPTDJqt0.js → src-Ci8DeY8J.js} +1 -1
  199. package/dist/{src-CGc_hjxJ.js → src-DFW49IAs.js} +143 -111
  200. package/dist/{src-1EHkSFS-.js → src-Dxs3Buo_.js} +205 -139
  201. package/dist/{src-CExIrXPC.js → src-npqwq3Sa.js} +1 -1
  202. package/dist/styles2.css +542 -21
  203. package/dist/{time-series-IB3CB93O.js → time-series-BL933QyA.js} +787 -715
  204. package/dist/{token-heatmap-C00DnoNO.js → token-heatmap-BB65awva.js} +4 -4
  205. package/dist/{token-predictions-Cxx29iDr.js → token-predictions-Pa8eUGan.js} +6 -6
  206. package/dist/transport-DzyxVXbL.js +715 -0
  207. package/dist/{tree-diagram-DsckNKaW.js → tree-diagram-DJhKBiia.js} +6 -6
  208. package/dist/{treemap-9_DpLCW9.js → treemap-CxxgABUg.js} +5 -5
  209. package/dist/use-tween-5HZ55_9d.js +72 -0
  210. package/dist/{violin-plot-BhPHKXsN.js → violin-plot-CoAEF_7Z.js} +7 -6
  211. package/dist/{waterfall-CGksuTy5.js → waterfall-DdoEXEkT.js} +7 -7
  212. package/package.json +30 -5
  213. package/recipes/counting-cards.tsx +656 -0
  214. package/recipes/explorable-essay.tsx +172 -0
  215. package/skills/extend-elements/SKILL.md +21 -0
  216. package/skills/plan-lesson/SKILL.md +86 -0
  217. package/skills/plan-lesson/references/plan-format.md +114 -0
  218. package/skills/plan-lesson/references/worked-plan.md +171 -0
  219. package/skills/review-elements/SKILL.md +4 -2
  220. package/skills/review-explainer/SKILL.md +97 -0
  221. package/skills/upgrade-elements/references/releases.md +65 -0
  222. package/skills/use-elements/SKILL.md +18 -16
  223. package/skills/use-elements/references/kits.md +9 -26
  224. package/skills/use-elements/references/teaching.md +36 -0
  225. package/skills/write-explainer/SKILL.md +112 -0
  226. package/skills/write-explainer/references/article.md +164 -0
  227. package/skills/write-explainer/references/lesson.md +148 -0
  228. package/skills/write-explainer/references/mdx.md +78 -0
  229. package/skills/write-explainer/references/scene-parts.md +273 -0
  230. package/skills/write-explainer/references/scene.md +168 -0
  231. package/skills/write-explainer/references/tutor.md +104 -0
  232. package/skills/write-explainer/references/worked-essay.md +459 -0
  233. package/templates/essay/AGENTS.md +14 -0
  234. package/templates/essay/README.md +59 -0
  235. package/templates/essay/index.html +17 -0
  236. package/templates/essay/package.template.json +21 -0
  237. package/templates/essay/plan.json +96 -0
  238. package/templates/essay/src/essay.mdx +97 -0
  239. package/templates/essay/src/figures.tsx +92 -0
  240. package/templates/essay/src/lesson.ts +83 -0
  241. package/templates/essay/src/main.tsx +53 -0
  242. package/templates/essay/src/mdx.d.ts +7 -0
  243. package/templates/essay/tsconfig.template.json +15 -0
  244. package/templates/essay/vite.config.template.txt +8 -0
  245. package/dist/kits/explainers.js +0 -452
  246. package/dist/packages/kits/src/explainers/figures.d.ts +0 -31
  247. package/dist/packages/kits/src/explainers/index.d.ts +0 -8
  248. package/dist/packages/kits/src/explainers/story-steps.d.ts +0 -46
  249. /package/dist/packages/{kits/src/explainers → teaching/src/article}/linked-target.d.ts +0 -0
  250. /package/dist/packages/{kits/src/explainers → teaching/src/lesson}/bound-value.d.ts +0 -0
@@ -0,0 +1,1904 @@
1
+ import { n as e, t } from "./chart-link-AE_xuxiP.js";
2
+ import { i as n, t as r } from "./tone-scope-DKiSw-JR.js";
3
+ import { a as i, c as a, i as o, l as s, n as c, o as l, t as u } from "./transport-DzyxVXbL.js";
4
+ import { d, n as f, t as p, u as m } from "./param-BE3VMSkH.js";
5
+ import { i as h, r as g } from "./tokens.stylex-dF5CACEJ.js";
6
+ import { T as _, m as v } from "./src-9EJskqB_.js";
7
+ import { t as y } from "./accessibility-P89UG9-r.js";
8
+ import { r as b } from "./figure-format-B8kRZMlo.js";
9
+ import { t as x } from "./forms-CEbwzlRR.js";
10
+ import { l as S, x as C } from "./src-Dxs3Buo_.js";
11
+ import { t as w } from "./chart-tones-ei3BC2AL.js";
12
+ import * as T from "@stylexjs/stylex";
13
+ import { usePart as ee, usePrimitive as te } from "@ui-sdk/react/primitive";
14
+ import { createContext as E, isValidElement as D, use as O, useEffect as k, useId as A, useLayoutEffect as ne, useRef as j, useState as M, useSyncExternalStore as re } from "react";
15
+ import { createChange as ie, createLocalStorage as ae, definePrimitive as oe, matchesShortcut as N } from "@ui-sdk/core";
16
+ import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
17
+ import { scrubTo as se } from "@ui-sdk/core/number";
18
+ // packages/teaching/src/article/article-context.ts
19
+ var ce = E(null);
20
+ function L() {
21
+ return O(ce);
22
+ }
23
+ var le = E(null);
24
+ function R() {
25
+ return O(le);
26
+ }
27
+ function ue(e) {
28
+ let t = { values: e }, n = /* @__PURE__ */ new Map();
29
+ return {
30
+ add: (e, t) => (n.set(e, t), () => {
31
+ n.get(e) === t && n.delete(e);
32
+ }),
33
+ entries: () => [...n.entries()],
34
+ seen: () => t.values,
35
+ remember: (e) => {
36
+ t.values = e;
37
+ }
38
+ };
39
+ }
40
+ // packages/teaching/src/article/article-labels.ts
41
+ var de = {
42
+ contents: "Contents",
43
+ figure: "Figure",
44
+ notes: "Notes",
45
+ note: "Note",
46
+ references: "References",
47
+ backToText: "Back to the text",
48
+ by: "By",
49
+ previous: "Previous",
50
+ next: "Next",
51
+ beat: "Beat",
52
+ of: "of",
53
+ step: "step",
54
+ figureDescription: "What the figure shows",
55
+ showAnswer: "Show the answer",
56
+ sheet: "Beat sheet",
57
+ checks: "Checks",
58
+ noProblems: "No problems found.",
59
+ opening: "Opening",
60
+ goal: "Goal",
61
+ misconception: "Misconception",
62
+ tutorHints: "Tutor hints",
63
+ steps: "Reveal steps",
64
+ progress: "Reading progress"
65
+ };
66
+ // packages/teaching/src/article/article-error.tsx
67
+ function z({ children: e }) {
68
+ return /* @__PURE__ */ F("div", {
69
+ className: "x1iemlrz",
70
+ children: /* @__PURE__ */ F(d, { children: e })
71
+ });
72
+ }
73
+ function B(e, t) {
74
+ return `${e} "${t}" sits inside a component of your own, so the outline, the beat sheet and the tutor miss it. Write it directly in the Article's children.`;
75
+ }
76
+ function V(e) {
77
+ return `${e} must be rendered inside an <Article>.`;
78
+ }
79
+ // packages/teaching/src/article/beat-steps.ts
80
+ function fe({ beat: e, step: t, view: n }) {
81
+ let r = n === "present" ? e?.scrollySteps.length ?? 0 : 0;
82
+ return r === 0 ? {
83
+ scrolly: null,
84
+ reveal: t
85
+ } : {
86
+ scrolly: Math.min(t, r - 1),
87
+ reveal: Math.max(0, t - (r - 1))
88
+ };
89
+ }
90
+ function pe(e) {
91
+ return Object.fromEntries(e.beats.flatMap((e) => e.scrollySteps.length > 1 ? [[e.id, e.scrollySteps.length - 1]] : []));
92
+ }
93
+ // packages/teaching/src/article/notes.tsx
94
+ h.focusWidth, g.focus;
95
+ function me({ children: e }) {
96
+ return /* @__PURE__ */ F("aside", {
97
+ className: "x1lliihq x9f619 xhff0hu x1umj4g3 x1ga0w67 xyumdvf xhzquy7 x1t7ytsu x97x49r x153jb6y xtqrqnz x1778rvt xyen2ro x1wo0zam xza49il x14atkfc x4iwnoa x1m1vpj6 x1hw0jy8 x14z9mp x1kn4fvo",
98
+ children: e
99
+ });
100
+ }
101
+ function he(e) {
102
+ return `fn-${e}`;
103
+ }
104
+ function ge(e) {
105
+ return `fnref-${e}`;
106
+ }
107
+ function _e({ id: e }) {
108
+ let t = L();
109
+ if (t === null) return /* @__PURE__ */ F(d, { children: V("Footnote") });
110
+ let n = t.outline.footnotes.findIndex((t) => t.id === e) + 1;
111
+ return /* @__PURE__ */ F("sup", {
112
+ className: "x14ju556",
113
+ children: /* @__PURE__ */ F("a", {
114
+ id: t.view === "sheet" ? void 0 : ge(e),
115
+ href: `#${he(e)}`,
116
+ "aria-label": `${t.labels.note} ${n}`,
117
+ className: "x3crp0m x7ixh4y xy8obcc xss6m8b xkrqix3 x1ok0vyi x5638nf x13qnu6 x9v5kkp x19rmrnh x7s97pk",
118
+ children: n
119
+ })
120
+ });
121
+ }
122
+ function H({ beat: e }) {
123
+ let t = L(), n = A(), r = t?.outline.footnotes ?? [], i = e === void 0 ? r : r.filter((t) => t.beat === e), a = e !== void 0;
124
+ return t === null || i.length === 0 ? null : /* @__PURE__ */ I("section", {
125
+ "aria-labelledby": n,
126
+ ...{
127
+ 0: { className: "xrvj5dj x1hnptsi x1b5qhtu x1tku9c6 xmblgzg x178xt8z x13fuv20 xhjagg4 x153jb6y x1hz01jw xtqrqnz x1778rvt" },
128
+ 1: { className: "xrvj5dj x1b5qhtu x178xt8z x13fuv20 xhjagg4 x153jb6y x1hz01jw xunmzkg x1m1vpj6 x3bg4vu xy8obcc xas2l8k" }
129
+ }[!!a | 0],
130
+ children: [/* @__PURE__ */ F("h2", {
131
+ id: n,
132
+ ...{
133
+ 0: { className: "x1ghz6dp xbixft x12myhf4 x4fansv x1b5ytql" },
134
+ 1: { className: "x1ghz6dp xbixft x1b5ytql xy8obcc xas2l8k" }
135
+ }[!!a | 0],
136
+ children: t.labels.notes
137
+ }), /* @__PURE__ */ F("ol", {
138
+ ...{
139
+ 0: { className: "xrvj5dj x1hnptsi x1ghz6dp x1sbza1b" },
140
+ 1: { className: "xrvj5dj x1ghz6dp x1sbza1b xfko13i" }
141
+ }[!!a | 0],
142
+ children: i.map((e) => /* @__PURE__ */ I("li", {
143
+ id: he(e.id),
144
+ value: r.indexOf(e) + 1,
145
+ className: "xqalb56 xk5a76m",
146
+ children: [e.content, /* @__PURE__ */ F("a", {
147
+ href: `#${ge(e.id)}`,
148
+ "aria-label": t.labels.backToText,
149
+ className: "xa1dmyi x7ixh4y xkrqix3 x1ok0vyi x13qnu6 x9v5kkp x19rmrnh x7s97pk",
150
+ children: "↩"
151
+ })]
152
+ }, e.id))
153
+ })]
154
+ });
155
+ }
156
+ function ve(e) {
157
+ return `ref-${e}`;
158
+ }
159
+ function ye({ id: e }) {
160
+ let t = L();
161
+ if (t === null) return /* @__PURE__ */ F(d, { children: V("Cite") });
162
+ let { references: n } = t.outline, r = n.findIndex((t) => t.id === e), i = n[r];
163
+ return i === void 0 ? /* @__PURE__ */ F(d, { children: `Unknown reference "${e}": add it to the article's References.` }) : /* @__PURE__ */ F("a", {
164
+ href: `#${ve(e)}`,
165
+ "aria-label": `${i.authors.join(", ")}, ${i.year}`,
166
+ className: "x3crp0m x7ixh4y xy8obcc xss6m8b xkrqix3 x1ok0vyi x5638nf x13qnu6 x9v5kkp x19rmrnh x7s97pk",
167
+ children: `[${r + 1}]`
168
+ });
169
+ }
170
+ function be({ items: e }) {
171
+ let t = L(), { beat: n, lesson: r } = a(), i = t?.view === "present" && n !== r.beats.at(-1)?.id, o = A(), s = e.find((t, n) => e.findIndex((e) => e.id === t.id) !== n);
172
+ return t === null || s !== void 0 ? /* @__PURE__ */ F(z, { children: t === null ? V("References") : `Two references share the id "${s?.id ?? ""}".` }) : /* @__PURE__ */ I("section", {
173
+ "aria-labelledby": o,
174
+ hidden: i,
175
+ ...{
176
+ 0: { className: "xrvj5dj x1hnptsi x1b5qhtu x1tku9c6 xmblgzg x178xt8z x13fuv20 xhjagg4 x153jb6y x1hz01jw xtqrqnz x1778rvt" },
177
+ 1: { className: "x1hnptsi x1b5qhtu x1tku9c6 xmblgzg x178xt8z x13fuv20 xhjagg4 x153jb6y x1hz01jw xtqrqnz x1778rvt x1s85apg" }
178
+ }[!!i | 0],
179
+ children: [/* @__PURE__ */ F("h2", {
180
+ id: o,
181
+ className: "x1ghz6dp xbixft x12myhf4 x4fansv x1b5ytql",
182
+ children: t.labels.references
183
+ }), /* @__PURE__ */ F("ol", {
184
+ className: "xrvj5dj x1hnptsi x1ghz6dp x1sbza1b",
185
+ children: e.map((e) => /* @__PURE__ */ I("li", {
186
+ id: ve(e.id),
187
+ className: "xqalb56 xk5a76m",
188
+ children: [
189
+ `${e.authors.join(", ")}. ${e.year}. `,
190
+ e.url === void 0 ? /* @__PURE__ */ F("span", {
191
+ className: "xbixft",
192
+ children: e.title
193
+ }) : /* @__PURE__ */ F("a", {
194
+ href: e.url,
195
+ className: "xj0a0fe xibglb1 x1ok0vyi x13qnu6 x9v5kkp x19rmrnh x7s97pk xbixft",
196
+ children: e.title
197
+ }),
198
+ e.venue === void 0 ? "." : `. ${e.venue}.`
199
+ ]
200
+ }, e.id))
201
+ })]
202
+ });
203
+ }
204
+ // packages/teaching/src/article/beat.tsx
205
+ function xe(e) {
206
+ return e?.states?.[0]?.values ?? {};
207
+ }
208
+ function U(e, t) {
209
+ return e.beats.find((e) => e.id === t);
210
+ }
211
+ function W({ id: e, children: t }) {
212
+ let n = L(), { beat: r, step: i } = a(), o = A();
213
+ if (n === null) return /* @__PURE__ */ F(z, { children: V("Beat") });
214
+ let c = U(n.lesson, e), l = r === e, u = n.outline.beats.find((t) => t.id === e), f = fe({
215
+ beat: u,
216
+ step: l ? i : 0,
217
+ view: n.view
218
+ }), p = n.view === "static", m = n.view === "present" && !l, h = c === void 0 ? /* @__PURE__ */ F(d, { children: `Lesson "${n.lesson.id}" has no beat "${e}". Its beats: ${n.lesson.beats.map((e) => e.id).join(", ")}.` }) : c.title, g = /* @__PURE__ */ I(le, {
219
+ value: {
220
+ id: e,
221
+ isCurrent: l,
222
+ step: f.reveal,
223
+ scrolly: f.scrolly
224
+ },
225
+ children: [
226
+ /* @__PURE__ */ F("h2", {
227
+ id: o,
228
+ className: "xdj266r x14yccmi x71lla1 xgkpprq x1b5ytql x1wjjqco x1w2vvpw x37gifx",
229
+ children: h
230
+ }),
231
+ u === void 0 ? /* @__PURE__ */ F(z, { children: B("Beat", e) }) : null,
232
+ t,
233
+ n.view === "present" ? /* @__PURE__ */ F(H, { beat: e }) : null
234
+ ]
235
+ });
236
+ return /* @__PURE__ */ F("section", {
237
+ id: e,
238
+ "aria-labelledby": o,
239
+ "data-beat": e,
240
+ "data-current": l ? "" : void 0,
241
+ hidden: m,
242
+ ...{
243
+ 0: { className: "x1lliihq xeuugli x1b5qhtu x16jagqu xyri2b x1xpcpqf x123szhz xqalb56 xbixft x1hz01jw x1i2cqwi x1ytb0s6 x1mzt3pk" },
244
+ 1: { className: "xeuugli x1b5qhtu x16jagqu xyri2b x1xpcpqf x123szhz xqalb56 xbixft x1hz01jw x1i2cqwi x1ytb0s6 x1mzt3pk x1s85apg" }
245
+ }[!!m | 0],
246
+ children: p ? /* @__PURE__ */ F(s, {
247
+ lesson: n.lesson,
248
+ locale: n.locale,
249
+ values: xe(c),
250
+ isReadOnly: !0,
251
+ children: g
252
+ }) : g
253
+ });
254
+ }
255
+ // packages/teaching/src/article/exercise-styles.ts
256
+ var G = {
257
+ box: {
258
+ k1xSpc: "xrvj5dj",
259
+ kOIVth: "x1n8ia3y",
260
+ kqGvvJ: "xtru72a",
261
+ k8WAf4: "x1ydxw8w",
262
+ kg3NbH: "x1m92p3w",
263
+ kMzoRj: "xmkeg23",
264
+ ksu8eU: "x1y0btm7",
265
+ kVAM5u: "x1ey3b81",
266
+ kaIpWk: "xy32g2j",
267
+ kWkggS: "xpvm0e4",
268
+ kiIUUe: "x1qgqlal",
269
+ $$css: !0
270
+ },
271
+ kicker: {
272
+ kogj98: "x1ghz6dp",
273
+ kMwMTN: "x7ixh4y",
274
+ kGuDYH: "xy8obcc",
275
+ kLWn49: "xas2l8k",
276
+ k63SB2: "x1b5ytql",
277
+ kb6lSQ: "x1dgsrnt",
278
+ kP9fke: "xtvhhri",
279
+ $$css: !0
280
+ },
281
+ prompt: {
282
+ k63SB2: "xk4h15q",
283
+ $$css: !0
284
+ },
285
+ meta: {
286
+ kogj98: "x1ghz6dp",
287
+ kMwMTN: "x153jb6y",
288
+ kGuDYH: "x12myhf4",
289
+ $$css: !0
290
+ },
291
+ controls: {
292
+ k1xSpc: "xrvj5dj",
293
+ kOIVth: "x1n8ia3y",
294
+ ks0D6T: "x1983rqf",
295
+ $$css: !0
296
+ },
297
+ result: {
298
+ k1xSpc: "xrvj5dj",
299
+ kOIVth: "x1hnptsi",
300
+ $$css: !0
301
+ },
302
+ verdict: {
303
+ kogj98: "x1ghz6dp",
304
+ $$css: !0
305
+ },
306
+ right: {
307
+ kMwMTN: "x7ixh4y",
308
+ k63SB2: "x1b5ytql",
309
+ $$css: !0
310
+ },
311
+ wrong: {
312
+ kMwMTN: "x1f9ixgr",
313
+ k63SB2: "x1b5ytql",
314
+ $$css: !0
315
+ },
316
+ details: {
317
+ k1xSpc: "xrvj5dj",
318
+ kOIVth: "x1hnptsi",
319
+ $$css: !0
320
+ },
321
+ summary: {
322
+ kMwMTN: "x7ixh4y",
323
+ kkrTdU: "x1ypdohk",
324
+ kGuDYH: "x12myhf4",
325
+ $$css: !0
326
+ },
327
+ hints: {
328
+ k1xSpc: "xrvj5dj",
329
+ kOIVth: "xunmzkg",
330
+ kogj98: "x1ghz6dp",
331
+ kZCmMZ: "x1sbza1b",
332
+ kMwMTN: "x153jb6y",
333
+ $$css: !0
334
+ },
335
+ actions: {
336
+ k1xSpc: "x78zum5",
337
+ kwnvtZ: "x1a02dak",
338
+ kGNEyG: "x6s0dn4",
339
+ kOIVth: "x1n8ia3y",
340
+ $$css: !0
341
+ }
342
+ }, Se = {
343
+ kicker: "Challenge",
344
+ reached: "Reached.",
345
+ notYet: "Not reached yet.",
346
+ hint: "Show a hint",
347
+ of: "of",
348
+ showOutcome: "Show what you find"
349
+ };
350
+ function Ce({ id: e, prompt: t, isReached: n, hints: r = [], children: i, labels: a }) {
351
+ let o = L(), s = {
352
+ ...Se,
353
+ ...a
354
+ }, c = A(), l = o?.challenges;
355
+ if (k(() => l?.add(e, n), [
356
+ l,
357
+ e,
358
+ n
359
+ ]), o === null) return /* @__PURE__ */ F(z, { children: V("Challenge") });
360
+ let u = o.progress.reached.includes(e), d = Math.min(o.progress.hints[e] ?? 0, r.length), f = /* @__PURE__ */ I(P, { children: [
361
+ o.outline.challenges.some((t) => t.id === e) ? null : /* @__PURE__ */ F(z, { children: B("Challenge", e) }),
362
+ /* @__PURE__ */ F("p", {
363
+ ...T.props(G.kicker),
364
+ children: s.kicker
365
+ }),
366
+ /* @__PURE__ */ F("div", {
367
+ id: c,
368
+ ...T.props(G.prompt),
369
+ children: t
370
+ })
371
+ ] });
372
+ return o.view === "static" ? /* @__PURE__ */ I("section", {
373
+ "aria-labelledby": c,
374
+ ...T.props(G.box),
375
+ children: [
376
+ f,
377
+ r.length > 0 ? /* @__PURE__ */ F("ol", {
378
+ ...T.props(G.hints),
379
+ children: r.map((e) => /* @__PURE__ */ F("li", { children: e }, e))
380
+ }) : null,
381
+ /* @__PURE__ */ I("details", {
382
+ ...T.props(G.details),
383
+ children: [/* @__PURE__ */ F("summary", {
384
+ ...T.props(G.summary),
385
+ children: s.showOutcome
386
+ }), i]
387
+ })
388
+ ]
389
+ }) : /* @__PURE__ */ I("section", {
390
+ "aria-labelledby": c,
391
+ ...T.props(G.box),
392
+ children: [
393
+ f,
394
+ /* @__PURE__ */ F("p", {
395
+ role: "status",
396
+ ...T.props(G.verdict),
397
+ children: /* @__PURE__ */ F("span", {
398
+ ...T.props(u ? G.right : G.meta),
399
+ children: u ? s.reached : s.notYet
400
+ })
401
+ }),
402
+ d > 0 ? /* @__PURE__ */ F("ol", {
403
+ ...T.props(G.hints),
404
+ children: r.slice(0, d).map((e) => /* @__PURE__ */ F("li", { children: e }, e))
405
+ }) : null,
406
+ u ? /* @__PURE__ */ F("div", { children: i }) : null,
407
+ !u && d < r.length ? /* @__PURE__ */ F("div", {
408
+ ...T.props(G.actions),
409
+ children: /* @__PURE__ */ F(_, {
410
+ density: "compact",
411
+ onClick: (t) => o.progressApi.showHint(e, {
412
+ reason: "hint-press",
413
+ event: t.nativeEvent
414
+ }),
415
+ children: `${s.hint} (${d + 1} ${s.of} ${r.length})`
416
+ })
417
+ }) : null
418
+ ]
419
+ });
420
+ }
421
+ // packages/teaching/src/article/figure.tsx
422
+ var we = {
423
+ figure: {
424
+ k1xSpc: "xrvj5dj",
425
+ kOIVth: "x1hnptsi",
426
+ k7Eaqz: "xeuugli",
427
+ kUOVxO: "xrxpjvj",
428
+ kqGvvJ: "xtru72a",
429
+ klnimT: "x18xfj1p",
430
+ k4rD7h: "xqalb56",
431
+ kiIUUe: "x1qgqlal",
432
+ $$css: !0
433
+ },
434
+ cell: {
435
+ kqGvvJ: "x10im51j",
436
+ $$css: !0
437
+ },
438
+ description: {
439
+ kogj98: "x1ghz6dp",
440
+ ks0D6T: "x1b5qhtu",
441
+ kMwMTN: "xbixft",
442
+ kGuDYH: "x12myhf4",
443
+ kLWn49: "x1ytb0s6",
444
+ $$css: !0
445
+ }
446
+ }, Te = E(!1), K = E(!1), Ee = {
447
+ text: { $$css: !0 },
448
+ wide: {
449
+ k71WvV: "x14z9mp x1kn4fvo",
450
+ $$css: !0
451
+ }
452
+ };
453
+ function De(e) {
454
+ let t = L()?.outline.figures.indexOf(e) ?? -1;
455
+ return t === -1 ? void 0 : t + 1;
456
+ }
457
+ function Oe(e) {
458
+ return `Unknown figure "${e}": no Figure in the article has this id.`;
459
+ }
460
+ function q({ id: e, caption: t, description: n, size: r = "wide", children: i }) {
461
+ let a = L(), o = De(e), s = A(), c = O(Te), l = O(K);
462
+ if (a === null) return /* @__PURE__ */ F(z, { children: V("Figure") });
463
+ let { view: u, labels: f } = a, p = u === "sheet", m = u === "static", h = n !== void 0;
464
+ return /* @__PURE__ */ I("figure", {
465
+ id: p || c ? void 0 : e,
466
+ "aria-describedby": h ? s : void 0,
467
+ ...T.props(we.figure, !p && Ee[l ? "text" : r], p && we.cell),
468
+ children: [
469
+ i,
470
+ /* @__PURE__ */ F("figcaption", {
471
+ className: "x1ghz6dp x1b5qhtu x153jb6y x1hz01jw xy8obcc xas2l8k xj0a0fe",
472
+ children: o === void 0 ? /* @__PURE__ */ F(d, { children: B("Figure", e) }) : /* @__PURE__ */ I(P, { children: [
473
+ /* @__PURE__ */ F("span", {
474
+ className: "xbixft x1b5ytql",
475
+ children: `${f.figure} ${o}.`
476
+ }),
477
+ " ",
478
+ t
479
+ ] })
480
+ }),
481
+ h ? /* @__PURE__ */ I("p", {
482
+ id: s,
483
+ ...T.props(we.description, !m && y.hidden),
484
+ children: [/* @__PURE__ */ F("span", {
485
+ className: "x1b5ytql",
486
+ children: `${f.figureDescription}: `
487
+ }), n]
488
+ }) : null
489
+ ]
490
+ });
491
+ }
492
+ function ke({ to: e }) {
493
+ let t = L(), n = De(e);
494
+ return n === void 0 || t === null ? /* @__PURE__ */ F(d, { children: t === null ? V("FigureReference") : Oe(e) }) : /* @__PURE__ */ F("a", {
495
+ href: `#${encodeURIComponent(e)}`,
496
+ className: "x1heor9g xujl8zx xibglb1 x1ohr1zr x1ok0vyi xd636jy x13qnu6 x9v5kkp x19rmrnh x7s97pk",
497
+ children: `${t.labels.figure} ${n}`
498
+ });
499
+ }
500
+ function Ae(e) {
501
+ let t = L(), n = R();
502
+ return t?.view !== "present" || n === null || n.isCurrent && n.step >= e;
503
+ }
504
+ function je({ at: e, children: t }) {
505
+ let n = L(), r = R(), i = Ae(e);
506
+ if (n === null || r === null) return /* @__PURE__ */ F(z, { children: n === null ? V("Reveal") : "Reveal must sit inside a Beat." });
507
+ let a = n.lesson.beats.find((e) => e.id === r.id)?.steps ?? 0;
508
+ if (!(Number.isInteger(e) && e >= 0 && e <= a)) return /* @__PURE__ */ F(z, { children: `Reveal at ${e}, but beat "${r.id}" has reveal steps 0 to ${a}.` });
509
+ let o = !i;
510
+ return /* @__PURE__ */ F("div", {
511
+ hidden: o,
512
+ "data-reveal-at": e,
513
+ ...{
514
+ 0: {},
515
+ 1: { className: "xjp7ctv" }
516
+ }[!o | 0],
517
+ children: t
518
+ });
519
+ }
520
+ // packages/teaching/src/article/predict.tsx
521
+ var Me = {
522
+ kicker: "Predict",
523
+ yourGuess: "Your guess",
524
+ commit: "Lock in my guess",
525
+ youGuessed: "You guessed",
526
+ answerIs: "The answer is",
527
+ right: "Right.",
528
+ wrong: "Not quite.",
529
+ showAnswer: "Show the answer",
530
+ range: "Between",
531
+ needsReader: "Commits the reader’s own prediction; only the reader can make it."
532
+ };
533
+ function Ne(e, t) {
534
+ if ("options" in e) return e.options.some((t) => t.id === e.answer) ? { answer: e.answer } : { error: `Predict "${e.id}" has no option "${e.answer}" for its answer.` };
535
+ if (e.answerFrom === void 0) return { answer: e.answer };
536
+ let n = t[e.answerFrom];
537
+ return typeof n == "number" ? { answer: n } : { error: `Predict "${e.id}" takes its answer from "${e.answerFrom}", which is not a number of the lesson.` };
538
+ }
539
+ function J(e, t, n) {
540
+ return "options" in e ? e.options.find((e) => e.id === t)?.label ?? String(t) : typeof t == "number" ? b({
541
+ value: t,
542
+ locale: n,
543
+ format: e.format
544
+ }) : t;
545
+ }
546
+ function Pe(e, t, n) {
547
+ return "options" in e || typeof t != "number" || typeof n != "number" ? t === n : Math.abs(t - n) <= (e.tolerance ?? e.step);
548
+ }
549
+ function Fe({ props: e, record: t, article: n, words: r }) {
550
+ let i = J(e, t.value, n.locale), a = J(e, t.answer, n.locale);
551
+ return /* @__PURE__ */ I("div", {
552
+ role: "status",
553
+ ...T.props(G.result),
554
+ children: [/* @__PURE__ */ I("p", {
555
+ ...T.props(G.verdict),
556
+ children: [
557
+ /* @__PURE__ */ F("span", {
558
+ ...T.props(t.isCorrect ? G.right : G.wrong),
559
+ children: t.isCorrect ? r.right : r.wrong
560
+ }),
561
+ " ",
562
+ `${r.youGuessed} ${i}. ${r.answerIs} ${a}.`
563
+ ]
564
+ }), /* @__PURE__ */ F("div", { children: e.children })]
565
+ });
566
+ }
567
+ function Ie(e) {
568
+ let { id: t, prompt: n, children: r, labels: i } = e, o = L(), { values: s } = a(), c = {
569
+ ...Me,
570
+ ...i
571
+ }, l = A(), u = "options" in e ? null : se((e.min + e.max) / 2, e).value, [d, f] = M(u);
572
+ if (o === null) return /* @__PURE__ */ F(z, { children: V("Predict") });
573
+ if (!o.outline.predictions.some((e) => e.id === t)) return /* @__PURE__ */ F(z, { children: B("Predict", t) });
574
+ let p = Ne(e, s);
575
+ if ("error" in p) return /* @__PURE__ */ F(z, { children: p.error });
576
+ let m = o.progress.predictions[t], h = /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("p", {
577
+ ...T.props(G.kicker),
578
+ children: c.kicker
579
+ }), /* @__PURE__ */ F("div", {
580
+ id: l,
581
+ ...T.props(G.prompt),
582
+ children: n
583
+ })] });
584
+ if (o.view === "static") {
585
+ let t = "options" in e ? e.options.map((e) => e.label).join(" · ") : null, n = "options" in e ? null : `${c.range} ${J(e, e.min, o.locale)} – ${J(e, e.max, o.locale)}`;
586
+ return /* @__PURE__ */ I("section", {
587
+ "aria-labelledby": l,
588
+ ...T.props(G.box),
589
+ children: [
590
+ h,
591
+ /* @__PURE__ */ F("p", {
592
+ ...T.props(G.meta),
593
+ children: t ?? n
594
+ }),
595
+ /* @__PURE__ */ I("details", {
596
+ ...T.props(G.details),
597
+ children: [
598
+ /* @__PURE__ */ F("summary", {
599
+ ...T.props(G.summary),
600
+ children: c.showAnswer
601
+ }),
602
+ /* @__PURE__ */ F("p", {
603
+ ...T.props(G.verdict),
604
+ children: `${c.answerIs} ${J(e, p.answer, o.locale)}.`
605
+ }),
606
+ r
607
+ ]
608
+ })
609
+ ]
610
+ });
611
+ }
612
+ function g(n) {
613
+ d === null || "error" in p || o === null || o.progressApi.commit(t, {
614
+ value: d,
615
+ answer: p.answer,
616
+ isCorrect: Pe(e, d, p.answer)
617
+ }, {
618
+ reason: "commit",
619
+ event: n.nativeEvent
620
+ });
621
+ }
622
+ let y = "options" in e ? /* @__PURE__ */ F(S.Root, {
623
+ value: typeof d == "string" ? d : "",
624
+ onValueChange: (e) => f(e),
625
+ "aria-labelledby": l,
626
+ children: e.options.map((e) => /* @__PURE__ */ F(x.Root, { children: /* @__PURE__ */ F(x.Label, { children: /* @__PURE__ */ I(v, { children: [/* @__PURE__ */ F(S.Item, {
627
+ value: e.id,
628
+ children: /* @__PURE__ */ F(S.Indicator, {})
629
+ }), e.label] }) }) }, e.id))
630
+ }) : /* @__PURE__ */ I(C.Root, {
631
+ locale: o.locale,
632
+ value: typeof d == "number" ? d : e.min,
633
+ onValueChange: (e) => f(e),
634
+ min: e.min,
635
+ max: e.max,
636
+ step: e.step,
637
+ format: e.format,
638
+ children: [/* @__PURE__ */ I(v, {
639
+ shouldSpaceBetween: !0,
640
+ children: [/* @__PURE__ */ F(C.Label, { children: c.yourGuess }), /* @__PURE__ */ F(C.Value, {})]
641
+ }), /* @__PURE__ */ I(C.Control, { children: [/* @__PURE__ */ F(C.Track, { children: /* @__PURE__ */ F(C.Indicator, {}) }), /* @__PURE__ */ F(C.Thumb, {})] })]
642
+ });
643
+ return /* @__PURE__ */ I("section", {
644
+ "aria-labelledby": l,
645
+ ...T.props(G.box),
646
+ children: [h, m === void 0 ? /* @__PURE__ */ I("div", {
647
+ ...T.props(G.controls),
648
+ children: [y, /* @__PURE__ */ F("div", { children: /* @__PURE__ */ F(_, {
649
+ variant: "solid",
650
+ disabled: d === null,
651
+ "data-agent-confirm": c.needsReader,
652
+ onClick: g,
653
+ children: c.commit
654
+ }) })]
655
+ }) : /* @__PURE__ */ F(Fe, {
656
+ props: e,
657
+ record: m,
658
+ article: o,
659
+ words: c
660
+ })]
661
+ });
662
+ }
663
+ // packages/teaching/src/article/lesson-values.ts
664
+ function Le(e, t) {
665
+ let n = new Map(Object.entries(e.params));
666
+ return Object.entries(t).flatMap(([t, r]) => {
667
+ let i = n.get(t);
668
+ return i === void 0 ? [`Lesson "${e.id}" has no param "${t}".`] : m({
669
+ name: t,
670
+ param: i,
671
+ value: r
672
+ }) ?? [];
673
+ }).at(0);
674
+ }
675
+ function Re(e, t) {
676
+ return e.beats.flatMap((e) => e.states ?? []).find((e) => e.id === t)?.values;
677
+ }
678
+ // packages/teaching/src/article/walk.ts
679
+ function* Y({ node: e, place: t, placeOf: n }) {
680
+ if (Array.isArray(e)) for (let r of e) yield* Y({
681
+ node: r,
682
+ place: t,
683
+ placeOf: n
684
+ });
685
+ else if (typeof e == "object" && D(e)) {
686
+ yield {
687
+ element: e,
688
+ place: t
689
+ };
690
+ for (let [r, i] of Object.entries(e.props)) yield* Y({
691
+ node: i,
692
+ place: n({
693
+ element: e,
694
+ place: t,
695
+ prop: r
696
+ }),
697
+ placeOf: n
698
+ });
699
+ }
700
+ }
701
+ function X(e, t) {
702
+ let n = e.props[t];
703
+ return typeof n == "string" ? n : void 0;
704
+ }
705
+ // packages/teaching/src/article/scrolly.tsx
706
+ var ze = /* @__PURE__ */ new Set(["static", "sheet"]);
707
+ function Be({ children: e }) {
708
+ return e;
709
+ }
710
+ function Ve(e, t) {
711
+ let n = [...Y({
712
+ node: e,
713
+ place: {
714
+ beat: null,
715
+ figure: null
716
+ },
717
+ placeOf: ({ place: e }) => e
718
+ })].flatMap(({ element: e }) => e.type === Be && D(e) ? [e.props] : []), r = n.find((e) => e.state !== void 0 && Re(t, e.state) === void 0);
719
+ if (r !== void 0) return { error: `ScrollyStep "${r.id}" shows state "${r.state ?? ""}", which no beat declares.` };
720
+ let i = n.map((e) => ({
721
+ id: e.id,
722
+ values: (e.state === void 0 ? void 0 : Re(t, e.state)) ?? e.values ?? {},
723
+ content: e.children
724
+ })), a = i.map((e) => Le(t, e.values)).find((e) => e !== void 0);
725
+ return a === void 0 ? { steps: i } : { error: a };
726
+ }
727
+ function He({ figure: e, children: t }) {
728
+ let n = L(), { setMany: r } = a(), [i, o] = M(null), c = j(null), l = n === null ? { error: V("Scrolly") } : Ve(t, n.lesson), u = "steps" in l ? l.steps : [], d = "error" in l ? l.error : void 0, f = n?.view === "article", p = R(), m = j({
729
+ steps: u,
730
+ setMany: r,
731
+ applied: ""
732
+ }), h = u.map((e) => e.id).join("\n");
733
+ if (k(() => {
734
+ m.current.steps = u, m.current.setMany = r;
735
+ }), k(() => {
736
+ let e = c.current;
737
+ if (e === null || !f) return;
738
+ let t = new IntersectionObserver((e) => {
739
+ let t = e.find((e) => e.isIntersecting)?.target, n = t instanceof HTMLElement ? t.dataset.step : void 0, r = m.current.steps.find((e) => e.id === n);
740
+ r !== void 0 && r.id !== m.current.applied && (m.current.applied = r.id, o(r.id), m.current.setMany(r.values, { reason: "scroll" }));
741
+ }, { rootMargin: "-50% 0px -50% 0px" });
742
+ for (let n of e.querySelectorAll("[data-step]")) t.observe(n);
743
+ return () => t.disconnect();
744
+ }, [f, h]), n === null || d !== void 0) return /* @__PURE__ */ F(z, { children: d ?? V("Scrolly") });
745
+ if (n.view === "present") {
746
+ let t = n.outline.beats.find((e) => e.id === p?.id)?.scrollySteps.findIndex((e) => e.id === u[0]?.id) ?? 0, r = Math.min((p?.scrolly ?? 0) - t, u.length - 1), i = r < 0 ? void 0 : u[r]?.id;
747
+ return /* @__PURE__ */ F("div", {
748
+ className: "x12h1iku x812sq7 x18xfj1p xtru72a x14z9mp x1kn4fvo",
749
+ children: /* @__PURE__ */ I("div", {
750
+ className: "xrvj5dj x1mkdm3x xrz0ok8 xaml1ju x7a106z",
751
+ children: [/* @__PURE__ */ F("div", {
752
+ className: "x1ms6mhf xgkxs2y x1b6q7f1",
753
+ children: /* @__PURE__ */ F(K, {
754
+ value: !0,
755
+ children: e
756
+ })
757
+ }), /* @__PURE__ */ F("ol", {
758
+ className: "xrvj5dj x1hnptsi x7sv70a xru1beq xgkxs2y xeuugli x1ghz6dp x1717udv xe8uvvx",
759
+ children: u.map((e) => /* @__PURE__ */ F("li", {
760
+ "data-step": e.id,
761
+ "data-active": i === e.id ? "" : void 0,
762
+ "aria-current": i === e.id ? "step" : void 0,
763
+ ...{
764
+ 0: { className: "x1umj4g3 xyumdvf x1t7ytsu x97x49r x12ldcl5" },
765
+ 1: { className: "x1umj4g3 xyumdvf x1t7ytsu x1lm0jcf xbixft" }
766
+ }[i === e.id | 0],
767
+ children: e.content
768
+ }, e.id))
769
+ })]
770
+ })
771
+ });
772
+ }
773
+ return ze.has(n.view) ? /* @__PURE__ */ F("div", {
774
+ className: "x12h1iku x812sq7 x18xfj1p xtru72a x14z9mp x1kn4fvo xrvj5dj xaml1ju",
775
+ children: u.map((t, r) => /* @__PURE__ */ I("div", {
776
+ className: "xrvj5dj xaml1ju",
777
+ children: [/* @__PURE__ */ F("div", {
778
+ className: "x1b5qhtu",
779
+ children: t.content
780
+ }), /* @__PURE__ */ F(s, {
781
+ lesson: n.lesson,
782
+ locale: n.locale,
783
+ values: t.values,
784
+ isReadOnly: !0,
785
+ children: /* @__PURE__ */ F(Te, {
786
+ value: r > 0,
787
+ children: /* @__PURE__ */ F(K, {
788
+ value: !0,
789
+ children: e
790
+ })
791
+ })
792
+ })]
793
+ }, t.id))
794
+ }) : /* @__PURE__ */ F("div", {
795
+ className: "x12h1iku x812sq7 x18xfj1p xtru72a x14z9mp x1kn4fvo",
796
+ children: /* @__PURE__ */ I("div", {
797
+ className: "xrvj5dj x1mkdm3x xrz0ok8 x1i3977y x7a106z",
798
+ children: [/* @__PURE__ */ F("div", {
799
+ className: "x7wzq59 x13vifvy x1vjfegm x1ms6mhf xru1beq xgkxs2y x1b6q7f1 xn9t2bk xpvm0e4",
800
+ children: /* @__PURE__ */ F(K, {
801
+ value: !0,
802
+ children: e
803
+ })
804
+ }), /* @__PURE__ */ F("div", {
805
+ ref: c,
806
+ className: "x7sv70a xru1beq xgkxs2y xrvj5dj xxhr3t xeuugli",
807
+ children: u.map((e, t) => /* @__PURE__ */ F("div", {
808
+ "data-step": e.id,
809
+ "data-active": i === e.id ? "" : void 0,
810
+ ...{
811
+ 0: { className: "x78zum5 x6s0dn4 x13qphff x1hbw6r9 xbixft" },
812
+ 2: { className: "x78zum5 x6s0dn4 xbixft xwnajww xyvmra8" },
813
+ 1: { className: "x78zum5 x6s0dn4 x13qphff x1hbw6r9 x12ldcl5" },
814
+ 3: { className: "x78zum5 x6s0dn4 xwnajww xyvmra8 x12ldcl5" }
815
+ }[(t === 0) << 1 | (i !== null && i !== e.id)],
816
+ children: /* @__PURE__ */ F("div", {
817
+ className: "x1b5qhtu",
818
+ children: e.content
819
+ })
820
+ }, e.id))
821
+ })]
822
+ })
823
+ });
824
+ }
825
+ // packages/teaching/src/article/article-outline.ts
826
+ var Z = "(scrolly figure)", Ue = /* @__PURE__ */ new Map([
827
+ [p, "name"],
828
+ [f, "name"],
829
+ [i, "name"],
830
+ [o, "name"],
831
+ [l, "name"],
832
+ [c, "name"],
833
+ [u, "for"]
834
+ ]);
835
+ function We({ element: e, place: t, prop: n }) {
836
+ return e.type === W ? {
837
+ beat: X(e, "id") ?? null,
838
+ figure: null
839
+ } : e.type === q ? {
840
+ ...t,
841
+ figure: X(e, "id") ?? null
842
+ } : e.type === He && n === "figure" ? {
843
+ ...t,
844
+ figure: Z
845
+ } : t;
846
+ }
847
+ function Ge(e) {
848
+ let t = Ue.get(e.type);
849
+ return t === void 0 ? void 0 : X(e, t);
850
+ }
851
+ function Ke(e) {
852
+ return e.flatMap(({ element: e, place: t }) => e.type === q && D(e) ? [{
853
+ id: e.props.id,
854
+ beat: t.beat,
855
+ hasDescription: e.props.description !== void 0,
856
+ size: t.figure === Z ? "text" : e.props.size ?? "wide",
857
+ node: e
858
+ }] : e.type !== He || !D(e) || [...Y({
859
+ node: e.props.figure,
860
+ place: t,
861
+ placeOf: We
862
+ })].some((e) => e.element.type === q) ? [] : [{
863
+ id: Z,
864
+ beat: t.beat,
865
+ hasDescription: !1,
866
+ size: "text",
867
+ node: e.props.figure
868
+ }]);
869
+ }
870
+ function qe(e, t) {
871
+ return e.flatMap(({ element: e, place: n }) => {
872
+ if (n.beat !== t) return [];
873
+ let r = e.type === q && D(e) ? e.props.reads ?? [] : [], i = n.figure === null ? void 0 : Ge(e);
874
+ return i === void 0 ? r : [...r, i];
875
+ });
876
+ }
877
+ function Je(e) {
878
+ let t = [...Y({
879
+ node: e,
880
+ place: {
881
+ beat: null,
882
+ figure: null
883
+ },
884
+ placeOf: We
885
+ })], n = Ke(t), r = t.flatMap(({ element: e }) => e.type === W ? X(e, "id") ?? [] : []), i = t.flatMap(({ element: e }) => e.type === be && D(e) ? e.props.items : []);
886
+ return {
887
+ beats: r.map((e) => ({
888
+ id: e,
889
+ figures: n.filter((t) => t.beat === e),
890
+ figureNames: [...new Set(qe(t, e))],
891
+ proseParams: [...new Set(t.flatMap(({ element: t, place: n }) => n.beat === e && n.figure === null && t.type === p ? X(t, "name") ?? [] : []))],
892
+ scrollySteps: t.flatMap(({ element: t, place: n }) => n.beat === e && t.type === Be && D(t) ? [{
893
+ id: t.props.id,
894
+ values: t.props.values,
895
+ state: t.props.state
896
+ }] : [])
897
+ })),
898
+ figures: n.filter((e) => e.id !== Z).map((e) => e.id),
899
+ footnotes: t.flatMap(({ element: e, place: t }) => e.type === _e && D(e) ? [{
900
+ id: e.props.id,
901
+ beat: t.beat,
902
+ content: e.props.children
903
+ }] : []),
904
+ references: i,
905
+ playbacks: t.flatMap(({ element: e, place: t }) => e.type === c ? [{
906
+ name: X(e, "name") ?? "",
907
+ beat: t.beat
908
+ }] : []),
909
+ transports: t.flatMap(({ element: e }) => e.type === u ? X(e, "for") ?? [] : []),
910
+ predictions: t.flatMap(({ element: e, place: t }) => {
911
+ let n = e.type === Ie ? X(e, "id") : void 0, r = X(e, "answerFrom");
912
+ return n === void 0 ? [] : [{
913
+ id: n,
914
+ beat: t.beat,
915
+ ...r !== void 0 && { answerFrom: r }
916
+ }];
917
+ }),
918
+ challenges: t.flatMap(({ element: e, place: t }) => {
919
+ let n = e.type === Ce ? X(e, "id") : void 0;
920
+ return n === void 0 ? [] : [{
921
+ id: n,
922
+ beat: t.beat
923
+ }];
924
+ })
925
+ };
926
+ }
927
+ function Ye(e) {
928
+ return Object.fromEntries(e.predictions.flatMap((e) => e.answerFrom === void 0 ? [] : [[e.id, e.answerFrom]]));
929
+ }
930
+ // packages/teaching/src/article/progress-store.ts
931
+ var Xe = {
932
+ predictions: {},
933
+ reached: [],
934
+ hints: {},
935
+ visited: []
936
+ }, Ze = "n:", Qe = "s:", $e = "p.", et = "h.";
937
+ function tt(e) {
938
+ return typeof e == "number" ? `${Ze}${e}` : `${Qe}${e}`;
939
+ }
940
+ function nt(e) {
941
+ if (e?.startsWith(Qe) === !0) return e.slice(2);
942
+ let t = e?.startsWith(Ze) === !0 ? Number(e.slice(2)) : NaN;
943
+ return Number.isFinite(t) ? t : void 0;
944
+ }
945
+ function rt(e) {
946
+ return new URLSearchParams([
947
+ ...Object.entries(e.predictions).flatMap(([e, t]) => [
948
+ [`p.${e}.v`, tt(t.value)],
949
+ [`p.${e}.a`, tt(t.answer)],
950
+ [`p.${e}.c`, String(t.isCorrect)]
951
+ ]),
952
+ ...e.reached.map((e) => ["r", e]),
953
+ ...Object.entries(e.hints).map(([e, t]) => [`h.${e}`, String(t)]),
954
+ ...e.visited.map((e) => ["v", e])
955
+ ]).toString();
956
+ }
957
+ function it(e) {
958
+ let t = new URLSearchParams(e), n = [...t.keys()], r = [...new Set(n.filter((e) => e.startsWith($e)).map((e) => e.slice(2, e.lastIndexOf("."))))].flatMap((e) => {
959
+ let n = nt(t.get(`p.${e}.v`)), r = nt(t.get(`p.${e}.a`));
960
+ return n === void 0 || r === void 0 ? [] : [[e, {
961
+ value: n,
962
+ answer: r,
963
+ isCorrect: t.get(`p.${e}.c`) === "true"
964
+ }]];
965
+ }), i = n.flatMap((e) => {
966
+ let n = Number(t.get(e));
967
+ return e.startsWith(et) && Number.isInteger(n) && n > 0 ? [[e.slice(2), n]] : [];
968
+ });
969
+ return {
970
+ predictions: Object.fromEntries(r),
971
+ reached: [...new Set(t.getAll("r"))],
972
+ hints: Object.fromEntries(i),
973
+ visited: [...new Set(t.getAll("v"))]
974
+ };
975
+ }
976
+ function at(e, t) {
977
+ return {
978
+ predictions: {
979
+ ...t.predictions,
980
+ ...e.predictions
981
+ },
982
+ reached: [.../* @__PURE__ */ new Set([...t.reached, ...e.reached])],
983
+ hints: {
984
+ ...t.hints,
985
+ ...e.hints
986
+ },
987
+ visited: [.../* @__PURE__ */ new Set([...t.visited, ...e.visited])]
988
+ };
989
+ }
990
+ function ot(e) {
991
+ return {
992
+ reason: e.reason,
993
+ ...e.event !== void 0 && { event: e.event },
994
+ ...e.source !== void 0 && { source: e.source }
995
+ };
996
+ }
997
+ var st = oe({
998
+ name: "lesson-progress",
999
+ options: {
1000
+ progress: "value",
1001
+ defaultProgress: "value",
1002
+ onProgressChange: "callback",
1003
+ storageKey: "string"
1004
+ },
1005
+ controlled: ["progress"],
1006
+ state: (e) => ({ progress: e.progress ?? e.defaultProgress ?? Xe }),
1007
+ sync: (e) => e.progress === void 0 ? {} : { progress: e.progress },
1008
+ api: (e) => {
1009
+ let t = ie(e);
1010
+ function n() {
1011
+ return e.store.get().progress;
1012
+ }
1013
+ function r(e, n) {
1014
+ return t("progress", e, ot(n));
1015
+ }
1016
+ return {
1017
+ commit(e, t, i) {
1018
+ let { predictions: a } = n();
1019
+ return e in a ? !1 : r({
1020
+ ...n(),
1021
+ predictions: {
1022
+ ...a,
1023
+ [e]: t
1024
+ }
1025
+ }, i);
1026
+ },
1027
+ reach(e, t) {
1028
+ let { reached: i } = n();
1029
+ return !i.includes(e) && r({
1030
+ ...n(),
1031
+ reached: [...i, e]
1032
+ }, t);
1033
+ },
1034
+ showHint(e, t) {
1035
+ let { hints: i } = n();
1036
+ return r({
1037
+ ...n(),
1038
+ hints: {
1039
+ ...i,
1040
+ [e]: (i[e] ?? 0) + 1
1041
+ }
1042
+ }, t);
1043
+ },
1044
+ visit(e, t) {
1045
+ let { visited: i } = n();
1046
+ return !i.includes(e) && r({
1047
+ ...n(),
1048
+ visited: [...i, e]
1049
+ }, t);
1050
+ },
1051
+ reset(e) {
1052
+ return r(Xe, e ?? { reason: "reset" });
1053
+ },
1054
+ connect() {
1055
+ let { storageKey: t } = e.options();
1056
+ if (t === void 0) return () => void 0;
1057
+ let i = ae(t), a = it(i.get() ?? "");
1058
+ return rt(a) !== "" && r(at(n(), a), { reason: "restore" }), e.store.subscribe(() => {
1059
+ i.set(rt(n()));
1060
+ });
1061
+ }
1062
+ };
1063
+ },
1064
+ slots: (e) => ({ root: e({ bind: (e, t) => t.api.connect() }) }),
1065
+ agent: { actions: [] }
1066
+ });
1067
+ function ct(e, t) {
1068
+ let { onProgressChange: n } = e, r = te(st, {
1069
+ ...e,
1070
+ onProgressChange: (e, t) => {
1071
+ t.source === "agent" ? t.cancel() : n?.(e, t);
1072
+ }
1073
+ });
1074
+ return re(r.instance.subscribe, r.instance.get, r.instance.get), ee(r, "root", {}, t(r.state.progress, r.api), "article");
1075
+ }
1076
+ // packages/teaching/src/article/view-essay.tsx
1077
+ var lt = "-33% 0px -62% 0px";
1078
+ function ut({ beats: e, current: t, isCompact: n, onPick: r }) {
1079
+ return /* @__PURE__ */ F("ol", {
1080
+ ...{
1081
+ 0: { className: "xrvj5dj xfko13i x1ghz6dp x1717udv x3ct3a4" },
1082
+ 1: { className: "xrvj5dj xfko13i x1ghz6dp x1717udv x3ct3a4 x3bg4vu" }
1083
+ }[!!n | 0],
1084
+ children: e.map((e) => /* @__PURE__ */ F("li", { children: /* @__PURE__ */ F("a", {
1085
+ href: `#${encodeURIComponent(e.id)}`,
1086
+ "aria-current": e.id === t ? "location" : void 0,
1087
+ onClick: r,
1088
+ ...{
1089
+ 0: { className: "x1lliihq x1hmw7ec x1umj4g3 xyumdvf x1t7ytsu x97x49r x153jb6y xtqrqnz x1778rvt xkrqix3 xza0erv xp9636p x13qnu6 x9v5kkp x19rmrnh" },
1090
+ 1: { className: "x1lliihq x1hmw7ec x1umj4g3 xyumdvf x1t7ytsu xtqrqnz x1778rvt xkrqix3 xza0erv xp9636p x13qnu6 x9v5kkp x19rmrnh x1lm0jcf xbixft xk4h15q" }
1091
+ }[e.id === t | 0],
1092
+ children: e.title
1093
+ }) }, e.id))
1094
+ });
1095
+ }
1096
+ function dt({ article: e, header: t, children: n }) {
1097
+ let { beat: r, goTo: i } = a(), o = j(null), s = j(null), c = j({
1098
+ beat: r,
1099
+ goTo: i,
1100
+ scrolled: r
1101
+ }), l = e.outline.beats.flatMap((t) => {
1102
+ let n = U(e.lesson, t.id);
1103
+ return n === void 0 ? [] : [{
1104
+ id: n.id,
1105
+ title: n.title
1106
+ }];
1107
+ }), u = l.find((e) => e.id === r)?.title ?? l[0]?.title ?? "";
1108
+ return k(() => {
1109
+ c.current.beat = r, c.current.goTo = i;
1110
+ let e = o.current;
1111
+ r !== null && r !== c.current.scrolled && e !== null && (c.current.scrolled = r, e.querySelector(`[data-beat="${CSS.escape(r)}"]`)?.scrollIntoView({ block: "start" }));
1112
+ }), k(() => {
1113
+ let t = o.current;
1114
+ if (t === null) return;
1115
+ let n = new Set(e.lesson.beats.map((e) => e.id)), r = new IntersectionObserver((e) => {
1116
+ let t = e.find((e) => e.isIntersecting)?.target, r = t instanceof HTMLElement ? t.dataset.beat : void 0;
1117
+ r !== void 0 && n.has(r) && (c.current.scrolled = r, r !== c.current.beat && c.current.goTo(r, 0, { reason: "scroll" }));
1118
+ }, { rootMargin: lt });
1119
+ for (let e of t.querySelectorAll("[data-beat]")) r.observe(e);
1120
+ return () => r.disconnect();
1121
+ }, [e.lesson]), /* @__PURE__ */ I("div", {
1122
+ ref: o,
1123
+ className: "xrvj5dj x1mkdm3x x1xlo7gb xpoj3vq x7a106z",
1124
+ children: [/* @__PURE__ */ I("nav", {
1125
+ "aria-label": e.labels.contents,
1126
+ className: "x1s85apg x1mbwsne x7wzq59 x1leig9i xe0zcna",
1127
+ children: [/* @__PURE__ */ F("p", {
1128
+ className: "x1ghz6dp x1jfksii x153jb6y xy8obcc xas2l8k x1b5ytql",
1129
+ children: e.labels.contents
1130
+ }), /* @__PURE__ */ F(ut, {
1131
+ beats: l,
1132
+ current: r,
1133
+ isCompact: !1
1134
+ })]
1135
+ }), /* @__PURE__ */ I("div", {
1136
+ className: "xeuugli",
1137
+ children: [
1138
+ t,
1139
+ /* @__PURE__ */ I("details", {
1140
+ ref: s,
1141
+ className: "x1lliihq xwuzx6 x7wzq59 x13vifvy xhtitgo xm8yyvp xn9t2bk xso031l x1q0q8m5 x1qndepd xpvm0e4",
1142
+ children: [/* @__PURE__ */ I("summary", {
1143
+ className: "x78zum5 x1hnptsi x1pha0wt x1ypdohk xbixft xtqrqnz x1778rvt x1ok0vyi x13qnu6 x9v5kkp x19rmrnh",
1144
+ children: [/* @__PURE__ */ F("span", {
1145
+ className: "x153jb6y x2lah0s",
1146
+ children: e.labels.contents
1147
+ }), /* @__PURE__ */ F("span", {
1148
+ className: "xb3r6kr xlyipyv xuxw1ft xk4h15q",
1149
+ children: u
1150
+ })]
1151
+ }), /* @__PURE__ */ F("nav", {
1152
+ "aria-label": e.labels.contents,
1153
+ children: /* @__PURE__ */ F(ut, {
1154
+ beats: l,
1155
+ current: r,
1156
+ isCompact: !0,
1157
+ onPick: () => {
1158
+ s.current !== null && (s.current.open = !1);
1159
+ }
1160
+ })
1161
+ })]
1162
+ }),
1163
+ n,
1164
+ /* @__PURE__ */ F(H, {})
1165
+ ]
1166
+ })]
1167
+ });
1168
+ }
1169
+ // packages/teaching/src/article/view-present.tsx
1170
+ var ft = "input, textarea, select, [contenteditable=\"true\"], [role=\"slider\"], [role=\"radio\"], [role=\"radiogroup\"], [role=\"tab\"], [role=\"combobox\"], [role=\"spinbutton\"], [role=\"listbox\"], [role=\"menu\"], [role=\"grid\"], [role=\"application\"]", pt = `${ft}, button, a, summary, [role="button"], [role="checkbox"], [role="switch"], [role="link"]`;
1171
+ function mt(e, t) {
1172
+ return e instanceof Element && e.closest(t) !== null;
1173
+ }
1174
+ function ht({ article: e, children: t }) {
1175
+ let { beat: n, step: r, next: i, previous: o, lesson: s } = a(), c = j(null), l = j({
1176
+ next: i,
1177
+ previous: o
1178
+ }), u = j(n), d = s.beats, f = d.findIndex((e) => e.id === n), p = U(s, n ?? ""), m = e.outline.beats.find((e) => e.id === n)?.scrollySteps.length ?? 0, h = (p?.steps ?? 0) + Math.max(0, m - 1), g = f <= 0 && r === 0, v = f === d.length - 1 && r >= h, { labels: y } = e, b = `${y.beat} ${f + 1} ${y.of} ${d.length}`, x = h > 0 ? `, ${y.step} ${r + 1} ${y.of} ${h + 1}` : "";
1179
+ return k(() => {
1180
+ l.current = {
1181
+ next: i,
1182
+ previous: o
1183
+ };
1184
+ }), k(() => {
1185
+ u.current !== n && (u.current = n, c.current?.scrollIntoView({ block: "start" }));
1186
+ }, [n]), k(() => {
1187
+ function e(e) {
1188
+ let t = N(e, "ArrowRight"), n = N(e, "Space"), r = N(e, "ArrowLeft"), i = n ? pt : ft;
1189
+ !t && !n && !r || e.defaultPrevented || mt(e.target, i) || (e.preventDefault(), r ? l.current.previous({
1190
+ reason: "shortcut",
1191
+ event: e
1192
+ }) : l.current.next({
1193
+ reason: "shortcut",
1194
+ event: e
1195
+ }));
1196
+ }
1197
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
1198
+ }, []), /* @__PURE__ */ F(P, { children: /* @__PURE__ */ I("div", {
1199
+ ref: c,
1200
+ className: "xrvj5dj xxq7klm x1ov3xa9 xdiyxhk",
1201
+ children: [
1202
+ /* @__PURE__ */ I("div", {
1203
+ className: "x78zum5 x1a02dak x1qughib x1hnptsi x1qokhjc xso031l x1q0q8m5 x1qndepd x153jb6y xtqrqnz x1778rvt",
1204
+ children: [/* @__PURE__ */ F("p", {
1205
+ className: "x1ghz6dp xbixft xk4h15q",
1206
+ children: e.title
1207
+ }), /* @__PURE__ */ F("p", {
1208
+ "aria-live": "polite",
1209
+ className: "x1ghz6dp xss6m8b",
1210
+ children: `${b}${x}`
1211
+ })]
1212
+ }),
1213
+ /* @__PURE__ */ F("div", {
1214
+ className: "xeuugli xmblgzg",
1215
+ children: t
1216
+ }),
1217
+ /* @__PURE__ */ I("div", {
1218
+ className: "xrvj5dj x1n8ia3y x7wzq59 x1ey2m1c x1qokhjc xpvm0e4",
1219
+ children: [/* @__PURE__ */ F("div", {
1220
+ "aria-hidden": !0,
1221
+ className: "x78zum5 xfko13i xeuugli",
1222
+ children: d.map((e, t) => /* @__PURE__ */ F("span", { ...{
1223
+ 0: { className: "x1iyjqo2 x1r8uery x8qmimb x1fxuffc x1fa40ue" },
1224
+ 1: { className: "x1iyjqo2 x1r8uery x8qmimb x1fxuffc x1pt885t" }
1225
+ }[t <= f | 0] }, e.id))
1226
+ }), /* @__PURE__ */ I("div", {
1227
+ className: "x78zum5 x1qughib x6s0dn4 x1n8ia3y",
1228
+ children: [
1229
+ /* @__PURE__ */ F(_, {
1230
+ density: "compact",
1231
+ disabled: g,
1232
+ focusableWhenDisabled: !0,
1233
+ onClick: (e) => o({
1234
+ reason: "press",
1235
+ event: e.nativeEvent
1236
+ }),
1237
+ children: y.previous
1238
+ }),
1239
+ /* @__PURE__ */ F("span", {
1240
+ "aria-hidden": !0,
1241
+ className: "x12ldcl5 xy8obcc x2b8uid",
1242
+ children: "← →"
1243
+ }),
1244
+ /* @__PURE__ */ F(_, {
1245
+ density: "compact",
1246
+ variant: "solid",
1247
+ disabled: v,
1248
+ focusableWhenDisabled: !0,
1249
+ onClick: (e) => i({
1250
+ reason: "press",
1251
+ event: e.nativeEvent
1252
+ }),
1253
+ children: y.next
1254
+ })
1255
+ ]
1256
+ })]
1257
+ })
1258
+ ]
1259
+ }) });
1260
+ }
1261
+ // packages/teaching/src/article/article-checks.ts
1262
+ function gt(e, t) {
1263
+ let n = new Map(Object.entries(e.reads)), r = {
1264
+ found: /* @__PURE__ */ new Set([t]),
1265
+ size: 0
1266
+ };
1267
+ for (; r.found.size !== r.size;) r.size = r.found.size, r.found = /* @__PURE__ */ new Set([...r.found, ...[...r.found].flatMap((e) => n.get(e) ?? [])]);
1268
+ return r.found;
1269
+ }
1270
+ function _t(e, t) {
1271
+ let n = new Set(e.beats.map((e) => e.id)), r = new Set(t.beats.map((e) => e.id));
1272
+ return [
1273
+ ...e.beats.filter((e) => !r.has(e.id)).map((e) => ({
1274
+ beat: e.id,
1275
+ message: `The lesson declares beat "${e.id}", which the article does not render.`
1276
+ })),
1277
+ ...t.beats.filter((e) => !n.has(e.id)).map((e) => ({
1278
+ beat: e.id,
1279
+ message: `The article renders beat "${e.id}", which the lesson does not declare.`
1280
+ })),
1281
+ ...t.beats.filter((e) => e.figures.length === 0).map((e) => ({
1282
+ beat: e.id,
1283
+ message: `Beat "${e.id}" has no figure.`
1284
+ }))
1285
+ ];
1286
+ }
1287
+ function vt(e) {
1288
+ return e.beats.flatMap((e) => e.figures).filter((e) => !e.hasDescription).map((e) => ({
1289
+ beat: e.beat,
1290
+ message: `Figure "${e.id}" has no description.`
1291
+ }));
1292
+ }
1293
+ function yt(e) {
1294
+ return [
1295
+ ...e.beats.map((e) => ({
1296
+ id: e.id,
1297
+ part: `Beat "${e.id}"`
1298
+ })),
1299
+ ...e.figures.map((e) => ({
1300
+ id: e,
1301
+ part: `Figure "${e}"`
1302
+ })),
1303
+ ...e.footnotes.map((e) => ({
1304
+ id: `fn-${e.id}`,
1305
+ part: `Footnote "${e.id}"`
1306
+ })),
1307
+ ...e.references.map((e) => ({
1308
+ id: `ref-${e.id}`,
1309
+ part: `Reference "${e.id}"`
1310
+ }))
1311
+ ];
1312
+ }
1313
+ function bt(e) {
1314
+ return [...Map.groupBy(yt(e), (e) => e.id)].flatMap(([e, t]) => t.length === 1 ? [] : [{
1315
+ beat: null,
1316
+ message: `${t.map((e) => e.part).join(" and ")} share the element id "${e}". Rename one.`
1317
+ }]);
1318
+ }
1319
+ function xt(e, t) {
1320
+ let n = new Set(t.transports), r = t.playbacks.filter((e) => !n.has(e.name)).map((e) => ({
1321
+ beat: e.beat,
1322
+ message: `Playback "${e.name}" has no Transport, so the reader cannot start it.`
1323
+ })), i = t.beats.flatMap((t) => {
1324
+ let n = new Set(t.figureNames.flatMap((t) => [...gt(e, t)]));
1325
+ return t.proseParams.filter((e) => !n.has(e)).map((e) => ({
1326
+ beat: t.id,
1327
+ message: `Param "${e}" in the prose of beat "${t.id}" changes no figure of that beat. Name it in a figure's reads.`
1328
+ }));
1329
+ });
1330
+ return [...r, ...i];
1331
+ }
1332
+ function St(e) {
1333
+ return [...e.predictions.filter((e) => e.beat === null).map((e) => ({
1334
+ beat: null,
1335
+ message: `Predict "${e.id}" sits outside every Beat.`
1336
+ })), ...e.challenges.filter((e) => e.beat === null).map((e) => ({
1337
+ beat: null,
1338
+ message: `Challenge "${e.id}" sits outside every Beat.`
1339
+ }))];
1340
+ }
1341
+ function Ct(e, t) {
1342
+ return [
1343
+ ..._t(e, t),
1344
+ ...vt(t),
1345
+ ...xt(e, t),
1346
+ ...St(t),
1347
+ ...bt(t)
1348
+ ];
1349
+ }
1350
+ // packages/teaching/src/article/view-sheet.tsx
1351
+ var wt = {
1352
+ k3aq6I: "xsqj5wx",
1353
+ $$css: !0
1354
+ }, Q = {
1355
+ frame: {
1356
+ k7Eaqz: "xeuugli",
1357
+ kVQacm: "xb3r6kr",
1358
+ $$css: !0
1359
+ },
1360
+ design: {
1361
+ k3nNDw: "x1hj3fc7",
1362
+ $$css: !0
1363
+ },
1364
+ text: {
1365
+ kzqmXN: "x15rcoqf",
1366
+ $$css: !0
1367
+ },
1368
+ wide: {
1369
+ kzqmXN: "x2foucm",
1370
+ $$css: !0
1371
+ },
1372
+ scaled: (e) => [wt, { "--x-transform": `scale(${e})` == null ? void 0 : `scale(${e})` }],
1373
+ widened: (e) => [{
1374
+ kzqmXN: e == null ? e : "x5lhr3w",
1375
+ $$css: !0
1376
+ }, { "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }],
1377
+ reserved: (e) => [{
1378
+ kZKoxP: e == null ? e : "x16ye13r",
1379
+ $$css: !0
1380
+ }, { "--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }]
1381
+ }, Tt = /* @__PURE__ */ new Set(["auto", "scroll"]);
1382
+ function Et(e) {
1383
+ let t = [...e.querySelectorAll("*")].filter((e) => Tt.has(getComputedStyle(e).overflowX)).map((e) => e.scrollWidth - e.clientWidth);
1384
+ return Math.max(0, ...t);
1385
+ }
1386
+ function Dt({ frame: e, design: t, fit: n }) {
1387
+ let r = Et(t), i = t.offsetWidth + r, a = Math.min(1, e.clientWidth / i);
1388
+ return {
1389
+ scale: a,
1390
+ height: t.offsetHeight * a,
1391
+ width: r > 0 ? i : n.width
1392
+ };
1393
+ }
1394
+ function Ot({ size: e, children: t }) {
1395
+ let n = j(null), r = j(null), [i, a] = M({
1396
+ scale: 1,
1397
+ height: void 0,
1398
+ width: void 0
1399
+ });
1400
+ return ne(() => {
1401
+ let e = n.current, t = r.current;
1402
+ if (e === null || t === null) return;
1403
+ let i = new ResizeObserver(() => a((n) => Dt({
1404
+ frame: e,
1405
+ design: t,
1406
+ fit: n
1407
+ }))), o = new AbortController();
1408
+ return i.observe(e), i.observe(t), globalThis.matchMedia("print").addEventListener("change", () => a((n) => Dt({
1409
+ frame: e,
1410
+ design: t,
1411
+ fit: n
1412
+ })), { signal: o.signal }), () => {
1413
+ i.disconnect(), o.abort();
1414
+ };
1415
+ }, []), /* @__PURE__ */ F("div", {
1416
+ ref: n,
1417
+ ...T.props(Q.frame, i.height !== void 0 && Q.reserved(i.height)),
1418
+ children: /* @__PURE__ */ F("div", {
1419
+ ref: r,
1420
+ ...T.props(Q.design, i.width === void 0 ? Q[e] : Q.widened(i.width), Q.scaled(i.scale)),
1421
+ children: t
1422
+ })
1423
+ });
1424
+ }
1425
+ function kt({ beat: e, article: t }) {
1426
+ let n = U(t.lesson, e.id), { labels: r } = t, i = [
1427
+ {
1428
+ term: r.goal,
1429
+ value: n?.goal
1430
+ },
1431
+ {
1432
+ term: r.misconception,
1433
+ value: n?.misconception
1434
+ },
1435
+ {
1436
+ term: r.tutorHints,
1437
+ value: n?.hints?.join(" · ")
1438
+ },
1439
+ {
1440
+ term: r.steps,
1441
+ value: String(n?.steps ?? 0)
1442
+ }
1443
+ ].flatMap((e) => e.value === void 0 || e.value === "" ? [] : [{
1444
+ term: e.term,
1445
+ value: e.value
1446
+ }]);
1447
+ return /* @__PURE__ */ F("dl", {
1448
+ className: "xrvj5dj x16lqc3j x8zbtdt x1gkm1c7 x1ghz6dp xtqrqnz x1778rvt",
1449
+ children: i.map((e) => /* @__PURE__ */ I("div", {
1450
+ className: "xjp7ctv",
1451
+ children: [/* @__PURE__ */ F("dt", {
1452
+ className: "x153jb6y",
1453
+ children: e.term
1454
+ }), /* @__PURE__ */ F("dd", {
1455
+ className: "x1ghz6dp",
1456
+ children: e.value
1457
+ })]
1458
+ }, e.term))
1459
+ });
1460
+ }
1461
+ function At({ article: e }) {
1462
+ let t = Ct(e.lesson, e.outline), { labels: n } = e;
1463
+ return /* @__PURE__ */ I("div", {
1464
+ className: "xrvj5dj x1m6b44x xeuugli xbixft x1hz01jw",
1465
+ children: [
1466
+ /* @__PURE__ */ F("div", { children: /* @__PURE__ */ F("h1", {
1467
+ className: "x1ghz6dp x71lla1 xgkpprq x1b5ytql x1wjjqco",
1468
+ children: `${n.sheet}: ${e.title}`
1469
+ }) }),
1470
+ e.outline.beats.map((t) => {
1471
+ let r = U(e.lesson, t.id), i = {
1472
+ id: "opening",
1473
+ label: n.opening,
1474
+ values: {}
1475
+ }, a = r?.states === void 0 || r.states.length === 0 ? [i] : r.states;
1476
+ return /* @__PURE__ */ I("section", {
1477
+ "aria-label": r?.title ?? t.id,
1478
+ className: "xrvj5dj x1n8ia3y xmblgzg x178xt8z x13fuv20 xhjagg4",
1479
+ children: [
1480
+ /* @__PURE__ */ I("h2", {
1481
+ className: "x1ghz6dp x1i2cqwi x4fansv x1b5ytql",
1482
+ children: [
1483
+ r?.title ?? t.id,
1484
+ " ",
1485
+ /* @__PURE__ */ F("span", {
1486
+ className: "xiard35 xy8obcc x153jb6y xj57cvi",
1487
+ children: t.id
1488
+ })
1489
+ ]
1490
+ }),
1491
+ /* @__PURE__ */ F(kt, {
1492
+ beat: t,
1493
+ article: e
1494
+ }),
1495
+ /* @__PURE__ */ F("div", {
1496
+ className: "xrvj5dj x7te2vt xaml1ju",
1497
+ children: a.map((n) => /* @__PURE__ */ I("div", {
1498
+ className: "xrvj5dj x10ukxgv x1hnptsi xeuugli x1mvvolr xmkeg23 x1y0btm7 x1ey3b81 xy32g2j",
1499
+ children: [/* @__PURE__ */ F("p", {
1500
+ className: "x1ghz6dp xy8obcc xas2l8k x153jb6y",
1501
+ children: n.label
1502
+ }), /* @__PURE__ */ F(s, {
1503
+ lesson: e.lesson,
1504
+ locale: e.locale,
1505
+ values: n.values,
1506
+ isReadOnly: !0,
1507
+ children: /* @__PURE__ */ F("div", {
1508
+ className: "xrvj5dj x1j825kq xeuugli",
1509
+ children: t.figures.map((e) => /* @__PURE__ */ F(Ot, {
1510
+ size: e.size,
1511
+ children: e.node
1512
+ }, e.id))
1513
+ })
1514
+ })]
1515
+ }, n.id))
1516
+ })
1517
+ ]
1518
+ }, t.id);
1519
+ }),
1520
+ /* @__PURE__ */ I("section", {
1521
+ "aria-label": n.checks,
1522
+ className: "xrvj5dj x1n8ia3y xmblgzg x178xt8z x13fuv20 xhjagg4",
1523
+ children: [/* @__PURE__ */ F("h2", {
1524
+ className: "x1ghz6dp x1i2cqwi x4fansv x1b5ytql",
1525
+ children: n.checks
1526
+ }), t.length === 0 ? /* @__PURE__ */ F("p", {
1527
+ className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
1528
+ children: n.noProblems
1529
+ }) : /* @__PURE__ */ F("ul", {
1530
+ className: "xrvj5dj xunmzkg x1ghz6dp x1sbza1b x12myhf4",
1531
+ children: t.map((e) => /* @__PURE__ */ F("li", {
1532
+ className: "x1f9ixgr",
1533
+ children: e.message
1534
+ }, e.message))
1535
+ })]
1536
+ })
1537
+ ]
1538
+ });
1539
+ }
1540
+ // packages/teaching/src/article/view-static.tsx
1541
+ function jt({ article: e, header: t, children: n }) {
1542
+ let r = e.outline.beats.flatMap((t) => U(e.lesson, t.id) ?? []);
1543
+ return /* @__PURE__ */ I("div", {
1544
+ className: "xeuugli",
1545
+ children: [
1546
+ t,
1547
+ /* @__PURE__ */ I("nav", {
1548
+ "aria-label": e.labels.contents,
1549
+ className: "x1b5qhtu xtru72a x153jb6y xtqrqnz x1778rvt",
1550
+ children: [/* @__PURE__ */ F("p", {
1551
+ className: "x1ghz6dp xbixft x1b5ytql",
1552
+ children: e.labels.contents
1553
+ }), /* @__PURE__ */ F("ol", {
1554
+ className: "x1ghz6dp x1sbza1b",
1555
+ children: r.map((e) => /* @__PURE__ */ F("li", { children: /* @__PURE__ */ F("a", {
1556
+ href: `#${encodeURIComponent(e.id)}`,
1557
+ children: e.title
1558
+ }) }, e.id))
1559
+ })]
1560
+ }),
1561
+ n,
1562
+ /* @__PURE__ */ F(H, {})
1563
+ ]
1564
+ });
1565
+ }
1566
+ // packages/teaching/src/article/article.tsx
1567
+ var Mt = /* @__PURE__ */ new Set(["article", "present"]), Nt = {
1568
+ article: dt,
1569
+ present: ht,
1570
+ static: jt,
1571
+ sheet: At
1572
+ };
1573
+ function Pt() {
1574
+ let e = { pending: null };
1575
+ return {
1576
+ wait: (t) => {
1577
+ e.pending = t;
1578
+ },
1579
+ pending: () => e.pending,
1580
+ clear: () => {
1581
+ e.pending = null;
1582
+ }
1583
+ };
1584
+ }
1585
+ var Ft = /* @__PURE__ */ new Map([
1586
+ ["press", "press"],
1587
+ ["link-press", "press"],
1588
+ ["scroll", "scroll"],
1589
+ ["shortcut", "shortcut"]
1590
+ ]);
1591
+ function It(e) {
1592
+ return {
1593
+ reason: Ft.get(e.reason) ?? "imperative",
1594
+ event: e.event,
1595
+ source: e.source
1596
+ };
1597
+ }
1598
+ function Lt({ challenges: e, progressApi: t, isReading: n, moves: r, outline: i, opening: o }) {
1599
+ let { values: s, beat: c, step: l, lesson: u, show: d, setMany: f } = a(), p = j(c), m = i.beats.find((e) => e.id === c), h = fe({
1600
+ beat: m,
1601
+ step: l,
1602
+ view: "present"
1603
+ }), g = j({
1604
+ beat: c,
1605
+ scrolly: h.scrolly
1606
+ });
1607
+ return k(() => {
1608
+ e.remember(s);
1609
+ }), k(() => {
1610
+ n && p.current !== null && t.visit(p.current, { reason: "visit" });
1611
+ }, [n, t]), k(() => {
1612
+ let e = r.pending();
1613
+ if (e === null) return;
1614
+ let t = g.current.beat !== c, n = h.scrolly === null ? void 0 : m?.scrollySteps[h.scrolly], i = n !== void 0 && (t || g.current.scrolly !== h.scrolly), a = u.beats.find((e) => e.id === c)?.states?.[0];
1615
+ if (g.current = {
1616
+ beat: c,
1617
+ scrolly: h.scrolly
1618
+ }, i) {
1619
+ let t = n.state === void 0 ? n.values : Re(u, n.state);
1620
+ f({
1621
+ ...o,
1622
+ ...a?.values,
1623
+ ...t
1624
+ }, e);
1625
+ } else t && a !== void 0 && d(a.id, e);
1626
+ r.clear();
1627
+ }, [
1628
+ c,
1629
+ u,
1630
+ r,
1631
+ o,
1632
+ m,
1633
+ h.scrolly,
1634
+ f,
1635
+ d
1636
+ ]), null;
1637
+ }
1638
+ function Rt(e, t) {
1639
+ return new Intl.DateTimeFormat(t, {
1640
+ dateStyle: "long",
1641
+ timeZone: "UTC"
1642
+ }).format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`));
1643
+ }
1644
+ function zt({ lesson: e, locale: n, title: i, authors: a = [], date: o, summary: c, tones: l = {}, view: u = "article", math: d, storageKey: f, progress: p, defaultProgress: m, onProgressChange: h, labels: g, lessonProps: _, children: v }) {
1645
+ let y = A(), [b] = M(Pt), x = Je(v), S = u === "present", [C] = M(() => ue(e.initial)), w = {
1646
+ ...de,
1647
+ ...g
1648
+ }, T = [a.length > 0 ? `${w.by} ${a.join(", ")}` : "", o === void 0 ? "" : Rt(o, n)].filter((e) => e !== "").join(" · "), ee = /* @__PURE__ */ I("header", {
1649
+ className: "xrvj5dj x1n8ia3y x1b5qhtu x123szhz xhlx3wy xso031l x1q0q8m5 x1qndepd",
1650
+ children: [
1651
+ /* @__PURE__ */ F("h1", {
1652
+ id: y,
1653
+ className: "x1ghz6dp x71lla1 x1qqoz9m xgkpprq xdpi0mq x1b5ytql x1wjjqco x1w2vvpw",
1654
+ children: i
1655
+ }),
1656
+ c === void 0 ? null : /* @__PURE__ */ F("p", {
1657
+ className: "x1ghz6dp x153jb6y x1i2cqwi x1ytb0s6",
1658
+ children: c
1659
+ }),
1660
+ T === "" ? null : /* @__PURE__ */ F("p", {
1661
+ className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
1662
+ children: T
1663
+ })
1664
+ ]
1665
+ }), te = Nt[u];
1666
+ return ct({
1667
+ progress: p,
1668
+ defaultProgress: m,
1669
+ onProgressChange: h,
1670
+ storageKey: f === void 0 ? void 0 : `${f}.progress`
1671
+ }, (a, o) => {
1672
+ let c = {
1673
+ view: u,
1674
+ title: i,
1675
+ lesson: e,
1676
+ locale: n,
1677
+ labels: w,
1678
+ math: d,
1679
+ outline: x,
1680
+ progress: a,
1681
+ progressApi: o,
1682
+ challenges: C
1683
+ };
1684
+ return {
1685
+ "aria-labelledby": u === "sheet" ? void 0 : y,
1686
+ "aria-label": u === "sheet" ? i : void 0,
1687
+ children: /* @__PURE__ */ F(s, {
1688
+ ..._,
1689
+ lesson: e,
1690
+ locale: n,
1691
+ storageKey: f,
1692
+ onValuesChange: (t, n) => {
1693
+ _?.onValuesChange?.(t, n);
1694
+ let r = b.pending() !== null, i = n.source !== "agent" && n.reason !== "restore";
1695
+ if (n.canceled || !i || r) return;
1696
+ let a = C.seen(), s = {
1697
+ ...t,
1698
+ ...e.compute(t)
1699
+ };
1700
+ for (let [e, t] of C.entries()) !t(a) && t(s) && o.reach(e, {
1701
+ reason: "reach",
1702
+ event: n.event
1703
+ });
1704
+ },
1705
+ onBeatChange: (e, t) => {
1706
+ _?.onBeatChange?.(e, t), t.canceled || e === null || (o.visit(e, {
1707
+ reason: "visit",
1708
+ event: t.event,
1709
+ source: t.source
1710
+ }), S && t.reason !== "restore" && b.wait(It(t)));
1711
+ },
1712
+ onStepChange: (e, t) => {
1713
+ _?.onStepChange?.(e, t), !t.canceled && S && t.reason !== "restore" && b.wait(It(t));
1714
+ },
1715
+ addedSteps: S ? pe(x) : void 0,
1716
+ children: /* @__PURE__ */ F(r, {
1717
+ ids: Object.keys(l),
1718
+ tones: l,
1719
+ children: /* @__PURE__ */ F(t, { children: /* @__PURE__ */ I(ce, {
1720
+ value: c,
1721
+ children: [/* @__PURE__ */ F(Lt, {
1722
+ challenges: C,
1723
+ progressApi: o,
1724
+ isReading: Mt.has(u),
1725
+ moves: b,
1726
+ outline: x,
1727
+ opening: {
1728
+ ...e.defaults,
1729
+ ..._?.defaultValues
1730
+ }
1731
+ }), /* @__PURE__ */ F(te, {
1732
+ article: c,
1733
+ header: ee,
1734
+ children: v
1735
+ })]
1736
+ }) })
1737
+ })
1738
+ }),
1739
+ className: "x12h1iku xc29y5m x1lliihq xeuugli xbixft xpvm0e4 x1hz01jw"
1740
+ };
1741
+ });
1742
+ }
1743
+ // packages/teaching/src/article/tex.tsx
1744
+ function Bt({ children: e, isDisplay: t = !1 }) {
1745
+ let n = L()?.math;
1746
+ return /* @__PURE__ */ F("span", {
1747
+ role: "math",
1748
+ "aria-label": e,
1749
+ ...{
1750
+ 0: { className: "xuxw1ft" },
1751
+ 1: { className: "x1lliihq xhff0hu xw2csxc x10wlt62 x2b8uid xeaf4i8" }
1752
+ }[!!t | 0],
1753
+ children: /* @__PURE__ */ F("span", {
1754
+ "aria-hidden": !0,
1755
+ children: n === void 0 ? /* @__PURE__ */ F("code", {
1756
+ className: "xbixft xiard35 x1qlqyl8",
1757
+ children: e
1758
+ }) : n(e, { isDisplay: t })
1759
+ })
1760
+ });
1761
+ }
1762
+ // packages/teaching/src/article/linked-target.ts
1763
+ function Vt(t) {
1764
+ let n = e(), r = n?.inspected === t;
1765
+ function i(e, r) {
1766
+ n?.inspected === t && n.inspect(null, {
1767
+ reason: r,
1768
+ event: e
1769
+ });
1770
+ }
1771
+ function a(e) {
1772
+ n?.inspect(t, {
1773
+ reason: "item-press",
1774
+ event: e
1775
+ });
1776
+ }
1777
+ return {
1778
+ isInspected: r,
1779
+ handlers: {
1780
+ onPointerEnter: (e) => {
1781
+ e.pointerType === "mouse" && n?.inspect(t, {
1782
+ reason: "item-hover",
1783
+ event: e.nativeEvent
1784
+ });
1785
+ },
1786
+ onPointerLeave: (e) => {
1787
+ e.pointerType === "mouse" && i(e.nativeEvent, "item-hover");
1788
+ },
1789
+ onFocus: (e) => n?.inspect(t, {
1790
+ reason: "focus-in",
1791
+ event: e.nativeEvent
1792
+ }),
1793
+ onBlur: (e) => i(e.nativeEvent, "focus-out"),
1794
+ onClick: (e) => a(e.nativeEvent)
1795
+ },
1796
+ press: a
1797
+ };
1798
+ }
1799
+ // packages/teaching/src/article/term.tsx
1800
+ var Ht = { hint: "Highlights it in the figures." }, Ut = /* @__PURE__ */ new Set(["Enter", " "]), Wt = {
1801
+ k1xSpc: "xt0psk2",
1802
+ kogj98: "x1ghz6dp",
1803
+ kmVPX3: "x1717udv",
1804
+ kMzoRj: "xc342km",
1805
+ kaIpWk: "x1ok0vyi",
1806
+ kWkggS: "xjbqb8w",
1807
+ kMwMTN: "x1heor9g",
1808
+ kMv6JI: "xjb2p0i",
1809
+ kGuDYH: "x1qlqyl8",
1810
+ k63SB2: "x1pd3egz",
1811
+ kLWn49: "x15bjb6t",
1812
+ k9WMMc: "x16tdsg8",
1813
+ kkrTdU: "x1ypdohk",
1814
+ kMnn75: "xujl8zx",
1815
+ kmVMDM: "xi2nhp4",
1816
+ kNySMw: "xewurvo",
1817
+ kcSHmL: "x1jdncgf",
1818
+ kPJHz1: "x13qnu6",
1819
+ k7shQP: "x9v5kkp",
1820
+ kZs9gx: "x19rmrnh",
1821
+ kiEn40: "x7s97pk",
1822
+ $$css: !0
1823
+ }, Gt = {
1824
+ kmVMDM: "x6ur5ct",
1825
+ kWkggS: "xl8spv7",
1826
+ $$css: !0
1827
+ }, Kt = {
1828
+ kjVXCG: "x73je2i",
1829
+ kfJifR: "xhr4kjn",
1830
+ kDwRjp: "xbraz4a",
1831
+ kkrTdU: "x1ypdohk",
1832
+ k3XXqK: "x1t137rt",
1833
+ kGEFZS: "x1rvwdm5",
1834
+ kM8Kxi: "x17g5ih3",
1835
+ $$css: !0
1836
+ }, $ = {
1837
+ term: (e) => [
1838
+ Wt,
1839
+ {
1840
+ k1TLXF: e == null ? e : "xnv2ixb",
1841
+ $$css: !0
1842
+ },
1843
+ { "--x-textDecorationColor": e ?? void 0 }
1844
+ ],
1845
+ inspected: (e) => [Gt, { "--x-backgroundColor": `color-mix(in srgb, ${e} 16%, transparent)` == null ? void 0 : `color-mix(in srgb, ${e} 16%, transparent)` }],
1846
+ part: (e) => [
1847
+ Kt,
1848
+ {
1849
+ kMwMTN: e == null ? e : "x14rh7hd",
1850
+ $$css: !0
1851
+ },
1852
+ { "--x-color": e ?? void 0 }
1853
+ ],
1854
+ partInspected: {
1855
+ kfJifR: "xqjr0vm",
1856
+ kDwRjp: "x19cei4z",
1857
+ $$css: !0
1858
+ }
1859
+ };
1860
+ function qt(e, t) {
1861
+ let r = n(e);
1862
+ return r === void 0 ? t : w[r];
1863
+ }
1864
+ function Jt({ inspects: e, children: t, labels: n }) {
1865
+ let { isInspected: r, handlers: i } = Vt(e), a = qt(e, g.muted), o = A();
1866
+ return /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("button", {
1867
+ type: "button",
1868
+ "aria-describedby": o,
1869
+ ...i,
1870
+ ...T.props($.term(a), r && $.inspected(a)),
1871
+ children: t
1872
+ }), /* @__PURE__ */ F("span", {
1873
+ id: o,
1874
+ hidden: !0,
1875
+ children: {
1876
+ ...Ht,
1877
+ ...n
1878
+ }.hint
1879
+ })] });
1880
+ }
1881
+ function Yt({ inspects: e, label: t, children: n, labels: r }) {
1882
+ let { isInspected: i, handlers: a, press: o } = Vt(e), s = qt(e, g.muted), c = A();
1883
+ function l(e) {
1884
+ Ut.has(e.key) && (e.preventDefault(), o(e.nativeEvent));
1885
+ }
1886
+ return /* @__PURE__ */ I("g", {
1887
+ role: "button",
1888
+ tabIndex: 0,
1889
+ "aria-label": t,
1890
+ "aria-describedby": c,
1891
+ "data-inspected": i ? "" : void 0,
1892
+ ...a,
1893
+ onKeyDown: l,
1894
+ ...T.props($.part(s), i && $.partInspected),
1895
+ children: [/* @__PURE__ */ F("desc", {
1896
+ id: c,
1897
+ children: {
1898
+ ...Ht,
1899
+ ...r
1900
+ }.hint
1901
+ }), n]
1902
+ });
1903
+ }
1904
+ export { de as S, W as _, Ct as a, _e as b, Je as c, Ie as d, q as f, Ce as g, Ae as h, zt as i, He as l, je as m, Jt as n, Xe as o, ke as p, Bt as r, Ye as s, Yt as t, Be as u, me as v, be as x, ye as y };