alexsys-exam-renderer 0.1.4 → 0.1.5

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.
package/dist/index.js CHANGED
@@ -1,49 +1,49 @@
1
1
  import { Fragment as e, useEffect as t, useMemo as n, useRef as r, useState as i } from "react";
2
2
  import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
3
3
  import { DragDropProvider as c, useDraggable as l, useDroppable as u } from "@dnd-kit/react";
4
- import { Apple as d, CheckCircle2 as f, Circle as p, Diamond as m, Eraser as h, Flower2 as g, Heart as _, Hexagon as v, Mic as y, PencilRuler as b, Pentagon as x, RectangleHorizontal as S, RotateCcw as ee, Square as C, Star as w, Sun as T, Triangle as E, VolumeX as D, XCircle as O } from "lucide-react";
5
- import { Arc as k, Circle as A, Group as j, Layer as te, Line as M, Rect as N, Stage as ne, Text as re } from "react-konva";
6
- import { move as P } from "@dnd-kit/helpers";
7
- import { useSortable as F } from "@dnd-kit/react/sortable";
4
+ import { Apple as d, CheckCircle2 as f, Circle as p, Diamond as m, Eraser as h, Flower2 as g, Heart as _, Hexagon as v, Mic as y, PencilRuler as b, Pentagon as x, RectangleHorizontal as S, RotateCcw as C, Square as w, Star as T, Sun as E, Triangle as D, VolumeX as O, XCircle as k } from "lucide-react";
5
+ import { Arc as A, Circle as j, Group as M, Layer as ee, Line as N, Rect as P, Stage as te, Text as F } from "react-konva";
6
+ import { move as I } from "@dnd-kit/helpers";
7
+ import { useSortable as L } from "@dnd-kit/react/sortable";
8
8
  //#region src/exam-session/examPoints.ts
