@mechane-ai/elements 0.49.0 → 0.50.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 (102) hide show
  1. package/README.md +40 -2
  2. package/dist/{article-yyNPg6VU.js → article-CRlhq9oA.js} +531 -463
  3. package/dist/article.js +1 -1
  4. package/dist/catalog.json +37 -1
  5. package/dist/{categorical-values-DCznViFp.js → categorical-values-BYP_R5gS.js} +13 -13
  6. package/dist/charts/cartesian.js +1 -1
  7. package/dist/charts/comparison.js +1 -1
  8. package/dist/charts/distribution.js +1 -1
  9. package/dist/charts/figure.js +12 -12
  10. package/dist/charts/graph.js +1 -1
  11. package/dist/charts/hierarchy.js +1 -1
  12. package/dist/charts/image.js +1 -1
  13. package/dist/charts/matrix.js +1 -1
  14. package/dist/charts/plot.js +4 -4
  15. package/dist/charts/relationship.js +1 -1
  16. package/dist/charts/text.js +1 -1
  17. package/dist/charts/timeline.js +1 -1
  18. package/dist/charts/trend.js +1 -1
  19. package/dist/charts.js +7 -7
  20. package/dist/collections.js +1 -1
  21. package/dist/{dumbbell-plot-CMv9llfd.js → dumbbell-plot-BC8d_IJy.js} +45 -45
  22. package/dist/{embedding-map-DC-lgzCq.js → embedding-map-Bj8krO-d.js} +528 -528
  23. package/dist/figure-frame-koVKcXph.js +323 -0
  24. package/dist/{image-grid-DHqtj_zs.js → image-grid-CLhol2jy.js} +47 -47
  25. package/dist/kits/evaluation.js +50 -48
  26. package/dist/kits/interpretability.js +7 -7
  27. package/dist/kits/operations.js +4 -4
  28. package/dist/kits/research.js +346 -264
  29. package/dist/kits/training.js +3 -3
  30. package/dist/layout.js +1 -1075
  31. package/dist/lesson/spec.js +11 -11
  32. package/dist/lesson.js +4 -4
  33. package/dist/mdx.js +4 -4
  34. package/dist/packages/charts/src/chart-inspection.d.ts +4 -1
  35. package/dist/packages/charts/src/figure/caption-scope.d.ts +12 -0
  36. package/dist/packages/charts/src/figure/figure-frame.d.ts +2 -1
  37. package/dist/packages/charts/src/index.d.ts +2 -0
  38. package/dist/packages/collections/src/data-table-trigger.d.ts +2 -0
  39. package/dist/packages/kits/src/evaluation/leaderboard.d.ts +2 -0
  40. package/dist/packages/kits/src/research/collection-page.d.ts +46 -0
  41. package/dist/packages/kits/src/research/index.d.ts +2 -0
  42. package/dist/packages/kits/src/research/milestone-path.d.ts +1 -2
  43. package/dist/packages/kits/src/research/work-heartbeat.d.ts +4 -3
  44. package/dist/packages/layout/src/detail-page.d.ts +3 -1
  45. package/dist/packages/teaching/src/article/article-context.d.ts +2 -0
  46. package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +13 -0
  47. package/dist/packages/teaching/src/article/article.d.ts +6 -1
  48. package/dist/packages/teaching/src/article/figure.d.ts +20 -3
  49. package/dist/packages/teaching/src/article/index.d.ts +1 -1
  50. package/dist/packages/teaching/src/article/view-essay.d.ts +2 -1
  51. package/dist/packages/teaching/src/lesson/define-lesson.d.ts +4 -0
  52. package/dist/packages/teaching/src/lesson/index.d.ts +2 -2
  53. package/dist/packages/teaching/src/lesson/lesson-player.d.ts +19 -3
  54. package/dist/packages/teaching/src/lesson/lesson-store.d.ts +2 -0
  55. package/dist/packages/teaching/src/lesson/playback.d.ts +9 -6
  56. package/dist/packages/teaching/src/lesson/use-lesson.d.ts +7 -2
  57. package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +4 -1
  58. package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +5 -6
  59. package/dist/packages/teaching/src/scene/scene-geometry.d.ts +1 -1
  60. package/dist/packages/teaching/src/scene/scene-node.d.ts +4 -1
  61. package/dist/packages/teaching/src/scene/scene-validate.d.ts +6 -0
  62. package/dist/packages/teaching/src/scene/scene-wire.d.ts +6 -1
  63. package/dist/packages/teaching/src/scene/scene.d.ts +1 -1
  64. package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +5 -1
  65. package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +1 -1
  66. package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +1 -1
  67. package/dist/packages/teaching/src/time/tween.d.ts +2 -0
  68. package/dist/{param-BE3VMSkH.js → param-BdqTpZER.js} +166 -99
  69. package/dist/{plot-layout-Bqe4-0qZ.js → plot-layout-B2xRt-_k.js} +144 -130
  70. package/dist/{plot-surface-DON6WUmk.js → plot-surface-0cKFwtws.js} +1 -1
  71. package/dist/{reference-lines-hjuD1rRZ.js → reference-lines-nSxcZVF5.js} +1 -1
  72. package/dist/{scene-BP0Ue0R5.js → scene-4ePpWdmE.js} +1227 -1125
  73. package/dist/scene.js +1 -1
  74. package/dist/{slope-chart-C8eeSgL4.js → slope-chart-DWZIYDty.js} +179 -179
  75. package/dist/{src-B2rgpWap.js → src-DNclWY4V.js} +1 -1
  76. package/dist/src-DhWMspwr.js +1085 -0
  77. package/dist/styles2.css +77 -14
  78. package/dist/{time-series-BL933QyA.js → time-series-CsngFxr1.js} +952 -948
  79. package/dist/{token-heatmap-BB65awva.js → token-heatmap-BQLIxPky.js} +84 -84
  80. package/dist/{token-predictions-Pa8eUGan.js → token-predictions-C3B5L-eO.js} +126 -126
  81. package/dist/{transport-DzyxVXbL.js → transport-4V9rfYHN.js} +278 -233
  82. package/dist/{tree-diagram-DJhKBiia.js → tree-diagram-Dau9jeXS.js} +115 -115
  83. package/dist/{treemap-CxxgABUg.js → treemap-DWrMQndu.js} +27 -27
  84. package/dist/use-tween-BsaEO862.js +10 -0
  85. package/dist/{violin-plot-CoAEF_7Z.js → violin-plot-D05ODcyc.js} +123 -123
  86. package/dist/{waterfall-DdoEXEkT.js → waterfall-BkLLv2Lm.js} +39 -39
  87. package/package.json +1 -1
  88. package/recipes/counting-cards.tsx +3 -3
  89. package/skills/review-elements/SKILL.md +14 -0
  90. package/skills/review-explainer/SKILL.md +2 -1
  91. package/skills/upgrade-elements/references/releases.md +61 -0
  92. package/skills/use-elements/SKILL.md +21 -17
  93. package/skills/use-elements/references/editorial-restraint.md +40 -0
  94. package/skills/use-elements/references/styling.md +23 -0
  95. package/skills/use-elements/references/teaching.md +13 -0
  96. package/skills/use-elements/references/workspace.md +14 -8
  97. package/skills/write-explainer/references/article.md +50 -2
  98. package/skills/write-explainer/references/lesson.md +18 -9
  99. package/skills/write-explainer/references/scene-parts.md +17 -12
  100. package/skills/write-explainer/references/scene.md +25 -3
  101. package/dist/figure-frame-BjFzbl3m.js +0 -270
  102. package/dist/use-tween-5HZ55_9d.js +0 -72
@@ -1,49 +1,49 @@
1
1
  import { i as e } from "./chart-link-AE_xuxiP.js";
2
- import { E as t, O as n, S as r, T as i, c as a, k as o, l as s, s as c, t as l, u, w as d } from "./plot-layout-Bqe4-0qZ.js";
3
- import { i as f, l as p, n as m, r as h, t as g } from "./figure-frame-BjFzbl3m.js";
4
- import { r as _, t as v } from "./plot-surface-DON6WUmk.js";
2
+ import { A as t, D as n, E as r, O as i, S as a, c as o, j as s, l as c, s as l, t as u, u as d } from "./plot-layout-B2xRt-_k.js";
3
+ import { i as f, l as p, n as m, r as h, t as g } from "./figure-frame-koVKcXph.js";
4
+ import { r as _, t as v } from "./plot-surface-0cKFwtws.js";
5
5
  import { a as y, i as b, r as x } from "./tone-scope-DKiSw-JR.js";
6
- import { a as S, h as C, l as w, o as T, t as E } from "./param-BE3VMSkH.js";
7
- import { n as D, t as O } from "./clock-DSm5lkNE.js";
8
- import { n as k, t as A } from "./use-tween-5HZ55_9d.js";
9
- import { o as j, r as M } from "./scale-C2xgZyZN.js";
6
+ import { _ as S, a as C, g as w, o as T, t as E, u as D } from "./param-BdqTpZER.js";
7
+ import { n as O, t as k } from "./clock-DSm5lkNE.js";
8
+ import { o as A, r as j } from "./scale-C2xgZyZN.js";
9
+ import { t as M } from "./use-tween-BsaEO862.js";
10
10
  import { t as N } from "./chart-tones-ei3BC2AL.js";
11
11
  import { r as P } from "./tokens.stylex-dF5CACEJ.js";
12
12
  import { r as F } from "./figure-format-B8kRZMlo.js";
13
13
  import { n as I } from "./plot-width-D3hTycYX.js";
14
14
  import { n as L, t as R } from "./label-place-Z0fryBZb.js";
15
- import { a as ee, c as z, f as B, n as te, t as ne, u as re } from "./plot-marks-FVsbFkUs.js";
16
- import { i as ie, r as ae, t as oe } from "./path-BglsXpnO.js";
17
- import { t as se } from "./plot-axes-D5S9BnBa.js";
18
- import { t as ce } from "./heatmap-scale-Zte6Ya-g.js";
19
- import { d as le, f as ue } from "./token-predictions-Pa8eUGan.js";
20
- import * as V from "@stylexjs/stylex";
21
- import { Children as de, createContext as fe, memo as pe, use as H, useEffect as me, useId as he, useLayoutEffect as U, useMemo as ge, useRef as _e, useState as W, useSyncExternalStore as ve } from "react";
15
+ import { a as z, c as ee, f as te, n as B, t as V, u as ne } from "./plot-marks-FVsbFkUs.js";
16
+ import { i as re, r as ie, t as ae } from "./path-BglsXpnO.js";
17
+ import { t as oe } from "./plot-axes-D5S9BnBa.js";
18
+ import { t as se } from "./heatmap-scale-Zte6Ya-g.js";
19
+ import { d as ce, f as le } from "./token-predictions-C3B5L-eO.js";
20
+ import * as H from "@stylexjs/stylex";
21
+ import { Children as ue, createContext as de, memo as fe, use as pe, useEffect as me, useId as he, useLayoutEffect as U, useMemo as ge, useRef as _e, useState as W, useSyncExternalStore as ve } from "react";
22
22
  import { bindDrag as ye, dragThreshold as be } from "@ui-sdk/core";
23
23
  import { Fragment as xe, jsx as G, jsxs as K } from "react/jsx-runtime";
24
- import { clamp as Se, scrubTo as Ce } from "@ui-sdk/core/number";
25
- import { createPortal as we } from "react-dom";
24
+ import { clamp as Se, scrubTo as Ce, stepFromKey as we } from "@ui-sdk/core/number";
25
+ import { createPortal as Te } from "react-dom";
26
26
  // packages/teaching/src/scene/scene-registry.ts
