hyperbook 0.113.1 → 0.113.3

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 (55) hide show
  1. package/dist/asset-manifest.json +9 -9
  2. package/dist/assets/directive-bitflow/{EditorElement-zyz99U6n.js → EditorElement-BNwEKIvk.js} +258 -258
  3. package/dist/assets/directive-bitflow/{ReportElements-BnX14NtV.js → ReportElements-CAvHx5xm.js} +2 -2
  4. package/dist/assets/directive-bitflow/{bitLoaders-DIGwTcpd.js → bitLoaders-7qanePQL.js} +1138 -1073
  5. package/dist/assets/directive-bitflow/{dom-uYx_3K1r.js → dom-B6NPWBb1.js} +1558 -1551
  6. package/dist/assets/directive-bitflow/editor.js +3 -3
  7. package/dist/assets/directive-bitflow/flow.js +4 -4
  8. package/dist/assets/directive-bitflow/{index-BseSaQlX.js → index-4JaKZ7WT.js} +2 -2
  9. package/dist/assets/directive-bitflow/{index-e_8twLaN.js → index-6CQr_atd.js} +120 -120
  10. package/dist/assets/directive-bitflow/{index-COndsSPW.js → index-B9iG-a48.js} +9 -9
  11. package/dist/assets/directive-bitflow/{index-C5czXkRd.js → index-BFYoOtcY.js} +36 -36
  12. package/dist/assets/directive-bitflow/{index-YPMWh-1B.js → index-BI6aFdIS.js} +21 -21
  13. package/dist/assets/directive-bitflow/{index-D7m-hJZ9.js → index-Bf078mfo.js} +69 -69
  14. package/dist/assets/directive-bitflow/{index-Bf_FQRbK.js → index-BinE5Wvd.js} +19 -19
  15. package/dist/assets/directive-bitflow/{index-CFcRAa3F.js → index-BoX5-jkC.js} +31 -31
  16. package/dist/assets/directive-bitflow/{index-NyNuXp4C.js → index-BqRsXShM.js} +34 -34
  17. package/dist/assets/directive-bitflow/{index-Fr7yl4Vn.js → index-BxihQ8Oo.js} +21 -21
  18. package/dist/assets/directive-bitflow/{index-B3jMTk1o.js → index-C5YguHZU.js} +101 -101
  19. package/dist/assets/directive-bitflow/{index-XxGfBwJe.js → index-C8zwSmE6.js} +27 -27
  20. package/dist/assets/directive-bitflow/{index-BLcJNyog.js → index-C9JSBTNc.js} +91 -91
  21. package/dist/assets/directive-bitflow/{index-CjscG0z6.js → index-CCMI6UK4.js} +75 -75
  22. package/dist/assets/directive-bitflow/{index-CK1UMcfT.js → index-CGDt8H6s.js} +24 -24
  23. package/dist/assets/directive-bitflow/{index-xapm2BQE.js → index-Ca1v0pjV.js} +102 -92
  24. package/dist/assets/directive-bitflow/{index-IQHOi2fr.js → index-CaYn3Gmh.js} +31 -31
  25. package/dist/assets/directive-bitflow/{index-BpG316Ls.js → index-CbQue0If.js} +67 -67
  26. package/dist/assets/directive-bitflow/{index-CzdZQibq.js → index-CjH3h0OO.js} +79 -79
  27. package/dist/assets/directive-bitflow/{index-B7Z6Q-PQ.js → index-CkO3QfOS.js} +8 -8
  28. package/dist/assets/directive-bitflow/{index-BIJ7VfD2.js → index-Cz4i5rfe.js} +39 -39
  29. package/dist/assets/directive-bitflow/{index-8jTO-NJA.js → index-D0NtgeiX.js} +85 -85
  30. package/dist/assets/directive-bitflow/{index-DtsDy2By.js → index-D1C_1SPY.js} +14 -14
  31. package/dist/assets/directive-bitflow/{index-BdBBCZSy.js → index-D45u7EVR.js} +227 -194
  32. package/dist/assets/directive-bitflow/{index-cnRM_JDB.js → index-D9Ox4YpM.js} +33 -33
  33. package/dist/assets/directive-bitflow/{index-Bqf-kixT.js → index-DJ1w2Xcm.js} +46 -46
  34. package/dist/assets/directive-bitflow/{index-BQ5h4nDN.js → index-DUqW2fmV.js} +94 -94
  35. package/dist/assets/directive-bitflow/{index-ChgzyMHe.js → index-Deedj9EF.js} +25 -25
  36. package/dist/assets/directive-bitflow/{index-CZyaFdD2.js → index-Dg6nnY_v.js} +68 -68
  37. package/dist/assets/directive-bitflow/{index-kRpwcprB.js → index-DgxEzomz.js} +2 -2
  38. package/dist/assets/directive-bitflow/{index-D5yZNeIg.js → index-Dl0-ZAT5.js} +52 -52
  39. package/dist/assets/directive-bitflow/{index-DnVYIuen.js → index-Do6dmZyj.js} +42 -42
  40. package/dist/assets/directive-bitflow/{index-DjWNEPDL.js → index-DqnGC-DU.js} +31 -31
  41. package/dist/assets/directive-bitflow/{index-ivI25bnR.js → index-DwXXeSwk.js} +73 -73
  42. package/dist/assets/directive-bitflow/{index-Bf_NXJjq.js → index-b6qwcTj9.js} +15 -15
  43. package/dist/assets/directive-bitflow/{index-Fq7njn6_.js → index-d105UFQI.js} +58 -58
  44. package/dist/assets/directive-bitflow/{index-CW9iev-_.js → index-jijMWQB6.js} +8 -8
  45. package/dist/assets/directive-bitflow/{index-C_ZTSeqv.js → index-kxO5_U9Y.js} +24 -24
  46. package/dist/assets/directive-bitflow/{index-DoKlIgCD.js → index-p5AOgOal.js} +35 -35
  47. package/dist/assets/directive-bitflow/{index-CvCZVgKv.js → index-q2APknM6.js} +46 -46
  48. package/dist/assets/directive-bitflow/{index-eN2S_MLj.js → index-zVkWgm5I.js} +70 -70
  49. package/dist/assets/directive-bitflow/index.js +6 -6
  50. package/dist/assets/directive-bitflow/katex-DSLAjWZH-CHGN3Pr6.js +11314 -0
  51. package/dist/assets/directive-bitflow/katex-Dv-tcU2S-Dv-tcU2S.js +4 -0
  52. package/dist/assets/directive-bitflow/report.js +1 -1
  53. package/dist/assets/directive-bitflow/{shareableReport-ArQU1XjG.js → shareableReport-mdyEMdsJ.js} +6 -6
  54. package/dist/index.js +1 -1
  55. package/package.json +2 -2
