hyperbook 0.113.0 → 0.113.2

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 (56) hide show
  1. package/README.md +18 -3
  2. package/dist/asset-manifest.json +9 -9
  3. package/dist/assets/directive-bitflow/{EditorElement-zyz99U6n.js → EditorElement-CE3Yr86b.js} +155 -155
  4. package/dist/assets/directive-bitflow/{ReportElements-BnX14NtV.js → ReportElements-eYGRtw6N.js} +1 -1
  5. package/dist/assets/directive-bitflow/{bitLoaders-DIGwTcpd.js → bitLoaders-CxvZkGrY.js} +1138 -1073
  6. package/dist/assets/directive-bitflow/editor.js +3 -3
  7. package/dist/assets/directive-bitflow/flow.js +3 -3
  8. package/dist/assets/directive-bitflow/{index-IQHOi2fr.js → index-88c3K20U.js} +31 -31
  9. package/dist/assets/directive-bitflow/{index-Bqf-kixT.js → index-B61LKxr1.js} +45 -45
  10. package/dist/assets/directive-bitflow/{index-CFcRAa3F.js → index-BG0PL-Z6.js} +30 -30
  11. package/dist/assets/directive-bitflow/{index-B3jMTk1o.js → index-BNdpL6Ss.js} +78 -78
  12. package/dist/assets/directive-bitflow/{index-Fq7njn6_.js → index-BO-d4HVC.js} +48 -48
  13. package/dist/assets/directive-bitflow/{index-Bf_NXJjq.js → index-BZhNY0lo.js} +12 -12
  14. package/dist/assets/directive-bitflow/{index-COndsSPW.js → index-BadyFTU5.js} +8 -8
  15. package/dist/assets/directive-bitflow/{index-CvCZVgKv.js → index-BlT1EcFH.js} +34 -34
  16. package/dist/assets/directive-bitflow/{index-CW9iev-_.js → index-BuQ-K_tR.js} +7 -7
  17. package/dist/assets/directive-bitflow/{index-DjWNEPDL.js → index-Bw0pL0hW.js} +28 -28
  18. package/dist/assets/directive-bitflow/{index-BQ5h4nDN.js → index-BwBVUdJ9.js} +94 -94
  19. package/dist/assets/directive-bitflow/{index-CjscG0z6.js → index-BydYlLy4.js} +73 -73
  20. package/dist/assets/directive-bitflow/{index-BpG316Ls.js → index-C7RJxxAx.js} +63 -63
  21. package/dist/assets/directive-bitflow/{index-eN2S_MLj.js → index-CERSJ9uS.js} +70 -70
  22. package/dist/assets/directive-bitflow/{index-DtsDy2By.js → index-CLHtOGrW.js} +11 -11
  23. package/dist/assets/directive-bitflow/{index-Bf_FQRbK.js → index-CWe2GjBK.js} +14 -14
  24. package/dist/assets/directive-bitflow/{index-CzdZQibq.js → index-CfKpkSVC.js} +72 -72
  25. package/dist/assets/directive-bitflow/{index-Fr7yl4Vn.js → index-CjKhq7gY.js} +23 -23
  26. package/dist/assets/directive-bitflow/{index-DoKlIgCD.js → index-Cm4w1Zyc.js} +38 -38
  27. package/dist/assets/directive-bitflow/{index-D5yZNeIg.js → index-D0U3nepG.js} +52 -52
  28. package/dist/assets/directive-bitflow/{index-C5czXkRd.js → index-D4PdXMcj.js} +33 -33
  29. package/dist/assets/directive-bitflow/{index-BLcJNyog.js → index-D9LOuqr2.js} +99 -99
  30. package/dist/assets/directive-bitflow/{index-BIJ7VfD2.js → index-DIb3CXwC.js} +42 -42
  31. package/dist/assets/directive-bitflow/{index-CZyaFdD2.js → index-DQP0cUsP.js} +70 -70
  32. package/dist/assets/directive-bitflow/{index-ChgzyMHe.js → index-DUOrQfVe.js} +27 -27
  33. package/dist/assets/directive-bitflow/{index-kRpwcprB.js → index-DW3cUBvZ.js} +1 -1
  34. package/dist/assets/directive-bitflow/{index-C_ZTSeqv.js → index-DYWo0PUv.js} +24 -24
  35. package/dist/assets/directive-bitflow/{index-xapm2BQE.js → index-D_QhyFcx.js} +101 -91
  36. package/dist/assets/directive-bitflow/{index-BdBBCZSy.js → index-Dn5hHVuT.js} +226 -193
  37. package/dist/assets/directive-bitflow/{index-D7m-hJZ9.js → index-DruC5d43.js} +69 -69
  38. package/dist/assets/directive-bitflow/{index-e_8twLaN.js → index-EKIgFddO.js} +105 -105
  39. package/dist/assets/directive-bitflow/{index-8jTO-NJA.js → index-HXNGIC7K.js} +70 -70
  40. package/dist/assets/directive-bitflow/{index-DnVYIuen.js → index-ISbOe239.js} +42 -42
  41. package/dist/assets/directive-bitflow/{index-cnRM_JDB.js → index-IsMJtrUT.js} +31 -31
  42. package/dist/assets/directive-bitflow/{index-B7Z6Q-PQ.js → index-TUXuIR22.js} +6 -6
  43. package/dist/assets/directive-bitflow/{index-CK1UMcfT.js → index-WbE9UOFa.js} +24 -24
  44. package/dist/assets/directive-bitflow/{index-YPMWh-1B.js → index-d5ebPDeY.js} +13 -13
  45. package/dist/assets/directive-bitflow/{index-NyNuXp4C.js → index-ledofrbo.js} +33 -33
  46. package/dist/assets/directive-bitflow/{index-BseSaQlX.js → index-oNmOArKu.js} +1 -1
  47. package/dist/assets/directive-bitflow/{index-ivI25bnR.js → index-rp4UTV85.js} +84 -84
  48. package/dist/assets/directive-bitflow/{index-XxGfBwJe.js → index-xTX3CXJW.js} +23 -23
  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-vjEU4OvA.js} +2 -2
  54. package/dist/index.js +6351 -3340
  55. package/dist/schemas/hyperbook.schema.json +4 -4
  56. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