27
- function Te(e, t) {
27
+ function Ee(e, t) {
28
28
  return e.length === t.length && e.every((e, n) => e === t[n]);
29
29
  }
30
- function Ee(e, t) {
30
+ function De(e, t) {
31
31
  let [n = 0, r = 0] = e ?? [], [i = 0, a = 0] = t ?? [];
32
32
  return n === i && r === a;
33
33
  }
34
- function De(e, t) {
34
+ function Oe(e, t) {
35
35
  if (e === void 0 || t === void 0) return e === t;
36
- let n = e.x === t.x && e.y === t.y && Ee(e.offset, t.offset), r = e.width === t.width && e.height === t.height;
37
- return n && r && Oe(e.outset, t.outset);
36
+ let n = e.x === t.x && e.y === t.y && De(e.offset, t.offset), r = e.width === t.width && e.height === t.height;
37
+ return n && r && ke(e.outset, t.outset);
38
38
  }
39
- function Oe(e, t) {
39
+ function ke(e, t) {
40
40
  return e?.top === t?.top && e?.bottom === t?.bottom && e?.left === t?.left && e?.right === t?.right;
41
41
  }
42
- function ke(e, t) {
43
- let n = e.kind === t.kind && e.label === t.label && e.shape === t.shape, r = e.isShown === t.isShown && e.isActive === t.isActive, i = Te(e.attaches, t.attaches) && e.track === t.track, a = e.problem === t.problem && De(e.frame, t.frame), o = e.isFloating === t.isFloating && e.order === t.order && e.room === t.room, s = n && r && o, c = Oe(e.margins, t.margins) && Oe(e.surround, t.surround);
42
+ function Ae(e, t) {
43
+ let n = e.kind === t.kind && e.label === t.label && e.shape === t.shape, r = e.isShown === t.isShown && e.isActive === t.isActive, i = Ee(e.attaches, t.attaches) && e.track === t.track, a = e.problem === t.problem && Oe(e.frame, t.frame), o = e.isFloating === t.isFloating && e.order === t.order && e.room === t.room, s = n && r && o, c = ke(e.margins, t.margins) && ke(e.surround, t.surround);
44
44
  return s && i && a && c;
45
45
  }
46
- function Ae() {
46
+ function je() {
47
47
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = {
48
48
  snapshot: void 0,
49
49
  isPainted: !1,
@@ -64,7 +64,7 @@ function Ae() {
64
64
  if (i !== void 0 && i.owner !== n) {
65
65
  let e = t.get(r.id) ?? /* @__PURE__ */ new Set(), i = !e.has(n);
66
66
  e.add(n), t.set(r.id, e), i && a();
67
- } else i !== void 0 && ke(i.member, r) || (e.set(r.id, {
67
+ } else i !== void 0 && Ae(i.member, r) || (e.set(r.id, {
68
68
  owner: n,
69
69
  member: r
70
70
  }), a());
@@ -94,7 +94,7 @@ function Ae() {
94
94
  }
95
95
  };
96
96
  }
97
- function je(e) {
97
+ function Me(e) {
98
98
  let t = /* @__PURE__ */ new WeakMap();
99
99
  return (n) => {
100
100
  let r = t.get(n);
@@ -104,15 +104,15 @@ function je(e) {
104
104
  };
105
105
  }
106
106
  // packages/teaching/src/scene/scene-stagger.ts
107
- var Me = {
107
+ var Ne = {
108
108
  short: 60,
109
109
  regular: 120,
110
110
  long: 240
111
111
  };
112
- function Ne(e) {
113
- return typeof e == "number" ? e : e.index * Me[e.step ?? "regular"];
112
+ function Pe(e) {
113
+ return typeof e == "number" ? e : e.index * Ne[e.step ?? "regular"];
114
114
  }
115
- function Pe() {
115
+ function Fe() {
116
116
  let e = /* @__PURE__ */ new Set(), t = { isQueued: !1 };
117
117
  function n() {
118
118
  t.isQueued = !1;
@@ -120,7 +120,7 @@ function Pe() {
120
120
  e.clear();
121
121
  let r = Array.from(n.values()).flatMap((e) => e.toSorted((e, t) => e.place.index - t.place.index).map((e, t) => ({
122
122
  entry: e,
123
- wait: t * Me[e.place.step ?? "regular"]
123
+ wait: t * Ne[e.place.step ?? "regular"]
124
124
  })));
125
125
  for (let { entry: e, wait: t } of r) e.begin(t);
126
126
  }
@@ -128,9 +128,10 @@ function Pe() {
128
128
  e.delete(r);
129
129
  }) };
130
130
  }
131
- var Fe = je(Pe), Ie = {
131
+ var Ie = Me(Fe), Le = {
132
132
  objects: "diagram parts",
133
133
  objectColumn: "Part",
134
+ press: "Press Enter or Space to activate a part.",
134
135
  missingLocale: "This scene needs a locale. Pass `locale`, or place it inside a Lesson.",
135
136
  invalidBox: "The scene box needs two finite, increasing values on each axis.",
136
137
  invalidAspect: "The scene aspect must be a positive, finite ratio of width to height.",
@@ -141,22 +142,22 @@ var Fe = je(Pe), Ie = {
141
142
  unknownFocus: "The focus names \"{id}\", which no object in this scene has.",
142
143
  weightOutside: "The wire \"{id}\" has weight {weight}, outside the scene's weight limit of plus or minus {limit}.",
143
144
  outside: "{part} must be inside a Scene."
144
- }, Le = { objects: 1200 };
145
+ }, Re = { objects: 1200 };
145
146
  function q(e, t) {
146
147
  return e.replaceAll(/\{(\w+)\}/gu, (e, n) => t[n] ?? e);
147
148
  }
148
- function Re({ box: e, aspect: t, labels: n }) {
149
- return j(e.x) !== void 0 || j(e.y) !== void 0 ? n.invalidBox : t !== void 0 && (!Number.isFinite(t) || t <= 0) ? n.invalidAspect : void 0;
149
+ function ze({ box: e, aspect: t, labels: n }) {
150
+ return A(e.x) !== void 0 || A(e.y) !== void 0 ? n.invalidBox : t !== void 0 && (!Number.isFinite(t) || t <= 0) ? n.invalidAspect : void 0;
150
151
  }
151
- function ze(e, t) {
152
+ function Be(e, t) {
152
153
  if (e === void 0) return !1;
153
154
  let n = Number.isFinite(e.x) && Number.isFinite(e.y), r = e.x < t.x[0] || e.x > t.x[1], i = e.y < t.y[0] || e.y > t.y[1];
154
155
  return !n || r || i;
155
156
  }
156
- function Be({ member: e, ids: t, box: n, labels: r }) {
157
+ function Ve({ member: e, ids: t, box: n, labels: r }) {
157
158
  if (e.problem !== void 0) return e.problem;
158
159
  let i = e.attaches.find((e) => !t.has(e));
159
- return i === void 0 ? ze(e.frame, n) ? q(r.outsideBox, {
160
+ return i === void 0 ? Be(e.frame, n) ? q(r.outsideBox, {
160
161
  kind: e.kind,
161
162
  id: e.id
162
163
  }) : void 0 : q(r.unknownId, {
@@ -165,13 +166,13 @@ function Be({ member: e, ids: t, box: n, labels: r }) {
165
166
  target: i
166
167
  });
167
168
  }
168
- function Ve({ members: e, focus: t, box: n, labels: r }) {
169
- if (e.list.length > Le.objects) return q(r.tooMany, { limit: String(Le.objects) });
169
+ function He({ members: e, focus: t, box: n, labels: r }) {
170
+ if (e.list.length > Re.objects) return q(r.tooMany, { limit: String(Re.objects) });
170
171
  let [i] = e.duplicates;
171
172
  if (i !== void 0) return q(r.duplicateId, { id: i });
172
173
  let a = new Set(e.list.map((e) => e.id));
173
174
  for (let t of e.list) {
174
- let e = Be({
175
+ let e = Ve({
175
176
  member: t,
176
177
  ids: a,
177
178
  box: n,
@@ -183,14 +184,14 @@ function Ve({ members: e, focus: t, box: n, labels: r }) {
183
184
  return o === void 0 ? void 0 : q(r.unknownFocus, { id: o });
184
185
  }
185
186
  // packages/teaching/src/scene/scene-context.ts
186
- var He = .5, Ue = {
187
+ var Ue = .5, We = {
187
188
  normal: 1,
188
189
  context: 1,
189
190
  receded: .32
190
191
  };
191
- function We() {
192
+ function Ge() {
192
193
  let e = {
193
- box: c({
194
+ box: l({
194
195
  width: 1,
195
196
  height: 1,
196
197
  margins: {
@@ -207,10 +208,10 @@ function We() {
207
208
  };
208
209
  return {
209
210
  ...e,
210
- scalesFor: Ze(e),
211
+ scalesFor: Qe(e),
211
212
  isInScene: !1,
212
- registry: Ae(),
213
- camera: k({
213
+ registry: je(),
214
+ camera: S({
214
215
  x0: 0,
215
216
  x1: 1,
216
217
  y0: 0,
@@ -225,21 +226,21 @@ function We() {
225
226
  wires: null,
226
227
  front: null
227
228
  },
228
- labels: Ie
229
+ labels: Le
229
230
  };
230
231
  }
231
- var Ge = fe(We());
232
- function Ke() {}
233
- var qe = fe({
232
+ var Ke = de(Ge());
233
+ function qe() {}
234
+ var Je = de({
234
235
  inspected: null,
235
236
  selected: null,
236
237
  cursor: null,
237
238
  lit: null,
238
239
  isKeyboardFocused: !1,
239
- focusPlot: Ke
240
+ focusPlot: qe
240
241
  });
241
- function Je({ domain: e, low: t, high: n, range: r }) {
242
- let i = M({
242
+ function Ye({ domain: e, low: t, high: n, range: r }) {
243
+ let i = j({
243
244
  domain: e,
244
245
  range: [0, 1]
245
246
  }), a = e[1] - e[0];
@@ -255,8 +256,8 @@ function Je({ domain: e, low: t, high: n, range: r }) {
255
256
  valueAt: (t) => e[0] + (s + (t - r[0]) / l * c) * a
256
257
  };
257
258
  }
258
- function Ye({ values: e, x: t, y: n }) {
259
- let r = t.position(e.x) + e.dx, i = n.position(e.y) + e.dy, a = e.width * He, o = e.height * He;
259
+ function Xe({ values: e, x: t, y: n }) {
260
+ let r = t.position(e.x) + e.dx, i = n.position(e.y) + e.dy, a = e.width * Ue, o = e.height * Ue;
260
261
  return {
261
262
  left: r - a,
262
263
  top: i - o,
@@ -264,13 +265,13 @@ function Ye({ values: e, x: t, y: n }) {
264
265
  bottom: i + o
265
266
  };
266
267
  }
267
- function Xe(e, t) {
268
- let { box: n, domain: r } = e, i = Je({
268
+ function Ze(e, t) {
269
+ let { box: n, domain: r } = e, i = Ye({
269
270
  domain: r.x,
270
271
  low: t.x0,
271
272
  high: t.x1,
272
273
  range: [n.left, n.right]
273
- }), a = Je({
274
+ }), a = Ye({
274
275
  domain: r.y,
275
276
  low: t.y0,
276
277
  high: t.y1,
@@ -279,38 +280,38 @@ function Xe(e, t) {
279
280
  return {
280
281
  x: i,
281
282
  y: a,
282
- rectOf: (e) => Ye({
283
+ rectOf: (e) => Xe({
283
284
  values: e,
284
285
  x: i,
285
286
  y: a
286
287
  })
287
288
  };
288
289
  }
289
- function Ze(e) {
290
+ function Qe(e) {
290
291
  let t = {
291
292
  view: void 0,
292
- scales: Xe(e, {
293
+ scales: Ze(e, {
293
294
  x0: e.domain.x[0],
294
295
  x1: e.domain.x[1],
295
296
  y0: e.domain.y[0],
296
297
  y1: e.domain.y[1]
297
298
  })
298
299
  };
299
- return (n) => (t.view !== n && (t.view = n, t.scales = Xe(e, n)), t.scales);
300
+ return (n) => (t.view !== n && (t.view = n, t.scales = Ze(e, n)), t.scales);
300
301
  }
301
302
  function J() {
302
- let e = H(Ge), t = ve(e.camera.subscribe, e.camera.get, e.camera.get);
303
+ let e = pe(Ke), t = ve(e.camera.subscribe, e.camera.get, e.camera.get);
303
304
  return {
304
305
  ...e,
305
306
  ...e.scalesFor(t),
306
307
  view: t
307
308
  };
308
309
  }
309
- function Qe({ id: e, marks: t, emphasis: n }) {
310
+ function $e({ id: e, marks: t, emphasis: n }) {
310
311
  return n === "context" ? "context" : t.inspected === e ? "normal" : t.lit === null ? n ?? "normal" : t.lit.has(e) ? "normal" : "receded";
311
312
  }
312
313
  function Y(e) {
313
- let t = J(), n = H(qe), { registry: r } = t, { id: i, kind: a, frame: o, values: s, shape: c = "box", label: l, attaches: u = [], isShown: d = !0, isActive: f = !1 } = e, { emphasis: p, problem: m, pace: h = t.pace, isFloating: g = !1, margins: _, order: v = 0, delay: y = 0, stagger: b } = e, { room: x, surround: S } = e, [C] = W(() => ({})), w = {
314
+ let t = J(), n = pe(Je), { registry: r } = t, { id: i, kind: a, frame: o, values: s, shape: c = "box", label: l, attaches: u = [], isShown: d = !0, isActive: f = !1 } = e, { emphasis: p, problem: m, pace: h = t.pace, isFloating: g = !1, margins: _, order: v = 0, delay: y = 0, stagger: b } = e, { room: x, surround: C } = e, [w] = W(() => ({})), T = {
314
315
  ...s,
315
316
  x: o?.x ?? 0,
316
317
  y: o?.y ?? 0,
@@ -319,17 +320,17 @@ function Y(e) {
319
320
  width: o?.width ?? 0,
320
321
  height: o?.height ?? 0,
321
322
  opacity: +!!d
322
- }, [T] = W(() => k({
323
- ...w,
324
- opacity: r.isPainted() ? 0 : w.opacity
325
- })), [E] = W(() => ({
326
- key: JSON.stringify(T.get()),
323
+ }, [E] = W(() => S({
324
+ ...T,
325
+ opacity: r.isPainted() ? 0 : T.opacity
326
+ })), [D] = W(() => ({
327
+ key: JSON.stringify(E.get()),
327
328
  stop: () => void 0
328
- })), j = ve(T.subscribe, T.get, T.get), M = Qe({
329
+ })), A = ve(E.subscribe, E.get, E.get), j = $e({
329
330
  id: i,
330
331
  marks: n,
331
332
  emphasis: p
332
- }), { strength: N } = A({ strength: Ue[M] }, "fast"), P = {
333
+ }), { strength: N } = M({ strength: We[j] }, "fast"), P = {
333
334
  id: i,
334
335
  kind: a,
335
336
  label: l,
@@ -340,60 +341,60 @@ function Y(e) {
340
341
  order: v,
341
342
  attaches: u,
342
343
  room: x,
343
- surround: S,
344
+ surround: C,
344
345
  isShown: d,
345
346
  isActive: f,
346
347
  problem: m
347
348
  };
348
349
  return r.isDrafting() && r.draft({
349
350
  ...P,
350
- track: T
351
+ track: E
351
352
  }), U(() => {
352
- let e = JSON.stringify(w);
353
- if (r.upsert(C, {
353
+ let e = JSON.stringify(T);
354
+ if (r.upsert(w, {
354
355
  ...P,
355
- track: T
356
- }), h === "instant" || O()) {
357
- E.stop(), E.key = e, T.to(w, h);
356
+ track: E
357
+ }), h === "instant" || k()) {
358
+ D.stop(), D.key = e, E.to(T, h);
358
359
  return;
359
360
  }
360
- if (E.key === e) return;
361
- E.key = e, E.stop();
361
+ if (D.key === e) return;
362
+ D.key = e, D.stop();
362
363
  function t(e) {
363
- let t = Ne(y) + e;
364
+ let t = Pe(y) + e;
364
365
  if (t <= 0) {
365
- T.to(w, h);
366
+ E.to(T, h);
366
367
  return;
367
368
  }
368
369
  let n = { start: void 0 };
369
- E.stop = D((e) => {
370
- n.start ??= e, e - n.start >= t && (E.stop(), T.to(w, h));
370
+ D.stop = O((e) => {
371
+ n.start ??= e, e - n.start >= t && (D.stop(), E.to(T, h));
371
372
  });
372
373
  }
373
- b === void 0 ? t(0) : E.stop = Fe(r).join({
374
+ b === void 0 ? t(0) : D.stop = Ie(r).join({
374
375
  place: b,
375
376
  begin: t
376
377
  });
377
- }), U(() => () => r.remove(C, i), [
378
+ }), U(() => () => r.remove(w, i), [
378
379
  r,
379
- C,
380
+ w,
380
381
  i
381
382
  ]), U(() => () => {
382
- E.stop(), T.destroy();
383
- }, [T, E]), {
384
- values: j,
385
- rect: o === void 0 ? void 0 : t.rectOf(j),
386
- isVisible: d || j.opacity > 0,
383
+ D.stop(), E.destroy();
384
+ }, [E, D]), {
385
+ values: A,
386
+ rect: o === void 0 ? void 0 : t.rectOf(A),
387
+ isVisible: d || A.opacity > 0,
387
388
  isInspected: n.inspected === i,
388
389
  isSelected: n.selected === i,
389
390
  isCursor: n.isKeyboardFocused && n.cursor === i,
390
- emphasis: M,
391
+ emphasis: j,
391
392
  strength: N,
392
393
  focusPlot: n.focusPlot,
393
394
  scene: t
394
395
  };
395
396
  }
396
- function $e(e, t) {
397
+ function et(e, t) {
397
398
  let n = _e([]);
398
399
  function r() {
399
400
  let e = t(), r = n.current;
@@ -401,8 +402,8 @@ function $e(e, t) {
401
402
  }
402
403
  return ve(e, r, r);
403
404
  }
404
- function et(e) {
405
- let t = J(), { registry: n } = t, r = $e(n.subscribe, () => e.map((e) => n.member(e))), i = $e(ge(() => (e) => {
405
+ function tt(e) {
406
+ let t = J(), { registry: n } = t, r = et(n.subscribe, () => e.map((e) => n.member(e))), i = et(ge(() => (e) => {
406
407
  let t = r.flatMap((t) => t === void 0 ? [] : [t.track.subscribe(e)]);
407
408
  return () => {
408
409
  for (let e of t) e();
@@ -418,7 +419,7 @@ function et(e) {
418
419
  });
419
420
  }
420
421
  // packages/teaching/src/scene/scene-geometry.ts
421
- var tt = {
422
+ var nt = {
422
423
  small: {
423
424
  width: 64,
424
425
  height: 28
@@ -431,16 +432,16 @@ var tt = {
431
432
  width: 184,
432
433
  height: 64
433
434
  }
434
- }, nt = {
435
+ }, rt = {
435
436
  small: 32,
436
437
  medium: 48,
437
438
  large: 72
438
- }, X = .5, rt = 8, it = 8, at = 64, ot = 4, st = 8, ct = 2, lt = 2400, ut = 2, dt = 16;
439
- function ft(e, t) {
439
+ }, X = .5, it = 8, at = 8, ot = 16, st = 4, ct = 8, lt = 2, ut = 2400, dt = 2, ft = 16;
440
+ function pt(e, t) {
440
441
  return typeof e == "string" ? t === "circle" ? {
441
- width: nt[e],
442
- height: nt[e]
443
- } : tt[e] : e;
442
+ width: rt[e],
443
+ height: rt[e]
444
+ } : nt[e] : e;
444
445
  }
445
446
  function Z(e) {
446
447
  return {
@@ -448,7 +449,7 @@ function Z(e) {
448
449
  y: (e.top + e.bottom) * X
449
450
  };
450
451
  }
451
- function pt(e) {
452
+ function mt(e) {
452
453
  if (e.length !== 0) return {
453
454
  left: Math.min(...e.map((e) => e.left)),
454
455
  top: Math.min(...e.map((e) => e.top)),
@@ -456,7 +457,7 @@ function pt(e) {
456
457
  bottom: Math.max(...e.map((e) => e.bottom))
457
458
  };
458
459
  }
459
- function mt(e, t) {
460
+ function ht(e, t) {
460
461
  return {
461
462
  left: e.left - t,
462
463
  top: e.top - t,
@@ -464,14 +465,14 @@ function mt(e, t) {
464
465
  bottom: e.bottom + t
465
466
  };
466
467
  }
467
- function ht(e, t) {
468
+ function gt(e, t) {
468
469
  return !(e.right <= t.left || t.right <= e.left) && !(e.bottom <= t.top || t.bottom <= e.top);
469
470
  }
470
- function gt(e, t) {
471
+ function _t(e, t) {
471
472
  let n = Math.min(e.right, t.right) - Math.max(e.left, t.left), r = Math.min(e.bottom, t.bottom) - Math.max(e.top, t.top);
472
473
  return Math.max(0, n) * Math.max(0, r);
473
474
  }
474
- function _t({ rect: e, from: t, to: n }) {
475
+ function vt({ rect: e, from: t, to: n }) {
475
476
  let r = n.x - t.x, i = n.y - t.y, a = [
476
477
  {
477
478
  step: -r,
@@ -494,11 +495,11 @@ function _t({ rect: e, from: t, to: n }) {
494
495
  let o = Math.max(0, ...a.filter((e) => e.step < 0).map((e) => e.room / e.step)), s = Math.min(1, ...a.filter((e) => e.step > 0).map((e) => e.room / e.step));
495
496
  return s > o ? (s - o) * Math.hypot(r, i) : 0;
496
497
  }
497
- function vt({ center: e, corner: t, step: n, radius: r }) {
498
+ function yt({ center: e, corner: t, step: n, radius: r }) {
498
499
  let i = e.x - t.x, a = e.y - t.y, o = n.x * n.x + n.y * n.y, s = i * n.x + a * n.y, c = i * i + a * a - r * r, l = Math.max(0, s * s - o * c);
499
500
  return (-s + Math.sqrt(l)) / o;
500
501
  }
501
- function yt({ rect: e, shape: t, toward: n }) {
502
+ function bt({ rect: e, shape: t, toward: n }) {
502
503
  let r = Z(e), i = (e.right - e.left) * X, a = (e.bottom - e.top) * X, o = {
503
504
  x: n.x - r.x,
504
505
  y: n.y - r.y
@@ -516,7 +517,7 @@ function yt({ rect: e, shape: t, toward: n }) {
516
517
  y: r.y + o.y * l
517
518
  }, d = t === "pill" ? Math.min(i, a) : 0, f = Math.abs(u.x - r.x) > i - d;
518
519
  if (d === 0 || !f || Math.abs(u.y - r.y) <= a - d) return u;
519
- let p = vt({
520
+ let p = yt({
520
521
  center: r,
521
522
  corner: {
522
523
  x: r.x + Math.sign(o.x) * (i - d),
@@ -530,7 +531,7 @@ function yt({ rect: e, shape: t, toward: n }) {
530
531
  y: r.y + o.y * p
531
532
  };
532
533
  }
533
- function bt({ rect: e, axis: t, sign: n }) {
534
+ function xt({ rect: e, axis: t, sign: n }) {
534
535
  let r = Z(e);
535
536
  return t === "x" ? {
536
537
  x: n > 0 ? e.right : e.left,
@@ -540,10 +541,10 @@ function bt({ rect: e, axis: t, sign: n }) {
540
541
  y: n > 0 ? e.bottom : e.top
541
542
  };
542
543
  }
543
- function xt({ start: e, span: t, domain: n }) {
544
+ function St({ start: e, span: t, domain: n }) {
544
545
  return Math.min(n[1] - t, Math.max(n[0], e));
545
546
  }
546
- function St({ domain: e, width: t, height: n, frames: r, padding: i }) {
547
+ function Ct({ domain: e, width: t, height: n, frames: r, padding: i }) {
547
548
  let a = {
548
549
  x0: e.x[0],
549
550
  x1: e.x[1],
@@ -551,11 +552,11 @@ function St({ domain: e, width: t, height: n, frames: r, padding: i }) {
551
552
  y1: e.y[1]
552
553
  };
553
554
  if (r.length === 0) return a;
554
- let o = e.x[1] - e.x[0], s = e.y[1] - e.y[0], c = Math.min(...r.map((e) => e.x)), l = Math.max(...r.map((e) => e.x)), u = Math.min(...r.map((e) => e.y)), d = Math.max(...r.map((e) => e.y)), f = t - Math.max(...r.map((e) => e.width)) - ct * i, p = n - Math.max(...r.map((e) => e.height)) - ct * i, m = l === c ? st : f / (l - c) * (o / t), h = d === u ? st : p / (d - u) * (s / n), g = Math.min(st, Math.max(1, Math.min(m, h))), _ = o / g, v = s / g, y = xt({
555
+ let o = e.x[1] - e.x[0], s = e.y[1] - e.y[0], c = Math.min(...r.map((e) => e.x)), l = Math.max(...r.map((e) => e.x)), u = Math.min(...r.map((e) => e.y)), d = Math.max(...r.map((e) => e.y)), f = t - Math.max(...r.map((e) => e.width)) - lt * i, p = n - Math.max(...r.map((e) => e.height)) - lt * i, m = l === c ? ct : f / (l - c) * (o / t), h = d === u ? ct : p / (d - u) * (s / n), g = Math.min(ct, Math.max(1, Math.min(m, h))), _ = o / g, v = s / g, y = St({
555
556
  start: (c + l) * X - _ * X,
556
557
  span: _,
557
558
  domain: e.x
558
- }), b = xt({
559
+ }), b = St({
559
560
  start: (u + d) * X - v * X,
560
561
  span: v,
561
562
  domain: e.y
@@ -567,7 +568,7 @@ function St({ domain: e, width: t, height: n, frames: r, padding: i }) {
567
568
  y1: b + v
568
569
  };
569
570
  }
570
- function Ct(e) {
571
+ function wt(e) {
571
572
  let [t, n] = e.offset ?? [0, 0], r = e.outset ?? {};
572
573
  return {
573
574
  top: e.height * X - n + (r.top ?? 0),
@@ -576,9 +577,9 @@ function Ct(e) {
576
577
  left: e.width * X - t + (r.left ?? 0)
577
578
  };
578
579
  }
579
- function wt({ frames: e, domain: t, innerWidth: n, innerHeight: r }) {
580
+ function Tt({ frames: e, domain: t, innerWidth: n, innerHeight: r }) {
580
581
  let i = e.map((e) => {
581
- let i = Ct(e), a = (e.x - t.x[0]) / (t.x[1] - t.x[0]), o = (e.y - t.y[0]) / (t.y[1] - t.y[0]);
582
+ let i = wt(e), a = (e.x - t.x[0]) / (t.x[1] - t.x[0]), o = (e.y - t.y[0]) / (t.y[1] - t.y[0]);
582
583
  return {
583
584
  top: i.top - (1 - o) * r,
584
585
  right: i.right - (1 - a) * n,
@@ -593,9 +594,9 @@ function wt({ frames: e, domain: t, innerWidth: n, innerHeight: r }) {
593
594
  left: Math.max(0, ...i.map((e) => e.left))
594
595
  };
595
596
  }
596
- function Tt(e, t) {
597
+ function Et(e, t) {
597
598
  function n(n) {
598
- return Math.max(Math.ceil(e[n]) + rt, ...t.map((e) => e[n] ?? 0));
599
+ return Math.max(Math.ceil(e[n]) + it, ...t.map((e) => e[n] ?? 0));
599
600
  }
600
601
  return {
601
602
  top: n("top"),
@@ -604,7 +605,7 @@ function Tt(e, t) {
604
605
  left: n("left")
605
606
  };
606
607
  }
607
- function Et({ frames: e, reserved: t, domain: n, width: r, height: i }) {
608
+ function Dt({ frames: e, reserved: t, domain: n, width: r, height: i }) {
608
609
  let a = {
609
610
  margins: {
610
611
  top: 0,
@@ -615,8 +616,8 @@ function Et({ frames: e, reserved: t, domain: n, width: r, height: i }) {
615
616
  rounds: 0,
616
617
  isSettled: !1
617
618
  };
618
- for (; !a.isSettled && a.rounds < ot;) {
619
- let { margins: o } = a, s = Tt(wt({
619
+ for (; !a.isSettled && a.rounds < st;) {
620
+ let { margins: o } = a, s = Et(Tt({
620
621
  frames: e,
621
622
  domain: n,
622
623
  innerWidth: r - o.left - o.right,
@@ -626,35 +627,35 @@ function Et({ frames: e, reserved: t, domain: n, width: r, height: i }) {
626
627
  }
627
628
  return a.margins;
628
629
  }
629
- function Dt(e, t, n) {
630
+ function Ot(e, t, n) {
630
631
  let [r, i] = e.x <= t.x ? [e, t] : [t, e], a = i.x - r.x;
631
- return a === 0 ? 0 : Math.max(0, (Ct(r).right + Ct(i).left + n) / a);
632
+ return a === 0 ? 0 : Math.max(0, (wt(r).right + wt(i).left + n) / a);
632
633
  }
633
- function Ot({ first: e, second: t, perUnitY: n }) {
634
- let r = Ct(e), i = Ct(t), a = -e.y * n, o = -t.y * n;
635
- return a - r.top < o + i.bottom + it && o - i.top < a + r.bottom + it;
634
+ function kt({ first: e, second: t, perUnitY: n }) {
635
+ let r = wt(e), i = wt(t), a = -e.y * n, o = -t.y * n;
636
+ return a - r.top < o + i.bottom + at && o - i.top < a + r.bottom + at;
636
637
  }
637
- function kt({ frames: e, edged: t, links: n, domain: r, innerHeight: i, reserved: a }) {
638
- let o = i / (r.y[1] - r.y[0]), s = e.map((t, n) => Math.max(0, ...e.slice(n + 1).map((e) => Ot({
638
+ function At({ frames: e, edged: t, links: n, domain: r, innerHeight: i, reserved: a }) {
639
+ let o = i / (r.y[1] - r.y[0]), s = e.map((t, n) => Math.max(0, ...e.slice(n + 1).map((e) => kt({
639
640
  first: t,
640
641
  second: e,
641
642
  perUnitY: o
642
- }) ? Dt(t, e, it) : 0))), c = n.map((e) => Dt(e.from, e.to, Math.max(at, e.room ?? 0))), l = Math.max(0, ...s, ...c);
643
+ }) ? Ot(t, e, at) : 0))), c = n.map((e) => Ot(e.from, e.to, e.room ?? ot)), l = Math.max(0, ...s, ...c);
643
644
  if (l === 0) return 0;
644
- let u = l * (r.x[1] - r.x[0]), d = Tt(wt({
645
+ let u = l * (r.x[1] - r.x[0]), d = Et(Tt({
645
646
  frames: t,
646
647
  domain: r,
647
648
  innerWidth: u,
648
649
  innerHeight: i
649
650
  }), a);
650
- return Math.min(lt, Math.ceil(u + d.left + d.right));
651
+ return Math.min(ut, Math.ceil(u + d.left + d.right));
651
652
  }
652
- function At(e) {
653
+ function jt(e) {
653
654
  let t = e.map((e) => Z(e.rect)), n = Map.groupBy(e.map((e, t) => ({
654
655
  item: e,
655
656
  index: t
656
657
  })), ({ index: e }) => t.findIndex((n, r) => {
657
- let i = t[e] ?? n, a = Math.abs(n.x - i.x) <= dt && Math.abs(n.y - i.y) <= dt;
658
+ let i = t[e] ?? n, a = Math.abs(n.x - i.x) <= ft && Math.abs(n.y - i.y) <= ft;
658
659
  return r <= e && a;
659
660
  }));
660
661
  return new Map(Array.from(n, ([e, n]) => {
@@ -663,7 +664,7 @@ function At(e) {
663
664
  y: 0
664
665
  };
665
666
  return r.map(({ item: e, index: r }, o) => {
666
- let s = t[r] ?? a, c = n.length === 1 ? 0 : a.x + (o - i) * ut - s.x, l = n.length === 1 ? 0 : a.y - s.y, { rect: u } = e;
667
+ let s = t[r] ?? a, c = n.length === 1 ? 0 : a.x + (o - i) * dt - s.x, l = n.length === 1 ? 0 : a.y - s.y, { rect: u } = e;
667
668
  return [e.id, {
668
669
  left: u.left + c,
669
670
  right: u.right + c,
@@ -674,12 +675,12 @@ function At(e) {
674
675
  }).flat());
675
676
  }
676
677
  // packages/teaching/src/scene/scene.tsx
677
- var jt = 24, Mt = 32, Nt = {
678
+ var Mt = 24, Nt = 32, Pt = {
678
679
  kVAEAm: "x1n2onr6",
679
680
  kVQacm: "xb3r6kr",
680
681
  $$css: !0
681
- }, Pt = { stage: (e, t) => [
682
- Nt,
682
+ }, Ft = { stage: (e, t) => [
683
+ Pt,
683
684
  {
684
685
  kzqmXN: e == null ? e : "x5lhr3w",
685
686
  kZKoxP: t == null ? t : "x16ye13r",
@@ -690,20 +691,20 @@ var jt = 24, Mt = 32, Nt = {
690
691
  "--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
691
692
  }
692
693
  ] };
693
- function Ft(e) {
694
+ function It(e) {
694
695
  return e === null ? [] : typeof e == "string" ? [e] : e;
695
696
  }
696
- function It(e) {
697
+ function Lt(e) {
697
698
  return e !== void 0 && e.isShown && !e.isFloating ? e.frame : void 0;
698
699
  }
699
- function Lt(e, t) {
700
+ function Rt(e, t) {
700
701
  let n = e.member(t);
701
702
  return n === void 0 ? [] : n.frame === void 0 ? n.attaches.flatMap((t) => {
702
703
  let n = e.member(t)?.frame;
703
704
  return n === void 0 ? [] : [n];
704
705
  }) : [n.frame];
705
706
  }
706
- function Rt(e, t) {
707
+ function zt(e, t) {
707
708
  let n = /* @__PURE__ */ new Set([...e.flatMap((e) => e.isActive && e.isShown ? [e.id] : []), ...t === null ? [] : [t]]);
708
709
  if (n.size === 0) return null;
709
710
  let r = e.filter((e) => e.attaches.some((e) => n.has(e))), i = e.flatMap((e) => n.has(e.id) ? e.attaches : []), a = r.flatMap((e) => e.kind === "wire" ? e.attaches : []);
@@ -714,245 +715,259 @@ function Rt(e, t) {
714
715
  ...a
715
716
  ]);
716
717
  }
717
- function zt({ cursor: e, isActive: t, scrollerRef: n, place: r }) {
718
+ function Bt({ cursor: e, isActive: t, scrollerRef: n, place: r }) {
718
719
  return me(() => {
719
720
  let i = n.current, a = e === null ? void 0 : r(e);
720
721
  if (!t || i === null || a === void 0) return;
721
- let o = Math.min(a.left - Mt, Math.max(i.scrollLeft, a.right + Mt - i.clientWidth));
722
+ let o = Math.min(a.left - Nt, Math.max(i.scrollLeft, a.right + Nt - i.clientWidth));
722
723
  i.scrollTo({ left: o });
723
724
  }), null;
724
725
  }
725
- function Bt(i) {
726
- let { x: a, y: s, height: l = "regular", aspect: u, focus: v = null, pace: b = "regular", minWidth: x, weightMax: S = 1 } = i, { labels: w, children: T, selected: E, onSelectedChange: O, ...A } = i, { emptyLabel: j = "This scene has nothing to draw.", locale: M, ...N } = A, P = C(), F = {
727
- ...Ie,
728
- ...w
729
- }, I = _(l), L = he(), R = y(), ee = e(), [z] = W(Ae), [B] = W(() => k({
730
- x0: a[0],
731
- x1: a[1],
732
- y0: s[0],
733
- y1: s[1]
734
- })), te = ve(z.subscribe, z.members, z.members), [ne, re] = W(null), [ie, ae] = W(null), [oe, se] = W(null), [ce, le] = W(!1), [ue] = W(() => ({ places: null })), fe = _e(null), pe = _e(null), H = {
735
- x: a,
736
- y: s
737
- }, ge = Ft(v), ye = te.list.flatMap((e) => {
738
- let t = It(e);
726
+ function Vt(n) {
727
+ let { x: o, y: c, height: u = "regular", aspect: d, focus: v = null, pace: b = "regular", minWidth: x, weightMax: C = 1 } = n, { labels: T, children: E, selected: D, onSelectedChange: k, ...A } = n, { emptyLabel: j = "This scene has nothing to draw.", locale: M, ...N } = A, P = w(), F = {
728
+ ...Le,
729
+ ...T
730
+ }, I = _(u), L = he(), R = y(), z = e(), [ee, te] = W(null), [B] = W(je), [V] = W(() => S({
731
+ x0: o[0],
732
+ x1: o[1],
733
+ y0: c[0],
734
+ y1: c[1]
735
+ })), ne = ve(B.subscribe, B.members, B.members), [re, ie] = W(null), [ae, oe] = W(null), [se, ce] = W(null), [le, de] = W(!1), [fe] = W(() => ({ places: null })), pe = _e(null), ge = _e(null), ye = {
736
+ x: o,
737
+ y: c
738
+ }, be = It(v), xe = ne.list.flatMap((e) => {
739
+ let t = Lt(e);
739
740
  return t === void 0 ? [] : [t];
740
- }), be = te.list.flatMap((e) => {
741
+ }), Se = ne.list.flatMap((e) => {
741
742
  let { surround: t } = e;
742
743
  return t === void 0 || !e.isShown ? [] : e.attaches.flatMap((e) => {
743
- let n = It(z.member(e));
744
+ let n = Lt(B.member(e));
744
745
  return n === void 0 ? [] : [{
745
746
  ...n,
746
747
  outset: t
747
748
  }];
748
749
  });
749
- }), xe = [...ye, ...be], Se = te.list.flatMap((e) => e.isShown && e.margins !== void 0 ? [e.margins] : []), Ce = u === void 0 ? I.height : Math.round(I.width / u), we = Et({
750
- frames: xe,
751
- reserved: Se,
752
- domain: H,
750
+ }), Ce = [...xe, ...Se], we = ne.list.flatMap((e) => e.isShown && e.margins !== void 0 ? [e.margins] : []), Te = d === void 0 ? I.height : Math.round(I.width / d), Ee = Dt({
751
+ frames: Ce,
752
+ reserved: we,
753
+ domain: ye,
753
754
  width: I.width,
754
- height: Ce
755
- }), Te = Ce - we.top - we.bottom, Ee = kt({
756
- frames: ye,
757
- edged: xe,
758
- links: te.list.flatMap((e) => {
759
- let [t, n] = e.kind === "wire" && e.isShown ? e.attaches : [], r = t === void 0 ? void 0 : It(z.member(t)), i = n === void 0 ? void 0 : It(z.member(n));
755
+ height: Te
756
+ }), De = Te - Ee.top - Ee.bottom, Oe = At({
757
+ frames: xe,
758
+ edged: Ce,
759
+ links: ne.list.flatMap((e) => {
760
+ let [t, n] = e.kind === "wire" && e.isShown ? e.attaches : [], r = t === void 0 ? void 0 : Lt(B.member(t)), i = n === void 0 ? void 0 : Lt(B.member(n));
760
761
  return r === void 0 || i === void 0 ? [] : [{
761
762
  from: r,
762
763
  to: i,
763
764
  room: e.room
764
765
  }];
765
766
  }),
766
- domain: H,
767
- innerHeight: Te,
768
- reserved: Se
769
- }), De = Math.max(I.width, x ?? Ee), Oe = De === I.width ? we : Et({
770
- frames: xe,
771
- reserved: Se,
772
- domain: H,
773
- width: De,
774
- height: Ce
775
- }), ke = c({
776
- width: De,
777
- height: Ce,
778
- margins: Oe
779
- }), je = M ?? P, Me = St({
780
- domain: H,
781
- width: ke.innerWidth,
782
- height: ke.innerHeight,
783
- frames: ge.flatMap((e) => Lt(z, e)),
784
- padding: jt
785
- }), Ne = {
767
+ domain: ye,
768
+ innerHeight: De,
769
+ reserved: we
770
+ }), ke = Math.max(I.width, x ?? Oe), Ae = ke === I.width ? Ee : Dt({
771
+ frames: Ce,
772
+ reserved: we,
773
+ domain: ye,
774
+ width: ke,
775
+ height: Te
776
+ }), Me = l({
777
+ width: ke,
778
+ height: Te,
779
+ margins: Ae
780
+ }), Ne = M ?? P, Pe = Ct({
781
+ domain: ye,
782
+ width: Me.innerWidth,
783
+ height: Me.innerHeight,
784
+ frames: be.flatMap((e) => Rt(B, e)),
785
+ padding: Mt
786
+ }), Fe = {
786
787
  isInScene: !0,
787
- registry: z,
788
- camera: B,
789
- box: ke,
790
- domain: H,
788
+ registry: B,
789
+ camera: V,
790
+ box: Me,
791
+ domain: ye,
791
792
  pace: b,
792
- locale: je ?? "",
793
+ locale: Ne ?? "",
793
794
  tone: R,
794
- weightMax: S,
795
+ weightMax: C,
795
796
  layers: {
796
- back: ne,
797
- wires: ie,
798
- front: oe
797
+ back: re,
798
+ wires: ae,
799
+ front: se
799
800
  },
800
801
  labels: F,
801
- scalesFor: Ze({
802
- box: ke,
803
- domain: H
802
+ scalesFor: Qe({
803
+ box: Me,
804
+ domain: ye
804
805
  })
805
806
  };
806
807
  if (U(() => {
807
- z.isPainted() ? B.to(Me, b) : B.jump(Me);
808
- }), U(() => z.endDrafts(), [z]), me(() => {
808
+ B.isPainted() ? V.to(Pe, b) : V.jump(Pe);
809
+ }), U(() => B.endDrafts(), [B]), me(() => {
809
810
  let e = { stop: () => void 0 };
810
- return e.stop = D(() => {
811
- z.markPainted(), e.stop();
811
+ return e.stop = O(() => {
812
+ B.markPainted(), e.stop();
812
813
  }), () => e.stop();
813
- }, [z]), me(() => () => B.destroy(), [B]), je === null) return /* @__PURE__ */ G("span", {
814
+ }, [B]), me(() => () => V.destroy(), [V]), Ne === null) return /* @__PURE__ */ G("span", {
814
815
  className: "xr5kp14 x1hz01jw x1b5ytql",
815
816
  children: F.missingLocale
816
817
  });
817
- let Pe = {
818
+ let Ie = {
818
819
  ...N,
819
- locale: je
820
+ locale: Ne
820
821
  };
821
- if (Pe.status === "loading") return /* @__PURE__ */ G(f, {
822
- ...Pe,
823
- height: l
822
+ if (Ie.status === "loading") return /* @__PURE__ */ G(f, {
823
+ ...Ie,
824
+ height: u
824
825
  });
825
- let Fe = Re({
826
- box: H,
827
- aspect: u,
826
+ let Re = ze({
827
+ box: ye,
828
+ aspect: d,
828
829
  labels: F
829
830
  });
830
- if (Fe !== void 0) return /* @__PURE__ */ G(h, {
831
- ...Pe,
832
- message: Fe
831
+ if (Re !== void 0) return /* @__PURE__ */ G(h, {
832
+ ...Ie,
833
+ message: Re
833
834
  });
834
- if (de.toArray(T).length === 0) return /* @__PURE__ */ G(m, {
835
- ...Pe,
835
+ if (ue.toArray(E).length === 0) return /* @__PURE__ */ G(m, {
836
+ ...Ie,
836
837
  children: /* @__PURE__ */ G(g, { children: j })
837
838
  });
838
- let Le = Ve({
839
- members: te,
840
- focus: ge,
841
- box: H,
839
+ let q = He({
840
+ members: ne,
841
+ focus: be,
842
+ box: ye,
842
843
  labels: F
843
- }), q = Le === void 0 ? te.list.flatMap((e) => e.label !== void 0 && e.isShown ? [{
844
+ }), Be = q === void 0 ? ne.list.flatMap((e) => e.label !== void 0 && e.isShown ? [{
844
845
  id: e.id,
845
846
  label: e.label
846
847
  }] : []) : [];
847
- function ze(e) {
848
- let t = z.member(e), n = Ne.scalesFor(B.get());
849
- if (t !== void 0) return t.frame === void 0 ? pt(t.attaches.flatMap((e) => {
850
- let t = z.member(e);
851
- return t?.frame === void 0 ? [] : [Ye({
848
+ function Ve(e, t) {
849
+ te(e === null ? null : t.reason), z.onInspectedChange?.(e, t);
850
+ }
851
+ let Ue = k !== void 0 && ee === "item-press";
852
+ function We(e) {
853
+ let t = B.member(e), n = Fe.scalesFor(V.get());
854
+ if (t !== void 0) return t.frame === void 0 ? mt(t.attaches.flatMap((e) => {
855
+ let t = B.member(e);
856
+ return t?.frame === void 0 ? [] : [Xe({
852
857
  values: t.track.get(),
853
858
  ...n
854
859
  })];
855
- })) : Ye({
860
+ })) : Xe({
856
861
  values: t.track.get(),
857
862
  ...n
858
863
  });
859
864
  }
860
- function Be(e) {
861
- return ue.places === null && (ue.places = At(q.flatMap((e) => {
862
- let t = ze(e.id);
865
+ function Ge(e) {
866
+ return fe.places === null && (fe.places = jt(Be.flatMap((e) => {
867
+ let t = We(e.id);
863
868
  return t === void 0 ? [] : [{
864
869
  id: e.id,
865
870
  rect: t,
866
- order: z.member(e.id)?.order ?? 0
871
+ order: B.member(e.id)?.order ?? 0
867
872
  }];
868
873
  })), queueMicrotask(() => {
869
- ue.places = null;
870
- })), ue.places.get(e) ?? ze(e);
874
+ fe.places = null;
875
+ })), fe.places.get(e) ?? We(e);
871
876
  }
872
- return /* @__PURE__ */ G(d, {
873
- ...ee,
874
- items: q,
875
- place: Be,
876
- selected: E ?? null,
877
- onSelect: O,
878
- render: (e, i) => /* @__PURE__ */ K(m, {
879
- ...Pe,
877
+ return /* @__PURE__ */ G(r, {
878
+ ...z,
879
+ onInspectedChange: Ve,
880
+ items: Be,
881
+ place: Ge,
882
+ selected: D ?? null,
883
+ onSelect: k,
884
+ render: (e, n) => /* @__PURE__ */ K(m, {
885
+ ...Ie,
880
886
  figure: e,
881
- footer: /* @__PURE__ */ G(r, {
887
+ footer: /* @__PURE__ */ G(a, {
882
888
  id: L,
883
- children: n(q, i.inspected)
889
+ children: t(Be, n.inspected)
884
890
  }),
885
891
  children: [
886
892
  /* @__PURE__ */ K("div", {
887
893
  ref: I.ref,
888
894
  className: "xeuugli x41o525",
889
- children: [Le !== void 0 && /* @__PURE__ */ G("p", {
895
+ children: [q !== void 0 && /* @__PURE__ */ G("p", {
890
896
  role: "alert",
891
897
  className: "x1ghz6dp x1qokhjc x1doqdfy x1ok0vyi xcqwzn xr5kp14 x1hz01jw xtqrqnz x1778rvt xj0a0fe",
892
- children: Le
898
+ children: q
893
899
  }), /* @__PURE__ */ G("div", {
894
- ref: pe,
895
- hidden: Le !== void 0,
900
+ ref: ge,
901
+ hidden: q !== void 0,
896
902
  className: "xw2csxc x10wlt62 xeuugli",
897
903
  children: /* @__PURE__ */ K("div", {
898
- ...V.props(Pt.stage(De, Ce)),
899
- children: [/* @__PURE__ */ G(t, {
900
- ref: fe,
904
+ ...H.props(Ft.stage(ke, Te)),
905
+ children: [/* @__PURE__ */ G(i, {
906
+ ref: pe,
901
907
  role: "group",
902
- "aria-label": o({
903
- title: Pe.title,
908
+ "aria-label": [s({
909
+ title: Ie.title,
904
910
  marks: F.objects,
905
- isSelectable: O !== void 0
906
- }),
911
+ isSelectable: !1
912
+ }), ...k === void 0 ? [] : [F.press]].join(" "),
907
913
  "aria-describedby": L,
908
- onFocus: (e) => le(e.currentTarget.matches(":focus-visible")),
909
- onBlur: () => le(!1),
914
+ onFocus: (e) => de(e.currentTarget.matches(":focus-visible")),
915
+ onBlur: () => de(!1),
910
916
  className: "x10l6tqk x10a8y8t x1t137rt x13qnu6 x19rmrnh x9v5kkp x1bqaal x-default-marker",
911
917
  children: /* @__PURE__ */ K("svg", {
912
918
  "aria-hidden": !0,
913
- width: De,
914
- height: Ce,
915
- viewBox: `0 0 ${De} ${Ce}`,
919
+ width: ke,
920
+ height: Te,
921
+ viewBox: `0 0 ${ke} ${Te}`,
916
922
  className: "x1lliihq xb3r6kr",
917
923
  children: [
918
- /* @__PURE__ */ G("g", { ref: re }),
919
- /* @__PURE__ */ G("g", { ref: ae }),
920
- /* @__PURE__ */ G("g", { ref: se })
924
+ /* @__PURE__ */ G("g", {
925
+ ref: ie,
926
+ tabIndex: -1
927
+ }),
928
+ /* @__PURE__ */ G("g", {
929
+ ref: oe,
930
+ tabIndex: -1
931
+ }),
932
+ /* @__PURE__ */ G("g", {
933
+ ref: ce,
934
+ tabIndex: -1
935
+ })
921
936
  ]
922
937
  })
923
938
  }), /* @__PURE__ */ G("div", {
924
939
  className: "x10l6tqk x10a8y8t x47corl xc8icb0",
925
- children: /* @__PURE__ */ G(Ge, {
926
- value: Ne,
927
- children: /* @__PURE__ */ G(qe, {
940
+ children: /* @__PURE__ */ G(Ke, {
941
+ value: Fe,
942
+ children: /* @__PURE__ */ G(Je, {
928
943
  value: {
929
- inspected: i.inspected,
930
- selected: i.selected,
931
- cursor: i.cursor,
932
- lit: Rt(te.list, i.inspected),
933
- isKeyboardFocused: ce,
934
- focusPlot: () => fe.current?.focus({ preventScroll: !0 })
944
+ inspected: n.inspected,
945
+ selected: n.selected,
946
+ cursor: n.cursor,
947
+ lit: zt(ne.list, Ue ? null : n.inspected),
948
+ isKeyboardFocused: le,
949
+ focusPlot: () => pe.current?.focus({ preventScroll: !0 })
935
950
  },
936
- children: T
951
+ children: E
937
952
  })
938
953
  })
939
954
  })]
940
955
  })
941
956
  })]
942
957
  }),
943
- /* @__PURE__ */ G(zt, {
944
- cursor: i.cursor,
945
- isActive: ce,
946
- scrollerRef: pe,
947
- place: Be
958
+ /* @__PURE__ */ G(Bt, {
959
+ cursor: n.cursor,
960
+ isActive: le,
961
+ scrollerRef: ge,
962
+ place: Ge
948
963
  }),
949
964
  /* @__PURE__ */ G(p, {
950
- label: `${Pe.title} ${F.objects}`,
965
+ label: `${Ie.title} ${F.objects}`,
951
966
  columns: [{
952
967
  id: "part",
953
968
  label: F.objectColumn
954
969
  }],
955
- rows: q.map((e) => ({
970
+ rows: Be.map((e) => ({
956
971
  id: e.id,
957
972
  values: [e.label]
958
973
  }))
@@ -962,7 +977,7 @@ function Bt(i) {
962
977
  });
963
978
  }
964
979
  // packages/teaching/src/scene/scene-layer.tsx
965
- var Vt = { inline: {
980
+ var Ht = { inline: {
966
981
  kVAEAm: "x10l6tqk",
967
982
  kbCHJM: "xu96u03",
968
983
  k87sOh: "x13vifvy",
@@ -970,7 +985,7 @@ var Vt = { inline: {
970
985
  kVQacm: "xb3r6kr",
971
986
  kfzvcC: "x47corl",
972
987
  $$css: !0
973
- } }, Ht = {
988
+ } }, Ut = {
974
989
  back: {
975
990
  kY2c9j: "x1rs5lyz",
976
991
  $$css: !0
@@ -984,26 +999,26 @@ var Vt = { inline: {
984
999
  $$css: !0
985
1000
  }
986
1001
  };
987
- function Ut({ layer: e = "front", children: t }) {
988
- let { layers: n, box: r, isInScene: i } = H(Ge), a = n[e];
1002
+ function Wt({ layer: e = "front", children: t }) {
1003
+ let { layers: n, box: r, isInScene: i } = pe(Ke), a = n[e];
989
1004
  return i ? a === null ? /* @__PURE__ */ G("svg", {
990
1005
  "aria-hidden": !0,
991
1006
  width: r.width,
992
1007
  height: r.height,
993
1008
  viewBox: `0 0 ${r.width} ${r.height}`,
994
- ...V.props(Vt.inline, Ht[e]),
1009
+ ...H.props(Ht.inline, Ut[e]),
995
1010
  children: t
996
- }) : we(t, a) : null;
1011
+ }) : Te(t, a) : null;
997
1012
  }
998
1013
  function Q({ part: e }) {
999
- let { labels: t } = H(Ge);
1014
+ let { labels: t } = pe(Ke);
1000
1015
  return /* @__PURE__ */ G("span", {
1001
1016
  className: "xr5kp14 x1hz01jw x1b5ytql",
1002
1017
  children: q(t.outside, { part: e })
1003
1018
  });
1004
1019
  }
1005
1020
  // packages/teaching/src/scene/scene-style.ts
1006
- var Wt = `color-mix(in srgb, ${P.faint} 70%, ${P.muted})`, Gt = {
1021
+ var Gt = `color-mix(in srgb, ${P.faint} 70%, ${P.muted})`, Kt = {
1007
1022
  inspected: {
1008
1023
  kMeerF: "x1qgsegg",
1009
1024
  k3XXqK: "xaatb59",
@@ -1026,39 +1041,39 @@ var Wt = `color-mix(in srgb, ${P.faint} 70%, ${P.muted})`, Gt = {
1026
1041
  $$css: !0
1027
1042
  }
1028
1043
  };
1029
- function Kt({ isInspected: e, isSelected: t, isCursor: n }) {
1044
+ function qt({ isInspected: e, isSelected: t, isCursor: n }) {
1030
1045
  return [
1031
- e && Gt.inspected,
1032
- t && Gt.selected,
1033
- n && Gt.cursor
1046
+ e && Kt.inspected,
1047
+ t && Kt.selected,
1048
+ n && Kt.cursor
1034
1049
  ];
1035
1050
  }
1036
1051
  // packages/teaching/src/scene/scene-node.tsx
1037
- var qt = 180, Jt = 48, Yt = .08, Xt = 1e3, Zt = {
1052
+ var Jt = 180, Yt = .5, Xt = 48, Zt = .08, Qt = 1e3, $t = {
1038
1053
  rest: 2,
1039
1054
  lifted: 14
1040
- }, Qt = {
1055
+ }, en = {
1041
1056
  rest: 4,
1042
1057
  lifted: 22
1043
- }, $t = 22, en = {
1058
+ }, tn = 22, nn = {
1044
1059
  kVAEAm: "x10l6tqk",
1045
1060
  kbCHJM: "xu96u03",
1046
1061
  k87sOh: "x13vifvy",
1047
1062
  kfzvcC: "x67bb7w",
1048
1063
  $$css: !0
1049
- }, tn = {
1064
+ }, rn = {
1050
1065
  kVAEAm: "x10l6tqk",
1051
1066
  kpwlN0: "x10a8y8t",
1052
1067
  k1xSpc: "x1lliihq",
1053
1068
  kmaZ5I: "x1oyok0e",
1054
1069
  k3XXqK: "x1t137rt",
1055
1070
  $$css: !0
1056
- }, nn = {
1071
+ }, an = {
1057
1072
  kVAEAm: "x10l6tqk",
1058
1073
  kpwlN0: "x10a8y8t",
1059
1074
  kfzvcC: "x47corl",
1060
1075
  $$css: !0
1061
- }, rn = {
1076
+ }, on = {
1062
1077
  kVAEAm: "x10l6tqk",
1063
1078
  kpwlN0: "x10a8y8t",
1064
1079
  kB7OPa: "x9f619",
@@ -1076,9 +1091,9 @@ var qt = 180, Jt = 48, Yt = .08, Xt = 1e3, Zt = {
1076
1091
  kMwMTN: "xbixft",
1077
1092
  kgyCeQ: "xlp1x4z",
1078
1093
  $$css: !0
1079
- }, an = {
1094
+ }, sn = {
1080
1095
  node: (e, t, n) => [
1081
- en,
1096
+ nn,
1082
1097
  {
1083
1098
  kzqmXN: t == null ? t : "x5lhr3w",
1084
1099
  kZKoxP: n == null ? n : "x16ye13r",
@@ -1109,7 +1124,7 @@ var qt = 180, Jt = 48, Yt = .08, Xt = 1e3, Zt = {
1109
1124
  $$css: !0
1110
1125
  },
1111
1126
  card: (e) => [
1112
- tn,
1127
+ rn,
1113
1128
  {
1114
1129
  k3aq6I: e == null ? e : "xsqj5wx",
1115
1130
  $$css: !0
@@ -1117,7 +1132,7 @@ var qt = 180, Jt = 48, Yt = .08, Xt = 1e3, Zt = {
1117
1132
  { "--x-transform": e ?? void 0 }
1118
1133
  ],
1119
1134
  shadow: (e, t) => [
1120
- nn,
1135
+ an,
1121
1136
  {
1122
1137
  kGVxlE: e == null ? e : "x1iotiob",
1123
1138
  k3aq6I: t == null ? t : "xsqj5wx",
@@ -1129,7 +1144,7 @@ var qt = 180, Jt = 48, Yt = .08, Xt = 1e3, Zt = {
1129
1144
  }
1130
1145
  ],
1131
1146
  face: (e) => [
1132
- rn,
1147
+ on,
1133
1148
  {
1134
1149
  kVAM5u: e == null ? e : "x6w5c0t",
1135
1150
  $$css: !0
@@ -1147,7 +1162,7 @@ var qt = 180, Jt = 48, Yt = .08, Xt = 1e3, Zt = {
1147
1162
  k3aq6I: "x1msufx5",
1148
1163
  $$css: !0
1149
1164
  }
1150
- }, on = {
1165
+ }, cn = {
1151
1166
  box: {
1152
1167
  kaIpWk: "xy32g2j",
1153
1168
  $$css: !0
@@ -1165,7 +1180,7 @@ var qt = 180, Jt = 48, Yt = .08, Xt = 1e3, Zt = {
1165
1180
  kWkggS: "xjbqb8w",
1166
1181
  $$css: !0
1167
1182
  }
1168
- }, sn = {
1183
+ }, ln = {
1169
1184
  box: {
1170
1185
  kaIpWk: "xy32g2j",
1171
1186
  $$css: !0
@@ -1183,8 +1198,8 @@ var qt = 180, Jt = 48, Yt = .08, Xt = 1e3, Zt = {
1183
1198
  $$css: !0
1184
1199
  }
1185
1200
  };
1186
- function cn({ id: e, at: t, offset: n, label: r, text: i, isCode: a = !1, size: o = "medium", shape: s = "box", tone: c, emphasis: l, isShown: u = !0, isActive: d = !1, turn: f = 0, lift: p = 0, tilt: m = 0, rotate: h = 0, order: g = 0, delay: _, stagger: v, pace: y, isFloating: x, back: S, backTone: C, children: w }) {
1187
- let T = b(e), E = ft(o, s), D = Y({
1201
+ function un({ id: e, at: t, offset: n, label: r, text: i, isCode: a = !1, size: o = "medium", shape: s = "box", tone: c, emphasis: l, isShown: u = !0, isActive: d = !1, turn: f = 0, lift: p = 0, tilt: m = 0, rotate: h = 0, order: g = 0, delay: _, stagger: v, pace: y, isFloating: x, back: S, backTone: C, children: w }) {
1202
+ let T = b(e), E = pt(o, s), D = Y({
1188
1203
  id: e,
1189
1204
  kind: "node",
1190
1205
  frame: {
@@ -1217,24 +1232,24 @@ function cn({ id: e, at: t, offset: n, label: r, text: i, isCode: a = !1, size:
1217
1232
  top: 0,
1218
1233
  right: 0,
1219
1234
  bottom: 0
1220
- } } = D, A = c ?? T ?? "neutral", j = D.emphasis === "context", M = j ? Wt : N[A], F = j ? Wt : N[C ?? A], I = Math.max(0, O.lift), L = [
1221
- `0 ${Zt.rest + I * Zt.lifted}px`,
1222
- `${Qt.rest + I * Qt.lifted}px`,
1223
- `color-mix(in srgb, ${P.ink} ${Math.round(I * $t)}%, transparent)`
1224
- ].join(" "), R = I === 0 && O.tilt === 0 && O.turn === 0, ee = `translate(${k.left}px, ${k.top}px)`, z = g + (p > 0 ? Xt : 0), B = R ? "none" : [
1225
- `translateZ(${I * Jt}px)`,
1235
+ } } = D, A = c ?? T ?? "neutral", j = D.emphasis === "context", M = j ? Gt : N[A], F = j ? Gt : N[C ?? A], I = Math.max(0, O.lift), L = [
1236
+ `0 ${$t.rest + I * $t.lifted}px`,
1237
+ `${en.rest + I * en.lifted}px`,
1238
+ `color-mix(in srgb, ${P.ink} ${Math.round(I * tn)}%, transparent)`
1239
+ ].join(" "), R = I === 0 && O.tilt === 0 && O.turn === 0, z = `translate(${k.left}px, ${k.top}px)`, ee = g + (p > 0 ? Qt : 0), te = R ? "none" : [
1240
+ `translateZ(${I * Xt}px)`,
1226
1241
  `rotateX(${O.tilt}deg)`,
1227
- `rotateY(${O.turn * qt}deg)`,
1228
- `scale(${1 + I * Yt})`
1242
+ `rotateY(${O.turn * Jt}deg)`,
1243
+ `scale(${1 + I * Zt})`
1229
1244
  ].join(" ");
1230
1245
  return /* @__PURE__ */ K("div", {
1231
1246
  "aria-hidden": !u || void 0,
1232
1247
  inert: !u,
1233
1248
  "data-scene-node": e,
1234
- ...V.props(an.node(O.rotate === 0 ? ee : `${ee} rotate(${O.rotate}deg)`, O.width, O.height), an.order(z), an.fade(Math.max(0, Math.min(1, O.opacity)) * D.strength), !R && an.deep, !D.isVisible && an.gone),
1235
- children: [I > 0 && /* @__PURE__ */ G("div", { ...V.props(an.shadow(L, `scale(${1 + I * Yt})`), sn[s]) }), /* @__PURE__ */ G(un, {
1249
+ ...H.props(sn.node(O.rotate === 0 ? z : `${z} rotate(${O.rotate}deg)`, O.width, O.height), sn.order(ee), sn.fade(Math.max(0, Math.min(1, O.opacity)) * D.strength), !R && sn.deep, !D.isVisible && sn.gone),
1250
+ children: [I > 0 && /* @__PURE__ */ G("div", { ...H.props(sn.shadow(L, `scale(${1 + I * Zt})`), ln[s]) }), /* @__PURE__ */ G(fn, {
1236
1251
  id: e,
1237
- transform: B,
1252
+ transform: te,
1238
1253
  color: M,
1239
1254
  backColor: F,
1240
1255
  shape: s,
@@ -1244,46 +1259,50 @@ function cn({ id: e, at: t, offset: n, label: r, text: i, isCode: a = !1, size:
1244
1259
  text: i,
1245
1260
  isCode: a,
1246
1261
  hasBack: S !== void 0 || !R,
1262
+ isBackShown: O.turn >= Yt,
1263
+ isFrontHidden: f >= Yt,
1247
1264
  back: S,
1248
1265
  focusPlot: D.focusPlot,
1249
1266
  children: w
1250
1267
  })]
1251
1268
  });
1252
1269
  }
1253
- function ln({ id: e, transform: t, color: n, backColor: r, shape: a, isInspected: o, isSelected: s, isCursor: c, text: l, isCode: u, hasBack: d, back: f, focusPlot: p, children: m }) {
1254
- let h = m != null;
1255
- function g(e) {
1256
- h || (e.preventDefault(), p());
1270
+ function dn({ id: e, transform: t, color: r, backColor: i, shape: a, isInspected: o, isSelected: s, isCursor: c, text: l, isCode: u, hasBack: d, isBackShown: f, isFrontHidden: p, back: m, focusPlot: h, children: g }) {
1271
+ let _ = g != null;
1272
+ function v(e) {
1273
+ _ || (e.preventDefault(), h());
1257
1274
  }
1258
- return /* @__PURE__ */ K(i, {
1275
+ return /* @__PURE__ */ K(n, {
1259
1276
  value: e,
1260
1277
  render: /* @__PURE__ */ G("div", {}),
1261
- onMouseDown: g,
1262
- ...V.props(an.card(t), ...Kt({
1278
+ onMouseDown: v,
1279
+ ...H.props(sn.card(t), ...qt({
1263
1280
  isInspected: o,
1264
1281
  isSelected: s,
1265
1282
  isCursor: c
1266
- }), sn[a]),
1283
+ }), ln[a]),
1267
1284
  children: [/* @__PURE__ */ K("div", {
1268
- ...V.props(an.face(n), on[a], h && an.rich),
1269
- children: [l !== void 0 && /* @__PURE__ */ G("span", {
1285
+ "aria-hidden": p ? !0 : void 0,
1286
+ ...H.props(sn.face(r), cn[a], _ && sn.rich),
1287
+ children: [l !== void 0 && !f && /* @__PURE__ */ G("span", {
1270
1288
  "aria-hidden": !0,
1271
1289
  ...{
1272
1290
  0: { className: "x104kibb x2lah0s x193iq5w xb3r6kr x2b8uid x1ua5tub x1h7i4cw xj0a0fe x1hz01jw xtqrqnz xas2l8k xk4h15q xss6m8b" },
1273
1291
  1: { className: "x104kibb x2lah0s x193iq5w xb3r6kr x2b8uid x1ua5tub x1h7i4cw xj0a0fe xtqrqnz xas2l8k xss6m8b xiard35 xj57cvi" }
1274
1292
  }[!!u | 0],
1275
1293
  children: l
1276
- }), h && /* @__PURE__ */ G("div", {
1294
+ }), _ && !f && /* @__PURE__ */ G("div", {
1277
1295
  className: "xkh2ocl x1iyjqo2 xeuugli x2lwn1j xb3r6kr",
1278
- children: m
1296
+ children: g
1279
1297
  })]
1280
1298
  }), d && /* @__PURE__ */ G("div", {
1281
- ...V.props(an.face(r), on[a], an.backFace),
1282
- children: f
1299
+ "aria-hidden": !p || void 0,
1300
+ ...H.props(sn.face(i), cn[a], sn.backFace),
1301
+ children: f ? m : null
1283
1302
  })]
1284
1303
  });
1285
1304
  }
1286
- var un = pe(ln), dn = 1.25, fn = 7, pn = 3.5, mn = 7, hn = .4, gn = .5, _n = 2, vn = .38, yn = 11, bn = 3, xn = {
1305
+ var fn = fe(dn), pn = 1.25, mn = 7, hn = 3.5, gn = 16, _n = 7, vn = .4, yn = .5, bn = 2, xn = .38, Sn = 11, Cn = 3, wn = {
1287
1306
  top: {
1288
1307
  x: 0,
1289
1308
  y: -1
@@ -1300,17 +1319,17 @@ var un = pe(ln), dn = 1.25, fn = 7, pn = 3.5, mn = 7, hn = .4, gn = .5, _n = 2,
1300
1319
  x: -1,
1301
1320
  y: 0
1302
1321
  }
1303
- }, Sn = {
1322
+ }, Tn = {
1304
1323
  kjVXCG: "xeutv01",
1305
1324
  kfzvcC: "x47corl",
1306
1325
  $$css: !0
1307
- }, Cn = {
1326
+ }, En = {
1308
1327
  fade: (e) => [{
1309
1328
  kSiTet: e == null ? e : "xb4nw82",
1310
1329
  $$css: !0
1311
1330
  }, { "--x-opacity": e ?? void 0 }],
1312
1331
  arrow: (e, t) => [
1313
- Sn,
1332
+ Tn,
1314
1333
  {
1315
1334
  kDwRjp: e == null ? e : "x19zyb68",
1316
1335
  kSiTet: t == null ? t : "xb4nw82",
@@ -1327,7 +1346,7 @@ var un = pe(ln), dn = 1.25, fn = 7, pn = 3.5, mn = 7, hn = .4, gn = .5, _n = 2,
1327
1346
  $$css: !0
1328
1347
  }
1329
1348
  };
1330
- function wn(e, t) {
1349
+ function Dn(e, t) {
1331
1350
  let n = Math.hypot(t.x - e.x, t.y - e.y);
1332
1351
  return n === 0 ? {
1333
1352
  x: 1,
@@ -1337,155 +1356,169 @@ function wn(e, t) {
1337
1356
  y: (t.y - e.y) / n
1338
1357
  };
1339
1358
  }
1340
- function Tn(e, t) {
1359
+ function On(e, t) {
1341
1360
  let n = {
1342
1361
  x: -e.y,
1343
1362
  y: e.x
1344
- }, r = Math.abs(e.x) >= Math.abs(e.y) ? xn.top : xn.right, i = t === "auto" ? r : xn[t], a = n.x * i.x + n.y * i.y;
1345
- return (Math.abs(a) < vn ? n.x * r.x + n.y * r.y : a) < 0 ? {
1363
+ }, r = Math.abs(e.x) >= Math.abs(e.y) ? wn.top : wn.right, i = t === "auto" ? r : wn[t], a = n.x * i.x + n.y * i.y;
1364
+ return (Math.abs(a) < xn ? n.x * r.x + n.y * r.y : a) < 0 ? {
1346
1365
  x: -n.x,
1347
1366
  y: -n.y
1348
1367
  } : n;
1349
1368
  }
1350
- function En(e, t) {
1351
- let n = t.x > vn ? "start" : "middle", r = t.x < -.38 ? "end" : n, i = e.y + 8 * gn, a = t.y > vn ? e.y + yn : i;
1369
+ function kn(e, t) {
1370
+ let n = t.x > xn ? "start" : "middle", r = t.x < -.38 ? "end" : n, i = e.y + 8 * yn, a = t.y > xn ? e.y + Sn : i;
1352
1371
  return {
1353
1372
  x: e.x,
1354
- y: t.y < -.38 ? e.y - bn : a,
1373
+ y: t.y < -.38 ? e.y - Cn : a,
1355
1374
  anchor: r
1356
1375
  };
1357
1376
  }
1358
- function Dn(e) {
1359
- let t = L({
1377
+ function An(e, t) {
1378
+ let n = t ? mn : 0;
1379
+ if (e === void 0) return gn + n;
1380
+ let r = L({
1360
1381
  x: 0,
1361
1382
  y: 0,
1362
1383
  anchor: "start",
1363
1384
  text: e
1364
- });
1365
- return Math.ceil((t.right - t.left) / (_n * Math.min(hn, .6)) + fn);
1385
+ }), i = r.right - r.left + 8, a = Math.ceil(i / (bn * Math.min(vn, .6)));
1386
+ return Math.max(gn, a) + n;
1366
1387
  }
1367
- function On(e) {
1388
+ function jn(e) {
1368
1389
  return e === void 0 || e === 0 ? "neutral" : e > 0 ? "positive" : "negative";
1369
1390
  }
1370
- function kn({ from: e, to: t, id: n = `${e}>${t}`, label: r, text: a, textSide: o = "auto", weight: s, tone: c, shape: l = "straight", isDashed: u = !1, hasArrow: d = !0, isShown: f = !0, isActive: p = !1, emphasis: m }) {
1371
- let h = et([e, t]), g = h[0], _ = h[1], v = J(), y = s !== void 0 && Math.abs(s) > v.weightMax ? q(v.labels.weightOutside, {
1372
- id: n,
1391
+ function Mn({ from: e, to: t, id: r = `${e}>${t}`, label: i, text: a, textSide: o = "auto", weight: s, tone: c, shape: l = "straight", bend: u = 0, isDashed: d = !1, hasArrow: f = !0, isShown: p = !0, isActive: m = !1, emphasis: h }) {
1392
+ let g = tt([e, t]), _ = g[0], v = g[1], y = J(), b = s !== void 0 && Math.abs(s) > y.weightMax ? q(y.labels.weightOutside, {
1393
+ id: r,
1373
1394
  weight: F({
1374
1395
  value: s,
1375
- locale: v.locale,
1396
+ locale: y.locale,
1376
1397
  format: { maximumFractionDigits: 3 }
1377
1398
  }),
1378
- limit: String(v.weightMax)
1379
- }) : void 0, b = Y({
1380
- id: n,
1399
+ limit: String(y.weightMax)
1400
+ }) : void 0, x = Y({
1401
+ id: r,
1381
1402
  kind: "wire",
1382
- values: { weight: s ?? 0 },
1383
- label: r,
1403
+ values: {
1404
+ weight: s ?? 0,
1405
+ bend: l === "straight" ? u : 0
1406
+ },
1407
+ label: i,
1384
1408
  attaches: [e, t],
1385
- room: a === void 0 ? void 0 : Dn(a),
1386
- isShown: f,
1387
- isActive: p,
1388
- emphasis: m,
1389
- problem: y
1409
+ room: An(a, f),
1410
+ isShown: p,
1411
+ isActive: m,
1412
+ emphasis: h,
1413
+ problem: b
1390
1414
  });
1391
- if (!v.isInScene) return /* @__PURE__ */ G(Q, { part: "SceneWire" });
1392
- if (g === void 0 || _ === void 0) return null;
1393
- let x = g.rect, S = _.rect;
1394
- if (x === void 0 || S === void 0) return null;
1395
- let C = b.values.opacity * Math.min(g.values.opacity, _.values.opacity);
1396
- if (C <= 0) return null;
1397
- let w = Z(x), T = Z(S), E = Math.abs(T.x - w.x) >= Math.abs(T.y - w.y) ? "x" : "y", D = (E === "x" ? T.x - w.x : T.y - w.y) < 0 ? -1 : 1, O = l === "straight", k = O ? yt({
1398
- rect: x,
1399
- shape: g.member.shape,
1400
- toward: T
1401
- }) : bt({
1402
- rect: x,
1403
- axis: E,
1404
- sign: D
1405
- }), A = O ? yt({
1415
+ if (!y.isInScene) return /* @__PURE__ */ G(Q, { part: "SceneWire" });
1416
+ if (_ === void 0 || v === void 0) return null;
1417
+ let S = _.rect, C = v.rect;
1418
+ if (S === void 0 || C === void 0) return null;
1419
+ let w = x.values.opacity * Math.min(_.values.opacity, v.values.opacity);
1420
+ if (w <= 0) return null;
1421
+ let T = Z(S), E = Z(C), D = Math.abs(E.x - T.x) >= Math.abs(E.y - T.y) ? "x" : "y", O = (D === "x" ? E.x - T.x : E.y - T.y) < 0 ? -1 : 1, k = l === "straight", A = On(Dn(T, E), "auto"), j = x.values.bend * bn, M = {
1422
+ x: (T.x + E.x) * yn,
1423
+ y: (T.y + E.y) * yn
1424
+ }, P = {
1425
+ x: M.x + A.x * j,
1426
+ y: M.y + A.y * j
1427
+ }, L = k && x.values.bend !== 0, R = k ? bt({
1406
1428
  rect: S,
1407
1429
  shape: _.member.shape,
1408
- toward: w
1409
- }) : bt({
1430
+ toward: L ? P : E
1431
+ }) : xt({
1410
1432
  rect: S,
1411
- axis: E,
1412
- sign: -D
1413
- }), j = O ? wn(k, A) : E === "x" ? {
1414
- x: D,
1433
+ axis: D,
1434
+ sign: O
1435
+ }), z = k ? bt({
1436
+ rect: C,
1437
+ shape: v.member.shape,
1438
+ toward: L ? P : T
1439
+ }) : xt({
1440
+ rect: C,
1441
+ axis: D,
1442
+ sign: -O
1443
+ }), te = k ? Dn(R, z) : D === "x" ? {
1444
+ x: O,
1415
1445
  y: 0
1416
1446
  } : {
1417
1447
  x: 0,
1418
- y: D
1419
- }, M = d ? {
1420
- x: A.x - j.x * fn,
1421
- y: A.y - j.y * fn
1422
- } : A, P = O ? ae([k, M]) : ie({
1423
- x1: k.x,
1424
- y1: k.y,
1425
- x2: M.x,
1426
- y2: M.y,
1427
- axis: E,
1448
+ y: O
1449
+ }, B = L ? Dn(P, z) : te, V = f ? {
1450
+ x: z.x - B.x * mn,
1451
+ y: z.y - B.y * mn
1452
+ } : z, ae = `M${R.x},${R.y}Q${P.x},${P.y} ${V.x},${V.y}`, oe = L ? ae : ie([R, V]), se = k ? oe : re({
1453
+ x1: R.x,
1454
+ y1: R.y,
1455
+ x2: V.x,
1456
+ y2: V.y,
1457
+ axis: D,
1428
1458
  shape: l
1429
- }), L = c ?? On(s), R = b.emphasis === "context" ? Wt : N[L], ee = Math.min(1, Math.abs(b.values.weight) / v.weightMax), B = s === void 0 ? dn : dn + ee * 4.75, te = O ? hn : gn, ne = {
1430
- x: k.x + (M.x - k.x) * te,
1431
- y: k.y + (M.y - k.y) * te
1432
- }, oe = {
1433
- x: -j.y,
1434
- y: j.x
1435
- }, se = Tn(j, o), ce = En({
1436
- x: ne.x + se.x * mn,
1437
- y: ne.y + se.y * mn
1438
- }, se), le = [
1439
- `M${A.x},${A.y}`,
1440
- `L${M.x + oe.x * pn},${M.y + oe.y * pn}`,
1441
- `L${M.x - oe.x * pn},${M.y - oe.y * pn}Z`
1459
+ }), ce = c ?? jn(s), le = x.emphasis === "context" ? Gt : N[ce], ue = Math.min(1, Math.abs(x.values.weight) / y.weightMax), de = s === void 0 ? pn : pn + ue * 4.75, fe = k ? vn : yn, pe = {
1460
+ x: R.x + (V.x - R.x) * fe,
1461
+ y: R.y + (V.y - R.y) * fe
1462
+ }, me = L ? bn * fe * (1 - fe) * j : 0, he = {
1463
+ x: pe.x + A.x * me,
1464
+ y: pe.y + A.y * me
1465
+ }, U = {
1466
+ x: -B.y,
1467
+ y: B.x
1468
+ }, ge = On(te, o), _e = kn({
1469
+ x: he.x + ge.x * _n,
1470
+ y: he.y + ge.y * _n
1471
+ }, ge), W = [
1472
+ `M${z.x},${z.y}`,
1473
+ `L${V.x + U.x * hn},${V.y + U.y * hn}`,
1474
+ `L${V.x - U.x * hn},${V.y - U.y * hn}Z`
1442
1475
  ].join("");
1443
- return /* @__PURE__ */ G(Ut, {
1476
+ return /* @__PURE__ */ G(Wt, {
1444
1477
  layer: "wires",
1445
1478
  children: /* @__PURE__ */ K("g", {
1446
- "data-scene-wire": n,
1447
- ...V.props(Cn.fade(C)),
1479
+ "data-scene-wire": r,
1480
+ ...H.props(En.fade(w)),
1448
1481
  children: [
1449
- /* @__PURE__ */ G(re, {
1450
- d: P,
1451
- tone: L,
1452
- width: b.isInspected ? B + 1 : B,
1453
- stroke: u ? "dashed" : "solid",
1454
- emphasis: b.emphasis
1482
+ /* @__PURE__ */ G(ne, {
1483
+ d: se,
1484
+ tone: ce,
1485
+ width: x.isInspected ? de + 1 : de,
1486
+ stroke: d ? "dashed" : "solid",
1487
+ emphasis: x.emphasis
1455
1488
  }),
1456
- d && /* @__PURE__ */ G("path", {
1457
- d: le,
1458
- ...V.props(Cn.arrow(R, b.strength))
1489
+ f && /* @__PURE__ */ G("path", {
1490
+ d: W,
1491
+ ...H.props(En.arrow(le, x.strength))
1459
1492
  }),
1460
- a !== void 0 && /* @__PURE__ */ G(z, {
1461
- x: ce.x,
1462
- y: ce.y,
1463
- anchor: ce.anchor,
1493
+ a !== void 0 && /* @__PURE__ */ G(ee, {
1494
+ x: _e.x,
1495
+ y: _e.y,
1496
+ anchor: _e.anchor,
1464
1497
  children: a
1465
1498
  }),
1466
- r !== void 0 && f && /* @__PURE__ */ G(i, {
1467
- value: n,
1468
- render: /* @__PURE__ */ G("path", { d: P }),
1499
+ i !== void 0 && p && /* @__PURE__ */ G(n, {
1500
+ value: r,
1501
+ render: /* @__PURE__ */ G("path", { d: se }),
1469
1502
  className: "xbh8q5q xmy28x3 x1qrb80n x1bz8pot x1t137rt"
1470
1503
  }),
1471
- b.isCursor && /* @__PURE__ */ G("path", {
1472
- d: P,
1473
- ...V.props(I.shapeCursor, Cn.cursor)
1504
+ x.isCursor && /* @__PURE__ */ G("path", {
1505
+ d: se,
1506
+ ...H.props(I.shapeCursor, En.cursor)
1474
1507
  })
1475
1508
  ]
1476
1509
  })
1477
1510
  });
1478
1511
  }
1479
1512
  // packages/teaching/src/scene/scene-group.tsx
1480
- var An = 18, jn = 8, Mn = 7, Nn = 13, Pn = 6, Fn = {
1513
+ var Nn = 18, Pn = 8, Fn = 7, In = 13, Ln = 6, Rn = {
1481
1514
  kDwRjp: "x19zyb68",
1482
1515
  kfJifR: "xnpr05h",
1483
1516
  kREpy8: "x13efnbd",
1484
1517
  k3XXqK: "x1t137rt",
1485
1518
  $$css: !0
1486
- }, In = {
1519
+ }, zn = {
1487
1520
  outline: (e, t) => [
1488
- Fn,
1521
+ Rn,
1489
1522
  {
1490
1523
  kjVXCG: e == null ? e : "x6mkzkt",
1491
1524
  kSiTet: t == null ? t : "xb4nw82",
@@ -1511,15 +1544,15 @@ var An = 18, jn = 8, Mn = 7, Nn = 13, Pn = 6, Fn = {
1511
1544
  $$css: !0
1512
1545
  }, { "--x-opacity": e ?? void 0 }]
1513
1546
  };
1514
- function Ln({ id: e, label: t, text: n, around: r, tone: a, padding: o = 10, isShown: s = !0, isActive: c = !1, emphasis: l }) {
1515
- let u = et(r), d = b(e), f = n ?? t, p = Y({
1547
+ function Bn({ id: e, label: t, text: r, around: i, tone: a, padding: o = 10, isShown: s = !0, isActive: c = !1, emphasis: l }) {
1548
+ let u = tt(i), d = b(e), f = r ?? t, p = Y({
1516
1549
  id: e,
1517
1550
  kind: "group",
1518
1551
  values: {},
1519
1552
  label: t,
1520
- attaches: r,
1553
+ attaches: i,
1521
1554
  surround: {
1522
- top: o + (f === void 0 ? 0 : An),
1555
+ top: o + (f === void 0 ? 0 : Nn),
1523
1556
  right: o,
1524
1557
  bottom: o,
1525
1558
  left: o
@@ -1529,31 +1562,31 @@ function Ln({ id: e, label: t, text: n, around: r, tone: a, padding: o = 10, isS
1529
1562
  emphasis: l
1530
1563
  });
1531
1564
  if (!p.scene.isInScene) return /* @__PURE__ */ G(Q, { part: "SceneGroup" });
1532
- let m = pt(u.flatMap((e) => e?.rect === void 0 || e.values.opacity <= 0 ? [] : [e.rect]));
1565
+ let m = mt(u.flatMap((e) => e?.rect === void 0 || e.values.opacity <= 0 ? [] : [e.rect]));
1533
1566
  if (m === void 0 || p.values.opacity <= 0) return null;
1534
- let h = mt(m, o), g = f === void 0 ? h.top : h.top - An, _ = a ?? d ?? "neutral", v = p.emphasis === "context" ? Wt : N[_], y = Math.max(h.right - h.left, (f?.length ?? 0) * Mn + 16), x = Math.min(h.left, (h.left + h.right - y) / 2), S = h.left < jn ? x : Math.max(jn, x), C = h.bottom - g, w = /* @__PURE__ */ G("rect", {
1567
+ let h = ht(m, o), g = f === void 0 ? h.top : h.top - Nn, _ = a ?? d ?? "neutral", v = p.emphasis === "context" ? Gt : N[_], y = Math.max(h.right - h.left, (f?.length ?? 0) * Fn + 16), x = Math.min(h.left, (h.left + h.right - y) / 2), S = h.left < Pn ? x : Math.max(Pn, x), C = h.bottom - g, w = /* @__PURE__ */ G("rect", {
1535
1568
  x: S,
1536
1569
  y: g,
1537
1570
  width: y,
1538
1571
  height: C,
1539
- rx: Pn,
1540
- ry: Pn
1572
+ rx: Ln,
1573
+ ry: Ln
1541
1574
  });
1542
- return /* @__PURE__ */ G(Ut, {
1575
+ return /* @__PURE__ */ G(Wt, {
1543
1576
  layer: "back",
1544
1577
  children: /* @__PURE__ */ K("g", {
1545
- ...V.props(In.fade(p.strength)),
1578
+ ...H.props(zn.fade(p.strength)),
1546
1579
  children: [
1547
- /* @__PURE__ */ G(i, {
1580
+ /* @__PURE__ */ G(n, {
1548
1581
  value: e,
1549
1582
  render: w,
1550
- ...V.props(In.outline(v, p.values.opacity), p.isInspected && In.inspected)
1583
+ ...H.props(zn.outline(v, p.values.opacity), p.isInspected && zn.inspected)
1551
1584
  }),
1552
1585
  f !== void 0 && /* @__PURE__ */ G("g", {
1553
- ...V.props(In.fade(p.values.opacity)),
1554
- children: /* @__PURE__ */ G(z, {
1555
- x: S + jn,
1556
- y: g + Nn,
1586
+ ...H.props(zn.fade(p.values.opacity)),
1587
+ children: /* @__PURE__ */ G(ee, {
1588
+ x: S + Pn,
1589
+ y: g + In,
1557
1590
  isStrong: !0,
1558
1591
  children: f
1559
1592
  })
@@ -1563,27 +1596,27 @@ function Ln({ id: e, label: t, text: n, around: r, tone: a, padding: o = 10, isS
1563
1596
  y: g,
1564
1597
  width: y,
1565
1598
  height: C,
1566
- rx: Pn,
1567
- ry: Pn,
1568
- ...V.props(I.shapeCursor, In.cursor)
1599
+ rx: Ln,
1600
+ ry: Ln,
1601
+ ...H.props(I.shapeCursor, zn.cursor)
1569
1602
  })
1570
1603
  ]
1571
1604
  })
1572
1605
  });
1573
1606
  }
1574
1607
  // packages/teaching/src/scene/scene-bracket.tsx
1575
- var Rn = 6, zn = 14, Bn = 6, Vn = 6.5, Hn = 4, Un = /* @__PURE__ */ new Set(["top", "bottom"]), Wn = {
1608
+ var Vn = 6, Hn = 14, Un = 6, Wn = 6.5, Gn = 4, Kn = /* @__PURE__ */ new Set(["top", "bottom"]), qn = {
1576
1609
  top: "bottom",
1577
1610
  bottom: "top",
1578
1611
  left: "right",
1579
1612
  right: "left"
1580
- }, Gn = { fade: (e) => [{
1613
+ }, Jn = { fade: (e) => [{
1581
1614
  kSiTet: e == null ? e : "xb4nw82",
1582
1615
  $$css: !0
1583
1616
  }, { "--x-opacity": e ?? void 0 }] };
1584
- function Kn({ bounds: e, side: t, padding: n, textWidth: r, stage: i }) {
1585
- let a = Math.min(i.width - r / 2 - Hn, Math.max(r / 2 + Hn, (e.left + e.right) / 2)), o = (e.top + e.bottom) / 2;
1586
- if (Un.has(t)) {
1617
+ function Yn({ bounds: e, side: t, padding: n, textWidth: r, stage: i }) {
1618
+ let a = Math.min(i.width - r / 2 - Gn, Math.max(r / 2 + Gn, (e.left + e.right) / 2)), o = (e.top + e.bottom) / 2;
1619
+ if (Kn.has(t)) {
1587
1620
  let r = t === "bottom" ? 1 : -1, i = t === "bottom" ? e.bottom + n : e.top - n;
1588
1621
  return {
1589
1622
  lines: [
@@ -1599,26 +1632,26 @@ function Kn({ bounds: e, side: t, padding: n, textWidth: r, stage: i }) {
1599
1632
  x1: e.left,
1600
1633
  y1: i,
1601
1634
  x2: e.left,
1602
- y2: i - r * Rn
1635
+ y2: i - r * Vn
1603
1636
  },
1604
1637
  {
1605
1638
  key: "end",
1606
1639
  x1: e.right,
1607
1640
  y1: i,
1608
1641
  x2: e.right,
1609
- y2: i - r * Rn
1642
+ y2: i - r * Vn
1610
1643
  }
1611
1644
  ],
1612
1645
  label: {
1613
1646
  x: a,
1614
- y: t === "bottom" ? i + zn : i - Bn,
1647
+ y: t === "bottom" ? i + Hn : i - Un,
1615
1648
  anchor: "middle"
1616
1649
  },
1617
1650
  hit: {
1618
1651
  left: e.left,
1619
- top: i - Rn,
1652
+ top: i - Vn,
1620
1653
  right: e.right,
1621
- bottom: i + Rn
1654
+ bottom: i + Vn
1622
1655
  }
1623
1656
  };
1624
1657
  }
@@ -1636,31 +1669,31 @@ function Kn({ bounds: e, side: t, padding: n, textWidth: r, stage: i }) {
1636
1669
  key: "start",
1637
1670
  x1: c,
1638
1671
  y1: e.top,
1639
- x2: c - s * Rn,
1672
+ x2: c - s * Vn,
1640
1673
  y2: e.top
1641
1674
  },
1642
1675
  {
1643
1676
  key: "end",
1644
1677
  x1: c,
1645
1678
  y1: e.bottom,
1646
- x2: c - s * Rn,
1679
+ x2: c - s * Vn,
1647
1680
  y2: e.bottom
1648
1681
  }
1649
1682
  ],
1650
1683
  label: {
1651
- x: c + s * Bn,
1652
- y: o + Hn,
1684
+ x: c + s * Un,
1685
+ y: o + Gn,
1653
1686
  anchor: t === "right" ? "start" : "end"
1654
1687
  },
1655
1688
  hit: {
1656
- left: c - Rn,
1689
+ left: c - Vn,
1657
1690
  top: e.top,
1658
- right: c + Rn,
1691
+ right: c + Vn,
1659
1692
  bottom: e.bottom
1660
1693
  }
1661
1694
  };
1662
1695
  }
1663
- function qn({ bounds: e, side: t, room: n, stage: r }) {
1696
+ function Xn({ bounds: e, side: t, room: n, stage: r }) {
1664
1697
  return {
1665
1698
  top: e.top,
1666
1699
  bottom: r.height - e.bottom,
@@ -1668,51 +1701,51 @@ function qn({ bounds: e, side: t, room: n, stage: r }) {
1668
1701
  right: r.width - e.right
1669
1702
  }[t] >= n;
1670
1703
  }
1671
- function Jn({ of: e, id: t = `bracket:${e[0] ?? ""}`, label: n, text: r, side: a = "bottom", padding: o = 8, isShown: s = !0 }) {
1672
- let c = et(e), l = Y({
1704
+ function Zn({ of: e, id: t = `bracket:${e[0] ?? ""}`, label: r, text: i, side: a = "bottom", padding: o = 8, isShown: s = !0 }) {
1705
+ let c = tt(e), l = Y({
1673
1706
  id: t,
1674
1707
  kind: "bracket",
1675
1708
  values: {},
1676
- label: n,
1709
+ label: r,
1677
1710
  attaches: e,
1678
1711
  isShown: s
1679
1712
  }), { scene: u } = l;
1680
1713
  if (!u.isInScene) return /* @__PURE__ */ G(Q, { part: "SceneBracket" });
1681
- let d = pt(c.flatMap((e) => e?.rect === void 0 ? [] : [e.rect])), f = r ?? n, p = (f?.length ?? 0) * Vn;
1714
+ let d = mt(c.flatMap((e) => e?.rect === void 0 ? [] : [e.rect])), f = i ?? r, p = (f?.length ?? 0) * Wn;
1682
1715
  if (d === void 0 || l.values.opacity <= 0) return null;
1683
1716
  let m = {
1684
1717
  width: u.box.width,
1685
1718
  height: u.box.height
1686
- }, h = Kn({
1719
+ }, h = Yn({
1687
1720
  bounds: d,
1688
- side: qn({
1721
+ side: Xn({
1689
1722
  bounds: d,
1690
1723
  side: a,
1691
- room: o + (Un.has(a) ? 18 : p + Bn + Hn),
1724
+ room: o + (Kn.has(a) ? 18 : p + Un + Gn),
1692
1725
  stage: m
1693
- }) ? a : Wn[a],
1726
+ }) ? a : qn[a],
1694
1727
  padding: o,
1695
1728
  textWidth: p,
1696
1729
  stage: m
1697
1730
  }), { hit: g } = h;
1698
- return /* @__PURE__ */ G(Ut, {
1731
+ return /* @__PURE__ */ G(Wt, {
1699
1732
  layer: "front",
1700
1733
  children: /* @__PURE__ */ K("g", {
1701
- ...V.props(Gn.fade(l.values.opacity)),
1734
+ ...H.props(Jn.fade(l.values.opacity)),
1702
1735
  children: [
1703
- h.lines.map((e) => /* @__PURE__ */ G(B, {
1736
+ h.lines.map((e) => /* @__PURE__ */ G(te, {
1704
1737
  x1: e.x1,
1705
1738
  y1: e.y1,
1706
1739
  x2: e.x2,
1707
1740
  y2: e.y2
1708
1741
  }, e.key)),
1709
- f !== void 0 && /* @__PURE__ */ G(z, {
1742
+ f !== void 0 && /* @__PURE__ */ G(ee, {
1710
1743
  x: h.label.x,
1711
1744
  y: h.label.y,
1712
1745
  anchor: h.label.anchor,
1713
1746
  children: f
1714
1747
  }),
1715
- n !== void 0 && s && /* @__PURE__ */ G(i, {
1748
+ r !== void 0 && s && /* @__PURE__ */ G(n, {
1716
1749
  value: t,
1717
1750
  render: /* @__PURE__ */ G("rect", {
1718
1751
  x: g.left,
@@ -1727,10 +1760,10 @@ function Jn({ of: e, id: t = `bracket:${e[0] ?? ""}`, label: n, text: r, side: a
1727
1760
  });
1728
1761
  }
1729
1762
  // packages/teaching/src/scene/scene-obstacles.ts
1730
- function Yn(e, t) {
1763
+ function Qn(e, t) {
1731
1764
  return e.left === t.left && e.right === t.right && e.top === t.top && e.bottom === t.bottom;
1732
1765
  }
1733
- function Xn() {
1766
+ function $n() {
1734
1767
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = { version: 0 };
1735
1768
  function i() {
1736
1769
  r.version += 1;
@@ -1742,7 +1775,7 @@ function Xn() {
1742
1775
  },
1743
1776
  claim: (e, n) => {
1744
1777
  let r = t.get(e);
1745
- n === null ? t.delete(e) && i() : r !== void 0 && Yn(r, n) || (t.set(e, n), i());
1778
+ n === null ? t.delete(e) && i() : r !== void 0 && Qn(r, n) || (t.set(e, n), i());
1746
1779
  },
1747
1780
  lines: (t) => Array.from(e, ([e, n]) => e === t ? [] : [n]).flat(),
1748
1781
  taken: (e) => {
@@ -1755,36 +1788,36 @@ function Xn() {
1755
1788
  })
1756
1789
  };
1757
1790
  }
1758
- var Zn = je(Xn);
1759
- function Qn({ id: e, line: t }) {
1760
- let { registry: n } = J(), r = Zn(n);
1791
+ var er = Me($n);
1792
+ function tr({ id: e, line: t }) {
1793
+ let { registry: n } = J(), r = er(n);
1761
1794
  U(() => {
1762
1795
  r.set(e, t);
1763
1796
  }), U(() => () => {
1764
1797
  r.set(e, null);
1765
1798
  }, [r, e]);
1766
1799
  }
1767
- function $n(e) {
1768
- let t = J(), n = Zn(t.registry);
1800
+ function nr(e) {
1801
+ let t = J(), n = er(t.registry);
1769
1802
  return ve(n.subscribe, n.version, n.version), n.lines(e).map((e) => e.map((e) => ({
1770
1803
  x: t.x.position(e.x),
1771
1804
  y: t.y.position(e.y)
1772
1805
  })));
1773
1806
  }
1774
- function er(e) {
1775
- let { registry: t } = J(), n = Zn(t);
1807
+ function rr(e) {
1808
+ let { registry: t } = J(), n = er(t);
1776
1809
  return ve(n.subscribe, n.version, n.version), n.taken(e);
1777
1810
  }
1778
- function tr(e, t) {
1779
- let { registry: n } = J(), r = Zn(n);
1811
+ function ir(e, t) {
1812
+ let { registry: n } = J(), r = er(n);
1780
1813
  U(() => {
1781
1814
  r.claim(e, t);
1782
1815
  }), U(() => () => {
1783
1816
  r.claim(e, null);
1784
1817
  }, [r, e]);
1785
1818
  }
1786
- function nr({ id: e, owner: t, spots: n, lines: r }) {
1787
- let { box: i } = J(), a = $n(t), o = er(e), s = n.filter((e) => {
1819
+ function ar({ id: e, owner: t, spots: n, lines: r }) {
1820
+ let { box: i } = J(), a = nr(t), o = rr(e), s = n.filter((e) => {
1788
1821
  let t = L(e);
1789
1822
  return t.left >= i.left && t.right <= i.right && t.top >= i.top && t.bottom <= i.bottom;
1790
1823
  }), c = R({
@@ -1792,23 +1825,23 @@ function nr({ id: e, owner: t, spots: n, lines: r }) {
1792
1825
  lines: [...a, ...r],
1793
1826
  taken: o
1794
1827
  });
1795
- return tr(e, c === void 0 ? null : L(c)), c;
1828
+ return ir(e, c === void 0 ? null : L(c)), c;
1796
1829
  }
1797
1830
  // packages/teaching/src/scene/scene-callout.tsx
1798
- var rr = 18, ir = 4, ar = 40, or = [
1831
+ var or = 18, sr = 4, cr = 40, lr = [
1799
1832
  "right",
1800
1833
  "left",
1801
1834
  "bottom",
1802
1835
  "top"
1803
- ], sr = [
1836
+ ], ur = [
1804
1837
  "center",
1805
1838
  "start",
1806
1839
  "end"
1807
- ], cr = [
1840
+ ], dr = [
1808
1841
  1,
1809
1842
  .8,
1810
1843
  .64
1811
- ], lr = 1e3, ur = 40, dr = 10, fr = 4, pr = 60, mr = {
1844
+ ], fr = 1e3, pr = 40, mr = 10, hr = 4, gr = 60, _r = {
1812
1845
  kVAEAm: "x10l6tqk",
1813
1846
  kbCHJM: "xu96u03",
1814
1847
  k87sOh: "x13vifvy",
@@ -1827,20 +1860,20 @@ var rr = 18, ir = 4, ar = 40, or = [
1827
1860
  kHjlTd: "xj0a0fe",
1828
1861
  kfzvcC: "x67bb7w",
1829
1862
  $$css: !0
1830
- }, hr = {
1863
+ }, vr = {
1831
1864
  kjVXCG: "xhq4mlf",
1832
1865
  kfJifR: "xnpr05h",
1833
1866
  kDwRjp: "xbh8q5q",
1834
1867
  kREpy8: "x13efnbd",
1835
1868
  kfzvcC: "x47corl",
1836
1869
  $$css: !0
1837
- }, gr = {
1870
+ }, yr = {
1838
1871
  kDwRjp: "x1q7gtio",
1839
1872
  kfzvcC: "x47corl",
1840
1873
  $$css: !0
1841
- }, _r = {
1874
+ }, br = {
1842
1875
  callout: (e, t) => [
1843
- mr,
1876
+ _r,
1844
1877
  {
1845
1878
  kzqmXN: t == null ? t : "x5lhr3w",
1846
1879
  k3aq6I: e == null ? e : "xsqj5wx",
@@ -1860,7 +1893,7 @@ var rr = 18, ir = 4, ar = 40, or = [
1860
1893
  $$css: !0
1861
1894
  },
1862
1895
  leader: (e) => [
1863
- hr,
1896
+ vr,
1864
1897
  {
1865
1898
  kSiTet: e == null ? e : "xb4nw82",
1866
1899
  $$css: !0
@@ -1868,7 +1901,7 @@ var rr = 18, ir = 4, ar = 40, or = [
1868
1901
  { "--x-opacity": e ?? void 0 }
1869
1902
  ],
1870
1903
  end: (e) => [
1871
- gr,
1904
+ yr,
1872
1905
  {
1873
1906
  kSiTet: e == null ? e : "xb4nw82",
1874
1907
  $$css: !0
@@ -1876,7 +1909,7 @@ var rr = 18, ir = 4, ar = 40, or = [
1876
1909
  { "--x-opacity": e ?? void 0 }
1877
1910
  ]
1878
1911
  };
1879
- function vr({ side: e, alignment: t, target: n, size: r, stage: i }) {
1912
+ function xr({ side: e, alignment: t, target: n, size: r, stage: i }) {
1880
1913
  let a = Z(n), { width: o, height: s } = r, c = {
1881
1914
  center: a.x - o / 2,
1882
1915
  start: n.left,
@@ -1885,22 +1918,22 @@ function vr({ side: e, alignment: t, target: n, size: r, stage: i }) {
1885
1918
  center: a.y - s / 2,
1886
1919
  start: n.top,
1887
1920
  end: n.bottom - s
1888
- }, u = Math.min(i.width - o - ir, Math.max(ir, c[t])), d = Math.min(i.height - s - ir, Math.max(ir, l[t])), f = {
1921
+ }, u = Math.min(i.width - o - sr, Math.max(sr, c[t])), d = Math.min(i.height - s - sr, Math.max(sr, l[t])), f = {
1889
1922
  right: {
1890
- x: n.right + rr,
1923
+ x: n.right + or,
1891
1924
  y: d
1892
1925
  },
1893
1926
  left: {
1894
- x: n.left - rr - o,
1927
+ x: n.left - or - o,
1895
1928
  y: d
1896
1929
  },
1897
1930
  bottom: {
1898
1931
  x: u,
1899
- y: n.bottom + rr
1932
+ y: n.bottom + or
1900
1933
  },
1901
1934
  top: {
1902
1935
  x: u,
1903
- y: n.top - rr - s
1936
+ y: n.top - or - s
1904
1937
  }
1905
1938
  }[e];
1906
1939
  return {
@@ -1910,10 +1943,10 @@ function vr({ side: e, alignment: t, target: n, size: r, stage: i }) {
1910
1943
  bottom: f.y + s
1911
1944
  };
1912
1945
  }
1913
- function yr(e, t) {
1914
- return e.left >= 3 && e.right <= t.width - ir + 1 && e.top >= 3 && e.bottom <= t.height - ir + 1;
1946
+ function Sr(e, t) {
1947
+ return e.left >= 3 && e.right <= t.width - sr + 1 && e.top >= 3 && e.bottom <= t.height - sr + 1;
1915
1948
  }
1916
- function br(e, t, n) {
1949
+ function Cr(e, t, n) {
1917
1950
  let r = Z(t), i = e.registry.members().list.filter((e) => e.isShown && e.id !== n);
1918
1951
  function a(t) {
1919
1952
  let n = e.registry.member(t);
@@ -1930,45 +1963,45 @@ function br(e, t, n) {
1930
1963
  })
1931
1964
  };
1932
1965
  }
1933
- function xr(e, t) {
1934
- return t.flatMap((t) => t.slice(1).map((n, r) => _t({
1966
+ function wr(e, t) {
1967
+ return t.flatMap((t) => t.slice(1).map((n, r) => vt({
1935
1968
  rect: e,
1936
1969
  from: t[r] ?? n,
1937
1970
  to: n
1938
1971
  }))).reduce((e, t) => e + t, 0);
1939
1972
  }
1940
- function Sr(e, t) {
1941
- return t.map((t) => gt(e, t)).reduce((e, t) => e + t, 0);
1973
+ function Tr(e, t) {
1974
+ return t.map((t) => _t(e, t)).reduce((e, t) => e + t, 0);
1942
1975
  }
1943
- function Cr(e, t) {
1976
+ function Er(e, t) {
1944
1977
  return {
1945
1978
  x: Math.min(e.right, Math.max(e.left, t.x)),
1946
1979
  y: Math.min(e.bottom, Math.max(e.top, t.y))
1947
1980
  };
1948
1981
  }
1949
- function wr({ scene: e, to: t, target: n, side: r, width: i, measured: a, avoided: o }) {
1982
+ function Dr({ scene: e, to: t, target: n, side: r, width: i, measured: a, avoided: o }) {
1950
1983
  let s = {
1951
1984
  width: e.box.width,
1952
1985
  height: e.box.height
1953
- }, c = r === "auto" ? or : [r, ...or.filter((e) => e !== r)], l = a.width * a.height, u = br(e, n, t), d = [...u.boxes, ...o.boxes], f = [...u.lines, ...o.lines], p = cr.flatMap((e, t) => {
1986
+ }, c = r === "auto" ? lr : [r, ...lr.filter((e) => e !== r)], l = a.width * a.height, u = Cr(e, n, t), d = [...u.boxes, ...o.boxes], f = [...u.lines, ...o.lines], p = dr.flatMap((e, t) => {
1954
1987
  let r = {
1955
1988
  width: Math.round(i * e),
1956
1989
  height: Math.ceil(l / Math.round(i * e))
1957
1990
  };
1958
- return c.flatMap((e, i) => sr.flatMap((a, o) => {
1959
- let c = vr({
1991
+ return c.flatMap((e, i) => ur.flatMap((a, o) => {
1992
+ let c = xr({
1960
1993
  side: e,
1961
1994
  alignment: a,
1962
1995
  target: n,
1963
1996
  size: r,
1964
1997
  stage: s
1965
- }), l = i * ur + o * dr + t * pr, u = Sr(c, d) * lr + xr(c, f) * fr + l;
1966
- return yr(c, s) ? [{
1998
+ }), l = i * pr + o * mr + t * gr, u = Tr(c, d) * fr + wr(c, f) * hr + l;
1999
+ return Sr(c, s) ? [{
1967
2000
  rect: c,
1968
2001
  cost: u
1969
2002
  }] : [];
1970
2003
  }));
1971
- }).toSorted((e, t) => e.cost - t.cost)[0], m = vr({
2004
+ }).toSorted((e, t) => e.cost - t.cost)[0], m = xr({
1972
2005
  side: c[0] ?? "right",
1973
2006
  alignment: "center",
1974
2007
  target: n,
@@ -1977,8 +2010,8 @@ function wr({ scene: e, to: t, target: n, side: r, width: i, measured: a, avoide
1977
2010
  });
1978
2011
  return p?.rect ?? m;
1979
2012
  }
1980
- function Tr({ to: e, id: t = `callout:${e}`, side: n = "auto", width: r = 176, isShown: i = !0, children: a }) {
1981
- let [o] = et([e]), s = Y({
2013
+ function Or({ to: e, id: t = `callout:${e}`, side: n = "auto", width: r = 176, isShown: i = !0, children: a }) {
2014
+ let [o] = tt([e]), s = Y({
1982
2015
  id: t,
1983
2016
  kind: "callout",
1984
2017
  values: {},
@@ -1986,11 +2019,11 @@ function Tr({ to: e, id: t = `callout:${e}`, side: n = "auto", width: r = 176, i
1986
2019
  isShown: i
1987
2020
  }), [c, l] = W(null), [u, d] = W({
1988
2021
  width: r,
1989
- height: ar
2022
+ height: cr
1990
2023
  }), f = {
1991
- boxes: er(t),
1992
- lines: $n(e)
1993
- }, { scene: p } = s, m = o?.rect, h = m === void 0 || !p.isInScene ? void 0 : wr({
2024
+ boxes: rr(t),
2025
+ lines: nr(e)
2026
+ }, { scene: p } = s, m = o?.rect, h = m === void 0 || !p.isInScene ? void 0 : Dr({
1994
2027
  scene: p,
1995
2028
  to: e,
1996
2029
  target: m,
@@ -1999,7 +2032,7 @@ function Tr({ to: e, id: t = `callout:${e}`, side: n = "auto", width: r = 176, i
1999
2032
  measured: u,
2000
2033
  avoided: f
2001
2034
  });
2002
- if (tr(t, i && h !== void 0 ? h : null), U(() => {
2035
+ if (ir(t, i && h !== void 0 ? h : null), U(() => {
2003
2036
  if (c === null) return;
2004
2037
  let e = new ResizeObserver(() => d((e) => e.width === c.offsetWidth && e.height === c.offsetHeight ? e : {
2005
2038
  width: c.offsetWidth,
@@ -2008,41 +2041,41 @@ function Tr({ to: e, id: t = `callout:${e}`, side: n = "auto", width: r = 176, i
2008
2041
  return e.observe(c), () => e.disconnect();
2009
2042
  }, [c]), !p.isInScene) return /* @__PURE__ */ G(Q, { part: "SceneCallout" });
2010
2043
  if (o === void 0 || m === void 0 || h === void 0) return null;
2011
- let g = s.values.opacity * o.values.opacity, _ = Cr(h, Z(m)), v = yt({
2044
+ let g = s.values.opacity * o.values.opacity, _ = Er(h, Z(m)), v = bt({
2012
2045
  rect: m,
2013
2046
  shape: o.member.shape,
2014
2047
  toward: _
2015
2048
  });
2016
- return /* @__PURE__ */ K(xe, { children: [/* @__PURE__ */ K(Ut, {
2049
+ return /* @__PURE__ */ K(xe, { children: [/* @__PURE__ */ K(Wt, {
2017
2050
  layer: "front",
2018
2051
  children: [/* @__PURE__ */ G("line", {
2019
2052
  x1: _.x,
2020
2053
  y1: _.y,
2021
2054
  x2: v.x,
2022
2055
  y2: v.y,
2023
- ...V.props(_r.leader(g))
2056
+ ...H.props(br.leader(g))
2024
2057
  }), /* @__PURE__ */ G("circle", {
2025
2058
  cx: v.x,
2026
2059
  cy: v.y,
2027
2060
  r: 2,
2028
- ...V.props(_r.end(g))
2061
+ ...H.props(br.end(g))
2029
2062
  })]
2030
2063
  }), /* @__PURE__ */ G("div", {
2031
2064
  ref: l,
2032
2065
  "aria-hidden": !i || void 0,
2033
- ...V.props(_r.callout(`translate(${h.left}px, ${h.top}px)`, h.right - h.left), _r.fade(g), !s.isVisible && _r.gone),
2066
+ ...H.props(br.callout(`translate(${h.left}px, ${h.top}px)`, h.right - h.left), br.fade(g), !s.isVisible && br.gone),
2034
2067
  children: a
2035
2068
  })] });
2036
2069
  }
2037
2070
  // packages/teaching/src/scene/scene-highlight.tsx
2038
- var Er = 8, Dr = {
2071
+ var kr = 8, Ar = {
2039
2072
  kDwRjp: "x19zyb68",
2040
2073
  kfJifR: "xhr4kjn",
2041
2074
  kREpy8: "x13efnbd",
2042
2075
  kfzvcC: "x47corl",
2043
2076
  $$css: !0
2044
- }, Or = { halo: (e, t) => [
2045
- Dr,
2077
+ }, jr = { halo: (e, t) => [
2078
+ Ar,
2046
2079
  {
2047
2080
  kjVXCG: e == null ? e : "x6mkzkt",
2048
2081
  kSiTet: t == null ? t : "xb4nw82",
@@ -2054,8 +2087,8 @@ var Er = 8, Dr = {
2054
2087
  "--x-opacity": t ?? void 0
2055
2088
  }
2056
2089
  ] };
2057
- function kr({ of: e, id: t, tone: n, padding: r = 6, isShown: i = !0 }) {
2058
- let a = typeof e == "string" ? [e] : e, o = et(a), s = Y({
2090
+ function Mr({ of: e, id: t, tone: n, padding: r = 6, isShown: i = !0 }) {
2091
+ let a = typeof e == "string" ? [e] : e, o = tt(a), s = Y({
2059
2092
  id: t ?? `highlight:${a.join(",")}`,
2060
2093
  kind: "highlight",
2061
2094
  values: {},
@@ -2065,28 +2098,28 @@ function kr({ of: e, id: t, tone: n, padding: r = 6, isShown: i = !0 }) {
2065
2098
  if (!s.scene.isInScene) return /* @__PURE__ */ G(Q, { part: "SceneHighlight" });
2066
2099
  if (s.values.opacity <= 0) return null;
2067
2100
  let c = n === void 0 ? P.ink : N[n];
2068
- return /* @__PURE__ */ G(Ut, {
2101
+ return /* @__PURE__ */ G(Wt, {
2069
2102
  layer: "back",
2070
2103
  children: o.map((e, t) => {
2071
2104
  let n = e?.rect;
2072
2105
  if (e === void 0 || n === void 0) return null;
2073
- let i = mt(n, r), o = e.member.shape === "circle";
2106
+ let i = ht(n, r), o = e.member.shape === "circle";
2074
2107
  return /* @__PURE__ */ G("rect", {
2075
2108
  x: i.left,
2076
2109
  y: i.top,
2077
2110
  width: i.right - i.left,
2078
2111
  height: i.bottom - i.top,
2079
- rx: o ? (i.right - i.left) / 2 : Er,
2080
- ry: o ? (i.bottom - i.top) / 2 : Er,
2081
- ...V.props(Or.halo(c, s.values.opacity * e.values.opacity))
2112
+ rx: o ? (i.right - i.left) / 2 : kr,
2113
+ ry: o ? (i.bottom - i.top) / 2 : kr,
2114
+ ...H.props(jr.halo(c, s.values.opacity * e.values.opacity))
2082
2115
  }, a[t]);
2083
2116
  })
2084
2117
  });
2085
2118
  }
2086
2119
  // packages/teaching/src/scene/scene-custom.tsx
2087
- function Ar({ layer: e = "front", children: t }) {
2120
+ function Nr({ layer: e = "front", children: t }) {
2088
2121
  let n = J();
2089
- return n.isInScene ? /* @__PURE__ */ G(Ut, {
2122
+ return n.isInScene ? /* @__PURE__ */ G(Wt, {
2090
2123
  layer: e,
2091
2124
  children: t({
2092
2125
  x: n.x,
@@ -2099,7 +2132,7 @@ function Ar({ layer: e = "front", children: t }) {
2099
2132
  }) : /* @__PURE__ */ G(Q, { part: "SceneCustom" });
2100
2133
  }
2101
2134
  // packages/teaching/src/scene/plane/plane-hit.tsx
2102
- var jr = {
2135
+ var Pr = {
2103
2136
  fade: (e) => [{
2104
2137
  kSiTet: Math.max(0, Math.min(1, e)) == null ? Math.max(0, Math.min(1, e)) : "xb4nw82",
2105
2138
  $$css: !0
@@ -2125,37 +2158,37 @@ var jr = {
2125
2158
  $$css: !0
2126
2159
  }
2127
2160
  };
2128
- function Mr({ id: e, layer: t, opacity: n, children: r }) {
2129
- return /* @__PURE__ */ G(Ut, {
2161
+ function Fr({ id: e, layer: t, opacity: n, children: r }) {
2162
+ return /* @__PURE__ */ G(Wt, {
2130
2163
  layer: t,
2131
2164
  children: /* @__PURE__ */ G("g", {
2132
2165
  "data-scene-plane": e,
2133
- ...V.props(jr.fade(n)),
2166
+ ...H.props(Pr.fade(n)),
2134
2167
  children: r
2135
2168
  })
2136
2169
  });
2137
2170
  }
2138
- function Nr({ id: e, d: t, hasLabel: n, isCursor: r, reach: a = "stroke" }) {
2139
- return /* @__PURE__ */ K(xe, { children: [n && /* @__PURE__ */ G(i, {
2171
+ function Ir({ id: e, d: t, hasLabel: r, isCursor: i, reach: a = "stroke" }) {
2172
+ return /* @__PURE__ */ K(xe, { children: [r && /* @__PURE__ */ G(n, {
2140
2173
  value: e,
2141
2174
  render: /* @__PURE__ */ G("path", { d: t }),
2142
- ...V.props(jr[a])
2143
- }), r && /* @__PURE__ */ G("path", {
2175
+ ...H.props(Pr[a])
2176
+ }), i && /* @__PURE__ */ G("path", {
2144
2177
  d: t,
2145
- ...V.props(I.shapeCursor, jr.cursor)
2178
+ ...H.props(I.shapeCursor, Pr.cursor)
2146
2179
  })] });
2147
2180
  }
2148
2181
  // packages/teaching/src/scene/plane/scene-axes.tsx
2149
- var Pr = { maximumFractionDigits: 2 }, Fr = 96, Ir = 56, Lr = [a.compact, a.tall];
2150
- function Rr(e) {
2182
+ var Lr = { maximumFractionDigits: 2 }, Rr = 96, zr = 56, Br = [o.compact, o.tall];
2183
+ function Vr(e) {
2151
2184
  return {
2152
2185
  label: e?.label ?? "",
2153
- format: e?.format ?? Pr
2186
+ format: e?.format ?? Lr
2154
2187
  };
2155
2188
  }
2156
- function zr({ axis: e, domain: t, length: n, spacing: r, locale: i }) {
2157
- let a = e?.label !== void 0, o = Rr(e);
2158
- if (e?.ticks === void 0) return l({
2189
+ function Hr({ axis: e, domain: t, length: n, spacing: r, locale: i }) {
2190
+ let a = e?.label !== void 0, o = Vr(e);
2191
+ if (e?.ticks === void 0) return u({
2159
2192
  axis: o,
2160
2193
  domain: t,
2161
2194
  length: n,
@@ -2166,7 +2199,7 @@ function zr({ axis: e, domain: t, length: n, spacing: r, locale: i }) {
2166
2199
  let s = e.ticks.filter((e) => e >= t[0] && e <= t[1]);
2167
2200
  return {
2168
2201
  values: s,
2169
- labels: u({
2202
+ labels: d({
2170
2203
  values: s,
2171
2204
  axis: o,
2172
2205
  locale: i,
@@ -2174,25 +2207,25 @@ function zr({ axis: e, domain: t, length: n, spacing: r, locale: i }) {
2174
2207
  })
2175
2208
  };
2176
2209
  }
2177
- function Br(e, t) {
2210
+ function Ur(e, t) {
2178
2211
  return e.values.map((n, r) => ({
2179
2212
  key: String(n),
2180
2213
  position: t(n),
2181
2214
  label: e.labels[r] ?? ""
2182
2215
  }));
2183
2216
  }
2184
- function Vr({ id: e = "axes", x: t, y: n, grid: r = "y", isShown: i = !0 }) {
2185
- let a = J(), { box: o, view: c, domain: l, locale: u } = a, d = t?.label !== void 0, f = n?.label !== void 0, p = Lr.flatMap((e) => zr({
2217
+ function Wr({ id: e = "axes", x: t, y: n, grid: r = "y", isShown: i = !0 }) {
2218
+ let a = J(), { box: o, view: s, domain: l, locale: u } = a, d = t?.label !== void 0, f = n?.label !== void 0, p = Br.flatMap((e) => Hr({
2186
2219
  axis: n,
2187
2220
  domain: l.y,
2188
2221
  length: e,
2189
- spacing: Ir,
2222
+ spacing: zr,
2190
2223
  locale: u
2191
2224
  }).labels), m = Y({
2192
2225
  id: e,
2193
2226
  kind: "axes",
2194
2227
  values: {},
2195
- margins: s({
2228
+ margins: c({
2196
2229
  width: o.width,
2197
2230
  valueLabels: p,
2198
2231
  hasXTitle: d,
@@ -2200,7 +2233,7 @@ function Vr({ id: e = "axes", x: t, y: n, grid: r = "y", isShown: i = !0 }) {
2200
2233
  }),
2201
2234
  isShown: i
2202
2235
  }), [h, g] = l.x, [_, v] = l.y, y = h < 0 && g > 0, b = _ < 0 && v > 0;
2203
- if (Qn({
2236
+ if (tr({
2204
2237
  id: `${e}:zero-x`,
2205
2238
  line: y ? [{
2206
2239
  x: 0,
@@ -2209,7 +2242,7 @@ function Vr({ id: e = "axes", x: t, y: n, grid: r = "y", isShown: i = !0 }) {
2209
2242
  x: 0,
2210
2243
  y: v
2211
2244
  }] : []
2212
- }), Qn({
2245
+ }), tr({
2213
2246
  id: `${e}:zero-y`,
2214
2247
  line: b ? [{
2215
2248
  x: h,
@@ -2220,39 +2253,39 @@ function Vr({ id: e = "axes", x: t, y: n, grid: r = "y", isShown: i = !0 }) {
2220
2253
  }] : []
2221
2254
  }), !a.isInScene) return /* @__PURE__ */ G(Q, { part: "SceneAxes" });
2222
2255
  if (!m.isVisible) return null;
2223
- let x = zr({
2256
+ let x = Hr({
2224
2257
  axis: t,
2225
- domain: [c.x0, c.x1],
2258
+ domain: [s.x0, s.x1],
2226
2259
  length: o.innerWidth,
2227
- spacing: Fr,
2260
+ spacing: Rr,
2228
2261
  locale: u
2229
- }), S = zr({
2262
+ }), S = Hr({
2230
2263
  axis: n,
2231
- domain: [c.y0, c.y1],
2264
+ domain: [s.y0, s.y1],
2232
2265
  length: o.innerHeight,
2233
- spacing: Ir,
2266
+ spacing: zr,
2234
2267
  locale: u
2235
- }), C = c.x0 < 0 && c.x1 > 0, w = c.y0 < 0 && c.y1 > 0;
2236
- return /* @__PURE__ */ K(Mr, {
2268
+ }), C = s.x0 < 0 && s.x1 > 0, w = s.y0 < 0 && s.y1 > 0;
2269
+ return /* @__PURE__ */ K(Fr, {
2237
2270
  id: e,
2238
2271
  layer: "back",
2239
2272
  opacity: m.values.opacity,
2240
2273
  children: [
2241
- /* @__PURE__ */ G(se, {
2274
+ /* @__PURE__ */ G(oe, {
2242
2275
  box: o,
2243
- xTicks: Br(x, a.x.position),
2244
- yTicks: Br(S, a.y.position),
2276
+ xTicks: Ur(x, a.x.position),
2277
+ yTicks: Ur(S, a.y.position),
2245
2278
  xTitle: t?.label,
2246
2279
  yTitle: n?.label,
2247
2280
  grid: r
2248
2281
  }),
2249
- C && /* @__PURE__ */ G(B, {
2282
+ C && /* @__PURE__ */ G(te, {
2250
2283
  x1: a.x.position(0),
2251
2284
  x2: a.x.position(0),
2252
2285
  y1: o.top,
2253
2286
  y2: o.bottom
2254
2287
  }),
2255
- w && /* @__PURE__ */ G(B, {
2288
+ w && /* @__PURE__ */ G(te, {
2256
2289
  x1: o.left,
2257
2290
  x2: o.right,
2258
2291
  y1: a.y.position(0),
@@ -2262,7 +2295,7 @@ function Vr({ id: e = "axes", x: t, y: n, grid: r = "y", isShown: i = !0 }) {
2262
2295
  });
2263
2296
  }
2264
2297
  // packages/teaching/src/scene/plane/plane-labels.ts
2265
- var Hr = {
2298
+ var Gr = {
2266
2299
  curveSource: "The curve \"{id}\" needs `points` or `of`, and not both.",
2267
2300
  curveTooMany: "The curve \"{id}\" takes at most {limit} points. Pass fewer, or use `of`.",
2268
2301
  curveOrder: "The curve \"{id}\" needs at least two points with strictly increasing x.",
@@ -2270,48 +2303,49 @@ var Hr = {
2270
2303
  pointLabel: "The point \"{id}\" can be moved, so it needs a `label` for the readout.",
2271
2304
  pointOutsideLesson: "The point \"{id}\" sets lesson params, so it must be inside a Lesson.",
2272
2305
  pointParam: "The point \"{id}\" sets \"{name}\", which lesson \"{lesson}\" does not declare as a number param.",
2273
- pointMovable: " Use the arrow keys to move it.",
2306
+ pointMovable: " Tab to it and use the arrow keys to move it.",
2307
+ pointValue: "{name} {value}",
2274
2308
  regionShape: "The region \"{id}\" needs one of `between`, `above`, `below` or `points`.",
2275
2309
  ruleAxis: "The rule \"{id}\" needs `x` or `y`, and not both.",
2276
2310
  projectionSource: "The projection \"{id}\" needs `of` or `at`, and not both.",
2277
2311
  notFinite: "The {kind} \"{id}\" has a value that is not a finite number."
2278
- }, Ur = {
2312
+ }, Kr = {
2279
2313
  coarse: 60,
2280
2314
  regular: 160,
2281
2315
  fine: 400
2282
- }, Wr = {
2316
+ }, qr = {
2283
2317
  curvePoints: 2e3,
2284
2318
  polygonPoints: 200
2285
- }, Gr = {
2319
+ }, Jr = {
2286
2320
  thin: 1.25,
2287
2321
  regular: 1.75,
2288
2322
  thick: 3
2289
- }, Kr = .5;
2290
- function qr(e, t) {
2291
- return Number.isFinite(e) ? Math.min(t[1], Math.max(t[0], e)) : (t[0] + t[1]) * Kr;
2323
+ }, Yr = .5;
2324
+ function Xr(e, t) {
2325
+ return Number.isFinite(e) ? Math.min(t[1], Math.max(t[0], e)) : (t[0] + t[1]) * Yr;
2292
2326
  }
2293
- function Jr(e, t) {
2294
- return [qr(e[0], t.x), qr(e[1], t.y)];
2327
+ function Zr(e, t) {
2328
+ return [Xr(e[0], t.x), Xr(e[1], t.y)];
2295
2329
  }
2296
- function Yr(e, t) {
2330
+ function Qr(e, t) {
2297
2331
  return Array.from({ length: t }, (n, r) => e[0] + (e[1] - e[0]) * r / (t - 1));
2298
2332
  }
2299
- function Xr(e, t) {
2333
+ function $r(e, t) {
2300
2334
  let n = {
2301
2335
  low: 0,
2302
2336
  high: e.length
2303
2337
  };
2304
2338
  for (; n.low < n.high;) {
2305
- let r = Math.floor((n.low + n.high) * Kr);
2339
+ let r = Math.floor((n.low + n.high) * Yr);
2306
2340
  (e[r]?.[0] ?? Infinity) < t ? n.low = r + 1 : n.high = r;
2307
2341
  }
2308
2342
  return n.low;
2309
2343
  }
2310
- function Zr(e, t) {
2311
- let n = Xr(e, t), r = e[n], i = e[n - 1];
2344
+ function ei(e, t) {
2345
+ let n = $r(e, t), r = e[n], i = e[n - 1];
2312
2346
  return r === void 0 ? i?.[1] ?? 0 : i === void 0 || r[0] === t ? r[1] : i[1] + (r[1] - i[1]) * (t - i[0]) / (r[0] - i[0]);
2313
2347
  }
2314
- function Qr({ xs: e, ys: t, from: n, to: r }) {
2348
+ function ti({ xs: e, ys: t, from: n, to: r }) {
2315
2349
  let i = e.map((e, n) => [e, t[n] ?? 0]), a = i.flatMap(([e, t]) => e > n && e < r ? [{
2316
2350
  x: e,
2317
2351
  y: t
@@ -2319,32 +2353,32 @@ function Qr({ xs: e, ys: t, from: n, to: r }) {
2319
2353
  return [
2320
2354
  {
2321
2355
  x: n,
2322
- y: Zr(i, n)
2356
+ y: ei(i, n)
2323
2357
  },
2324
2358
  ...a,
2325
2359
  {
2326
2360
  x: r,
2327
- y: Zr(i, r)
2361
+ y: ei(i, r)
2328
2362
  }
2329
2363
  ];
2330
2364
  }
2331
- function $r(e) {
2365
+ function ni(e) {
2332
2366
  let t = { sum: 0 };
2333
2367
  for (let n of e) t.sum += n;
2334
2368
  return t.sum / Math.max(1, e.length);
2335
2369
  }
2336
- function ei(e) {
2370
+ function ri(e) {
2337
2371
  return {
2338
- x: $r(e.map((e) => e.x)),
2339
- y: $r(e.map((e) => e.y))
2372
+ x: ni(e.map((e) => e.x)),
2373
+ y: ni(e.map((e) => e.y))
2340
2374
  };
2341
2375
  }
2342
2376
  // packages/teaching/src/scene/plane/scene-curve.tsx
2343
- var ti = 1, ni = .5;
2344
- function ri(e) {
2377
+ var ii = 1, ai = .5;
2378
+ function oi(e) {
2345
2379
  return e.every(([e, t]) => Number.isFinite(e) && Number.isFinite(t)) && e.every((t, n) => n === 0 || t[0] > (e[n - 1]?.[0] ?? 0));
2346
2380
  }
2347
- function ii({ id: e, points: t, of: n, xs: r, domain: i, labels: a }) {
2381
+ function si({ id: e, points: t, of: n, xs: r, domain: i, labels: a }) {
2348
2382
  let o = {
2349
2383
  ys: r.map(() => 0),
2350
2384
  from: i[0],
@@ -2368,38 +2402,38 @@ function ii({ id: e, points: t, of: n, xs: r, domain: i, labels: a }) {
2368
2402
  ...o,
2369
2403
  problem: q(a.curveSource, { id: e })
2370
2404
  };
2371
- if (t.length > Wr.curvePoints) return {
2405
+ if (t.length > qr.curvePoints) return {
2372
2406
  ...o,
2373
2407
  problem: q(a.curveTooMany, {
2374
2408
  id: e,
2375
- limit: String(Wr.curvePoints)
2409
+ limit: String(qr.curvePoints)
2376
2410
  })
2377
2411
  };
2378
- if (t.length < 2 || !ri(t)) return {
2412
+ if (t.length < 2 || !oi(t)) return {
2379
2413
  ...o,
2380
2414
  problem: q(a.curveOrder, { id: e })
2381
2415
  };
2382
2416
  let s = Math.max(i[0], t[0]?.[0] ?? i[0]), c = Math.max(s, Math.min(i[1], t.at(-1)?.[0] ?? i[1]));
2383
2417
  return {
2384
- ys: r.map((e) => Zr(t, e)),
2418
+ ys: r.map((e) => ei(t, e)),
2385
2419
  from: s,
2386
2420
  to: c,
2387
2421
  problem: void 0
2388
2422
  };
2389
2423
  }
2390
- function ai({ id: e, points: t, of: n, resolution: r = "regular", label: i, tone: a, emphasis: o, isDashed: s = !1, thickness: c = "regular", fillTo: l, isShown: u = !0, isActive: d = !1, pace: f, labels: p }) {
2391
- let m = J(), h = b(e), [g, _] = m.domain.x, y = ge(() => Yr([g, _], Ur[r]), [
2424
+ function ci({ id: e, points: t, of: n, resolution: r = "regular", label: i, tone: a, emphasis: o, isDashed: s = !1, thickness: c = "regular", fillTo: l, isShown: u = !0, isActive: d = !1, pace: f, labels: p }) {
2425
+ let m = J(), h = b(e), [g, _] = m.domain.x, y = ge(() => Qr([g, _], Kr[r]), [
2392
2426
  g,
2393
2427
  _,
2394
2428
  r
2395
- ]), x = ge(() => ii({
2429
+ ]), x = ge(() => si({
2396
2430
  id: e,
2397
2431
  points: t,
2398
2432
  of: n,
2399
2433
  xs: y,
2400
2434
  domain: [g, _],
2401
2435
  labels: {
2402
- ...Hr,
2436
+ ...Gr,
2403
2437
  ...p
2404
2438
  }
2405
2439
  }), [
@@ -2415,12 +2449,12 @@ function ai({ id: e, points: t, of: n, resolution: r = "regular", label: i, tone
2415
2449
  from: x.from,
2416
2450
  to: x.to,
2417
2451
  base: l ?? 0
2418
- }, C = (x.from + x.to) * ni, w = Y({
2452
+ }, C = (x.from + x.to) * ai, w = Y({
2419
2453
  id: e,
2420
2454
  kind: "curve",
2421
2455
  frame: {
2422
2456
  x: C,
2423
- y: qr(Zr(y.map((e, t) => [e, x.ys[t] ?? 0]), C), m.domain.y),
2457
+ y: Xr(ei(y.map((e, t) => [e, x.ys[t] ?? 0]), C), m.domain.y),
2424
2458
  width: 0,
2425
2459
  height: 0
2426
2460
  },
@@ -2432,13 +2466,13 @@ function ai({ id: e, points: t, of: n, resolution: r = "regular", label: i, tone
2432
2466
  emphasis: o,
2433
2467
  problem: x.problem,
2434
2468
  pace: f
2435
- }), T = w.values, E = Qr({
2469
+ }), T = w.values, E = ti({
2436
2470
  xs: y,
2437
2471
  ys: y.map((e, t) => T[`y${t}`] ?? 0),
2438
2472
  from: T.from,
2439
2473
  to: T.to
2440
2474
  });
2441
- if (Qn({
2475
+ if (tr({
2442
2476
  id: e,
2443
2477
  line: w.isVisible && x.problem === void 0 ? E : []
2444
2478
  }), !w.scene.isInScene) return /* @__PURE__ */ G(Q, { part: "SceneCurve" });
@@ -2446,16 +2480,16 @@ function ai({ id: e, points: t, of: n, resolution: r = "regular", label: i, tone
2446
2480
  let D = E.map((e) => ({
2447
2481
  x: m.x.position(e.x),
2448
2482
  y: m.y.position(e.y)
2449
- })), O = ae(D), k = m.y.position(T.base), A = Gr[c] + (w.isInspected ? ti : 0), j = a ?? h ?? "series1";
2450
- return /* @__PURE__ */ G(Mr, {
2483
+ })), O = ie(D), k = m.y.position(T.base), A = Jr[c] + (w.isInspected ? ii : 0), j = a ?? h ?? "series1";
2484
+ return /* @__PURE__ */ G(Fr, {
2451
2485
  id: e,
2452
2486
  layer: "wires",
2453
2487
  opacity: T.opacity,
2454
2488
  children: /* @__PURE__ */ K(v, {
2455
2489
  box: m.box,
2456
2490
  children: [
2457
- l !== void 0 && /* @__PURE__ */ G(ne, {
2458
- d: oe(D.map((e) => ({
2491
+ l !== void 0 && /* @__PURE__ */ G(V, {
2492
+ d: ae(D.map((e) => ({
2459
2493
  x: e.x,
2460
2494
  y0: k,
2461
2495
  y1: e.y
@@ -2464,14 +2498,14 @@ function ai({ id: e, points: t, of: n, resolution: r = "regular", label: i, tone
2464
2498
  emphasis: w.emphasis,
2465
2499
  isPale: !0
2466
2500
  }),
2467
- /* @__PURE__ */ G(re, {
2501
+ /* @__PURE__ */ G(ne, {
2468
2502
  d: O,
2469
2503
  tone: j,
2470
2504
  width: A,
2471
2505
  stroke: s ? "dashed" : "solid",
2472
2506
  emphasis: w.emphasis
2473
2507
  }),
2474
- /* @__PURE__ */ G(Nr, {
2508
+ /* @__PURE__ */ G(Ir, {
2475
2509
  id: e,
2476
2510
  d: O,
2477
2511
  hasLabel: i !== void 0 && u,
@@ -2482,67 +2516,67 @@ function ai({ id: e, points: t, of: n, resolution: r = "regular", label: i, tone
2482
2516
  });
2483
2517
  }
2484
2518
  // packages/teaching/src/scene/plane/plane-label.tsx
2485
- var oi = 11, si = 16, ci = 4;
2486
- function li({ x: e, y: t, text: n }) {
2519
+ var li = 11, ui = 16, di = 4;
2520
+ function fi({ x: e, y: t, text: n }) {
2487
2521
  return [
2488
2522
  {
2489
- x: e + oi,
2490
- y: t - oi,
2523
+ x: e + li,
2524
+ y: t - li,
2491
2525
  anchor: "start",
2492
2526
  text: n
2493
2527
  },
2494
2528
  {
2495
- x: e + oi,
2496
- y: t + si,
2529
+ x: e + li,
2530
+ y: t + ui,
2497
2531
  anchor: "start",
2498
2532
  text: n
2499
2533
  },
2500
2534
  {
2501
- x: e - oi,
2502
- y: t - oi,
2535
+ x: e - li,
2536
+ y: t - li,
2503
2537
  anchor: "end",
2504
2538
  text: n
2505
2539
  },
2506
2540
  {
2507
- x: e - oi,
2508
- y: t + si,
2541
+ x: e - li,
2542
+ y: t + ui,
2509
2543
  anchor: "end",
2510
2544
  text: n
2511
2545
  },
2512
2546
  {
2513
2547
  x: e,
2514
- y: t - oi - ci,
2548
+ y: t - li - di,
2515
2549
  anchor: "middle",
2516
2550
  text: n
2517
2551
  },
2518
2552
  {
2519
2553
  x: e,
2520
- y: t + si + ci,
2554
+ y: t + ui + di,
2521
2555
  anchor: "middle",
2522
2556
  text: n
2523
2557
  },
2524
2558
  {
2525
- x: e + oi,
2526
- y: t + ci,
2559
+ x: e + li,
2560
+ y: t + di,
2527
2561
  anchor: "start",
2528
2562
  text: n
2529
2563
  },
2530
2564
  {
2531
- x: e - oi,
2532
- y: t + ci,
2565
+ x: e - li,
2566
+ y: t + di,
2533
2567
  anchor: "end",
2534
2568
  text: n
2535
2569
  }
2536
2570
  ];
2537
2571
  }
2538
- function ui({ owner: e, name: t, spots: n, lines: r = [], isStrong: i = !1 }) {
2539
- let a = nr({
2572
+ function pi({ owner: e, name: t, spots: n, lines: r = [], isStrong: i = !1 }) {
2573
+ let a = ar({
2540
2574
  id: `${e}:${t}`,
2541
2575
  owner: e,
2542
2576
  spots: n,
2543
2577
  lines: r
2544
2578
  });
2545
- return a === void 0 ? null : /* @__PURE__ */ G(z, {
2579
+ return a === void 0 ? null : /* @__PURE__ */ G(ee, {
2546
2580
  x: a.x,
2547
2581
  y: a.y,
2548
2582
  anchor: a.anchor,
@@ -2551,12 +2585,12 @@ function ui({ owner: e, name: t, spots: n, lines: r = [], isStrong: i = !1 }) {
2551
2585
  });
2552
2586
  }
2553
2587
  // packages/teaching/src/scene/plane/scene-point.tsx
2554
- var di = 6, fi = 14, pi = 100, mi = 10, hi = "[role=\"group\"][tabindex]", gi = {
2555
- ArrowRight: [1, 0],
2556
- ArrowLeft: [-1, 0],
2557
- ArrowUp: [0, 1],
2558
- ArrowDown: [0, -1]
2559
- }, _i = {
2588
+ var mi = 6, hi = 14, gi = 100, _i = 10, vi = { maximumFractionDigits: 2 }, yi = /* @__PURE__ */ new Set([
2589
+ "ArrowUp",
2590
+ "ArrowDown",
2591
+ "PageUp",
2592
+ "PageDown"
2593
+ ]), bi = {
2560
2594
  kVAEAm: "x10l6tqk",
2561
2595
  kbCHJM: "xu96u03",
2562
2596
  k87sOh: "x13vifvy",
@@ -2564,9 +2598,9 @@ var di = 6, fi = 14, pi = 100, mi = 10, hi = "[role=\"group\"][tabindex]", gi =
2564
2598
  kZKoxP: "x1fgtraw",
2565
2599
  kfzvcC: "x67bb7w",
2566
2600
  $$css: !0
2567
- }, vi = {
2601
+ }, xi = {
2568
2602
  target: (e) => [
2569
- _i,
2603
+ bi,
2570
2604
  {
2571
2605
  k3aq6I: e == null ? e : "xsqj5wx",
2572
2606
  $$css: !0
@@ -2576,6 +2610,11 @@ var di = 6, fi = 14, pi = 100, mi = 10, hi = "[role=\"group\"][tabindex]", gi =
2576
2610
  movable: {
2577
2611
  kkrTdU: "x1jm3nie",
2578
2612
  kFalU9: "x5ve5x3",
2613
+ kaIpWk: "x16rqkct",
2614
+ k3XXqK: "x1t137rt",
2615
+ kPJHz1: "x13qnu6",
2616
+ k7shQP: "x9v5kkp",
2617
+ kZs9gx: "x19rmrnh",
2579
2618
  $$css: !0
2580
2619
  },
2581
2620
  dragging: {
@@ -2590,14 +2629,14 @@ var di = 6, fi = 14, pi = 100, mi = 10, hi = "[role=\"group\"][tabindex]", gi =
2590
2629
  $$css: !0
2591
2630
  }
2592
2631
  };
2593
- function yi(e, { min: t, max: n, step: r }) {
2632
+ function Si(e, { min: t, max: n, step: r }) {
2594
2633
  return r === void 0 ? Se(e, t, n) : Ce(Se(e, t, n), {
2595
2634
  min: t,
2596
2635
  max: n,
2597
2636
  step: r
2598
2637
  }).value;
2599
2638
  }
2600
- function bi(e, t, n) {
2639
+ function Ci(e, t, n) {
2601
2640
  return n === void 0 ? {
2602
2641
  min: e[0],
2603
2642
  max: e[1],
@@ -2608,7 +2647,7 @@ function bi(e, t, n) {
2608
2647
  step: n.step
2609
2648
  };
2610
2649
  }
2611
- function xi({ id: e, sets: t, scope: n, labels: r }) {
2650
+ function wi({ id: e, sets: t, scope: n, labels: r }) {
2612
2651
  if (n === null) return q(r.pointOutsideLesson, { id: e });
2613
2652
  let i = ["x", "y"].flatMap((e) => {
2614
2653
  let r = t[e], i = r === void 0 ? void 0 : n.lesson.params[r];
@@ -2624,124 +2663,133 @@ function xi({ id: e, sets: t, scope: n, labels: r }) {
2624
2663
  lesson: n.lesson.id
2625
2664
  });
2626
2665
  }
2627
- function Si(e, { at: t, grids: n, along: r }) {
2628
- let i = r === "y" ? t[0] : yi(e[0], n.x);
2666
+ function Ti(e, { at: t, grids: n, along: r }) {
2667
+ let i = r === "y" ? t[0] : Si(e[0], n.x);
2629
2668
  if (typeof r == "function") {
2630
2669
  let e = r(i);
2631
2670
  return [i, Number.isFinite(e) ? Se(e, n.y.min, n.y.max) : t[1]];
2632
2671
  }
2633
- return [i, r === "x" ? t[1] : yi(e[1], n.y)];
2634
- }
2635
- function Ci(e, t) {
2636
- let n = gi[e.key], r = e.altKey || e.ctrlKey || e.metaKey, { at: i, grids: a, along: o } = t;
2637
- if (n === void 0 || r) return;
2638
- let s = n[0] !== 0;
2639
- if (o === "x" && !s || o === "y" && s) return;
2640
- let c = e.shiftKey ? mi : 1, l = (a.x.step ?? (a.x.max - a.x.min) / pi) * c, u = (a.y.step ?? (a.y.max - a.y.min) / pi) * c;
2641
- return Si(typeof o == "function" ? [i[0] + (n[0] + n[1]) * l, i[1]] : [i[0] + n[0] * l, i[1] + n[1] * u], t);
2642
- }
2643
- function wi({ id: e, at: t, label: n, text: r, tone: a, emphasis: o, isShown: s = !0, isActive: c = !1, onMove: l, sets: u, snap: d, along: f, pace: p, labels: m }) {
2644
- let h = J(), g = H(qe), _ = b(e), v = {
2645
- ...Hr,
2672
+ return [i, r === "x" ? t[1] : Si(e[1], n.y)];
2673
+ }
2674
+ function Ei(e) {
2675
+ return e === void 0 ? ["x", "y"] : e === "y" ? ["y"] : ["x"];
2676
+ }
2677
+ function Di(e, t) {
2678
+ let { at: n, grids: r, along: i } = t, a = Ei(i), [o] = a, s = a.length > 1 && yi.has(e.key) ? "y" : o ?? "x", c = a.length > 1 ? s === "y" ? "vertical" : "horizontal" : "all", l = we(e, {
2679
+ arrows: c,
2680
+ orientation: s === "y" ? "vertical" : "horizontal"
2681
+ }), u = e.ctrlKey || e.metaKey;
2682
+ if (l === null || u) return;
2683
+ let d = r[s], f = n[s === "x" ? 0 : 1], p = d.step ?? (d.max - d.min) / gi, m = l.bound === "min" ? d.min : d.max, h = f + (l.direction ?? 0) * p * (l.size === "large" ? _i : 1), g = l.bound === void 0 ? h : m;
2684
+ return Ti(s === "x" ? [g, n[1]] : [n[0], g], t);
2685
+ }
2686
+ function Oi({ at: e, axes: t, params: n, locale: r, labels: i }) {
2687
+ return t.map((t) => {
2688
+ let a = n[t], o = e[t === "x" ? 0 : 1], s = F({
2689
+ value: o,
2690
+ locale: r,
2691
+ format: a?.format ?? vi
2692
+ });
2693
+ return a === void 0 ? s : q(i.pointValue, {
2694
+ name: a.label,
2695
+ value: s
2696
+ });
2697
+ }).join(", ");
2698
+ }
2699
+ function ki({ id: e, at: t, label: r, text: i, tone: a, emphasis: o, isShown: s = !0, isActive: c = !1, onMove: l, sets: u, snap: d, along: f, pace: p, labels: m }) {
2700
+ let h = J(), g = b(e), _ = {
2701
+ ...Gr,
2646
2702
  ...m
2647
- }, [y, x] = W(!1), C = _e(null), w = _e(null), T = H(S), E = l !== void 0 || u !== void 0, D = u === void 0 ? {} : xi({
2703
+ }, [v, y] = W(!1), x = _e(null), S = pe(C), w = l !== void 0 || u !== void 0, T = u === void 0 ? {} : wi({
2648
2704
  id: e,
2649
2705
  sets: u,
2650
- scope: T,
2651
- labels: v
2652
- }), O = typeof D == "string" ? {} : D, k = O.x !== void 0 && O.y === void 0, A = O.y !== void 0 && O.x === void 0 ? "y" : void 0, j = {
2706
+ scope: S,
2707
+ labels: _
2708
+ }), E = typeof T == "string" ? {} : T, D = E.x !== void 0 && E.y === void 0, O = E.y !== void 0 && E.x === void 0 ? "y" : void 0, k = {
2653
2709
  at: t,
2654
2710
  grids: {
2655
- x: bi(h.domain.x, d, O.x),
2656
- y: bi(h.domain.y, d, O.y)
2711
+ x: Ci(h.domain.x, d, E.x),
2712
+ y: Ci(h.domain.y, d, E.y)
2657
2713
  },
2658
- along: f ?? (k ? "x" : A)
2714
+ along: f ?? (D ? "x" : O)
2659
2715
  };
2660
- function M(e, t) {
2716
+ function A(e, t) {
2661
2717
  let n = Object.fromEntries(["x", "y"].flatMap((t, n) => {
2662
2718
  let r = u?.[t];
2663
- return r === void 0 || O[t] === void 0 ? [] : [[r, e[n]]];
2719
+ return r === void 0 || E[t] === void 0 ? [] : [[r, e[n]]];
2664
2720
  }));
2665
- T !== null && Object.keys(n).length > 0 && T.api.setParams(n, t), l?.(e, t);
2721
+ S !== null && Object.keys(n).length > 0 && S.api.setParams(n, t), l?.(e, t);
2666
2722
  }
2667
- let N = _e({
2723
+ let j = _e({
2668
2724
  scene: h,
2669
- constraint: j,
2670
- move: M
2671
- }), P = E && n === void 0 ? q(v.pointLabel, { id: e }) : void 0, F = typeof D == "string" ? D : P, [I, L] = t, R = Y({
2725
+ constraint: k,
2726
+ move: A
2727
+ }), M = w && r === void 0 ? q(_.pointLabel, { id: e }) : void 0, N = typeof T == "string" ? T : M, [P, F] = t, I = Y({
2672
2728
  id: e,
2673
2729
  kind: "point",
2674
2730
  frame: {
2675
- x: I,
2676
- y: L,
2731
+ x: P,
2732
+ y: F,
2677
2733
  width: 12,
2678
2734
  height: 12
2679
2735
  },
2680
2736
  isFloating: !0,
2681
2737
  values: {},
2682
2738
  shape: "circle",
2683
- label: E && n !== void 0 ? `${n}${v.pointMovable}` : n,
2739
+ label: w && r !== void 0 ? `${r}${_.pointMovable}` : r,
2684
2740
  isShown: s,
2685
2741
  isActive: c,
2686
2742
  emphasis: o,
2687
- problem: F,
2688
- pace: y ? "instant" : p
2689
- }), z = R.isVisible && F === void 0;
2690
- Qn({
2743
+ problem: N,
2744
+ pace: v ? "instant" : p
2745
+ }), L = I.isVisible && N === void 0;
2746
+ tr({
2691
2747
  id: e,
2692
- line: z ? [{
2693
- x: I,
2694
- y: L
2748
+ line: L ? [{
2749
+ x: P,
2750
+ y: F
2695
2751
  }] : []
2696
- });
2697
- let B = g.cursor === e, te = E && B && R.isVisible;
2698
- me(() => {
2699
- N.current = {
2752
+ }), me(() => {
2753
+ j.current = {
2700
2754
  scene: h,
2701
- constraint: j,
2702
- move: M
2755
+ constraint: k,
2756
+ move: A
2703
2757
  };
2704
- }), me(() => () => w.current?.(), []), me(() => {
2705
- if (!te) return;
2706
- function e(e) {
2707
- let t = C.current?.closest("figure"), { target: n } = e, r = n instanceof Element && t?.contains(n) === !0 && n.matches(hi) ? Ci(e, N.current.constraint) : void 0;
2708
- if (r === void 0) return;
2709
- e.preventDefault(), e.stopPropagation();
2710
- let i = N.current.constraint.at;
2711
- (r[0] !== i[0] || r[1] !== i[1]) && N.current.move(r, {
2712
- reason: "step-key",
2713
- event: e
2714
- });
2715
- }
2716
- return document.addEventListener("keydown", e, !0), () => document.removeEventListener("keydown", e, !0);
2717
- }, [te]);
2718
- function ne(e) {
2719
- e.preventDefault(), R.focusPlot();
2758
+ }), me(() => () => x.current?.(), []);
2759
+ function R(e) {
2760
+ let n = w ? Di(e.nativeEvent, k) : void 0;
2761
+ n !== void 0 && (e.preventDefault(), e.stopPropagation(), (n[0] !== t[0] || n[1] !== t[1]) && A(n, {
2762
+ reason: "step-key",
2763
+ event: e.nativeEvent
2764
+ }));
2720
2765
  }
2721
- function re(e) {
2766
+ function ee(e) {
2767
+ e.preventDefault(), w ? e.currentTarget.focus({ preventScroll: !0 }) : I.focusPlot();
2768
+ }
2769
+ function te(e) {
2722
2770
  let t = e.currentTarget;
2723
- if (!E || e.button !== 0) return;
2771
+ if (!w || e.button !== 0) return;
2724
2772
  let n = t.getBoundingClientRect(), r = {
2725
2773
  x: n.left + n.width / 2 - e.clientX,
2726
2774
  y: n.top + n.height / 2 - e.clientY
2727
- }, i = N.current.constraint.at;
2728
- w.current?.(), w.current = ye(t, e.nativeEvent, {
2775
+ }, i = j.current.constraint.at;
2776
+ x.current?.(), x.current = ye(t, e.nativeEvent, {
2729
2777
  threshold: be,
2730
2778
  cancelOnEscape: !0,
2731
2779
  onStart: () => {
2732
- x(!0);
2780
+ y(!0);
2733
2781
  },
2734
2782
  onMove: ({ x: e, y: n, event: i }) => {
2735
- let a = t.parentElement?.getBoundingClientRect(), { scene: o, constraint: s, move: c } = N.current;
2783
+ let a = t.parentElement?.getBoundingClientRect(), { scene: o, constraint: s, move: c } = j.current;
2736
2784
  if (a === void 0) return;
2737
- let l = Si([o.x.valueAt(e + r.x - a.left), o.y.valueAt(n + r.y - a.top)], s);
2785
+ let l = Ti([o.x.valueAt(e + r.x - a.left), o.y.valueAt(n + r.y - a.top)], s);
2738
2786
  (l[0] !== s.at[0] || l[1] !== s.at[1]) && c(l, {
2739
2787
  reason: "drag",
2740
2788
  event: i
2741
2789
  });
2742
2790
  },
2743
2791
  onEnd: (e, t) => {
2744
- x(!1), t && N.current.move(i, {
2792
+ y(!1), t && j.current.move(i, {
2745
2793
  reason: "drag",
2746
2794
  event: e
2747
2795
  });
@@ -2749,44 +2797,60 @@ function wi({ id: e, at: t, label: n, text: r, tone: a, emphasis: o, isShown: s
2749
2797
  });
2750
2798
  }
2751
2799
  if (!h.isInScene) return /* @__PURE__ */ G(Q, { part: "ScenePoint" });
2752
- if (!z || R.rect === void 0) return null;
2753
- let { x: ie, y: ae } = Z(R.rect), oe = a ?? _ ?? "series1";
2754
- return /* @__PURE__ */ K(xe, { children: [/* @__PURE__ */ K(Mr, {
2800
+ if (!L || I.rect === void 0) return null;
2801
+ let { x: B, y: V } = Z(I.rect), ne = a ?? g ?? "series1", re = Ei(k.along), ie = re.length === 1 && re[0] === "y" ? "y" : "x", ae = w ? {
2802
+ role: "slider",
2803
+ tabIndex: 0,
2804
+ "aria-label": r,
2805
+ "aria-orientation": ie === "y" ? "vertical" : "horizontal",
2806
+ "aria-valuenow": t[ie === "x" ? 0 : 1],
2807
+ "aria-valuemin": k.grids[ie].min,
2808
+ "aria-valuemax": k.grids[ie].max,
2809
+ "aria-valuetext": Oi({
2810
+ at: t,
2811
+ axes: re,
2812
+ params: E,
2813
+ locale: h.locale,
2814
+ labels: _
2815
+ }),
2816
+ onKeyDown: R
2817
+ } : {};
2818
+ return /* @__PURE__ */ K(xe, { children: [/* @__PURE__ */ K(Fr, {
2755
2819
  id: e,
2756
2820
  layer: "front",
2757
- opacity: R.values.opacity,
2758
- children: [/* @__PURE__ */ G(ee, {
2759
- x: ie,
2760
- y: ae,
2761
- tone: oe,
2762
- radius: di,
2763
- emphasis: R.emphasis,
2764
- isInspected: R.isInspected,
2765
- isSelected: R.isSelected
2766
- }), r !== void 0 && /* @__PURE__ */ G(ui, {
2821
+ opacity: I.values.opacity,
2822
+ children: [/* @__PURE__ */ G(z, {
2823
+ x: B,
2824
+ y: V,
2825
+ tone: ne,
2826
+ radius: mi,
2827
+ emphasis: I.emphasis,
2828
+ isInspected: I.isInspected,
2829
+ isSelected: I.isSelected
2830
+ }), i !== void 0 && /* @__PURE__ */ G(pi, {
2767
2831
  owner: e,
2768
2832
  name: "text",
2769
- spots: li({
2770
- x: ie,
2771
- y: ae,
2772
- text: r
2833
+ spots: fi({
2834
+ x: B,
2835
+ y: V,
2836
+ text: i
2773
2837
  }),
2774
2838
  lines: [[{
2775
- x: ie,
2776
- y: ae
2839
+ x: B,
2840
+ y: V
2777
2841
  }]]
2778
2842
  })]
2779
- }), n !== void 0 && s && /* @__PURE__ */ G("div", {
2780
- ref: C,
2843
+ }), r !== void 0 && s && /* @__PURE__ */ G("div", {
2844
+ ...ae,
2781
2845
  "data-scene-point": e,
2782
- onMouseDown: ne,
2783
- onPointerDown: re,
2784
- ...V.props(vi.target(`translate(${ie - fi}px, ${ae - fi}px)`), E && vi.movable, y && vi.dragging),
2785
- children: /* @__PURE__ */ G(i, {
2846
+ onMouseDown: ee,
2847
+ onPointerDown: te,
2848
+ ...H.props(xi.target(`translate(${B - hi}px, ${V - hi}px)`), w && xi.movable, v && xi.dragging),
2849
+ children: /* @__PURE__ */ G(n, {
2786
2850
  value: e,
2787
2851
  render: /* @__PURE__ */ G("div", {}),
2788
- ...V.props(vi.mark, ...Kt({
2789
- ...R,
2852
+ ...H.props(xi.mark, ...qt({
2853
+ ...I,
2790
2854
  isInspected: !1,
2791
2855
  isSelected: !1
2792
2856
  }))
@@ -2794,12 +2858,12 @@ function wi({ id: e, at: t, label: n, text: r, tone: a, emphasis: o, isShown: s
2794
2858
  })] });
2795
2859
  }
2796
2860
  // packages/teaching/src/scene/plane/scene-projection.tsx
2797
- var Ti = { maximumFractionDigits: 2 }, Ei = 6, Di = 6, Oi = 14;
2798
- function ki({ id: e, of: t, at: n, format: r = Ti, tone: i, isShown: a = !0, pace: o, labels: s }) {
2861
+ var Ai = { maximumFractionDigits: 2 }, ji = 6, Mi = 6, Ni = 14;
2862
+ function Pi({ id: e, of: t, at: n, format: r = Ai, tone: i, isShown: a = !0, pace: o, labels: s }) {
2799
2863
  let c = J(), l = b(e), u = {
2800
- ...Hr,
2864
+ ...Gr,
2801
2865
  ...s
2802
- }, d = et(t === void 0 ? [] : [t])[0], f = t === void 0 != (n === void 0), p = Y({
2866
+ }, d = tt(t === void 0 ? [] : [t])[0], f = t === void 0 != (n === void 0), p = Y({
2803
2867
  id: e,
2804
2868
  kind: "projection",
2805
2869
  frame: n === void 0 ? void 0 : {
@@ -2839,12 +2903,12 @@ function ki({ id: e, of: t, at: n, format: r = Ti, tone: i, isShown: a = !0, pac
2839
2903
  x: h.left,
2840
2904
  y: v
2841
2905
  }]];
2842
- return /* @__PURE__ */ K(Mr, {
2906
+ return /* @__PURE__ */ K(Fr, {
2843
2907
  id: e,
2844
2908
  layer: "front",
2845
2909
  opacity: p.values.opacity,
2846
2910
  children: [
2847
- /* @__PURE__ */ G(B, {
2911
+ /* @__PURE__ */ G(te, {
2848
2912
  x1: _,
2849
2913
  y1: v,
2850
2914
  x2: _,
@@ -2852,7 +2916,7 @@ function ki({ id: e, of: t, at: n, format: r = Ti, tone: i, isShown: a = !0, pac
2852
2916
  stroke: "dashed",
2853
2917
  tone: y
2854
2918
  }),
2855
- /* @__PURE__ */ G(B, {
2919
+ /* @__PURE__ */ G(te, {
2856
2920
  x1: _,
2857
2921
  y1: v,
2858
2922
  x2: h.left,
@@ -2860,34 +2924,34 @@ function ki({ id: e, of: t, at: n, format: r = Ti, tone: i, isShown: a = !0, pac
2860
2924
  stroke: "dashed",
2861
2925
  tone: y
2862
2926
  }),
2863
- /* @__PURE__ */ G(ui, {
2927
+ /* @__PURE__ */ G(pi, {
2864
2928
  owner: e,
2865
2929
  name: "across",
2866
2930
  spots: [{
2867
- x: _ + Ei,
2868
- y: h.bottom - Ei,
2931
+ x: _ + ji,
2932
+ y: h.bottom - ji,
2869
2933
  anchor: "start",
2870
2934
  text: x
2871
2935
  }, {
2872
- x: _ - Ei,
2873
- y: h.bottom - Ei,
2936
+ x: _ - ji,
2937
+ y: h.bottom - ji,
2874
2938
  anchor: "end",
2875
2939
  text: x
2876
2940
  }],
2877
2941
  lines: C,
2878
2942
  isStrong: !0
2879
2943
  }),
2880
- /* @__PURE__ */ G(ui, {
2944
+ /* @__PURE__ */ G(pi, {
2881
2945
  owner: e,
2882
2946
  name: "up",
2883
2947
  spots: [{
2884
- x: h.left + Ei,
2885
- y: v - Di,
2948
+ x: h.left + ji,
2949
+ y: v - Mi,
2886
2950
  anchor: "start",
2887
2951
  text: S
2888
2952
  }, {
2889
- x: h.left + Ei,
2890
- y: v + Oi,
2953
+ x: h.left + ji,
2954
+ y: v + Ni,
2891
2955
  anchor: "start",
2892
2956
  text: S
2893
2957
  }],
@@ -2898,12 +2962,12 @@ function ki({ id: e, of: t, at: n, format: r = Ti, tone: i, isShown: a = !0, pac
2898
2962
  });
2899
2963
  }
2900
2964
  // packages/teaching/src/scene/plane/scene-region.tsx
2901
- var Ai = 3, ji = 16, Mi = 8, Ni = 4, Pi = [
2965
+ var Fi = 3, Ii = 16, Li = 8, Ri = 4, zi = [
2902
2966
  .5,
2903
2967
  .25,
2904
2968
  .75
2905
2969
  ];
2906
- function Fi(e, t) {
2970
+ function Bi(e, t) {
2907
2971
  let { between: n, above: r, below: i, points: a } = e, o = [
2908
2972
  n,
2909
2973
  r,
@@ -2927,29 +2991,29 @@ function Fi(e, t) {
2927
2991
  [n[0], u]
2928
2992
  ] : [];
2929
2993
  }
2930
- function Ii({ id: e, corners: t, labels: n }) {
2931
- return t.length < Ai || t.length > Wr.polygonPoints ? q(n.regionShape, { id: e }) : t.every(([e, t]) => Number.isFinite(e) && Number.isFinite(t)) ? void 0 : q(n.notFinite, {
2994
+ function Vi({ id: e, corners: t, labels: n }) {
2995
+ return t.length < Fi || t.length > qr.polygonPoints ? q(n.regionShape, { id: e }) : t.every(([e, t]) => Number.isFinite(e) && Number.isFinite(t)) ? void 0 : q(n.notFinite, {
2932
2996
  kind: "region",
2933
2997
  id: e
2934
2998
  });
2935
2999
  }
2936
- function Li({ id: e, between: t, above: n, below: r, points: i, label: a, text: o, tone: s, emphasis: c, isShown: l = !0, isActive: u = !1, pace: d, labels: f }) {
3000
+ function Hi({ id: e, between: t, above: n, below: r, points: i, label: a, text: o, tone: s, emphasis: c, isShown: l = !0, isActive: u = !1, pace: d, labels: f }) {
2937
3001
  let p = J(), m = b(e), h = {
2938
- ...Hr,
3002
+ ...Gr,
2939
3003
  ...f
2940
- }, g = Fi({
3004
+ }, g = Bi({
2941
3005
  between: t,
2942
3006
  above: n,
2943
3007
  below: r,
2944
3008
  points: i
2945
- }, p.domain), _ = Ii({
3009
+ }, p.domain), _ = Vi({
2946
3010
  id: e,
2947
3011
  corners: g,
2948
3012
  labels: h
2949
- }), y = _ === void 0 ? g : [], x = Object.fromEntries(y.flatMap(([e, t], n) => [[`cx${n}`, e], [`cy${n}`, t]])), S = ei(y.map(([e, t]) => ({
3013
+ }), y = _ === void 0 ? g : [], x = Object.fromEntries(y.flatMap(([e, t], n) => [[`cx${n}`, e], [`cy${n}`, t]])), S = ri(y.map(([e, t]) => ({
2950
3014
  x: e,
2951
3015
  y: t
2952
- }))), [C, w] = Jr([S.x, S.y], p.domain), T = Y({
3016
+ }))), [C, w] = Zr([S.x, S.y], p.domain), T = Y({
2953
3017
  id: e,
2954
3018
  kind: "region",
2955
3019
  frame: {
@@ -2972,35 +3036,35 @@ function Li({ id: e, between: t, above: n, below: r, points: i, label: a, text:
2972
3036
  let { values: E } = T, D = y.map((e, t) => ({
2973
3037
  x: p.x.position(E[`cx${t}`] ?? 0),
2974
3038
  y: p.y.position(E[`cy${t}`] ?? 0)
2975
- })), O = `${ae(D)}Z`, k = {
3039
+ })), O = `${ie(D)}Z`, k = {
2976
3040
  x: p.x.position(S.x),
2977
3041
  y: p.y.position(S.y)
2978
3042
  }, A = Math.min(...D.map((e) => e.y)), j = Math.max(...D.map((e) => e.y)), M = s ?? m ?? "neutral", N = Math.max(Math.min(...D.map((e) => e.x)), p.box.left), P = Math.min(Math.max(...D.map((e) => e.x)), p.box.right), F = [
2979
- Math.max(A, p.box.top) + ji,
2980
- k.y + Ni,
2981
- Math.min(j, p.box.bottom) - Mi
3043
+ Math.max(A, p.box.top) + Ii,
3044
+ k.y + Ri,
3045
+ Math.min(j, p.box.bottom) - Li
2982
3046
  ];
2983
- return /* @__PURE__ */ K(Mr, {
3047
+ return /* @__PURE__ */ K(Fr, {
2984
3048
  id: e,
2985
3049
  layer: "back",
2986
3050
  opacity: E.opacity,
2987
3051
  children: [/* @__PURE__ */ K(v, {
2988
3052
  box: p.box,
2989
- children: [/* @__PURE__ */ G(te, {
3053
+ children: [/* @__PURE__ */ G(B, {
2990
3054
  d: O,
2991
3055
  tone: M,
2992
3056
  emphasis: T.emphasis
2993
- }), /* @__PURE__ */ G(Nr, {
3057
+ }), /* @__PURE__ */ G(Ir, {
2994
3058
  id: e,
2995
3059
  d: O,
2996
3060
  hasLabel: a !== void 0 && l,
2997
3061
  isCursor: T.isCursor,
2998
3062
  reach: "fill"
2999
3063
  })]
3000
- }), o !== void 0 && /* @__PURE__ */ G(ui, {
3064
+ }), o !== void 0 && /* @__PURE__ */ G(pi, {
3001
3065
  owner: e,
3002
3066
  name: "text",
3003
- spots: F.flatMap((e) => Pi.map((t) => ({
3067
+ spots: F.flatMap((e) => zi.map((t) => ({
3004
3068
  x: N + (P - N) * t,
3005
3069
  y: e,
3006
3070
  anchor: "middle",
@@ -3010,22 +3074,22 @@ function Li({ id: e, between: t, above: n, below: r, points: i, label: a, text:
3010
3074
  });
3011
3075
  }
3012
3076
  // packages/teaching/src/scene/plane/scene-rule.tsx
3013
- var Ri = 6, zi = 14, Bi = 6, Vi = 12, Hi = [
3077
+ var Ui = 6, Wi = 14, Gi = 6, Ki = 12, qi = [
3014
3078
  .75,
3015
3079
  .25,
3016
3080
  .5
3017
3081
  ];
3018
- function Ui({ box: e, at: t, text: n }) {
3019
- let r = Hi.map((t) => e.left + e.innerWidth * t);
3020
- return [t - Ri, t + zi].flatMap((t) => [
3082
+ function Ji({ box: e, at: t, text: n }) {
3083
+ let r = qi.map((t) => e.left + e.innerWidth * t);
3084
+ return [t - Ui, t + Wi].flatMap((t) => [
3021
3085
  {
3022
- x: e.right - Bi,
3086
+ x: e.right - Gi,
3023
3087
  y: t,
3024
3088
  anchor: "end",
3025
3089
  text: n
3026
3090
  },
3027
3091
  {
3028
- x: e.left + Bi,
3092
+ x: e.left + Gi,
3029
3093
  y: t,
3030
3094
  anchor: "start",
3031
3095
  text: n
@@ -3038,20 +3102,20 @@ function Ui({ box: e, at: t, text: n }) {
3038
3102
  }))
3039
3103
  ]);
3040
3104
  }
3041
- function Wi({ box: e, at: t, text: n }) {
3042
- let r = Hi.map((t) => e.top + e.innerHeight * t);
3043
- return [t + Bi, t - Bi].flatMap((i) => {
3105
+ function Yi({ box: e, at: t, text: n }) {
3106
+ let r = qi.map((t) => e.top + e.innerHeight * t);
3107
+ return [t + Gi, t - Gi].flatMap((i) => {
3044
3108
  let a = i > t ? "start" : "end";
3045
3109
  return [
3046
3110
  {
3047
3111
  x: i,
3048
- y: e.top + Vi,
3112
+ y: e.top + Ki,
3049
3113
  anchor: a,
3050
3114
  text: n
3051
3115
  },
3052
3116
  {
3053
3117
  x: i,
3054
- y: e.bottom - Bi,
3118
+ y: e.bottom - Gi,
3055
3119
  anchor: a,
3056
3120
  text: n
3057
3121
  },
@@ -3064,14 +3128,14 @@ function Wi({ box: e, at: t, text: n }) {
3064
3128
  ];
3065
3129
  });
3066
3130
  }
3067
- function Gi({ id: e, x: t, y: n, label: r, text: i, tone: a, emphasis: o, isDashed: s = !0, isShown: c = !0, isActive: l = !1, pace: u, labels: d }) {
3131
+ function Xi({ id: e, x: t, y: n, label: r, text: i, tone: a, emphasis: o, isDashed: s = !0, isShown: c = !0, isActive: l = !1, pace: u, labels: d }) {
3068
3132
  let f = J(), p = b(e), m = {
3069
- ...Hr,
3133
+ ...Gr,
3070
3134
  ...d
3071
3135
  }, h = t !== void 0, g = (h ? t : n) ?? 0, _ = t === void 0 != (n === void 0), y = Number.isFinite(g), [x, S] = f.domain.x, [C, w] = f.domain.y, T = _ ? void 0 : q(m.ruleAxis, { id: e }), E = y ? void 0 : q(m.notFinite, {
3072
3136
  kind: "rule",
3073
3137
  id: e
3074
- }), D = qr(y ? g : 0, h ? f.domain.x : f.domain.y), O = Y({
3138
+ }), D = Xr(y ? g : 0, h ? f.domain.x : f.domain.y), O = Y({
3075
3139
  id: e,
3076
3140
  kind: "rule",
3077
3141
  frame: h ? {
@@ -3094,7 +3158,7 @@ function Gi({ id: e, x: t, y: n, label: r, text: i, tone: a, emphasis: o, isDash
3094
3158
  problem: T ?? E,
3095
3159
  pace: u
3096
3160
  });
3097
- if (Qn({
3161
+ if (tr({
3098
3162
  id: e,
3099
3163
  line: [h ? {
3100
3164
  x: O.values.value,
@@ -3121,30 +3185,30 @@ function Gi({ id: e, x: t, y: n, label: r, text: i, tone: a, emphasis: o, isDash
3121
3185
  y1: j,
3122
3186
  x2: k.right,
3123
3187
  y2: j
3124
- }, F = ae([{
3188
+ }, F = ie([{
3125
3189
  x: P.x1,
3126
3190
  y: P.y1
3127
3191
  }, {
3128
3192
  x: P.x2,
3129
3193
  y: P.y2
3130
- }]), I = h ? Wi : Ui;
3131
- return /* @__PURE__ */ K(Mr, {
3194
+ }]), I = h ? Yi : Ji;
3195
+ return /* @__PURE__ */ K(Fr, {
3132
3196
  id: e,
3133
3197
  layer: "back",
3134
3198
  opacity: O.values.opacity * O.strength,
3135
3199
  children: [/* @__PURE__ */ K(v, {
3136
3200
  box: k,
3137
- children: [/* @__PURE__ */ G(B, {
3201
+ children: [/* @__PURE__ */ G(te, {
3138
3202
  ...P,
3139
3203
  stroke: M,
3140
3204
  tone: N
3141
- }), /* @__PURE__ */ G(Nr, {
3205
+ }), /* @__PURE__ */ G(Ir, {
3142
3206
  id: e,
3143
3207
  d: F,
3144
3208
  hasLabel: r !== void 0 && c,
3145
3209
  isCursor: O.isCursor
3146
3210
  })]
3147
- }), i !== void 0 && /* @__PURE__ */ G(ui, {
3211
+ }), i !== void 0 && /* @__PURE__ */ G(pi, {
3148
3212
  owner: e,
3149
3213
  name: "text",
3150
3214
  spots: I({
@@ -3156,8 +3220,8 @@ function Gi({ id: e, x: t, y: n, label: r, text: i, tone: a, emphasis: o, isDash
3156
3220
  });
3157
3221
  }
3158
3222
  // packages/teaching/src/scene/plane/scene-vector.tsx
3159
- var Ki = [0, 0], qi = 10, Ji = 5, Yi = 4, Xi = 1, Zi = .5;
3160
- function Qi(e, t) {
3223
+ var Zi = [0, 0], Qi = 10, $i = 5, ea = 4, ta = 1, na = .5;
3224
+ function ra(e, t) {
3161
3225
  let n = Math.hypot(t.x - e.x, t.y - e.y);
3162
3226
  return n === 0 ? {
3163
3227
  x: 1,
@@ -3167,9 +3231,9 @@ function Qi(e, t) {
3167
3231
  y: (t.y - e.y) / n
3168
3232
  };
3169
3233
  }
3170
- function $i({ id: e, to: t, from: n = Ki, label: r, text: i, tone: a, emphasis: o, isDashed: s = !1, thickness: c = "regular", isShown: l = !0, isActive: u = !1, pace: d, labels: f }) {
3234
+ function ia({ id: e, to: t, from: n = Zi, label: r, text: i, tone: a, emphasis: o, isDashed: s = !1, thickness: c = "regular", isShown: l = !0, isActive: u = !1, pace: d, labels: f }) {
3171
3235
  let p = J(), m = b(e), h = {
3172
- ...Hr,
3236
+ ...Gr,
3173
3237
  ...f
3174
3238
  }, g = [...n, ...t].every((e) => Number.isFinite(e)), _ = g ? {
3175
3239
  fx: n[0],
@@ -3181,7 +3245,7 @@ function $i({ id: e, to: t, from: n = Ki, label: r, text: i, tone: a, emphasis:
3181
3245
  fy: 0,
3182
3246
  tx: 0,
3183
3247
  ty: 0
3184
- }, [y, x] = Jr([(_.fx + _.tx) * Zi, (_.fy + _.ty) * Zi], p.domain), S = Y({
3248
+ }, [y, x] = Zr([(_.fx + _.tx) * na, (_.fy + _.ty) * na], p.domain), S = Y({
3185
3249
  id: e,
3186
3250
  kind: "vector",
3187
3251
  frame: {
@@ -3202,7 +3266,7 @@ function $i({ id: e, to: t, from: n = Ki, label: r, text: i, tone: a, emphasis:
3202
3266
  }),
3203
3267
  pace: d
3204
3268
  });
3205
- if (Qn({
3269
+ if (tr({
3206
3270
  id: e,
3207
3271
  line: S.isVisible && g ? [{
3208
3272
  x: S.values.fx,
@@ -3219,44 +3283,44 @@ function $i({ id: e, to: t, from: n = Ki, label: r, text: i, tone: a, emphasis:
3219
3283
  }, T = {
3220
3284
  x: p.x.position(C.tx),
3221
3285
  y: p.y.position(C.ty)
3222
- }, E = Qi(w, T), D = {
3223
- x: T.x - E.x * qi,
3224
- y: T.y - E.y * qi
3286
+ }, E = ra(w, T), D = {
3287
+ x: T.x - E.x * Qi,
3288
+ y: T.y - E.y * Qi
3225
3289
  }, O = {
3226
- x: D.x - E.y * Ji,
3227
- y: D.y + E.x * Ji
3290
+ x: D.x - E.y * $i,
3291
+ y: D.y + E.x * $i
3228
3292
  }, k = {
3229
- x: D.x + E.y * Ji,
3230
- y: D.y - E.x * Ji
3231
- }, A = ae([w, T]), j = `${A}${ae([
3293
+ x: D.x + E.y * $i,
3294
+ y: D.y - E.x * $i
3295
+ }, A = ie([w, T]), j = `${A}${ie([
3232
3296
  O,
3233
3297
  T,
3234
3298
  k
3235
- ])}`, M = Gr[c] + (S.isInspected ? Xi : 0), N = a ?? m ?? "series2";
3236
- return /* @__PURE__ */ K(Mr, {
3299
+ ])}`, M = Jr[c] + (S.isInspected ? ta : 0), N = a ?? m ?? "series2";
3300
+ return /* @__PURE__ */ K(Fr, {
3237
3301
  id: e,
3238
3302
  layer: "front",
3239
3303
  opacity: C.opacity,
3240
3304
  children: [/* @__PURE__ */ K(v, {
3241
3305
  box: p.box,
3242
- children: [/* @__PURE__ */ G(re, {
3306
+ children: [/* @__PURE__ */ G(ne, {
3243
3307
  d: j,
3244
3308
  tone: N,
3245
3309
  width: M,
3246
3310
  stroke: s ? "dashed" : "solid",
3247
3311
  emphasis: S.emphasis
3248
- }), /* @__PURE__ */ G(Nr, {
3312
+ }), /* @__PURE__ */ G(Ir, {
3249
3313
  id: e,
3250
3314
  d: A,
3251
3315
  hasLabel: r !== void 0 && l,
3252
3316
  isCursor: S.isCursor
3253
3317
  })]
3254
- }), i !== void 0 && /* @__PURE__ */ G(ui, {
3318
+ }), i !== void 0 && /* @__PURE__ */ G(pi, {
3255
3319
  owner: e,
3256
3320
  name: "text",
3257
- spots: li({
3258
- x: T.x + E.x * Yi,
3259
- y: T.y + E.y * Yi,
3321
+ spots: fi({
3322
+ x: T.x + E.x * ea,
3323
+ y: T.y + E.y * ea,
3260
3324
  text: i
3261
3325
  }),
3262
3326
  lines: [[w, T]]
@@ -3264,7 +3328,7 @@ function $i({ id: e, to: t, from: n = Ki, label: r, text: i, tone: a, emphasis:
3264
3328
  });
3265
3329
  }
3266
3330
  // packages/teaching/src/scene/shapes/stack-book.ts
3267
- function ea() {
3331
+ function aa() {
3268
3332
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = {
3269
3333
  isDirty: !1,
3270
3334
  version: 0
@@ -3305,7 +3369,7 @@ function ea() {
3305
3369
  })
3306
3370
  };
3307
3371
  }
3308
- var ta = je(ea), na = {
3372
+ var oa = Me(aa), sa = {
3309
3373
  small: {
3310
3374
  width: 56,
3311
3375
  height: 78
@@ -3318,26 +3382,26 @@ var ta = je(ea), na = {
3318
3382
  width: 144,
3319
3383
  height: 202
3320
3384
  }
3321
- }, ra = {
3385
+ }, ca = {
3322
3386
  small: 4,
3323
3387
  medium: 12,
3324
3388
  large: 24
3325
- }, ia = {
3389
+ }, la = {
3326
3390
  depthMax: 8,
3327
3391
  across: 1.5,
3328
3392
  up: 2
3329
- }, aa = {
3393
+ }, ua = {
3330
3394
  overlap: .3,
3331
3395
  arc: 12,
3332
3396
  turn: 14
3333
- }, oa = .5, sa = Math.PI / 180;
3334
- function ca({ layout: e, count: t, size: n, gap: r, index: i }) {
3335
- let a = na[n], o = ra[r], s = (Math.max(t, 1) - 1) * oa, c = i - s;
3397
+ }, da = .5, fa = Math.PI / 180;
3398
+ function pa({ layout: e, count: t, size: n, gap: r, index: i }) {
3399
+ let a = sa[n], o = ca[r], s = (Math.max(t, 1) - 1) * da, c = i - s;
3336
3400
  switch (e) {
3337
3401
  case "pile": {
3338
- let e = Math.min(i, ia.depthMax);
3402
+ let e = Math.min(i, la.depthMax);
3339
3403
  return {
3340
- offset: [e * ia.across, -e * ia.up],
3404
+ offset: [e * la.across, -e * la.up],
3341
3405
  rotate: 0
3342
3406
  };
3343
3407
  }
@@ -3352,18 +3416,18 @@ function ca({ layout: e, count: t, size: n, gap: r, index: i }) {
3352
3416
  case "fan": {
3353
3417
  let e = s === 0 ? 0 : c / s;
3354
3418
  return {
3355
- offset: [c * (a.width * aa.overlap + o), aa.arc * e * e],
3356
- rotate: aa.turn * e
3419
+ offset: [c * (a.width * ua.overlap + o), ua.arc * e * e],
3420
+ rotate: ua.turn * e
3357
3421
  };
3358
3422
  }
3359
3423
  }
3360
3424
  }
3361
- function la(e) {
3362
- let t = na[e.size], n = Array.from({ length: Math.max(e.count, 1) }, (n, r) => {
3363
- let { offset: i, rotate: a } = ca({
3425
+ function ma(e) {
3426
+ let t = sa[e.size], n = Array.from({ length: Math.max(e.count, 1) }, (n, r) => {
3427
+ let { offset: i, rotate: a } = pa({
3364
3428
  ...e,
3365
3429
  index: r
3366
- }), o = Math.abs(Math.cos(a * sa)), s = Math.abs(Math.sin(a * sa)), c = (t.width * o + t.height * s) * oa, l = (t.width * s + t.height * o) * oa;
3430
+ }), o = Math.abs(Math.cos(a * fa)), s = Math.abs(Math.sin(a * fa)), c = (t.width * o + t.height * s) * da, l = (t.width * s + t.height * o) * da;
3367
3431
  return {
3368
3432
  left: i[0] - c,
3369
3433
  right: i[0] + c,
@@ -3372,13 +3436,13 @@ function la(e) {
3372
3436
  };
3373
3437
  }), r = Math.min(...n.map((e) => e.left)), i = Math.max(...n.map((e) => e.right)), a = Math.min(...n.map((e) => e.top)), o = Math.max(...n.map((e) => e.bottom));
3374
3438
  return {
3375
- offset: [(r + i) * oa, (a + o) * oa],
3439
+ offset: [(r + i) * da, (a + o) * da],
3376
3440
  width: i - r,
3377
3441
  height: o - a
3378
3442
  };
3379
3443
  }
3380
3444
  // packages/teaching/src/scene/shapes/scene-card.tsx
3381
- var ua = [
3445
+ var ha = [
3382
3446
  "A",
3383
3447
  "2",
3384
3448
  "3",
@@ -3392,12 +3456,12 @@ var ua = [
3392
3456
  "J",
3393
3457
  "Q",
3394
3458
  "K"
3395
- ], da = [
3459
+ ], ga = [
3396
3460
  "heart",
3397
3461
  "diamond",
3398
3462
  "spade",
3399
3463
  "club"
3400
- ], fa = {
3464
+ ], _a = {
3401
3465
  ranks: {
3402
3466
  A: "Ace",
3403
3467
  2: "2",
@@ -3422,17 +3486,17 @@ var ua = [
3422
3486
  name: "{rank} of {suit}",
3423
3487
  faceDown: "A card, face down",
3424
3488
  noPlace: "The card \"{id}\" has no place. Give it `at`, or list it in a SceneStack declared before it."
3425
- }, pa = {
3489
+ }, va = {
3426
3490
  heart: "negative",
3427
3491
  diamond: "negative",
3428
3492
  spade: "series1",
3429
3493
  club: "series1"
3430
- }, ma = {
3494
+ }, ya = {
3431
3495
  heart: "♥",
3432
3496
  diamond: "♦",
3433
3497
  spade: "♠",
3434
3498
  club: "♣"
3435
- }, ha = 100, ga = {
3499
+ }, ba = 100, xa = {
3436
3500
  kSGwAc: "xkh2ocl",
3437
3501
  kzQI83: "x1iyjqo2",
3438
3502
  kaIpWk: "x1ok0vyi",
@@ -3440,7 +3504,7 @@ var ua = [
3440
3504
  ksu8eU: "x1y0btm7",
3441
3505
  kVAM5u: "x6w5c0t",
3442
3506
  $$css: !0
3443
- }, _a = {
3507
+ }, Sa = {
3444
3508
  face: {
3445
3509
  kVAEAm: "x1n2onr6",
3446
3510
  kzqmXN: "xh8yej3",
@@ -3478,7 +3542,7 @@ var ua = [
3478
3542
  $$css: !0
3479
3543
  },
3480
3544
  lattice: (e) => [
3481
- ga,
3545
+ xa,
3482
3546
  {
3483
3547
  kKwaWg: [`repeating-linear-gradient(45deg, color-mix(in srgb, ${e} 45%, transparent) 0 1.5px, transparent 1.5px 7px)`, `repeating-linear-gradient(-45deg, color-mix(in srgb, ${e} 45%, transparent) 0 1.5px, transparent 1.5px 7px)`].join(", ") == null ? [`repeating-linear-gradient(45deg, color-mix(in srgb, ${e} 45%, transparent) 0 1.5px, transparent 1.5px 7px)`, `repeating-linear-gradient(-45deg, color-mix(in srgb, ${e} 45%, transparent) 0 1.5px, transparent 1.5px 7px)`].join(", ") : "x1e87kdn",
3484
3548
  $$css: !0
@@ -3488,7 +3552,7 @@ var ua = [
3488
3552
  "--x-borderColor": `color-mix(in srgb, ${e} 55%, transparent)` == null ? void 0 : `color-mix(in srgb, ${e} 55%, transparent)`
3489
3553
  }
3490
3554
  ]
3491
- }, va = {
3555
+ }, Ca = {
3492
3556
  small: {
3493
3557
  kGuDYH: "xfifm61",
3494
3558
  $$css: !0
@@ -3501,9 +3565,9 @@ var ua = [
3501
3565
  kGuDYH: "x1pvqxga",
3502
3566
  $$css: !0
3503
3567
  }
3504
- }, ya = {
3568
+ }, wa = {
3505
3569
  small: {
3506
- kGuDYH: "x1j6dyjg",
3570
+ kGuDYH: "xfifm61",
3507
3571
  $$css: !0
3508
3572
  },
3509
3573
  medium: {
@@ -3514,7 +3578,7 @@ var ua = [
3514
3578
  kGuDYH: "x1i1m3gp",
3515
3579
  $$css: !0
3516
3580
  }
3517
- }, ba = {
3581
+ }, Ta = {
3518
3582
  small: {
3519
3583
  kGuDYH: "x1ewwscv",
3520
3584
  $$css: !0
@@ -3528,59 +3592,59 @@ var ua = [
3528
3592
  $$css: !0
3529
3593
  }
3530
3594
  };
3531
- function xa({ rank: e, suit: t, labels: n }) {
3595
+ function Ea({ rank: e, suit: t, labels: n }) {
3532
3596
  return q(n.name, {
3533
3597
  rank: n.ranks[e],
3534
3598
  suit: n.suits[t]
3535
3599
  });
3536
3600
  }
3537
- function Sa({ rank: e, suit: t, size: n, placement: r }) {
3601
+ function Da({ rank: e, suit: t, size: n, placement: r }) {
3538
3602
  return /* @__PURE__ */ K("span", {
3539
3603
  "aria-hidden": !0,
3540
- ...V.props(_a.corner, va[n], r),
3604
+ ...H.props(Sa.corner, Ca[n], r),
3541
3605
  children: [/* @__PURE__ */ G("span", { children: e }), /* @__PURE__ */ G("span", {
3542
- ...V.props(ya[n]),
3543
- children: ma[t]
3606
+ ...H.props(wa[n]),
3607
+ children: ya[t]
3544
3608
  })]
3545
3609
  });
3546
3610
  }
3547
- function Ca({ rank: e, suit: t, size: n, color: r, name: i, children: a }) {
3611
+ function Oa({ rank: e, suit: t, size: n, color: r, name: i, children: a }) {
3548
3612
  let o = a != null;
3549
3613
  return /* @__PURE__ */ K("div", {
3550
3614
  role: "img",
3551
3615
  "aria-label": i,
3552
- ...V.props(_a.face, _a.inkColor(r)),
3616
+ ...H.props(Sa.face, Sa.inkColor(r)),
3553
3617
  children: [
3554
- /* @__PURE__ */ G(Sa, {
3618
+ /* @__PURE__ */ G(Da, {
3555
3619
  rank: e,
3556
3620
  suit: t,
3557
3621
  size: n,
3558
- placement: _a.topLeft
3622
+ placement: Sa.topLeft
3559
3623
  }),
3560
3624
  /* @__PURE__ */ G("div", {
3561
3625
  "aria-hidden": !0,
3562
3626
  className: "x10l6tqk x10a8y8t x78zum5 x6s0dn4 xl56j7k",
3563
3627
  children: o ? a : /* @__PURE__ */ G("span", {
3564
- ...V.props(_a.pip, ba[n]),
3565
- children: ma[t]
3628
+ ...H.props(Sa.pip, Ta[n]),
3629
+ children: ya[t]
3566
3630
  })
3567
3631
  }),
3568
- /* @__PURE__ */ G(Sa, {
3632
+ /* @__PURE__ */ G(Da, {
3569
3633
  rank: e,
3570
3634
  suit: t,
3571
3635
  size: n,
3572
- placement: _a.bottomRight
3636
+ placement: Sa.bottomRight
3573
3637
  })
3574
3638
  ]
3575
3639
  });
3576
3640
  }
3577
- function wa({ id: e, at: t, offset: n, rotate: r, rank: i, suit: a, text: o, label: s, isFaceUp: c = !0, lift: l = 0, tilt: u = 0, size: d = "medium", tone: f, emphasis: p, isShown: m = !0, isActive: h = !1, back: g, children: _, order: v, delay: y, pace: x, labels: S }) {
3578
- let { registry: C } = J(), w = ta(C), T = {
3579
- ...fa,
3641
+ function ka({ id: e, at: t, offset: n, rotate: r, rank: i, suit: a, text: o, label: s, isFaceUp: c = !0, lift: l = 0, tilt: u = 0, size: d = "medium", tone: f, emphasis: p, isShown: m = !0, isActive: h = !1, back: g, children: _, order: v, delay: y, pace: x, labels: S }) {
3642
+ let { registry: C } = J(), w = oa(C), T = {
3643
+ ..._a,
3580
3644
  ...S
3581
3645
  }, E = b(e), D = b(a ?? "");
3582
3646
  ve(w.subscribe, w.version, w.version);
3583
- let O = w.slotOf(e), k = O?.spec.size ?? d, A = O === void 0 ? void 0 : ca({
3647
+ let O = w.slotOf(e), k = O?.spec.size ?? d, A = O === void 0 ? void 0 : pa({
3584
3648
  ...O.spec,
3585
3649
  count: O.spec.cards.length,
3586
3650
  index: O.index
@@ -3589,17 +3653,17 @@ function wa({ id: e, at: t, offset: n, rotate: r, rank: i, suit: a, text: o, lab
3589
3653
  className: "xr5kp14 x1hz01jw xy8obcc",
3590
3654
  children: q(T.noPlace, { id: e })
3591
3655
  });
3592
- let j = a === void 0 ? "neutral" : pa[a], M = f ?? E ?? D ?? j, P = i !== void 0 && a !== void 0, F = P ? xa({
3656
+ let j = a === void 0 ? "neutral" : va[a], M = f ?? E ?? D ?? j, P = i !== void 0 && a !== void 0, F = P ? Ea({
3593
3657
  rank: i,
3594
3658
  suit: a,
3595
3659
  labels: T
3596
- }) : o, I = s ?? (c || F === void 0 ? F : q(T.faceDown, { name: F })), L = P ? "neutral" : M, R = O !== void 0 && O.spec.layout !== "pile", ee = (O?.index ?? 0) + (R ? ha : 0);
3597
- return /* @__PURE__ */ G(cn, {
3660
+ }) : o, I = s ?? (c || F === void 0 ? F : q(T.faceDown, { name: F })), L = P ? "neutral" : M, R = O !== void 0 && O.spec.layout !== "pile", z = (O?.index ?? 0) + (R ? ba : 0);
3661
+ return /* @__PURE__ */ G(un, {
3598
3662
  id: e,
3599
3663
  at: O?.spec.at ?? t ?? [0, 0],
3600
3664
  offset: A?.offset ?? n,
3601
3665
  rotate: A?.rotate ?? r,
3602
- size: na[k],
3666
+ size: sa[k],
3603
3667
  text: P ? void 0 : o,
3604
3668
  label: I,
3605
3669
  tone: M,
@@ -3610,7 +3674,7 @@ function wa({ id: e, at: t, offset: n, rotate: r, rank: i, suit: a, text: o, lab
3610
3674
  turn: +!c,
3611
3675
  lift: l,
3612
3676
  tilt: u,
3613
- order: v ?? ee,
3677
+ order: v ?? z,
3614
3678
  delay: y,
3615
3679
  stagger: O?.spec.stagger === void 0 ? void 0 : {
3616
3680
  group: O.stackId,
@@ -3619,8 +3683,8 @@ function wa({ id: e, at: t, offset: n, rotate: r, rank: i, suit: a, text: o, lab
3619
3683
  },
3620
3684
  pace: x,
3621
3685
  backTone: L,
3622
- back: g ?? /* @__PURE__ */ G("div", { ...V.props(_a.lattice(N[L])) }),
3623
- children: P ? /* @__PURE__ */ G(Ca, {
3686
+ back: g ?? /* @__PURE__ */ G("div", { ...H.props(Sa.lattice(N[L])) }),
3687
+ children: P ? /* @__PURE__ */ G(Oa, {
3624
3688
  rank: i,
3625
3689
  suit: a,
3626
3690
  size: k,
@@ -3631,23 +3695,23 @@ function wa({ id: e, at: t, offset: n, rotate: r, rank: i, suit: a, text: o, lab
3631
3695
  });
3632
3696
  }
3633
3697
  // packages/teaching/src/scene/shapes/scene-stack.tsx
3634
- var Ta = {
3698
+ var Aa = {
3635
3699
  sharedCard: "The stack \"{id}\" lists the card \"{card}\", which another stack lists too. A card sits in one stack.",
3636
3700
  repeatedCard: "The stack \"{id}\" lists the card \"{card}\" twice."
3637
3701
  };
3638
- function Ea(e) {
3702
+ function ja(e) {
3639
3703
  return e.find((t, n) => e.indexOf(t) !== n);
3640
3704
  }
3641
- function Da({ id: e, at: t, cards: n, layout: r = "pile", gap: i = "medium", size: a = "medium", stagger: o, label: s, labels: c }) {
3642
- let l = J(), u = ta(l.registry), d = {
3643
- ...Ta,
3705
+ function Ma({ id: e, at: t, cards: n, layout: r = "pile", gap: i = "medium", size: a = "medium", stagger: o, label: s, labels: c }) {
3706
+ let l = J(), u = oa(l.registry), d = {
3707
+ ...Aa,
3644
3708
  ...c
3645
- }, f = la({
3709
+ }, f = ma({
3646
3710
  layout: r,
3647
3711
  count: n.length,
3648
3712
  size: a,
3649
3713
  gap: i
3650
- }), p = u.sharedCard(e), m = Ea(n), h = [p === void 0 ? void 0 : q(d.sharedCard, {
3714
+ }), p = u.sharedCard(e), m = ja(n), h = [p === void 0 ? void 0 : q(d.sharedCard, {
3651
3715
  id: e,
3652
3716
  card: p
3653
3717
  }), m === void 0 ? void 0 : q(d.repeatedCard, {
@@ -3682,19 +3746,19 @@ function Da({ id: e, at: t, cards: n, layout: r = "pile", gap: i = "medium", siz
3682
3746
  }), l.isInScene ? null : /* @__PURE__ */ G(Q, { part: "SceneStack" });
3683
3747
  }
3684
3748
  // packages/teaching/src/scene/shapes/scene-slot.tsx
3685
- var Oa = -1, ka = 16, Aa = 20;
3686
- function ja(e) {
3687
- let t = na[e];
3749
+ var Na = -1, Pa = 16, Fa = 20;
3750
+ function Ia(e) {
3751
+ let t = sa[e];
3688
3752
  return {
3689
- width: t.width + ka,
3690
- height: t.height + ka
3753
+ width: t.width + Pa,
3754
+ height: t.height + Pa
3691
3755
  };
3692
3756
  }
3693
- var Ma = {
3757
+ var La = {
3694
3758
  ksu8eU: "x1y0btm7",
3695
3759
  kWkggS: "xl8spv7",
3696
3760
  $$css: !0
3697
- }, Na = {
3761
+ }, Ra = {
3698
3762
  slot: {
3699
3763
  kVAEAm: "x10l6tqk",
3700
3764
  kbCHJM: "xu96u03",
@@ -3726,7 +3790,7 @@ var Ma = {
3726
3790
  "--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
3727
3791
  }],
3728
3792
  active: (e) => [
3729
- Ma,
3793
+ La,
3730
3794
  {
3731
3795
  kVAM5u: e == null ? e : "x6w5c0t",
3732
3796
  $$css: !0
@@ -3742,8 +3806,8 @@ var Ma = {
3742
3806
  $$css: !0
3743
3807
  }
3744
3808
  };
3745
- function Pa({ id: e, at: t, size: n = "medium", text: r, label: a, isActive: o = !1, tone: s = "neutral", emphasis: c, isShown: l = !0 }) {
3746
- let u = typeof n == "string" ? ja(n) : n, d = Y({
3809
+ function za({ id: e, at: t, size: r = "medium", text: i, label: a, isActive: o = !1, tone: s = "neutral", emphasis: c, isShown: l = !0 }) {
3810
+ let u = typeof r == "string" ? Ia(r) : r, d = Y({
3747
3811
  id: e,
3748
3812
  kind: "slot",
3749
3813
  frame: {
@@ -3751,14 +3815,13 @@ function Pa({ id: e, at: t, size: n = "medium", text: r, label: a, isActive: o =
3751
3815
  y: t[1],
3752
3816
  width: u.width,
3753
3817
  height: u.height,
3754
- outset: r === void 0 ? void 0 : { top: Aa }
3818
+ outset: i === void 0 ? void 0 : { top: Fa }
3755
3819
  },
3756
3820
  values: {},
3757
3821
  label: a,
3758
3822
  isShown: l,
3759
- isActive: o,
3760
3823
  emphasis: c,
3761
- order: Oa
3824
+ order: Na
3762
3825
  });
3763
3826
  if (!d.scene.isInScene) return /* @__PURE__ */ G(Q, { part: "SceneSlot" });
3764
3827
  let { rect: f = {
@@ -3767,27 +3830,27 @@ function Pa({ id: e, at: t, size: n = "medium", text: r, label: a, isActive: o =
3767
3830
  right: 0,
3768
3831
  bottom: 0
3769
3832
  }, values: p } = d, m = N[s], h = Math.max(0, Math.min(1, p.opacity)) * d.strength;
3770
- return /* @__PURE__ */ G(i, {
3833
+ return /* @__PURE__ */ G(n, {
3771
3834
  value: e,
3772
3835
  render: /* @__PURE__ */ G("div", { "data-scene-slot": e }),
3773
- ...V.props(Na.slot, Na.place(`translate(${f.left}px, ${f.top}px)`, h), Na.box(p.width, p.height), o && Na.active(m), !d.isVisible && Na.gone, ...Kt(d)),
3774
- children: r !== void 0 && /* @__PURE__ */ G("span", {
3836
+ ...H.props(Ra.slot, Ra.place(`translate(${f.left}px, ${f.top}px)`, h), Ra.box(p.width, p.height), o && Ra.active(m), !d.isVisible && Ra.gone, ...qt(d)),
3837
+ children: i !== void 0 && /* @__PURE__ */ G("span", {
3775
3838
  "aria-hidden": !0,
3776
3839
  className: "x10l6tqk x17y0mx6 x10w3d4m x1cjbxdm xb3r6kr xlyipyv xuxw1ft x153jb6y x1hz01jw xy8obcc xas2l8k",
3777
- children: r
3840
+ children: i
3778
3841
  })
3779
3842
  });
3780
3843
  }
3781
3844
  // packages/teaching/src/scene/shapes/cell-color.ts
3782
- function Fa({ value: e, palette: t, domain: n }) {
3845
+ function Ba({ value: e, palette: t, domain: n }) {
3783
3846
  let r = e === void 0 || e < n[0] || e > n[1];
3784
- if (!(t === void 0 || r)) return ce(e, {
3847
+ if (!(t === void 0 || r)) return se(e, {
3785
3848
  domain: n,
3786
3849
  palette: t
3787
3850
  });
3788
3851
  }
3789
3852
  // packages/teaching/src/scene/shapes/cell-grid.ts
3790
- var Ia = {
3853
+ var Va = {
3791
3854
  small: {
3792
3855
  width: 40,
3793
3856
  height: 28
@@ -3800,33 +3863,33 @@ var Ia = {
3800
3863
  width: 76,
3801
3864
  height: 46
3802
3865
  }
3803
- }, La = 2, Ra = .5;
3804
- function za(e) {
3866
+ }, Ha = 2, Ua = .5;
3867
+ function Wa(e) {
3805
3868
  return typeof e == "number" ? [e] : e;
3806
3869
  }
3807
- function Ba({ values: e, cells: t, direction: n }) {
3870
+ function Ga({ values: e, cells: t, direction: n }) {
3808
3871
  if (t !== void 0) return t;
3809
- let r = (e ?? []).map(za);
3872
+ let r = (e ?? []).map(Wa);
3810
3873
  return ((e ?? []).every((e) => typeof e == "number") && n === "row" ? [r.flat()] : r).map((e) => e.map((e) => ({ value: e })));
3811
3874
  }
3812
- function Va({ rows: e, columns: t, size: n }) {
3813
- let r = Ia[n];
3875
+ function Ka({ rows: e, columns: t, size: n }) {
3876
+ let r = Va[n];
3814
3877
  return {
3815
3878
  width: t * r.width + Math.max(t - 1, 0) * 2,
3816
3879
  height: e * r.height + Math.max(e - 1, 0) * 2
3817
3880
  };
3818
3881
  }
3819
- function Ha({ row: e, column: t, rows: n, columns: r, size: i }) {
3820
- let a = Ia[i];
3821
- return [(t - (r - 1) * Ra) * (a.width + 2), (e - (n - 1) * Ra) * (a.height + 2)];
3882
+ function qa({ row: e, column: t, rows: n, columns: r, size: i }) {
3883
+ let a = Va[i];
3884
+ return [(t - (r - 1) * Ua) * (a.width + 2), (e - (n - 1) * Ua) * (a.height + 2)];
3822
3885
  }
3823
- function Ua({ grid: e, palette: t, domain: n }) {
3886
+ function Ja({ grid: e, palette: t, domain: n }) {
3824
3887
  if (n !== void 0) return n;
3825
3888
  let r = Math.max(0, ...e.flatMap((e) => e.map((e) => Math.abs(e.value ?? 0)))), i = r === 0 ? 1 : r;
3826
3889
  return t === "diverging" ? [-i, i] : [0, i];
3827
3890
  }
3828
3891
  // packages/teaching/src/scene/shapes/scene-cells.tsx
3829
- var Wa = {
3892
+ var Ya = {
3830
3893
  cell: "{row}, {column}: {value}",
3831
3894
  inRow: "{column}: {value}",
3832
3895
  inColumn: "{row}: {value}",
@@ -3836,7 +3899,7 @@ var Wa = {
3836
3899
  ragged: "The cells \"{id}\" have rows of different lengths.",
3837
3900
  rowLabelCount: "The cells \"{id}\" have {count} rows but {labels} row labels.",
3838
3901
  columnLabelCount: "The cells \"{id}\" have {count} columns but {labels} column labels."
3839
- }, Ga = 6, Ka = 20, qa = { maximumFractionDigits: 2 }, Ja = {
3902
+ }, Xa = 6, Za = 2, Qa = 18, $a = 10, eo = { maximumFractionDigits: 2 }, to = .5, no = {
3840
3903
  kB7OPa: "x9f619",
3841
3904
  k1xSpc: "x78zum5",
3842
3905
  kGNEyG: "x6s0dn4",
@@ -3853,10 +3916,14 @@ var Wa = {
3853
3916
  kfzvcC: "x67bb7w",
3854
3917
  k3XXqK: "x1t137rt",
3855
3918
  $$css: !0
3856
- }, Ya = {
3857
- k87sOh: "xcrr8yc",
3919
+ }, ro = {
3920
+ k1xSpc: "x78zum5",
3921
+ kGNEyG: "xuk3077",
3922
+ kjj79g: "xl56j7k",
3923
+ kVQacm: "x1rea2x4",
3924
+ khDVqt: "xeaf4i8",
3858
3925
  $$css: !0
3859
- }, Xa = {
3926
+ }, io = {
3860
3927
  kbCHJM: "xgq9j65",
3861
3928
  k1xSpc: "x78zum5",
3862
3929
  kGNEyG: "x6s0dn4",
@@ -3909,7 +3976,7 @@ var Wa = {
3909
3976
  $$css: !0
3910
3977
  },
3911
3978
  cell: (e, t) => [
3912
- Ja,
3979
+ no,
3913
3980
  {
3914
3981
  kWkggS: (e ?? P.surface) == null ? e ?? P.surface : "xl8spv7",
3915
3982
  kSiTet: t == null ? t : "xb4nw82",
@@ -3925,6 +3992,10 @@ var Wa = {
3925
3992
  kMzoRj: "xdh2fpr",
3926
3993
  $$css: !0
3927
3994
  },
3995
+ ink: (e) => [{
3996
+ kMwMTN: e == null ? e : "x14rh7hd",
3997
+ $$css: !0
3998
+ }, { "--x-color": e ?? void 0 }],
3928
3999
  label: {
3929
4000
  kVAEAm: "x10l6tqk",
3930
4001
  kVQacm: "xb3r6kr",
@@ -3938,20 +4009,22 @@ var Wa = {
3938
4009
  kfzvcC: "x47corl",
3939
4010
  $$css: !0
3940
4011
  },
3941
- columnLabel: (e, t) => [
3942
- Ya,
4012
+ columnLabel: (e, t, n) => [
4013
+ ro,
3943
4014
  {
3944
4015
  kbCHJM: e == null ? e : "xgq9j65",
3945
4016
  kzqmXN: t == null ? t : "x5lhr3w",
4017
+ krVfgx: n == null ? n : "x1nqzi6q",
3946
4018
  $$css: !0
3947
4019
  },
3948
4020
  {
3949
4021
  "--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
3950
- "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
4022
+ "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t),
4023
+ "--x-bottom": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(n)
3951
4024
  }
3952
4025
  ],
3953
4026
  rowLabel: (e, t, n) => [
3954
- Xa,
4027
+ io,
3955
4028
  {
3956
4029
  k87sOh: e == null ? e : "xjbys53",
3957
4030
  kZKoxP: t == null ? t : "x16ye13r",
@@ -3961,7 +4034,7 @@ var Wa = {
3961
4034
  {
3962
4035
  "--x-top": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
3963
4036
  "--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t),
3964
- "--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(-(n + Ga)),
4037
+ "--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(-(n + Xa)),
3965
4038
  "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(n)
3966
4039
  }
3967
4040
  ],
@@ -3971,16 +4044,16 @@ var Wa = {
3971
4044
  $$css: !0
3972
4045
  }
3973
4046
  };
3974
- function Za({ id: e, at: t, row: n, column: r, rows: a, columns: o, cell: s, size: c, name: l, format: u, palette: d, domain: f, isHighlighted: p, isShown: m, emphasis: h }) {
3975
- let g = Ia[c], _ = Y({
4047
+ function ao({ id: e, at: t, row: r, column: i, rows: a, columns: o, cell: s, size: c, name: l, format: u, palette: d, domain: f, isHighlighted: p, isShown: m, emphasis: h }) {
4048
+ let g = Va[c], _ = Y({
3976
4049
  id: e,
3977
4050
  kind: "cell",
3978
4051
  frame: {
3979
4052
  x: t[0],
3980
4053
  y: t[1],
3981
- offset: Ha({
3982
- row: n,
3983
- column: r,
4054
+ offset: qa({
4055
+ row: r,
4056
+ column: i,
3984
4057
  rows: a,
3985
4058
  columns: o,
3986
4059
  size: c
@@ -3996,38 +4069,60 @@ function Za({ id: e, at: t, row: n, column: r, rows: a, columns: o, cell: s, siz
3996
4069
  value: v,
3997
4070
  locale: _.scene.locale,
3998
4071
  format: u
3999
- })), b = Fa({
4072
+ })), b = Ba({
4000
4073
  value: s.value === void 0 ? void 0 : v,
4001
4074
  palette: d,
4002
4075
  domain: f
4003
- });
4004
- return /* @__PURE__ */ G(i, {
4076
+ }), x = s.tone === void 0 ? void 0 : N[s.tone], S = x === void 0 ? void 0 : `color-mix(in srgb, ${x} ${$a}%, ${P.surface})`, C = s.isMuted === !0 ? void 0 : b ?? S, w = s.isMuted === !0 ? Gt : x;
4077
+ return /* @__PURE__ */ G(n, {
4005
4078
  value: e,
4006
4079
  render: /* @__PURE__ */ G("div", {
4007
4080
  role: "img",
4008
4081
  "aria-label": s.label ?? l,
4009
4082
  "data-scene-cell": e
4010
4083
  }),
4011
- ...V.props($.cell(b, Math.max(0, Math.min(1, _.values.opacity)) * _.strength), p && $.highlighted, !_.isVisible && $.gone, ...Kt(_)),
4084
+ ...H.props($.cell(C, Math.max(0, Math.min(1, _.values.opacity)) * _.strength), w !== void 0 && $.ink(w), p && $.highlighted, !_.isVisible && $.gone, ...qt(_)),
4012
4085
  children: /* @__PURE__ */ G("span", {
4013
4086
  "aria-hidden": !0,
4014
4087
  children: y
4015
4088
  })
4016
4089
  });
4017
4090
  }
4018
- function Qa(e) {
4019
- let t = (e ?? []).map((e) => {
4020
- let t = L({
4021
- x: 0,
4022
- y: 0,
4023
- anchor: "start",
4024
- text: e
4025
- });
4026
- return t.right - t.left;
4091
+ function oo(e) {
4092
+ let t = L({
4093
+ x: 0,
4094
+ y: 0,
4095
+ anchor: "start",
4096
+ text: e
4027
4097
  });
4028
- return Math.ceil(Math.max(0, ...t));
4098
+ return t.right - t.left;
4099
+ }
4100
+ function so(e) {
4101
+ return Math.ceil(Math.max(0, ...(e ?? []).map(oo)));
4029
4102
  }
4030
- function $a({ grid: e, props: t, labels: n }) {
4103
+ function co(e, t) {
4104
+ if (e.length === 0) return 0;
4105
+ let n = e.findIndex((n, r) => r > 0 && oo(e.slice(0, r + 1).join(" ")) > t);
4106
+ return n === -1 ? 1 : 1 + co(e.slice(n), t);
4107
+ }
4108
+ function lo({ columnLabels: e, width: t }) {
4109
+ if (e === void 0 || e.length === 0) return {
4110
+ top: 0,
4111
+ left: 0,
4112
+ right: 0
4113
+ };
4114
+ let n = e.map((e) => e.split(/\s+/u).filter((e) => e.length > 0));
4115
+ function r(e) {
4116
+ let r = Math.max(0, ...(n[e] ?? []).map(oo));
4117
+ return Math.ceil(Math.max(0, (r - t) * to));
4118
+ }
4119
+ return {
4120
+ top: Math.max(1, ...n.map((e) => co(e, t))) * Qa + Za,
4121
+ left: r(0),
4122
+ right: r(n.length - 1)
4123
+ };
4124
+ }
4125
+ function uo({ grid: e, props: t, labels: n }) {
4031
4126
  let { id: r, rowLabels: i, columnLabels: a } = t, o = e[0]?.length ?? 0;
4032
4127
  return e.length === 0 || o === 0 ? q(n.noCells, { id: r }) : e.some((e) => e.length !== o) ? q(n.ragged, { id: r }) : i !== void 0 && i.length !== e.length ? q(n.rowLabelCount, {
4033
4128
  id: r,
@@ -4039,23 +4134,26 @@ function $a({ grid: e, props: t, labels: n }) {
4039
4134
  labels: String(a.length)
4040
4135
  }) : void 0;
4041
4136
  }
4042
- function eo(e) {
4043
- let { id: t, at: n, values: r, cells: i, direction: a = "row", format: o = qa, palette: s, domain: c } = e, { size: l = "medium", rowLabels: u, columnLabels: d, highlight: f, label: p, emphasis: m, isShown: h = !0 } = e, g = {
4044
- ...Wa,
4137
+ function fo(e) {
4138
+ let { id: t, at: n, values: r, cells: i, direction: a = "row", format: o = eo, palette: s, domain: c } = e, { size: l = "medium", rowLabels: u, columnLabels: d, highlight: f, label: p, emphasis: m, isShown: h = !0 } = e, g = {
4139
+ ...Ya,
4045
4140
  ...e.labels
4046
- }, _ = Ba({
4141
+ }, _ = Ga({
4047
4142
  values: r,
4048
4143
  cells: i,
4049
4144
  direction: a
4050
- }), v = _.length, y = _[0]?.length ?? 0, b = Va({
4145
+ }), v = _.length, y = _[0]?.length ?? 0, b = Ka({
4051
4146
  rows: v,
4052
4147
  columns: y,
4053
4148
  size: l
4054
- }), x = $a({
4149
+ }), x = uo({
4055
4150
  grid: _,
4056
4151
  props: e,
4057
4152
  labels: g
4058
- }), S = Qa(u), C = u === void 0 ? 0 : S + Ga, w = d === void 0 ? 0 : Ka, T = Y({
4153
+ }), S = so(u), C = u === void 0 ? 0 : S + Xa, w = lo({
4154
+ columnLabels: d,
4155
+ width: Va[l].width
4156
+ }), T = Y({
4059
4157
  id: t,
4060
4158
  kind: "cells",
4061
4159
  frame: {
@@ -4064,8 +4162,9 @@ function eo(e) {
4064
4162
  width: b.width,
4065
4163
  height: b.height,
4066
4164
  outset: {
4067
- left: C,
4068
- top: w
4165
+ left: Math.max(C, w.left),
4166
+ right: w.right,
4167
+ top: w.top
4069
4168
  }
4070
4169
  },
4071
4170
  values: {},
@@ -4081,7 +4180,7 @@ function eo(e) {
4081
4180
  top: 0,
4082
4181
  right: 0,
4083
4182
  bottom: 0
4084
- } } = T, D = Ia[l], O = Ua({
4183
+ } } = T, D = Va[l], O = Ja({
4085
4184
  grid: _,
4086
4185
  palette: s,
4087
4186
  domain: c
@@ -4098,17 +4197,20 @@ function eo(e) {
4098
4197
  "aria-hidden": !h || void 0,
4099
4198
  inert: !h,
4100
4199
  "data-scene-cells": t,
4101
- ...V.props(!T.isVisible && $.gone, $.grid, $.place(`translate(${E.left}px, ${E.top}px)`, Math.max(0, Math.min(1, T.values.opacity))), $.box(b.width, b.height), $.tracks(`repeat(${y}, ${D.width}px)`, `${D.height}px`, 2)),
4200
+ ...H.props(!T.isVisible && $.gone, $.grid, $.place(`translate(${E.left}px, ${E.top}px)`, Math.max(0, Math.min(1, T.values.opacity))), $.box(b.width, b.height), $.tracks(`repeat(${y}, ${D.width}px)`, `${D.height}px`, 2)),
4102
4201
  children: [
4103
- T.isInspected || T.isCursor ? /* @__PURE__ */ G("span", { ...V.props($.ring, ...Kt(T)) }) : null,
4202
+ T.isInspected || T.isCursor ? /* @__PURE__ */ G("span", { ...H.props($.ring, ...qt(T)) }) : null,
4104
4203
  k.map((e) => /* @__PURE__ */ G("span", {
4105
4204
  "aria-hidden": !0,
4106
- ...V.props($.label, $.columnLabel(e.index * (D.width + 2), D.width), f?.column === e.index && $.strong),
4107
- children: e.text
4205
+ ...H.props($.label, $.columnLabel(e.index * (D.width + 2), D.width, b.height + Za), f?.column === e.index && $.strong),
4206
+ children: /* @__PURE__ */ G("span", {
4207
+ className: "x1h4wwuj x2b8uid",
4208
+ children: e.text
4209
+ })
4108
4210
  }, e.key)),
4109
4211
  A.map((e) => /* @__PURE__ */ G("span", {
4110
4212
  "aria-hidden": !0,
4111
- ...V.props($.label, $.rowLabel(e.index * (D.height + 2), D.height, S), f?.row === e.index && $.strong),
4213
+ ...H.props($.label, $.rowLabel(e.index * (D.height + 2), D.height, S), f?.row === e.index && $.strong),
4112
4214
  children: e.text
4113
4215
  }, e.key)),
4114
4216
  _.flatMap((e, r) => e.map((e, i) => {
@@ -4121,7 +4223,7 @@ function eo(e) {
4121
4223
  column: p,
4122
4224
  value: _
4123
4225
  }), S = f?.row === void 0 || f.row === r, C = f?.column === void 0 || f.column === i, w = f !== void 0 && (f.row !== void 0 || f.column !== void 0);
4124
- return /* @__PURE__ */ G(Za, {
4226
+ return /* @__PURE__ */ G(ao, {
4125
4227
  id: a,
4126
4228
  at: n,
4127
4229
  row: r,
@@ -4143,72 +4245,72 @@ function eo(e) {
4143
4245
  });
4144
4246
  }
4145
4247
  // packages/teaching/src/scene/shapes/token-layout.ts
4146
- var to = 7.4, no = 16, ro = 36, io = 176, ao = 28, oo = 44, so = .5, co = {
4248
+ var po = 7.4, mo = 16, ho = 36, go = 176, _o = 28, vo = 44, yo = .5, bo = {
4147
4249
  small: 4,
4148
4250
  medium: 8,
4149
4251
  large: 16
4150
4252
  };
4151
- function lo({ text: e, caption: t }) {
4253
+ function xo({ text: e, caption: t }) {
4152
4254
  let n = Math.max(Array.from(e).length, Array.from(t ?? "").length);
4153
4255
  return {
4154
- width: Math.min(io, Math.max(ro, Math.ceil(n * to + no))),
4155
- height: t === void 0 ? ao : oo
4256
+ width: Math.min(go, Math.max(ho, Math.ceil(n * po + mo))),
4257
+ height: t === void 0 ? _o : vo
4156
4258
  };
4157
4259
  }
4158
- function uo(e) {
4260
+ function So(e) {
4159
4261
  let t = { value: 0 };
4160
4262
  for (let n of e) t.value += n;
4161
4263
  return t.value;
4162
4264
  }
4163
- function fo(e, t) {
4164
- return uo(e.map((e) => e.width)) + Math.max(e.length - 1, 0) * t;
4265
+ function Co(e, t) {
4266
+ return So(e.map((e) => e.width)) + Math.max(e.length - 1, 0) * t;
4165
4267
  }
4166
- function po({ boxes: e, wrapWidth: t, space: n }) {
4268
+ function wo({ boxes: e, wrapWidth: t, space: n }) {
4167
4269
  let r = {
4168
4270
  start: 0,
4169
4271
  rows: []
4170
4272
  };
4171
4273
  for (; r.start < e.length;) {
4172
- let i = e.slice(r.start), a = i.map((e, r) => fo(i.slice(0, r + 1), n) <= t), o = a.indexOf(!1), s = Math.max(1, o === -1 ? a.length : o);
4274
+ let i = e.slice(r.start), a = i.map((e, r) => Co(i.slice(0, r + 1), n) <= t), o = a.indexOf(!1), s = Math.max(1, o === -1 ? a.length : o);
4173
4275
  r.rows = [...r.rows, Array.from({ length: s }, (e, t) => r.start + t)], r.start += s;
4174
4276
  }
4175
4277
  return r.rows;
4176
4278
  }
4177
- function mo({ boxes: e, wrapWidth: t, gap: n }) {
4178
- let r = co[n], i = po({
4279
+ function To({ boxes: e, wrapWidth: t, gap: n }) {
4280
+ let r = bo[n], i = wo({
4179
4281
  boxes: e,
4180
4282
  wrapWidth: t,
4181
4283
  space: r
4182
- }), a = i.map((t) => Math.max(...t.map((t) => e[t]?.height ?? 0))), o = Math.max(0, ...i.map((t) => fo(t.map((t) => e[t] ?? {
4284
+ }), a = i.map((t) => Math.max(...t.map((t) => e[t]?.height ?? 0))), o = Math.max(0, ...i.map((t) => Co(t.map((t) => e[t] ?? {
4183
4285
  width: 0,
4184
4286
  height: 0
4185
- }), r))), s = uo(a) + Math.max(i.length - 1, 0) * r;
4287
+ }), r))), s = So(a) + Math.max(i.length - 1, 0) * r;
4186
4288
  return {
4187
4289
  offsets: e.map((t, n) => {
4188
- let c = i.findIndex((e) => e.includes(n)), l = i[c] ?? [], u = uo(l.slice(0, l.indexOf(n)).map((t) => (e[t]?.width ?? 0) + r)), d = uo(a.slice(0, c).map((e) => e + r));
4189
- return [u + t.width * so - o * so, d + (a[c] ?? 0) * so - s * so];
4290
+ let c = i.findIndex((e) => e.includes(n)), l = i[c] ?? [], u = So(l.slice(0, l.indexOf(n)).map((t) => (e[t]?.width ?? 0) + r)), d = So(a.slice(0, c).map((e) => e + r));
4291
+ return [u + t.width * yo - o * yo, d + (a[c] ?? 0) * yo - s * yo];
4190
4292
  }),
4191
4293
  width: o,
4192
4294
  height: s
4193
4295
  };
4194
4296
  }
4195
4297
  // packages/teaching/src/scene/shapes/scene-token.tsx
4196
- var ho = {
4298
+ var Eo = {
4197
4299
  plain: "{token}",
4198
4300
  withProbability: "{token}, probability {probability}",
4199
4301
  withId: "{token}, token id {id}",
4200
4302
  withBoth: "{token}, token id {id}, probability {probability}"
4201
- }, go = {
4303
+ }, Do = {
4202
4304
  style: "percent",
4203
4305
  maximumFractionDigits: 1
4204
- }, _o = {
4306
+ }, Oo = {
4205
4307
  kVAEAm: "x10l6tqk",
4206
4308
  kbCHJM: "xu96u03",
4207
4309
  krVfgx: "x1ey2m1c",
4208
4310
  kZKoxP: "xuoj239",
4209
4311
  kzqmXN: "x5lhr3w",
4210
4312
  $$css: !0
4211
- }, vo = {
4313
+ }, ko = {
4212
4314
  token: {
4213
4315
  kVAEAm: "x10l6tqk",
4214
4316
  kbCHJM: "xu96u03",
@@ -4256,7 +4358,7 @@ var ho = {
4256
4358
  $$css: !0
4257
4359
  },
4258
4360
  bar: (e, t) => [
4259
- _o,
4361
+ Oo,
4260
4362
  {
4261
4363
  kWkggS: e == null ? e : "xl8spv7",
4262
4364
  $$css: !0
@@ -4267,13 +4369,13 @@ var ho = {
4267
4369
  }
4268
4370
  ]
4269
4371
  };
4270
- function yo({ tokenId: e, probability: t }) {
4372
+ function Ao({ tokenId: e, probability: t }) {
4271
4373
  let n = [e === void 0 ? void 0 : String(e), t].filter((e) => e !== void 0);
4272
4374
  return n.length === 0 ? void 0 : n.join(" · ");
4273
4375
  }
4274
- function bo({ id: e, at: t, offset: n, text: r, tokenId: a, probability: o, format: s = go, tone: c, label: l, emphasis: u, isShown: d = !0, isActive: f = !1, isFloating: p, labels: m }) {
4376
+ function jo({ id: e, at: t, offset: r, text: i, tokenId: a, probability: o, format: s = Do, tone: c, label: l, emphasis: u, isShown: d = !0, isActive: f = !1, isFloating: p, labels: m }) {
4275
4377
  let h = {
4276
- ...ho,
4378
+ ...Eo,
4277
4379
  ...m
4278
4380
  }, { locale: g } = J();
4279
4381
  function _(e) {
@@ -4283,9 +4385,9 @@ function bo({ id: e, at: t, offset: n, text: r, tokenId: a, probability: o, form
4283
4385
  format: s
4284
4386
  });
4285
4387
  }
4286
- let v = lo({
4287
- text: r,
4288
- caption: yo({
4388
+ let v = xo({
4389
+ text: i,
4390
+ caption: Ao({
4289
4391
  tokenId: a,
4290
4392
  probability: o === void 0 ? void 0 : _(o)
4291
4393
  })
@@ -4295,7 +4397,7 @@ function bo({ id: e, at: t, offset: n, text: r, tokenId: a, probability: o, form
4295
4397
  h.withProbability,
4296
4398
  h.withBoth
4297
4399
  ][Number(y) + 2 * Number(b)] ?? h.plain, S = l ?? q(x, {
4298
- token: ue(r),
4400
+ token: le(i),
4299
4401
  id: String(a ?? ""),
4300
4402
  probability: o === void 0 ? "" : _(o)
4301
4403
  }), C = Y({
@@ -4304,7 +4406,7 @@ function bo({ id: e, at: t, offset: n, text: r, tokenId: a, probability: o, form
4304
4406
  frame: {
4305
4407
  x: t[0],
4306
4408
  y: t[1],
4307
- offset: n,
4409
+ offset: r,
4308
4410
  width: v.width,
4309
4411
  height: v.height
4310
4412
  },
@@ -4321,11 +4423,11 @@ function bo({ id: e, at: t, offset: n, text: r, tokenId: a, probability: o, form
4321
4423
  top: 0,
4322
4424
  right: 0,
4323
4425
  bottom: 0
4324
- }, values: T } = C, E = yo({
4426
+ }, values: T } = C, E = Ao({
4325
4427
  tokenId: a,
4326
4428
  probability: o === void 0 ? void 0 : _(T.probability)
4327
4429
  }), D = c === void 0 ? P.line : N[c];
4328
- return /* @__PURE__ */ K(i, {
4430
+ return /* @__PURE__ */ K(n, {
4329
4431
  value: e,
4330
4432
  render: /* @__PURE__ */ G("div", {
4331
4433
  role: "img",
@@ -4333,40 +4435,40 @@ function bo({ id: e, at: t, offset: n, text: r, tokenId: a, probability: o, form
4333
4435
  "data-scene-token": e,
4334
4436
  inert: !d
4335
4437
  }),
4336
- ...V.props(vo.token, vo.place(`translate(${w.left}px, ${w.top}px)`, Math.max(0, Math.min(1, T.opacity)) * C.strength), vo.box(T.width, T.height), vo.outline(D), !C.isVisible && vo.gone, ...Kt(C)),
4438
+ ...H.props(ko.token, ko.place(`translate(${w.left}px, ${w.top}px)`, Math.max(0, Math.min(1, T.opacity)) * C.strength), ko.box(T.width, T.height), ko.outline(D), !C.isVisible && ko.gone, ...qt(C)),
4337
4439
  children: [
4338
4440
  /* @__PURE__ */ G("span", {
4339
4441
  "aria-hidden": !0,
4340
4442
  className: "x193iq5w xb3r6kr xlyipyv xuxw1ft",
4341
- children: /* @__PURE__ */ G(le, {
4342
- text: r,
4443
+ children: /* @__PURE__ */ G(ce, {
4444
+ text: i,
4343
4445
  shouldWrap: !1
4344
4446
  })
4345
4447
  }),
4346
4448
  E !== void 0 && /* @__PURE__ */ G("span", {
4347
4449
  "aria-hidden": !0,
4348
- className: "x153jb6y xiard35 x1j6dyjg x1xxsxie xss6m8b xuxw1ft",
4450
+ className: "x153jb6y xiard35 xy8obcc x1d3mw78 xss6m8b xuxw1ft",
4349
4451
  children: E
4350
4452
  }),
4351
4453
  b && /* @__PURE__ */ G("span", {
4352
4454
  "aria-hidden": !0,
4353
- ...V.props(vo.bar(N[c ?? "series1"], Math.max(0, Math.min(1, T.probability))))
4455
+ ...H.props(ko.bar(N[c ?? "series1"], Math.max(0, Math.min(1, T.probability))))
4354
4456
  })
4355
4457
  ]
4356
4458
  });
4357
4459
  }
4358
4460
  // packages/teaching/src/scene/shapes/scene-tokens.tsx
4359
- var xo = 480;
4360
- function So({ id: e, at: t, tokens: n, wrapWidth: r = xo, gap: i = "medium", format: a, label: o, emphasis: s, isShown: c = !0 }) {
4361
- let { locale: l } = J(), u = mo({
4362
- boxes: n.map((e) => lo({
4461
+ var Mo = 480;
4462
+ function No({ id: e, at: t, tokens: n, wrapWidth: r = Mo, gap: i = "medium", format: a, label: o, emphasis: s, isShown: c = !0 }) {
4463
+ let { locale: l } = J(), u = To({
4464
+ boxes: n.map((e) => xo({
4363
4465
  text: e.text,
4364
- caption: yo({
4466
+ caption: Ao({
4365
4467
  tokenId: e.tokenId,
4366
4468
  probability: e.probability === void 0 ? void 0 : F({
4367
4469
  value: e.probability,
4368
4470
  locale: l,
4369
- format: a ?? go
4471
+ format: a ?? Do
4370
4472
  })
4371
4473
  })
4372
4474
  })),
@@ -4390,7 +4492,7 @@ function So({ id: e, at: t, tokens: n, wrapWidth: r = xo, gap: i = "medium", for
4390
4492
  key: `${e}.${n}`,
4391
4493
  token: t,
4392
4494
  offset: u.offsets[n]
4393
- })).map(({ key: e, token: n, offset: r }) => /* @__PURE__ */ G(bo, {
4495
+ })).map(({ key: e, token: n, offset: r }) => /* @__PURE__ */ G(jo, {
4394
4496
  id: e,
4395
4497
  at: t,
4396
4498
  offset: r,
@@ -4406,8 +4508,8 @@ function So({ id: e, at: t, tokens: n, wrapWidth: r = xo, gap: i = "medium", for
4406
4508
  }, e)) : /* @__PURE__ */ G(Q, { part: "SceneTokens" });
4407
4509
  }
4408
4510
  // packages/teaching/src/scene/flow/flow-layout.ts
4409
- var Co = .5;
4410
- function wo(e, t) {
4511
+ var Po = .5;
4512
+ function Fo(e, t) {
4411
4513
  let n = {
4412
4514
  reached: /* @__PURE__ */ new Set(),
4413
4515
  pending: t
@@ -4418,17 +4520,17 @@ function wo(e, t) {
4418
4520
  }
4419
4521
  return n.reached;
4420
4522
  }
4421
- function To(e) {
4422
- let t = e.toSorted((e, t) => e - t), n = t[Math.floor((t.length - 1) * Co)] ?? 0;
4423
- return (n + (t[Math.ceil((t.length - 1) * Co)] ?? n)) * Co;
4523
+ function Io(e) {
4524
+ let t = e.toSorted((e, t) => e - t), n = t[Math.floor((t.length - 1) * Po)] ?? 0;
4525
+ return (n + (t[Math.ceil((t.length - 1) * Po)] ?? n)) * Po;
4424
4526
  }
4425
- function Eo(e, t) {
4527
+ function Lo(e, t) {
4426
4528
  let n = new Set(e.nodes.map((e) => e.name));
4427
4529
  return t.find((e) => !n.has(e));
4428
4530
  }
4429
- function Do({ members: e, inputs: t, fractions: n }) {
4531
+ function Ro({ members: e, inputs: t, fractions: n }) {
4430
4532
  return e.map((e, r) => {
4431
- let i = t(e.name).flatMap((e) => n.get(e) ?? []), a = i.length === 0 ? Infinity : To(i);
4533
+ let i = t(e.name).flatMap((e) => n.get(e) ?? []), a = i.length === 0 ? Infinity : Io(i);
4432
4534
  return {
4433
4535
  name: e.name,
4434
4536
  index: r,
@@ -4439,8 +4541,8 @@ function Do({ members: e, inputs: t, fractions: n }) {
4439
4541
  return n === 0 || Number.isNaN(n) ? e.index - t.index : n;
4440
4542
  }).map((e) => e.name);
4441
4543
  }
4442
- function Oo(e, t) {
4443
- let n = t === void 0 ? void 0 : wo(e, t), r = e.nodes.filter((e) => n === void 0 || n.has(e.name)), i = new Set(r.map((e) => e.name)), a = e.edges.filter((e) => i.has(e.from) && i.has(e.to)), o = {
4544
+ function zo(e, t) {
4545
+ let n = t === void 0 ? void 0 : Fo(e, t), r = e.nodes.filter((e) => n === void 0 || n.has(e.name)), i = new Set(r.map((e) => e.name)), a = e.edges.filter((e) => i.has(e.from) && i.has(e.to)), o = {
4444
4546
  depth: /* @__PURE__ */ new Map(),
4445
4547
  unplaced: r
4446
4548
  };
@@ -4459,12 +4561,12 @@ function Oo(e, t) {
4459
4561
  rows: /* @__PURE__ */ new Map()
4460
4562
  }, f = Array.from({ length: u }, (e, t) => t);
4461
4563
  for (; f.length > 0;) {
4462
- let e = f.shift(), t = Do({
4564
+ let e = f.shift(), t = Ro({
4463
4565
  members: r.filter((t) => l.get(t.name) === e),
4464
4566
  inputs: s,
4465
4567
  fractions: d.fractions
4466
4568
  });
4467
- d.rows = new Map([...d.rows, ...t.map((e, t) => [e, t])]), d.fractions = new Map([...d.fractions, ...t.map((e, n) => [e, (n + Co) / t.length])]);
4569
+ d.rows = new Map([...d.rows, ...t.map((e, t) => [e, t])]), d.fractions = new Map([...d.fractions, ...t.map((e, n) => [e, (n + Po) / t.length])]);
4468
4570
  }
4469
4571
  let p = r.map((e) => ({
4470
4572
  ...e,
@@ -4478,17 +4580,17 @@ function Oo(e, t) {
4478
4580
  rows: Math.max(1, ...Array.from({ length: u }, (e, t) => p.filter((e) => e.layer === t).length))
4479
4581
  };
4480
4582
  }
4481
- function ko({ index: e, count: t, size: n }) {
4482
- return n <= 1 ? Co : (e + (n - t) * Co) / (n - 1);
4583
+ function Bo({ index: e, count: t, size: n }) {
4584
+ return n <= 1 ? Po : (e + (n - t) * Po) / (n - 1);
4483
4585
  }
4484
- function Ao({ plan: e, box: t, direction: n }) {
4586
+ function Vo({ plan: e, box: t, direction: n }) {
4485
4587
  let r = n === "across", i = r ? t.x : t.y, a = r ? t.y : t.x;
4486
4588
  return new Map(e.slots.map((t) => {
4487
- let n = e.slots.filter((e) => e.layer === t.layer).length, o = ko({
4589
+ let n = e.slots.filter((e) => e.layer === t.layer).length, o = Bo({
4488
4590
  index: t.layer,
4489
4591
  count: e.layers,
4490
4592
  size: e.layers
4491
- }), s = ko({
4593
+ }), s = Bo({
4492
4594
  index: t.row,
4493
4595
  count: n,
4494
4596
  size: e.rows
@@ -4497,19 +4599,19 @@ function Ao({ plan: e, box: t, direction: n }) {
4497
4599
  }));
4498
4600
  }
4499
4601
  // packages/teaching/src/scene/flow/flow-pulse.tsx
4500
- var jo = 3, Mo = 6, No = 10, Po = 4.5, Fo = .85, Io = .5, Lo = {
4602
+ var Ho = 3, Uo = 6, Wo = 10, Go = 4.5, Ko = .85, qo = .5, Jo = {
4501
4603
  kDwRjp: "x19zyb68",
4502
4604
  kfJifR: "xvlca1e",
4503
4605
  kfzvcC: "x47corl",
4504
4606
  $$css: !0
4505
- }, Ro = {
4607
+ }, Yo = {
4506
4608
  kjVXCG: "xaep1og",
4507
4609
  kfJifR: "xhr4kjn",
4508
4610
  kfzvcC: "x47corl",
4509
4611
  $$css: !0
4510
- }, zo = {
4612
+ }, Xo = {
4511
4613
  ring: (e, t) => [
4512
- Lo,
4614
+ Jo,
4513
4615
  {
4514
4616
  kjVXCG: e == null ? e : "x6mkzkt",
4515
4617
  kSiTet: t == null ? t : "xb4nw82",
@@ -4526,7 +4628,7 @@ var jo = 3, Mo = 6, No = 10, Po = 4.5, Fo = .85, Io = .5, Lo = {
4526
4628
  $$css: !0
4527
4629
  },
4528
4630
  dot: (e) => [
4529
- Ro,
4631
+ Yo,
4530
4632
  {
4531
4633
  kDwRjp: e == null ? e : "x19zyb68",
4532
4634
  $$css: !0
@@ -4534,25 +4636,25 @@ var jo = 3, Mo = 6, No = 10, Po = 4.5, Fo = .85, Io = .5, Lo = {
4534
4636
  { "--x-fill": e ?? void 0 }
4535
4637
  ]
4536
4638
  };
4537
- function Bo(e, t) {
4639
+ function Zo(e, t) {
4538
4640
  return e.size === t.size && [...e].every(([e, n]) => t.get(e) === n);
4539
4641
  }
4540
- function Vo(e, t) {
4642
+ function Qo(e, t) {
4541
4643
  let n = e - t;
4542
4644
  return n <= 0 || n >= 1 ? 0 : Math.sin(n * Math.PI);
4543
4645
  }
4544
- function Ho({ plan: e, values: t, pace: n, tone: r }) {
4545
- let [i] = W(() => k({ wave: 0 })), [a] = W(() => ({
4646
+ function $o({ plan: e, values: t, pace: n, tone: r }) {
4647
+ let [i] = W(() => S({ wave: 0 })), [a] = W(() => ({
4546
4648
  target: 0,
4547
4649
  end: 0
4548
- })), [o, s] = W(null), c = _e(t), l = ve(i.subscribe, i.get, i.get), u = o === null ? [] : [...o.steps.keys()], d = et(u);
4650
+ })), [o, s] = W(null), c = _e(t), l = ve(i.subscribe, i.get, i.get), u = o === null ? [] : [...o.steps.keys()], d = tt(u);
4549
4651
  if (U(() => {
4550
4652
  let r = c.current;
4551
4653
  c.current = t;
4552
4654
  let l = e.slots.filter((e) => !Object.is(r[e.name], t[e.name]));
4553
4655
  if (l.length === 0) return;
4554
- let u = Math.min(...l.map((e) => e.layer)), d = new Map(l.map((e) => [e.name, e.layer - u])), f = O() || n === "instant";
4555
- if (o !== null && !o.isStill && i.get().wave < a.end && !f && Bo(o.steps, d)) return;
4656
+ let u = Math.min(...l.map((e) => e.layer)), d = new Map(l.map((e) => [e.name, e.layer - u])), f = k() || n === "instant";
4657
+ if (o !== null && !o.isStill && i.get().wave < a.end && !f && Zo(o.steps, d)) return;
4556
4658
  let p = e.edges.filter((e) => d.has(e.from) && d.has(e.to));
4557
4659
  s({
4558
4660
  steps: d,
@@ -4570,27 +4672,27 @@ function Ho({ plan: e, values: t, pace: n, tone: r }) {
4570
4672
  let n = d[t]?.rect;
4571
4673
  return n === void 0 ? [] : [[e, n]];
4572
4674
  })), m = u.flatMap((e) => {
4573
- let t = p.get(e), n = o.steps.get(e) ?? 0, r = o.isStill ? Fo : Vo(l.wave, n);
4675
+ let t = p.get(e), n = o.steps.get(e) ?? 0, r = o.isStill ? Ko : Qo(l.wave, n);
4574
4676
  if (t === void 0 || r <= 0) return [];
4575
- let i = mt(t, jo + (o.isStill ? 0 : Mo * r));
4677
+ let i = ht(t, Ho + (o.isStill ? 0 : Uo * r));
4576
4678
  return [/* @__PURE__ */ G("rect", {
4577
4679
  "data-flow-pulse": e,
4578
4680
  x: i.left,
4579
4681
  y: i.top,
4580
4682
  width: i.right - i.left,
4581
4683
  height: i.bottom - i.top,
4582
- rx: No,
4583
- ry: No,
4584
- ...V.props(zo.ring(f, r), o.isStill && zo.still)
4684
+ rx: Wo,
4685
+ ry: Wo,
4686
+ ...H.props(Xo.ring(f, r), o.isStill && Xo.still)
4585
4687
  }, e)];
4586
4688
  }), h = o.isStill ? [] : o.edges.flatMap((e) => {
4587
- let t = p.get(e.from), n = p.get(e.to), r = o.steps.get(e.from) ?? 0, i = o.steps.get(e.to) ?? 0, a = (l.wave - r - Io) / Math.max(1, i - r);
4689
+ let t = p.get(e.from), n = p.get(e.to), r = o.steps.get(e.from) ?? 0, i = o.steps.get(e.to) ?? 0, a = (l.wave - r - qo) / Math.max(1, i - r);
4588
4690
  if (t === void 0 || n === void 0 || !(a > 0 && a < 1)) return [];
4589
- let s = yt({
4691
+ let s = bt({
4590
4692
  rect: t,
4591
4693
  shape: "box",
4592
4694
  toward: Z(n)
4593
- }), c = yt({
4695
+ }), c = bt({
4594
4696
  rect: n,
4595
4697
  shape: "box",
4596
4698
  toward: Z(t)
@@ -4599,20 +4701,20 @@ function Ho({ plan: e, values: t, pace: n, tone: r }) {
4599
4701
  "data-flow-dot": `${e.from}>${e.to}`,
4600
4702
  cx: s.x + (c.x - s.x) * a,
4601
4703
  cy: s.y + (c.y - s.y) * a,
4602
- r: Po,
4603
- ...V.props(zo.dot(f))
4704
+ r: Go,
4705
+ ...H.props(Xo.dot(f))
4604
4706
  }, `${e.from}>${e.to}`)];
4605
4707
  });
4606
- return /* @__PURE__ */ K(xe, { children: [/* @__PURE__ */ G(Ut, {
4708
+ return /* @__PURE__ */ K(xe, { children: [/* @__PURE__ */ G(Wt, {
4607
4709
  layer: "back",
4608
4710
  children: m
4609
- }), /* @__PURE__ */ G(Ut, {
4711
+ }), /* @__PURE__ */ G(Wt, {
4610
4712
  layer: "front",
4611
4713
  children: h
4612
4714
  })] });
4613
4715
  }
4614
4716
  // packages/teaching/src/scene/flow/scene-flow.tsx
4615
- var Uo = {
4717
+ var es = {
4616
4718
  noLesson: "SceneFlow needs a Lesson around it that renders its lesson.",
4617
4719
  unknownName: "The flow names \"{name}\", which lesson \"{lesson}\" does not declare.",
4618
4720
  crowded: "The flow stacks {count} values in one column, and this plot holds {limit}. Show fewer with `names`.",
@@ -4621,26 +4723,26 @@ var Uo = {
4621
4723
  reads: ". Reads {names}",
4622
4724
  on: "on",
4623
4725
  off: "off"
4624
- }, Wo = {
4726
+ }, ts = {
4625
4727
  width: 128,
4626
4728
  height: 64
4627
- }, Go = 16, Ko = [
4729
+ }, ns = 16, rs = [
4628
4730
  "compact",
4629
4731
  "regular",
4630
4732
  "tall"
4631
4733
  ];
4632
- function qo(e) {
4633
- let t = H(S);
4734
+ function is(e) {
4735
+ let t = pe(C);
4634
4736
  return e === void 0 ? t : T(t, e);
4635
4737
  }
4636
- function Jo({ param: e, value: t, locale: n, labels: r }) {
4738
+ function as({ param: e, value: t, locale: n, labels: r }) {
4637
4739
  return e.kind === "number" ? F({
4638
4740
  value: typeof t == "number" ? t : null,
4639
4741
  locale: n,
4640
4742
  format: e.format
4641
4743
  }) : e.kind === "toggle" ? t === !0 ? r.on : r.off : e.options.find((e) => e.id === t)?.label ?? String(t);
4642
4744
  }
4643
- function Yo({ problem: e }) {
4745
+ function os({ problem: e }) {
4644
4746
  return Y({
4645
4747
  id: "scene-flow:problem",
4646
4748
  kind: "flow",
@@ -4648,12 +4750,12 @@ function Yo({ problem: e }) {
4648
4750
  problem: e
4649
4751
  }), null;
4650
4752
  }
4651
- function Xo(e, t) {
4753
+ function ss(e, t) {
4652
4754
  let n = e - t - 16;
4653
- return 1 + Math.max(0, Math.floor(n / (t + Go)));
4755
+ return 1 + Math.max(0, Math.floor(n / (t + ns)));
4654
4756
  }
4655
- function Zo({ scope: e, plan: t, box: n, layout: r, formula: i, size: a, tone: o, labels: s }) {
4656
- let c = J(), { lesson: l, values: u, locale: d } = e, f = Ao({
4757
+ function cs({ scope: e, plan: t, box: n, layout: r, formula: i, size: a, tone: o, labels: s }) {
4758
+ let c = J(), { lesson: l, values: u, locale: d } = e, f = Vo({
4657
4759
  plan: t,
4658
4760
  box: n,
4659
4761
  direction: r
@@ -4664,7 +4766,7 @@ function Zo({ scope: e, plan: t, box: n, layout: r, formula: i, size: a, tone: o
4664
4766
  value: typeof o == "number" ? o : null,
4665
4767
  locale: d,
4666
4768
  format: i ?? {}
4667
- }) : Jo({
4769
+ }) : as({
4668
4770
  param: r,
4669
4771
  value: o,
4670
4772
  locale: d,
@@ -4677,7 +4779,7 @@ function Zo({ scope: e, plan: t, box: n, layout: r, formula: i, size: a, tone: o
4677
4779
  _ === void 0 ? "" : q(s.formula, { formula: _ }),
4678
4780
  l.length === 0 ? "" : q(s.reads, { names: l.join(", ") })
4679
4781
  ].join("");
4680
- return /* @__PURE__ */ G(cn, {
4782
+ return /* @__PURE__ */ G(un, {
4681
4783
  id: e.name,
4682
4784
  at: f.get(e.name) ?? [n.x[0], n.y[0]],
4683
4785
  size: a,
@@ -4692,11 +4794,11 @@ function Zo({ scope: e, plan: t, box: n, layout: r, formula: i, size: a, tone: o
4692
4794
  })
4693
4795
  }, e.name);
4694
4796
  }),
4695
- t.edges.map((e) => /* @__PURE__ */ G(kn, {
4797
+ t.edges.map((e) => /* @__PURE__ */ G(Mn, {
4696
4798
  from: e.from,
4697
4799
  to: e.to
4698
4800
  }, `${e.from}>${e.to}`)),
4699
- /* @__PURE__ */ G(Ho, {
4801
+ /* @__PURE__ */ G($o, {
4700
4802
  plan: t,
4701
4803
  values: u,
4702
4804
  pace: c.pace,
@@ -4704,29 +4806,29 @@ function Zo({ scope: e, plan: t, box: n, layout: r, formula: i, size: a, tone: o
4704
4806
  })
4705
4807
  ] });
4706
4808
  }
4707
- function Qo({ lesson: e, names: t, layout: n = "across", at: r, formula: i = {}, size: a = Wo, tone: o, labels: s }) {
4708
- let c = J(), l = qo(e), u = {
4709
- ...Uo,
4809
+ function ls({ lesson: e, names: t, layout: n = "across", at: r, formula: i = {}, size: a = ts, tone: o, labels: s }) {
4810
+ let c = J(), l = is(e), u = {
4811
+ ...es,
4710
4812
  ...s
4711
4813
  };
4712
4814
  if (!c.isInScene) return /* @__PURE__ */ G(Q, { part: "SceneFlow" });
4713
- if (l === null) return /* @__PURE__ */ G(Yo, { problem: u.noLesson });
4714
- let d = w(l.lesson), f = t === void 0 ? void 0 : Eo(d, t);
4715
- if (f !== void 0) return /* @__PURE__ */ G(Yo, { problem: q(u.unknownName, {
4815
+ if (l === null) return /* @__PURE__ */ G(os, { problem: u.noLesson });
4816
+ let d = D(l.lesson), f = t === void 0 ? void 0 : Lo(d, t);
4817
+ if (f !== void 0) return /* @__PURE__ */ G(os, { problem: q(u.unknownName, {
4716
4818
  name: f,
4717
4819
  lesson: l.lesson.id
4718
4820
  }) });
4719
- let p = Oo(d, t), m = r ?? c.domain, h = n === "across" ? p.rows : p.layers, g = c.box.innerHeight / (c.domain.y[1] - c.domain.y[0]), _ = Math.abs(m.y[1] - m.y[0]) * g;
4720
- if ((h > 1 ? _ / (h - 1) : Infinity) < a.height + Go) {
4721
- let e = 1 + Math.max(0, Math.floor(_ / (a.height + Go)));
4722
- return /* @__PURE__ */ G(Yo, { problem: q(u.crowded, {
4821
+ let p = zo(d, t), m = r ?? c.domain, h = n === "across" ? p.rows : p.layers, g = c.box.innerHeight / (c.domain.y[1] - c.domain.y[0]), _ = Math.abs(m.y[1] - m.y[0]) * g;
4822
+ if ((h > 1 ? _ / (h - 1) : Infinity) < a.height + ns) {
4823
+ let e = 1 + Math.max(0, Math.floor(_ / (a.height + ns)));
4824
+ return /* @__PURE__ */ G(os, { problem: q(u.crowded, {
4723
4825
  count: String(h),
4724
4826
  limit: String(e)
4725
4827
  }) });
4726
4828
  }
4727
- return /* @__PURE__ */ G(S, {
4829
+ return /* @__PURE__ */ G(C, {
4728
4830
  value: l,
4729
- children: /* @__PURE__ */ G(Zo, {
4831
+ children: /* @__PURE__ */ G(cs, {
4730
4832
  scope: l,
4731
4833
  plan: p,
4732
4834
  box: m,
@@ -4738,32 +4840,32 @@ function Qo({ lesson: e, names: t, layout: n = "across", at: r, formula: i = {},
4738
4840
  })
4739
4841
  });
4740
4842
  }
4741
- function $o({ lesson: e, names: t, layout: n = "across", formula: r, size: i = Wo, tone: o, labels: s, title: c, height: l, children: u, ...d }) {
4742
- let f = qo(e), p = f === null ? void 0 : Oo(w(f.lesson), t), m = p?.layers ?? 1, h = p?.rows ?? 1, g = n === "across", _ = g ? m : h, v = g ? h : m, y = Ko.find((e) => Xo(a[e], i.height) >= v) ?? "tall";
4743
- return /* @__PURE__ */ K(Bt, {
4843
+ function us({ lesson: e, names: t, layout: n = "across", formula: r, size: i = ts, tone: a, labels: s, title: c, height: l, children: u, ...d }) {
4844
+ let f = is(e), p = f === null ? void 0 : zo(D(f.lesson), t), m = p?.layers ?? 1, h = p?.rows ?? 1, g = n === "across", _ = g ? m : h, v = g ? h : m, y = rs.find((e) => ss(o[e], i.height) >= v) ?? "tall";
4845
+ return /* @__PURE__ */ K(Vt, {
4744
4846
  ...d,
4745
4847
  labels: s,
4746
4848
  title: c ?? f?.lesson.title ?? "",
4747
4849
  x: [0, Math.max(1, _ - 1)],
4748
4850
  y: [0, Math.max(1, v - 1)],
4749
4851
  height: l ?? y,
4750
- children: [/* @__PURE__ */ G(Qo, {
4852
+ children: [/* @__PURE__ */ G(ls, {
4751
4853
  lesson: e,
4752
4854
  names: t,
4753
4855
  layout: n,
4754
4856
  formula: r,
4755
4857
  size: i,
4756
- tone: o,
4858
+ tone: a,
4757
4859
  labels: s
4758
4860
  }), u]
4759
4861
  });
4760
4862
  }
4761
4863
  // packages/teaching/src/scene/morph/morph-scope.tsx
4762
- var es = { unknownFigure: "MorphScope shows \"{name}\", which is not one of its figures: {names}." }, ts = ["data-scene-node", "data-chart-mark"], ns = "[data-scene-node] [data-chart-mark], [data-scene-wire] [data-chart-mark]", rs = 1 / 3, is = {
4864
+ var ds = { unknownFigure: "MorphScope shows \"{name}\", which is not one of its figures: {names}." }, fs = ["data-scene-node", "data-chart-mark"], ps = "[data-scene-node] [data-chart-mark], [data-scene-wire] [data-chart-mark]", ms = 1 / 3, hs = {
4763
4865
  kJuA4N: "x15r89dc",
4764
4866
  k7Eaqz: "xeuugli",
4765
4867
  $$css: !0
4766
- }, as = {
4868
+ }, gs = {
4767
4869
  kVAEAm: "x10l6tqk",
4768
4870
  kbCHJM: "xu96u03",
4769
4871
  k87sOh: "x13vifvy",
@@ -4773,9 +4875,9 @@ var es = { unknownFigure: "MorphScope shows \"{name}\", which is not one of its
4773
4875
  kaIpWk: "xy32g2j",
4774
4876
  kWkggS: "xl8spv7",
4775
4877
  $$css: !0
4776
- }, os = {
4878
+ }, _s = {
4777
4879
  figure: (e) => [
4778
- is,
4880
+ hs,
4779
4881
  {
4780
4882
  kSiTet: e == null ? e : "xb4nw82",
4781
4883
  $$css: !0
@@ -4798,7 +4900,7 @@ var es = { unknownFigure: "MorphScope shows \"{name}\", which is not one of its
4798
4900
  "--x-transform": e ?? void 0
4799
4901
  }],
4800
4902
  ghost: (e) => [
4801
- as,
4903
+ gs,
4802
4904
  {
4803
4905
  kVAM5u: e == null ? e : "x6w5c0t",
4804
4906
  $$css: !0
@@ -4813,12 +4915,12 @@ var es = { unknownFigure: "MorphScope shows \"{name}\", which is not one of its
4813
4915
  $$css: !0
4814
4916
  }, { "--x-opacity": e ?? void 0 }]
4815
4917
  };
4816
- function ss(e) {
4918
+ function vs(e) {
4817
4919
  return (e.right - e.left) * (e.bottom - e.top);
4818
4920
  }
4819
- function cs(e, t) {
4820
- let n = ts.map((e) => `[${e}]`).join(","), r = Array.from(e.querySelectorAll(n)).filter((e) => !e.matches(ns)).map((e) => {
4821
- let n = ts.map((t) => e.getAttribute(t)).find((e) => e !== null) ?? "", r = e.getBoundingClientRect();
4921
+ function ys(e, t) {
4922
+ let n = fs.map((e) => `[${e}]`).join(","), r = Array.from(e.querySelectorAll(n)).filter((e) => !e.matches(ps)).map((e) => {
4923
+ let n = fs.map((t) => e.getAttribute(t)).find((e) => e !== null) ?? "", r = e.getBoundingClientRect();
4822
4924
  return {
4823
4925
  id: n,
4824
4926
  rect: {
@@ -4828,52 +4930,52 @@ function cs(e, t) {
4828
4930
  bottom: r.bottom - t.top
4829
4931
  }
4830
4932
  };
4831
- }).toSorted((e, t) => ss(t.rect) - ss(e.rect));
4933
+ }).toSorted((e, t) => vs(t.rect) - vs(e.rect));
4832
4934
  return new Map(r.map((e) => [e.id, e.rect]));
4833
4935
  }
4834
- function ls(e, t, n) {
4936
+ function bs(e, t, n) {
4835
4937
  return e + (t - e) * n;
4836
4938
  }
4837
- function us(e) {
4939
+ function xs(e) {
4838
4940
  return Math.min(1, Math.max(0, e));
4839
4941
  }
4840
- function ds({ name: e, show: t, flight: n, progress: r }) {
4841
- return e === t ? n === null ? 1 : us((r - .6666666666666667) / rs) : n?.from === e ? us(1 - r / rs) : 0;
4942
+ function Ss({ name: e, show: t, flight: n, progress: r }) {
4943
+ return e === t ? n === null ? 1 : xs((r - .6666666666666667) / ms) : n?.from === e ? xs(1 - r / ms) : 0;
4842
4944
  }
4843
- function fs({ name: e, opacity: t, isShown: n, setRoot: r, children: i }) {
4945
+ function Cs({ name: e, opacity: t, isShown: n, setRoot: r, children: i }) {
4844
4946
  return /* @__PURE__ */ G("div", {
4845
4947
  ref: (t) => r(e, t),
4846
4948
  "data-morph-figure": e,
4847
4949
  "aria-hidden": !n || void 0,
4848
4950
  inert: !n,
4849
- ...V.props(os.figure(t), t === 0 && os.hidden),
4951
+ ...H.props(_s.figure(t), t === 0 && _s.hidden),
4850
4952
  children: i
4851
4953
  });
4852
4954
  }
4853
- function ps({ travel: e, progress: t, tone: n }) {
4854
- let r = b(e.id), { from: i, to: a } = e, o = ls(i.left, a.left, t), s = ls(i.top, a.top, t), c = ls(i.right - i.left, a.right - a.left, t), l = ls(i.bottom - i.top, a.bottom - a.top, t), u = us(Math.min(t, 1 - t) / rs), d = N[n ?? r ?? "neutral"];
4955
+ function ws({ travel: e, progress: t, tone: n }) {
4956
+ let r = b(e.id), { from: i, to: a } = e, o = bs(i.left, a.left, t), s = bs(i.top, a.top, t), c = bs(i.right - i.left, a.right - a.left, t), l = bs(i.bottom - i.top, a.bottom - a.top, t), u = xs(Math.min(t, 1 - t) / ms), d = N[n ?? r ?? "neutral"];
4855
4957
  return /* @__PURE__ */ G("div", {
4856
4958
  "data-morph-ghost": e.id,
4857
- ...V.props(os.ghost(d), os.place(`translate(${o}px, ${s}px)`, c, l), os.fade(u))
4959
+ ...H.props(_s.ghost(d), _s.place(`translate(${o}px, ${s}px)`, c, l), _s.fade(u))
4858
4960
  });
4859
4961
  }
4860
- function ms({ tween: e, flight: t, tones: n }) {
4962
+ function Ts({ tween: e, flight: t, tones: n }) {
4861
4963
  let { progress: r } = ve(e.subscribe, e.get, e.get), i = new Map(Object.entries(n));
4862
4964
  return t === null || !(r > 0 && r < 1) ? null : /* @__PURE__ */ G("div", {
4863
4965
  "aria-hidden": !0,
4864
4966
  className: "x10l6tqk x10a8y8t xb3r6kr x47corl",
4865
- children: t.travels.map((e) => /* @__PURE__ */ G(ps, {
4967
+ children: t.travels.map((e) => /* @__PURE__ */ G(ws, {
4866
4968
  travel: e,
4867
4969
  progress: r,
4868
4970
  tone: i.get(e.id)
4869
4971
  }, e.id))
4870
4972
  });
4871
4973
  }
4872
- function hs({ tween: e, flight: t, show: n, figures: r, setRoot: i }) {
4974
+ function Es({ tween: e, flight: t, show: n, figures: r, setRoot: i }) {
4873
4975
  let { progress: a } = ve(e.subscribe, e.get, e.get);
4874
- return Object.entries(r).map(([e, r]) => /* @__PURE__ */ G(fs, {
4976
+ return Object.entries(r).map(([e, r]) => /* @__PURE__ */ G(Cs, {
4875
4977
  name: e,
4876
- opacity: ds({
4978
+ opacity: Ss({
4877
4979
  name: e,
4878
4980
  show: n,
4879
4981
  flight: t,
@@ -4884,15 +4986,15 @@ function hs({ tween: e, flight: t, show: n, figures: r, setRoot: i }) {
4884
4986
  children: r
4885
4987
  }, e));
4886
4988
  }
4887
- function gs({ figures: e, show: t, pace: n = "slow", tones: r = {}, labels: i }) {
4989
+ function Ds({ figures: e, show: t, pace: n = "slow", tones: r = {}, labels: i }) {
4888
4990
  let a = {
4889
- ...es,
4991
+ ...ds,
4890
4992
  ...i
4891
- }, o = _e(null), [s] = W(() => /* @__PURE__ */ new Map()), [c] = W(() => k({ progress: 1 })), [l, u] = W(null), d = _e(t), f = Object.keys(e), p = f.includes(t);
4993
+ }, o = _e(null), [s] = W(() => /* @__PURE__ */ new Map()), [c] = W(() => S({ progress: 1 })), [l, u] = W(null), d = _e(t), f = Object.keys(e), p = f.includes(t);
4892
4994
  return U(() => {
4893
4995
  let e = d.current, r = o.current;
4894
4996
  if (d.current = t, e === t || r === null) return;
4895
- let i = r.getBoundingClientRect(), a = s.get(e), l = s.get(t), f = a === void 0 ? /* @__PURE__ */ new Map() : cs(a, i), p = l === void 0 ? /* @__PURE__ */ new Map() : cs(l, i), m = [...f].flatMap(([e, t]) => {
4997
+ let i = r.getBoundingClientRect(), a = s.get(e), l = s.get(t), f = a === void 0 ? /* @__PURE__ */ new Map() : ys(a, i), p = l === void 0 ? /* @__PURE__ */ new Map() : ys(l, i), m = [...f].flatMap(([e, t]) => {
4896
4998
  let n = p.get(e);
4897
4999
  return n === void 0 ? [] : [{
4898
5000
  id: e,
@@ -4913,7 +5015,7 @@ function gs({ figures: e, show: t, pace: n = "slow", tones: r = {}, labels: i })
4913
5015
  ref: o,
4914
5016
  "data-morph-scope": "",
4915
5017
  className: "x1n2onr6 xrvj5dj xeuugli",
4916
- children: [/* @__PURE__ */ G(hs, {
5018
+ children: [/* @__PURE__ */ G(Es, {
4917
5019
  tween: c,
4918
5020
  flight: l,
4919
5021
  show: t,
@@ -4921,7 +5023,7 @@ function gs({ figures: e, show: t, pace: n = "slow", tones: r = {}, labels: i })
4921
5023
  setRoot: (e, t) => {
4922
5024
  t === null ? s.delete(e) : s.set(e, t);
4923
5025
  }
4924
- }), /* @__PURE__ */ G(ms, {
5026
+ }), /* @__PURE__ */ G(Ts, {
4925
5027
  tween: c,
4926
5028
  flight: l,
4927
5029
  tones: r
@@ -4935,4 +5037,4 @@ function gs({ figures: e, show: t, pace: n = "slow", tones: r = {}, labels: i })
4935
5037
  })
4936
5038
  });
4937
5039
  }
4938
- export { Ut as $, ra as A, Gr as B, wa as C, pa as D, fa as E, ki as F, Tr as G, Vr as H, wi as I, Ln as J, Qn as K, ai as L, $i as M, Gi as N, na as O, Li as P, Kt as Q, Ur as R, Ta as S, da as T, Ar as U, Hr as V, kr as W, cn as X, kn as Y, Wt as Z, Wa as _, Me as _t, Wo as a, Z as at, Pa as b, Ao as c, tt as ct, ho as d, J as dt, Q as et, go as f, et as ft, eo as g, Le as gt, co as h, Ie as ht, Qo as i, mt as it, ca as j, la as k, So as l, bt as lt, mo as m, q as mt, es as n, yt as nt, Uo as o, ht as ot, lo as p, Y as pt, Jn as q, $o as r, ft as rt, Oo as s, nt as st, gs as t, Bt as tt, bo as u, pt as ut, La as v, je as vt, ua as w, Da as x, Ia as y, Wr as z };
5040
+ export { Wt as $, ca as A, Jr as B, ka as C, va as D, _a as E, Pi as F, Or as G, Wr as H, ki as I, Bn as J, tr as K, ci as L, ia as M, Xi as N, sa as O, Hi as P, qt as Q, Kr as R, Aa as S, ga as T, Nr as U, Gr as V, Mr as W, un as X, Mn as Y, Gt as Z, Ya as _, Ne as _t, ts as a, Z as at, za as b, Vo as c, nt as ct, Eo as d, J as dt, Q as et, Do as f, tt as ft, fo as g, Re as gt, bo as h, Le as ht, ls as i, ht as it, pa as j, ma as k, No as l, xt as lt, To as m, q as mt, ds as n, bt as nt, es as o, gt as ot, xo as p, Y as pt, Zn as q, us as r, pt as rt, zo as s, rt as st, Ds as t, Vt as tt, jo as u, mt as ut, Ha as v, Me as vt, ha as w, Ma as x, Va as y, qr as z };