@@ -1,12 +1,12 @@
1
- import { L as m, a2 as o, a4 as x, ab as y, ac as j, ad as g, a9 as d, a5 as E, j as i, a as S, b as c, s as A, aa as C } from "./dom-uYx_3K1r.js";
2
- import { v as w, A as p, P as M, y as R, e as H, M as h, E as T, L as F, R as I } from "./bitLoaders-DIGwTcpd.js";
3
- const z = "", K = ({
1
+ import { P as m, a2 as o, a4 as x, ab as j, ac as C, ad as w, a9 as d, a5 as y, j as i, a as S, b as c, s as E, aa as A } from "./dom-B6NPWBb1.js";
2
+ import { e as g, g as p, M, C as R, P as H, F as h, B as F, U as I, H as T } from "./bitLoaders-7qanePQL.js";
3
+ const z = "", P = ({
4
4
  data: e,
5
5
  answer: n
6
6
  }) => {
7
7
  if (e.evaluation.mode === "skip")
8
8
  return { state: "unknown", allowRetry: !1 };
9
- const s = f(n?.input ?? "", e), l = N(s, e), t = [];
9
+ const s = f(n?.input ?? "", e), l = U(s, e), t = [];
10
10
  if (e.evaluation.showFeedback)
11
11
  for (const r of e.patternFeedback)
12
12
  v(r.pattern, s, e.caseSensitive) && t.push(r.feedback);
@@ -16,7 +16,7 @@ const z = "", K = ({
16
16
  allowRetry: e.evaluation.enableRetry,
17
17
  feedback: t.length > 0 ? t : void 0
18
18
  };
19
- }, f = (e, n) => n.trim ? e.trim() : e, N = (e, n) => {
19
+ }, f = (e, n) => n.trim ? e.trim() : e, U = (e, n) => {
20
20
  if (n.matchMode === "regex")
21
21
  return v(n.pattern, e, n.caseSensitive);
22
22
  const s = (t) => n.caseSensitive ? t : t.toLowerCase(), l = s(e);
@@ -79,20 +79,20 @@ const z = "", K = ({
79
79
  it: { name: "Risposta breve", description: "Una breve risposta scritta.", answerLabel: "La tua risposta" },
80
80
  pt: { name: "Resposta curta", description: "Uma resposta curta escrita.", answerLabel: "A tua resposta" },
81
81
  tr: { name: "Kısa yanıt", description: "Kısa, yazılan bir yanıt.", answerLabel: "Yanıtın" }
82
- }, P = (e) => {
82
+ }, K = (e) => {
83
83
  try {
84
84
  return new RegExp(e), !0;
85
85
  } catch {
86
86
  return !1;
87
87
  }
88
- }, D = m({
88
+ }, N = m({
89
89
  instruction: o().default(""),
90
90
  /**
91
91
  * How the answer is checked. The old version only offered a raw regular
92
92
  * expression, which meant a teacher wanting "the answer is Paris" had to
93
93
  * write one — and get the escaping right.
94
94
  */
95
- matchMode: E(["exact", "contains", "regex"]).default("exact"),
95
+ matchMode: y(["exact", "contains", "regex"]).default("exact"),
96
96
  /** Accepted answers for `exact`/`contains`; any one of them counts. */
97
97
  expected: x(o()).default([]),
98
98
  /** Used when `matchMode` is `regex`. */
@@ -101,19 +101,19 @@ const z = "", K = ({
101
101
  trim: d().default(!0),
102
102
  /** Render a textarea instead of a single-line input. */
103
103
  multiline: d().default(!1),
104
- evaluation: j.default(g),
104
+ evaluation: C.default(w),
105
105
  /** Feedback attached to answers matching a pattern. */
106
106
  patternFeedback: x(
107
107
  m({
108
108
  pattern: o(),
109
- feedback: y
109
+ feedback: j
110
110
  })
111
111
  ).default([])
112
112
  }).check((e) => {
113
113
  const { matchMode: n, pattern: s, expected: l, evaluation: t } = e.value;
114
114
  if (t.mode === "auto") {
115
115
  if (n === "regex") {
116
- s ? P(s) || e.issues.push({
116
+ s ? K(s) || e.issues.push({
117
117
  code: "custom",
118
118
  input: s,
119
119
  path: ["pattern"],
@@ -133,7 +133,7 @@ const z = "", K = ({
133
133
  message: "Enter at least one accepted answer, or switch grading off for this task."
134
134
  });
135
135
  }
136
- }), W = m({ input: o().default("") }), U = ({
136
+ }), B = m({ input: o().default("") }), D = ({
137
137
  data: e,
138
138
  answer: n,
139
139
  readonly: s,
@@ -152,10 +152,10 @@ const z = "", K = ({
152
152
  autoCapitalize: "off",
153
153
  autoCorrect: "off",
154
154
  spellCheck: !1,
155
- onChange: (k) => t({ input: k.target.value })
155
+ onChange: (L) => t({ input: L.target.value })
156
156
  };
157
157
  return /* @__PURE__ */ i.jsxs("div", { className: "bitflow-stack", children: [
158
- /* @__PURE__ */ i.jsx(F, { markdown: e.instruction }),
158
+ /* @__PURE__ */ i.jsx(I, { markdown: e.instruction }),
159
159
  /* @__PURE__ */ i.jsxs("div", { className: "bitflow-field", children: [
160
160
  /* @__PURE__ */ i.jsx("label", { className: "bitflow-label", htmlFor: r, children: a }),
161
161
  e.multiline ? /* @__PURE__ */ i.jsx("textarea", { ...b, rows: 5 }) : /* @__PURE__ */ i.jsx("input", { ...b, type: "text" })
@@ -170,7 +170,7 @@ const z = "", K = ({
170
170
  const t = (a) => c(u, a, n), r = (a) => s({ ...e, ...a });
171
171
  return /* @__PURE__ */ i.jsxs("div", { className: "bitflow-stack", children: [
172
172
  /* @__PURE__ */ i.jsx(
173
- w,
173
+ g,
174
174
  {
175
175
  label: t("instructionLabel"),
176
176
  hint: t("instructionHint"),
@@ -202,7 +202,7 @@ const z = "", K = ({
202
202
  onChange: (a) => r({ pattern: a })
203
203
  }
204
204
  ) : /* @__PURE__ */ i.jsx(
205
- w,
205
+ g,
206
206
  {
207
207
  label: t("expectedLabel"),
208
208
  hint: t("expectedHint"),
@@ -240,7 +240,7 @@ const z = "", K = ({
240
240
  }
241
241
  ),
242
242
  /* @__PURE__ */ i.jsx(
243
- T,
243
+ F,
244
244
  {
245
245
  evaluation: e.evaluation,
246
246
  locale: n,
@@ -250,14 +250,14 @@ const z = "", K = ({
250
250
  ] })
251
251
  ] });
252
252
  };
253
- A("bitflow-styles-task-input", z);
254
- const L = "task-input";
255
- C({
256
- type: L,
253
+ E("bitflow-styles-task-input", z);
254
+ const k = "task-input";
255
+ A({
256
+ type: k,
257
257
  kind: "task",
258
- schema: D,
259
- evaluate: K,
260
- Task: U,
258
+ schema: N,
259
+ evaluate: P,
260
+ Task: D,
261
261
  Form: G,
262
262
  info: (e) => ({
263
263
  name: c(u, "name", e),
@@ -271,17 +271,17 @@ C({
271
271
  caseSensitive: !1,
272
272
  trim: !0,
273
273
  multiline: !1,
274
- evaluation: g(),
274
+ evaluation: w(),
275
275
  patternFeedback: []
276
276
  })
277
277
  });
278
- I(L);
278
+ T(k);
279
279
  export {
280
- W as AnswerSchema,
281
- D as DataSchema,
280
+ B as AnswerSchema,
281
+ N as DataSchema,
282
282
  G as Form,
283
- L as TYPE,
284
- U as Task,
285
- K as evaluate,
283
+ k as TYPE,
284
+ D as Task,
285
+ P as evaluate,
286
286
  u as messages
287
287
  };
@@ -1,14 +1,14 @@
1
- import { L as R, a4 as z, a9 as re, ac as ge, ad as oe, a2 as x, a as N, j as c, a5 as D, b as F, aa as we, s as ve } from "./dom-uYx_3K1r.js";
2
- import { v as ye, P as Q, t as ke, _ as xe, A as H, y as Z, e as Ne, M as je, E as Ke, L as Se, R as Le } from "./bitLoaders-DIGwTcpd.js";
3
- const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e) => {
1
+ import { P as R, a4 as E, a9 as re, ac as ge, ad as oe, a2 as x, a as N, j as c, a5 as D, b as F, aa as we, s as ve } from "./dom-B6NPWBb1.js";
2
+ import { e as ye, M as Q, r as ke, i as xe, g as O, C as Z, P as Ne, F as je, B as Ke, U as Se, H as Te } from "./bitLoaders-7qanePQL.js";
3
+ const Le = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Le.test(e.trim()), $ = (e) => {
4
4
  const t = e.mode === "search" ? [e.searchKey] : e.mode === "insert" ? e.insertKeys : [], o = [...e.tree.nodes.map((n) => n.label), ...t].filter(
5
5
  (n) => n.trim() !== ""
6
6
  );
7
7
  return o.length > 0 && o.every(se);
8
- }, L = (e, t, o) => o ? Number(e) - Number(t) : e.localeCompare(t, void 0, { numeric: !0 }), Ce = (e, t) => {
8
+ }, T = (e, t, o) => o ? Number(e) - Number(t) : e.localeCompare(t, void 0, { numeric: !0 }), Ce = (e, t) => {
9
9
  for (let o = 0; o < e.length; o++)
10
10
  for (let n = o + 1; n < e.length; n++)
11
- if (L(e[o], e[n], t) === 0) return e[n];
11
+ if (T(e[o], e[n], t) === 0) return e[n];
12
12
  }, X = (e) => e.split(/[,\s]+/).map((t) => t.trim()).filter((t) => t !== ""), Pe = (e) => {
13
13
  const t = /* @__PURE__ */ new Set();
14
14
  for (const o of e)
@@ -33,7 +33,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
33
33
  const n = new Map(e.map((s) => [s.id, s])), r = (s, a, d) => {
34
34
  if (s === void 0) return !0;
35
35
  const i = n.get(s);
36
- return !i || a !== void 0 && L(i.label, a, o) <= 0 || d !== void 0 && L(i.label, d, o) >= 0 ? !1 : r(i.left, a, i.label) && r(i.right, i.label, d);
36
+ return !i || a !== void 0 && T(i.label, a, o) <= 0 || d !== void 0 && T(i.label, d, o) >= 0 ? !1 : r(i.left, a, i.label) && r(i.right, i.label, d);
37
37
  };
38
38
  return r(t, void 0, void 0);
39
39
  }, Me = (e, t, o) => {
@@ -61,7 +61,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
61
61
  s.push(a);
62
62
  const d = r.get(a);
63
63
  if (!d) break;
64
- const i = L(o, d.label, n);
64
+ const i = T(o, d.label, n);
65
65
  if (i === 0) return { path: s, found: !0 };
66
66
  a = i < 0 ? d.left : d.right;
67
67
  }
@@ -83,7 +83,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
83
83
  const n = new Map(e.nodes.map((s) => [s.id, s]));
84
84
  let r = e.root;
85
85
  for (; ; ) {
86
- const s = n.get(r), a = L(t, s.label, o) < 0 ? "left" : "right", d = a === "left" ? s.left : s.right;
86
+ const s = n.get(r), a = T(t, s.label, o) < 0 ? "left" : "right", d = a === "left" ? s.left : s.right;
87
87
  if (d === void 0) return { key: t, parent: r, side: a };
88
88
  r = d;
89
89
  }
@@ -94,13 +94,13 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
94
94
  n.push(Be(s, r, o));
95
95
  }
96
96
  return n;
97
- }, Ee = (e, t) => {
97
+ }, ze = (e, t) => {
98
98
  const o = [];
99
99
  for (const r of e)
100
- r.trim() !== "" && (o.some((s) => L(s, r, t) === 0) || o.push(r));
100
+ r.trim() !== "" && (o.some((s) => T(s, r, t) === 0) || o.push(r));
101
101
  const n = { nodes: [], root: void 0 };
102
102
  return q(n, ne(n, o, t));
103
- }, ze = (e) => {
103
+ }, Ee = (e) => {
104
104
  const t = [];
105
105
  let o = 0;
106
106
  for (; o < e.length; ) {
@@ -121,7 +121,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
121
121
  }, ee = (e) => {
122
122
  const t = e.trim();
123
123
  if (t === "") return { tree: { nodes: [], root: void 0 } };
124
- const o = ze(t);
124
+ const o = Ee(t);
125
125
  let n = 0;
126
126
  const r = [];
127
127
  let s = 0;
@@ -164,7 +164,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
164
164
  return `${r.label} (${d}) (${o(r.right)})`;
165
165
  };
166
166
  return e.root === void 0 ? "" : o(e.root);
167
- }, Ae = (e, t, o = !0) => {
167
+ }, $e = (e, t, o = !0) => {
168
168
  const n = new Map(e.map((u) => [u.id, u])), r = [];
169
169
  let s = 0;
170
170
  const a = (u, b, p, f) => {
@@ -202,7 +202,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
202
202
  for (; o < e.length && o < t.length && e[o] === t[o]; )
203
203
  o += 1;
204
204
  return o;
205
- }, ie = (e, t, o) => e < t.length ? "wrongOrder" : t.length < o.length ? "missesPlaces" : "extraSteps", $e = (e, t) => {
205
+ }, ie = (e, t, o) => e < t.length ? "wrongOrder" : t.length < o.length ? "missesPlaces" : "extraSteps", Ae = (e, t) => {
206
206
  const o = Me(e.tree.nodes, e.tree.root, e.traversal), n = new Set(e.tree.nodes.map((b) => b.id)), r = (t?.sequence ?? []).filter((b) => n.has(b)), s = ae(r, o), a = s === o.length && r.length === o.length, d = r.length === 0 ? "empty" : a ? "correct" : ie(s, r, o), i = o.length, u = e.partialCredit && i > 0 ? { earned: s, possible: i } : { earned: a ? 1 : 0, possible: 1 };
207
207
  return {
208
208
  state: a ? "correct" : "wrong",
@@ -210,8 +210,8 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
210
210
  allowRetry: e.evaluation.enableRetry,
211
211
  detail: { reason: d, correctPrefix: s }
212
212
  };
213
- }, Oe = (e, t) => {
214
- const o = A(e), { path: n, found: r } = Ie(e.tree.nodes, e.tree.root, e.searchKey, o), s = new Set(e.tree.nodes.map((h) => h.id)), a = (t?.sequence ?? []).filter((h) => s.has(h)), d = t?.notFound ?? !1, i = ae(a, n), u = i === n.length && a.length === n.length, b = d === !r, p = u && b;
213
+ }, He = (e, t) => {
214
+ const o = $(e), { path: n, found: r } = Ie(e.tree.nodes, e.tree.root, e.searchKey, o), s = new Set(e.tree.nodes.map((h) => h.id)), a = (t?.sequence ?? []).filter((h) => s.has(h)), d = t?.notFound ?? !1, i = ae(a, n), u = i === n.length && a.length === n.length, b = d === !r, p = u && b;
215
215
  let f;
216
216
  a.length === 0 && !d ? f = "empty" : u ? b ? f = "correct" : f = r ? "saidNotFoundButFound" : "missedNotFound" : f = ie(i, a, n);
217
217
  const m = n.length + (r ? 0 : 1), w = r ? 0 : d ? 1 : 0, v = e.partialCredit && m > 0 ? { earned: i + w, possible: m } : { earned: p ? 1 : 0, possible: 1 };
@@ -221,8 +221,8 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
221
221
  allowRetry: e.evaluation.enableRetry,
222
222
  detail: { reason: f, correctPrefix: i }
223
223
  };
224
- }, He = (e, t) => {
225
- const o = A(e), n = ne(e.tree, e.insertKeys, o), r = t?.placements ?? [], s = e.insertKeys.map((p, f) => {
224
+ }, Oe = (e, t) => {
225
+ const o = $(e), n = ne(e.tree, e.insertKeys, o), r = t?.placements ?? [], s = e.insertKeys.map((p, f) => {
226
226
  if (f >= r.length) return "pending";
227
227
  const m = r[f];
228
228
  return m.parent === n[f].parent && m.side === n[f].side ? "correct" : "wrong";
@@ -241,13 +241,13 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
241
241
  return { state: "unknown", allowRetry: !1 };
242
242
  switch (e.mode) {
243
243
  case "search":
244
- return Oe(e, t);
245
- case "insert":
246
244
  return He(e, t);
245
+ case "insert":
246
+ return Oe(e, t);
247
247
  default:
248
- return $e(e, t);
248
+ return Ae(e, t);
249
249
  }
250
- }, $ = {
250
+ }, A = {
251
251
  en: {
252
252
  name: "Binary tree",
253
253
  description: "A binary tree the learner walks in a traversal order, searches, or grows by inserting keys.",
@@ -343,20 +343,20 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
343
343
  left: x().optional(),
344
344
  right: x().optional()
345
345
  }), qe = R({
346
- nodes: z(De).max(31).default([]),
346
+ nodes: E(De).max(31).default([]),
347
347
  /** Omitted only when `nodes` is empty — "insert" is the only mode that
348
348
  * starts with nothing to insert into. */
349
349
  root: x().optional()
350
- }), We = ["traversal", "search", "insert"], Ve = D(We), le = ["preorder", "inorder", "postorder", "levelorder"], Ge = D(le), Ue = R({
350
+ }), We = ["traversal", "search", "insert"], Ue = D(We), le = ["preorder", "inorder", "postorder", "levelorder"], Ve = D(le), Ge = R({
351
351
  instruction: x().default(""),
352
- mode: Ve.default("traversal"),
352
+ mode: Ue.default("traversal"),
353
353
  /** Only read in "traversal" mode. */
354
- traversal: Ge.default("inorder"),
354
+ traversal: Ve.default("inorder"),
355
355
  tree: qe.default({ nodes: [], root: void 0 }),
356
356
  /** Only read in "search" mode. */
357
357
  searchKey: x().default(""),
358
358
  /** Only read in "insert" mode, inserted in this order. */
359
- insertKeys: z(x()).max(12).default([]),
359
+ insertKeys: E(x()).max(12).default([]),
360
360
  /**
361
361
  * A point per place named in the right order, or per key placed where it
362
362
  * belongs, rather than the whole task passing or failing as one. Off for
@@ -443,7 +443,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
443
443
  path: ["insertKeys"],
444
444
  message: "Add at least one key to insert."
445
445
  }), (o === "search" || o === "insert") && b && t.root !== void 0) {
446
- const p = A(e.value);
446
+ const p = $(e.value);
447
447
  Re(t.nodes, t.root, p) || e.issues.push({
448
448
  code: "custom",
449
449
  input: t.nodes,
@@ -452,7 +452,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
452
452
  });
453
453
  }
454
454
  if (o === "insert" && r.length > 0) {
455
- const p = A(e.value), f = Ce(r, p);
455
+ const p = $(e.value), f = Ce(r, p);
456
456
  if (f !== void 0)
457
457
  e.issues.push({
458
458
  code: "custom",
@@ -462,7 +462,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
462
462
  });
463
463
  else {
464
464
  const m = r.find(
465
- (w) => t.nodes.some((v) => L(v.label, w, p) === 0)
465
+ (w) => t.nodes.some((v) => T(v.label, w, p) === 0)
466
466
  );
467
467
  m !== void 0 && e.issues.push({
468
468
  code: "custom",
@@ -480,11 +480,11 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
480
480
  side: D(["left", "right", "root"])
481
481
  }), lt = R({
482
482
  /** "traversal"/"search": the places tapped, in order. */
483
- sequence: z(x()).default([]),
483
+ sequence: E(x()).default([]),
484
484
  /** "search" only: whether the learner also said the key was not there. */
485
485
  notFound: re().optional(),
486
486
  /** "insert" only: where each key in turn was tapped. */
487
- placements: z(Ye).default([])
487
+ placements: E(Ye).default([])
488
488
  }), Je = (e, t) => e.nodes.find((o) => o.id === t), dt = (e, t) => Je(e, t)?.label || t, Qe = '.bitflow-tree{display:flex;flex-direction:column;gap:var(--bitflow-space-small)}.bitflow-tree-scroll{overflow-x:auto}.bitflow-tree-diagram{display:block;width:100%;min-width:calc(var(--bitflow-tree-columns, 1) * 2.5rem);height:auto;background:var(--bitflow-color-surface);border:1px solid var(--bitflow-color-border);border-radius:var(--bitflow-radius-standard)}.bitflow-tree-edge{stroke:var(--bitflow-color-neutral-400);stroke-width:calc(3 * var(--bitflow-tree-scale, 1))}.bitflow-tree-edge-empty{stroke-dasharray:8 6}.bitflow-tree-node circle{fill:var(--bitflow-color-surface);stroke:var(--bitflow-color-neutral-700);stroke-width:calc(3 * var(--bitflow-tree-scale, 1))}.bitflow-tree-node text{fill:var(--bitflow-color-text);font-family:var(--bitflow-font-family);font-size:calc(28px * var(--bitflow-tree-scale, 1));font-weight:var(--bitflow-font-weight-medium);-webkit-user-select:none;user-select:none}.bitflow-tree-node-live{cursor:pointer}.bitflow-tree-node-chosen circle{fill:var(--bitflow-color-primary-light);stroke:var(--bitflow-color-primary)}.bitflow-tree-node-right circle{fill:var(--bitflow-color-correct-surface);stroke:var(--bitflow-color-correct)}.bitflow-tree-node-wrong circle{fill:var(--bitflow-color-wrong-surface);stroke:var(--bitflow-color-wrong);stroke-dasharray:10 6}.bitflow-tree-node text.bitflow-tree-step{fill:var(--bitflow-color-primary-dark);font-size:calc(22px * var(--bitflow-tree-scale, 1));font-weight:var(--bitflow-font-weight-bold)}.bitflow-tree-node text.bitflow-tree-verdict{font-size:calc(22px * var(--bitflow-tree-scale, 1));font-weight:var(--bitflow-font-weight-bold)}.bitflow-tree-node-right text.bitflow-tree-verdict{fill:var(--bitflow-color-correct)}.bitflow-tree-node-wrong text.bitflow-tree-verdict{fill:var(--bitflow-color-wrong)}.bitflow-tree-slot{fill:transparent;stroke:var(--bitflow-color-neutral-400);stroke-width:calc(2 * var(--bitflow-tree-scale, 1));stroke-dasharray:6 5}.bitflow-tree-slot-live{cursor:pointer;stroke:var(--bitflow-color-primary)}.bitflow-tree-slot-live:hover{fill:var(--bitflow-color-primary-light)}.bitflow-tree-next{margin:0;font-weight:var(--bitflow-font-weight-medium)}.bitflow-tree-chosen{display:flex;flex-wrap:wrap;gap:var(--bitflow-space-xxsmall);margin:0;padding:0;list-style:none;counter-reset:bitflow-tree-step}.bitflow-tree-chip{counter-increment:bitflow-tree-step;padding:var(--bitflow-space-xxsmall) var(--bitflow-space-xsmall);border-radius:var(--bitflow-radius-full);background:var(--bitflow-color-primary-light);color:var(--bitflow-color-primary-dark);font-size:var(--bitflow-font-size-small)}.bitflow-tree-chip:before{content:counter(bitflow-tree-step) ". ";font-weight:var(--bitflow-font-weight-bold)}.bitflow-tree-chip-correct{background:var(--bitflow-color-correct-surface);color:var(--bitflow-color-correct)}.bitflow-tree-chip-wrong{background:var(--bitflow-color-wrong-surface);color:var(--bitflow-color-wrong);text-decoration:line-through}.bitflow-tree-text{font-family:var(--bitflow-font-family-mono)}.bitflow-tree-keys{flex:1 1 12rem;width:auto;min-width:0}', Ze = {
489
489
  en: {
490
490
  instructionLabel: "Instruction",
@@ -571,30 +571,30 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
571
571
  onChange: a,
572
572
  diagramOnly: d
573
573
  }) => {
574
- const i = (l, g) => F($, l, o, g), u = N.useRef(null), b = rt(u), [p, f] = N.useState(""), m = !n && a !== void 0, w = e.mode === "insert", v = t?.sequence ?? [], h = t?.placements ?? [], k = r !== void 0 || s !== void 0, M = w ? q(e.tree, h) : e.tree, j = Ae(M.nodes, M.root, w), W = Xe * (j.depth + 1), O = (l) => ({
574
+ const i = (l, g) => F(A, l, o, g), u = N.useRef(null), b = rt(u), [p, f] = N.useState(""), m = !n && a !== void 0, w = e.mode === "insert", v = t?.sequence ?? [], h = t?.placements ?? [], k = r !== void 0 || s !== void 0, M = w ? q(e.tree, h) : e.tree, j = $e(M.nodes, M.root, w), W = Xe * (j.depth + 1), H = (l) => ({
575
575
  x: l.x * _,
576
576
  y: l.y * W
577
- }), I = new Map(j.nodes.map((l) => [l.id, O(l)])), V = j.nodes.length + j.slots.length, K = Math.min(te * b, 0.42 * _ / Math.max(V, 1)), B = (l) => M.nodes.find((g) => g.id === l)?.label || l, S = w ? e.insertKeys[h.length] : void 0, T = (l) => a?.({
577
+ }), I = new Map(j.nodes.map((l) => [l.id, H(l)])), U = j.nodes.length + j.slots.length, K = Math.min(te * b, 0.42 * _ / Math.max(U, 1)), B = (l) => M.nodes.find((g) => g.id === l)?.label || l, S = w ? e.insertKeys[h.length] : void 0, L = (l) => a?.({
578
578
  sequence: v,
579
579
  placements: h,
580
580
  ...t?.notFound !== void 0 ? { notFound: t.notFound } : {},
581
581
  ...l
582
- }), G = (l) => {
582
+ }), V = (l) => {
583
583
  if (m) {
584
584
  if (v.includes(l)) {
585
585
  f(i("alreadyChosen", { key: B(l) }));
586
586
  return;
587
587
  }
588
- T({ sequence: [...v, l] }), f(i("added", { key: B(l), step: v.length + 1 }));
588
+ L({ sequence: [...v, l] }), f(i("added", { key: B(l), step: v.length + 1 }));
589
589
  }
590
- }, U = (l) => l.side === "root" ? i("slotRoot") : i(l.side === "left" ? "slotLeft" : "slotRight", {
590
+ }, G = (l) => l.side === "root" ? i("slotRoot") : i(l.side === "left" ? "slotLeft" : "slotRight", {
591
591
  key: B(l.parentId)
592
592
  }), Y = (l) => {
593
- !m || S === void 0 || (T({
593
+ !m || S === void 0 || (L({
594
594
  placements: [...h, { key: S, parent: l.parentId, side: l.side }]
595
- }), f(i("placed", { key: S, where: U(l) })));
595
+ }), f(i("placed", { key: S, where: G(l) })));
596
596
  }, ue = () => {
597
- m && (w ? T({ placements: h.slice(0, -1) }) : t?.notFound ? T({ notFound: !1 }) : T({ sequence: v.slice(0, -1) }), f(i("undone")));
597
+ m && (w ? L({ placements: h.slice(0, -1) }) : t?.notFound ? L({ notFound: !1 }) : L({ sequence: v.slice(0, -1) }), f(i("undone")));
598
598
  }, fe = () => {
599
599
  m && (a?.({ sequence: [], placements: [] }), f(i("cleared")));
600
600
  }, be = (l) => v.indexOf(l) + 1, J = (l) => r === void 0 ? void 0 : l <= r ? "correct" : "wrong", pe = (l) => {
@@ -615,7 +615,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
615
615
  "aria-label": i("diagramLabel"),
616
616
  style: {
617
617
  "--bitflow-tree-scale": Math.min(b, K / te),
618
- "--bitflow-tree-columns": V
618
+ "--bitflow-tree-columns": U
619
619
  },
620
620
  children: [
621
621
  me.map((l) => {
@@ -633,7 +633,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
633
633
  );
634
634
  }),
635
635
  w && j.slots.map((l) => {
636
- const g = O(l), y = l.parentId ? I.get(l.parentId) : void 0;
636
+ const g = H(l), y = l.parentId ? I.get(l.parentId) : void 0;
637
637
  return /* @__PURE__ */ c.jsxs("g", { children: [
638
638
  y && /* @__PURE__ */ c.jsx(
639
639
  "line",
@@ -658,13 +658,13 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
658
658
  ] }, `${l.parentId}-${l.side}`);
659
659
  }),
660
660
  j.nodes.map((l) => {
661
- const g = O(l), y = be(l.id), E = w ? pe(l.id) : y > 0 ? J(y) : void 0, C = ["bitflow-tree-node"];
662
- return y > 0 && C.push("bitflow-tree-node-chosen"), E === "correct" && C.push("bitflow-tree-node-right"), E === "wrong" && C.push("bitflow-tree-node-wrong"), m && !w && C.push("bitflow-tree-node-live"), /* @__PURE__ */ c.jsxs(
661
+ const g = H(l), y = be(l.id), z = w ? pe(l.id) : y > 0 ? J(y) : void 0, C = ["bitflow-tree-node"];
662
+ return y > 0 && C.push("bitflow-tree-node-chosen"), z === "correct" && C.push("bitflow-tree-node-right"), z === "wrong" && C.push("bitflow-tree-node-wrong"), m && !w && C.push("bitflow-tree-node-live"), /* @__PURE__ */ c.jsxs(
663
663
  "g",
664
664
  {
665
665
  className: C.join(" "),
666
666
  transform: `translate(${g.x} ${g.y})`,
667
- onClick: () => !w && G(l.id),
667
+ onClick: () => !w && V(l.id),
668
668
  children: [
669
669
  /* @__PURE__ */ c.jsx("circle", { r: K }),
670
670
  /* @__PURE__ */ c.jsx("text", { dominantBaseline: "central", textAnchor: "middle", children: l.label }),
@@ -678,14 +678,14 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
678
678
  children: y
679
679
  }
680
680
  ),
681
- E && /* @__PURE__ */ c.jsx(
681
+ z && /* @__PURE__ */ c.jsx(
682
682
  "text",
683
683
  {
684
684
  className: "bitflow-tree-verdict",
685
685
  x: -K * 0.9,
686
686
  y: -K * 0.9,
687
687
  textAnchor: "end",
688
- children: E === "correct" ? "✓" : "✗"
688
+ children: z === "correct" ? "✓" : "✗"
689
689
  }
690
690
  )
691
691
  ]
@@ -728,7 +728,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
728
728
  type: "button",
729
729
  className: "bitflow-button bitflow-button-secondary",
730
730
  onClick: () => Y(l),
731
- children: U(l)
731
+ children: G(l)
732
732
  },
733
733
  `${l.parentId}-${l.side}`
734
734
  )) : j.nodes.map((l) => /* @__PURE__ */ c.jsx(
@@ -737,7 +737,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
737
737
  type: "button",
738
738
  className: "bitflow-button bitflow-button-secondary",
739
739
  disabled: v.includes(l.id),
740
- onClick: () => G(l.id),
740
+ onClick: () => V(l.id),
741
741
  children: i("addNode", { key: l.label })
742
742
  },
743
743
  l.id
@@ -749,7 +749,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
749
749
  className: "bitflow-button bitflow-button-secondary",
750
750
  "aria-pressed": t?.notFound === !0,
751
751
  onClick: () => {
752
- T({ notFound: !t?.notFound }), f(i(t?.notFound ? "notFoundOff" : "notFoundOn"));
752
+ L({ notFound: !t?.notFound }), f(i(t?.notFound ? "notFoundOff" : "notFoundOn"));
753
753
  },
754
754
  children: i("notFound")
755
755
  }
@@ -807,7 +807,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
807
807
  locale: r,
808
808
  onAnswerChange: s
809
809
  }) => {
810
- const a = (u, b) => F($, u, r, b), d = o?.detail, i = n ? a("howToReadonly") : e.mode === "search" ? a("howToSearch", { key: e.searchKey }) : e.mode === "insert" ? a("howToInsert") : a("howToTraversal", { order: a(ce[e.traversal]) });
810
+ const a = (u, b) => F(A, u, r, b), d = o?.detail, i = n ? a("howToReadonly") : e.mode === "search" ? a("howToSearch", { key: e.searchKey }) : e.mode === "insert" ? a("howToInsert") : a("howToTraversal", { order: a(ce[e.traversal]) });
811
811
  return /* @__PURE__ */ c.jsxs("div", { className: "bitflow-stack", children: [
812
812
  /* @__PURE__ */ c.jsx(Se, { markdown: e.instruction }),
813
813
  /* @__PURE__ */ c.jsx("p", { className: "bitflow-hint", children: i }),
@@ -845,7 +845,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
845
845
  }
846
846
  u(void 0), s({ tree: k.tree });
847
847
  }, v = () => {
848
- const h = X(b), k = Ee(h, h.length > 0 && h.every(se));
848
+ const h = X(b), k = ze(h, h.length > 0 && h.every(se));
849
849
  d(P(k)), u(void 0), s({ tree: k });
850
850
  };
851
851
  return /* @__PURE__ */ c.jsxs("div", { className: "bitflow-stack", children: [
@@ -887,7 +887,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
887
887
  {
888
888
  label: r("treeLabel"),
889
889
  hint: r("treeHint"),
890
- error: i ?? xe(n, "tree.nodes") ?? H(n, "tree.root"),
890
+ error: i ?? xe(n, "tree.nodes") ?? O(n, "tree.root"),
891
891
  children: (h) => /* @__PURE__ */ c.jsx(
892
892
  "textarea",
893
893
  {
@@ -939,7 +939,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
939
939
  label: r("searchKeyLabel"),
940
940
  hint: r("searchKeyHint"),
941
941
  value: e.searchKey,
942
- error: H(n, "searchKey"),
942
+ error: O(n, "searchKey"),
943
943
  onChange: (h) => s({ searchKey: h.trim() })
944
944
  }
945
945
  ),
@@ -949,7 +949,7 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
949
949
  label: r("insertKeysLabel"),
950
950
  hint: r("insertKeysHint"),
951
951
  value: f,
952
- error: H(n, "insertKeys"),
952
+ error: O(n, "insertKeys"),
953
953
  onChange: (h) => {
954
954
  m(h), s({ insertKeys: X(h) });
955
955
  }
@@ -979,13 +979,13 @@ const Te = /^[+-]?(?:\d+\.?\d*|\.\d+)$/, se = (e) => Te.test(e.trim()), A = (e)
979
979
  we({
980
980
  type: he,
981
981
  kind: "task",
982
- schema: Ue,
982
+ schema: Ge,
983
983
  evaluate: _e,
984
984
  Task: ot,
985
985
  Form: st,
986
986
  info: (e) => ({
987
- name: F($, "name", e),
988
- description: F($, "description", e)
987
+ name: F(A, "name", e),
988
+ description: F(A, "description", e)
989
989
  }),
990
990
  defaultData: () => ({
991
991
  instruction: "",
@@ -998,32 +998,32 @@ we({
998
998
  evaluation: oe()
999
999
  })
1000
1000
  });
1001
- Le(he);
1001
+ Te(he);
1002
1002
  ve("bitflow-styles-task-binary-tree", Qe);
1003
1003
  export {
1004
1004
  lt as AnswerSchema,
1005
- Ue as DataSchema,
1005
+ Ge as DataSchema,
1006
1006
  st as Form,
1007
1007
  We as MODES,
1008
- Ve as ModeSchema,
1008
+ Ue as ModeSchema,
1009
1009
  Ye as PlacementSchema,
1010
1010
  it as REASONS,
1011
1011
  le as TRAVERSAL_KINDS,
1012
1012
  he as TYPE,
1013
1013
  ot as Task,
1014
- Ge as TraversalKindSchema,
1014
+ Ve as TraversalKindSchema,
1015
1015
  De as TreeNodeSchema,
1016
1016
  qe as TreeSchema,
1017
1017
  de as TreeView,
1018
- Ee as buildBstFromKeys,
1019
- L as compareKeys,
1018
+ ze as buildBstFromKeys,
1019
+ T as compareKeys,
1020
1020
  _e as evaluate,
1021
1021
  ne as expectedPlacements,
1022
1022
  Ze as formMessages,
1023
1023
  Re as isBst,
1024
- A as isNumericMode,
1025
- Ae as layoutTree,
1026
- $ as messages,
1024
+ $ as isNumericMode,
1025
+ $e as layoutTree,
1026
+ A as messages,
1027
1027
  dt as nameOf,
1028
1028
  Je as nodeById,
1029
1029
  X as parseKeyList,