9
- function ie(e) {
9
+ function ne(e) {
10
10
  if (!e) return 0;
11
11
  let t = Number.parseFloat(e.replace(",", "."));
12
12
  return Number.isFinite(t) ? t : 0;
13
13
  }
14
- function I(e) {
14
+ function R(e) {
15
15
  let t = Math.round(e * 100) / 100;
16
16
  return String(t);
17
17
  }
18
- function ae(e) {
19
- return ie(e.maxScore);
20
- }
21
- function oe(e) {
22
- return e.questions.some((e) => se(e.maxScore));
18
+ function re(e) {
19
+ return ne(e.maxScore);
23
20
  }
24
- function L(e) {
25
- return oe(e) ? ce(e.questions.reduce((e, t) => e + ae(t), 0)) : ie(e.points);
21
+ function ie(e) {
22
+ return e.questions.some((e) => oe(e.maxScore));
26
23
  }
27
- function R(e) {
28
- return I(L(e));
24
+ function ae(e) {
25
+ return ie(e) ? se(e.questions.reduce((e, t) => e + re(t), 0)) : ne(e.points);
29
26
  }
30
27
  function z(e) {
28
+ return R(ae(e));
29
+ }
30
+ function B(e) {
31
31
  return {
32
32
  ...e,
33
- points: R(e)
33
+ points: z(e)
34
34
  };
35
35
  }
36
- function se(e) {
36
+ function oe(e) {
37
37
  return typeof e == "string" && e.trim().length > 0;
38
38
  }
39
- function ce(e) {
39
+ function se(e) {
40
40
  return Math.round(e * 100) / 100;
41
41
  }
42
42
  //#endregion
43
43
  //#region src/exam-session/examScoring.ts
44
- var le = 1e3, ue = 600, B = 70;
45
- function de(e, t) {
46
- let n = e.sections.filter((e) => e.isScored !== !1).map((e) => fe(e, t)), r = U(n, (e) => e.correctCount), i = U(n, (e) => e.incorrectCount), a = U(n, (e) => e.unansweredCount), o = i + a, s = U(n, (e) => e.totalUnits), c = W(U(n, (e) => e.maxScore)), l = W(U(n, (e) => e.score));
44
+ var ce = 1e3, le = 600, V = 70;
45
+ function ue(e, t) {
46
+ let n = e.sections.filter((e) => e.isScored !== !1).map((e) => de(e, t)), r = W(n, (e) => e.correctCount), i = W(n, (e) => e.incorrectCount), a = W(n, (e) => e.unansweredCount), o = i + a, s = W(n, (e) => e.totalUnits), c = G(W(n, (e) => e.maxScore)), l = G(W(n, (e) => e.score));
47
47
  return {
48
48
  attentionWarningCount: 0,
49
49
  correctCount: r,
@@ -51,7 +51,7 @@ function de(e, t) {
51
51
  incorrectCount: i,
52
52
  maxScore: c,
53
53
  notCorrectCount: o,
54
- percentage: c > 0 ? W(l / c * 100) : 0,
54
+ percentage: c > 0 ? G(l / c * 100) : 0,
55
55
  score: l,
56
56
  sections: n,
57
57
  subject: e.subject,
@@ -60,16 +60,16 @@ function de(e, t) {
60
60
  unansweredCount: a
61
61
  };
62
62
  }
63
- function fe(e, t) {
64
- let n = oe(e), r = L(e), i = e.questions.map((e) => ({
65
- maxScore: n ? ae(e) : 0,
66
- units: pe(e, t)
67
- })), a = !n && U(i, (e) => e.units.length) > 0 ? r / U(i, (e) => e.units.length) : 0, o = i.flatMap((t) => {
63
+ function de(e, t) {
64
+ let n = ie(e), r = ae(e), i = e.questions.map((e) => ({
65
+ maxScore: n ? re(e) : 0,
66
+ units: fe(e, t)
67
+ })), a = !n && W(i, (e) => e.units.length) > 0 ? r / W(i, (e) => e.units.length) : 0, o = i.flatMap((t) => {
68
68
  let r = n ? t.units.length > 0 ? t.maxScore / t.units.length : 0 : a;
69
69
  return t.units.map((t) => ({
70
70
  ...t,
71
- maxScore: W(r),
72
- score: t.status === "correct" ? W(r) : 0,
71
+ maxScore: G(r),
72
+ score: t.status === "correct" ? G(r) : 0,
73
73
  sectionId: e.id
74
74
  }));
75
75
  }), s = Ae(o, "correct"), c = Ae(o, "incorrect"), l = Ae(o, "unanswered"), u = c + l;
@@ -80,7 +80,7 @@ function fe(e, t) {
80
80
  incorrectCount: c,
81
81
  maxScore: r,
82
82
  notCorrectCount: u,
83
- score: W(U(o, (e) => e.score)),
83
+ score: G(W(o, (e) => e.score)),
84
84
  title: e.title,
85
85
  tone: e.tone,
86
86
  totalUnits: o.length,
@@ -88,52 +88,56 @@ function fe(e, t) {
88
88
  units: o
89
89
  };
90
90
  }
91
- function pe(e, t) {
91
+ function fe(e, t) {
92
92
  switch (e.type) {
93
93
  case "inline-inputs":
94
94
  case "equation-inputs": return e.items.flatMap((n) => {
95
95
  if (n.answers?.length) return n.answers.flatMap((r) => {
96
96
  if (!r.correctAnswer) return [];
97
97
  let i = `${e.id}:${n.id}:${r.id}`;
98
- return [V(i, e.id, r.before, r.correctAnswer, t[i])];
98
+ return [H(i, e.id, r.before, r.correctAnswer, t[i])];
99
99
  });
100
100
  if (!n.correctAnswer) return [];
101
101
  let r = `${e.id}:${n.id}`;
102
- return [V(r, e.id, n.before, n.correctAnswer, t[r])];
102
+ return [H(r, e.id, n.before, n.correctAnswer, t[r])];
103
103
  });
104
- case "number-line": return [V(e.id, e.id, e.expression, e.correctAnswer, t[e.id])];
104
+ case "number-line": return [H(e.id, e.id, e.expression, e.correctAnswer, t[e.id])];
105
+ case "operation-solving": return [H(e.id, e.id, me(e), e.correctAnswer, t[e.id])];
105
106
  case "visual-choice": return he(e.id, e.id, e.grading.pairs, t[e.id]);
106
107
  case "length-estimation": return ge(e, t);
107
108
  case "shape-choice": return he(e.id, e.id, e.grading.pairs, t[e.id]);
108
109
  case "drag-match": return he(e.id, e.id, e.grading?.pairs, t[e.id]);
109
110
  case "drawing-grid": return [xe(e, t[e.id])];
110
111
  case "table-response": return ve(e, t[e.id]);
111
- case "text-input": return e.correctAnswer ? [V(e.id, e.id, e.prompt, e.correctAnswer, t[e.id])] : [];
112
+ case "text-input": return e.correctAnswer ? [H(e.id, e.id, e.prompt, e.correctAnswer, t[e.id])] : [];
112
113
  case "word-problem": return e.parts.flatMap((n) => {
113
114
  let r = `${e.id}:${n.id}`;
114
- return n.type === "coin-table" ? ye(e.id, n, t[r]) : n.correctAnswer ? [V(r, e.id, n.prompt, n.correctAnswer, t[r])] : [];
115
+ return n.type === "coin-table" ? ye(e.id, n, t[r]) : n.correctAnswer ? [H(r, e.id, n.prompt, n.correctAnswer, t[r])] : [];
115
116
  });
116
117
  case "sortable-answer": return [];
117
118
  case "label-placement": return be(e.id, e.grading?.targetsByLabelId, t[e.id]);
118
- case "audio-recording": return [me(e, t[e.id])];
119
+ case "audio-recording": return [pe(e, t[e.id])];
119
120
  }
120
121
  }
121
- function me(e, t) {
122
- return t?.kind === "audio-recording" ? H(e.id, e.id, e.expectedAnswer, t.evaluation.isCorrect ? "correct" : "incorrect") : H(e.id, e.id, e.expectedAnswer, "unanswered");
122
+ function pe(e, t) {
123
+ return t?.kind === "audio-recording" ? U(e.id, e.id, e.expectedAnswer, t.evaluation.isCorrect ? "correct" : "incorrect") : U(e.id, e.id, e.expectedAnswer, "unanswered");
124
+ }
125
+ function me(e) {
126
+ return `${e.leftOperand} ${e.operator} ${e.rightOperand} =`;
123
127
  }
124
- function V(e, t, n, r, i) {
125
- return r ? i?.kind === "handwritten-number" ? i.strokes.length === 0 ? H(e, t, n, "unanswered") : H(e, t, n, i.recognizedValue && Oe(i.recognizedValue, r) ? "correct" : "incorrect") : i?.kind !== "text" || ke(i.value) === "" ? H(e, t, n, "unanswered") : H(e, t, n, Oe(i.value, r) ? "correct" : "incorrect") : H(e, t, n, "incorrect");
128
+ function H(e, t, n, r, i) {
129
+ return r ? i?.kind === "handwritten-number" ? i.strokes.length === 0 ? U(e, t, n, "unanswered") : U(e, t, n, i.recognizedValue && Oe(i.recognizedValue, r) ? "correct" : "incorrect") : i?.kind !== "text" || ke(i.value) === "" ? U(e, t, n, "unanswered") : U(e, t, n, Oe(i.value, r) ? "correct" : "incorrect") : U(e, t, n, "incorrect");
126
130
  }
127
131
  function he(e, t, n, r) {
128
132
  return n ? Object.entries(n).map(([n, i]) => {
129
133
  let a = r?.kind === "matches" ? r.pairs[n] : void 0, o = a ? a === i ? "correct" : "incorrect" : "unanswered";
130
- return H(`${e}:${n}`, t, n, o);
134
+ return U(`${e}:${n}`, t, n, o);
131
135
  }) : [];
132
136
  }
133
137
  function ge(e, t) {
134
138
  let n = e.items.map((n) => {
135
139
  let r = `${e.id}:squares:${n.id}`;
136
- return V(r, e.id, n.label, n.squareLength.toString(), t[r]);
140
+ return H(r, e.id, n.label, n.squareLength.toString(), t[r]);
137
141
  }), r = e.items.flatMap((n) => {
138
142
  if (!n.correctColorId) return [];
139
143
  let r = `${e.id}:color:${n.id}`;
@@ -142,33 +146,33 @@ function ge(e, t) {
142
146
  return n.concat(r);
143
147
  }
144
148
  function _e(e, t, n, r, i) {
145
- return i?.kind !== "choice" || !i.choiceId ? H(e, t, n, "unanswered") : H(e, t, n, i.choiceId === r ? "correct" : "incorrect");
149
+ return i?.kind !== "choice" || !i.choiceId ? U(e, t, n, "unanswered") : U(e, t, n, i.choiceId === r ? "correct" : "incorrect");
146
150
  }
147
151
  function ve(e, t) {
148
152
  return e.columns.flatMap((n) => {
149
153
  if (typeof n.correctCount != "number") return [];
150
154
  let r = t?.kind === "coin-table" ? t.counts[n.id] : void 0, i = r === void 0 ? "unanswered" : r === n.correctCount ? "correct" : "incorrect";
151
- return H(`${e.id}:${n.id}`, e.id, n.title, i);
155
+ return U(`${e.id}:${n.id}`, e.id, n.title, i);
152
156
  });
153
157
  }
154
158
  function ye(e, t, n) {
155
159
  return t.columns.flatMap((r) => {
156
160
  if (typeof r.correctCount != "number") return [];
157
161
  let i = n?.kind === "coin-table" ? n.counts[r.id] : void 0, a = i === void 0 ? "unanswered" : i === r.correctCount ? "correct" : "incorrect";
158
- return H(`${e}:${t.id}:${r.id}`, e, r.title, a);
162
+ return U(`${e}:${t.id}:${r.id}`, e, r.title, a);
159
163
  });
160
164
  }
161
165
  function be(e, t, n) {
162
166
  return t ? Object.entries(t).map(([t, r]) => {
163
167
  let i = n?.kind === "placements" ? n.placements[t]?.targetId : void 0, a = i ? i === r ? "correct" : "incorrect" : "unanswered";
164
- return H(`${e}:${t}`, e, t, a);
168
+ return U(`${e}:${t}`, e, t, a);
165
169
  }) : [];
166
170
  }
167
171
  function xe(e, t) {
168
172
  let n = e.grading.expectedSegments, r = t?.kind === "drawing" && ((t.elements?.length ?? 0) > 0 || (t.strokes?.length ?? 0) > 0);
169
- if (t?.kind !== "drawing" || !r) return H(e.id, e.id, e.prompt, "unanswered");
173
+ if (t?.kind !== "drawing" || !r) return U(e.id, e.id, e.prompt, "unanswered");
170
174
  let i = n.every((n) => Se(t, e, n));
171
- return H(e.id, e.id, e.prompt, i ? "correct" : "incorrect");
175
+ return U(e.id, e.id, e.prompt, i ? "correct" : "incorrect");
172
176
  }
173
177
  function Se(e, t, n) {
174
178
  let r = Ee(t, n.from), i = Ee(t, n.to);
@@ -209,11 +213,11 @@ function Ce(e) {
209
213
  return t.concat(n);
210
214
  }
211
215
  function we(e, t, n) {
212
- let r = je(e.start, t) <= B && je(e.end, n) <= B, i = je(e.start, n) <= B && je(e.end, t) <= B;
213
- return !r && !i ? !1 : Te(e.points, t, n, B);
216
+ let r = K(e.start, t) <= V && K(e.end, n) <= V, i = K(e.start, n) <= V && K(e.end, t) <= V;
217
+ return !r && !i ? !1 : Te(e.points, t, n, V);
214
218
  }
215
219
  function Te(e, t, n, r) {
216
- for (let i = 0; i < e.length - 1; i += 4) if (Me({
220
+ for (let i = 0; i < e.length - 1; i += 4) if (je({
217
221
  x: e[i],
218
222
  y: e[i + 1]
219
223
  }, t, n) > r) return !1;
@@ -228,11 +232,11 @@ function Ee(e, t) {
228
232
  }
229
233
  function De(e, t) {
230
234
  return {
231
- x: e / 100 * le,
232
- y: t / 100 * ue
235
+ x: e / 100 * ce,
236
+ y: t / 100 * le
233
237
  };
234
238
  }
235
- function H(e, t, n, r) {
239
+ function U(e, t, n, r) {
236
240
  return {
237
241
  id: e,
238
242
  label: n,
@@ -250,31 +254,31 @@ function ke(e) {
250
254
  function Ae(e, t) {
251
255
  return e.filter((e) => e.status === t).length;
252
256
  }
253
- function U(e, t) {
257
+ function W(e, t) {
254
258
  return e.reduce((e, n) => e + t(n), 0);
255
259
  }
256
- function W(e) {
260
+ function G(e) {
257
261
  return Math.round(e * 100) / 100;
258
262
  }
259
- function je(e, t) {
263
+ function K(e, t) {
260
264
  return Math.hypot(e.x - t.x, e.y - t.y);
261
265
  }
262
- function Me(e, t, n) {
266
+ function je(e, t, n) {
263
267
  let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
264
- if (a === 0) return je(e, t);
268
+ if (a === 0) return K(e, t);
265
269
  let o = Math.max(0, Math.min(1, ((e.x - t.x) * r + (e.y - t.y) * i) / a));
266
- return je(e, {
270
+ return K(e, {
267
271
  x: t.x + o * r,
268
272
  y: t.y + o * i
269
273
  });
270
274
  }
271
275
  //#endregion
272
276
  //#region src/exam-session/interactions/CoinTableResponse.tsx
273
- var Ne = 0, Pe = 12;
274
- function Fe({ columns: e, value: t, onChange: n }) {
277
+ var Me = 0, Ne = 12;
278
+ function Pe({ columns: e, value: t, onChange: n }) {
275
279
  let r = t?.counts ?? {};
276
280
  function i(e, t) {
277
- let i = e.maxCoins ?? Pe, a = Math.max(Ne, Math.min(i, t));
281
+ let i = e.maxCoins ?? Ne, a = Math.max(Me, Math.min(i, t));
278
282
  n({
279
283
  kind: "coin-table",
280
284
  counts: {
@@ -286,7 +290,7 @@ function Fe({ columns: e, value: t, onChange: n }) {
286
290
  return /* @__PURE__ */ o("div", {
287
291
  className: "response-table",
288
292
  children: e.map((e) => {
289
- let t = r[e.id] ?? 0, n = e.maxCoins ?? Pe;
293
+ let t = r[e.id] ?? 0, n = e.maxCoins ?? Ne;
290
294
  return /* @__PURE__ */ s("div", {
291
295
  className: "response-column",
292
296
  children: [
@@ -311,7 +315,7 @@ function Fe({ columns: e, value: t, onChange: n }) {
311
315
  children: "إِضافَةٌ"
312
316
  }), /* @__PURE__ */ o("button", {
313
317
  className: "coin-action coin-action--secondary",
314
- disabled: t <= Ne,
318
+ disabled: t <= Me,
315
319
  onClick: () => i(e, t - 1),
316
320
  type: "button",
317
321
  children: "حَذْفٌ"
@@ -338,17 +342,17 @@ function Fe({ columns: e, value: t, onChange: n }) {
338
342
  }
339
343
  //#endregion
340
344
  //#region src/renderer/shapeCatalog.tsx
341
- var Ie = {
345
+ var Fe = {
342
346
  circle: p,
343
347
  diamond: m,
344
348
  heart: _,
345
349
  hexagon: v,
346
350
  pentagon: x,
347
351
  rectangle: S,
348
- square: C,
349
- star: w,
350
- triangle: E
351
- }, Le = {
352
+ square: w,
353
+ star: T,
354
+ triangle: D
355
+ }, Ie = {
352
356
  circle: "Cercle",
353
357
  diamond: "Losange",
354
358
  heart: "Coeur",
@@ -358,15 +362,15 @@ var Ie = {
358
362
  square: "Carre",
359
363
  star: "Etoile",
360
364
  triangle: "Triangle"
361
- }, Re = Object.keys(Le).map((e) => ({
362
- label: Le[e],
365
+ }, Le = Object.keys(Ie).map((e) => ({
366
+ label: Ie[e],
363
367
  value: e
364
368
  }));
365
- function ze(e) {
366
- return Le[e];
369
+ function Re(e) {
370
+ return Ie[e];
367
371
  }
368
- function Be({ shapeId: e, title: t }) {
369
- let n = Ie[e];
372
+ function ze({ shapeId: e, title: t }) {
373
+ let n = Fe[e];
370
374
  return /* @__PURE__ */ o("span", {
371
375
  "aria-label": t,
372
376
  role: t ? "img" : void 0,
@@ -376,7 +380,7 @@ function Be({ shapeId: e, title: t }) {
376
380
  }
377
381
  //#endregion
378
382
  //#region src/exam-session/interactions/DragMatch.tsx
379
- function Ve({ items: e, targets: t, value: n, onChange: r }) {
383
+ function Be({ items: e, targets: t, value: n, onChange: r }) {
380
384
  let i = n?.pairs ?? {}, a = new Set(Object.values(i));
381
385
  return /* @__PURE__ */ o(c, {
382
386
  onDragEnd: (e) => {
@@ -394,10 +398,10 @@ function Ve({ items: e, targets: t, value: n, onChange: r }) {
394
398
  className: "drag-match",
395
399
  children: [/* @__PURE__ */ o("div", {
396
400
  className: "drag-match__items",
397
- children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ o(He, { item: e }, e.id))
401
+ children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ o(Ve, { item: e }, e.id))
398
402
  }), /* @__PURE__ */ o("div", {
399
403
  className: "drag-match__targets",
400
- children: t.map((t) => /* @__PURE__ */ o(Ue, {
404
+ children: t.map((t) => /* @__PURE__ */ o(He, {
401
405
  assignedItem: e.find((e) => e.id === i[t.id]),
402
406
  target: t
403
407
  }, t.id))
@@ -405,7 +409,7 @@ function Ve({ items: e, targets: t, value: n, onChange: r }) {
405
409
  })
406
410
  });
407
411
  }
408
- function He({ item: e }) {
412
+ function Ve({ item: e }) {
409
413
  let { ref: t, isDragging: n } = l({ id: e.id });
410
414
  return /* @__PURE__ */ o("button", {
411
415
  className: n ? "drag-pill drag-pill--dragging" : "drag-pill",
@@ -414,74 +418,74 @@ function He({ item: e }) {
414
418
  children: e.label
415
419
  });
416
420
  }
417
- function Ue({ assignedItem: e, target: t }) {
421
+ function He({ assignedItem: e, target: t }) {
418
422
  let { ref: n, isDropTarget: r } = u({ id: t.id });
419
423
  return /* @__PURE__ */ s("div", {
420
424
  className: r ? "drop-slot drop-slot--active" : "drop-slot",
421
425
  ref: n,
422
426
  children: [/* @__PURE__ */ o("span", {
423
427
  className: t.shapeId ? "drop-slot__visual drop-slot__visual--shape" : "drop-slot__visual",
424
- children: t.shapeId ? /* @__PURE__ */ o(Be, {
428
+ children: t.shapeId ? /* @__PURE__ */ o(ze, {
425
429
  shapeId: t.shapeId,
426
430
  title: t.label
427
431
  }) : t.label
428
- }), e ? /* @__PURE__ */ o(He, { item: e }) : /* @__PURE__ */ o("span", { children: "ضع الإجابة هنا" })]
432
+ }), e ? /* @__PURE__ */ o(Ve, { item: e }) : /* @__PURE__ */ o("span", { children: "ضع الإجابة هنا" })]
429
433
  });
430
434
  }
431
435
  //#endregion
432
436
  //#region src/exam-session/interactions/HandwrittenNumberAnswer.tsx
433
- var We = 132, Ge = 88, Ke = 650;
434
- function G({ ariaLabel: e, onChange: n, onClear: a, recognizer: c, value: l }) {
435
- let u = l?.strokes ?? [], d = u.length === 0, f = r(n), [p, m] = i(!1), [g, _] = i(!1), v = !!c?.isAvailable(), y = c?.getStatus?.() ?? (v ? "ready" : "unavailable"), b = y === "preparing" || y === "error", x = y === "preparing" ? "preparing-model" : y === "error" ? "model-error" : d || p ? "idle" : l?.recognizedValue === void 0 ? !v || y === "unavailable" ? "unavailable" : g ? "unrecognized" : "recognizing" : "recognized";
437
+ var Ue = 132, We = 88, Ge = 650;
438
+ function q({ ariaLabel: e, canvasWidth: n = Ue, onChange: a, onClear: c, recognizer: l, value: u }) {
439
+ let d = u?.strokes ?? [], f = d.length === 0, p = r(a), [m, g] = i(!1), [_, v] = i(!1), y = !!l?.isAvailable(), b = l?.getStatus?.() ?? (y ? "ready" : "unavailable"), x = b === "preparing" || b === "error", S = b === "preparing" ? "preparing-model" : b === "error" ? "model-error" : f || m ? "idle" : u?.recognizedValue === void 0 ? !y || b === "unavailable" ? "unavailable" : _ ? "unrecognized" : "recognizing" : "recognized";
436
440
  t(() => {
437
- f.current = n;
438
- }, [n]), t(() => {
439
- if (d || p || !l || !c || l.recognizedValue !== void 0 || !v || y !== "ready") return;
441
+ p.current = a;
442
+ }, [a]), t(() => {
443
+ if (f || m || !u || !l || u.recognizedValue !== void 0 || !y || b !== "ready") return;
440
444
  let e = !1, t = window.setTimeout(() => {
441
- c.recognize(l).then((t) => {
445
+ l.recognize(u).then((t) => {
442
446
  if (!e) {
443
447
  if (t.recognizedValue === void 0) {
444
- _(!0);
448
+ v(!0);
445
449
  return;
446
450
  }
447
- f.current(t);
451
+ p.current(t);
448
452
  }
449
453
  }).catch(() => {
450
- e || _(!0);
454
+ e || v(!0);
451
455
  });
452
- }, Ke);
456
+ }, Ge);
453
457
  return () => {
454
458
  e = !0, window.clearTimeout(t);
455
459
  };
456
460
  }, [
457
- p,
458
- d,
461
+ m,
462
+ f,
463
+ b,
459
464
  y,
460
- v,
461
- c,
462
- l
465
+ l,
466
+ u
463
467
  ]);
464
- function S(e) {
465
- _(!1), n({
466
- canvasHeight: Ge,
467
- canvasWidth: We,
468
+ function C(e) {
469
+ v(!1), a({
470
+ canvasHeight: We,
471
+ canvasWidth: n,
468
472
  kind: "handwritten-number",
469
473
  strokes: e
470
474
  });
471
475
  }
472
- function ee(e) {
473
- if (b) return;
476
+ function w(e) {
477
+ if (x) return;
474
478
  let t = e.target.getStage()?.getPointerPosition();
475
- t && (e.evt.preventDefault(), m(!0), S([...u, {
479
+ t && (e.evt.preventDefault(), g(!0), C([...d, {
476
480
  id: `stroke-${Date.now()}-${Math.round(t.x)}-${Math.round(t.y)}`,
477
481
  points: [t.x, t.y],
478
482
  timestamps: [Date.now()]
479
483
  }]));
480
484
  }
481
- function C(e) {
482
- if (b || d || !e.evt.buttons && e.evt.pointerType === "mouse") return;
485
+ function T(e) {
486
+ if (x || f || !e.evt.buttons && e.evt.pointerType === "mouse") return;
483
487
  let t = e.target.getStage()?.getPointerPosition();
484
- t && (e.evt.preventDefault(), S(u.map((e, n) => n === u.length - 1 ? {
488
+ t && (e.evt.preventDefault(), C(d.map((e, n) => n === d.length - 1 ? {
485
489
  ...e,
486
490
  points: [
487
491
  ...e.points,
@@ -491,66 +495,66 @@ function G({ ariaLabel: e, onChange: n, onClear: a, recognizer: c, value: l }) {
491
495
  timestamps: [...e.timestamps ?? [], Date.now()]
492
496
  } : e)));
493
497
  }
494
- function w(e) {
495
- b || (e.evt.preventDefault(), m(!1));
498
+ function E(e) {
499
+ x || (e.evt.preventDefault(), g(!1));
496
500
  }
497
- function T() {
498
- m(!1), S([]), a?.();
501
+ function D() {
502
+ g(!1), C([]), c?.();
499
503
  }
500
504
  return /* @__PURE__ */ s("div", {
501
- "aria-disabled": b,
505
+ "aria-disabled": x,
502
506
  "aria-label": e,
503
507
  className: "handwritten-number-answer",
504
- "data-model-state": y,
508
+ "data-model-state": b,
505
509
  children: [
506
- /* @__PURE__ */ s(ne, {
510
+ /* @__PURE__ */ s(te, {
507
511
  className: "handwritten-number-stage",
508
- height: Ge,
509
- onPointerCancel: w,
510
- onPointerDown: ee,
511
- onPointerMove: C,
512
- onPointerUp: w,
512
+ height: We,
513
+ onPointerCancel: E,
514
+ onPointerDown: w,
515
+ onPointerMove: T,
516
+ onPointerUp: E,
513
517
  role: "img",
514
- width: We,
515
- children: [/* @__PURE__ */ s(te, {
518
+ width: n,
519
+ children: [/* @__PURE__ */ s(ee, {
516
520
  listening: !1,
517
521
  children: [
518
- /* @__PURE__ */ o(N, {
522
+ /* @__PURE__ */ o(P, {
519
523
  cornerRadius: 14,
520
524
  fill: "#fff",
521
- height: Ge,
525
+ height: We,
522
526
  stroke: "#cfe3d9",
523
527
  strokeWidth: 2,
524
- width: We,
528
+ width: n,
525
529
  x: 0,
526
530
  y: 0
527
531
  }),
528
- /* @__PURE__ */ o(M, {
532
+ /* @__PURE__ */ o(N, {
529
533
  dash: [6, 8],
530
534
  points: [
531
535
  16,
532
- Ge - 18,
533
- We - 16,
534
- Ge - 18
536
+ We - 18,
537
+ n - 16,
538
+ We - 18
535
539
  ],
536
540
  stroke: "#dbe9e2",
537
541
  strokeWidth: 2
538
542
  }),
539
- d ? /* @__PURE__ */ o(re, {
543
+ f ? /* @__PURE__ */ o(F, {
540
544
  align: "center",
541
545
  fill: "#9aaca3",
542
546
  fontFamily: "Arial, sans-serif",
543
547
  fontSize: 15,
544
548
  fontStyle: "bold",
545
- height: Ge,
549
+ height: We,
546
550
  text: "ارسم هنا",
547
551
  verticalAlign: "middle",
548
- width: We,
552
+ width: n,
549
553
  x: 0,
550
554
  y: 0
551
555
  }) : null
552
556
  ]
553
- }), /* @__PURE__ */ o(te, { children: u.map((e) => /* @__PURE__ */ o(M, {
557
+ }), /* @__PURE__ */ o(ee, { children: d.map((e) => /* @__PURE__ */ o(N, {
554
558
  globalCompositeOperation: "source-over",
555
559
  lineCap: "round",
556
560
  lineJoin: "round",
@@ -563,21 +567,21 @@ function G({ ariaLabel: e, onChange: n, onClear: a, recognizer: c, value: l }) {
563
567
  /* @__PURE__ */ o("button", {
564
568
  "aria-label": "مسح الجواب المرسوم",
565
569
  className: "handwritten-number-clear",
566
- disabled: d || b,
567
- onClick: T,
570
+ disabled: f || x,
571
+ onClick: D,
568
572
  type: "button",
569
573
  children: /* @__PURE__ */ o(h, { "aria-hidden": "true" })
570
574
  }),
571
- x !== "idle" && x !== "unavailable" ? /* @__PURE__ */ o("span", {
575
+ S !== "idle" && S !== "unavailable" ? /* @__PURE__ */ o("span", {
572
576
  "aria-live": "polite",
573
577
  className: "handwritten-number-status",
574
- "data-state": x,
575
- children: qe(x, l?.recognizedValue)
578
+ "data-state": S,
579
+ children: Ke(S, u?.recognizedValue)
576
580
  }) : null
577
581
  ]
578
582
  });
579
583
  }
580
- function qe(e, t) {
584
+ function Ke(e, t) {
581
585
  switch (e) {
582
586
  case "recognizing": return "جارٍ التعرّف على الرقم…";
583
587
  case "recognized": return `تمّ التعرّف: ${t ?? ""}`;
@@ -590,7 +594,7 @@ function qe(e, t) {
590
594
  }
591
595
  //#endregion
592
596
  //#region src/exam-session/interactions/ColorPenPicker.tsx
593
- function Je({ ariaLabel: e, className: t = "", colors: n, disabled: r = !1, onChange: i, selectedColorId: a }) {
597
+ function qe({ ariaLabel: e, className: t = "", colors: n, disabled: r = !1, onChange: i, selectedColorId: a }) {
594
598
  return /* @__PURE__ */ o("div", {
595
599
  "aria-label": e,
596
600
  className: ["color-pen-picker", t].filter(Boolean).join(" "),
@@ -614,7 +618,7 @@ function Je({ ariaLabel: e, className: t = "", colors: n, disabled: r = !1, onCh
614
618
  }
615
619
  //#endregion
616
620
  //#region src/exam-session/interactions/geometryColors.ts
617
- var K = [
621
+ var Je = [
618
622
  {
619
623
  id: "green",
620
624
  label: "أَخْضَرُ",
@@ -645,18 +649,18 @@ function Xe(e, t) {
645
649
  return t ? e.find((e) => e.id === t || e.value === t)?.id ?? e[0]?.id ?? "green" : e[0]?.id ?? "green";
646
650
  }
647
651
  function Ze(e, t) {
648
- return e.find((e) => e.id === t)?.value ?? e[0]?.value ?? K[0].value;
652
+ return e.find((e) => e.id === t)?.value ?? e[0]?.value ?? Je[0].value;
649
653
  }
650
654
  function Qe(e) {
651
655
  return e.map((e) => ({
652
656
  id: e.id,
653
657
  label: e.label,
654
- value: Ye[e.id] ?? K[0].value
658
+ value: Ye[e.id] ?? Je[0].value
655
659
  }));
656
660
  }
657
661
  //#endregion
658
662
  //#region src/exam-session/interactions/GeometryCanvas.tsx
659
- var $e = 1e3, et = 600, q = 30, tt = 240, nt = 12, rt = K[0].value, J = "#0a8f55", it = [
663
+ var $e = 1e3, et = 600, J = 30, tt = 240, nt = 12, rt = Je[0].value, Y = "#0a8f55", it = [
660
664
  {
661
665
  id: "pen",
662
666
  icon: "✎",
@@ -692,34 +696,34 @@ var $e = 1e3, et = 600, q = 30, tt = 240, nt = 12, rt = K[0].value, J = "#0a8f55
692
696
  "protractor",
693
697
  "compass"
694
698
  ]);
695
- function ot({ actionLabel: e, canvasHeight: t = et, canvasWidth: n = $e, className: a = "", colorOptions: c = K, defaultColor: l, disabled: u = !1, minStageWidth: d = tt, onChange: f, points: p = [], showColorPalette: m = !0, value: h, variant: g = "question" }) {
696
- let _ = c.length > 0 ? c : K, [v, y] = i(null), [b, x] = i([]), [S, ee] = i(() => Xe(_, l ?? "black")), [C, w] = i(() => gt(h)), [T, E] = i(() => h?.guides ?? ht(n, t)), [D, O] = i(null), [k, A] = i({
699
+ function ot({ actionLabel: e, canvasHeight: t = et, canvasWidth: n = $e, className: a = "", colorOptions: c = Je, defaultColor: l, disabled: u = !1, minStageWidth: d = tt, onChange: f, points: p = [], showColorPalette: m = !0, value: h, variant: g = "question" }) {
700
+ let _ = c.length > 0 ? c : Je, [v, y] = i(null), [b, x] = i([]), [S, C] = i(() => Xe(_, l ?? "black")), [w, T] = i(() => gt(h)), [E, D] = i(() => h?.guides ?? ht(n, t)), [O, k] = i(null), [A, j] = i({
697
701
  height: t,
698
702
  scale: 1,
699
703
  width: n
700
- }), [j, M] = i({
704
+ }), [M, N] = i({
701
705
  canRedo: !1,
702
706
  canUndo: !1
703
- }), re = r(null), P = r([Y(C)]), F = r(0), ie = r(0), I = r(null);
704
- st(re, n, t, d, A);
705
- let ae = vt(p, n, t), oe = [
707
+ }), F = r(null), I = r([vt(w)]), L = r(0), ne = r(0), R = r(null);
708
+ st(F, n, t, d, j);
709
+ let re = yt(p, n, t), ie = [
706
710
  "geometry-canvas",
707
711
  `geometry-canvas--${g}`,
708
712
  a
709
- ].filter(Boolean).join(" "), L = _.some((e) => e.id === S) ? S : Xe(_, "black"), R = Ze(_, L), z = xt(v);
710
- function se(e) {
711
- return at.has(e) ? !z && b.includes(e) : v === e || b.includes(e);
713
+ ].filter(Boolean).join(" "), ae = _.some((e) => e.id === S) ? S : Xe(_, "black"), z = Ze(_, ae), B = St(v);
714
+ function oe(e) {
715
+ return at.has(e) ? !B && b.includes(e) : v === e || b.includes(e);
712
716
  }
713
- function ce(e) {
717
+ function se(e) {
714
718
  x((t) => t.includes(e) ? t.filter((t) => t !== e) : t.concat(e));
715
719
  }
716
- function le(e) {
720
+ function ce(e) {
717
721
  if (e === "ruler" || e === "protractor") {
718
- if (z) {
722
+ if (B) {
719
723
  y(null), x((t) => t.includes(e) ? t : t.concat(e));
720
724
  return;
721
725
  }
722
- ce(e);
726
+ se(e);
723
727
  return;
724
728
  }
725
729
  if (e === "compass") {
@@ -732,65 +736,65 @@ function ot({ actionLabel: e, canvasHeight: t = et, canvasWidth: n = $e, classNa
732
736
  }
733
737
  y(e);
734
738
  }
735
- function ue(e) {
736
- return ie.current += 1, `${e}-${Date.now()}-${ie.current}`;
739
+ function le(e) {
740
+ return ne.current += 1, `${e}-${Date.now()}-${ne.current}`;
737
741
  }
738
- function B(e, t = T) {
742
+ function V(e, t = E) {
739
743
  f({
740
- elements: Y(e),
744
+ elements: vt(e),
741
745
  guides: t,
742
746
  kind: "drawing",
743
747
  strokes: _t(e)
744
748
  });
745
749
  }
746
- function de() {
747
- M({
748
- canRedo: F.current < P.current.length - 1,
749
- canUndo: F.current > 0
750
+ function ue() {
751
+ N({
752
+ canRedo: L.current < I.current.length - 1,
753
+ canUndo: L.current > 0
750
754
  });
751
755
  }
752
- function fe(e, t = T) {
753
- let n = Y(e), r = P.current.slice(0, F.current + 1);
754
- r.push(n), P.current = r, F.current = r.length - 1, w(n), B(n, t), de();
756
+ function de(e, t = E) {
757
+ let n = vt(e), r = I.current.slice(0, L.current + 1);
758
+ r.push(n), I.current = r, L.current = r.length - 1, T(n), V(n, t), ue();
755
759
  }
756
- function pe(e) {
757
- E(e), B(C, e);
760
+ function fe(e) {
761
+ D(e), V(w, e);
758
762
  }
759
- function me() {
760
- if (!j.canUndo || u) return;
761
- --F.current;
762
- let e = Y(P.current[F.current]);
763
- w(e), B(e), de();
763
+ function pe() {
764
+ if (!M.canUndo || u) return;
765
+ --L.current;
766
+ let e = vt(I.current[L.current]);
767
+ T(e), V(e), ue();
764
768
  }
765
- function V() {
766
- if (!j.canRedo || u) return;
767
- F.current += 1;
768
- let e = Y(P.current[F.current]);
769
- w(e), B(e), de();
769
+ function me() {
770
+ if (!M.canRedo || u) return;
771
+ L.current += 1;
772
+ let e = vt(I.current[L.current]);
773
+ T(e), V(e), ue();
770
774
  }
771
- function he() {
772
- u || C.length === 0 || fe([]);
775
+ function H() {
776
+ u || w.length === 0 || de([]);
773
777
  }
774
- function ge(e) {
778
+ function he(e) {
775
779
  let r = e.target.getStage()?.getPointerPosition();
776
780
  return r ? {
777
- x: jt(r.x / k.scale, 0, n),
778
- y: jt(r.y / k.scale, 0, t)
781
+ x: Mt(r.x / A.scale, 0, n),
782
+ y: Mt(r.y / A.scale, 0, t)
779
783
  } : null;
780
784
  }
781
- function _e(e) {
782
- if (u || !z && bt(e.target)) return;
783
- let t = ge(e);
785
+ function ge(e) {
786
+ if (u || !B && xt(e.target)) return;
787
+ let t = he(e);
784
788
  if (!t || !v) return;
785
789
  if (v === "eraser") {
786
- be(t);
790
+ ye(t);
787
791
  return;
788
792
  }
789
- let n = yt(t, ae);
793
+ let n = bt(t, re);
790
794
  if (v === "pen") {
791
- I.current = n, O({
792
- color: R,
793
- id: ue("freehand"),
795
+ R.current = n, k({
796
+ color: z,
797
+ id: le("freehand"),
794
798
  points: [n.x, n.y],
795
799
  strokeWidth: 4,
796
800
  type: "freehand"
@@ -798,9 +802,9 @@ function ot({ actionLabel: e, canvasHeight: t = et, canvasWidth: n = $e, classNa
798
802
  return;
799
803
  }
800
804
  if (v === "line") {
801
- I.current = n, O({
802
- color: R,
803
- id: ue("line"),
805
+ R.current = n, k({
806
+ color: z,
807
+ id: le("line"),
804
808
  points: [
805
809
  n.x,
806
810
  n.y,
@@ -812,78 +816,78 @@ function ot({ actionLabel: e, canvasHeight: t = et, canvasWidth: n = $e, classNa
812
816
  });
813
817
  return;
814
818
  }
815
- v === "compass" && (I.current = n, O({
819
+ v === "compass" && (R.current = n, k({
816
820
  center: n,
817
- color: R,
818
- id: ue("circle"),
821
+ color: z,
822
+ id: le("circle"),
819
823
  radius: 1,
820
824
  strokeWidth: 3,
821
825
  type: "circle"
822
826
  }));
823
827
  }
824
- function ve(e) {
825
- let t = ge(e);
828
+ function _e(e) {
829
+ let t = he(e);
826
830
  if (t) {
827
831
  if (v === "eraser" && !u) {
828
- be(t);
832
+ ye(t);
829
833
  return;
830
834
  }
831
- if (!(!D || !I.current || u)) {
832
- if (D.type === "freehand") {
833
- O({
834
- ...D,
835
- points: D.points.concat([t.x, t.y])
835
+ if (!(!O || !R.current || u)) {
836
+ if (O.type === "freehand") {
837
+ k({
838
+ ...O,
839
+ points: O.points.concat([t.x, t.y])
836
840
  });
837
841
  return;
838
842
  }
839
- if (D.type === "line") {
840
- let e = yt(t, ae);
841
- O({
842
- ...D,
843
+ if (O.type === "line") {
844
+ let e = bt(t, re);
845
+ k({
846
+ ...O,
843
847
  points: [
844
- I.current.x,
845
- I.current.y,
848
+ R.current.x,
849
+ R.current.y,
846
850
  e.x,
847
851
  e.y
848
852
  ]
849
853
  });
850
854
  return;
851
855
  }
852
- D.type === "circle" && O({
853
- ...D,
854
- radius: X(D.center, t)
856
+ O.type === "circle" && k({
857
+ ...O,
858
+ radius: X(O.center, t)
855
859
  });
856
860
  }
857
861
  }
858
862
  }
859
- function ye() {
860
- if (!D || u) {
861
- I.current = null, O(null);
863
+ function ve() {
864
+ if (!O || u) {
865
+ R.current = null, k(null);
862
866
  return;
863
867
  }
864
- let e = D;
865
- if (I.current = null, O(null), Ct(e)) {
868
+ let e = O;
869
+ if (R.current = null, k(null), wt(e)) {
866
870
  if (e.type === "circle") {
867
871
  let t = {
868
- ...T,
872
+ ...E,
869
873
  compass: {
870
874
  center: e.center,
871
875
  radius: e.radius
872
876
  }
873
877
  };
874
- E(t), fe(C.concat(e), t);
878
+ D(t), de(w.concat(e), t);
875
879
  return;
876
880
  }
877
- fe(C.concat(e));
881
+ de(w.concat(e));
878
882
  }
879
883
  }
880
- function be(e) {
881
- if (C.length === 0) return;
882
- let t = wt(C, e);
883
- t < 0 || fe(C.filter((e, n) => n !== t));
884
+ function ye(e) {
885
+ if (w.length === 0) return;
886
+ let t = Tt(w, e);
887
+ t < 0 || de(w.filter((e, n) => n !== t));
884
888
  }
885
889
  return /* @__PURE__ */ s("div", {
886
- className: oe,
890
+ className: ie,
887
891
  "data-disabled": u ? "true" : "false",
888
892
  dir: "rtl",
889
893
  children: [
@@ -891,14 +895,14 @@ function ot({ actionLabel: e, canvasHeight: t = et, canvasWidth: n = $e, classNa
891
895
  className: "geometry-toolbar",
892
896
  "aria-label": "أَدَواتُ الوَرَقَةِ المُسَوَّدَةِ",
893
897
  children: it.map((e) => /* @__PURE__ */ s("button", {
894
- "aria-pressed": se(e.id),
898
+ "aria-pressed": oe(e.id),
895
899
  className: [
896
900
  "geometry-tool-button",
897
- se(e.id) ? "geometry-tool-button--active" : "",
901
+ oe(e.id) ? "geometry-tool-button--active" : "",
898
902
  at.has(e.id) ? "geometry-tool-button--guide" : ""
899
903
  ].filter(Boolean).join(" "),
900
904
  disabled: u,
901
- onClick: () => le(e.id),
905
+ onClick: () => ce(e.id),
902
906
  type: "button",
903
907
  children: [/* @__PURE__ */ o("span", {
904
908
  "aria-hidden": "true",
@@ -906,32 +910,32 @@ function ot({ actionLabel: e, canvasHeight: t = et, canvasWidth: n = $e, classNa
906
910
  }), /* @__PURE__ */ o("span", { children: e.label })]
907
911
  }, e.id))
908
912
  }),
909
- m ? /* @__PURE__ */ o(Je, {
913
+ m ? /* @__PURE__ */ o(qe, {
910
914
  ariaLabel: "أَلْوانُ الأَقْلامِ",
911
915
  className: "geometry-color-picker",
912
916
  colors: _,
913
917
  disabled: u,
914
- onChange: ee,
915
- selectedColorId: L
918
+ onChange: C,
919
+ selectedColorId: ae
916
920
  }) : null,
917
921
  /* @__PURE__ */ o("div", {
918
922
  className: "geometry-stage-shell",
919
- ref: re,
920
- children: /* @__PURE__ */ o(ne, {
921
- height: k.height,
922
- onMouseDown: _e,
923
- onMouseLeave: ye,
924
- onMouseMove: ve,
925
- onMouseUp: ye,
926
- onTouchEnd: ye,
927
- onTouchMove: ve,
928
- onTouchStart: _e,
929
- width: k.width,
930
- children: /* @__PURE__ */ s(te, {
931
- scaleX: k.scale,
932
- scaleY: k.scale,
923
+ ref: F,
924
+ children: /* @__PURE__ */ o(te, {
925
+ height: A.height,
926
+ onMouseDown: ge,
927
+ onMouseLeave: ve,
928
+ onMouseMove: _e,
929
+ onMouseUp: ve,
930
+ onTouchEnd: ve,
931
+ onTouchMove: _e,
932
+ onTouchStart: ge,
933
+ width: A.width,
934
+ children: /* @__PURE__ */ s(ee, {
935
+ scaleX: A.scale,
936
+ scaleY: A.scale,
933
937
  children: [
934
- /* @__PURE__ */ o(N, {
938
+ /* @__PURE__ */ o(P, {
935
939
  fill: "#fff",
936
940
  height: t,
937
941
  stroke: "#bad3c8",
@@ -947,32 +951,32 @@ function ot({ actionLabel: e, canvasHeight: t = et, canvasWidth: n = $e, classNa
947
951
  x: e.x / 100 * n,
948
952
  y: e.y / 100 * t
949
953
  }, e.id)),
950
- C.map((e) => mt(e)),
951
- D ? mt(D, !0) : null,
954
+ w.map((e) => mt(e)),
955
+ O ? mt(O, !0) : null,
952
956
  b.includes("ruler") ? /* @__PURE__ */ o(dt, {
953
957
  disabled: u,
954
- guide: T.ruler,
955
- locked: z,
956
- onCommit: (e) => pe({
957
- ...T,
958
+ guide: E.ruler,
959
+ locked: B,
960
+ onCommit: (e) => fe({
961
+ ...E,
958
962
  ruler: e
959
963
  })
960
- }, `${T.ruler.x}:${T.ruler.y}:${T.ruler.length}:${T.ruler.rotation}`) : null,
964
+ }, `${E.ruler.x}:${E.ruler.y}:${E.ruler.length}:${E.ruler.rotation}`) : null,
961
965
  b.includes("protractor") ? /* @__PURE__ */ o(ft, {
962
966
  disabled: u,
963
- guide: T.protractor,
964
- locked: z,
965
- onChange: (e) => pe({
966
- ...T,
967
+ guide: E.protractor,
968
+ locked: B,
969
+ onChange: (e) => fe({
970
+ ...E,
967
971
  protractor: e
968
972
  })
969
973
  }) : null,
970
974
  b.includes("compass") ? /* @__PURE__ */ o(pt, {
971
975
  disabled: u,
972
- guide: T.compass,
973
- locked: z,
974
- onChange: (e) => pe({
975
- ...T,
976
+ guide: E.compass,
977
+ locked: B,
978
+ onChange: (e) => fe({
979
+ ...E,
976
980
  compass: e
977
981
  })
978
982
  }) : null
@@ -985,20 +989,20 @@ function ot({ actionLabel: e, canvasHeight: t = et, canvasWidth: n = $e, classNa
985
989
  children: [
986
990
  e ? /* @__PURE__ */ o("span", { children: e }) : null,
987
991
  /* @__PURE__ */ o("button", {
988
- disabled: !j.canUndo || u,
989
- onClick: me,
992
+ disabled: !M.canUndo || u,
993
+ onClick: pe,
990
994
  type: "button",
991
995
  children: "تَراجُعٌ"
992
996
  }),
993
997
  /* @__PURE__ */ o("button", {
994
- disabled: !j.canRedo || u,
995
- onClick: V,
998
+ disabled: !M.canRedo || u,
999
+ onClick: me,
996
1000
  type: "button",
997
1001
  children: "إِعادَةٌ"
998
1002
  }),
999
1003
  /* @__PURE__ */ o("button", {
1000
- disabled: C.length === 0 || u,
1001
- onClick: he,
1004
+ disabled: w.length === 0 || u,
1005
+ onClick: H,
1002
1006
  type: "button",
1003
1007
  children: "مَسْحٌ"
1004
1008
  })
@@ -1034,29 +1038,29 @@ function st(e, n, r, i, a) {
1034
1038
  ]);
1035
1039
  }
1036
1040
  function ct({ canvasHeight: e, canvasWidth: t }) {
1037
- let n = Math.floor(t / q), r = Math.floor(e / q);
1038
- return /* @__PURE__ */ s(a, { children: [Array.from({ length: n + 1 }, (t, n) => /* @__PURE__ */ o(M, {
1041
+ let n = Math.floor(t / J), r = Math.floor(e / J);
1042
+ return /* @__PURE__ */ s(a, { children: [Array.from({ length: n + 1 }, (t, n) => /* @__PURE__ */ o(N, {
1039
1043
  points: [
1040
- n * q,
1044
+ n * J,
1041
1045
  0,
1042
- n * q,
1046
+ n * J,
1043
1047
  e
1044
1048
  ],
1045
1049
  stroke: "#d2ded8",
1046
1050
  strokeWidth: 1
1047
- }, `vertical-${n}`)), Array.from({ length: r + 1 }, (e, n) => /* @__PURE__ */ o(M, {
1051
+ }, `vertical-${n}`)), Array.from({ length: r + 1 }, (e, n) => /* @__PURE__ */ o(N, {
1048
1052
  points: [
1049
1053
  0,
1050
- n * q,
1054
+ n * J,
1051
1055
  t,
1052
- n * q
1056
+ n * J
1053
1057
  ],
1054
1058
  stroke: "#d2ded8",
1055
1059
  strokeWidth: 1
1056
1060
  }, `horizontal-${n}`))] });
1057
1061
  }
1058
1062
  function lt({ label: e, x: t, y: n }) {
1059
- return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(A, {
1063
+ return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(j, {
1060
1064
  fill: "#e63542",
1061
1065
  radius: 4.75,
1062
1066
  shadowBlur: 5,
@@ -1065,7 +1069,7 @@ function lt({ label: e, x: t, y: n }) {
1065
1069
  strokeWidth: 1.7,
1066
1070
  x: t,
1067
1071
  y: n
1068
- }), /* @__PURE__ */ o(re, {
1072
+ }), /* @__PURE__ */ o(F, {
1069
1073
  fill: "#111",
1070
1074
  fontSize: 14,
1071
1075
  fontStyle: "bold",
@@ -1085,7 +1089,7 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1085
1089
  }
1086
1090
  function y(e) {
1087
1091
  e.cancelBubble = !0;
1088
- let t = St(e);
1092
+ let t = Ct(e);
1089
1093
  t && (v({
1090
1094
  ...d.current,
1091
1095
  x: t.x,
@@ -1103,8 +1107,8 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1103
1107
  }
1104
1108
  function x(e, t) {
1105
1109
  e.cancelBubble = !0;
1106
- let n = St(e);
1107
- n && (v(kt(d.current, n, t)), e.currentTarget.position({
1110
+ let n = Ct(e);
1111
+ n && (v(At(d.current, n, t)), e.currentTarget.position({
1108
1112
  x: 0,
1109
1113
  y: 0
1110
1114
  }));
@@ -1112,11 +1116,11 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1112
1116
  function S() {
1113
1117
  let e = {
1114
1118
  ...d.current,
1115
- rotation: Mt(d.current.rotation + 90)
1119
+ rotation: Nt(d.current.rotation + 90)
1116
1120
  };
1117
1121
  v(e), c(e);
1118
1122
  }
1119
- return /* @__PURE__ */ o(a, { children: /* @__PURE__ */ s(j, {
1123
+ return /* @__PURE__ */ o(a, { children: /* @__PURE__ */ s(M, {
1120
1124
  listening: _,
1121
1125
  name: "geometry-guide",
1122
1126
  onDblClick: S,
@@ -1125,18 +1129,18 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1125
1129
  x: l.x,
1126
1130
  y: l.y,
1127
1131
  children: [
1128
- /* @__PURE__ */ o(N, {
1132
+ /* @__PURE__ */ o(P, {
1129
1133
  cornerRadius: 7,
1130
1134
  fill: "rgba(14, 173, 100, 0.13)",
1131
1135
  height: 38,
1132
1136
  listening: !1,
1133
1137
  offsetX: l.length / 2,
1134
1138
  offsetY: 38 / 2,
1135
- stroke: J,
1139
+ stroke: Y,
1136
1140
  strokeWidth: 2,
1137
1141
  width: l.length
1138
1142
  }),
1139
- /* @__PURE__ */ o(M, {
1143
+ /* @__PURE__ */ o(N, {
1140
1144
  points: [
1141
1145
  -l.length / 2 + 12,
1142
1146
  0,
@@ -1144,12 +1148,12 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1144
1148
  0
1145
1149
  ],
1146
1150
  listening: !1,
1147
- stroke: J,
1151
+ stroke: Y,
1148
1152
  strokeWidth: 2
1149
1153
  }),
1150
1154
  Array.from({ length: Math.floor(l.length / 20) + 1 }, (e, t) => {
1151
1155
  let n = -l.length / 2 + t * 20, r = t % 5 == 0;
1152
- return /* @__PURE__ */ o(M, {
1156
+ return /* @__PURE__ */ o(N, {
1153
1157
  listening: !1,
1154
1158
  points: [
1155
1159
  n,
@@ -1157,11 +1161,11 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1157
1161
  n,
1158
1162
  r ? 4 : 10
1159
1163
  ],
1160
- stroke: J,
1164
+ stroke: Y,
1161
1165
  strokeWidth: r ? 1.5 : 1
1162
1166
  }, t);
1163
1167
  }),
1164
- /* @__PURE__ */ o(M, {
1168
+ /* @__PURE__ */ o(N, {
1165
1169
  dash: [7, 7],
1166
1170
  listening: !1,
1167
1171
  opacity: .72,
@@ -1171,10 +1175,10 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1171
1175
  p,
1172
1176
  0
1173
1177
  ],
1174
- stroke: J,
1178
+ stroke: Y,
1175
1179
  strokeWidth: 2
1176
1180
  }),
1177
- /* @__PURE__ */ o(M, {
1181
+ /* @__PURE__ */ o(N, {
1178
1182
  dash: [7, 7],
1179
1183
  listening: !1,
1180
1184
  opacity: .72,
@@ -1184,17 +1188,17 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1184
1188
  m,
1185
1189
  0
1186
1190
  ],
1187
- stroke: J,
1191
+ stroke: Y,
1188
1192
  strokeWidth: 2
1189
1193
  }),
1190
- /* @__PURE__ */ o(j, {
1194
+ /* @__PURE__ */ o(M, {
1191
1195
  draggable: _,
1192
1196
  name: "geometry-guide",
1193
1197
  onDblClick: S,
1194
1198
  onDblTap: S,
1195
1199
  onDragEnd: b,
1196
1200
  onDragMove: (e) => x(e, "right"),
1197
- children: /* @__PURE__ */ o(N, {
1201
+ children: /* @__PURE__ */ o(P, {
1198
1202
  fill: "rgba(255, 255, 255, 0.01)",
1199
1203
  height: 106,
1200
1204
  offsetY: 53,
@@ -1202,14 +1206,14 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1202
1206
  x: 0
1203
1207
  })
1204
1208
  }),
1205
- /* @__PURE__ */ o(j, {
1209
+ /* @__PURE__ */ o(M, {
1206
1210
  draggable: _,
1207
1211
  name: "geometry-guide",
1208
1212
  onDblClick: S,
1209
1213
  onDblTap: S,
1210
1214
  onDragEnd: b,
1211
1215
  onDragMove: (e) => x(e, "left"),
1212
- children: /* @__PURE__ */ o(N, {
1216
+ children: /* @__PURE__ */ o(P, {
1213
1217
  fill: "rgba(255, 255, 255, 0.01)",
1214
1218
  height: 106,
1215
1219
  offsetY: 53,
@@ -1217,34 +1221,34 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1217
1221
  x: m - 24
1218
1222
  })
1219
1223
  }),
1220
- /* @__PURE__ */ o(A, {
1224
+ /* @__PURE__ */ o(j, {
1221
1225
  fill: "#f7fffb",
1222
1226
  listening: !1,
1223
1227
  radius: 16,
1224
1228
  shadowBlur: 10,
1225
1229
  shadowColor: "rgba(10, 143, 85, 0.35)",
1226
- stroke: J,
1230
+ stroke: Y,
1227
1231
  strokeWidth: 4,
1228
1232
  x: p,
1229
1233
  y: 0
1230
1234
  }),
1231
- /* @__PURE__ */ o(A, {
1235
+ /* @__PURE__ */ o(j, {
1232
1236
  fill: "#f7fffb",
1233
1237
  listening: !1,
1234
1238
  radius: 16,
1235
1239
  shadowBlur: 10,
1236
1240
  shadowColor: "rgba(10, 143, 85, 0.35)",
1237
- stroke: J,
1241
+ stroke: Y,
1238
1242
  strokeWidth: 4,
1239
1243
  x: m,
1240
1244
  y: 0
1241
1245
  }),
1242
- /* @__PURE__ */ s(j, {
1246
+ /* @__PURE__ */ s(M, {
1243
1247
  draggable: _,
1244
1248
  name: "geometry-guide",
1245
1249
  onDragEnd: b,
1246
1250
  onDragMove: y,
1247
- children: [/* @__PURE__ */ o(N, {
1251
+ children: [/* @__PURE__ */ o(P, {
1248
1252
  cornerRadius: 13,
1249
1253
  fill: "#ffffff",
1250
1254
  height: 26,
@@ -1252,14 +1256,14 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1252
1256
  offsetY: 13,
1253
1257
  shadowBlur: 8,
1254
1258
  shadowColor: "rgba(10, 143, 85, 0.2)",
1255
- stroke: J,
1259
+ stroke: Y,
1256
1260
  strokeWidth: 2,
1257
1261
  width: 70
1258
1262
  }), [
1259
1263
  -14,
1260
1264
  0,
1261
1265
  14
1262
- ].map((e) => /* @__PURE__ */ o(M, {
1266
+ ].map((e) => /* @__PURE__ */ o(N, {
1263
1267
  lineCap: "round",
1264
1268
  points: [
1265
1269
  e,
@@ -1267,7 +1271,7 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1267
1271
  e,
1268
1272
  7
1269
1273
  ],
1270
- stroke: J,
1274
+ stroke: Y,
1271
1275
  strokeWidth: 2
1272
1276
  }, e))]
1273
1277
  })
@@ -1275,14 +1279,14 @@ function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1275
1279
  }) });
1276
1280
  }
1277
1281
  function ft({ disabled: e, guide: t, locked: n, onChange: r }) {
1278
- let i = !e && !n, c = Dt({
1282
+ let i = !e && !n, c = Ot({
1279
1283
  x: 136,
1280
1284
  y: 0
1281
1285
  }, t.rotation, {
1282
1286
  x: t.x,
1283
1287
  y: t.y
1284
1288
  });
1285
- return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ s(j, {
1289
+ return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ s(M, {
1286
1290
  draggable: i,
1287
1291
  listening: i,
1288
1292
  name: "geometry-guide",
@@ -1295,23 +1299,23 @@ function ft({ disabled: e, guide: t, locked: n, onChange: r }) {
1295
1299
  x: t.x,
1296
1300
  y: t.y,
1297
1301
  children: [
1298
- /* @__PURE__ */ o(k, {
1302
+ /* @__PURE__ */ o(A, {
1299
1303
  angle: 180,
1300
1304
  fill: "rgba(14, 173, 100, 0.11)",
1301
1305
  innerRadius: 0,
1302
1306
  outerRadius: 110,
1303
1307
  rotation: 180,
1304
- stroke: J,
1308
+ stroke: Y,
1305
1309
  strokeWidth: 2
1306
1310
  }),
1307
- /* @__PURE__ */ o(M, {
1311
+ /* @__PURE__ */ o(N, {
1308
1312
  points: [
1309
1313
  -110,
1310
1314
  0,
1311
1315
  110,
1312
1316
  0
1313
1317
  ],
1314
- stroke: J,
1318
+ stroke: Y,
1315
1319
  strokeWidth: 2
1316
1320
  }),
1317
1321
  Array.from({ length: 19 }, (e, t) => {
@@ -1322,14 +1326,14 @@ function ft({ disabled: e, guide: t, locked: n, onChange: r }) {
1322
1326
  x: Math.cos(r) * (t % 3 == 0 ? 92 : 100),
1323
1327
  y: -Math.sin(r) * (t % 3 == 0 ? 92 : 100)
1324
1328
  };
1325
- return /* @__PURE__ */ o(M, {
1329
+ return /* @__PURE__ */ o(N, {
1326
1330
  points: [
1327
1331
  a.x,
1328
1332
  a.y,
1329
1333
  i.x,
1330
1334
  i.y
1331
1335
  ],
1332
- stroke: J,
1336
+ stroke: Y,
1333
1337
  strokeWidth: t % 3 == 0 ? 1.4 : 1
1334
1338
  }, n);
1335
1339
  }),
@@ -1339,8 +1343,8 @@ function ft({ disabled: e, guide: t, locked: n, onChange: r }) {
1339
1343
  180
1340
1344
  ].map((e) => {
1341
1345
  let t = (180 - e) * Math.PI / 180;
1342
- return /* @__PURE__ */ o(re, {
1343
- fill: J,
1346
+ return /* @__PURE__ */ o(F, {
1347
+ fill: Y,
1344
1348
  fontSize: 12,
1345
1349
  fontStyle: "bold",
1346
1350
  text: `${e}`,
@@ -1349,7 +1353,7 @@ function ft({ disabled: e, guide: t, locked: n, onChange: r }) {
1349
1353
  }, e);
1350
1354
  })
1351
1355
  ]
1352
- }), /* @__PURE__ */ o(A, {
1356
+ }), /* @__PURE__ */ o(j, {
1353
1357
  draggable: i,
1354
1358
  fill: "#fff",
1355
1359
  listening: i,
@@ -1362,7 +1366,7 @@ function ft({ disabled: e, guide: t, locked: n, onChange: r }) {
1362
1366
  });
1363
1367
  },
1364
1368
  radius: 10,
1365
- stroke: J,
1369
+ stroke: Y,
1366
1370
  strokeWidth: 3,
1367
1371
  x: c.x,
1368
1372
  y: c.y
@@ -1377,15 +1381,15 @@ function pt({ disabled: e, guide: t, locked: n, onChange: r }) {
1377
1381
  y: t.center.y - Math.min(90, Math.max(34, t.radius * .68))
1378
1382
  };
1379
1383
  return /* @__PURE__ */ s(a, { children: [
1380
- /* @__PURE__ */ o(A, {
1384
+ /* @__PURE__ */ o(j, {
1381
1385
  dash: [8, 8],
1382
1386
  radius: t.radius,
1383
- stroke: J,
1387
+ stroke: Y,
1384
1388
  strokeWidth: 2,
1385
1389
  x: t.center.x,
1386
1390
  y: t.center.y
1387
1391
  }),
1388
- /* @__PURE__ */ o(M, {
1392
+ /* @__PURE__ */ o(N, {
1389
1393
  dash: [8, 8],
1390
1394
  points: [
1391
1395
  t.center.x,
@@ -1393,10 +1397,10 @@ function pt({ disabled: e, guide: t, locked: n, onChange: r }) {
1393
1397
  c.x,
1394
1398
  c.y
1395
1399
  ],
1396
- stroke: J,
1400
+ stroke: Y,
1397
1401
  strokeWidth: 2
1398
1402
  }),
1399
- /* @__PURE__ */ o(M, {
1403
+ /* @__PURE__ */ o(N, {
1400
1404
  lineCap: "round",
1401
1405
  lineJoin: "round",
1402
1406
  points: [
@@ -1407,18 +1411,18 @@ function pt({ disabled: e, guide: t, locked: n, onChange: r }) {
1407
1411
  c.x,
1408
1412
  c.y
1409
1413
  ],
1410
- stroke: J,
1414
+ stroke: Y,
1411
1415
  strokeWidth: 4
1412
1416
  }),
1413
- /* @__PURE__ */ o(A, {
1417
+ /* @__PURE__ */ o(j, {
1414
1418
  fill: "#fff",
1415
1419
  radius: 8,
1416
- stroke: J,
1420
+ stroke: Y,
1417
1421
  strokeWidth: 3,
1418
1422
  x: l.x,
1419
1423
  y: l.y
1420
1424
  }),
1421
- /* @__PURE__ */ o(A, {
1425
+ /* @__PURE__ */ o(j, {
1422
1426
  draggable: i,
1423
1427
  fill: "#fff",
1424
1428
  listening: i,
@@ -1428,12 +1432,12 @@ function pt({ disabled: e, guide: t, locked: n, onChange: r }) {
1428
1432
  center: e.target.position()
1429
1433
  }),
1430
1434
  radius: 11,
1431
- stroke: J,
1435
+ stroke: Y,
1432
1436
  strokeWidth: 3,
1433
1437
  x: t.center.x,
1434
1438
  y: t.center.y
1435
1439
  }),
1436
- /* @__PURE__ */ o(A, {
1440
+ /* @__PURE__ */ o(j, {
1437
1441
  draggable: i,
1438
1442
  fill: "#fff",
1439
1443
  listening: i,
@@ -1446,7 +1450,7 @@ function pt({ disabled: e, guide: t, locked: n, onChange: r }) {
1446
1450
  });
1447
1451
  },
1448
1452
  radius: 9,
1449
- stroke: J,
1453
+ stroke: Y,
1450
1454
  strokeWidth: 3,
1451
1455
  x: c.x,
1452
1456
  y: c.y
@@ -1455,7 +1459,7 @@ function pt({ disabled: e, guide: t, locked: n, onChange: r }) {
1455
1459
  }
1456
1460
  function mt(e, t = !1) {
1457
1461
  let n = t ? .58 : 1;
1458
- return e.type === "freehand" ? /* @__PURE__ */ o(M, {
1462
+ return e.type === "freehand" ? /* @__PURE__ */ o(N, {
1459
1463
  lineCap: "round",
1460
1464
  lineJoin: "round",
1461
1465
  opacity: n,
@@ -1463,13 +1467,13 @@ function mt(e, t = !1) {
1463
1467
  stroke: e.color,
1464
1468
  strokeWidth: e.strokeWidth,
1465
1469
  tension: .45
1466
- }, e.id) : e.type === "line" ? /* @__PURE__ */ o(M, {
1470
+ }, e.id) : e.type === "line" ? /* @__PURE__ */ o(N, {
1467
1471
  lineCap: "round",
1468
1472
  opacity: n,
1469
1473
  points: e.points,
1470
1474
  stroke: e.color,
1471
1475
  strokeWidth: e.strokeWidth
1472
- }, e.id) : /* @__PURE__ */ o(A, {
1476
+ }, e.id) : /* @__PURE__ */ o(j, {
1473
1477
  opacity: n,
1474
1478
  radius: e.radius,
1475
1479
  stroke: e.color,
@@ -1501,7 +1505,7 @@ function ht(e, t) {
1501
1505
  };
1502
1506
  }
1503
1507
  function gt(e) {
1504
- return e?.elements?.length ? Y(e.elements) : (e?.strokes ?? []).filter((e) => e.tool === "pen" && e.points.length >= 4).map((e) => ({
1508
+ return e?.elements?.length ? vt(e.elements) : (e?.strokes ?? []).filter((e) => e.tool === "pen" && e.points.length >= 4).map((e) => ({
1505
1509
  color: rt,
1506
1510
  id: e.id,
1507
1511
  points: e.points.slice(),
@@ -1520,7 +1524,7 @@ function _t(e) {
1520
1524
  tool: "pen"
1521
1525
  }] : []);
1522
1526
  }
1523
- function Y(e) {
1527
+ function vt(e) {
1524
1528
  return e.map((e) => e.type === "freehand" ? {
1525
1529
  ...e,
1526
1530
  points: e.points.slice()
@@ -1537,25 +1541,25 @@ function Y(e) {
1537
1541
  center: { ...e.center }
1538
1542
  });
1539
1543
  }
1540
- function vt(e, t, n) {
1544
+ function yt(e, t, n) {
1541
1545
  let r = e.map((e) => ({
1542
1546
  x: e.x / 100 * t,
1543
1547
  y: e.y / 100 * n
1544
1548
  })), i = [];
1545
- for (let e = 0; e <= t; e += q) for (let t = 0; t <= n; t += q) i.push({
1549
+ for (let e = 0; e <= t; e += J) for (let t = 0; t <= n; t += J) i.push({
1546
1550
  x: e,
1547
1551
  y: t
1548
1552
  });
1549
1553
  return r.concat(i);
1550
1554
  }
1551
- function yt(e, t) {
1555
+ function bt(e, t) {
1552
1556
  let n = e, r = nt;
1553
1557
  return t.forEach((t) => {
1554
1558
  let i = X(e, t);
1555
1559
  i < r && (n = t, r = i);
1556
1560
  }), n;
1557
1561
  }
1558
- function bt(e) {
1562
+ function xt(e) {
1559
1563
  let t = e;
1560
1564
  for (; t;) {
1561
1565
  if (t.name().split(" ").includes("geometry-guide")) return !0;
@@ -1563,10 +1567,10 @@ function bt(e) {
1563
1567
  }
1564
1568
  return !1;
1565
1569
  }
1566
- function xt(e) {
1570
+ function St(e) {
1567
1571
  return e === "pen" || e === "line" || e === "eraser";
1568
1572
  }
1569
- function St(e) {
1573
+ function Ct(e) {
1570
1574
  let t = e.target.getStage()?.getPointerPosition();
1571
1575
  if (!t) return null;
1572
1576
  let n = e.target.getLayer(), r = n?.scaleX() || 1, i = n?.scaleY() || r;
@@ -1575,16 +1579,16 @@ function St(e) {
1575
1579
  y: t.y / i
1576
1580
  };
1577
1581
  }
1578
- function Ct(e) {
1579
- return e.type === "freehand" ? e.points.length >= 4 : e.type === "line" ? At(e.points) > 6 : e.radius > 6;
1582
+ function wt(e) {
1583
+ return e.type === "freehand" ? e.points.length >= 4 : e.type === "line" ? jt(e.points) > 6 : e.radius > 6;
1580
1584
  }
1581
- function wt(e, t) {
1582
- for (let n = e.length - 1; n >= 0; --n) if (Tt(e[n], t)) return n;
1585
+ function Tt(e, t) {
1586
+ for (let n = e.length - 1; n >= 0; --n) if (Et(e[n], t)) return n;
1583
1587
  return -1;
1584
1588
  }
1585
- function Tt(e, t) {
1589
+ function Et(e, t) {
1586
1590
  if (e.type === "circle") return Math.abs(X(e.center, t) - e.radius) <= 14;
1587
- for (let n = 0; n < e.points.length - 2; n += 2) if (Et(t, {
1591
+ for (let n = 0; n < e.points.length - 2; n += 2) if (Dt(t, {
1588
1592
  x1: e.points[n],
1589
1593
  x2: e.points[n + 2],
1590
1594
  y1: e.points[n + 1],
@@ -1592,27 +1596,27 @@ function Tt(e, t) {
1592
1596
  }) <= 14) return !0;
1593
1597
  return !1;
1594
1598
  }
1595
- function Et(e, t) {
1599
+ function Dt(e, t) {
1596
1600
  let n = t.x2 - t.x1, r = t.y2 - t.y1, i = n * n + r * r;
1597
1601
  if (i === 0) return X(e, {
1598
1602
  x: t.x1,
1599
1603
  y: t.y1
1600
1604
  });
1601
- let a = jt(((e.x - t.x1) * n + (e.y - t.y1) * r) / i, 0, 1);
1605
+ let a = Mt(((e.x - t.x1) * n + (e.y - t.y1) * r) / i, 0, 1);
1602
1606
  return X(e, {
1603
1607
  x: t.x1 + a * n,
1604
1608
  y: t.y1 + a * r
1605
1609
  });
1606
1610
  }
1607
- function Dt(e, t, n) {
1611
+ function Ot(e, t, n) {
1608
1612
  let r = t * Math.PI / 180, i = Math.cos(r), a = Math.sin(r);
1609
1613
  return {
1610
1614
  x: n.x + e.x * i - e.y * a,
1611
1615
  y: n.y + e.x * a + e.y * i
1612
1616
  };
1613
1617
  }
1614
- function Ot(e, t) {
1615
- return Dt({
1618
+ function kt(e, t) {
1619
+ return Ot({
1616
1620
  x: t === "left" ? -e.length / 2 : e.length / 2,
1617
1621
  y: 0
1618
1622
  }, e.rotation, {
@@ -1620,8 +1624,8 @@ function Ot(e, t) {
1620
1624
  y: e.y
1621
1625
  });
1622
1626
  }
1623
- function kt(e, t, n) {
1624
- let r = n === "right" ? "left" : "right", i = Ot(e, r), a = Math.atan2(t.y - i.y, t.x - i.x) * 180 / Math.PI, o = Mt(n === "right" ? a : a + 180), s = o * Math.PI / 180, c = e.length / 2, l = r === "left" ? 1 : -1;
1627
+ function At(e, t, n) {
1628
+ let r = n === "right" ? "left" : "right", i = kt(e, r), a = Math.atan2(t.y - i.y, t.x - i.x) * 180 / Math.PI, o = Nt(n === "right" ? a : a + 180), s = o * Math.PI / 180, c = e.length / 2, l = r === "left" ? 1 : -1;
1625
1629
  return {
1626
1630
  ...e,
1627
1631
  rotation: o,
@@ -1629,7 +1633,7 @@ function kt(e, t, n) {
1629
1633
  y: i.y + Math.sin(s) * c * l
1630
1634
  };
1631
1635
  }
1632
- function At(e) {
1636
+ function jt(e) {
1633
1637
  return X({
1634
1638
  x: e[0],
1635
1639
  y: e[1]
@@ -1641,15 +1645,15 @@ function At(e) {
1641
1645
  function X(e, t) {
1642
1646
  return Math.hypot(e.x - t.x, e.y - t.y);
1643
1647
  }
1644
- function jt(e, t, n) {
1648
+ function Mt(e, t, n) {
1645
1649
  return Math.min(Math.max(e, t), n);
1646
1650
  }
1647
- function Mt(e) {
1651
+ function Nt(e) {
1648
1652
  return (e % 360 + 360) % 360;
1649
1653
  }
1650
1654
  //#endregion
1651
1655
  //#region src/exam-session/interactions/KonvaDrawingGrid.tsx
1652
- function Nt({ points: e, value: t, onChange: n }) {
1656
+ function Pt({ points: e, value: t, onChange: n }) {
1653
1657
  return /* @__PURE__ */ o(ot, {
1654
1658
  onChange: n,
1655
1659
  points: e,
@@ -1659,7 +1663,7 @@ function Nt({ points: e, value: t, onChange: n }) {
1659
1663
  }
1660
1664
  //#endregion
1661
1665
  //#region src/exam-session/interactions/LabelPlacement.tsx
1662
- function Pt({ labels: e, targets: t, value: n, onChange: r }) {
1666
+ function Ft({ labels: e, targets: t, value: n, onChange: r }) {
1663
1667
  let i = n?.placements ?? {}, a = new Set(Object.keys(i));
1664
1668
  return /* @__PURE__ */ o(c, {
1665
1669
  onDragEnd: (e) => {
@@ -1682,10 +1686,10 @@ function Pt({ labels: e, targets: t, value: n, onChange: r }) {
1682
1686
  className: "label-placement",
1683
1687
  children: [/* @__PURE__ */ o("div", {
1684
1688
  className: "label-placement__bank",
1685
- children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ o(Ft, { label: e }, e.id))
1689
+ children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ o(It, { label: e }, e.id))
1686
1690
  }), /* @__PURE__ */ o("div", {
1687
1691
  className: "label-placement__diagram",
1688
- children: t.map((t) => /* @__PURE__ */ o(It, {
1692
+ children: t.map((t) => /* @__PURE__ */ o(Lt, {
1689
1693
  label: e.find((e) => i[e.id]?.targetId === t.id),
1690
1694
  target: t
1691
1695
  }, t.id))
@@ -1693,7 +1697,7 @@ function Pt({ labels: e, targets: t, value: n, onChange: r }) {
1693
1697
  })
1694
1698
  });
1695
1699
  }
1696
- function Ft({ label: e }) {
1700
+ function It({ label: e }) {
1697
1701
  let { ref: t, isDragging: n } = l({ id: e.id });
1698
1702
  return /* @__PURE__ */ o("button", {
1699
1703
  className: n ? "placement-label placement-label--dragging" : "placement-label",
@@ -1702,7 +1706,7 @@ function Ft({ label: e }) {
1702
1706
  children: e.label
1703
1707
  });
1704
1708
  }
1705
- function It({ label: e, target: t }) {
1709
+ function Lt({ label: e, target: t }) {
1706
1710
  let { ref: n, isDropTarget: r } = u({ id: t.id });
1707
1711
  return /* @__PURE__ */ s("div", {
1708
1712
  className: r ? "placement-target placement-target--active" : "placement-target",
@@ -1714,17 +1718,17 @@ function It({ label: e, target: t }) {
1714
1718
  children: [/* @__PURE__ */ o("span", {
1715
1719
  "aria-hidden": "true",
1716
1720
  children: t.label
1717
- }), e ? /* @__PURE__ */ o(Ft, { label: e }) : null]
1721
+ }), e ? /* @__PURE__ */ o(It, { label: e }) : null]
1718
1722
  });
1719
1723
  }
1720
1724
  //#endregion
1721
1725
  //#region src/exam-session/interactions/NumberLineAnswer.tsx
1722
- function Lt({ answerId: e, expression: t, value: n, onChange: r, onClear: i, recognizer: a }) {
1726
+ function Rt({ answerId: e, expression: t, value: n, onChange: r, onClear: i, recognizer: a }) {
1723
1727
  return /* @__PURE__ */ s("div", {
1724
1728
  className: "number-line-layout",
1725
- children: [/* @__PURE__ */ o(Rt, {}), /* @__PURE__ */ s("div", {
1729
+ children: [/* @__PURE__ */ o(zt, {}), /* @__PURE__ */ s("div", {
1726
1730
  className: "compact-answer",
1727
- children: [/* @__PURE__ */ o("span", { children: t }), /* @__PURE__ */ o(G, {
1731
+ children: [/* @__PURE__ */ o("span", { children: t }), /* @__PURE__ */ o(q, {
1728
1732
  ariaLabel: t,
1729
1733
  onChange: (t) => r(e, t),
1730
1734
  onClear: () => i(e),
@@ -1734,7 +1738,7 @@ function Lt({ answerId: e, expression: t, value: n, onChange: r, onClear: i, rec
1734
1738
  })]
1735
1739
  });
1736
1740
  }
1737
- function Rt() {
1741
+ function zt() {
1738
1742
  return /* @__PURE__ */ s("svg", {
1739
1743
  className: "number-line",
1740
1744
  viewBox: "0 0 520 86",
@@ -1761,8 +1765,362 @@ function Rt() {
1761
1765
  });
1762
1766
  }
1763
1767
  //#endregion
1768
+ //#region src/exam-session/interactions/OperationWorkArea.tsx
1769
+ var Z = 900, Bt = 300, Vt = 510, Ht = 260;
1770
+ function Ut({ ariaLabel: e, divisionOperands: n, gridVariant: c = "ruled", onChange: l, onClear: u, operation: d = "+", placeholder: f = "اكتب خطوات العملية هنا", value: p }) {
1771
+ let m = c === "operation-worksheet" || c === "division-worksheet" ? Vt : Bt, g = r(null), [_, v] = i(() => Kt(p)), [y, b] = i(!1), [x, S] = i({
1772
+ height: m,
1773
+ scale: 1,
1774
+ width: Z
1775
+ }), C = _.length === 0;
1776
+ t(() => {
1777
+ v(Kt(p));
1778
+ }, [p]), t(() => {
1779
+ let e = g.current;
1780
+ if (!e) return;
1781
+ function t() {
1782
+ let t = Math.max(Ht, Math.min(Z, e?.clientWidth ?? Z)), n = t / Z;
1783
+ S({
1784
+ height: m * n,
1785
+ scale: n,
1786
+ width: t
1787
+ });
1788
+ }
1789
+ t();
1790
+ let n = new ResizeObserver(t);
1791
+ return n.observe(e), () => n.disconnect();
1792
+ }, [m]);
1793
+ function w(e) {
1794
+ v(e), l({
1795
+ elements: e,
1796
+ kind: "drawing"
1797
+ });
1798
+ }
1799
+ function T(e) {
1800
+ let t = e?.getPointerPosition();
1801
+ return t ? {
1802
+ x: t.x / x.scale,
1803
+ y: t.y / x.scale
1804
+ } : null;
1805
+ }
1806
+ function E(e) {
1807
+ e.evt.preventDefault();
1808
+ let t = T(e.target.getStage());
1809
+ t && (b(!0), w([..._, {
1810
+ color: "#061013",
1811
+ id: `operation-stroke-${Date.now()}-${Math.round(t.x)}-${Math.round(t.y)}`,
1812
+ points: [t.x, t.y],
1813
+ strokeWidth: 8,
1814
+ type: "freehand"
1815
+ }]));
1816
+ }
1817
+ function D(e) {
1818
+ if (!y || C || !e.evt.buttons && e.evt.pointerType === "mouse") return;
1819
+ e.evt.preventDefault();
1820
+ let t = T(e.target.getStage());
1821
+ t && w(_.map((e, n) => n === _.length - 1 ? {
1822
+ ...e,
1823
+ points: [
1824
+ ...e.points,
1825
+ t.x,
1826
+ t.y
1827
+ ]
1828
+ } : e));
1829
+ }
1830
+ function O(e) {
1831
+ e.evt.preventDefault(), b(!1);
1832
+ }
1833
+ function k() {
1834
+ b(!1), w([]), u?.();
1835
+ }
1836
+ return /* @__PURE__ */ s("div", {
1837
+ "aria-label": e,
1838
+ className: ["operation-work-area", c === "operation-worksheet" ? "operation-work-area--operation-worksheet" : c === "division-worksheet" ? "operation-work-area--division-worksheet" : ""].filter(Boolean).join(" "),
1839
+ ref: g,
1840
+ children: [/* @__PURE__ */ o(te, {
1841
+ className: ["operation-work-area__stage", c === "operation-worksheet" ? "operation-work-area__stage--operation-worksheet" : c === "division-worksheet" ? "operation-work-area__stage--division-worksheet" : ""].filter(Boolean).join(" "),
1842
+ height: x.height,
1843
+ onPointerCancel: O,
1844
+ onPointerDown: E,
1845
+ onPointerMove: D,
1846
+ onPointerUp: O,
1847
+ role: "img",
1848
+ width: x.width,
1849
+ children: /* @__PURE__ */ s(ee, {
1850
+ scaleX: x.scale,
1851
+ scaleY: x.scale,
1852
+ children: [
1853
+ /* @__PURE__ */ o(P, {
1854
+ cornerRadius: 22,
1855
+ fill: "#fff",
1856
+ height: m,
1857
+ stroke: "#cfe3d9",
1858
+ strokeWidth: 2,
1859
+ width: Z,
1860
+ x: 0,
1861
+ y: 0
1862
+ }),
1863
+ c === "division-worksheet" ? /* @__PURE__ */ o(Gt, {
1864
+ dividend: n?.dividend,
1865
+ divisor: n?.divisor,
1866
+ height: m,
1867
+ width: Z
1868
+ }) : c === "operation-worksheet" ? /* @__PURE__ */ o(Wt, {
1869
+ height: m,
1870
+ operation: d,
1871
+ width: Z
1872
+ }) : c === "squared" ? /* @__PURE__ */ s(a, { children: [Array.from({ length: 13 }, (e, t) => /* @__PURE__ */ o(N, {
1873
+ points: [
1874
+ 0,
1875
+ t * 24,
1876
+ Z,
1877
+ t * 24
1878
+ ],
1879
+ stroke: t % 4 == 0 ? "#4e68ff" : "#89d9ff",
1880
+ strokeWidth: t % 4 == 0 ? 2 : 1
1881
+ }, `square-y-${t}`)), Array.from({ length: 13 }, (e, t) => /* @__PURE__ */ o(N, {
1882
+ points: [
1883
+ t * 75,
1884
+ 0,
1885
+ t * 75,
1886
+ Bt
1887
+ ],
1888
+ stroke: "#4e68ff",
1889
+ strokeWidth: 1.5
1890
+ }, `square-x-${t}`))] }) : Array.from({ length: 6 }, (e, t) => /* @__PURE__ */ o(N, {
1891
+ dash: [8, 12],
1892
+ points: [
1893
+ 28,
1894
+ 58 + t * 40,
1895
+ Z - 28,
1896
+ 58 + t * 40
1897
+ ],
1898
+ stroke: "#edf3ef",
1899
+ strokeWidth: 2
1900
+ }, `line-${t}`)),
1901
+ C && f ? /* @__PURE__ */ o(F, {
1902
+ align: "center",
1903
+ fill: "#8fa39a",
1904
+ fontFamily: "Arial, sans-serif",
1905
+ fontSize: 24,
1906
+ fontStyle: "bold",
1907
+ height: m,
1908
+ text: f,
1909
+ verticalAlign: "middle",
1910
+ width: Z,
1911
+ x: 0,
1912
+ y: 0
1913
+ }) : null,
1914
+ _.map((e) => /* @__PURE__ */ o(N, {
1915
+ globalCompositeOperation: "source-over",
1916
+ lineCap: "round",
1917
+ lineJoin: "round",
1918
+ points: e.points,
1919
+ stroke: e.color,
1920
+ strokeWidth: e.strokeWidth,
1921
+ tension: .28
1922
+ }, e.id))
1923
+ ]
1924
+ })
1925
+ }), /* @__PURE__ */ o("button", {
1926
+ "aria-label": "مسح خطوات العملية",
1927
+ className: "operation-work-area__clear",
1928
+ disabled: C,
1929
+ onClick: k,
1930
+ type: "button",
1931
+ children: /* @__PURE__ */ o(h, { "aria-hidden": "true" })
1932
+ })]
1933
+ });
1934
+ }
1935
+ function Wt({ height: e, operation: t, width: n }) {
1936
+ let r = n - 166 - 94;
1937
+ return /* @__PURE__ */ s(a, { children: [
1938
+ Array.from({ length: Math.floor(e / 24) + 1 }, (e, t) => /* @__PURE__ */ o(N, {
1939
+ points: [
1940
+ 0,
1941
+ t * 24,
1942
+ n,
1943
+ t * 24
1944
+ ],
1945
+ stroke: t % 4 == 0 ? "#4e68ff" : "#89d9ff",
1946
+ strokeWidth: t % 4 == 0 ? 2 : 1
1947
+ }, `worksheet-y-${t}`)),
1948
+ Array.from({ length: 13 }, (t, n) => /* @__PURE__ */ o(N, {
1949
+ points: [
1950
+ n * 75,
1951
+ 0,
1952
+ n * 75,
1953
+ e
1954
+ ],
1955
+ stroke: "#4e68ff",
1956
+ strokeWidth: 1.5
1957
+ }, `worksheet-x-${n}`)),
1958
+ /* @__PURE__ */ o(P, {
1959
+ cornerRadius: 16,
1960
+ fill: "rgba(255, 255, 255, 0.74)",
1961
+ height: 94,
1962
+ stroke: "#9fcbf6",
1963
+ strokeWidth: 2,
1964
+ width: r,
1965
+ x: 166,
1966
+ y: 42
1967
+ }),
1968
+ /* @__PURE__ */ o(P, {
1969
+ cornerRadius: 16,
1970
+ fill: "rgba(255, 255, 255, 0.74)",
1971
+ height: 94,
1972
+ stroke: "#9fcbf6",
1973
+ strokeWidth: 2,
1974
+ width: r,
1975
+ x: 166,
1976
+ y: 158
1977
+ }),
1978
+ /* @__PURE__ */ o(F, {
1979
+ align: "center",
1980
+ fill: "#111827",
1981
+ fontFamily: "Arial, sans-serif",
1982
+ fontSize: 74,
1983
+ fontStyle: "bold",
1984
+ height: 94,
1985
+ text: t,
1986
+ verticalAlign: "middle",
1987
+ width: 112,
1988
+ x: 34,
1989
+ y: 158
1990
+ }),
1991
+ /* @__PURE__ */ o(N, {
1992
+ lineCap: "round",
1993
+ points: [
1994
+ 134,
1995
+ 281,
1996
+ n - 70,
1997
+ 281
1998
+ ],
1999
+ stroke: "#111827",
2000
+ strokeWidth: 7
2001
+ }),
2002
+ /* @__PURE__ */ o(P, {
2003
+ cornerRadius: 16,
2004
+ fill: "rgba(255, 255, 255, 0.82)",
2005
+ height: 120,
2006
+ stroke: "#79b8ee",
2007
+ strokeWidth: 2.5,
2008
+ width: r,
2009
+ x: 166,
2010
+ y: 316
2011
+ })
2012
+ ] });
2013
+ }
2014
+ function Gt({ dividend: e, divisor: t, height: n, width: r }) {
2015
+ let i = r - 588 - 70;
2016
+ return /* @__PURE__ */ s(a, { children: [
2017
+ Array.from({ length: Math.floor(n / 24) + 1 }, (e, t) => /* @__PURE__ */ o(N, {
2018
+ points: [
2019
+ 0,
2020
+ t * 24,
2021
+ r,
2022
+ t * 24
2023
+ ],
2024
+ stroke: t % 4 == 0 ? "#4e68ff" : "#89d9ff",
2025
+ strokeWidth: t % 4 == 0 ? 2 : 1
2026
+ }, `division-y-${t}`)),
2027
+ Array.from({ length: 13 }, (e, t) => /* @__PURE__ */ o(N, {
2028
+ points: [
2029
+ t * 75,
2030
+ 0,
2031
+ t * 75,
2032
+ n
2033
+ ],
2034
+ stroke: "#4e68ff",
2035
+ strokeWidth: 1.5
2036
+ }, `division-x-${t}`)),
2037
+ /* @__PURE__ */ o(P, {
2038
+ cornerRadius: 16,
2039
+ fill: "rgba(255, 255, 255, 0.82)",
2040
+ height: 96,
2041
+ stroke: "#9fcbf6",
2042
+ strokeWidth: 2,
2043
+ width: i,
2044
+ x: 588,
2045
+ y: 274
2046
+ }),
2047
+ /* @__PURE__ */ o(N, {
2048
+ lineCap: "round",
2049
+ points: [
2050
+ 560,
2051
+ n - 44,
2052
+ 560,
2053
+ 154,
2054
+ r - 70,
2055
+ 154
2056
+ ],
2057
+ stroke: "#101827",
2058
+ strokeWidth: 6
2059
+ }),
2060
+ /* @__PURE__ */ o(P, {
2061
+ cornerRadius: 14,
2062
+ fill: "rgba(255, 255, 255, 0.64)",
2063
+ height: 76,
2064
+ stroke: "#9fcbf6",
2065
+ strokeWidth: 2,
2066
+ width: 470,
2067
+ x: 56,
2068
+ y: 170
2069
+ }),
2070
+ /* @__PURE__ */ o(P, {
2071
+ cornerRadius: 14,
2072
+ fill: "rgba(255, 255, 255, 0.64)",
2073
+ height: 76,
2074
+ stroke: "#9fcbf6",
2075
+ strokeWidth: 2,
2076
+ width: i,
2077
+ x: 588,
2078
+ y: 170
2079
+ }),
2080
+ e ? /* @__PURE__ */ o(F, {
2081
+ align: "center",
2082
+ fill: "#101827",
2083
+ fontFamily: "Arial, sans-serif",
2084
+ fontSize: 52,
2085
+ fontStyle: "bold",
2086
+ height: 76,
2087
+ text: e,
2088
+ verticalAlign: "middle",
2089
+ width: 470,
2090
+ x: 56,
2091
+ y: 170
2092
+ }) : null,
2093
+ t ? /* @__PURE__ */ o(F, {
2094
+ align: "center",
2095
+ fill: "#101827",
2096
+ fontFamily: "Arial, sans-serif",
2097
+ fontSize: 52,
2098
+ fontStyle: "bold",
2099
+ height: 76,
2100
+ text: t,
2101
+ verticalAlign: "middle",
2102
+ width: i,
2103
+ x: 588,
2104
+ y: 170
2105
+ }) : null,
2106
+ /* @__PURE__ */ o(P, {
2107
+ cornerRadius: 18,
2108
+ fill: "rgba(255, 255, 255, 0.58)",
2109
+ height: n - 294,
2110
+ stroke: "#9fcbf6",
2111
+ strokeWidth: 2,
2112
+ width: 470,
2113
+ x: 56,
2114
+ y: 268
2115
+ })
2116
+ ] });
2117
+ }
2118
+ function Kt(e) {
2119
+ return e?.elements?.filter((e) => e.type === "freehand") ?? [];
2120
+ }
2121
+ //#endregion
1764
2122
  //#region src/voice/evaluateVoiceAiResult.ts
1765
- var zt = {
2123
+ var qt = {
1766
2124
  audioConfig: {
1767
2125
  bitDepth: 16,
1768
2126
  channels: 1,
@@ -1772,18 +2130,18 @@ var zt = {
1772
2130
  lang: "fr",
1773
2131
  useModelAi: !0
1774
2132
  };
1775
- function Bt(e, t, n) {
1776
- let r = Wt([t, ...n.acceptedPronunciations ?? []]), i = r.map(Vt), a = Vt(e.transcript), o = i.map((e, t) => ({
2133
+ function Jt(e, t, n) {
2134
+ let r = Qt([t, ...n.acceptedPronunciations ?? []]), i = r.map(Yt), a = Yt(e.transcript), o = i.map((e, t) => ({
1777
2135
  index: t,
1778
- similarity: Ut(a, e)
2136
+ similarity: Zt(a, e)
1779
2137
  })).reduce((e, t) => t.similarity > e.similarity ? t : e, {
1780
2138
  index: -1,
1781
2139
  similarity: 0
1782
- }), s = o.index >= 0 ? r[o.index] : null, c = o.similarity === 1, l = Gt(n.minimumSimilarity ?? Ht(s), 0, 1), u = e.language === n.expectedLanguage, d = a.length > 0, f = d && u && o.similarity >= l, p = d ? u ? f ? "correct" : "incorrect" : "language-mismatch" : "no-speech";
2140
+ }), s = o.index >= 0 ? r[o.index] : null, c = o.similarity === 1, l = $t(n.minimumSimilarity ?? Xt(s), 0, 1), u = e.language === n.expectedLanguage, d = a.length > 0, f = d && u && o.similarity >= l, p = d ? u ? f ? "correct" : "incorrect" : "language-mismatch" : "no-speech";
1783
2141
  return {
1784
2142
  acceptedPronunciations: r,
1785
2143
  confidence: e.confidence,
1786
- confidencePercent: Math.round(Gt(e.confidence, 0, 1) * 100),
2144
+ confidencePercent: Math.round($t(e.confidence, 0, 1) * 100),
1787
2145
  detectedPronunciation: e.transcript,
1788
2146
  expectedLanguage: n.expectedLanguage,
1789
2147
  expectedText: t,
@@ -1802,13 +2160,13 @@ function Bt(e, t, n) {
1802
2160
  timestamps: e.timestamps ?? []
1803
2161
  };
1804
2162
  }
1805
- function Vt(e) {
2163
+ function Yt(e) {
1806
2164
  return e.toLocaleLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[\u064b-\u065f\u0670]/g, "").replace(/[|]+/g, " ").replace(/[^\p{Letter}\p{Number}\s]/gu, " ").replace(/\s+/g, " ").trim();
1807
2165
  }
1808
- function Ht(e) {
1809
- return (e ? Vt(e).length : 0) <= 4 ? 1 : .85;
2166
+ function Xt(e) {
2167
+ return (e ? Yt(e).length : 0) <= 4 ? 1 : .85;
1810
2168
  }
1811
- function Ut(e, t) {
2169
+ function Zt(e, t) {
1812
2170
  let n = Array.from(e), r = Array.from(t), i = Math.max(n.length, r.length);
1813
2171
  if (i === 0) return 0;
1814
2172
  let a = Array.from({ length: r.length + 1 }, (e, t) => t);
@@ -1820,22 +2178,22 @@ function Ut(e, t) {
1820
2178
  }
1821
2179
  a.splice(0, a.length, ...t);
1822
2180
  }
1823
- return Gt(1 - a[r.length] / i, 0, 1);
2181
+ return $t(1 - a[r.length] / i, 0, 1);
1824
2182
  }
1825
- function Wt(e) {
2183
+ function Qt(e) {
1826
2184
  let t = /* @__PURE__ */ new Set();
1827
2185
  return e.filter((e) => {
1828
- let n = Vt(e);
2186
+ let n = Yt(e);
1829
2187
  return !n || t.has(n) ? !1 : (t.add(n), !0);
1830
2188
  });
1831
2189
  }
1832
- function Gt(e, t, n) {
2190
+ function $t(e, t, n) {
1833
2191
  return Math.min(n, Math.max(t, e));
1834
2192
  }
1835
2193
  //#endregion
1836
2194
  //#region src/exam-session/interactions/PronunciationRecorder.tsx
1837
- function Kt({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc: l, instruction: u, language: d, minimumSimilarity: f, onChange: p, onReset: m, recorder: h, value: g }) {
1838
- let [_, v] = i("idle"), [b, x] = i(null), [S, w] = i(0), T = r(null), E = r(!1), D = n(() => g ? Bt(g.result.modelAiResult, a, {
2195
+ function en({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc: l, instruction: u, language: d, minimumSimilarity: f, onChange: p, onReset: m, recorder: h, value: g }) {
2196
+ let [_, v] = i("idle"), [b, x] = i(null), [S, T] = i(0), E = r(null), D = r(!1), O = n(() => g ? Jt(g.result.modelAiResult, a, {
1839
2197
  acceptedPronunciations: e,
1840
2198
  expectedLanguage: d,
1841
2199
  minimumSimilarity: f
@@ -1849,54 +2207,54 @@ function Kt({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc:
1849
2207
  t(() => {
1850
2208
  if (_ !== "recording") return;
1851
2209
  let e = window.setInterval(() => {
1852
- let e = T.current;
1853
- e !== null && w(Date.now() - e);
2210
+ let e = E.current;
2211
+ e !== null && T(Date.now() - e);
1854
2212
  }, 200);
1855
2213
  return () => window.clearInterval(e);
1856
2214
  }, [_]), t(() => () => {
1857
- E.current && h?.stopRecording().catch(() => void 0);
2215
+ D.current && h?.stopRecording().catch(() => void 0);
1858
2216
  }, [h]);
1859
- async function O() {
2217
+ async function k() {
1860
2218
  if (_ !== "recording") {
1861
2219
  v("checking"), x(null), m();
1862
2220
  try {
1863
2221
  if (!h) throw Error("مُسجِّل الصَّوت غَير مُتاحٍ فِي هذا التَّطبِيق.");
1864
2222
  let e = {
1865
- ...zt,
2223
+ ...qt,
1866
2224
  lang: d,
1867
2225
  maxDuration: 10
1868
2226
  };
1869
2227
  if (!(await h.startRecording(e)).started) throw Error("تعذّر بدء التسجيل الصوتي.");
1870
- E.current = !0, T.current = Date.now(), w(0), v("recording");
2228
+ D.current = !0, E.current = Date.now(), T(0), v("recording");
1871
2229
  } catch (e) {
1872
- E.current = !1, T.current = null, x(Xt(e)), v("error");
2230
+ D.current = !1, E.current = null, x(on(e)), v("error");
1873
2231
  }
1874
2232
  }
1875
2233
  }
1876
- async function k() {
2234
+ async function A() {
1877
2235
  if (_ === "recording") {
1878
2236
  v("processing"), x(null);
1879
2237
  try {
1880
2238
  if (!h) throw Error("مُسجِّل الصَّوت غَير مُتاحٍ فِي هذا التَّطبِيق.");
1881
- let t = await h.stopRecording(), n = Bt(t.modelAiResult, a, {
2239
+ let t = await h.stopRecording(), n = Jt(t.modelAiResult, a, {
1882
2240
  acceptedPronunciations: e,
1883
2241
  expectedLanguage: d,
1884
2242
  minimumSimilarity: f
1885
2243
  });
1886
- E.current = !1, T.current = null, w(t.duration), p({
2244
+ D.current = !1, E.current = null, T(t.duration), p({
1887
2245
  evaluation: n,
1888
2246
  kind: "audio-recording",
1889
2247
  result: t
1890
2248
  }), v("idle");
1891
2249
  } catch (e) {
1892
- E.current = !1, T.current = null, x(Xt(e)), v("error");
2250
+ D.current = !1, E.current = null, x(on(e)), v("error");
1893
2251
  }
1894
2252
  }
1895
2253
  }
1896
- function A() {
1897
- x(null), w(0), v("idle"), m();
2254
+ function j() {
2255
+ x(null), T(0), v("idle"), m();
1898
2256
  }
1899
- let j = _ === "checking" || _ === "processing", te = _ === "recording" ? S : g?.result.duration ?? S;
2257
+ let M = _ === "checking" || _ === "processing", ee = _ === "recording" ? S : g?.result.duration ?? S;
1900
2258
  return /* @__PURE__ */ s("div", {
1901
2259
  className: "audio-debug-card",
1902
2260
  "data-status": _,
@@ -1914,7 +2272,7 @@ function Kt({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc:
1914
2272
  children: [
1915
2273
  /* @__PURE__ */ s("span", { children: [
1916
2274
  "اُنْطِقِ الكَلِمَةَ بِـ",
1917
- Yt(d),
2275
+ an(d),
1918
2276
  ":"
1919
2277
  ] }),
1920
2278
  /* @__PURE__ */ o("strong", {
@@ -1932,31 +2290,31 @@ function Kt({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc:
1932
2290
  className: "audio-debug-card__icon",
1933
2291
  "aria-hidden": "true",
1934
2292
  children: /* @__PURE__ */ o(y, {})
1935
- }), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("strong", { children: Zt(_, !!g) }), /* @__PURE__ */ o("span", { children: Jt(te) })] })]
2293
+ }), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("strong", { children: sn(_, !!g) }), /* @__PURE__ */ o("span", { children: rn(ee) })] })]
1936
2294
  }),
1937
2295
  /* @__PURE__ */ s("div", {
1938
2296
  className: "audio-debug-actions",
1939
2297
  children: [
1940
2298
  /* @__PURE__ */ s("button", {
1941
2299
  className: "audio-debug-button audio-debug-button--record",
1942
- disabled: _ === "recording" || j,
1943
- onClick: O,
2300
+ disabled: _ === "recording" || M,
2301
+ onClick: k,
1944
2302
  type: "button",
1945
2303
  children: [/* @__PURE__ */ o(y, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: g ? "سَجِّلْ مُحاوَلَةً جَدِيدَةً" : "اِبْدَأِ التَّسْجِيلَ" })]
1946
2304
  }),
1947
2305
  /* @__PURE__ */ s("button", {
1948
2306
  className: "audio-debug-button audio-debug-button--stop",
1949
2307
  disabled: _ !== "recording",
1950
- onClick: k,
2308
+ onClick: A,
1951
2309
  type: "button",
1952
- children: [/* @__PURE__ */ o(C, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: "أَنْهِ التَّسْجِيلَ" })]
2310
+ children: [/* @__PURE__ */ o(w, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: "أَنْهِ التَّسْجِيلَ" })]
1953
2311
  }),
1954
2312
  /* @__PURE__ */ s("button", {
1955
2313
  className: "audio-debug-button audio-debug-button--reset",
1956
- disabled: _ === "recording" || j || !g && !b,
1957
- onClick: A,
2314
+ disabled: _ === "recording" || M || !g && !b,
2315
+ onClick: j,
1958
2316
  type: "button",
1959
- children: [/* @__PURE__ */ o(ee, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: "إِعادَةُ المُحاوَلَةِ" })]
2317
+ children: [/* @__PURE__ */ o(C, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: "إِعادَةُ المُحاوَلَةِ" })]
1960
2318
  })
1961
2319
  ]
1962
2320
  }),
@@ -1965,40 +2323,40 @@ function Kt({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc:
1965
2323
  role: "alert",
1966
2324
  children: b
1967
2325
  }) : null,
1968
- g && D ? /* @__PURE__ */ s("section", {
2326
+ g && O ? /* @__PURE__ */ s("section", {
1969
2327
  className: "audio-pronunciation-feedback",
1970
- "data-outcome": D.status,
2328
+ "data-outcome": O.status,
1971
2329
  "data-testid": "pronunciation-feedback",
1972
2330
  role: "status",
1973
2331
  children: [/* @__PURE__ */ s("div", {
1974
2332
  className: "audio-pronunciation-feedback__headline",
1975
- children: [/* @__PURE__ */ o(qt, { status: D.status }), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("strong", { children: Qt(D.status) }), /* @__PURE__ */ o("span", { children: $t(D.status, a) })] })]
2333
+ children: [/* @__PURE__ */ o(tn, { status: O.status }), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("strong", { children: cn(O.status) }), /* @__PURE__ */ o("span", { children: ln(O.status, a) })] })]
1976
2334
  }), /* @__PURE__ */ s("div", {
1977
2335
  className: "audio-debug-metadata",
1978
2336
  children: [
1979
- /* @__PURE__ */ o(Z, {
2337
+ /* @__PURE__ */ o(nn, {
1980
2338
  label: "ما تَعَرَّفَ عَلَيْهِ النَّمُوذَجُ",
1981
- value: D.detectedPronunciation || "—"
2339
+ value: O.detectedPronunciation || "—"
1982
2340
  }),
1983
- /* @__PURE__ */ o(Z, {
2341
+ /* @__PURE__ */ o(nn, {
1984
2342
  label: "نِسْبَةُ التَّطابُقِ",
1985
- value: `${D.similarityPercent}%`
2343
+ value: `${O.similarityPercent}%`
1986
2344
  }),
1987
- /* @__PURE__ */ o(Z, {
2345
+ /* @__PURE__ */ o(nn, {
1988
2346
  label: "ثِقَةُ النَّمُوذَجِ",
1989
- value: `${D.confidencePercent}%`
2347
+ value: `${O.confidencePercent}%`
1990
2348
  }),
1991
- /* @__PURE__ */ o(Z, {
2349
+ /* @__PURE__ */ o(nn, {
1992
2350
  label: "اللُّغَةُ",
1993
- value: D.language.toUpperCase()
2351
+ value: O.language.toUpperCase()
1994
2352
  }),
1995
- /* @__PURE__ */ o(Z, {
2353
+ /* @__PURE__ */ o(nn, {
1996
2354
  label: "زَمَنُ التَّحْلِيلِ",
1997
- value: `${D.latencyMs} ms`
2355
+ value: `${O.latencyMs} ms`
1998
2356
  }),
1999
- /* @__PURE__ */ o(Z, {
2357
+ /* @__PURE__ */ o(nn, {
2000
2358
  label: "عَدَدُ الرُّمُوزِ الصَّوْتِيَّةِ",
2001
- value: D.timestamps.length.toString()
2359
+ value: O.timestamps.length.toString()
2002
2360
  })
2003
2361
  ]
2004
2362
  })]
@@ -2006,10 +2364,10 @@ function Kt({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc:
2006
2364
  ]
2007
2365
  });
2008
2366
  }
2009
- function qt({ status: e }) {
2010
- return o(e === "correct" ? f : e === "no-speech" ? D : O, { "aria-hidden": "true" });
2367
+ function tn({ status: e }) {
2368
+ return o(e === "correct" ? f : e === "no-speech" ? O : k, { "aria-hidden": "true" });
2011
2369
  }
2012
- function Z({ label: e, value: t }) {
2370
+ function nn({ label: e, value: t }) {
2013
2371
  return /* @__PURE__ */ s("span", {
2014
2372
  className: "audio-debug-meta-card",
2015
2373
  children: [/* @__PURE__ */ o("small", { children: e }), /* @__PURE__ */ o("strong", {
@@ -2018,42 +2376,42 @@ function Z({ label: e, value: t }) {
2018
2376
  })]
2019
2377
  });
2020
2378
  }
2021
- function Jt(e) {
2379
+ function rn(e) {
2022
2380
  let t = Math.max(0, Math.round(e / 1e3)), n = Math.floor(t / 60), r = t % 60;
2023
2381
  return `${n.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}`;
2024
2382
  }
2025
- function Yt(e) {
2383
+ function an(e) {
2026
2384
  return e === "fr" ? "الفَرَنْسِيَّةِ" : "العَرَبِيَّةِ";
2027
2385
  }
2028
- function Xt(e) {
2386
+ function on(e) {
2029
2387
  let t = e;
2030
2388
  return t.code === "MISSING_PERMISSION" ? "يَجِبُ السَّماحُ بِاسْتِعْمالِ المِيكْرُوفُونِ لِتَسْجِيلِ الإِجابَةِ." : t.code === "MODEL_VOCAB_MISMATCH" ? "مَلَفُّ نَمُوذَجِ اللُّغَةِ لا يُطابِقُ قامُوسَهُ. يُرْجى تَصْحِيحُ مَلَفِّ النَّمُوذَجِ." : t.message ? t.message : typeof e == "string" ? e : "حَدَثَ خَطَأٌ أَثْناءَ تَسْجِيلِ الإِجابَةِ الصَّوْتِيَّةِ.";
2031
2389
  }
2032
- function Zt(e, t) {
2390
+ function sn(e, t) {
2033
2391
  return e === "checking" ? "جارِي تَجْهِيزُ المِيكْرُوفُونِ" : e === "recording" ? "جارِي التَّسْجِيلُ... تَكَلَّمِ الآنَ" : e === "processing" ? "جارِي تَحْلِيلُ النُّطْقِ" : e === "error" ? "تَعَذَّرَ تَحْلِيلُ التَّسْجِيلِ" : t ? "اِكْتَمَلَ تَحْلِيلُ الإِجابَةِ" : "المِيكْرُوفُونُ جاهِزٌ";
2034
2392
  }
2035
- function Qt(e) {
2393
+ function cn(e) {
2036
2394
  return e === "correct" ? "أَحْسَنْتَ! إِجابَةٌ صَحِيحَةٌ" : e === "no-speech" ? "لَمْ نَسْمَعْ كَلِمَةً واضِحَةً" : e === "language-mismatch" ? "اُسْتُعْمِلَ نَمُوذَجُ لُغَةٍ مُخْتَلِفَةٍ" : "حاوِلْ مَرَّةً أُخْرى";
2037
2395
  }
2038
- function $t(e, t) {
2396
+ function ln(e, t) {
2039
2397
  return e === "correct" ? `نَطَقْتَ «${t}» بِشَكْلٍ صَحِيحٍ.` : e === "no-speech" ? `قَرِّبْ فَمَكَ مِنَ المِيكْرُوفُونِ وَقُلْ «${t}».` : `اِسْتَمِعْ إِلى نُطْقِ «${t}» ثُمَّ أَعِدِ المُحاوَلَةَ.`;
2040
2398
  }
2041
2399
  //#endregion
2042
2400
  //#region src/exam-session/interactions/SortableAnswer.tsx
2043
- function en({ answerId: e, items: t, value: n, onChange: r }) {
2401
+ function un({ answerId: e, items: t, value: n, onChange: r }) {
2044
2402
  let i = new Map(t.map((e) => [e.id, e])), a = n?.itemIds.length === t.length ? n.itemIds.filter((e) => i.has(e)) : t.map((e) => e.id);
2045
2403
  return /* @__PURE__ */ o(c, {
2046
2404
  onDragEnd: (e) => {
2047
2405
  e.canceled || r({
2048
2406
  kind: "order",
2049
- itemIds: P(a, e).map((e) => e.toString())
2407
+ itemIds: I(a, e).map((e) => e.toString())
2050
2408
  });
2051
2409
  },
2052
2410
  children: /* @__PURE__ */ o("div", {
2053
2411
  className: "sortable-answer",
2054
2412
  children: a.map((t, n) => {
2055
2413
  let r = i.get(t);
2056
- return r ? /* @__PURE__ */ o(tn, {
2414
+ return r ? /* @__PURE__ */ o(dn, {
2057
2415
  group: e,
2058
2416
  index: n,
2059
2417
  item: r
@@ -2062,8 +2420,8 @@ function en({ answerId: e, items: t, value: n, onChange: r }) {
2062
2420
  })
2063
2421
  });
2064
2422
  }
2065
- function tn({ group: e, index: t, item: n }) {
2066
- let { ref: r, isDragging: i, isDropTarget: a } = F({
2423
+ function dn({ group: e, index: t, item: n }) {
2424
+ let { ref: r, isDragging: i, isDropTarget: a } = L({
2067
2425
  id: n.id,
2068
2426
  index: t,
2069
2427
  group: e,
@@ -2082,7 +2440,7 @@ function tn({ group: e, index: t, item: n }) {
2082
2440
  }
2083
2441
  //#endregion
2084
2442
  //#region src/exam-session/interactions/TextAnswer.tsx
2085
- function nn({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onChange: i }) {
2443
+ function fn({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onChange: i }) {
2086
2444
  return /* @__PURE__ */ o("input", {
2087
2445
  "aria-label": e,
2088
2446
  className: t,
@@ -2096,17 +2454,17 @@ function nn({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onCha
2096
2454
  }
2097
2455
  //#endregion
2098
2456
  //#region src/renderer/visualScene.tsx
2099
- var rn = {
2457
+ var pn = {
2100
2458
  apple: d,
2101
2459
  circle: p,
2102
2460
  flower: g,
2103
2461
  heart: _,
2104
2462
  hexagon: v,
2105
- square: C,
2106
- star: w,
2107
- sun: T,
2108
- triangle: E
2109
- }, an = {
2463
+ square: w,
2464
+ star: T,
2465
+ sun: E,
2466
+ triangle: D
2467
+ }, mn = {
2110
2468
  blue: "#4d89d9",
2111
2469
  gray: "#8c97a0",
2112
2470
  green: "#1f9d63",
@@ -2114,7 +2472,7 @@ var rn = {
2114
2472
  purple: "#8a63d2",
2115
2473
  red: "#eb5b5b",
2116
2474
  yellow: "#f2c641"
2117
- }, on = {
2475
+ }, hn = {
2118
2476
  "counter-rows": { rows: [{
2119
2477
  color: "yellow",
2120
2478
  count: 5,
@@ -2141,7 +2499,7 @@ var rn = {
2141
2499
  id: "star-row",
2142
2500
  state: "plain"
2143
2501
  }] }
2144
- }, sn = [
2502
+ }, gn = [
2145
2503
  {
2146
2504
  label: "Cercle",
2147
2505
  value: "circle"
@@ -2178,7 +2536,7 @@ var rn = {
2178
2536
  label: "Hexagone",
2179
2537
  value: "hexagon"
2180
2538
  }
2181
- ], cn = [
2539
+ ], _n = [
2182
2540
  {
2183
2541
  label: "Jaune",
2184
2542
  value: "yellow"
@@ -2207,20 +2565,20 @@ var rn = {
2207
2565
  label: "Gris",
2208
2566
  value: "gray"
2209
2567
  }
2210
- ], ln = [{
2568
+ ], vn = [{
2211
2569
  label: "Normal",
2212
2570
  value: "plain"
2213
2571
  }, {
2214
2572
  label: "Barre",
2215
2573
  value: "crossed"
2216
2574
  }];
2217
- function un(e) {
2218
- return { rows: on[e].rows.map((e) => ({ ...e })) };
2575
+ function yn(e) {
2576
+ return { rows: hn[e].rows.map((e) => ({ ...e })) };
2219
2577
  }
2220
- function dn(e) {
2221
- return an[e];
2578
+ function bn(e) {
2579
+ return mn[e];
2222
2580
  }
2223
- function fn({ scene: e }) {
2581
+ function xn({ scene: e }) {
2224
2582
  return /* @__PURE__ */ o("div", {
2225
2583
  className: "visual-panel visual-panel--custom",
2226
2584
  "aria-hidden": "true",
@@ -2228,7 +2586,7 @@ function fn({ scene: e }) {
2228
2586
  className: "visual-scene",
2229
2587
  children: e.rows.map((e) => /* @__PURE__ */ o("div", {
2230
2588
  className: "visual-scene-row",
2231
- children: Array.from({ length: Math.max(1, Math.floor(e.count) || 1) }, (t, n) => /* @__PURE__ */ o(pn, {
2589
+ children: Array.from({ length: Math.max(1, Math.floor(e.count) || 1) }, (t, n) => /* @__PURE__ */ o(Sn, {
2232
2590
  color: e.color,
2233
2591
  icon: e.icon,
2234
2592
  state: e.state
@@ -2237,26 +2595,26 @@ function fn({ scene: e }) {
2237
2595
  })
2238
2596
  });
2239
2597
  }
2240
- function pn({ color: e, icon: t, state: n }) {
2241
- let r = rn[t];
2598
+ function Sn({ color: e, icon: t, state: n }) {
2599
+ let r = pn[t];
2242
2600
  return /* @__PURE__ */ o("span", {
2243
2601
  className: n === "crossed" ? "visual-scene-icon visual-scene-icon--crossed" : "visual-scene-icon",
2244
- style: { color: dn(e) },
2602
+ style: { color: bn(e) },
2245
2603
  children: /* @__PURE__ */ o(r, { "aria-hidden": "true" })
2246
2604
  });
2247
2605
  }
2248
2606
  //#endregion
2249
2607
  //#region src/renderer/QuestionRenderer.tsx
2250
- function mn({ adapters: e, clearAnswer: t, question: n, getAnswer: r, updateAnswer: i }) {
2608
+ function Cn({ adapters: e, clearAnswer: t, question: n, getAnswer: r, updateAnswer: i }) {
2251
2609
  return /* @__PURE__ */ s("article", {
2252
2610
  className: `question-block question-block--${n.type}`,
2253
- children: [/* @__PURE__ */ o(gn, {
2611
+ children: [/* @__PURE__ */ o(Tn, {
2254
2612
  number: n.number,
2255
2613
  prompt: n.prompt
2256
- }), _n(n, r, i, t, e)]
2614
+ }), En(n, r, i, t, e)]
2257
2615
  });
2258
2616
  }
2259
- function hn({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswer: i }) {
2617
+ function wn({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswer: i }) {
2260
2618
  return /* @__PURE__ */ s("section", {
2261
2619
  className: `question-section question-section--${n.tone}`,
2262
2620
  children: [/* @__PURE__ */ s("header", {
@@ -2264,7 +2622,7 @@ function hn({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswe
2264
2622
  children: [
2265
2623
  /* @__PURE__ */ s("span", {
2266
2624
  className: "section-points",
2267
- children: [/* @__PURE__ */ o("small", { children: "ن" }), R(n)]
2625
+ children: [/* @__PURE__ */ o("small", { children: "ن" }), z(n)]
2268
2626
  }),
2269
2627
  /* @__PURE__ */ o("h3", { children: n.title }),
2270
2628
  /* @__PURE__ */ o("span", {
@@ -2274,7 +2632,7 @@ function hn({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswe
2274
2632
  ]
2275
2633
  }), /* @__PURE__ */ o("div", {
2276
2634
  className: "section-body",
2277
- children: n.questions.map((n) => /* @__PURE__ */ o(mn, {
2635
+ children: n.questions.map((n) => /* @__PURE__ */ o(Cn, {
2278
2636
  adapters: e,
2279
2637
  clearAnswer: t,
2280
2638
  getAnswer: r,
@@ -2284,17 +2642,17 @@ function hn({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswe
2284
2642
  })]
2285
2643
  });
2286
2644
  }
2287
- function gn({ number: e, prompt: t }) {
2645
+ function Tn({ number: e, prompt: t }) {
2288
2646
  return /* @__PURE__ */ s("div", {
2289
2647
  className: "question-prompt",
2290
2648
  children: [e > 0 ? /* @__PURE__ */ o("span", { children: e }) : null, /* @__PURE__ */ o("strong", { children: t })]
2291
2649
  });
2292
2650
  }
2293
- function _n(e, t, n, r, i) {
2651
+ function En(e, t, n, r, i) {
2294
2652
  switch (e.type) {
2295
2653
  case "inline-inputs": return /* @__PURE__ */ o("div", {
2296
2654
  className: "inline-equation-grid",
2297
- children: e.items.map((a) => vn({
2655
+ children: e.items.map((a) => Dn({
2298
2656
  adapters: i,
2299
2657
  className: "equation-card",
2300
2658
  clearAnswer: r,
@@ -2304,15 +2662,15 @@ function _n(e, t, n, r, i) {
2304
2662
  updateAnswer: n
2305
2663
  }))
2306
2664
  });
2307
- case "visual-choice": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(An, {
2665
+ case "visual-choice": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(Yn, {
2308
2666
  choices: e.choices,
2309
2667
  onChange: (t) => n(e.id, t),
2310
2668
  scene: e.scene,
2311
- value: xn(t(e.id)),
2669
+ value: An(t(e.id)),
2312
2670
  visual: e.visual
2313
2671
  }), e.inputLabel ? /* @__PURE__ */ s("div", {
2314
2672
  className: "compact-answer",
2315
- children: [/* @__PURE__ */ o("span", { children: e.inputLabel }), /* @__PURE__ */ o(G, {
2673
+ children: [/* @__PURE__ */ o("span", { children: e.inputLabel }), /* @__PURE__ */ o(q, {
2316
2674
  ariaLabel: e.inputLabel,
2317
2675
  onChange: (t) => n(`${e.id}:input`, t),
2318
2676
  onClear: () => r(`${e.id}:input`),
@@ -2320,7 +2678,7 @@ function _n(e, t, n, r, i) {
2320
2678
  value: Q(t(`${e.id}:input`))
2321
2679
  })]
2322
2680
  }) : null] });
2323
- case "number-line": return /* @__PURE__ */ o(Lt, {
2681
+ case "number-line": return /* @__PURE__ */ o(Rt, {
2324
2682
  answerId: e.id,
2325
2683
  expression: e.expression,
2326
2684
  onClear: r,
@@ -2328,9 +2686,31 @@ function _n(e, t, n, r, i) {
2328
2686
  recognizer: i?.handwritingRecognizer,
2329
2687
  value: Q(t(e.id))
2330
2688
  });
2689
+ case "operation-solving": {
2690
+ let a = Ln(e);
2691
+ return /* @__PURE__ */ s("div", {
2692
+ className: [
2693
+ "operation-solving",
2694
+ `operation-solving--${e.solutionMode}`,
2695
+ `operation-solving--${a}`
2696
+ ].join(" "),
2697
+ children: [a === "equation-card-grid" ? /* @__PURE__ */ o("div", {
2698
+ className: "operation-solving__equation-card",
2699
+ children: /* @__PURE__ */ o("span", { children: In(e) })
2700
+ }) : null, /* @__PURE__ */ o(Rn, {
2701
+ adapters: i,
2702
+ clearAnswer: r,
2703
+ getAnswer: t,
2704
+ question: e,
2705
+ showOperands: a === "vertical-operation",
2706
+ showWorkArea: a === "equation-card-grid",
2707
+ updateAnswer: n
2708
+ })]
2709
+ });
2710
+ }
2331
2711
  case "equation-inputs": return /* @__PURE__ */ o("div", {
2332
2712
  className: "stacked-equations",
2333
- children: e.items.map((a) => vn({
2713
+ children: e.items.map((a) => Dn({
2334
2714
  adapters: i,
2335
2715
  ariaPrefix: e.prompt,
2336
2716
  className: "wide-equation-card",
@@ -2341,7 +2721,7 @@ function _n(e, t, n, r, i) {
2341
2721
  updateAnswer: n
2342
2722
  }))
2343
2723
  });
2344
- case "length-estimation": return /* @__PURE__ */ o(jn, {
2724
+ case "length-estimation": return /* @__PURE__ */ o(Xn, {
2345
2725
  answerId: e.id,
2346
2726
  choices: e.choices,
2347
2727
  getAnswer: t,
@@ -2350,7 +2730,7 @@ function _n(e, t, n, r, i) {
2350
2730
  });
2351
2731
  case "shape-choice": return /* @__PURE__ */ s("div", {
2352
2732
  className: "shape-choice-layout",
2353
- children: [/* @__PURE__ */ o(Ve, {
2733
+ children: [/* @__PURE__ */ o(Be, {
2354
2734
  items: e.choices.map((e) => ({
2355
2735
  id: `${e.id}-label`,
2356
2736
  label: e.label
@@ -2358,24 +2738,24 @@ function _n(e, t, n, r, i) {
2358
2738
  onChange: (t) => n(e.id, t),
2359
2739
  targets: e.choices.map((e) => ({
2360
2740
  id: `${e.id}-target`,
2361
- label: On(e.id)
2741
+ label: qn(e.id)
2362
2742
  })),
2363
- value: xn(t(e.id))
2743
+ value: An(t(e.id))
2364
2744
  }), /* @__PURE__ */ o("div", {
2365
2745
  className: "shape-row",
2366
2746
  "aria-hidden": "true",
2367
2747
  children: e.choices.map((e) => /* @__PURE__ */ o("span", { className: `shape-drawing shape-drawing--${e.id}` }, e.id))
2368
2748
  })]
2369
2749
  });
2370
- case "drawing-grid": return /* @__PURE__ */ o(Nt, {
2750
+ case "drawing-grid": return /* @__PURE__ */ o(Pt, {
2371
2751
  onChange: (t) => n(e.id, t),
2372
2752
  points: e.points,
2373
- value: wn(t(e.id))
2753
+ value: Nn(t(e.id))
2374
2754
  });
2375
- case "table-response": return /* @__PURE__ */ o(Fe, {
2755
+ case "table-response": return /* @__PURE__ */ o(Pe, {
2376
2756
  columns: e.columns,
2377
2757
  onChange: (t) => n(e.id, t),
2378
- value: Tn(t(e.id))
2758
+ value: Pn(t(e.id))
2379
2759
  });
2380
2760
  case "text-input": return e.before && !e.after && e.number === 0 ? /* @__PURE__ */ o("p", {
2381
2761
  className: "problem-statement",
@@ -2384,7 +2764,7 @@ function _n(e, t, n, r, i) {
2384
2764
  className: "sentence-answer",
2385
2765
  children: [
2386
2766
  e.before ? /* @__PURE__ */ o("span", { children: e.before }) : null,
2387
- /* @__PURE__ */ o(G, {
2767
+ /* @__PURE__ */ o(q, {
2388
2768
  ariaLabel: e.prompt,
2389
2769
  onChange: (t) => n(e.id, t),
2390
2770
  onClear: () => r(e.id),
@@ -2401,7 +2781,7 @@ function _n(e, t, n, r, i) {
2401
2781
  children: e.situation
2402
2782
  }), /* @__PURE__ */ o("div", {
2403
2783
  className: "word-problem__parts",
2404
- children: e.parts.map((a, s) => /* @__PURE__ */ o(Dn, {
2784
+ children: e.parts.map((a, s) => /* @__PURE__ */ o(Kn, {
2405
2785
  adapters: i,
2406
2786
  clearAnswer: r,
2407
2787
  getAnswer: t,
@@ -2412,25 +2792,25 @@ function _n(e, t, n, r, i) {
2412
2792
  }, a.id))
2413
2793
  })]
2414
2794
  });
2415
- case "drag-match": return /* @__PURE__ */ o(Ve, {
2795
+ case "drag-match": return /* @__PURE__ */ o(Be, {
2416
2796
  items: e.items,
2417
2797
  onChange: (t) => n(e.id, t),
2418
2798
  targets: e.targets,
2419
- value: xn(t(e.id))
2799
+ value: An(t(e.id))
2420
2800
  });
2421
- case "sortable-answer": return /* @__PURE__ */ o(en, {
2801
+ case "sortable-answer": return /* @__PURE__ */ o(un, {
2422
2802
  answerId: e.id,
2423
2803
  items: e.items,
2424
2804
  onChange: (t) => n(e.id, t),
2425
- value: Sn(t(e.id))
2805
+ value: jn(t(e.id))
2426
2806
  });
2427
- case "label-placement": return /* @__PURE__ */ o(Pt, {
2807
+ case "label-placement": return /* @__PURE__ */ o(Ft, {
2428
2808
  labels: e.labels,
2429
2809
  onChange: (t) => n(e.id, t),
2430
2810
  targets: e.targets,
2431
- value: Cn(t(e.id))
2811
+ value: Mn(t(e.id))
2432
2812
  });
2433
- case "audio-recording": return /* @__PURE__ */ o(Kt, {
2813
+ case "audio-recording": return /* @__PURE__ */ o(en, {
2434
2814
  acceptedPronunciations: e.acceptedPronunciations,
2435
2815
  expectedText: e.expectedAnswer,
2436
2816
  imageAlt: e.imageAlt,
@@ -2441,16 +2821,16 @@ function _n(e, t, n, r, i) {
2441
2821
  onChange: (t) => n(e.id, t),
2442
2822
  onReset: () => r(e.id),
2443
2823
  recorder: i?.audioRecorder,
2444
- value: En(t(e.id))
2824
+ value: Fn(t(e.id))
2445
2825
  });
2446
2826
  }
2447
2827
  }
2448
- function vn({ adapters: t, ariaPrefix: n, className: r, clearAnswer: i, getAnswer: a, item: c, questionId: l, updateAnswer: u }) {
2828
+ function Dn({ adapters: t, ariaPrefix: n, className: r, clearAnswer: i, getAnswer: a, item: c, questionId: l, updateAnswer: u }) {
2449
2829
  if (c.answers?.length) return /* @__PURE__ */ s("div", {
2450
2830
  className: r,
2451
2831
  children: [c.answers.map((r) => {
2452
2832
  let d = `${l}:${c.id}:${r.id}`, f = [n, r.before].filter(Boolean).join(" ");
2453
- return /* @__PURE__ */ s(e, { children: [r.before ? /* @__PURE__ */ o("span", { children: r.before }) : null, /* @__PURE__ */ o(G, {
2833
+ return /* @__PURE__ */ s(e, { children: [r.before ? /* @__PURE__ */ o("span", { children: r.before }) : null, /* @__PURE__ */ o(q, {
2454
2834
  ariaLabel: f,
2455
2835
  onChange: (e) => u(d, e),
2456
2836
  onClear: () => i(d),
@@ -2468,7 +2848,7 @@ function vn({ adapters: t, ariaPrefix: n, className: r, clearAnswer: i, getAnswe
2468
2848
  className: r,
2469
2849
  children: [
2470
2850
  /* @__PURE__ */ o("span", { children: c.before }),
2471
- /* @__PURE__ */ o(G, {
2851
+ /* @__PURE__ */ o(q, {
2472
2852
  ariaLabel: [n, c.before].filter(Boolean).join(" "),
2473
2853
  onChange: (e) => u(d, e),
2474
2854
  onClear: () => i(d),
@@ -2479,49 +2859,208 @@ function vn({ adapters: t, ariaPrefix: n, className: r, clearAnswer: i, getAnswe
2479
2859
  ]
2480
2860
  }, c.id);
2481
2861
  }
2482
- function yn(e) {
2862
+ function On(e) {
2483
2863
  return e?.kind === "text" ? e : void 0;
2484
2864
  }
2485
2865
  function Q(e) {
2486
2866
  return e?.kind === "handwritten-number" ? e : void 0;
2487
2867
  }
2488
- function bn(e) {
2868
+ function kn(e) {
2489
2869
  return e?.kind === "choice" ? e : void 0;
2490
2870
  }
2491
- function xn(e) {
2871
+ function An(e) {
2492
2872
  return e?.kind === "matches" ? e : void 0;
2493
2873
  }
2494
- function Sn(e) {
2874
+ function jn(e) {
2495
2875
  return e?.kind === "order" ? e : void 0;
2496
2876
  }
2497
- function Cn(e) {
2877
+ function Mn(e) {
2498
2878
  return e?.kind === "placements" ? e : void 0;
2499
2879
  }
2500
- function wn(e) {
2880
+ function Nn(e) {
2501
2881
  return e?.kind === "drawing" ? e : void 0;
2502
2882
  }
2503
- function Tn(e) {
2883
+ function Pn(e) {
2504
2884
  return e?.kind === "coin-table" ? e : void 0;
2505
2885
  }
2506
- function En(e) {
2886
+ function Fn(e) {
2507
2887
  return e?.kind === "audio-recording" ? e : void 0;
2508
2888
  }
2509
- function Dn({ adapters: e, clearAnswer: t, getAnswer: n, parentQuestionId: r, part: i, partNumber: a, updateAnswer: c }) {
2889
+ function In(e) {
2890
+ return `${e.leftOperand} ${e.operator} ${e.rightOperand} =`;
2891
+ }
2892
+ function Ln(e) {
2893
+ return e.layout === "equation-card-grid" || e.solutionMode === "full-process" ? "equation-card-grid" : "vertical-operation";
2894
+ }
2895
+ function Rn({ adapters: e, clearAnswer: t, getAnswer: n, question: r, showOperands: i, showWorkArea: a, updateAnswer: c }) {
2896
+ if (r.operator === "÷") return /* @__PURE__ */ o(zn, {
2897
+ adapters: e,
2898
+ clearAnswer: t,
2899
+ getAnswer: n,
2900
+ question: r,
2901
+ showOperands: i,
2902
+ updateAnswer: c
2903
+ });
2904
+ if (a) return /* @__PURE__ */ o(Ut, {
2905
+ ariaLabel: "مساحة إنجاز العملية",
2906
+ gridVariant: "operation-worksheet",
2907
+ onChange: (e) => c(`${r.id}:work`, e),
2908
+ onClear: () => t(`${r.id}:work`),
2909
+ operation: r.operator,
2910
+ placeholder: "",
2911
+ value: Nn(n(`${r.id}:work`))
2912
+ });
2913
+ let l = Bn([
2914
+ r.leftOperand,
2915
+ r.rightOperand,
2916
+ r.correctAnswer
2917
+ ]), u = l.columns, d = a ? Gn(u) : u, f = Vn(r.leftOperand, l, d), p = Vn(r.rightOperand, l, d), m = Wn(r, u);
2918
+ return /* @__PURE__ */ s("div", {
2919
+ className: [
2920
+ "vertical-operation",
2921
+ i ? "vertical-operation--with-operands" : "vertical-operation--blank-operands",
2922
+ a ? "vertical-operation--with-work-area" : ""
2923
+ ].filter(Boolean).join(" "),
2924
+ style: { "--operation-columns": d },
2925
+ children: [
2926
+ a ? /* @__PURE__ */ o("div", {
2927
+ className: "vertical-operation__work-canvas",
2928
+ children: /* @__PURE__ */ o(Ut, {
2929
+ ariaLabel: "مساحة إنجاز العملية",
2930
+ gridVariant: "squared",
2931
+ onChange: (e) => c(`${r.id}:work`, e),
2932
+ onClear: () => t(`${r.id}:work`),
2933
+ placeholder: "",
2934
+ value: Nn(n(`${r.id}:work`))
2935
+ })
2936
+ }) : null,
2937
+ /* @__PURE__ */ s("div", {
2938
+ className: "vertical-operation__row",
2939
+ children: [/* @__PURE__ */ o("span", {
2940
+ className: "vertical-operation__operator",
2941
+ "aria-hidden": "true"
2942
+ }), f.map((e, t) => /* @__PURE__ */ o("span", {
2943
+ className: "vertical-operation__digit",
2944
+ children: i ? e : ""
2945
+ }, `left-${t}`))]
2946
+ }),
2947
+ /* @__PURE__ */ s("div", {
2948
+ className: "vertical-operation__row",
2949
+ children: [/* @__PURE__ */ o("span", {
2950
+ className: "vertical-operation__operator",
2951
+ children: r.operator
2952
+ }), p.map((e, t) => /* @__PURE__ */ o("span", {
2953
+ className: "vertical-operation__digit",
2954
+ children: i ? e : ""
2955
+ }, `right-${t}`))]
2956
+ }),
2957
+ /* @__PURE__ */ o("span", {
2958
+ className: "vertical-operation__rule",
2959
+ "aria-hidden": "true"
2960
+ }),
2961
+ /* @__PURE__ */ s("div", {
2962
+ className: "vertical-operation__answer-lane",
2963
+ children: [/* @__PURE__ */ o("span", {
2964
+ className: "vertical-operation__answer-label",
2965
+ children: "النَّتِيجَةُ"
2966
+ }), /* @__PURE__ */ o(q, {
2967
+ ariaLabel: "اكتب نتيجة العملية",
2968
+ canvasWidth: m,
2969
+ onChange: (e) => c(r.id, e),
2970
+ onClear: () => t(r.id),
2971
+ recognizer: e?.handwritingRecognizer,
2972
+ value: Q(n(r.id))
2973
+ })]
2974
+ })
2975
+ ]
2976
+ });
2977
+ }
2978
+ function zn({ adapters: e, clearAnswer: t, getAnswer: n, question: r, showOperands: i, updateAnswer: a }) {
2979
+ let c = Math.min(360, Math.max(180, Hn(r.correctAnswer).length * 88));
2980
+ return /* @__PURE__ */ s("div", {
2981
+ className: "division-operation",
2982
+ children: [/* @__PURE__ */ o(Ut, {
2983
+ ariaLabel: "مساحة إنجاز القسمة",
2984
+ divisionOperands: i ? {
2985
+ dividend: r.leftOperand,
2986
+ divisor: r.rightOperand
2987
+ } : void 0,
2988
+ gridVariant: "division-worksheet",
2989
+ onChange: (e) => a(`${r.id}:work`, e),
2990
+ onClear: () => t(`${r.id}:work`),
2991
+ placeholder: "",
2992
+ value: Nn(n(`${r.id}:work`))
2993
+ }), /* @__PURE__ */ o("div", {
2994
+ className: "division-operation__quotient",
2995
+ children: /* @__PURE__ */ o(q, {
2996
+ ariaLabel: "اكتب حاصل القسمة",
2997
+ canvasWidth: c,
2998
+ onChange: (e) => a(r.id, e),
2999
+ onClear: () => t(r.id),
3000
+ recognizer: e?.handwritingRecognizer,
3001
+ value: Q(n(r.id))
3002
+ })
3003
+ })]
3004
+ });
3005
+ }
3006
+ function Bn(e) {
3007
+ let t = e.map(Un), n = t.some((e) => e.separator.length > 0), r = Math.max(...t.map((e) => e.whole.length), 1), i = n ? Math.max(...t.map((e) => e.fraction.length), 0) : 0;
3008
+ return {
3009
+ columns: Math.max(n ? r + 1 + i : r, 2),
3010
+ fractionColumns: i,
3011
+ hasDecimal: n,
3012
+ wholeColumns: r
3013
+ };
3014
+ }
3015
+ function Vn(e, t, n = t.columns) {
3016
+ let r = Un(e), i = Math.max(0, t.wholeColumns - r.whole.length), a = t.hasDecimal ? [
3017
+ ...Array.from({ length: i }, () => ""),
3018
+ ...Array.from(r.whole),
3019
+ r.separator,
3020
+ ...Array.from(r.fraction),
3021
+ ...Array.from({ length: Math.max(0, t.fractionColumns - r.fraction.length) }, () => "")
3022
+ ] : [...Array.from({ length: i }, () => ""), ...Array.from(r.whole)];
3023
+ return [...Array.from({ length: Math.max(0, n - a.length) }, () => ""), ...a];
3024
+ }
3025
+ function Hn(e) {
3026
+ let t = e.trim();
3027
+ return t.length > 0 ? Array.from(t) : [""];
3028
+ }
3029
+ function Un(e) {
3030
+ let t = e.trim(), n = t.search(/[.,]/);
3031
+ return n < 0 ? {
3032
+ fraction: "",
3033
+ separator: "",
3034
+ whole: t
3035
+ } : {
3036
+ fraction: t.slice(n + 1),
3037
+ separator: t[n],
3038
+ whole: t.slice(0, n)
3039
+ };
3040
+ }
3041
+ function Wn(e, t) {
3042
+ let n = Hn(e.correctAnswer).length;
3043
+ return Math.min(640, Math.max(220, Math.max(t, n, 2) * 102));
3044
+ }
3045
+ function Gn(e) {
3046
+ return Math.max(e + 2, 5);
3047
+ }
3048
+ function Kn({ adapters: e, clearAnswer: t, getAnswer: n, parentQuestionId: r, part: i, partNumber: a, updateAnswer: c }) {
2510
3049
  let l = `${r}:${i.id}`;
2511
3050
  return /* @__PURE__ */ s("section", {
2512
3051
  className: "word-problem-part",
2513
3052
  children: [/* @__PURE__ */ s("div", {
2514
3053
  className: "word-problem-part__prompt",
2515
3054
  children: [/* @__PURE__ */ o("span", { children: a }), /* @__PURE__ */ o("strong", { children: i.prompt })]
2516
- }), i.type === "coin-table" ? /* @__PURE__ */ o(Fe, {
3055
+ }), i.type === "coin-table" ? /* @__PURE__ */ o(Pe, {
2517
3056
  columns: i.columns,
2518
3057
  onChange: (e) => c(l, e),
2519
- value: Tn(n(l))
3058
+ value: Pn(n(l))
2520
3059
  }) : /* @__PURE__ */ s("div", {
2521
3060
  className: "sentence-answer word-problem-part__sentence",
2522
3061
  children: [
2523
3062
  i.before ? /* @__PURE__ */ o("span", { children: i.before }) : null,
2524
- /* @__PURE__ */ o(G, {
3063
+ /* @__PURE__ */ o(q, {
2525
3064
  ariaLabel: i.prompt,
2526
3065
  onChange: (e) => c(l, e),
2527
3066
  onClear: () => t(l),
@@ -2533,12 +3072,12 @@ function Dn({ adapters: e, clearAnswer: t, getAnswer: n, parentQuestionId: r, pa
2533
3072
  })]
2534
3073
  });
2535
3074
  }
2536
- function On(e) {
3075
+ function qn(e) {
2537
3076
  return e === "triangle" ? "△" : e === "square" ? "□" : e === "rectangle" ? "▭" : e;
2538
3077
  }
2539
- var kn = "picture";
2540
- function An({ choices: e, onChange: n, scene: a, value: c, visual: l }) {
2541
- let u = r(null), d = r(null), f = r(null), p = r({}), m = r(null), h = c?.pairs[kn], [g, _] = i(null), [v, y] = i(null);
3078
+ var Jn = "picture";
3079
+ function Yn({ choices: e, onChange: n, scene: a, value: c, visual: l }) {
3080
+ let u = r(null), d = r(null), f = r(null), p = r({}), m = r(null), h = c?.pairs[Jn], [g, _] = i(null), [v, y] = i(null);
2542
3081
  function b(e, t) {
2543
3082
  let n = d.current;
2544
3083
  if (n) {
@@ -2595,7 +3134,7 @@ function An({ choices: e, onChange: n, scene: a, value: c, visual: l }) {
2595
3134
  y2: n.y
2596
3135
  }));
2597
3136
  }
2598
- function ee(e) {
3137
+ function C(e) {
2599
3138
  let t = m.current;
2600
3139
  if (!t || t.pointerId !== e.pointerId) return;
2601
3140
  let n = b(e.clientX, e.clientY), r = x(f.current);
@@ -2606,23 +3145,23 @@ function An({ choices: e, onChange: n, scene: a, value: c, visual: l }) {
2606
3145
  y2: n.y
2607
3146
  });
2608
3147
  }
2609
- function C(e) {
3148
+ function w(e) {
2610
3149
  let t = m.current;
2611
3150
  if (!t || t.pointerId !== e.pointerId) return;
2612
3151
  e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId);
2613
- let r = T(e.clientX, e.clientY);
3152
+ let r = E(e.clientX, e.clientY);
2614
3153
  r && n({
2615
3154
  kind: "matches",
2616
- pairs: { [kn]: r }
3155
+ pairs: { [Jn]: r }
2617
3156
  }), m.current = null, y(null);
2618
3157
  }
2619
- function w(e, t, n) {
3158
+ function T(e, t, n) {
2620
3159
  if (!e) return !1;
2621
3160
  let r = e.getBoundingClientRect(), i = r.left + r.width / 2, a = r.top + r.height / 2;
2622
3161
  return Math.hypot(t - i, n - a) <= Math.max(42, Math.max(r.width, r.height) * 2.4);
2623
3162
  }
2624
- function T(t, n) {
2625
- return e.find((e) => w(p.current[e.id], t, n))?.id;
3163
+ function E(t, n) {
3164
+ return e.find((e) => T(p.current[e.id], t, n))?.id;
2626
3165
  }
2627
3166
  return /* @__PURE__ */ s("div", {
2628
3167
  className: "visual-line-match",
@@ -2648,13 +3187,13 @@ function An({ choices: e, onChange: n, scene: a, value: c, visual: l }) {
2648
3187
  }),
2649
3188
  /* @__PURE__ */ s("div", {
2650
3189
  className: "visual-match-picture",
2651
- children: [/* @__PURE__ */ o(fn, { scene: a ?? un(l) }), /* @__PURE__ */ o("button", {
3190
+ children: [/* @__PURE__ */ o(xn, { scene: a ?? yn(l) }), /* @__PURE__ */ o("button", {
2652
3191
  "aria-label": "اربط الصورة بالإجابة",
2653
3192
  className: h ? "visual-match-point visual-match-point--target visual-match-point--target-active" : "visual-match-point visual-match-point--target",
2654
- onPointerCancel: C,
3193
+ onPointerCancel: w,
2655
3194
  onPointerDown: S,
2656
- onPointerMove: ee,
2657
- onPointerUp: C,
3195
+ onPointerMove: C,
3196
+ onPointerUp: w,
2658
3197
  ref: f,
2659
3198
  type: "button"
2660
3199
  })]
@@ -2680,7 +3219,7 @@ function An({ choices: e, onChange: n, scene: a, value: c, visual: l }) {
2680
3219
  ]
2681
3220
  });
2682
3221
  }
2683
- function jn({ answerId: e, choices: t, getAnswer: n, items: a, updateAnswer: c }) {
3222
+ function Xn({ answerId: e, choices: t, getAnswer: n, items: a, updateAnswer: c }) {
2684
3223
  let l = Math.max(...a.map((e) => e.squareLength)) + 2, u = Qe(t), [d, f] = i(null), [p, m] = i(!1), [h, g] = i({}), _ = r(null);
2685
3224
  function v(e, t, n) {
2686
3225
  let r = d;
@@ -2723,7 +3262,7 @@ function jn({ answerId: e, choices: t, getAnswer: n, items: a, updateAnswer: c }
2723
3262
  "data-coloring": p ? "true" : "false",
2724
3263
  onPointerCancel: () => x(),
2725
3264
  onPointerUp: () => x(),
2726
- children: [/* @__PURE__ */ o(Je, {
3265
+ children: [/* @__PURE__ */ o(qe, {
2727
3266
  ariaLabel: "ألوان الأقلام",
2728
3267
  className: "length-color-picker",
2729
3268
  colors: u,
@@ -2732,7 +3271,7 @@ function jn({ answerId: e, choices: t, getAnswer: n, items: a, updateAnswer: c }
2732
3271
  }), /* @__PURE__ */ o("div", {
2733
3272
  className: "length-card-row",
2734
3273
  children: a.map((t) => {
2735
- let r = `${e}:squares:${t.id}`, i = `${e}:color:${t.id}`, a = bn(n(i)), d = h[t.id], f = d?.colorId ?? a?.choiceId, p = d?.fill ?? +!!a?.choiceId, m = f ? Ze(u, f) : "#9aa3a8", g = `${16 + Math.min(p, 1) * 68}%`;
3274
+ let r = `${e}:squares:${t.id}`, i = `${e}:color:${t.id}`, a = kn(n(i)), d = h[t.id], f = d?.colorId ?? a?.choiceId, p = d?.fill ?? +!!a?.choiceId, m = f ? Ze(u, f) : "#9aa3a8", g = `${16 + Math.min(p, 1) * 68}%`;
2736
3275
  return /* @__PURE__ */ s("div", {
2737
3276
  className: "length-card",
2738
3277
  children: [/* @__PURE__ */ o("div", {
@@ -2767,11 +3306,11 @@ function jn({ answerId: e, choices: t, getAnswer: n, items: a, updateAnswer: c }
2767
3306
  className: "length-value-row",
2768
3307
  children: [
2769
3308
  /* @__PURE__ */ o("span", { children: t.label }),
2770
- /* @__PURE__ */ o(nn, {
3309
+ /* @__PURE__ */ o(fn, {
2771
3310
  ariaLabel: `طول ${t.label} بالمربعات`,
2772
3311
  inputMode: "numeric",
2773
3312
  onChange: (e) => c(r, e),
2774
- value: yn(n(r))
3313
+ value: On(n(r))
2775
3314
  }),
2776
3315
  /* @__PURE__ */ o("span", { children: "مربعات" })
2777
3316
  ]
@@ -2783,7 +3322,7 @@ function jn({ answerId: e, choices: t, getAnswer: n, items: a, updateAnswer: c }
2783
3322
  }
2784
3323
  //#endregion
2785
3324
  //#region src/renderer/QuestionPreviewPanel.tsx
2786
- function Mn({ adapters: e, answers: t, onAnswersChange: n, question: r }) {
3325
+ function Zn({ adapters: e, answers: t, onAnswersChange: n, question: r }) {
2787
3326
  let [a, s] = i({}), c = t ?? a;
2788
3327
  function l(e) {
2789
3328
  if (t !== void 0) {
@@ -2806,7 +3345,7 @@ function Mn({ adapters: e, answers: t, onAnswersChange: n, question: r }) {
2806
3345
  }
2807
3346
  return /* @__PURE__ */ o("div", {
2808
3347
  className: "exam-renderer-preview",
2809
- children: /* @__PURE__ */ o(mn, {
3348
+ children: /* @__PURE__ */ o(Cn, {
2810
3349
  adapters: e,
2811
3350
  clearAnswer: d,
2812
3351
  getAnswer: (e) => c[e],
@@ -2817,7 +3356,7 @@ function Mn({ adapters: e, answers: t, onAnswersChange: n, question: r }) {
2817
3356
  }
2818
3357
  //#endregion
2819
3358
  //#region src/renderer/PrintableExamDocument.tsx
2820
- var Nn = {
3359
+ var Qn = {
2821
3360
  ariaLabel: "معلومات المؤسسة",
2822
3361
  logoAlt: "شعار المملكة المغربية",
2823
3362
  logoSrc: "/logo/morocco-logo.png",
@@ -2828,39 +3367,39 @@ var Nn = {
2828
3367
  "المديرية الإقليمية"
2829
3368
  ]
2830
3369
  };
2831
- function Pn({ exam: e, locale: t = "fr", variant: n }) {
2832
- let r = nr(t), i = Vn(e);
3370
+ function $n({ exam: e, locale: t = "fr", variant: n }) {
3371
+ let r = Ar(t), i = or(e);
2833
3372
  return /* @__PURE__ */ s("article", {
2834
3373
  className: `printable-exam printable-exam--${n}`,
2835
- dir: tr(t) ? "rtl" : "ltr",
3374
+ dir: kr(t) ? "rtl" : "ltr",
2836
3375
  children: [/* @__PURE__ */ s("div", {
2837
3376
  className: "printable-exam__top",
2838
3377
  children: [/* @__PURE__ */ s("header", {
2839
3378
  className: "printable-exam__header",
2840
3379
  children: [/* @__PURE__ */ s("div", {
2841
3380
  className: "printable-exam__title-row",
2842
- children: [/* @__PURE__ */ o(Bn, { totalPoints: i }), /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("h1", { children: e.title }) })]
3381
+ children: [/* @__PURE__ */ o(ar, { totalPoints: i }), /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("h1", { children: e.title }) })]
2843
3382
  }), /* @__PURE__ */ s("div", {
2844
3383
  className: "printable-exam__meta",
2845
3384
  children: [
2846
- /* @__PURE__ */ o(zn, {
3385
+ /* @__PURE__ */ o(ir, {
2847
3386
  label: r.duration,
2848
3387
  value: e.timer
2849
3388
  }),
2850
- /* @__PURE__ */ o(zn, {
3389
+ /* @__PURE__ */ o(ir, {
2851
3390
  label: r.level,
2852
3391
  value: e.level
2853
3392
  }),
2854
- /* @__PURE__ */ o(zn, {
2855
- label: tr(t) ? "المادة" : r.subject ?? "Matiere",
3393
+ /* @__PURE__ */ o(ir, {
3394
+ label: kr(t) ? "المادة" : r.subject ?? "Matiere",
2856
3395
  value: e.subject
2857
3396
  })
2858
3397
  ]
2859
3398
  })]
2860
- }), /* @__PURE__ */ o(Fn, {})]
3399
+ }), /* @__PURE__ */ o(er, {})]
2861
3400
  }), /* @__PURE__ */ o("div", {
2862
3401
  className: "printable-exam__sections",
2863
- children: e.sections.map((e) => /* @__PURE__ */ o(In, {
3402
+ children: e.sections.map((e) => /* @__PURE__ */ o(tr, {
2864
3403
  locale: t,
2865
3404
  section: e,
2866
3405
  variant: n
@@ -2868,24 +3407,24 @@ function Pn({ exam: e, locale: t = "fr", variant: n }) {
2868
3407
  })]
2869
3408
  });
2870
3409
  }
2871
- function Fn() {
3410
+ function er() {
2872
3411
  return /* @__PURE__ */ s("section", {
2873
- "aria-label": Nn.ariaLabel,
3412
+ "aria-label": Qn.ariaLabel,
2874
3413
  className: "printable-institution-header",
2875
3414
  dir: "rtl",
2876
3415
  children: [
2877
3416
  /* @__PURE__ */ o("img", {
2878
- alt: Nn.logoAlt,
3417
+ alt: Qn.logoAlt,
2879
3418
  className: "printable-institution-header__logo",
2880
- src: Nn.logoSrc
3419
+ src: Qn.logoSrc
2881
3420
  }),
2882
- /* @__PURE__ */ o("h1", { children: Nn.title }),
2883
- Nn.lines.map((e) => /* @__PURE__ */ o("p", { children: e }, e))
3421
+ /* @__PURE__ */ o("h1", { children: Qn.title }),
3422
+ Qn.lines.map((e) => /* @__PURE__ */ o("p", { children: e }, e))
2884
3423
  ]
2885
3424
  });
2886
3425
  }
2887
- function In({ locale: e = "fr", section: t, variant: n }) {
2888
- let r = nr(e);
3426
+ function tr({ locale: e = "fr", section: t, variant: n }) {
3427
+ let r = Ar(e);
2889
3428
  return /* @__PURE__ */ s("section", {
2890
3429
  className: `printable-section printable-section--${t.tone}`,
2891
3430
  "data-variant": n,
@@ -2896,7 +3435,7 @@ function In({ locale: e = "fr", section: t, variant: n }) {
2896
3435
  className: "printable-section__score",
2897
3436
  children: /* @__PURE__ */ s("span", {
2898
3437
  className: "printable-section__obtained",
2899
- children: [/* @__PURE__ */ s("strong", { children: [/* @__PURE__ */ o("i", { "aria-hidden": "true" }), /* @__PURE__ */ s("b", { children: ["/ ", R(t)] })] }), /* @__PURE__ */ o("small", { children: r.obtainedNote })]
3438
+ children: [/* @__PURE__ */ s("strong", { children: [/* @__PURE__ */ o("i", { "aria-hidden": "true" }), /* @__PURE__ */ s("b", { children: ["/ ", z(t)] })] }), /* @__PURE__ */ o("small", { children: r.obtainedNote })]
2900
3439
  })
2901
3440
  }),
2902
3441
  /* @__PURE__ */ o("h2", { children: t.title }),
@@ -2907,7 +3446,7 @@ function In({ locale: e = "fr", section: t, variant: n }) {
2907
3446
  ]
2908
3447
  }), /* @__PURE__ */ o("div", {
2909
3448
  className: "printable-section__body",
2910
- children: t.questions.map((t) => /* @__PURE__ */ o(Ln, {
3449
+ children: t.questions.map((t) => /* @__PURE__ */ o(nr, {
2911
3450
  locale: e,
2912
3451
  question: t,
2913
3452
  variant: n
@@ -2915,8 +3454,8 @@ function In({ locale: e = "fr", section: t, variant: n }) {
2915
3454
  })]
2916
3455
  });
2917
3456
  }
2918
- function Ln({ locale: e = "fr", question: t, variant: n }) {
2919
- let r = nr(e), i = ae(t), a = i > 0 ? I(i) : "";
3457
+ function nr({ locale: e = "fr", question: t, variant: n }) {
3458
+ let r = Ar(e), i = re(t), a = i > 0 ? R(i) : "";
2920
3459
  return /* @__PURE__ */ s("article", {
2921
3460
  className: `printable-question printable-question--${t.type}`,
2922
3461
  children: [/* @__PURE__ */ o("div", {
@@ -2939,31 +3478,51 @@ function Ln({ locale: e = "fr", question: t, variant: n }) {
2939
3478
  }) : null
2940
3479
  ]
2941
3480
  })
2942
- }), Rn(t, n, r, e)]
3481
+ }), rr(t, n, r, e)]
2943
3482
  });
2944
3483
  }
2945
- function Rn(e, t, n, r) {
3484
+ function rr(e, t, n, r) {
2946
3485
  switch (e.type) {
2947
3486
  case "inline-inputs":
2948
3487
  case "equation-inputs": return /* @__PURE__ */ o("div", {
2949
3488
  className: "printable-equation-grid",
2950
3489
  children: e.items.map((e) => /* @__PURE__ */ o("div", {
2951
3490
  className: "printable-equation-card",
2952
- children: /* @__PURE__ */ o($n, { item: e })
3491
+ children: /* @__PURE__ */ o(Dr, { item: e })
2953
3492
  }, e.id))
2954
3493
  });
2955
3494
  case "number-line": return /* @__PURE__ */ s("div", {
2956
3495
  className: "printable-number-line-layout",
2957
3496
  children: [/* @__PURE__ */ s("div", {
2958
3497
  className: "printable-number-line-expression",
2959
- children: [/* @__PURE__ */ o("span", { children: e.expression }), /* @__PURE__ */ o(er, {})]
2960
- }), /* @__PURE__ */ o(Xn, {})]
3498
+ children: [/* @__PURE__ */ o("span", { children: e.expression }), /* @__PURE__ */ o(Or, {})]
3499
+ }), /* @__PURE__ */ o(wr, {})]
2961
3500
  });
3501
+ case "operation-solving": {
3502
+ let t = lr(e);
3503
+ return /* @__PURE__ */ s("div", {
3504
+ className: [
3505
+ "printable-operation-solving",
3506
+ `printable-operation-solving--${e.solutionMode}`,
3507
+ `printable-operation-solving--${t}`
3508
+ ].join(" "),
3509
+ children: [t === "equation-card-grid" ? /* @__PURE__ */ o(a, { children: /* @__PURE__ */ o("div", {
3510
+ className: "printable-operation-solving__equation",
3511
+ children: /* @__PURE__ */ o(cr, { question: e })
3512
+ }) }) : null, e.operator === "÷" ? /* @__PURE__ */ o(dr, {
3513
+ question: e,
3514
+ showOperands: t === "vertical-operation"
3515
+ }) : /* @__PURE__ */ o(ur, {
3516
+ question: e,
3517
+ showOperands: t === "vertical-operation"
3518
+ })]
3519
+ });
3520
+ }
2962
3521
  case "visual-choice": return /* @__PURE__ */ s("div", {
2963
3522
  className: "printable-visual-match",
2964
- children: [/* @__PURE__ */ o(Un, {
3523
+ children: [/* @__PURE__ */ o(_r, {
2965
3524
  choices: e.choices,
2966
- scene: e.scene ?? un(e.visual)
3525
+ scene: e.scene ?? yn(e.visual)
2967
3526
  }), e.inputLabel ? /* @__PURE__ */ s("div", {
2968
3527
  className: "printable-inline-answer",
2969
3528
  children: [/* @__PURE__ */ o("span", { children: e.inputLabel }), /* @__PURE__ */ o($, {})]
@@ -2973,9 +3532,9 @@ function Rn(e, t, n, r) {
2973
3532
  className: "printable-length-task",
2974
3533
  children: /* @__PURE__ */ o("div", {
2975
3534
  className: "printable-length-list",
2976
- children: e.items.map((e) => /* @__PURE__ */ o(Zn, {
3535
+ children: e.items.map((e) => /* @__PURE__ */ o(Tr, {
2977
3536
  item: e,
2978
- squareUnit: tr(r) ? "مربعات" : "carres",
3537
+ squareUnit: kr(r) ? "مربعات" : "carres",
2979
3538
  variant: t
2980
3539
  }, e.id))
2981
3540
  })
@@ -2987,7 +3546,7 @@ function Rn(e, t, n, r) {
2987
3546
  className: "printable-shape-bank",
2988
3547
  children: e.choices.map((e) => /* @__PURE__ */ o("div", {
2989
3548
  className: "printable-shape-card",
2990
- children: /* @__PURE__ */ o(Be, { shapeId: e.id })
3549
+ children: /* @__PURE__ */ o(ze, { shapeId: e.id })
2991
3550
  }, e.id))
2992
3551
  }),
2993
3552
  /* @__PURE__ */ o("div", {
@@ -2997,12 +3556,12 @@ function Rn(e, t, n, r) {
2997
3556
  children: [/* @__PURE__ */ s("span", { children: [t + 1, "."] }), /* @__PURE__ */ o("strong", { children: e.label })]
2998
3557
  }, e.id))
2999
3558
  }),
3000
- /* @__PURE__ */ o(Hn, { label: n.dragArea })
3559
+ /* @__PURE__ */ o(sr, { label: n.dragArea })
3001
3560
  ]
3002
3561
  });
3003
3562
  case "drawing-grid": return /* @__PURE__ */ o("div", {
3004
3563
  className: "printable-drawing-block",
3005
- children: /* @__PURE__ */ o(Yn, { points: e.points })
3564
+ children: /* @__PURE__ */ o(Cr, { points: e.points })
3006
3565
  });
3007
3566
  case "table-response": return /* @__PURE__ */ o("div", {
3008
3567
  className: "printable-table-response",
@@ -3036,13 +3595,13 @@ function Rn(e, t, n, r) {
3036
3595
  children: e.situation
3037
3596
  }), /* @__PURE__ */ o("div", {
3038
3597
  className: "printable-word-problem__parts",
3039
- children: e.parts.map((e, t) => /* @__PURE__ */ o(Qn, {
3598
+ children: e.parts.map((e, t) => /* @__PURE__ */ o(Er, {
3040
3599
  part: e,
3041
3600
  partNumber: t + 1
3042
3601
  }, e.id))
3043
3602
  })]
3044
3603
  });
3045
- case "drag-match": return /* @__PURE__ */ o(Gn, {
3604
+ case "drag-match": return /* @__PURE__ */ o(yr, {
3046
3605
  items: e.items,
3047
3606
  targets: e.targets
3048
3607
  });
@@ -3065,7 +3624,7 @@ function Rn(e, t, n, r) {
3065
3624
  case "label-placement": return /* @__PURE__ */ s("div", {
3066
3625
  className: "printable-label-placement",
3067
3626
  children: [
3068
- /* @__PURE__ */ o(Jn, { targets: e.targets }),
3627
+ /* @__PURE__ */ o(Sr, { targets: e.targets }),
3069
3628
  /* @__PURE__ */ o("div", {
3070
3629
  className: "printable-placement-labels",
3071
3630
  children: e.labels.map((e) => /* @__PURE__ */ o("span", {
@@ -3073,7 +3632,7 @@ function Rn(e, t, n, r) {
3073
3632
  children: /* @__PURE__ */ o("strong", { children: e.label })
3074
3633
  }, e.id))
3075
3634
  }),
3076
- /* @__PURE__ */ o(Hn, { label: n.placeLabels })
3635
+ /* @__PURE__ */ o(sr, { label: n.placeLabels })
3077
3636
  ]
3078
3637
  });
3079
3638
  case "audio-recording": return /* @__PURE__ */ s("div", {
@@ -3098,49 +3657,172 @@ function Rn(e, t, n, r) {
3098
3657
  });
3099
3658
  }
3100
3659
  }
3101
- function zn({ label: e, value: t }) {
3660
+ function ir({ label: e, value: t }) {
3102
3661
  return /* @__PURE__ */ s("div", {
3103
3662
  className: "printable-meta-pill",
3104
3663
  children: [/* @__PURE__ */ o("span", { children: e }), /* @__PURE__ */ o("strong", { children: t })]
3105
3664
  });
3106
3665
  }
3107
- function Bn({ totalPoints: e }) {
3666
+ function ar({ totalPoints: e }) {
3108
3667
  return /* @__PURE__ */ o("div", {
3109
3668
  className: "printable-note-box",
3110
3669
  children: /* @__PURE__ */ s("strong", { children: [/* @__PURE__ */ o("i", { "aria-hidden": "true" }), /* @__PURE__ */ s("b", { children: ["/ ", e] })] })
3111
3670
  });
3112
3671
  }
3113
- function Vn(e) {
3114
- let t = e.sections.filter((e) => e.isScored !== !1).map((e) => L(e)).filter((e) => Number.isFinite(e));
3672
+ function or(e) {
3673
+ let t = e.sections.filter((e) => e.isScored !== !1).map((e) => ae(e)).filter((e) => Number.isFinite(e));
3115
3674
  if (t.length === 0) return "";
3116
3675
  let n = t.reduce((e, t) => e + t, 0);
3117
3676
  return String(Number.isInteger(n) ? n : Number(n.toFixed(2)));
3118
3677
  }
3119
- function Hn({ label: e }) {
3678
+ function sr({ label: e }) {
3120
3679
  return /* @__PURE__ */ s("div", {
3121
3680
  className: "printable-hint-line",
3122
3681
  children: [/* @__PURE__ */ o("span", { children: e }), /* @__PURE__ */ o($, {})]
3123
3682
  });
3124
3683
  }
3125
- function Un({ choices: e, scene: t }) {
3684
+ function cr({ question: e }) {
3685
+ return /* @__PURE__ */ s(a, { children: [
3686
+ /* @__PURE__ */ o("span", { children: e.leftOperand }),
3687
+ /* @__PURE__ */ o(fr, {
3688
+ className: "printable-operation-solving__symbol",
3689
+ operator: e.operator
3690
+ }),
3691
+ /* @__PURE__ */ s("span", { children: [e.rightOperand, " ="] })
3692
+ ] });
3693
+ }
3694
+ function lr(e) {
3695
+ return e.layout === "equation-card-grid" || e.solutionMode === "full-process" ? "equation-card-grid" : "vertical-operation";
3696
+ }
3697
+ function ur({ question: e, showOperands: t }) {
3698
+ let n = mr([
3699
+ e.leftOperand,
3700
+ e.rightOperand,
3701
+ e.correctAnswer
3702
+ ]), r = n.columns, i = Math.max(r, 5), a = Math.max(r, pr(e.correctAnswer).length, 2), c = hr(e.leftOperand, n, i), l = hr(e.rightOperand, n, i);
3703
+ return /* @__PURE__ */ s("div", {
3704
+ className: ["printable-vertical-operation", t ? "printable-vertical-operation--with-operands" : "printable-vertical-operation--blank-operands"].filter(Boolean).join(" "),
3705
+ style: {
3706
+ "--operation-answer-columns": a,
3707
+ "--operation-columns": i
3708
+ },
3709
+ children: [
3710
+ /* @__PURE__ */ s("div", {
3711
+ className: "printable-vertical-operation__row",
3712
+ children: [/* @__PURE__ */ o("span", {
3713
+ className: "printable-vertical-operation__operator",
3714
+ "aria-hidden": "true"
3715
+ }), c.map((e, n) => /* @__PURE__ */ o("span", {
3716
+ className: "printable-vertical-operation__digit",
3717
+ children: t ? e : ""
3718
+ }, `left-${n}`))]
3719
+ }),
3720
+ /* @__PURE__ */ s("div", {
3721
+ className: "printable-vertical-operation__row",
3722
+ children: [/* @__PURE__ */ o(fr, {
3723
+ className: "printable-vertical-operation__operator",
3724
+ operator: e.operator
3725
+ }), l.map((e, n) => /* @__PURE__ */ o("span", {
3726
+ className: "printable-vertical-operation__digit",
3727
+ children: t ? e : ""
3728
+ }, `right-${n}`))]
3729
+ }),
3730
+ /* @__PURE__ */ o("span", {
3731
+ className: "printable-vertical-operation__rule",
3732
+ "aria-hidden": "true"
3733
+ }),
3734
+ /* @__PURE__ */ o("span", {
3735
+ className: "printable-vertical-operation__answer-lane",
3736
+ "aria-hidden": "true"
3737
+ })
3738
+ ]
3739
+ });
3740
+ }
3741
+ function dr({ question: e, showOperands: t }) {
3742
+ return /* @__PURE__ */ s("div", {
3743
+ className: "printable-division-operation",
3744
+ children: [
3745
+ /* @__PURE__ */ o("span", { className: "printable-division-operation__quotient" }),
3746
+ /* @__PURE__ */ s("div", {
3747
+ className: "printable-division-operation__bracket",
3748
+ children: [/* @__PURE__ */ o("span", {
3749
+ className: "printable-division-operation__dividend",
3750
+ children: t ? e.leftOperand : ""
3751
+ }), /* @__PURE__ */ o("span", {
3752
+ className: "printable-division-operation__divisor",
3753
+ children: t ? e.rightOperand : ""
3754
+ })]
3755
+ }),
3756
+ /* @__PURE__ */ o("span", { className: "printable-division-operation__work" })
3757
+ ]
3758
+ });
3759
+ }
3760
+ function fr({ className: e, operator: t }) {
3761
+ let n = t.trim();
3762
+ return /* @__PURE__ */ s("span", {
3763
+ "aria-hidden": "true",
3764
+ className: `${e} printable-operation-symbol printable-operation-symbol--${n === "+" ? "plus" : n === "-" || n === "−" || n === "–" ? "minus" : n === "÷" || n === "/" ? "divide" : "multiply"}`,
3765
+ children: [
3766
+ /* @__PURE__ */ o("i", { className: "printable-operation-symbol__stroke" }),
3767
+ /* @__PURE__ */ o("i", { className: "printable-operation-symbol__stroke" }),
3768
+ /* @__PURE__ */ o("i", { className: "printable-operation-symbol__stroke" })
3769
+ ]
3770
+ });
3771
+ }
3772
+ function pr(e) {
3773
+ let t = e.trim();
3774
+ return t.length > 0 ? Array.from(t) : [""];
3775
+ }
3776
+ function mr(e) {
3777
+ let t = e.map(gr), n = t.some((e) => e.separator.length > 0), r = Math.max(...t.map((e) => e.whole.length), 1), i = n ? Math.max(...t.map((e) => e.fraction.length), 0) : 0;
3778
+ return {
3779
+ columns: Math.max(n ? r + 1 + i : r, 2),
3780
+ fractionColumns: i,
3781
+ hasDecimal: n,
3782
+ wholeColumns: r
3783
+ };
3784
+ }
3785
+ function hr(e, t, n = t.columns) {
3786
+ let r = gr(e), i = Math.max(0, t.wholeColumns - r.whole.length), a = t.hasDecimal ? [
3787
+ ...Array.from({ length: i }, () => ""),
3788
+ ...Array.from(r.whole),
3789
+ r.separator,
3790
+ ...Array.from(r.fraction),
3791
+ ...Array.from({ length: Math.max(0, t.fractionColumns - r.fraction.length) }, () => "")
3792
+ ] : [...Array.from({ length: i }, () => ""), ...Array.from(r.whole)];
3793
+ return [...Array.from({ length: Math.max(0, n - a.length) }, () => ""), ...a];
3794
+ }
3795
+ function gr(e) {
3796
+ let t = e.trim(), n = t.search(/[.,]/);
3797
+ return n < 0 ? {
3798
+ fraction: "",
3799
+ separator: "",
3800
+ whole: t
3801
+ } : {
3802
+ fraction: t.slice(n + 1),
3803
+ separator: t[n],
3804
+ whole: t.slice(0, n)
3805
+ };
3806
+ }
3807
+ function _r({ choices: e, scene: t }) {
3126
3808
  return /* @__PURE__ */ o("div", {
3127
3809
  className: "printable-visual-match__preview",
3128
3810
  children: /* @__PURE__ */ s("div", {
3129
3811
  className: "visual-line-match printable-visual-line-match",
3130
3812
  children: [/* @__PURE__ */ s("div", {
3131
3813
  className: "visual-match-picture printable-visual-match-picture",
3132
- children: [/* @__PURE__ */ o(fn, { scene: t }), /* @__PURE__ */ o("span", {
3814
+ children: [/* @__PURE__ */ o(xn, { scene: t }), /* @__PURE__ */ o("span", {
3133
3815
  "aria-hidden": "true",
3134
3816
  className: "visual-match-point visual-match-point--target printable-match-point printable-match-point--target"
3135
3817
  })]
3136
3818
  }), /* @__PURE__ */ o("div", {
3137
3819
  className: "visual-line-match__answers printable-visual-line-match__answers",
3138
- children: e.map((e) => /* @__PURE__ */ o(Wn, { choice: e }, e.id))
3820
+ children: e.map((e) => /* @__PURE__ */ o(vr, { choice: e }, e.id))
3139
3821
  })]
3140
3822
  })
3141
3823
  });
3142
3824
  }
3143
- function Wn({ choice: e }) {
3825
+ function vr({ choice: e }) {
3144
3826
  return /* @__PURE__ */ s("div", {
3145
3827
  className: "visual-match-answer printable-visual-match-answer",
3146
3828
  children: [/* @__PURE__ */ o("span", {
@@ -3152,25 +3834,25 @@ function Wn({ choice: e }) {
3152
3834
  })]
3153
3835
  });
3154
3836
  }
3155
- function Gn({ items: e, targets: t }) {
3837
+ function yr({ items: e, targets: t }) {
3156
3838
  return /* @__PURE__ */ s("div", {
3157
3839
  className: "printable-drag-match-board",
3158
3840
  children: [/* @__PURE__ */ o("div", {
3159
3841
  className: "printable-drag-match-row printable-drag-match-row--answers",
3160
- children: e.map((e, t) => /* @__PURE__ */ o(qn, {
3842
+ children: e.map((e, t) => /* @__PURE__ */ o(xr, {
3161
3843
  index: t,
3162
3844
  item: e
3163
3845
  }, e.id))
3164
3846
  }), /* @__PURE__ */ o("div", {
3165
3847
  className: "printable-drag-match-row printable-drag-match-row--targets",
3166
- children: t.map((e, t) => /* @__PURE__ */ o(Kn, {
3848
+ children: t.map((e, t) => /* @__PURE__ */ o(br, {
3167
3849
  index: t,
3168
3850
  target: e
3169
3851
  }, e.id))
3170
3852
  })]
3171
3853
  });
3172
3854
  }
3173
- function Kn({ index: e, target: t }) {
3855
+ function br({ index: e, target: t }) {
3174
3856
  return /* @__PURE__ */ s("div", {
3175
3857
  className: "printable-drag-match-card printable-drag-match-card--target",
3176
3858
  children: [/* @__PURE__ */ o("span", {
@@ -3178,11 +3860,11 @@ function Kn({ index: e, target: t }) {
3178
3860
  children: String.fromCharCode(65 + e)
3179
3861
  }), /* @__PURE__ */ o("div", {
3180
3862
  className: "printable-drag-match-content",
3181
- children: t.shapeId ? /* @__PURE__ */ o(Be, { shapeId: t.shapeId }) : /* @__PURE__ */ o("strong", { children: t.label })
3863
+ children: t.shapeId ? /* @__PURE__ */ o(ze, { shapeId: t.shapeId }) : /* @__PURE__ */ o("strong", { children: t.label })
3182
3864
  })]
3183
3865
  });
3184
3866
  }
3185
- function qn({ index: e, item: t }) {
3867
+ function xr({ index: e, item: t }) {
3186
3868
  return /* @__PURE__ */ s("div", {
3187
3869
  className: "printable-drag-match-card printable-drag-match-card--answer",
3188
3870
  children: [/* @__PURE__ */ o("div", {
@@ -3194,7 +3876,7 @@ function qn({ index: e, item: t }) {
3194
3876
  })]
3195
3877
  });
3196
3878
  }
3197
- function Jn({ targets: e }) {
3879
+ function Sr({ targets: e }) {
3198
3880
  return /* @__PURE__ */ o("div", {
3199
3881
  className: "printable-placement-board",
3200
3882
  children: e.map((e, t) => /* @__PURE__ */ o("div", {
@@ -3207,7 +3889,7 @@ function Jn({ targets: e }) {
3207
3889
  }, e.id))
3208
3890
  });
3209
3891
  }
3210
- function Yn({ points: e }) {
3892
+ function Cr({ points: e }) {
3211
3893
  return /* @__PURE__ */ s("svg", {
3212
3894
  className: "printable-drawing-grid",
3213
3895
  viewBox: "0 0 1000 420",
@@ -3238,7 +3920,7 @@ function Yn({ points: e }) {
3238
3920
  ]
3239
3921
  });
3240
3922
  }
3241
- function Xn() {
3923
+ function wr() {
3242
3924
  return /* @__PURE__ */ s("svg", {
3243
3925
  className: "printable-number-line",
3244
3926
  viewBox: "0 0 420 90",
@@ -3262,7 +3944,7 @@ function Xn() {
3262
3944
  }, t))]
3263
3945
  });
3264
3946
  }
3265
- function Zn({ item: e, squareUnit: t, variant: n }) {
3947
+ function Tr({ item: e, squareUnit: t, variant: n }) {
3266
3948
  return /* @__PURE__ */ s("div", {
3267
3949
  className: "length-card printable-length-card",
3268
3950
  children: [/* @__PURE__ */ o("div", {
@@ -3291,13 +3973,13 @@ function Zn({ item: e, squareUnit: t, variant: n }) {
3291
3973
  className: "length-value-row printable-length-value-row",
3292
3974
  children: [
3293
3975
  /* @__PURE__ */ o("span", { children: e.label }),
3294
- /* @__PURE__ */ o(er, {}),
3976
+ /* @__PURE__ */ o(Or, {}),
3295
3977
  /* @__PURE__ */ o("span", { children: t })
3296
3978
  ]
3297
3979
  })]
3298
3980
  });
3299
3981
  }
3300
- function Qn({ part: e, partNumber: t }) {
3982
+ function Er({ part: e, partNumber: t }) {
3301
3983
  return /* @__PURE__ */ s("section", {
3302
3984
  className: "printable-word-problem__part",
3303
3985
  children: [/* @__PURE__ */ s("div", {
@@ -3326,10 +4008,10 @@ function Qn({ part: e, partNumber: t }) {
3326
4008
  })]
3327
4009
  });
3328
4010
  }
3329
- function $n({ item: t }) {
3330
- return t.answers?.length ? /* @__PURE__ */ s(a, { children: [t.answers.map((t) => /* @__PURE__ */ s(e, { children: [t.before ? /* @__PURE__ */ o("span", { children: t.before }) : null, /* @__PURE__ */ o(er, {})] }, t.id)), t.after ? /* @__PURE__ */ o("span", { children: t.after }) : null] }) : t.correctAnswer ? /* @__PURE__ */ s(a, { children: [
4011
+ function Dr({ item: t }) {
4012
+ return t.answers?.length ? /* @__PURE__ */ s(a, { children: [t.answers.map((t) => /* @__PURE__ */ s(e, { children: [t.before ? /* @__PURE__ */ o("span", { children: t.before }) : null, /* @__PURE__ */ o(Or, {})] }, t.id)), t.after ? /* @__PURE__ */ o("span", { children: t.after }) : null] }) : t.correctAnswer ? /* @__PURE__ */ s(a, { children: [
3331
4013
  /* @__PURE__ */ o("span", { children: t.before }),
3332
- /* @__PURE__ */ o(er, {}),
4014
+ /* @__PURE__ */ o(Or, {}),
3333
4015
  t.after ? /* @__PURE__ */ o("span", { children: t.after }) : null
3334
4016
  ] }) : /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("span", { children: t.before }), t.after ? /* @__PURE__ */ o("span", { children: t.after }) : null] });
3335
4017
  }
@@ -3339,17 +4021,17 @@ function $() {
3339
4021
  "aria-hidden": "true"
3340
4022
  });
3341
4023
  }
3342
- function er() {
4024
+ function Or() {
3343
4025
  return /* @__PURE__ */ o("span", {
3344
4026
  className: "printable-blank-box",
3345
4027
  "aria-hidden": "true"
3346
4028
  });
3347
4029
  }
3348
- function tr(e) {
4030
+ function kr(e) {
3349
4031
  return e.startsWith("ar");
3350
4032
  }
3351
- function nr(e) {
3352
- return tr(e) ? {
4033
+ function Ar(e) {
4034
+ return kr(e) ? {
3353
4035
  answerArea: "مساحة الجواب",
3354
4036
  countShort: "عدد",
3355
4037
  dragArea: "اربط أو اكتب الجواب",
@@ -3386,7 +4068,7 @@ function nr(e) {
3386
4068
  }
3387
4069
  //#endregion
3388
4070
  //#region src/exam-session/interactions/DraftSheet.tsx
3389
- function rr({ disabled: e, onChange: t, value: n }) {
4071
+ function jr({ disabled: e, onChange: t, value: n }) {
3390
4072
  let [r, a] = i(!1);
3391
4073
  return /* @__PURE__ */ o("aside", {
3392
4074
  className: "draft-sheet",
@@ -3422,7 +4104,7 @@ function rr({ disabled: e, onChange: t, value: n }) {
3422
4104
  }
3423
4105
  //#endregion
3424
4106
  //#region src/exam-session/interactions/SingleChoice.tsx
3425
- function ir({ answerId: e, choices: t, value: n, onChange: r }) {
4107
+ function Mr({ answerId: e, choices: t, value: n, onChange: r }) {
3426
4108
  return /* @__PURE__ */ o("div", {
3427
4109
  className: "choice-group",
3428
4110
  role: "radiogroup",
@@ -3447,4 +4129,4 @@ function ir({ answerId: e, choices: t, value: n, onChange: r }) {
3447
4129
  });
3448
4130
  }
3449
4131
  //#endregion
3450
- export { Fe as CoinTableResponse, Je as ColorPenPicker, K as DEFAULT_GEOMETRY_COLORS, zt as DEFAULT_NATIVE_VOICE_AI_CONFIG, rr as DraftSheet, Ve as DragMatch, hn as ExamSectionRenderer, ot as GeometryCanvas, G as HandwrittenNumberAnswer, Nt as KonvaDrawingGrid, Pt as LabelPlacement, Lt as NumberLineAnswer, Pn as PrintableExamDocument, Ln as PrintableQuestionRenderer, In as PrintableSectionRenderer, Kt as PronunciationRecorder, Mn as QuestionPreviewPanel, mn as QuestionRenderer, Be as ShapeGlyph, ir as SingleChoice, en as SortableAnswer, nn as TextAnswer, fn as VisualSceneGraphic, de as calculateExamResult, un as createVisualSceneFromVariant, Bt as evaluateVoiceAiResult, Re as examShapeOptions, I as formatScoreValue, Ze as getColorValue, Xe as getDefaultColorId, ze as getExamShapeLabel, ae as getQuestionMaxScore, L as getSectionMaxScore, R as getSectionMaxScoreLabel, dn as getVisualSceneColorValue, Qe as mapChoicesToGeometryColors, Vt as normalizeVoiceText, ie as parseScoreValue, oe as sectionHasQuestionScores, cn as visualSceneColorOptions, sn as visualSceneIconOptions, ln as visualSceneStateOptions, z as withDerivedSectionScore };
4132
+ export { Pe as CoinTableResponse, qe as ColorPenPicker, Je as DEFAULT_GEOMETRY_COLORS, qt as DEFAULT_NATIVE_VOICE_AI_CONFIG, jr as DraftSheet, Be as DragMatch, wn as ExamSectionRenderer, ot as GeometryCanvas, q as HandwrittenNumberAnswer, Pt as KonvaDrawingGrid, Ft as LabelPlacement, Rt as NumberLineAnswer, Ut as OperationWorkArea, $n as PrintableExamDocument, nr as PrintableQuestionRenderer, tr as PrintableSectionRenderer, en as PronunciationRecorder, Zn as QuestionPreviewPanel, Cn as QuestionRenderer, ze as ShapeGlyph, Mr as SingleChoice, un as SortableAnswer, fn as TextAnswer, xn as VisualSceneGraphic, ue as calculateExamResult, yn as createVisualSceneFromVariant, Jt as evaluateVoiceAiResult, Le as examShapeOptions, R as formatScoreValue, Ze as getColorValue, Xe as getDefaultColorId, Re as getExamShapeLabel, re as getQuestionMaxScore, ae as getSectionMaxScore, z as getSectionMaxScoreLabel, bn as getVisualSceneColorValue, Qe as mapChoicesToGeometryColors, Yt as normalizeVoiceText, ne as parseScoreValue, ie as sectionHasQuestionScores, _n as visualSceneColorOptions, gn as visualSceneIconOptions, vn as visualSceneStateOptions, B as withDerivedSectionScore };