- import { d as o } from "./EditorElement-zyz99U6n.js";
2
- import { B as l } from "./EditorElement-zyz99U6n.js";
3
- import { l as m } from "./bitLoaders-DIGwTcpd.js";
1
+ import { d as o } from "./EditorElement-CE3Yr86b.js";
2
+ import { B as l } from "./EditorElement-CE3Yr86b.js";
3
+ import { l as m } from "./bitLoaders-CxvZkGrY.js";
4
4
  o();
5
5
  export {
6
6
  l as BitflowEditorElement,
@@ -1,6 +1,6 @@
1
- import { d as e } from "./shareableReport-ArQU1XjG.js";
2
- import { B as s, c as t } from "./shareableReport-ArQU1XjG.js";
3
- import { K as p, b as f, a as m, c as i } from "./bitLoaders-DIGwTcpd.js";
1
+ import { d as e } from "./shareableReport-vjEU4OvA.js";
2
+ import { B as s, c as t } from "./shareableReport-vjEU4OvA.js";
3
+ import { K as p, b as f, a as m, c as i } from "./bitLoaders-CxvZkGrY.js";
4
4
  import { O as b, t as d } from "./dom-uYx_3K1r.js";
5
5
  e();
6
6
  export {
@@ -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 { L 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-uYx_3K1r.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-CxvZkGrY.js";
3
+ const z = "", U = ({
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 = K(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, K = (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
+ }, N = (e) => {
83
83
  try {
84
84
  return new RegExp(e), !0;
85
85
  } catch {
86
86
  return !1;
87
87
  }
88
- }, D = m({
88
+ }, P = 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 ? N(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: P,
259
+ evaluate: U,
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
+ P 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
+ U as evaluate,
286
286
  u as messages
287
287
  };
@@ -1,12 +1,12 @@
1
- import { L as R, a2 as k, ac as H, ad as B, a4 as $, P as D, am as P, a as j, j as o, a9 as I, a5 as W, b as C, aa as O, s as Z } from "./dom-uYx_3K1r.js";
2
- import { S as Y, v as S, D as q, A as f, e as z, y as K, M as U, P as G, t as J, E as Q, N as V, L as X, R as _ } from "./bitLoaders-DIGwTcpd.js";
1
+ import { L as C, a2 as k, ac as $, ad as z, a4 as A, P as B, am as I, a as j, j as o, a9 as P, a5 as W, b as R, aa as O, s as Z } from "./dom-uYx_3K1r.js";
2
+ import { $ as U, e as S, h as Y, g as f, P as F, C as q, F as G, M as K, r as J, B as Q, j as V, U as X, H as _ } from "./bitLoaders-CxvZkGrY.js";
3
3
  const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitflow-space-small)}.bitflow-hotspots-picture{position:relative;width:100%;overflow:hidden;border-radius:var(--bitflow-radius-standard)}.bitflow-hotspots-image{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}.bitflow-hotspots-noimage{background:var(--bitflow-color-neutral-100)}.bitflow-hotspots-surface{position:absolute;inset:0;width:100%;height:100%;padding:0;cursor:crosshair;background:none;border:0}.bitflow-hotspots-surface:disabled{cursor:default}.bitflow-hotspots-aim{position:absolute;width:22px;height:22px;margin:-11px 0 0 -11px;pointer-events:none;opacity:0;border:2px solid var(--bitflow-color-primary);border-radius:50%}.bitflow-hotspots-surface:focus-visible~.bitflow-hotspots-aim{opacity:1}.bitflow-hotspots-mark{position:absolute;width:14px;height:14px;margin:-7px 0 0 -7px;pointer-events:none;background:var(--bitflow-color-primary);border:2px solid var(--bitflow-color-surface);border-radius:50%}.bitflow-hotspots-mark-correct{background:var(--bitflow-color-correct)}.bitflow-hotspots-mark-wrong{background:var(--bitflow-color-wrong)}.bitflow-hotspots-region{position:absolute;pointer-events:none;border:2px solid}.bitflow-hotspots-region-correct{background:color-mix(in srgb,var(--bitflow-color-correct) 15%,transparent);border-color:var(--bitflow-color-correct)}.bitflow-hotspots-region-wrong{background:color-mix(in srgb,var(--bitflow-color-wrong) 15%,transparent);border-color:var(--bitflow-color-wrong)}.bitflow-hotspots-verdict,.bitflow-hotspots-feedback{margin:0}.bitflow-boxeditor-box.bitflow-hotspots-handle-correct{background:color-mix(in srgb,var(--bitflow-color-correct) 18%,transparent);border-color:var(--bitflow-color-correct)}", te = (e, i) => {
4
4
  if (e.width <= 0 || e.height <= 0) return !1;
5
5
  if (e.shape === "rect")
6
6
  return i.x >= e.x && i.x <= e.x + e.width && i.y >= e.y && i.y <= e.y + e.height;
7
7
  const n = (i.x - (e.x + e.width / 2)) / (e.width / 2), a = (i.y - (e.y + e.height / 2)) / (e.height / 2);
8
8
  return n * n + a * a <= 1;
9
- }, T = (e, i) => [...e].reverse().find((n) => te(n, i)), be = (e) => ({
9
+ }, H = (e, i) => [...e].reverse().find((n) => te(n, i)), be = (e) => ({
10
10
  x: e.x + e.width / 2,
11
11
  y: e.y + e.height / 2
12
12
  }), oe = ({
@@ -15,7 +15,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
15
15
  }) => {
16
16
  if (e.evaluation.mode === "skip")
17
17
  return { state: "unknown", allowRetry: !1 };
18
- const n = i?.selection, a = n ? T(e.hotspots, n) : void 0, s = a?.correct === !0;
18
+ const n = i?.selection, a = n ? H(e.hotspots, n) : void 0, s = a?.correct === !0;
19
19
  return {
20
20
  state: s ? "correct" : "wrong",
21
21
  score: { earned: s ? 1 : 0, possible: 1 },
@@ -30,7 +30,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
30
30
  feedback: a?.feedback ?? (n ? e.missFeedback : void 0)
31
31
  }
32
32
  };
33
- }, L = {
33
+ }, D = {
34
34
  en: {
35
35
  name: "Find the spot",
36
36
  description: "A picture with a place on it the learner has to find.",
@@ -53,7 +53,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
53
53
  landedOn: "Gewählt: {region}.",
54
54
  landedNowhere: "Du hast eine Stelle ohne Bereich gewählt."
55
55
  }
56
- }, v = D().min(0).max(1), se = R({
56
+ }, v = B().min(0).max(1), se = C({
57
57
  /** Stable across edits, so an answer keeps pointing at the same region. */
58
58
  id: k().min(1),
59
59
  /**
@@ -66,7 +66,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
66
66
  width: v,
67
67
  height: v,
68
68
  /** Whether finding this one is the point. Several may be. */
69
- correct: I().default(!1),
69
+ correct: P().default(!1),
70
70
  /**
71
71
  * Shown once this region has been chosen. On a wrong region this is where
72
72
  * the teaching happens — "that is the monitor, not an input device" is worth
@@ -78,18 +78,18 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
78
78
  * never read out before the answer: it says where things are.
79
79
  */
80
80
  label: k().default("")
81
- }), ae = R({
81
+ }), ae = C({
82
82
  instruction: k().default(""),
83
- background: P.default({ src: "", alt: "" }),
83
+ background: I.default({ src: "", alt: "" }),
84
84
  /** The shape of the picture, so the regions keep their proportions. */
85
- size: R({
86
- width: D().positive().default(620),
87
- height: D().positive().default(310)
85
+ size: C({
86
+ width: B().positive().default(620),
87
+ height: B().positive().default(310)
88
88
  }).default({ width: 620, height: 310 }),
89
- hotspots: $(se).default([]),
89
+ hotspots: A(se).default([]),
90
90
  /** Shown when the learner picks a spot no region covers. */
91
91
  missFeedback: k().optional(),
92
- evaluation: H.default(B)
92
+ evaluation: $.default(z)
93
93
  }).check((e) => {
94
94
  const i = e.value.hotspots.map((a) => a.id);
95
95
  if (new Set(i).size !== i.length && e.issues.push({
@@ -133,7 +133,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
133
133
  path: ["hotspots"],
134
134
  message: "Every region is correct, so any of them wins. Add regions that are not, to catch the mistakes worth catching."
135
135
  });
136
- }), ge = R({
136
+ }), ge = C({
137
137
  /**
138
138
  * Where the learner chose, and which region that turned out to be.
139
139
  *
@@ -141,12 +141,12 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
141
141
  * nothing, and because "they clicked just left of the keyboard" is a
142
142
  * different conversation from "they got it wrong".
143
143
  */
144
- selection: R({
144
+ selection: C({
145
145
  x: v,
146
146
  y: v,
147
147
  hotspotId: k().optional()
148
148
  }).optional()
149
- }), A = {
149
+ }), L = {
150
150
  en: {
151
151
  instructionLabel: "Question",
152
152
  instructionHint: "Markdown is supported. Say what the learner should find.",
@@ -215,7 +215,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
215
215
  onDraw: s,
216
216
  onMove: u
217
217
  }) => {
218
- const h = (c) => C(A, c, i);
218
+ const h = (c) => R(L, c, i);
219
219
  return /* @__PURE__ */ o.jsx(
220
220
  V,
221
221
  {
@@ -248,7 +248,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
248
248
  readonly: s,
249
249
  onAnswerChange: u
250
250
  }) => {
251
- const h = (l, d) => C(L, l, a, d), c = j.useRef(null), [w, y] = j.useState({ x: 0.5, y: 0.5 }), [m, x] = j.useState(""), t = i?.selection, p = n !== void 0, r = j.useCallback((l, d) => {
251
+ const h = (l, d) => R(D, l, a, d), c = j.useRef(null), [w, y] = j.useState({ x: 0.5, y: 0.5 }), [m, x] = j.useState(""), t = i?.selection, p = n !== void 0, r = j.useCallback((l, d) => {
252
252
  const g = c.current?.getBoundingClientRect();
253
253
  return !g || g.width === 0 || g.height === 0 ? null : {
254
254
  x: Math.min(1, Math.max(0, (l - g.left) / g.width)),
@@ -256,14 +256,14 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
256
256
  };
257
257
  }, []), N = (l) => {
258
258
  if (s) return;
259
- const d = T(e.hotspots, l);
259
+ const d = H(e.hotspots, l);
260
260
  u({ selection: { ...l, hotspotId: d?.id } }), x(
261
261
  h("chose", {
262
262
  x: Math.round(l.x * 100),
263
263
  y: Math.round(l.y * 100)
264
264
  })
265
265
  );
266
- }, E = (l) => l.label || l.id, b = e.hotspots.find(
266
+ }, M = (l) => l.label || l.id, b = e.hotspots.find(
267
267
  (l) => l.id === n?.hotspotId
268
268
  );
269
269
  return /* @__PURE__ */ o.jsxs("div", { className: "bitflow-hotspots", children: [
@@ -307,14 +307,14 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
307
307
  }[l.key];
308
308
  if (!g) return;
309
309
  l.preventDefault();
310
- const M = {
310
+ const E = {
311
311
  x: Math.min(1, Math.max(0, w.x + g[0])),
312
312
  y: Math.min(1, Math.max(0, w.y + g[1]))
313
313
  };
314
- y(M), x(
314
+ y(E), x(
315
315
  h("aiming", {
316
- x: Math.round(M.x * 100),
317
- y: Math.round(M.y * 100)
316
+ x: Math.round(E.x * 100),
317
+ y: Math.round(E.y * 100)
318
318
  })
319
319
  );
320
320
  }
@@ -354,7 +354,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
354
354
  }
355
355
  ),
356
356
  /* @__PURE__ */ o.jsx("p", { className: "bitflow-hint", children: h(s ? "howToReadonly" : "howTo") }),
357
- p && /* @__PURE__ */ o.jsx("p", { className: "bitflow-hotspots-verdict", children: b ? h("landedOn", { region: E(b) }) : h("landedNowhere") }),
357
+ p && /* @__PURE__ */ o.jsx("p", { className: "bitflow-hotspots-verdict", children: b ? h("landedOn", { region: M(b) }) : h("landedNowhere") }),
358
358
  /* @__PURE__ */ o.jsx("div", { className: "bitflow-visually-hidden", role: "status", "aria-live": "polite", children: m })
359
359
  ] });
360
360
  }, he = ({
@@ -392,7 +392,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
392
392
  onChange: n,
393
393
  errors: a
394
394
  }) => {
395
- const s = (t) => C(A, t, i), u = (t) => n({ ...e, ...t }), [h, c] = j.useState(), w = Y(e.hotspots.map((t) => t.id)), y = (t) => {
395
+ const s = (t) => R(L, t, i), u = (t) => n({ ...e, ...t }), [h, c] = j.useState(), w = U(e.hotspots.map((t) => t.id)), y = (t) => {
396
396
  c(t), t && w.open(t);
397
397
  }, m = (t, p) => u({
398
398
  hotspots: e.hotspots.map(
@@ -427,7 +427,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
427
427
  }
428
428
  ),
429
429
  /* @__PURE__ */ o.jsx(
430
- q,
430
+ Y,
431
431
  {
432
432
  value: e.background,
433
433
  locale: i,
@@ -458,14 +458,14 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
458
458
  {
459
459
  className: h === t.id ? "bitflow-rule bitflow-rule-selected" : "bitflow-rule",
460
460
  children: /* @__PURE__ */ o.jsxs(
461
- z,
461
+ F,
462
462
  {
463
463
  summary: t.label || s("unnamedRegion"),
464
464
  aside: s(t.correct ? "isCorrect" : "isDecoy"),
465
465
  ...w.props(t.id),
466
466
  children: [
467
467
  /* @__PURE__ */ o.jsx(
468
- K,
468
+ q,
469
469
  {
470
470
  label: s("regionName"),
471
471
  hint: s("regionNameHint"),
@@ -476,7 +476,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
476
476
  }
477
477
  ),
478
478
  /* @__PURE__ */ o.jsx(
479
- U,
479
+ G,
480
480
  {
481
481
  label: s("regionCorrect"),
482
482
  checked: t.correct,
@@ -484,7 +484,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
484
484
  }
485
485
  ),
486
486
  /* @__PURE__ */ o.jsx(
487
- G,
487
+ K,
488
488
  {
489
489
  label: s("regionShape"),
490
490
  value: t.shape,
@@ -500,10 +500,10 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
500
500
  ["y", "top"],
501
501
  ["width", "width"],
502
502
  ["height", "height"]
503
- ].map(([r, N]) => /* @__PURE__ */ o.jsx(J, { label: s(N), children: (E) => /* @__PURE__ */ o.jsx(
503
+ ].map(([r, N]) => /* @__PURE__ */ o.jsx(J, { label: s(N), children: (M) => /* @__PURE__ */ o.jsx(
504
504
  "input",
505
505
  {
506
- ...E,
506
+ ...M,
507
507
  type: "number",
508
508
  className: "bitflow-input",
509
509
  min: 0,
@@ -569,7 +569,7 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
569
569
  )
570
570
  ] })
571
571
  ] }),
572
- /* @__PURE__ */ o.jsxs(z, { summary: s("advanced"), children: [
572
+ /* @__PURE__ */ o.jsxs(F, { summary: s("advanced"), children: [
573
573
  /* @__PURE__ */ o.jsx(
574
574
  S,
575
575
  {
@@ -589,27 +589,27 @@ const ee = ".bitflow-hotspots{display:flex;flex-direction:column;gap:var(--bitfl
589
589
  )
590
590
  ] })
591
591
  ] });
592
- }, F = "task-find-hotspots";
592
+ }, T = "task-find-hotspots";
593
593
  O({
594
- type: F,
594
+ type: T,
595
595
  kind: "task",
596
596
  schema: ae,
597
597
  evaluate: oe,
598
598
  Task: he,
599
599
  Form: de,
600
600
  info: (e) => ({
601
- name: C(L, "name", e),
602
- description: C(L, "description", e)
601
+ name: R(D, "name", e),
602
+ description: R(D, "description", e)
603
603
  }),
604
604
  defaultData: () => ({
605
605
  instruction: "",
606
606
  background: { src: "", alt: "" },
607
607
  size: { width: 620, height: 310 },
608
608
  hotspots: [],
609
- evaluation: B()
609
+ evaluation: z()
610
610
  })
611
611
  });
612
- _(F);
612
+ _(T);
613
613
  Z("bitflow-styles-task-find-hotspots", ee);
614
614
  export {
615
615
  ge as AnswerSchema,
@@ -618,12 +618,12 @@ export {
618
618
  ie as HotspotCanvas,
619
619
  se as HotspotSchema,
620
620
  le as Picture,
621
- F as TYPE,
621
+ T as TYPE,
622
622
  he as Task,
623
623
  be as centreOf,
624
624
  te as contains,
625
625
  oe as evaluate,
626
- A as formMessages,
627
- T as hotspotAt,
628
- L as messages
626
+ L as formMessages,
627
+ H as hotspotAt,
628
+ D as messages
629
629
  };
@@ -1,27 +1,27 @@
1
- import { L as k, ac as S, ad as M, al as R, P as O, a2 as v, a9 as D, j as l, b as u, a as m, a4 as U, a5 as $, aa as B, s as q } from "./dom-uYx_3K1r.js";
2
- import { v as T, A as w, e as W, E as G, L as K, R as Y } from "./bitLoaders-DIGwTcpd.js";
3
- const I = ".bitflow-highlight-maroon{background:#f6d6d6;color:#4a1010}.bitflow-highlight-orange{background:#ffe0bd;color:#4a2c00}.bitflow-highlight-blue{background:#cfe0f7;color:#10294a}.bitflow-highlight-lavender{background:#e2dbf5;color:#2b1f4a}.bitflow-highlight-yellow{background:#fbf1b8;color:#453c00}.bitflow-highlight-palette{display:flex;flex-wrap:wrap;gap:var(--bitflow-space-xxsmall)}.bitflow-highlight-swatch{display:inline-flex;align-items:center;padding:var(--bitflow-space-xxsmall) var(--bitflow-space-xsmall);min-height:44px;border:var(--bitflow-border-width) solid transparent;border-radius:var(--bitflow-radius-standard);cursor:pointer;font-size:var(--bitflow-font-size-small)}.bitflow-highlight-swatch:has(:checked){border-color:var(--bitflow-color-neutral-900);font-weight:var(--bitflow-font-weight-bold)}.bitflow-highlight-swatch:has(:focus-visible){box-shadow:var(--bitflow-shadow-outline)}.bitflow-highlight-eraser{background:var(--bitflow-color-neutral-100)}.bitflow-highlight-text{white-space:pre-wrap;line-height:var(--bitflow-line-height-relaxed, 1.8);margin:0}.bitflow-highlight-text{cursor:text}.bitflow-highlight-token[role=button]{cursor:pointer;border-radius:var(--bitflow-radius-small);text-decoration:underline dotted var(--bitflow-color-neutral-400);text-underline-offset:3px}.bitflow-highlight-token[role=button]:hover{background:var(--bitflow-color-neutral-100);text-decoration-color:var(--bitflow-color-neutral-900)}.bitflow-highlight-token[role=button]:focus-visible{box-shadow:var(--bitflow-shadow-outline)}@media(pointer:coarse){.bitflow-highlight-text{line-height:2.2}.bitflow-highlight-token[role=button]{padding-block:4px;box-decoration-break:clone;-webkit-box-decoration-break:clone}}.bitflow-highlight-text ::selection{background:var(--bitflow-color-primary-light)}.bitflow-highlight-agreement{margin:0;padding-left:var(--bitflow-space-small);color:var(--bitflow-color-text-muted);font-size:var(--bitflow-font-size-small)}.bitflow-highlight-color-row{display:flex;align-items:center;gap:var(--bitflow-space-xsmall)}.bitflow-highlight-cutoff{display:flex;align-items:center;justify-content:space-between;gap:var(--bitflow-space-xsmall)}.bitflow-highlight-cutoff input{max-width:6em}", f = ["maroon", "orange", "blue", "lavender", "yellow"], j = $(f), z = U(j.nullable()), _ = k({
4
- instruction: v().default(""),
5
- text: v().default(""),
1
+ import { L as v, ac as A, ad as M, al as H, P as O, a2 as k, a9 as U, j as l, b as u, a as m, a4 as D, a5 as B, aa as $, s as q } from "./dom-uYx_3K1r.js";
2
+ import { e as T, g as w, P as W, B as G, U as I, H as K } from "./bitLoaders-CxvZkGrY.js";
3
+ const Y = ".bitflow-highlight-maroon{background:#f6d6d6;color:#4a1010}.bitflow-highlight-orange{background:#ffe0bd;color:#4a2c00}.bitflow-highlight-blue{background:#cfe0f7;color:#10294a}.bitflow-highlight-lavender{background:#e2dbf5;color:#2b1f4a}.bitflow-highlight-yellow{background:#fbf1b8;color:#453c00}.bitflow-highlight-palette{display:flex;flex-wrap:wrap;gap:var(--bitflow-space-xxsmall)}.bitflow-highlight-swatch{display:inline-flex;align-items:center;padding:var(--bitflow-space-xxsmall) var(--bitflow-space-xsmall);min-height:44px;border:var(--bitflow-border-width) solid transparent;border-radius:var(--bitflow-radius-standard);cursor:pointer;font-size:var(--bitflow-font-size-small)}.bitflow-highlight-swatch:has(:checked){border-color:var(--bitflow-color-neutral-900);font-weight:var(--bitflow-font-weight-bold)}.bitflow-highlight-swatch:has(:focus-visible){box-shadow:var(--bitflow-shadow-outline)}.bitflow-highlight-eraser{background:var(--bitflow-color-neutral-100)}.bitflow-highlight-text{white-space:pre-wrap;line-height:var(--bitflow-line-height-relaxed, 1.8);margin:0}.bitflow-highlight-text{cursor:text}.bitflow-highlight-token[role=button]{cursor:pointer;border-radius:var(--bitflow-radius-small);text-decoration:underline dotted var(--bitflow-color-neutral-400);text-underline-offset:3px}.bitflow-highlight-token[role=button]:hover{background:var(--bitflow-color-neutral-100);text-decoration-color:var(--bitflow-color-neutral-900)}.bitflow-highlight-token[role=button]:focus-visible{box-shadow:var(--bitflow-shadow-outline)}@media(pointer:coarse){.bitflow-highlight-text{line-height:2.2}.bitflow-highlight-token[role=button]{padding-block:4px;box-decoration-break:clone;-webkit-box-decoration-break:clone}}.bitflow-highlight-text ::selection{background:var(--bitflow-color-primary-light)}.bitflow-highlight-agreement{margin:0;padding-left:var(--bitflow-space-small);color:var(--bitflow-color-text-muted);font-size:var(--bitflow-font-size-small)}.bitflow-highlight-color-row{display:flex;align-items:center;gap:var(--bitflow-space-xsmall)}.bitflow-highlight-cutoff{display:flex;align-items:center;justify-content:space-between;gap:var(--bitflow-space-xsmall)}.bitflow-highlight-cutoff input{max-width:6em}", f = ["maroon", "orange", "blue", "lavender", "yellow"], j = B(f), P = D(j.nullable()), _ = v({
4
+ instruction: k().default(""),
5
+ text: k().default(""),
6
6
  // `partialRecord`, not `record`: a task uses one or two colours, and a
7
7
  // plain enum-keyed record in zod 4 would demand an entry for all five.
8
- colors: R(
8
+ colors: H(
9
9
  j,
10
- k({
11
- enabled: D().default(!1),
10
+ v({
11
+ enabled: U().default(!1),
12
12
  /** What this colour means in this task, e.g. "cause". */
13
- label: v().default("")
13
+ label: k().default("")
14
14
  })
15
15
  ).default({}),
16
16
  /** The teacher's own highlighting, compared against character by character. */
17
- reference: z.default([]),
17
+ reference: P.default([]),
18
18
  /**
19
19
  * Per colour, the Cohen's kappa a learner must reach for that colour to
20
20
  * count as right. Kappa rather than raw overlap because agreeing by
21
21
  * accident on a mostly-unhighlighted text is easy.
22
22
  */
23
- cutoffs: R(j, O().min(0).max(1)).default({}),
24
- evaluation: S.default(M)
23
+ cutoffs: H(j, O().min(0).max(1)).default({}),
24
+ evaluation: A.default(M)
25
25
  }).check((e) => {
26
26
  e.value.evaluation.mode === "auto" && (f.filter((o) => e.value.colors[o]?.enabled).length === 0 && e.issues.push({
27
27
  code: "custom",
@@ -34,8 +34,8 @@ const I = ".bitflow-highlight-maroon{background:#f6d6d6;color:#4a1010}.bitflow-h
34
34
  path: ["reference"],
35
35
  message: "The reference highlighting does not match the text. Re-mark the text after editing it."
36
36
  }));
37
- }), re = k({
38
- highlights: z.default([])
37
+ }), re = v({
38
+ highlights: P.default([])
39
39
  }), V = ({
40
40
  bothHighlighted: e,
41
41
  bothPlain: o,
@@ -157,7 +157,7 @@ const I = ".bitflow-highlight-maroon{background:#f6d6d6;color:#4a1010}.bitflow-h
157
157
  word: !0
158
158
  }), n = t.index + t[0].length;
159
159
  return n < e.length && o.push({ text: e.slice(n), start: n, end: e.length, word: !1 }), o;
160
- }, H = (e, o, i) => {
160
+ }, R = (e, o, i) => {
161
161
  const n = e[o] ?? null;
162
162
  for (let t = o; t < i; t++)
163
163
  if ((e[t] ?? null) !== n) return null;
@@ -171,7 +171,7 @@ const I = ".bitflow-highlight-maroon{background:#f6d6d6;color:#4a1010}.bitflow-h
171
171
  if (!i) return null;
172
172
  const n = Number(i.dataset.start);
173
173
  return Number.isFinite(n) ? n + o : null;
174
- }, P = ({
174
+ }, z = ({
175
175
  text: e,
176
176
  highlights: o,
177
177
  colors: i,
@@ -179,7 +179,7 @@ const I = ".bitflow-highlight-maroon{background:#f6d6d6;color:#4a1010}.bitflow-h
179
179
  readonly: t,
180
180
  onChange: c
181
181
  }) => {
182
- const s = (r, d) => u(g, r, n, d), a = f.filter((r) => i[r]?.enabled), [h, y] = m.useState(a[0] ?? null), F = m.useMemo(() => J(e), [e]), N = (r) => i[r]?.label || u(g, r, n), x = m.useCallback(
182
+ const s = (r, d) => u(g, r, n, d), a = f.filter((r) => i[r]?.enabled), [h, y] = m.useState(a[0] ?? null), S = m.useMemo(() => J(e), [e]), N = (r) => i[r]?.label || u(g, r, n), x = m.useCallback(
183
183
  (r, d, b) => c(Q(o, e.length, r, d, b)),
184
184
  [o, c, e.length]
185
185
  ), C = m.useCallback(() => {
@@ -191,7 +191,7 @@ const I = ".bitflow-highlight-maroon{background:#f6d6d6;color:#4a1010}.bitflow-h
191
191
  }, [h, x, t]), L = m.useCallback(
192
192
  (r) => {
193
193
  if (t) return;
194
- const d = H(o, r.start, r.end);
194
+ const d = R(o, r.start, r.end);
195
195
  x(r.start, r.end, d === h ? null : h);
196
196
  },
197
197
  [h, x, o, t]
@@ -247,8 +247,8 @@ const I = ".bitflow-highlight-maroon{background:#f6d6d6;color:#4a1010}.bitflow-h
247
247
  className: "bitflow-highlight-text",
248
248
  onMouseUp: C,
249
249
  onKeyUp: C,
250
- children: F.map((r) => {
251
- const d = H(o, r.start, r.end), b = [
250
+ children: S.map((r) => {
251
+ const d = R(o, r.start, r.end), b = [
252
252
  r.word ? "bitflow-highlight-token" : "",
253
253
  d ? `bitflow-highlight-${d}` : ""
254
254
  ].filter(Boolean).join(" ");
@@ -294,9 +294,9 @@ const I = ".bitflow-highlight-maroon{background:#f6d6d6;color:#4a1010}.bitflow-h
294
294
  }) => {
295
295
  const s = i?.detail?.agreement ?? {};
296
296
  return /* @__PURE__ */ l.jsxs("div", { className: "bitflow-stack", children: [
297
- /* @__PURE__ */ l.jsx(K, { markdown: e.instruction }),
297
+ /* @__PURE__ */ l.jsx(I, { markdown: e.instruction }),
298
298
  /* @__PURE__ */ l.jsx(
299
- P,
299
+ z,
300
300
  {
301
301
  text: e.text,
302
302
  highlights: o?.highlights ?? [],
@@ -392,7 +392,7 @@ const I = ".bitflow-highlight-maroon{background:#f6d6d6;color:#4a1010}.bitflow-h
392
392
  /* @__PURE__ */ l.jsx("span", { className: "bitflow-hint", children: t("referenceHint") }),
393
393
  w(n, "reference") && /* @__PURE__ */ l.jsx("span", { className: "bitflow-field-error", role: "alert", children: w(n, "reference") }),
394
394
  /* @__PURE__ */ l.jsx(
395
- P,
395
+ z,
396
396
  {
397
397
  text: e.text,
398
398
  highlights: e.reference,
@@ -437,9 +437,9 @@ const I = ".bitflow-highlight-maroon{background:#f6d6d6;color:#4a1010}.bitflow-h
437
437
  )
438
438
  ] })
439
439
  ] });
440
- }, A = "task-highlighting";
441
- B({
442
- type: A,
440
+ }, F = "task-highlighting";
441
+ $({
442
+ type: F,
443
443
  kind: "task",
444
444
  schema: _,
445
445
  evaluate: Z,
@@ -458,15 +458,15 @@ B({
458
458
  evaluation: M()
459
459
  })
460
460
  });
461
- Y(A);
462
- q("bitflow-styles-task-highlighting", I);
461
+ K(F);
462
+ q("bitflow-styles-task-highlighting", Y);
463
463
  export {
464
464
  re as AnswerSchema,
465
465
  f as COLORS,
466
466
  _ as DataSchema,
467
467
  te as Form,
468
- P as Highlighter,
469
- A as TYPE,
468
+ z as Highlighter,
469
+ F as TYPE,
470
470
  ee as Task,
471
471
  X as agreementPerColor,
472
472
  Z as evaluate,