alexsys-exam-renderer 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,21 +1,22 @@
1
- import { useEffect as e, useMemo as t, useRef as n, useState as r } from "react";
2
- import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
3
- import { DragDropProvider as s, useDraggable as c, useDroppable as l } from "@dnd-kit/react";
4
- import { CheckCircle2 as u, Eraser as d, Mic as f, PencilRuler as p, RotateCcw as m, Square as h, VolumeX as g, XCircle as _ } from "lucide-react";
5
- import { Arc as v, Circle as y, Group as b, Layer as x, Line as S, Rect as C, Stage as w, Text as T } from "react-konva";
6
- import { move as E } from "@dnd-kit/helpers";
7
- import { useSortable as D } from "@dnd-kit/react/sortable";
1
+ import { Fragment as e, useEffect as t, useMemo as n, useRef as r, useState as i } from "react";
2
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
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 P } from "react-konva";
6
+ import { move as F } from "@dnd-kit/helpers";
7
+ import { useSortable as I } from "@dnd-kit/react/sortable";
8
8
  //#region src/exam-session/examScoring.ts
9
- var O = 1e3, k = 500, A = 70;
10
- function j(e, t) {
11
- let n = e.sections.filter((e) => e.isScored !== !1).map((e) => M(e, t)), r = H(n, (e) => e.correctCount), i = H(n, (e) => e.incorrectCount), a = H(n, (e) => e.unansweredCount), o = i + a, s = H(n, (e) => e.totalUnits), c = U(H(n, (e) => e.maxScore)), l = U(H(n, (e) => e.score));
9
+ var re = 1e3, L = 600, R = 70;
10
+ function ie(e, t) {
11
+ let n = e.sections.filter((e) => e.isScored !== !1).map((e) => ae(e, t)), r = H(n, (e) => e.correctCount), i = H(n, (e) => e.incorrectCount), a = H(n, (e) => e.unansweredCount), o = i + a, s = H(n, (e) => e.totalUnits), c = we(H(n, (e) => e.maxScore)), l = we(H(n, (e) => e.score));
12
12
  return {
13
+ attentionWarningCount: 0,
13
14
  correctCount: r,
14
15
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
15
16
  incorrectCount: i,
16
17
  maxScore: c,
17
18
  notCorrectCount: o,
18
- percentage: c > 0 ? U(l / c * 100) : 0,
19
+ percentage: c > 0 ? we(l / c * 100) : 0,
19
20
  score: l,
20
21
  sections: n,
21
22
  subject: e.subject,
@@ -24,11 +25,11 @@ function j(e, t) {
24
25
  unansweredCount: a
25
26
  };
26
27
  }
27
- function M(e, t) {
28
- let n = e.questions.flatMap((e) => N(e, t)).map((t) => ({
28
+ function ae(e, t) {
29
+ let n = e.questions.flatMap((e) => oe(e, t)).map((t) => ({
29
30
  ...t,
30
31
  sectionId: e.id
31
- })), r = Number.parseFloat(e.points) || 0, i = V(n, "correct"), a = V(n, "incorrect"), o = V(n, "unanswered"), s = a + o, c = n.length > 0 ? r / n.length : 0;
32
+ })), r = Number.parseFloat(e.points) || 0, i = Ce(n, "correct"), a = Ce(n, "incorrect"), o = Ce(n, "unanswered"), s = a + o, c = n.length > 0 ? r / n.length : 0;
32
33
  return {
33
34
  badge: e.badge,
34
35
  correctCount: i,
@@ -36,7 +37,7 @@ function M(e, t) {
36
37
  incorrectCount: a,
37
38
  maxScore: r,
38
39
  notCorrectCount: s,
39
- score: U(i * c),
40
+ score: we(i * c),
40
41
  title: e.title,
41
42
  tone: e.tone,
42
43
  totalUnits: n.length,
@@ -44,77 +45,97 @@ function M(e, t) {
44
45
  units: n
45
46
  };
46
47
  }
47
- function N(e, t) {
48
+ function oe(e, t) {
48
49
  switch (e.type) {
49
50
  case "inline-inputs":
50
51
  case "equation-inputs": return e.items.flatMap((n) => {
52
+ if (n.answers?.length) return n.answers.flatMap((r) => {
53
+ if (!r.correctAnswer) return [];
54
+ let i = `${e.id}:${n.id}:${r.id}`;
55
+ return [B(i, e.id, r.before, r.correctAnswer, t[i])];
56
+ });
51
57
  if (!n.correctAnswer) return [];
52
58
  let r = `${e.id}:${n.id}`;
53
- return [P(r, e.id, n.before, n.correctAnswer, t[r])];
59
+ return [B(r, e.id, n.before, n.correctAnswer, t[r])];
60
+ });
61
+ case "number-line": return [B(e.id, e.id, e.expression, e.correctAnswer, t[e.id])];
62
+ case "operation-solving": return [B(e.id, e.id, se(e), e.correctAnswer, t[e.id])];
63
+ case "visual-choice": return ce(e.id, e.id, e.grading.pairs, t[e.id]);
64
+ case "length-estimation": return le(e, t);
65
+ case "shape-choice": return ce(e.id, e.id, e.grading.pairs, t[e.id]);
66
+ case "drag-match": return ce(e.id, e.id, e.grading?.pairs, t[e.id]);
67
+ case "drawing-grid": return [me(e, t[e.id])];
68
+ case "table-response": return de(e, t[e.id]);
69
+ case "text-input": return e.correctAnswer ? [B(e.id, e.id, e.prompt, e.correctAnswer, t[e.id])] : [];
70
+ case "word-problem": return e.parts.flatMap((n) => {
71
+ let r = `${e.id}:${n.id}`;
72
+ return n.type === "coin-table" ? fe(e.id, n, t[r]) : n.correctAnswer ? [B(r, e.id, n.prompt, n.correctAnswer, t[r])] : [];
54
73
  });
55
- case "number-line": return [P(e.id, e.id, e.expression, e.correctAnswer, t[e.id])];
56
- case "visual-choice": return te(e.id, e.id, e.grading.pairs, t[e.id]);
57
- case "length-estimation": return ne(e, t);
58
- case "shape-choice": return te(e.id, e.id, e.grading.pairs, t[e.id]);
59
- case "drag-match": return te(e.id, e.id, e.grading?.pairs, t[e.id]);
60
- case "drawing-grid": return [L(e, t[e.id])];
61
- case "table-response": return I(e, t[e.id]);
62
- case "text-input": return e.correctAnswer ? [P(e.id, e.id, e.prompt, e.correctAnswer, t[e.id])] : [];
63
74
  case "sortable-answer": return [];
64
- case "label-placement": return re(e.id, e.grading?.targetsByLabelId, t[e.id]);
65
- case "audio-recording": return [ee(e, t[e.id])];
75
+ case "label-placement": return pe(e.id, e.grading?.targetsByLabelId, t[e.id]);
76
+ case "audio-recording": return [z(e, t[e.id])];
66
77
  }
67
78
  }
68
- function ee(e, t) {
69
- return t?.kind === "audio-recording" ? z(e.id, e.id, e.expectedAnswer, t.evaluation.isCorrect ? "correct" : "incorrect") : z(e.id, e.id, e.expectedAnswer, "unanswered");
79
+ function z(e, t) {
80
+ return t?.kind === "audio-recording" ? V(e.id, e.id, e.expectedAnswer, t.evaluation.isCorrect ? "correct" : "incorrect") : V(e.id, e.id, e.expectedAnswer, "unanswered");
81
+ }
82
+ function se(e) {
83
+ return `${e.leftOperand} ${e.operator} ${e.rightOperand} =`;
70
84
  }
71
- function P(e, t, n, r, i) {
72
- return r ? i?.kind === "handwritten-number" ? i.strokes.length === 0 ? z(e, t, n, "unanswered") : z(e, t, n, i.recognizedValue && le(i.recognizedValue, r) ? "correct" : "incorrect") : i?.kind !== "text" || B(i.value) === "" ? z(e, t, n, "unanswered") : z(e, t, n, le(i.value, r) ? "correct" : "incorrect") : z(e, t, n, "incorrect");
85
+ function B(e, t, n, r, i) {
86
+ return r ? i?.kind === "handwritten-number" ? i.strokes.length === 0 ? V(e, t, n, "unanswered") : V(e, t, n, i.recognizedValue && xe(i.recognizedValue, r) ? "correct" : "incorrect") : i?.kind !== "text" || Se(i.value) === "" ? V(e, t, n, "unanswered") : V(e, t, n, xe(i.value, r) ? "correct" : "incorrect") : V(e, t, n, "incorrect");
73
87
  }
74
- function te(e, t, n, r) {
88
+ function ce(e, t, n, r) {
75
89
  return n ? Object.entries(n).map(([n, i]) => {
76
90
  let a = r?.kind === "matches" ? r.pairs[n] : void 0, o = a ? a === i ? "correct" : "incorrect" : "unanswered";
77
- return z(`${e}:${n}`, t, n, o);
91
+ return V(`${e}:${n}`, t, n, o);
78
92
  }) : [];
79
93
  }
80
- function ne(e, t) {
94
+ function le(e, t) {
81
95
  let n = e.items.map((n) => {
82
96
  let r = `${e.id}:squares:${n.id}`;
83
- return P(r, e.id, n.label, n.squareLength.toString(), t[r]);
97
+ return B(r, e.id, n.label, n.squareLength.toString(), t[r]);
84
98
  }), r = e.items.flatMap((n) => {
85
99
  if (!n.correctColorId) return [];
86
100
  let r = `${e.id}:color:${n.id}`;
87
- return [F(r, e.id, n.label, n.correctColorId, t[r])];
101
+ return [ue(r, e.id, n.label, n.correctColorId, t[r])];
88
102
  });
89
103
  return n.concat(r);
90
104
  }
91
- function F(e, t, n, r, i) {
92
- return i?.kind !== "choice" || !i.choiceId ? z(e, t, n, "unanswered") : z(e, t, n, i.choiceId === r ? "correct" : "incorrect");
105
+ function ue(e, t, n, r, i) {
106
+ return i?.kind !== "choice" || !i.choiceId ? V(e, t, n, "unanswered") : V(e, t, n, i.choiceId === r ? "correct" : "incorrect");
93
107
  }
94
- function I(e, t) {
108
+ function de(e, t) {
95
109
  return e.columns.flatMap((n) => {
96
110
  if (typeof n.correctCount != "number") return [];
97
111
  let r = t?.kind === "coin-table" ? t.counts[n.id] : void 0, i = r === void 0 ? "unanswered" : r === n.correctCount ? "correct" : "incorrect";
98
- return z(`${e.id}:${n.id}`, e.id, n.title, i);
112
+ return V(`${e.id}:${n.id}`, e.id, n.title, i);
113
+ });
114
+ }
115
+ function fe(e, t, n) {
116
+ return t.columns.flatMap((r) => {
117
+ if (typeof r.correctCount != "number") return [];
118
+ let i = n?.kind === "coin-table" ? n.counts[r.id] : void 0, a = i === void 0 ? "unanswered" : i === r.correctCount ? "correct" : "incorrect";
119
+ return V(`${e}:${t.id}:${r.id}`, e, r.title, a);
99
120
  });
100
121
  }
101
- function re(e, t, n) {
122
+ function pe(e, t, n) {
102
123
  return t ? Object.entries(t).map(([t, r]) => {
103
124
  let i = n?.kind === "placements" ? n.placements[t]?.targetId : void 0, a = i ? i === r ? "correct" : "incorrect" : "unanswered";
104
- return z(`${e}:${t}`, e, t, a);
125
+ return V(`${e}:${t}`, e, t, a);
105
126
  }) : [];
106
127
  }
107
- function L(e, t) {
128
+ function me(e, t) {
108
129
  let n = e.grading.expectedSegments, r = t?.kind === "drawing" && ((t.elements?.length ?? 0) > 0 || (t.strokes?.length ?? 0) > 0);
109
- if (t?.kind !== "drawing" || !r) return z(e.id, e.id, e.prompt, "unanswered");
110
- let i = n.every((n) => ie(t, e, n));
111
- return z(e.id, e.id, e.prompt, i ? "correct" : "incorrect");
130
+ if (t?.kind !== "drawing" || !r) return V(e.id, e.id, e.prompt, "unanswered");
131
+ let i = n.every((n) => he(t, e, n));
132
+ return V(e.id, e.id, e.prompt, i ? "correct" : "incorrect");
112
133
  }
113
- function ie(e, t, n) {
114
- let r = R(t, n.from), i = R(t, n.to);
115
- return !r || !i ? !1 : ae(e).some((e) => oe(e, r, i));
134
+ function he(e, t, n) {
135
+ let r = ye(t, n.from), i = ye(t, n.to);
136
+ return !r || !i ? !1 : ge(e).some((e) => _e(e, r, i));
116
137
  }
117
- function ae(e) {
138
+ function ge(e) {
118
139
  let t = e.elements.flatMap((e) => e.type === "line" ? [{
119
140
  end: {
120
141
  x: e.points[2],
@@ -148,31 +169,31 @@ function ae(e) {
148
169
  }]) ?? [];
149
170
  return t.concat(n);
150
171
  }
151
- function oe(e, t, n) {
152
- let r = W(e.start, t) <= A && W(e.end, n) <= A, i = W(e.start, n) <= A && W(e.end, t) <= A;
153
- return !r && !i ? !1 : se(e.points, t, n, A);
172
+ function _e(e, t, n) {
173
+ let r = U(e.start, t) <= R && U(e.end, n) <= R, i = U(e.start, n) <= R && U(e.end, t) <= R;
174
+ return !r && !i ? !1 : ve(e.points, t, n, R);
154
175
  }
155
- function se(e, t, n, r) {
156
- for (let i = 0; i < e.length - 1; i += 4) if (ue({
176
+ function ve(e, t, n, r) {
177
+ for (let i = 0; i < e.length - 1; i += 4) if (Te({
157
178
  x: e[i],
158
179
  y: e[i + 1]
159
180
  }, t, n) > r) return !1;
160
181
  return !0;
161
182
  }
162
- function R(e, t) {
183
+ function ye(e, t) {
163
184
  if ("pointId" in t) {
164
185
  let n = e.points.find((e) => e.id === t.pointId);
165
- return n ? ce(n.x, n.y) : null;
186
+ return n ? be(n.x, n.y) : null;
166
187
  }
167
- return ce(t.percentX, t.percentY);
188
+ return be(t.percentX, t.percentY);
168
189
  }
169
- function ce(e, t) {
190
+ function be(e, t) {
170
191
  return {
171
- x: e / 100 * O,
172
- y: t / 100 * k
192
+ x: e / 100 * re,
193
+ y: t / 100 * L
173
194
  };
174
195
  }
175
- function z(e, t, n, r) {
196
+ function V(e, t, n, r) {
176
197
  return {
177
198
  id: e,
178
199
  label: n,
@@ -180,41 +201,41 @@ function z(e, t, n, r) {
180
201
  status: r
181
202
  };
182
203
  }
183
- function le(e, t) {
184
- let n = B(e), r = B(t), i = Number(n), a = Number(r);
204
+ function xe(e, t) {
205
+ let n = Se(e), r = Se(t), i = Number(n), a = Number(r);
185
206
  return Number.isFinite(i) && Number.isFinite(a) ? i === a : n === r;
186
207
  }
187
- function B(e) {
208
+ function Se(e) {
188
209
  return e.trim().replace(/[٠-٩]/g, (e) => `${e.charCodeAt(0) - 1632}`).replace(/[۰-۹]/g, (e) => `${e.charCodeAt(0) - 1776}`);
189
210
  }
190
- function V(e, t) {
211
+ function Ce(e, t) {
191
212
  return e.filter((e) => e.status === t).length;
192
213
  }
193
214
  function H(e, t) {
194
215
  return e.reduce((e, n) => e + t(n), 0);
195
216
  }
196
- function U(e) {
217
+ function we(e) {
197
218
  return Math.round(e * 100) / 100;
198
219
  }
199
- function W(e, t) {
220
+ function U(e, t) {
200
221
  return Math.hypot(e.x - t.x, e.y - t.y);
201
222
  }
202
- function ue(e, t, n) {
223
+ function Te(e, t, n) {
203
224
  let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
204
- if (a === 0) return W(e, t);
225
+ if (a === 0) return U(e, t);
205
226
  let o = Math.max(0, Math.min(1, ((e.x - t.x) * r + (e.y - t.y) * i) / a));
206
- return W(e, {
227
+ return U(e, {
207
228
  x: t.x + o * r,
208
229
  y: t.y + o * i
209
230
  });
210
231
  }
211
232
  //#endregion
212
233
  //#region src/exam-session/interactions/CoinTableResponse.tsx
213
- var de = 0, fe = 12;
214
- function pe({ columns: e, value: t, onChange: n }) {
234
+ var Ee = 0, De = 12;
235
+ function Oe({ columns: e, value: t, onChange: n }) {
215
236
  let r = t?.counts ?? {};
216
237
  function i(e, t) {
217
- let i = e.maxCoins ?? fe, a = Math.max(de, Math.min(i, t));
238
+ let i = e.maxCoins ?? De, a = Math.max(Ee, Math.min(i, t));
218
239
  n({
219
240
  kind: "coin-table",
220
241
  counts: {
@@ -223,52 +244,52 @@ function pe({ columns: e, value: t, onChange: n }) {
223
244
  }
224
245
  });
225
246
  }
226
- return /* @__PURE__ */ a("div", {
247
+ return /* @__PURE__ */ o("div", {
227
248
  className: "response-table",
228
249
  children: e.map((e) => {
229
- let t = r[e.id] ?? 0, n = e.maxCoins ?? fe;
230
- return /* @__PURE__ */ o("div", {
250
+ let t = r[e.id] ?? 0, n = e.maxCoins ?? De;
251
+ return /* @__PURE__ */ s("div", {
231
252
  className: "response-column",
232
253
  children: [
233
- /* @__PURE__ */ a("h4", { children: e.title }),
234
- /* @__PURE__ */ o("div", {
254
+ /* @__PURE__ */ o("h4", { children: e.title }),
255
+ /* @__PURE__ */ s("div", {
235
256
  className: "coin-table-area",
236
257
  "aria-label": e.answerLabel,
237
- children: [/* @__PURE__ */ a("div", {
258
+ children: [/* @__PURE__ */ o("div", {
238
259
  className: "coin-list",
239
260
  "aria-hidden": "true",
240
- children: Array.from({ length: t }, (t, n) => /* @__PURE__ */ a("span", {
261
+ children: Array.from({ length: t }, (t, n) => /* @__PURE__ */ o("span", {
241
262
  className: "coin-shape",
242
263
  children: "د"
243
264
  }, `${e.id}-coin-${n}`))
244
- }), /* @__PURE__ */ o("div", {
265
+ }), /* @__PURE__ */ s("div", {
245
266
  className: "coin-controls",
246
- children: [/* @__PURE__ */ a("button", {
267
+ children: [/* @__PURE__ */ o("button", {
247
268
  className: "coin-action",
248
269
  disabled: t >= n,
249
270
  onClick: () => i(e, t + 1),
250
271
  type: "button",
251
272
  children: "إِضافَةٌ"
252
- }), /* @__PURE__ */ a("button", {
273
+ }), /* @__PURE__ */ o("button", {
253
274
  className: "coin-action coin-action--secondary",
254
- disabled: t <= de,
275
+ disabled: t <= Ee,
255
276
  onClick: () => i(e, t - 1),
256
277
  type: "button",
257
278
  children: "حَذْفٌ"
258
279
  })]
259
280
  })]
260
281
  }),
261
- /* @__PURE__ */ o("label", {
282
+ /* @__PURE__ */ s("label", {
262
283
  className: "coin-count-answer",
263
284
  children: [
264
- /* @__PURE__ */ a("span", { children: e.answerLabel }),
265
- /* @__PURE__ */ a("input", {
285
+ /* @__PURE__ */ o("span", { children: e.answerLabel }),
286
+ /* @__PURE__ */ o("input", {
266
287
  "aria-label": e.answerLabel,
267
288
  inputMode: "numeric",
268
289
  onChange: (t) => i(e, Number(t.target.value) || 0),
269
290
  value: t
270
291
  }),
271
- /* @__PURE__ */ a("span", { children: "دَراهِمُ" })
292
+ /* @__PURE__ */ o("span", { children: "دَراهِمُ" })
272
293
  ]
273
294
  })
274
295
  ]
@@ -277,10 +298,48 @@ function pe({ columns: e, value: t, onChange: n }) {
277
298
  });
278
299
  }
279
300
  //#endregion
301
+ //#region src/renderer/shapeCatalog.tsx
302
+ var ke = {
303
+ circle: p,
304
+ diamond: m,
305
+ heart: _,
306
+ hexagon: v,
307
+ pentagon: x,
308
+ rectangle: S,
309
+ square: C,
310
+ star: w,
311
+ triangle: E
312
+ }, Ae = {
313
+ circle: "Cercle",
314
+ diamond: "Losange",
315
+ heart: "Coeur",
316
+ hexagon: "Hexagone",
317
+ pentagon: "Pentagone",
318
+ rectangle: "Rectangle",
319
+ square: "Carre",
320
+ star: "Etoile",
321
+ triangle: "Triangle"
322
+ }, je = Object.keys(Ae).map((e) => ({
323
+ label: Ae[e],
324
+ value: e
325
+ }));
326
+ function Me(e) {
327
+ return Ae[e];
328
+ }
329
+ function Ne({ shapeId: e, title: t }) {
330
+ let n = ke[e];
331
+ return /* @__PURE__ */ o("span", {
332
+ "aria-label": t,
333
+ role: t ? "img" : void 0,
334
+ title: t,
335
+ children: /* @__PURE__ */ o(n, { "aria-hidden": t ? void 0 : !0 })
336
+ });
337
+ }
338
+ //#endregion
280
339
  //#region src/exam-session/interactions/DragMatch.tsx
281
- function me({ items: e, targets: t, value: n, onChange: r }) {
282
- let i = n?.pairs ?? {}, c = new Set(Object.values(i));
283
- return /* @__PURE__ */ a(s, {
340
+ function Pe({ items: e, targets: t, value: n, onChange: r }) {
341
+ let i = n?.pairs ?? {}, a = new Set(Object.values(i));
342
+ return /* @__PURE__ */ o(c, {
284
343
  onDragEnd: (e) => {
285
344
  if (e.canceled) return;
286
345
  let t = e.operation.source?.id?.toString(), n = e.operation.target?.id?.toString();
@@ -292,14 +351,14 @@ function me({ items: e, targets: t, value: n, onChange: r }) {
292
351
  }
293
352
  });
294
353
  },
295
- children: /* @__PURE__ */ o("div", {
354
+ children: /* @__PURE__ */ s("div", {
296
355
  className: "drag-match",
297
- children: [/* @__PURE__ */ a("div", {
356
+ children: [/* @__PURE__ */ o("div", {
298
357
  className: "drag-match__items",
299
- children: e.filter((e) => !c.has(e.id)).map((e) => /* @__PURE__ */ a(he, { item: e }, e.id))
300
- }), /* @__PURE__ */ a("div", {
358
+ children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ o(Fe, { item: e }, e.id))
359
+ }), /* @__PURE__ */ o("div", {
301
360
  className: "drag-match__targets",
302
- children: t.map((t) => /* @__PURE__ */ a(ge, {
361
+ children: t.map((t) => /* @__PURE__ */ o(Ie, {
303
362
  assignedItem: e.find((e) => e.id === i[t.id]),
304
363
  target: t
305
364
  }, t.id))
@@ -307,35 +366,38 @@ function me({ items: e, targets: t, value: n, onChange: r }) {
307
366
  })
308
367
  });
309
368
  }
310
- function he({ item: e }) {
311
- let { ref: t, isDragging: n } = c({ id: e.id });
312
- return /* @__PURE__ */ a("button", {
369
+ function Fe({ item: e }) {
370
+ let { ref: t, isDragging: n } = l({ id: e.id });
371
+ return /* @__PURE__ */ o("button", {
313
372
  className: n ? "drag-pill drag-pill--dragging" : "drag-pill",
314
373
  ref: t,
315
374
  type: "button",
316
375
  children: e.label
317
376
  });
318
377
  }
319
- function ge({ assignedItem: e, target: t }) {
320
- let { ref: n, isDropTarget: r } = l({ id: t.id });
321
- return /* @__PURE__ */ o("div", {
378
+ function Ie({ assignedItem: e, target: t }) {
379
+ let { ref: n, isDropTarget: r } = u({ id: t.id });
380
+ return /* @__PURE__ */ s("div", {
322
381
  className: r ? "drop-slot drop-slot--active" : "drop-slot",
323
382
  ref: n,
324
- children: [/* @__PURE__ */ a("span", {
325
- className: "drop-slot__visual",
326
- children: t.label
327
- }), e ? /* @__PURE__ */ a(he, { item: e }) : /* @__PURE__ */ a("span", { children: "ضَعِ الإِجابَةَ هُنا" })]
383
+ children: [/* @__PURE__ */ o("span", {
384
+ className: t.shapeId ? "drop-slot__visual drop-slot__visual--shape" : "drop-slot__visual",
385
+ children: t.shapeId ? /* @__PURE__ */ o(Ne, {
386
+ shapeId: t.shapeId,
387
+ title: t.label
388
+ }) : t.label
389
+ }), e ? /* @__PURE__ */ o(Fe, { item: e }) : /* @__PURE__ */ o("span", { children: "ضع الإجابة هنا" })]
328
390
  });
329
391
  }
330
392
  //#endregion
331
393
  //#region src/exam-session/interactions/HandwrittenNumberAnswer.tsx
332
- var G = 132, K = 88, _e = 650;
333
- function q({ ariaLabel: t, onChange: i, onClear: s, recognizer: c, value: l }) {
334
- let u = l?.strokes ?? [], f = u.length === 0, p = n(i), [m, h] = r(!1), [g, _] = r(!1), v = !!c?.isAvailable(), y = c?.getStatus?.() ?? (v ? "ready" : "unavailable"), b = y === "preparing" || y === "error", E = y === "preparing" ? "preparing-model" : y === "error" ? "model-error" : f || m ? "idle" : l?.recognizedValue === void 0 ? !v || y === "unavailable" ? "unavailable" : g ? "unrecognized" : "recognizing" : "recognized";
335
- e(() => {
336
- p.current = i;
337
- }, [i]), e(() => {
338
- if (f || m || !l || !c || l.recognizedValue !== void 0 || !v || y !== "ready") return;
394
+ var Le = 132, W = 88, Re = 650;
395
+ function G({ ariaLabel: e, onChange: n, onClear: a, recognizer: c, value: l }) {
396
+ 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";
397
+ t(() => {
398
+ f.current = n;
399
+ }, [n]), t(() => {
400
+ if (d || p || !l || !c || l.recognizedValue !== void 0 || !v || y !== "ready") return;
339
401
  let e = !1, t = window.setTimeout(() => {
340
402
  c.recognize(l).then((t) => {
341
403
  if (!e) {
@@ -343,44 +405,44 @@ function q({ ariaLabel: t, onChange: i, onClear: s, recognizer: c, value: l }) {
343
405
  _(!0);
344
406
  return;
345
407
  }
346
- p.current(t);
408
+ f.current(t);
347
409
  }
348
410
  }).catch(() => {
349
411
  e || _(!0);
350
412
  });
351
- }, _e);
413
+ }, Re);
352
414
  return () => {
353
415
  e = !0, window.clearTimeout(t);
354
416
  };
355
417
  }, [
356
- m,
357
- f,
418
+ p,
419
+ d,
358
420
  y,
359
421
  v,
360
422
  c,
361
423
  l
362
424
  ]);
363
- function D(e) {
364
- _(!1), i({
365
- canvasHeight: K,
366
- canvasWidth: G,
425
+ function S(e) {
426
+ _(!1), n({
427
+ canvasHeight: W,
428
+ canvasWidth: Le,
367
429
  kind: "handwritten-number",
368
430
  strokes: e
369
431
  });
370
432
  }
371
- function O(e) {
433
+ function ee(e) {
372
434
  if (b) return;
373
435
  let t = e.target.getStage()?.getPointerPosition();
374
- t && (e.evt.preventDefault(), h(!0), D([...u, {
436
+ t && (e.evt.preventDefault(), m(!0), S([...u, {
375
437
  id: `stroke-${Date.now()}-${Math.round(t.x)}-${Math.round(t.y)}`,
376
438
  points: [t.x, t.y],
377
439
  timestamps: [Date.now()]
378
440
  }]));
379
441
  }
380
- function k(e) {
381
- if (b || f || !e.evt.buttons && e.evt.pointerType === "mouse") return;
442
+ function C(e) {
443
+ if (b || d || !e.evt.buttons && e.evt.pointerType === "mouse") return;
382
444
  let t = e.target.getStage()?.getPointerPosition();
383
- t && (e.evt.preventDefault(), D(u.map((e, n) => n === u.length - 1 ? {
445
+ t && (e.evt.preventDefault(), S(u.map((e, n) => n === u.length - 1 ? {
384
446
  ...e,
385
447
  points: [
386
448
  ...e.points,
@@ -390,66 +452,66 @@ function q({ ariaLabel: t, onChange: i, onClear: s, recognizer: c, value: l }) {
390
452
  timestamps: [...e.timestamps ?? [], Date.now()]
391
453
  } : e)));
392
454
  }
393
- function A(e) {
394
- b || (e.evt.preventDefault(), h(!1));
455
+ function w(e) {
456
+ b || (e.evt.preventDefault(), m(!1));
395
457
  }
396
- function j() {
397
- h(!1), D([]), s?.();
458
+ function T() {
459
+ m(!1), S([]), a?.();
398
460
  }
399
- return /* @__PURE__ */ o("div", {
461
+ return /* @__PURE__ */ s("div", {
400
462
  "aria-disabled": b,
401
- "aria-label": t,
463
+ "aria-label": e,
402
464
  className: "handwritten-number-answer",
403
465
  "data-model-state": y,
404
466
  children: [
405
- /* @__PURE__ */ o(w, {
467
+ /* @__PURE__ */ s(ne, {
406
468
  className: "handwritten-number-stage",
407
- height: K,
408
- onPointerCancel: A,
409
- onPointerDown: O,
410
- onPointerMove: k,
411
- onPointerUp: A,
469
+ height: W,
470
+ onPointerCancel: w,
471
+ onPointerDown: ee,
472
+ onPointerMove: C,
473
+ onPointerUp: w,
412
474
  role: "img",
413
- width: G,
414
- children: [/* @__PURE__ */ o(x, {
475
+ width: Le,
476
+ children: [/* @__PURE__ */ s(te, {
415
477
  listening: !1,
416
478
  children: [
417
- /* @__PURE__ */ a(C, {
479
+ /* @__PURE__ */ o(N, {
418
480
  cornerRadius: 14,
419
481
  fill: "#fff",
420
- height: K,
482
+ height: W,
421
483
  stroke: "#cfe3d9",
422
484
  strokeWidth: 2,
423
- width: G,
485
+ width: Le,
424
486
  x: 0,
425
487
  y: 0
426
488
  }),
427
- /* @__PURE__ */ a(S, {
489
+ /* @__PURE__ */ o(M, {
428
490
  dash: [6, 8],
429
491
  points: [
430
492
  16,
431
- K - 18,
432
- G - 16,
433
- K - 18
493
+ W - 18,
494
+ Le - 16,
495
+ W - 18
434
496
  ],
435
497
  stroke: "#dbe9e2",
436
498
  strokeWidth: 2
437
499
  }),
438
- f ? /* @__PURE__ */ a(T, {
500
+ d ? /* @__PURE__ */ o(P, {
439
501
  align: "center",
440
502
  fill: "#9aaca3",
441
503
  fontFamily: "Arial, sans-serif",
442
504
  fontSize: 15,
443
505
  fontStyle: "bold",
444
- height: K,
506
+ height: W,
445
507
  text: "ارسم هنا",
446
508
  verticalAlign: "middle",
447
- width: G,
509
+ width: Le,
448
510
  x: 0,
449
511
  y: 0
450
512
  }) : null
451
513
  ]
452
- }), /* @__PURE__ */ a(x, { children: u.map((e) => /* @__PURE__ */ a(S, {
514
+ }), /* @__PURE__ */ o(te, { children: u.map((e) => /* @__PURE__ */ o(M, {
453
515
  globalCompositeOperation: "source-over",
454
516
  lineCap: "round",
455
517
  lineJoin: "round",
@@ -459,24 +521,24 @@ function q({ ariaLabel: t, onChange: i, onClear: s, recognizer: c, value: l }) {
459
521
  tension: .28
460
522
  }, e.id)) })]
461
523
  }),
462
- /* @__PURE__ */ a("button", {
524
+ /* @__PURE__ */ o("button", {
463
525
  "aria-label": "مسح الجواب المرسوم",
464
526
  className: "handwritten-number-clear",
465
- disabled: f || b,
466
- onClick: j,
527
+ disabled: d || b,
528
+ onClick: T,
467
529
  type: "button",
468
- children: /* @__PURE__ */ a(d, { "aria-hidden": "true" })
530
+ children: /* @__PURE__ */ o(h, { "aria-hidden": "true" })
469
531
  }),
470
- E !== "idle" && E !== "unavailable" ? /* @__PURE__ */ a("span", {
532
+ x !== "idle" && x !== "unavailable" ? /* @__PURE__ */ o("span", {
471
533
  "aria-live": "polite",
472
534
  className: "handwritten-number-status",
473
- "data-state": E,
474
- children: ve(E, l?.recognizedValue)
535
+ "data-state": x,
536
+ children: ze(x, l?.recognizedValue)
475
537
  }) : null
476
538
  ]
477
539
  });
478
540
  }
479
- function ve(e, t) {
541
+ function ze(e, t) {
480
542
  switch (e) {
481
543
  case "recognizing": return "جارٍ التعرّف على الرقم…";
482
544
  case "recognized": return `تمّ التعرّف: ${t ?? ""}`;
@@ -489,22 +551,22 @@ function ve(e, t) {
489
551
  }
490
552
  //#endregion
491
553
  //#region src/exam-session/interactions/ColorPenPicker.tsx
492
- function ye({ ariaLabel: e, className: t = "", colors: n, disabled: r = !1, onChange: i, selectedColorId: s }) {
493
- return /* @__PURE__ */ a("div", {
554
+ function Be({ ariaLabel: e, className: t = "", colors: n, disabled: r = !1, onChange: i, selectedColorId: a }) {
555
+ return /* @__PURE__ */ o("div", {
494
556
  "aria-label": e,
495
557
  className: ["color-pen-picker", t].filter(Boolean).join(" "),
496
558
  role: "group",
497
- children: n.map((e) => /* @__PURE__ */ o("button", {
498
- "aria-pressed": s === e.id,
499
- className: s === e.id ? "color-pen-button color-pen-button--selected" : "color-pen-button",
559
+ children: n.map((e) => /* @__PURE__ */ s("button", {
560
+ "aria-pressed": a === e.id,
561
+ className: a === e.id ? "color-pen-button color-pen-button--selected" : "color-pen-button",
500
562
  disabled: r,
501
563
  onClick: () => i(e.id),
502
564
  style: { "--pen-color": e.value },
503
565
  type: "button",
504
- children: [/* @__PURE__ */ a("span", {
566
+ children: [/* @__PURE__ */ o("span", {
505
567
  className: "color-pen-button__indicator",
506
568
  "aria-hidden": "true"
507
- }), /* @__PURE__ */ a("span", {
569
+ }), /* @__PURE__ */ o("span", {
508
570
  className: "color-pen-button__label",
509
571
  children: e.label
510
572
  })]
@@ -513,7 +575,7 @@ function ye({ ariaLabel: e, className: t = "", colors: n, disabled: r = !1, onCh
513
575
  }
514
576
  //#endregion
515
577
  //#region src/exam-session/interactions/geometryColors.ts
516
- var J = [
578
+ var K = [
517
579
  {
518
580
  id: "green",
519
581
  label: "أَخْضَرُ",
@@ -534,28 +596,28 @@ var J = [
534
596
  label: "أَسْوَدُ",
535
597
  value: "#17212b"
536
598
  }
537
- ], be = {
599
+ ], Ve = {
538
600
  black: "#17212b",
539
601
  blue: "#256fd2",
540
602
  green: "#0b7f45",
541
603
  red: "#e34a58"
542
604
  };
543
- function xe(e, t) {
605
+ function He(e, t) {
544
606
  return t ? e.find((e) => e.id === t || e.value === t)?.id ?? e[0]?.id ?? "green" : e[0]?.id ?? "green";
545
607
  }
546
- function Se(e, t) {
547
- return e.find((e) => e.id === t)?.value ?? e[0]?.value ?? J[0].value;
608
+ function Ue(e, t) {
609
+ return e.find((e) => e.id === t)?.value ?? e[0]?.value ?? K[0].value;
548
610
  }
549
- function Ce(e) {
611
+ function We(e) {
550
612
  return e.map((e) => ({
551
613
  id: e.id,
552
614
  label: e.label,
553
- value: be[e.id] ?? J[0].value
615
+ value: Ve[e.id] ?? K[0].value
554
616
  }));
555
617
  }
556
618
  //#endregion
557
619
  //#region src/exam-session/interactions/GeometryCanvas.tsx
558
- var we = 1e3, Te = 600, Y = 30, Ee = 240, De = 12, Oe = J[0].value, X = "#0a8f55", ke = [
620
+ var Ge = 1e3, Ke = 600, q = 30, qe = 240, Je = 12, Ye = K[0].value, J = "#0a8f55", Xe = [
559
621
  {
560
622
  id: "pen",
561
623
  icon: "✎",
@@ -586,44 +648,44 @@ var we = 1e3, Te = 600, Y = 30, Ee = 240, De = 12, Oe = J[0].value, X = "#0a8f55
586
648
  icon: "⌖",
587
649
  label: "بَرْكارٌ"
588
650
  }
589
- ], Ae = /* @__PURE__ */ new Set([
651
+ ], Ze = /* @__PURE__ */ new Set([
590
652
  "ruler",
591
653
  "protractor",
592
654
  "compass"
593
655
  ]);
594
- function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, className: s = "", colorOptions: c = J, defaultColor: l, disabled: u = !1, minStageWidth: d = Ee, onChange: f, points: p = [], showColorPalette: m = !0, value: h, variant: g = "question" }) {
595
- let _ = c.length > 0 ? c : J, [v, y] = r(null), [b, S] = r([]), [T, E] = r(() => xe(_, l ?? "black")), [D, O] = r(() => Be(h)), [k, A] = r(() => h?.guides ?? ze(i, t)), [j, M] = r(null), [N, ee] = r({
656
+ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, className: a = "", colorOptions: c = K, defaultColor: l, disabled: u = !1, minStageWidth: d = qe, onChange: f, points: p = [], showColorPalette: m = !0, value: h, variant: g = "question" }) {
657
+ let _ = c.length > 0 ? c : K, [v, y] = i(null), [b, x] = i([]), [S, ee] = i(() => He(_, l ?? "black")), [C, w] = i(() => ct(h)), [T, E] = i(() => h?.guides ?? st(n, t)), [D, O] = i(null), [k, A] = i({
596
658
  height: t,
597
659
  scale: 1,
598
- width: i
599
- }), [P, te] = r({
660
+ width: n
661
+ }), [j, M] = i({
600
662
  canRedo: !1,
601
663
  canUndo: !1
602
- }), ne = n(null), F = n([Z(D)]), I = n(0), re = n(0), L = n(null);
603
- Me(ne, i, t, d, ee);
604
- let ie = He(p, i, t), ae = [
664
+ }), P = r(null), F = r([Y(C)]), I = r(0), re = r(0), L = r(null);
665
+ $e(P, n, t, d, A);
666
+ let R = ut(p, n, t), ie = [
605
667
  "geometry-canvas",
606
668
  `geometry-canvas--${g}`,
607
- s
608
- ].filter(Boolean).join(" "), oe = _.some((e) => e.id === T) ? T : xe(_, "black"), se = Se(_, oe), R = Ge(v);
609
- function ce(e) {
610
- return Ae.has(e) ? !R && b.includes(e) : v === e || b.includes(e);
669
+ a
670
+ ].filter(Boolean).join(" "), ae = _.some((e) => e.id === S) ? S : He(_, "black"), oe = Ue(_, ae), z = pt(v);
671
+ function se(e) {
672
+ return Ze.has(e) ? !z && b.includes(e) : v === e || b.includes(e);
611
673
  }
612
- function z(e) {
613
- S((t) => t.includes(e) ? t.filter((t) => t !== e) : t.concat(e));
674
+ function B(e) {
675
+ x((t) => t.includes(e) ? t.filter((t) => t !== e) : t.concat(e));
614
676
  }
615
- function le(e) {
677
+ function ce(e) {
616
678
  if (e === "ruler" || e === "protractor") {
617
- if (R) {
618
- y(null), S((t) => t.includes(e) ? t : t.concat(e));
679
+ if (z) {
680
+ y(null), x((t) => t.includes(e) ? t : t.concat(e));
619
681
  return;
620
682
  }
621
- z(e);
683
+ B(e);
622
684
  return;
623
685
  }
624
686
  if (e === "compass") {
625
687
  let e = v !== "compass" || !b.includes("compass");
626
- y(e ? "compass" : null), S((t) => {
688
+ y(e ? "compass" : null), x((t) => {
627
689
  let n = t.filter((e) => e !== "compass");
628
690
  return e ? [...n, "compass"] : n;
629
691
  });
@@ -631,65 +693,65 @@ function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, classNa
631
693
  }
632
694
  y(e);
633
695
  }
634
- function B(e) {
696
+ function le(e) {
635
697
  return re.current += 1, `${e}-${Date.now()}-${re.current}`;
636
698
  }
637
- function V(e, t = k) {
699
+ function ue(e, t = T) {
638
700
  f({
639
- elements: Z(e),
701
+ elements: Y(e),
640
702
  guides: t,
641
703
  kind: "drawing",
642
- strokes: Ve(e)
704
+ strokes: lt(e)
643
705
  });
644
706
  }
645
- function H() {
646
- te({
707
+ function de() {
708
+ M({
647
709
  canRedo: I.current < F.current.length - 1,
648
710
  canUndo: I.current > 0
649
711
  });
650
712
  }
651
- function U(e, t = k) {
652
- let n = Z(e), r = F.current.slice(0, I.current + 1);
653
- r.push(n), F.current = r, I.current = r.length - 1, O(n), V(n, t), H();
713
+ function fe(e, t = T) {
714
+ let n = Y(e), r = F.current.slice(0, I.current + 1);
715
+ r.push(n), F.current = r, I.current = r.length - 1, w(n), ue(n, t), de();
654
716
  }
655
- function W(e) {
656
- A(e), V(D, e);
717
+ function pe(e) {
718
+ E(e), ue(C, e);
657
719
  }
658
- function ue() {
659
- if (!P.canUndo || u) return;
720
+ function me() {
721
+ if (!j.canUndo || u) return;
660
722
  --I.current;
661
- let e = Z(F.current[I.current]);
662
- O(e), V(e), H();
723
+ let e = Y(F.current[I.current]);
724
+ w(e), ue(e), de();
663
725
  }
664
- function de() {
665
- if (!P.canRedo || u) return;
726
+ function he() {
727
+ if (!j.canRedo || u) return;
666
728
  I.current += 1;
667
- let e = Z(F.current[I.current]);
668
- O(e), V(e), H();
729
+ let e = Y(F.current[I.current]);
730
+ w(e), ue(e), de();
669
731
  }
670
- function fe() {
671
- u || D.length === 0 || U([]);
732
+ function ge() {
733
+ u || C.length === 0 || fe([]);
672
734
  }
673
- function pe(e) {
674
- let n = e.target.getStage()?.getPointerPosition();
675
- return n ? {
676
- x: tt(n.x / N.scale, 0, i),
677
- y: tt(n.y / N.scale, 0, t)
735
+ function _e(e) {
736
+ let r = e.target.getStage()?.getPointerPosition();
737
+ return r ? {
738
+ x: Ct(r.x / k.scale, 0, n),
739
+ y: Ct(r.y / k.scale, 0, t)
678
740
  } : null;
679
741
  }
680
- function me(e) {
681
- if (u || !R && We(e.target)) return;
682
- let t = pe(e);
742
+ function ve(e) {
743
+ if (u || !z && ft(e.target)) return;
744
+ let t = _e(e);
683
745
  if (!t || !v) return;
684
746
  if (v === "eraser") {
685
- G(t);
747
+ V(t);
686
748
  return;
687
749
  }
688
- let n = Ue(t, ie);
750
+ let n = dt(t, R);
689
751
  if (v === "pen") {
690
- L.current = n, M({
691
- color: se,
692
- id: B("freehand"),
752
+ L.current = n, O({
753
+ color: oe,
754
+ id: le("freehand"),
693
755
  points: [n.x, n.y],
694
756
  strokeWidth: 4,
695
757
  type: "freehand"
@@ -697,9 +759,9 @@ function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, classNa
697
759
  return;
698
760
  }
699
761
  if (v === "line") {
700
- L.current = n, M({
701
- color: se,
702
- id: B("line"),
762
+ L.current = n, O({
763
+ color: oe,
764
+ id: le("line"),
703
765
  points: [
704
766
  n.x,
705
767
  n.y,
@@ -711,34 +773,34 @@ function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, classNa
711
773
  });
712
774
  return;
713
775
  }
714
- v === "compass" && (L.current = n, M({
776
+ v === "compass" && (L.current = n, O({
715
777
  center: n,
716
- color: se,
717
- id: B("circle"),
778
+ color: oe,
779
+ id: le("circle"),
718
780
  radius: 1,
719
781
  strokeWidth: 3,
720
782
  type: "circle"
721
783
  }));
722
784
  }
723
- function he(e) {
724
- let t = pe(e);
785
+ function ye(e) {
786
+ let t = _e(e);
725
787
  if (t) {
726
788
  if (v === "eraser" && !u) {
727
- G(t);
789
+ V(t);
728
790
  return;
729
791
  }
730
- if (!(!j || !L.current || u)) {
731
- if (j.type === "freehand") {
732
- M({
733
- ...j,
734
- points: j.points.concat([t.x, t.y])
792
+ if (!(!D || !L.current || u)) {
793
+ if (D.type === "freehand") {
794
+ O({
795
+ ...D,
796
+ points: D.points.concat([t.x, t.y])
735
797
  });
736
798
  return;
737
799
  }
738
- if (j.type === "line") {
739
- let e = Ue(t, ie);
740
- M({
741
- ...j,
800
+ if (D.type === "line") {
801
+ let e = dt(t, R);
802
+ O({
803
+ ...D,
742
804
  points: [
743
805
  L.current.x,
744
806
  L.current.y,
@@ -748,130 +810,130 @@ function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, classNa
748
810
  });
749
811
  return;
750
812
  }
751
- j.type === "circle" && M({
752
- ...j,
753
- radius: Q(j.center, t)
813
+ D.type === "circle" && O({
814
+ ...D,
815
+ radius: X(D.center, t)
754
816
  });
755
817
  }
756
818
  }
757
819
  }
758
- function ge() {
759
- if (!j || u) {
760
- L.current = null, M(null);
820
+ function be() {
821
+ if (!D || u) {
822
+ L.current = null, O(null);
761
823
  return;
762
824
  }
763
- let e = j;
764
- if (L.current = null, M(null), qe(e)) {
825
+ let e = D;
826
+ if (L.current = null, O(null), ht(e)) {
765
827
  if (e.type === "circle") {
766
828
  let t = {
767
- ...k,
829
+ ...T,
768
830
  compass: {
769
831
  center: e.center,
770
832
  radius: e.radius
771
833
  }
772
834
  };
773
- A(t), U(D.concat(e), t);
835
+ E(t), fe(C.concat(e), t);
774
836
  return;
775
837
  }
776
- U(D.concat(e));
838
+ fe(C.concat(e));
777
839
  }
778
840
  }
779
- function G(e) {
780
- if (D.length === 0) return;
781
- let t = Je(D, e);
782
- t < 0 || U(D.filter((e, n) => n !== t));
841
+ function V(e) {
842
+ if (C.length === 0) return;
843
+ let t = gt(C, e);
844
+ t < 0 || fe(C.filter((e, n) => n !== t));
783
845
  }
784
- return /* @__PURE__ */ o("div", {
785
- className: ae,
846
+ return /* @__PURE__ */ s("div", {
847
+ className: ie,
786
848
  "data-disabled": u ? "true" : "false",
787
849
  dir: "rtl",
788
850
  children: [
789
- /* @__PURE__ */ a("div", {
851
+ /* @__PURE__ */ o("div", {
790
852
  className: "geometry-toolbar",
791
853
  "aria-label": "أَدَواتُ الوَرَقَةِ المُسَوَّدَةِ",
792
- children: ke.map((e) => /* @__PURE__ */ o("button", {
793
- "aria-pressed": ce(e.id),
854
+ children: Xe.map((e) => /* @__PURE__ */ s("button", {
855
+ "aria-pressed": se(e.id),
794
856
  className: [
795
857
  "geometry-tool-button",
796
- ce(e.id) ? "geometry-tool-button--active" : "",
797
- Ae.has(e.id) ? "geometry-tool-button--guide" : ""
858
+ se(e.id) ? "geometry-tool-button--active" : "",
859
+ Ze.has(e.id) ? "geometry-tool-button--guide" : ""
798
860
  ].filter(Boolean).join(" "),
799
861
  disabled: u,
800
- onClick: () => le(e.id),
862
+ onClick: () => ce(e.id),
801
863
  type: "button",
802
- children: [/* @__PURE__ */ a("span", {
864
+ children: [/* @__PURE__ */ o("span", {
803
865
  "aria-hidden": "true",
804
866
  children: e.icon
805
- }), /* @__PURE__ */ a("span", { children: e.label })]
867
+ }), /* @__PURE__ */ o("span", { children: e.label })]
806
868
  }, e.id))
807
869
  }),
808
- m ? /* @__PURE__ */ a(ye, {
870
+ m ? /* @__PURE__ */ o(Be, {
809
871
  ariaLabel: "أَلْوانُ الأَقْلامِ",
810
872
  className: "geometry-color-picker",
811
873
  colors: _,
812
874
  disabled: u,
813
- onChange: E,
814
- selectedColorId: oe
875
+ onChange: ee,
876
+ selectedColorId: ae
815
877
  }) : null,
816
- /* @__PURE__ */ a("div", {
878
+ /* @__PURE__ */ o("div", {
817
879
  className: "geometry-stage-shell",
818
- ref: ne,
819
- children: /* @__PURE__ */ a(w, {
820
- height: N.height,
821
- onMouseDown: me,
822
- onMouseLeave: ge,
823
- onMouseMove: he,
824
- onMouseUp: ge,
825
- onTouchEnd: ge,
826
- onTouchMove: he,
827
- onTouchStart: me,
828
- width: N.width,
829
- children: /* @__PURE__ */ o(x, {
830
- scaleX: N.scale,
831
- scaleY: N.scale,
880
+ ref: P,
881
+ children: /* @__PURE__ */ o(ne, {
882
+ height: k.height,
883
+ onMouseDown: ve,
884
+ onMouseLeave: be,
885
+ onMouseMove: ye,
886
+ onMouseUp: be,
887
+ onTouchEnd: be,
888
+ onTouchMove: ye,
889
+ onTouchStart: ve,
890
+ width: k.width,
891
+ children: /* @__PURE__ */ s(te, {
892
+ scaleX: k.scale,
893
+ scaleY: k.scale,
832
894
  children: [
833
- /* @__PURE__ */ a(C, {
895
+ /* @__PURE__ */ o(N, {
834
896
  fill: "#fff",
835
897
  height: t,
836
898
  stroke: "#bad3c8",
837
899
  strokeWidth: 1,
838
- width: i
900
+ width: n
839
901
  }),
840
- /* @__PURE__ */ a(Ne, {
902
+ /* @__PURE__ */ o(et, {
841
903
  canvasHeight: t,
842
- canvasWidth: i
904
+ canvasWidth: n
843
905
  }),
844
- p.map((e, n) => /* @__PURE__ */ a(Pe, {
845
- label: n % 2 == 0 ? "1" : "2",
846
- x: e.x / 100 * i,
906
+ p.map((e, r) => e.hidden ? null : /* @__PURE__ */ o(tt, {
907
+ label: nt(e, r),
908
+ x: e.x / 100 * n,
847
909
  y: e.y / 100 * t
848
910
  }, e.id)),
849
- D.map((e) => Re(e)),
850
- j ? Re(j, !0) : null,
851
- b.includes("ruler") ? /* @__PURE__ */ a(Fe, {
911
+ C.map((e) => ot(e)),
912
+ D ? ot(D, !0) : null,
913
+ b.includes("ruler") ? /* @__PURE__ */ o(rt, {
852
914
  disabled: u,
853
- guide: k.ruler,
854
- locked: R,
855
- onCommit: (e) => W({
856
- ...k,
915
+ guide: T.ruler,
916
+ locked: z,
917
+ onCommit: (e) => pe({
918
+ ...T,
857
919
  ruler: e
858
920
  })
859
- }) : null,
860
- b.includes("protractor") ? /* @__PURE__ */ a(Ie, {
921
+ }, `${T.ruler.x}:${T.ruler.y}:${T.ruler.length}:${T.ruler.rotation}`) : null,
922
+ b.includes("protractor") ? /* @__PURE__ */ o(it, {
861
923
  disabled: u,
862
- guide: k.protractor,
863
- locked: R,
864
- onChange: (e) => W({
865
- ...k,
924
+ guide: T.protractor,
925
+ locked: z,
926
+ onChange: (e) => pe({
927
+ ...T,
866
928
  protractor: e
867
929
  })
868
930
  }) : null,
869
- b.includes("compass") ? /* @__PURE__ */ a(Le, {
931
+ b.includes("compass") ? /* @__PURE__ */ o(at, {
870
932
  disabled: u,
871
- guide: k.compass,
872
- locked: R,
873
- onChange: (e) => W({
874
- ...k,
933
+ guide: T.compass,
934
+ locked: z,
935
+ onChange: (e) => pe({
936
+ ...T,
875
937
  compass: e
876
938
  })
877
939
  }) : null
@@ -879,25 +941,25 @@ function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, classNa
879
941
  })
880
942
  })
881
943
  }),
882
- /* @__PURE__ */ o("div", {
944
+ /* @__PURE__ */ s("div", {
883
945
  className: "geometry-actions",
884
946
  children: [
885
- e ? /* @__PURE__ */ a("span", { children: e }) : null,
886
- /* @__PURE__ */ a("button", {
887
- disabled: !P.canUndo || u,
888
- onClick: ue,
947
+ e ? /* @__PURE__ */ o("span", { children: e }) : null,
948
+ /* @__PURE__ */ o("button", {
949
+ disabled: !j.canUndo || u,
950
+ onClick: me,
889
951
  type: "button",
890
952
  children: "تَراجُعٌ"
891
953
  }),
892
- /* @__PURE__ */ a("button", {
893
- disabled: !P.canRedo || u,
894
- onClick: de,
954
+ /* @__PURE__ */ o("button", {
955
+ disabled: !j.canRedo || u,
956
+ onClick: he,
895
957
  type: "button",
896
958
  children: "إِعادَةٌ"
897
959
  }),
898
- /* @__PURE__ */ a("button", {
899
- disabled: D.length === 0 || u,
900
- onClick: fe,
960
+ /* @__PURE__ */ o("button", {
961
+ disabled: C.length === 0 || u,
962
+ onClick: ge,
901
963
  type: "button",
902
964
  children: "مَسْحٌ"
903
965
  })
@@ -906,10 +968,10 @@ function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, classNa
906
968
  ]
907
969
  });
908
970
  }
909
- function Me(t, n, r, i, a) {
910
- e(() => {
911
- let e = t.current;
912
- if (!e) return;
971
+ function $e(e, n, r, i, a) {
972
+ t(() => {
973
+ let t = e.current;
974
+ if (!t) return;
913
975
  let o = (e) => {
914
976
  let t = Math.min(n, Math.max(1, e > 0 ? e : i)), o = t / n;
915
977
  a({
@@ -918,75 +980,75 @@ function Me(t, n, r, i, a) {
918
980
  width: t
919
981
  });
920
982
  };
921
- o(e.clientWidth);
983
+ o(t.clientWidth);
922
984
  let s = new ResizeObserver((e) => {
923
985
  let t = e[0];
924
986
  t && o(t.contentRect.width);
925
987
  });
926
- return s.observe(e), () => s.disconnect();
988
+ return s.observe(t), () => s.disconnect();
927
989
  }, [
928
990
  r,
929
- t,
991
+ e,
930
992
  n,
931
993
  i,
932
994
  a
933
995
  ]);
934
996
  }
935
- function Ne({ canvasHeight: e, canvasWidth: t }) {
936
- let n = Math.floor(t / Y), r = Math.floor(e / Y);
937
- return /* @__PURE__ */ o(i, { children: [Array.from({ length: n + 1 }, (t, n) => /* @__PURE__ */ a(S, {
997
+ function et({ canvasHeight: e, canvasWidth: t }) {
998
+ let n = Math.floor(t / q), r = Math.floor(e / q);
999
+ return /* @__PURE__ */ s(a, { children: [Array.from({ length: n + 1 }, (t, n) => /* @__PURE__ */ o(M, {
938
1000
  points: [
939
- n * Y,
1001
+ n * q,
940
1002
  0,
941
- n * Y,
1003
+ n * q,
942
1004
  e
943
1005
  ],
944
1006
  stroke: "#d2ded8",
945
1007
  strokeWidth: 1
946
- }, `vertical-${n}`)), Array.from({ length: r + 1 }, (e, n) => /* @__PURE__ */ a(S, {
1008
+ }, `vertical-${n}`)), Array.from({ length: r + 1 }, (e, n) => /* @__PURE__ */ o(M, {
947
1009
  points: [
948
1010
  0,
949
- n * Y,
1011
+ n * q,
950
1012
  t,
951
- n * Y
1013
+ n * q
952
1014
  ],
953
1015
  stroke: "#d2ded8",
954
1016
  strokeWidth: 1
955
1017
  }, `horizontal-${n}`))] });
956
1018
  }
957
- function Pe({ label: e, x: t, y: n }) {
958
- return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(y, {
1019
+ function tt({ label: e, x: t, y: n }) {
1020
+ return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(A, {
959
1021
  fill: "#e63542",
960
- radius: 9,
961
- shadowBlur: 8,
1022
+ radius: 4.75,
1023
+ shadowBlur: 5,
962
1024
  shadowColor: "rgba(230, 53, 66, 0.28)",
963
1025
  stroke: "#fff",
964
- strokeWidth: 3,
1026
+ strokeWidth: 1.7,
965
1027
  x: t,
966
1028
  y: n
967
- }), /* @__PURE__ */ a(T, {
1029
+ }), /* @__PURE__ */ o(P, {
968
1030
  fill: "#111",
969
- fontSize: 18,
1031
+ fontSize: 14,
970
1032
  fontStyle: "bold",
971
1033
  text: e,
972
- x: t + 11,
973
- y: n - 22
1034
+ x: t + 8,
1035
+ y: n - 18
974
1036
  })] });
975
1037
  }
976
- function Fe({ disabled: t, guide: s, locked: c, onCommit: l }) {
977
- let [u, d] = r(s), f = n(s);
978
- e(() => {
979
- f.current = s, d(s);
980
- }, [s]);
981
- let p = u.length / 2, m = p + 44, h = -p - 44, g = p + 8, _ = -p - 8, v = !t && !c;
982
- function x(e) {
983
- f.current = e, d(e);
1038
+ function nt(e, t) {
1039
+ let n = e.label?.trim();
1040
+ return n && n.length > 0 ? n : String(t + 1);
1041
+ }
1042
+ function rt({ disabled: e, guide: t, locked: n, onCommit: c }) {
1043
+ let [l, u] = i(t), d = r(t), f = l.length / 2, p = f + 44, m = -f - 44, h = f + 8, g = -f - 8, _ = !e && !n;
1044
+ function v(e) {
1045
+ d.current = e, u(e);
984
1046
  }
985
- function w(e) {
1047
+ function y(e) {
986
1048
  e.cancelBubble = !0;
987
- let t = Ke(e);
988
- t && (x({
989
- ...f.current,
1049
+ let t = mt(e);
1050
+ t && (v({
1051
+ ...d.current,
990
1052
  x: t.x,
991
1053
  y: t.y
992
1054
  }), e.currentTarget.position({
@@ -994,61 +1056,61 @@ function Fe({ disabled: t, guide: s, locked: c, onCommit: l }) {
994
1056
  y: 0
995
1057
  }));
996
1058
  }
997
- function T(e) {
1059
+ function b(e) {
998
1060
  e.cancelBubble = !0, e.currentTarget.position({
999
1061
  x: 0,
1000
1062
  y: 0
1001
- }), l(f.current);
1063
+ }), c(d.current);
1002
1064
  }
1003
- function E(e, t) {
1065
+ function x(e, t) {
1004
1066
  e.cancelBubble = !0;
1005
- let n = Ke(e);
1006
- n && (x($e(f.current, n, t)), e.currentTarget.position({
1067
+ let n = mt(e);
1068
+ n && (v(xt(d.current, n, t)), e.currentTarget.position({
1007
1069
  x: 0,
1008
1070
  y: 0
1009
1071
  }));
1010
1072
  }
1011
- function D() {
1073
+ function S() {
1012
1074
  let e = {
1013
- ...f.current,
1014
- rotation: nt(f.current.rotation + 90)
1075
+ ...d.current,
1076
+ rotation: wt(d.current.rotation + 90)
1015
1077
  };
1016
- x(e), l(e);
1078
+ v(e), c(e);
1017
1079
  }
1018
- return /* @__PURE__ */ a(i, { children: /* @__PURE__ */ o(b, {
1019
- listening: v,
1080
+ return /* @__PURE__ */ o(a, { children: /* @__PURE__ */ s(j, {
1081
+ listening: _,
1020
1082
  name: "geometry-guide",
1021
- onDblClick: D,
1022
- onDblTap: D,
1023
- rotation: u.rotation,
1024
- x: u.x,
1025
- y: u.y,
1083
+ onDblClick: S,
1084
+ onDblTap: S,
1085
+ rotation: l.rotation,
1086
+ x: l.x,
1087
+ y: l.y,
1026
1088
  children: [
1027
- /* @__PURE__ */ a(C, {
1089
+ /* @__PURE__ */ o(N, {
1028
1090
  cornerRadius: 7,
1029
1091
  fill: "rgba(14, 173, 100, 0.13)",
1030
1092
  height: 38,
1031
1093
  listening: !1,
1032
- offsetX: u.length / 2,
1094
+ offsetX: l.length / 2,
1033
1095
  offsetY: 38 / 2,
1034
- stroke: X,
1096
+ stroke: J,
1035
1097
  strokeWidth: 2,
1036
- width: u.length
1098
+ width: l.length
1037
1099
  }),
1038
- /* @__PURE__ */ a(S, {
1100
+ /* @__PURE__ */ o(M, {
1039
1101
  points: [
1040
- -u.length / 2 + 12,
1102
+ -l.length / 2 + 12,
1041
1103
  0,
1042
- u.length / 2 - 12,
1104
+ l.length / 2 - 12,
1043
1105
  0
1044
1106
  ],
1045
1107
  listening: !1,
1046
- stroke: X,
1108
+ stroke: J,
1047
1109
  strokeWidth: 2
1048
1110
  }),
1049
- Array.from({ length: Math.floor(u.length / 20) + 1 }, (e, t) => {
1050
- let n = -u.length / 2 + t * 20, r = t % 5 == 0;
1051
- return /* @__PURE__ */ a(S, {
1111
+ Array.from({ length: Math.floor(l.length / 20) + 1 }, (e, t) => {
1112
+ let n = -l.length / 2 + t * 20, r = t % 5 == 0;
1113
+ return /* @__PURE__ */ o(M, {
1052
1114
  listening: !1,
1053
1115
  points: [
1054
1116
  n,
@@ -1056,94 +1118,94 @@ function Fe({ disabled: t, guide: s, locked: c, onCommit: l }) {
1056
1118
  n,
1057
1119
  r ? 4 : 10
1058
1120
  ],
1059
- stroke: X,
1121
+ stroke: J,
1060
1122
  strokeWidth: r ? 1.5 : 1
1061
1123
  }, t);
1062
1124
  }),
1063
- /* @__PURE__ */ a(S, {
1125
+ /* @__PURE__ */ o(M, {
1064
1126
  dash: [7, 7],
1065
1127
  listening: !1,
1066
1128
  opacity: .72,
1067
1129
  points: [
1068
- g,
1130
+ h,
1069
1131
  0,
1070
- m,
1132
+ p,
1071
1133
  0
1072
1134
  ],
1073
- stroke: X,
1135
+ stroke: J,
1074
1136
  strokeWidth: 2
1075
1137
  }),
1076
- /* @__PURE__ */ a(S, {
1138
+ /* @__PURE__ */ o(M, {
1077
1139
  dash: [7, 7],
1078
1140
  listening: !1,
1079
1141
  opacity: .72,
1080
1142
  points: [
1081
- _,
1143
+ g,
1082
1144
  0,
1083
- h,
1145
+ m,
1084
1146
  0
1085
1147
  ],
1086
- stroke: X,
1148
+ stroke: J,
1087
1149
  strokeWidth: 2
1088
1150
  }),
1089
- /* @__PURE__ */ a(b, {
1090
- draggable: v,
1151
+ /* @__PURE__ */ o(j, {
1152
+ draggable: _,
1091
1153
  name: "geometry-guide",
1092
- onDblClick: D,
1093
- onDblTap: D,
1094
- onDragEnd: T,
1095
- onDragMove: (e) => E(e, "right"),
1096
- children: /* @__PURE__ */ a(C, {
1154
+ onDblClick: S,
1155
+ onDblTap: S,
1156
+ onDragEnd: b,
1157
+ onDragMove: (e) => x(e, "right"),
1158
+ children: /* @__PURE__ */ o(N, {
1097
1159
  fill: "rgba(255, 255, 255, 0.01)",
1098
1160
  height: 106,
1099
1161
  offsetY: 53,
1100
- width: m + 24,
1162
+ width: p + 24,
1101
1163
  x: 0
1102
1164
  })
1103
1165
  }),
1104
- /* @__PURE__ */ a(b, {
1105
- draggable: v,
1166
+ /* @__PURE__ */ o(j, {
1167
+ draggable: _,
1106
1168
  name: "geometry-guide",
1107
- onDblClick: D,
1108
- onDblTap: D,
1109
- onDragEnd: T,
1110
- onDragMove: (e) => E(e, "left"),
1111
- children: /* @__PURE__ */ a(C, {
1169
+ onDblClick: S,
1170
+ onDblTap: S,
1171
+ onDragEnd: b,
1172
+ onDragMove: (e) => x(e, "left"),
1173
+ children: /* @__PURE__ */ o(N, {
1112
1174
  fill: "rgba(255, 255, 255, 0.01)",
1113
1175
  height: 106,
1114
1176
  offsetY: 53,
1115
- width: Math.abs(h) + 24,
1116
- x: h - 24
1177
+ width: Math.abs(m) + 24,
1178
+ x: m - 24
1117
1179
  })
1118
1180
  }),
1119
- /* @__PURE__ */ a(y, {
1181
+ /* @__PURE__ */ o(A, {
1120
1182
  fill: "#f7fffb",
1121
1183
  listening: !1,
1122
1184
  radius: 16,
1123
1185
  shadowBlur: 10,
1124
1186
  shadowColor: "rgba(10, 143, 85, 0.35)",
1125
- stroke: X,
1187
+ stroke: J,
1126
1188
  strokeWidth: 4,
1127
- x: m,
1189
+ x: p,
1128
1190
  y: 0
1129
1191
  }),
1130
- /* @__PURE__ */ a(y, {
1192
+ /* @__PURE__ */ o(A, {
1131
1193
  fill: "#f7fffb",
1132
1194
  listening: !1,
1133
1195
  radius: 16,
1134
1196
  shadowBlur: 10,
1135
1197
  shadowColor: "rgba(10, 143, 85, 0.35)",
1136
- stroke: X,
1198
+ stroke: J,
1137
1199
  strokeWidth: 4,
1138
- x: h,
1200
+ x: m,
1139
1201
  y: 0
1140
1202
  }),
1141
- /* @__PURE__ */ o(b, {
1142
- draggable: v,
1203
+ /* @__PURE__ */ s(j, {
1204
+ draggable: _,
1143
1205
  name: "geometry-guide",
1144
- onDragEnd: T,
1145
- onDragMove: w,
1146
- children: [/* @__PURE__ */ a(C, {
1206
+ onDragEnd: b,
1207
+ onDragMove: y,
1208
+ children: [/* @__PURE__ */ o(N, {
1147
1209
  cornerRadius: 13,
1148
1210
  fill: "#ffffff",
1149
1211
  height: 26,
@@ -1151,14 +1213,14 @@ function Fe({ disabled: t, guide: s, locked: c, onCommit: l }) {
1151
1213
  offsetY: 13,
1152
1214
  shadowBlur: 8,
1153
1215
  shadowColor: "rgba(10, 143, 85, 0.2)",
1154
- stroke: X,
1216
+ stroke: J,
1155
1217
  strokeWidth: 2,
1156
1218
  width: 70
1157
1219
  }), [
1158
1220
  -14,
1159
1221
  0,
1160
1222
  14
1161
- ].map((e) => /* @__PURE__ */ a(S, {
1223
+ ].map((e) => /* @__PURE__ */ o(M, {
1162
1224
  lineCap: "round",
1163
1225
  points: [
1164
1226
  e,
@@ -1166,24 +1228,24 @@ function Fe({ disabled: t, guide: s, locked: c, onCommit: l }) {
1166
1228
  e,
1167
1229
  7
1168
1230
  ],
1169
- stroke: X,
1231
+ stroke: J,
1170
1232
  strokeWidth: 2
1171
1233
  }, e))]
1172
1234
  })
1173
1235
  ]
1174
1236
  }) });
1175
1237
  }
1176
- function Ie({ disabled: e, guide: t, locked: n, onChange: r }) {
1177
- let s = !e && !n, c = Ze({
1238
+ function it({ disabled: e, guide: t, locked: n, onChange: r }) {
1239
+ let i = !e && !n, c = yt({
1178
1240
  x: 136,
1179
1241
  y: 0
1180
1242
  }, t.rotation, {
1181
1243
  x: t.x,
1182
1244
  y: t.y
1183
1245
  });
1184
- return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ o(b, {
1185
- draggable: s,
1186
- listening: s,
1246
+ return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ s(j, {
1247
+ draggable: i,
1248
+ listening: i,
1187
1249
  name: "geometry-guide",
1188
1250
  onDragMove: (e) => r({
1189
1251
  ...t,
@@ -1194,41 +1256,41 @@ function Ie({ disabled: e, guide: t, locked: n, onChange: r }) {
1194
1256
  x: t.x,
1195
1257
  y: t.y,
1196
1258
  children: [
1197
- /* @__PURE__ */ a(v, {
1259
+ /* @__PURE__ */ o(k, {
1198
1260
  angle: 180,
1199
1261
  fill: "rgba(14, 173, 100, 0.11)",
1200
1262
  innerRadius: 0,
1201
1263
  outerRadius: 110,
1202
1264
  rotation: 180,
1203
- stroke: X,
1265
+ stroke: J,
1204
1266
  strokeWidth: 2
1205
1267
  }),
1206
- /* @__PURE__ */ a(S, {
1268
+ /* @__PURE__ */ o(M, {
1207
1269
  points: [
1208
1270
  -110,
1209
1271
  0,
1210
1272
  110,
1211
1273
  0
1212
1274
  ],
1213
- stroke: X,
1275
+ stroke: J,
1214
1276
  strokeWidth: 2
1215
1277
  }),
1216
1278
  Array.from({ length: 19 }, (e, t) => {
1217
1279
  let n = t * 10, r = (180 - n) * Math.PI / 180, i = {
1218
1280
  x: Math.cos(r) * 110,
1219
1281
  y: -Math.sin(r) * 110
1220
- }, o = {
1282
+ }, a = {
1221
1283
  x: Math.cos(r) * (t % 3 == 0 ? 92 : 100),
1222
1284
  y: -Math.sin(r) * (t % 3 == 0 ? 92 : 100)
1223
1285
  };
1224
- return /* @__PURE__ */ a(S, {
1286
+ return /* @__PURE__ */ o(M, {
1225
1287
  points: [
1226
- o.x,
1227
- o.y,
1288
+ a.x,
1289
+ a.y,
1228
1290
  i.x,
1229
1291
  i.y
1230
1292
  ],
1231
- stroke: X,
1293
+ stroke: J,
1232
1294
  strokeWidth: t % 3 == 0 ? 1.4 : 1
1233
1295
  }, n);
1234
1296
  }),
@@ -1238,8 +1300,8 @@ function Ie({ disabled: e, guide: t, locked: n, onChange: r }) {
1238
1300
  180
1239
1301
  ].map((e) => {
1240
1302
  let t = (180 - e) * Math.PI / 180;
1241
- return /* @__PURE__ */ a(T, {
1242
- fill: X,
1303
+ return /* @__PURE__ */ o(P, {
1304
+ fill: J,
1243
1305
  fontSize: 12,
1244
1306
  fontStyle: "bold",
1245
1307
  text: `${e}`,
@@ -1248,10 +1310,10 @@ function Ie({ disabled: e, guide: t, locked: n, onChange: r }) {
1248
1310
  }, e);
1249
1311
  })
1250
1312
  ]
1251
- }), /* @__PURE__ */ a(y, {
1252
- draggable: s,
1313
+ }), /* @__PURE__ */ o(A, {
1314
+ draggable: i,
1253
1315
  fill: "#fff",
1254
- listening: s,
1316
+ listening: i,
1255
1317
  name: "geometry-guide",
1256
1318
  onDragMove: (e) => {
1257
1319
  let n = e.target.position();
@@ -1261,30 +1323,30 @@ function Ie({ disabled: e, guide: t, locked: n, onChange: r }) {
1261
1323
  });
1262
1324
  },
1263
1325
  radius: 10,
1264
- stroke: X,
1326
+ stroke: J,
1265
1327
  strokeWidth: 3,
1266
1328
  x: c.x,
1267
1329
  y: c.y
1268
1330
  })] });
1269
1331
  }
1270
- function Le({ disabled: e, guide: t, locked: n, onChange: r }) {
1271
- let s = !e && !n, c = {
1332
+ function at({ disabled: e, guide: t, locked: n, onChange: r }) {
1333
+ let i = !e && !n, c = {
1272
1334
  x: t.center.x + t.radius,
1273
1335
  y: t.center.y
1274
1336
  }, l = {
1275
1337
  x: t.center.x + t.radius / 2,
1276
1338
  y: t.center.y - Math.min(90, Math.max(34, t.radius * .68))
1277
1339
  };
1278
- return /* @__PURE__ */ o(i, { children: [
1279
- /* @__PURE__ */ a(y, {
1340
+ return /* @__PURE__ */ s(a, { children: [
1341
+ /* @__PURE__ */ o(A, {
1280
1342
  dash: [8, 8],
1281
1343
  radius: t.radius,
1282
- stroke: X,
1344
+ stroke: J,
1283
1345
  strokeWidth: 2,
1284
1346
  x: t.center.x,
1285
1347
  y: t.center.y
1286
1348
  }),
1287
- /* @__PURE__ */ a(S, {
1349
+ /* @__PURE__ */ o(M, {
1288
1350
  dash: [8, 8],
1289
1351
  points: [
1290
1352
  t.center.x,
@@ -1292,10 +1354,10 @@ function Le({ disabled: e, guide: t, locked: n, onChange: r }) {
1292
1354
  c.x,
1293
1355
  c.y
1294
1356
  ],
1295
- stroke: X,
1357
+ stroke: J,
1296
1358
  strokeWidth: 2
1297
1359
  }),
1298
- /* @__PURE__ */ a(S, {
1360
+ /* @__PURE__ */ o(M, {
1299
1361
  lineCap: "round",
1300
1362
  lineJoin: "round",
1301
1363
  points: [
@@ -1306,55 +1368,55 @@ function Le({ disabled: e, guide: t, locked: n, onChange: r }) {
1306
1368
  c.x,
1307
1369
  c.y
1308
1370
  ],
1309
- stroke: X,
1371
+ stroke: J,
1310
1372
  strokeWidth: 4
1311
1373
  }),
1312
- /* @__PURE__ */ a(y, {
1374
+ /* @__PURE__ */ o(A, {
1313
1375
  fill: "#fff",
1314
1376
  radius: 8,
1315
- stroke: X,
1377
+ stroke: J,
1316
1378
  strokeWidth: 3,
1317
1379
  x: l.x,
1318
1380
  y: l.y
1319
1381
  }),
1320
- /* @__PURE__ */ a(y, {
1321
- draggable: s,
1382
+ /* @__PURE__ */ o(A, {
1383
+ draggable: i,
1322
1384
  fill: "#fff",
1323
- listening: s,
1385
+ listening: i,
1324
1386
  name: "geometry-guide",
1325
1387
  onDragMove: (e) => r({
1326
1388
  ...t,
1327
1389
  center: e.target.position()
1328
1390
  }),
1329
1391
  radius: 11,
1330
- stroke: X,
1392
+ stroke: J,
1331
1393
  strokeWidth: 3,
1332
1394
  x: t.center.x,
1333
1395
  y: t.center.y
1334
1396
  }),
1335
- /* @__PURE__ */ a(y, {
1336
- draggable: s,
1397
+ /* @__PURE__ */ o(A, {
1398
+ draggable: i,
1337
1399
  fill: "#fff",
1338
- listening: s,
1400
+ listening: i,
1339
1401
  name: "geometry-guide",
1340
1402
  onDragMove: (e) => {
1341
1403
  let n = e.target.position();
1342
1404
  r({
1343
1405
  ...t,
1344
- radius: Math.max(14, Q(t.center, n))
1406
+ radius: Math.max(14, X(t.center, n))
1345
1407
  });
1346
1408
  },
1347
1409
  radius: 9,
1348
- stroke: X,
1410
+ stroke: J,
1349
1411
  strokeWidth: 3,
1350
1412
  x: c.x,
1351
1413
  y: c.y
1352
1414
  })
1353
1415
  ] });
1354
1416
  }
1355
- function Re(e, t = !1) {
1417
+ function ot(e, t = !1) {
1356
1418
  let n = t ? .58 : 1;
1357
- return e.type === "freehand" ? /* @__PURE__ */ a(S, {
1419
+ return e.type === "freehand" ? /* @__PURE__ */ o(M, {
1358
1420
  lineCap: "round",
1359
1421
  lineJoin: "round",
1360
1422
  opacity: n,
@@ -1362,13 +1424,13 @@ function Re(e, t = !1) {
1362
1424
  stroke: e.color,
1363
1425
  strokeWidth: e.strokeWidth,
1364
1426
  tension: .45
1365
- }, e.id) : e.type === "line" ? /* @__PURE__ */ a(S, {
1427
+ }, e.id) : e.type === "line" ? /* @__PURE__ */ o(M, {
1366
1428
  lineCap: "round",
1367
1429
  opacity: n,
1368
1430
  points: e.points,
1369
1431
  stroke: e.color,
1370
1432
  strokeWidth: e.strokeWidth
1371
- }, e.id) : /* @__PURE__ */ a(y, {
1433
+ }, e.id) : /* @__PURE__ */ o(A, {
1372
1434
  opacity: n,
1373
1435
  radius: e.radius,
1374
1436
  stroke: e.color,
@@ -1377,7 +1439,7 @@ function Re(e, t = !1) {
1377
1439
  y: e.center.y
1378
1440
  }, e.id);
1379
1441
  }
1380
- function ze(e, t) {
1442
+ function st(e, t) {
1381
1443
  return {
1382
1444
  compass: {
1383
1445
  center: {
@@ -1399,16 +1461,16 @@ function ze(e, t) {
1399
1461
  }
1400
1462
  };
1401
1463
  }
1402
- function Be(e) {
1403
- return e?.elements?.length ? Z(e.elements) : (e?.strokes ?? []).filter((e) => e.tool === "pen" && e.points.length >= 4).map((e) => ({
1404
- color: Oe,
1464
+ function ct(e) {
1465
+ return e?.elements?.length ? Y(e.elements) : (e?.strokes ?? []).filter((e) => e.tool === "pen" && e.points.length >= 4).map((e) => ({
1466
+ color: Ye,
1405
1467
  id: e.id,
1406
1468
  points: e.points.slice(),
1407
1469
  strokeWidth: 4,
1408
1470
  type: "freehand"
1409
1471
  }));
1410
1472
  }
1411
- function Ve(e) {
1473
+ function lt(e) {
1412
1474
  return e.flatMap((e) => e.type === "freehand" ? [{
1413
1475
  id: e.id,
1414
1476
  points: e.points.slice(),
@@ -1419,7 +1481,7 @@ function Ve(e) {
1419
1481
  tool: "pen"
1420
1482
  }] : []);
1421
1483
  }
1422
- function Z(e) {
1484
+ function Y(e) {
1423
1485
  return e.map((e) => e.type === "freehand" ? {
1424
1486
  ...e,
1425
1487
  points: e.points.slice()
@@ -1436,25 +1498,25 @@ function Z(e) {
1436
1498
  center: { ...e.center }
1437
1499
  });
1438
1500
  }
1439
- function He(e, t, n) {
1501
+ function ut(e, t, n) {
1440
1502
  let r = e.map((e) => ({
1441
1503
  x: e.x / 100 * t,
1442
1504
  y: e.y / 100 * n
1443
1505
  })), i = [];
1444
- for (let e = 0; e <= t; e += Y) for (let t = 0; t <= n; t += Y) i.push({
1506
+ for (let e = 0; e <= t; e += q) for (let t = 0; t <= n; t += q) i.push({
1445
1507
  x: e,
1446
1508
  y: t
1447
1509
  });
1448
1510
  return r.concat(i);
1449
1511
  }
1450
- function Ue(e, t) {
1451
- let n = e, r = De;
1512
+ function dt(e, t) {
1513
+ let n = e, r = Je;
1452
1514
  return t.forEach((t) => {
1453
- let i = Q(e, t);
1515
+ let i = X(e, t);
1454
1516
  i < r && (n = t, r = i);
1455
1517
  }), n;
1456
1518
  }
1457
- function We(e) {
1519
+ function ft(e) {
1458
1520
  let t = e;
1459
1521
  for (; t;) {
1460
1522
  if (t.name().split(" ").includes("geometry-guide")) return !0;
@@ -1462,10 +1524,10 @@ function We(e) {
1462
1524
  }
1463
1525
  return !1;
1464
1526
  }
1465
- function Ge(e) {
1527
+ function pt(e) {
1466
1528
  return e === "pen" || e === "line" || e === "eraser";
1467
1529
  }
1468
- function Ke(e) {
1530
+ function mt(e) {
1469
1531
  let t = e.target.getStage()?.getPointerPosition();
1470
1532
  if (!t) return null;
1471
1533
  let n = e.target.getLayer(), r = n?.scaleX() || 1, i = n?.scaleY() || r;
@@ -1474,16 +1536,16 @@ function Ke(e) {
1474
1536
  y: t.y / i
1475
1537
  };
1476
1538
  }
1477
- function qe(e) {
1478
- return e.type === "freehand" ? e.points.length >= 4 : e.type === "line" ? et(e.points) > 6 : e.radius > 6;
1539
+ function ht(e) {
1540
+ return e.type === "freehand" ? e.points.length >= 4 : e.type === "line" ? St(e.points) > 6 : e.radius > 6;
1479
1541
  }
1480
- function Je(e, t) {
1481
- for (let n = e.length - 1; n >= 0; --n) if (Ye(e[n], t)) return n;
1542
+ function gt(e, t) {
1543
+ for (let n = e.length - 1; n >= 0; --n) if (_t(e[n], t)) return n;
1482
1544
  return -1;
1483
1545
  }
1484
- function Ye(e, t) {
1485
- if (e.type === "circle") return Math.abs(Q(e.center, t) - e.radius) <= 14;
1486
- for (let n = 0; n < e.points.length - 2; n += 2) if (Xe(t, {
1546
+ function _t(e, t) {
1547
+ if (e.type === "circle") return Math.abs(X(e.center, t) - e.radius) <= 14;
1548
+ for (let n = 0; n < e.points.length - 2; n += 2) if (vt(t, {
1487
1549
  x1: e.points[n],
1488
1550
  x2: e.points[n + 2],
1489
1551
  y1: e.points[n + 1],
@@ -1491,27 +1553,27 @@ function Ye(e, t) {
1491
1553
  }) <= 14) return !0;
1492
1554
  return !1;
1493
1555
  }
1494
- function Xe(e, t) {
1556
+ function vt(e, t) {
1495
1557
  let n = t.x2 - t.x1, r = t.y2 - t.y1, i = n * n + r * r;
1496
- if (i === 0) return Q(e, {
1558
+ if (i === 0) return X(e, {
1497
1559
  x: t.x1,
1498
1560
  y: t.y1
1499
1561
  });
1500
- let a = tt(((e.x - t.x1) * n + (e.y - t.y1) * r) / i, 0, 1);
1501
- return Q(e, {
1562
+ let a = Ct(((e.x - t.x1) * n + (e.y - t.y1) * r) / i, 0, 1);
1563
+ return X(e, {
1502
1564
  x: t.x1 + a * n,
1503
1565
  y: t.y1 + a * r
1504
1566
  });
1505
1567
  }
1506
- function Ze(e, t, n) {
1568
+ function yt(e, t, n) {
1507
1569
  let r = t * Math.PI / 180, i = Math.cos(r), a = Math.sin(r);
1508
1570
  return {
1509
1571
  x: n.x + e.x * i - e.y * a,
1510
1572
  y: n.y + e.x * a + e.y * i
1511
1573
  };
1512
1574
  }
1513
- function Qe(e, t) {
1514
- return Ze({
1575
+ function bt(e, t) {
1576
+ return yt({
1515
1577
  x: t === "left" ? -e.length / 2 : e.length / 2,
1516
1578
  y: 0
1517
1579
  }, e.rotation, {
@@ -1519,8 +1581,8 @@ function Qe(e, t) {
1519
1581
  y: e.y
1520
1582
  });
1521
1583
  }
1522
- function $e(e, t, n) {
1523
- let r = n === "right" ? "left" : "right", i = Qe(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;
1584
+ function xt(e, t, n) {
1585
+ let r = n === "right" ? "left" : "right", i = bt(e, r), a = Math.atan2(t.y - i.y, t.x - i.x) * 180 / Math.PI, o = wt(n === "right" ? a : a + 180), s = o * Math.PI / 180, c = e.length / 2, l = r === "left" ? 1 : -1;
1524
1586
  return {
1525
1587
  ...e,
1526
1588
  rotation: o,
@@ -1528,8 +1590,8 @@ function $e(e, t, n) {
1528
1590
  y: i.y + Math.sin(s) * c * l
1529
1591
  };
1530
1592
  }
1531
- function et(e) {
1532
- return Q({
1593
+ function St(e) {
1594
+ return X({
1533
1595
  x: e[0],
1534
1596
  y: e[1]
1535
1597
  }, {
@@ -1537,31 +1599,30 @@ function et(e) {
1537
1599
  y: e[3]
1538
1600
  });
1539
1601
  }
1540
- function Q(e, t) {
1602
+ function X(e, t) {
1541
1603
  return Math.hypot(e.x - t.x, e.y - t.y);
1542
1604
  }
1543
- function tt(e, t, n) {
1605
+ function Ct(e, t, n) {
1544
1606
  return Math.min(Math.max(e, t), n);
1545
1607
  }
1546
- function nt(e) {
1608
+ function wt(e) {
1547
1609
  return (e % 360 + 360) % 360;
1548
1610
  }
1549
1611
  //#endregion
1550
1612
  //#region src/exam-session/interactions/KonvaDrawingGrid.tsx
1551
- function rt({ actionLabel: e, points: t, value: n, onChange: r }) {
1552
- return /* @__PURE__ */ a(je, {
1553
- actionLabel: e,
1554
- onChange: r,
1555
- points: t,
1556
- value: n,
1613
+ function Tt({ points: e, value: t, onChange: n }) {
1614
+ return /* @__PURE__ */ o(Qe, {
1615
+ onChange: n,
1616
+ points: e,
1617
+ value: t,
1557
1618
  variant: "question"
1558
1619
  });
1559
1620
  }
1560
1621
  //#endregion
1561
1622
  //#region src/exam-session/interactions/LabelPlacement.tsx
1562
- function it({ labels: e, targets: t, value: n, onChange: r }) {
1563
- let i = n?.placements ?? {}, c = new Set(Object.keys(i));
1564
- return /* @__PURE__ */ a(s, {
1623
+ function Et({ labels: e, targets: t, value: n, onChange: r }) {
1624
+ let i = n?.placements ?? {}, a = new Set(Object.keys(i));
1625
+ return /* @__PURE__ */ o(c, {
1565
1626
  onDragEnd: (e) => {
1566
1627
  if (e.canceled) return;
1567
1628
  let n = e.operation.source?.id?.toString(), a = e.operation.target?.id?.toString(), o = t.find((e) => e.id === a);
@@ -1578,14 +1639,14 @@ function it({ labels: e, targets: t, value: n, onChange: r }) {
1578
1639
  }
1579
1640
  });
1580
1641
  },
1581
- children: /* @__PURE__ */ o("div", {
1642
+ children: /* @__PURE__ */ s("div", {
1582
1643
  className: "label-placement",
1583
- children: [/* @__PURE__ */ a("div", {
1644
+ children: [/* @__PURE__ */ o("div", {
1584
1645
  className: "label-placement__bank",
1585
- children: e.filter((e) => !c.has(e.id)).map((e) => /* @__PURE__ */ a(at, { label: e }, e.id))
1586
- }), /* @__PURE__ */ a("div", {
1646
+ children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ o(Dt, { label: e }, e.id))
1647
+ }), /* @__PURE__ */ o("div", {
1587
1648
  className: "label-placement__diagram",
1588
- children: t.map((t) => /* @__PURE__ */ a(ot, {
1649
+ children: t.map((t) => /* @__PURE__ */ o(Ot, {
1589
1650
  label: e.find((e) => i[e.id]?.targetId === t.id),
1590
1651
  target: t
1591
1652
  }, t.id))
@@ -1593,66 +1654,66 @@ function it({ labels: e, targets: t, value: n, onChange: r }) {
1593
1654
  })
1594
1655
  });
1595
1656
  }
1596
- function at({ label: e }) {
1597
- let { ref: t, isDragging: n } = c({ id: e.id });
1598
- return /* @__PURE__ */ a("button", {
1657
+ function Dt({ label: e }) {
1658
+ let { ref: t, isDragging: n } = l({ id: e.id });
1659
+ return /* @__PURE__ */ o("button", {
1599
1660
  className: n ? "placement-label placement-label--dragging" : "placement-label",
1600
1661
  ref: t,
1601
1662
  type: "button",
1602
1663
  children: e.label
1603
1664
  });
1604
1665
  }
1605
- function ot({ label: e, target: t }) {
1606
- let { ref: n, isDropTarget: r } = l({ id: t.id });
1607
- return /* @__PURE__ */ o("div", {
1666
+ function Ot({ label: e, target: t }) {
1667
+ let { ref: n, isDropTarget: r } = u({ id: t.id });
1668
+ return /* @__PURE__ */ s("div", {
1608
1669
  className: r ? "placement-target placement-target--active" : "placement-target",
1609
1670
  ref: n,
1610
1671
  style: {
1611
1672
  left: `${t.x}%`,
1612
1673
  top: `${t.y}%`
1613
1674
  },
1614
- children: [/* @__PURE__ */ a("span", {
1675
+ children: [/* @__PURE__ */ o("span", {
1615
1676
  "aria-hidden": "true",
1616
1677
  children: t.label
1617
- }), e ? /* @__PURE__ */ a(at, { label: e }) : null]
1678
+ }), e ? /* @__PURE__ */ o(Dt, { label: e }) : null]
1618
1679
  });
1619
1680
  }
1620
1681
  //#endregion
1621
1682
  //#region src/exam-session/interactions/NumberLineAnswer.tsx
1622
- function st({ answerId: e, expression: t, value: n, onChange: r, onClear: i, recognizer: s }) {
1623
- return /* @__PURE__ */ o("div", {
1683
+ function kt({ answerId: e, expression: t, value: n, onChange: r, onClear: i, recognizer: a }) {
1684
+ return /* @__PURE__ */ s("div", {
1624
1685
  className: "number-line-layout",
1625
- children: [/* @__PURE__ */ a(ct, {}), /* @__PURE__ */ o("div", {
1686
+ children: [/* @__PURE__ */ o(At, {}), /* @__PURE__ */ s("div", {
1626
1687
  className: "compact-answer",
1627
- children: [/* @__PURE__ */ a("span", { children: t }), /* @__PURE__ */ a(q, {
1688
+ children: [/* @__PURE__ */ o("span", { children: t }), /* @__PURE__ */ o(G, {
1628
1689
  ariaLabel: t,
1629
1690
  onChange: (t) => r(e, t),
1630
1691
  onClear: () => i(e),
1631
- recognizer: s,
1692
+ recognizer: a,
1632
1693
  value: n
1633
1694
  })]
1634
1695
  })]
1635
1696
  });
1636
1697
  }
1637
- function ct() {
1638
- return /* @__PURE__ */ o("svg", {
1698
+ function At() {
1699
+ return /* @__PURE__ */ s("svg", {
1639
1700
  className: "number-line",
1640
1701
  viewBox: "0 0 520 86",
1641
1702
  role: "img",
1642
1703
  "aria-label": "مُسْتَقِيمٌ عَدَدِيٌّ مِنْ 0 إِلَى 10",
1643
- children: [/* @__PURE__ */ a("line", {
1704
+ children: [/* @__PURE__ */ o("line", {
1644
1705
  x1: "32",
1645
1706
  x2: "488",
1646
1707
  y1: "36",
1647
1708
  y2: "36"
1648
1709
  }), Array.from({ length: 11 }, (e, t) => {
1649
1710
  let n = 32 + t * 45.6;
1650
- return /* @__PURE__ */ o("g", { children: [/* @__PURE__ */ a("line", {
1711
+ return /* @__PURE__ */ s("g", { children: [/* @__PURE__ */ o("line", {
1651
1712
  x1: n,
1652
1713
  x2: n,
1653
1714
  y1: "28",
1654
1715
  y2: "44"
1655
- }), /* @__PURE__ */ a("text", {
1716
+ }), /* @__PURE__ */ o("text", {
1656
1717
  x: n,
1657
1718
  y: "66",
1658
1719
  children: t
@@ -1661,8 +1722,152 @@ function ct() {
1661
1722
  });
1662
1723
  }
1663
1724
  //#endregion
1725
+ //#region src/exam-session/interactions/OperationWorkArea.tsx
1726
+ var Z = 900, jt = 300, Mt = 260;
1727
+ function Nt({ ariaLabel: e, onChange: n, onClear: a, value: c }) {
1728
+ let l = r(null), [u, d] = i(() => Pt(c)), [f, p] = i(!1), [m, g] = i({
1729
+ height: jt,
1730
+ scale: 1,
1731
+ width: Z
1732
+ }), _ = u.length === 0;
1733
+ t(() => {
1734
+ d(Pt(c));
1735
+ }, [c]), t(() => {
1736
+ let e = l.current;
1737
+ if (!e) return;
1738
+ function t() {
1739
+ let t = Math.max(Mt, Math.min(Z, e?.clientWidth ?? Z)), n = t / Z;
1740
+ g({
1741
+ height: jt * n,
1742
+ scale: n,
1743
+ width: t
1744
+ });
1745
+ }
1746
+ t();
1747
+ let n = new ResizeObserver(t);
1748
+ return n.observe(e), () => n.disconnect();
1749
+ }, []);
1750
+ function v(e) {
1751
+ d(e), n({
1752
+ elements: e,
1753
+ kind: "drawing"
1754
+ });
1755
+ }
1756
+ function y(e) {
1757
+ let t = e?.getPointerPosition();
1758
+ return t ? {
1759
+ x: t.x / m.scale,
1760
+ y: t.y / m.scale
1761
+ } : null;
1762
+ }
1763
+ function b(e) {
1764
+ e.evt.preventDefault();
1765
+ let t = y(e.target.getStage());
1766
+ t && (p(!0), v([...u, {
1767
+ color: "#061013",
1768
+ id: `operation-stroke-${Date.now()}-${Math.round(t.x)}-${Math.round(t.y)}`,
1769
+ points: [t.x, t.y],
1770
+ strokeWidth: 8,
1771
+ type: "freehand"
1772
+ }]));
1773
+ }
1774
+ function x(e) {
1775
+ if (!f || _ || !e.evt.buttons && e.evt.pointerType === "mouse") return;
1776
+ e.evt.preventDefault();
1777
+ let t = y(e.target.getStage());
1778
+ t && v(u.map((e, n) => n === u.length - 1 ? {
1779
+ ...e,
1780
+ points: [
1781
+ ...e.points,
1782
+ t.x,
1783
+ t.y
1784
+ ]
1785
+ } : e));
1786
+ }
1787
+ function S(e) {
1788
+ e.evt.preventDefault(), p(!1);
1789
+ }
1790
+ function ee() {
1791
+ p(!1), v([]), a?.();
1792
+ }
1793
+ return /* @__PURE__ */ s("div", {
1794
+ "aria-label": e,
1795
+ className: "operation-work-area",
1796
+ ref: l,
1797
+ children: [/* @__PURE__ */ o(ne, {
1798
+ className: "operation-work-area__stage",
1799
+ height: m.height,
1800
+ onPointerCancel: S,
1801
+ onPointerDown: b,
1802
+ onPointerMove: x,
1803
+ onPointerUp: S,
1804
+ role: "img",
1805
+ width: m.width,
1806
+ children: /* @__PURE__ */ s(te, {
1807
+ scaleX: m.scale,
1808
+ scaleY: m.scale,
1809
+ children: [
1810
+ /* @__PURE__ */ o(N, {
1811
+ cornerRadius: 22,
1812
+ fill: "#fff",
1813
+ height: jt,
1814
+ stroke: "#cfe3d9",
1815
+ strokeWidth: 2,
1816
+ width: Z,
1817
+ x: 0,
1818
+ y: 0
1819
+ }),
1820
+ Array.from({ length: 6 }, (e, t) => /* @__PURE__ */ o(M, {
1821
+ dash: [8, 12],
1822
+ points: [
1823
+ 28,
1824
+ 58 + t * 40,
1825
+ Z - 28,
1826
+ 58 + t * 40
1827
+ ],
1828
+ stroke: "#edf3ef",
1829
+ strokeWidth: 2
1830
+ }, `line-${t}`)),
1831
+ _ ? /* @__PURE__ */ o(P, {
1832
+ align: "center",
1833
+ fill: "#8fa39a",
1834
+ fontFamily: "Arial, sans-serif",
1835
+ fontSize: 24,
1836
+ fontStyle: "bold",
1837
+ height: jt,
1838
+ text: "اكتب خطوات العملية هنا",
1839
+ verticalAlign: "middle",
1840
+ width: Z,
1841
+ x: 0,
1842
+ y: 0
1843
+ }) : null,
1844
+ u.map((e) => /* @__PURE__ */ o(M, {
1845
+ globalCompositeOperation: "source-over",
1846
+ lineCap: "round",
1847
+ lineJoin: "round",
1848
+ points: e.points,
1849
+ stroke: e.color,
1850
+ strokeWidth: e.strokeWidth,
1851
+ tension: .28
1852
+ }, e.id))
1853
+ ]
1854
+ })
1855
+ }), /* @__PURE__ */ o("button", {
1856
+ "aria-label": "مسح خطوات العملية",
1857
+ className: "operation-work-area__clear",
1858
+ disabled: _,
1859
+ onClick: ee,
1860
+ type: "button",
1861
+ children: /* @__PURE__ */ o(h, { "aria-hidden": "true" })
1862
+ })]
1863
+ });
1864
+ }
1865
+ function Pt(e) {
1866
+ return e?.elements?.filter((e) => e.type === "freehand") ?? [];
1867
+ }
1868
+ //#endregion
1664
1869
  //#region src/voice/evaluateVoiceAiResult.ts
1665
- var lt = {
1870
+ var Ft = {
1666
1871
  audioConfig: {
1667
1872
  bitDepth: 16,
1668
1873
  channels: 1,
@@ -1672,18 +1877,18 @@ var lt = {
1672
1877
  lang: "fr",
1673
1878
  useModelAi: !0
1674
1879
  };
1675
- function ut(e, t, n) {
1676
- let r = mt([t, ...n.acceptedPronunciations ?? []]), i = r.map(dt), a = dt(e.transcript), o = i.map((e, t) => ({
1880
+ function It(e, t, n) {
1881
+ let r = Bt([t, ...n.acceptedPronunciations ?? []]), i = r.map(Lt), a = Lt(e.transcript), o = i.map((e, t) => ({
1677
1882
  index: t,
1678
- similarity: pt(a, e)
1883
+ similarity: zt(a, e)
1679
1884
  })).reduce((e, t) => t.similarity > e.similarity ? t : e, {
1680
1885
  index: -1,
1681
1886
  similarity: 0
1682
- }), s = o.index >= 0 ? r[o.index] : null, c = o.similarity === 1, l = ht(n.minimumSimilarity ?? ft(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";
1887
+ }), s = o.index >= 0 ? r[o.index] : null, c = o.similarity === 1, l = Vt(n.minimumSimilarity ?? Rt(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";
1683
1888
  return {
1684
1889
  acceptedPronunciations: r,
1685
1890
  confidence: e.confidence,
1686
- confidencePercent: Math.round(ht(e.confidence, 0, 1) * 100),
1891
+ confidencePercent: Math.round(Vt(e.confidence, 0, 1) * 100),
1687
1892
  detectedPronunciation: e.transcript,
1688
1893
  expectedLanguage: n.expectedLanguage,
1689
1894
  expectedText: t,
@@ -1702,13 +1907,13 @@ function ut(e, t, n) {
1702
1907
  timestamps: e.timestamps ?? []
1703
1908
  };
1704
1909
  }
1705
- function dt(e) {
1910
+ function Lt(e) {
1706
1911
  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();
1707
1912
  }
1708
- function ft(e) {
1709
- return (e ? dt(e).length : 0) <= 4 ? 1 : .85;
1913
+ function Rt(e) {
1914
+ return (e ? Lt(e).length : 0) <= 4 ? 1 : .85;
1710
1915
  }
1711
- function pt(e, t) {
1916
+ function zt(e, t) {
1712
1917
  let n = Array.from(e), r = Array.from(t), i = Math.max(n.length, r.length);
1713
1918
  if (i === 0) return 0;
1714
1919
  let a = Array.from({ length: r.length + 1 }, (e, t) => t);
@@ -1720,185 +1925,185 @@ function pt(e, t) {
1720
1925
  }
1721
1926
  a.splice(0, a.length, ...t);
1722
1927
  }
1723
- return ht(1 - a[r.length] / i, 0, 1);
1928
+ return Vt(1 - a[r.length] / i, 0, 1);
1724
1929
  }
1725
- function mt(e) {
1930
+ function Bt(e) {
1726
1931
  let t = /* @__PURE__ */ new Set();
1727
1932
  return e.filter((e) => {
1728
- let n = dt(e);
1933
+ let n = Lt(e);
1729
1934
  return !n || t.has(n) ? !1 : (t.add(n), !0);
1730
1935
  });
1731
1936
  }
1732
- function ht(e, t, n) {
1937
+ function Vt(e, t, n) {
1733
1938
  return Math.min(n, Math.max(t, e));
1734
1939
  }
1735
1940
  //#endregion
1736
1941
  //#region src/exam-session/interactions/PronunciationRecorder.tsx
1737
- function gt({ acceptedPronunciations: i, expectedText: s, imageAlt: c, imageSrc: l, instruction: u, language: d, minimumSimilarity: p, onChange: g, onReset: _, recorder: v, value: y }) {
1738
- let [b, x] = r("idle"), [S, C] = r(null), [w, T] = r(0), E = n(null), D = n(!1), O = t(() => y ? ut(y.result.modelAiResult, s, {
1739
- acceptedPronunciations: i,
1942
+ function Ht({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc: l, instruction: u, language: d, minimumSimilarity: f, onChange: p, onReset: m, recorder: h, value: g }) {
1943
+ let [_, v] = i("idle"), [b, x] = i(null), [S, w] = i(0), T = r(null), E = r(!1), D = n(() => g ? It(g.result.modelAiResult, a, {
1944
+ acceptedPronunciations: e,
1740
1945
  expectedLanguage: d,
1741
- minimumSimilarity: p
1946
+ minimumSimilarity: f
1742
1947
  }) : null, [
1743
- i,
1744
- s,
1948
+ e,
1949
+ a,
1745
1950
  d,
1746
- p,
1747
- y
1951
+ f,
1952
+ g
1748
1953
  ]);
1749
- e(() => {
1750
- if (b !== "recording") return;
1954
+ t(() => {
1955
+ if (_ !== "recording") return;
1751
1956
  let e = window.setInterval(() => {
1752
- let e = E.current;
1753
- e !== null && T(Date.now() - e);
1957
+ let e = T.current;
1958
+ e !== null && w(Date.now() - e);
1754
1959
  }, 200);
1755
1960
  return () => window.clearInterval(e);
1756
- }, [b]), e(() => () => {
1757
- D.current && v?.stopRecording().catch(() => void 0);
1758
- }, [v]);
1759
- async function k() {
1760
- if (b !== "recording") {
1761
- x("checking"), C(null), _();
1961
+ }, [_]), t(() => () => {
1962
+ E.current && h?.stopRecording().catch(() => void 0);
1963
+ }, [h]);
1964
+ async function O() {
1965
+ if (_ !== "recording") {
1966
+ v("checking"), x(null), m();
1762
1967
  try {
1763
- if (!v) throw Error("مُسجِّل الصَّوت غَير مُتاحٍ فِي هذا التَّطبِيق.");
1968
+ if (!h) throw Error("مُسجِّل الصَّوت غَير مُتاحٍ فِي هذا التَّطبِيق.");
1764
1969
  let e = {
1765
- ...lt,
1970
+ ...Ft,
1766
1971
  lang: d,
1767
1972
  maxDuration: 10
1768
1973
  };
1769
- if (!(await v.startRecording(e)).started) throw Error("تعذّر بدء التسجيل الصوتي.");
1770
- D.current = !0, E.current = Date.now(), T(0), x("recording");
1974
+ if (!(await h.startRecording(e)).started) throw Error("تعذّر بدء التسجيل الصوتي.");
1975
+ E.current = !0, T.current = Date.now(), w(0), v("recording");
1771
1976
  } catch (e) {
1772
- D.current = !1, E.current = null, C(bt(e)), x("error");
1977
+ E.current = !1, T.current = null, x(qt(e)), v("error");
1773
1978
  }
1774
1979
  }
1775
1980
  }
1776
- async function A() {
1777
- if (b === "recording") {
1778
- x("processing"), C(null);
1981
+ async function k() {
1982
+ if (_ === "recording") {
1983
+ v("processing"), x(null);
1779
1984
  try {
1780
- if (!v) throw Error("مُسجِّل الصَّوت غَير مُتاحٍ فِي هذا التَّطبِيق.");
1781
- let e = await v.stopRecording(), t = ut(e.modelAiResult, s, {
1782
- acceptedPronunciations: i,
1985
+ if (!h) throw Error("مُسجِّل الصَّوت غَير مُتاحٍ فِي هذا التَّطبِيق.");
1986
+ let t = await h.stopRecording(), n = It(t.modelAiResult, a, {
1987
+ acceptedPronunciations: e,
1783
1988
  expectedLanguage: d,
1784
- minimumSimilarity: p
1989
+ minimumSimilarity: f
1785
1990
  });
1786
- D.current = !1, E.current = null, T(e.duration), g({
1787
- evaluation: t,
1991
+ E.current = !1, T.current = null, w(t.duration), p({
1992
+ evaluation: n,
1788
1993
  kind: "audio-recording",
1789
- result: e
1790
- }), x("idle");
1994
+ result: t
1995
+ }), v("idle");
1791
1996
  } catch (e) {
1792
- D.current = !1, E.current = null, C(bt(e)), x("error");
1997
+ E.current = !1, T.current = null, x(qt(e)), v("error");
1793
1998
  }
1794
1999
  }
1795
2000
  }
1796
- function j() {
1797
- C(null), T(0), x("idle"), _();
2001
+ function A() {
2002
+ x(null), w(0), v("idle"), m();
1798
2003
  }
1799
- let M = b === "checking" || b === "processing", N = b === "recording" ? w : y?.result.duration ?? w;
1800
- return /* @__PURE__ */ o("div", {
2004
+ let j = _ === "checking" || _ === "processing", te = _ === "recording" ? S : g?.result.duration ?? S;
2005
+ return /* @__PURE__ */ s("div", {
1801
2006
  className: "audio-debug-card",
1802
- "data-status": b,
2007
+ "data-status": _,
1803
2008
  children: [
1804
- /* @__PURE__ */ o("div", {
2009
+ /* @__PURE__ */ s("div", {
1805
2010
  className: "audio-pronunciation-target",
1806
- children: [/* @__PURE__ */ a("div", {
2011
+ children: [/* @__PURE__ */ o("div", {
1807
2012
  className: "audio-pronunciation-image-frame",
1808
- children: /* @__PURE__ */ a("img", {
2013
+ children: /* @__PURE__ */ o("img", {
1809
2014
  alt: c,
1810
2015
  src: l
1811
2016
  })
1812
- }), /* @__PURE__ */ o("div", {
2017
+ }), /* @__PURE__ */ s("div", {
1813
2018
  className: "audio-pronunciation-copy",
1814
2019
  children: [
1815
- /* @__PURE__ */ o("span", { children: [
2020
+ /* @__PURE__ */ s("span", { children: [
1816
2021
  "اُنْطِقِ الكَلِمَةَ بِـ",
1817
- yt(d),
2022
+ Kt(d),
1818
2023
  ":"
1819
2024
  ] }),
1820
- /* @__PURE__ */ a("strong", {
2025
+ /* @__PURE__ */ o("strong", {
1821
2026
  dir: d === "ar" ? "rtl" : "ltr",
1822
- children: s
2027
+ children: a
1823
2028
  }),
1824
- /* @__PURE__ */ a("p", { children: u })
2029
+ /* @__PURE__ */ o("p", { children: u })
1825
2030
  ]
1826
2031
  })]
1827
2032
  }),
1828
- /* @__PURE__ */ o("div", {
2033
+ /* @__PURE__ */ s("div", {
1829
2034
  className: "audio-debug-card__hero",
1830
2035
  "aria-live": "polite",
1831
- children: [/* @__PURE__ */ a("span", {
2036
+ children: [/* @__PURE__ */ o("span", {
1832
2037
  className: "audio-debug-card__icon",
1833
2038
  "aria-hidden": "true",
1834
- children: /* @__PURE__ */ a(f, {})
1835
- }), /* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("strong", { children: xt(b, !!y) }), /* @__PURE__ */ a("span", { children: vt(N) })] })]
2039
+ children: /* @__PURE__ */ o(y, {})
2040
+ }), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("strong", { children: Jt(_, !!g) }), /* @__PURE__ */ o("span", { children: Gt(te) })] })]
1836
2041
  }),
1837
- /* @__PURE__ */ o("div", {
2042
+ /* @__PURE__ */ s("div", {
1838
2043
  className: "audio-debug-actions",
1839
2044
  children: [
1840
- /* @__PURE__ */ o("button", {
2045
+ /* @__PURE__ */ s("button", {
1841
2046
  className: "audio-debug-button audio-debug-button--record",
1842
- disabled: b === "recording" || M,
1843
- onClick: k,
2047
+ disabled: _ === "recording" || j,
2048
+ onClick: O,
1844
2049
  type: "button",
1845
- children: [/* @__PURE__ */ a(f, { "aria-hidden": "true" }), /* @__PURE__ */ a("span", { children: y ? "سَجِّلْ مُحاوَلَةً جَدِيدَةً" : "اِبْدَأِ التَّسْجِيلَ" })]
2050
+ children: [/* @__PURE__ */ o(y, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: g ? "سَجِّلْ مُحاوَلَةً جَدِيدَةً" : "اِبْدَأِ التَّسْجِيلَ" })]
1846
2051
  }),
1847
- /* @__PURE__ */ o("button", {
2052
+ /* @__PURE__ */ s("button", {
1848
2053
  className: "audio-debug-button audio-debug-button--stop",
1849
- disabled: b !== "recording",
1850
- onClick: A,
2054
+ disabled: _ !== "recording",
2055
+ onClick: k,
1851
2056
  type: "button",
1852
- children: [/* @__PURE__ */ a(h, { "aria-hidden": "true" }), /* @__PURE__ */ a("span", { children: "أَنْهِ التَّسْجِيلَ" })]
2057
+ children: [/* @__PURE__ */ o(C, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: "أَنْهِ التَّسْجِيلَ" })]
1853
2058
  }),
1854
- /* @__PURE__ */ o("button", {
2059
+ /* @__PURE__ */ s("button", {
1855
2060
  className: "audio-debug-button audio-debug-button--reset",
1856
- disabled: b === "recording" || M || !y && !S,
1857
- onClick: j,
2061
+ disabled: _ === "recording" || j || !g && !b,
2062
+ onClick: A,
1858
2063
  type: "button",
1859
- children: [/* @__PURE__ */ a(m, { "aria-hidden": "true" }), /* @__PURE__ */ a("span", { children: "إِعادَةُ المُحاوَلَةِ" })]
2064
+ children: [/* @__PURE__ */ o(ee, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: "إِعادَةُ المُحاوَلَةِ" })]
1860
2065
  })
1861
2066
  ]
1862
2067
  }),
1863
- S ? /* @__PURE__ */ a("p", {
2068
+ b ? /* @__PURE__ */ o("p", {
1864
2069
  className: "audio-debug-message",
1865
2070
  role: "alert",
1866
- children: S
2071
+ children: b
1867
2072
  }) : null,
1868
- y && O ? /* @__PURE__ */ o("section", {
2073
+ g && D ? /* @__PURE__ */ s("section", {
1869
2074
  className: "audio-pronunciation-feedback",
1870
- "data-outcome": O.status,
2075
+ "data-outcome": D.status,
1871
2076
  "data-testid": "pronunciation-feedback",
1872
2077
  role: "status",
1873
- children: [/* @__PURE__ */ o("div", {
2078
+ children: [/* @__PURE__ */ s("div", {
1874
2079
  className: "audio-pronunciation-feedback__headline",
1875
- children: [/* @__PURE__ */ a(_t, { status: O.status }), /* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("strong", { children: St(O.status) }), /* @__PURE__ */ a("span", { children: Ct(O.status, s) })] })]
1876
- }), /* @__PURE__ */ o("div", {
2080
+ children: [/* @__PURE__ */ o(Ut, { status: D.status }), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("strong", { children: Yt(D.status) }), /* @__PURE__ */ o("span", { children: Xt(D.status, a) })] })]
2081
+ }), /* @__PURE__ */ s("div", {
1877
2082
  className: "audio-debug-metadata",
1878
2083
  children: [
1879
- /* @__PURE__ */ a($, {
2084
+ /* @__PURE__ */ o(Wt, {
1880
2085
  label: "ما تَعَرَّفَ عَلَيْهِ النَّمُوذَجُ",
1881
- value: O.detectedPronunciation || "—"
2086
+ value: D.detectedPronunciation || "—"
1882
2087
  }),
1883
- /* @__PURE__ */ a($, {
2088
+ /* @__PURE__ */ o(Wt, {
1884
2089
  label: "نِسْبَةُ التَّطابُقِ",
1885
- value: `${O.similarityPercent}%`
2090
+ value: `${D.similarityPercent}%`
1886
2091
  }),
1887
- /* @__PURE__ */ a($, {
2092
+ /* @__PURE__ */ o(Wt, {
1888
2093
  label: "ثِقَةُ النَّمُوذَجِ",
1889
- value: `${O.confidencePercent}%`
2094
+ value: `${D.confidencePercent}%`
1890
2095
  }),
1891
- /* @__PURE__ */ a($, {
2096
+ /* @__PURE__ */ o(Wt, {
1892
2097
  label: "اللُّغَةُ",
1893
- value: O.language.toUpperCase()
2098
+ value: D.language.toUpperCase()
1894
2099
  }),
1895
- /* @__PURE__ */ a($, {
2100
+ /* @__PURE__ */ o(Wt, {
1896
2101
  label: "زَمَنُ التَّحْلِيلِ",
1897
- value: `${O.latencyMs} ms`
2102
+ value: `${D.latencyMs} ms`
1898
2103
  }),
1899
- /* @__PURE__ */ a($, {
2104
+ /* @__PURE__ */ o(Wt, {
1900
2105
  label: "عَدَدُ الرُّمُوزِ الصَّوْتِيَّةِ",
1901
- value: O.timestamps.length.toString()
2106
+ value: D.timestamps.length.toString()
1902
2107
  })
1903
2108
  ]
1904
2109
  })]
@@ -1906,54 +2111,54 @@ function gt({ acceptedPronunciations: i, expectedText: s, imageAlt: c, imageSrc:
1906
2111
  ]
1907
2112
  });
1908
2113
  }
1909
- function _t({ status: e }) {
1910
- return a(e === "correct" ? u : e === "no-speech" ? g : _, { "aria-hidden": "true" });
2114
+ function Ut({ status: e }) {
2115
+ return o(e === "correct" ? f : e === "no-speech" ? D : O, { "aria-hidden": "true" });
1911
2116
  }
1912
- function $({ label: e, value: t }) {
1913
- return /* @__PURE__ */ o("span", {
2117
+ function Wt({ label: e, value: t }) {
2118
+ return /* @__PURE__ */ s("span", {
1914
2119
  className: "audio-debug-meta-card",
1915
- children: [/* @__PURE__ */ a("small", { children: e }), /* @__PURE__ */ a("strong", {
2120
+ children: [/* @__PURE__ */ o("small", { children: e }), /* @__PURE__ */ o("strong", {
1916
2121
  dir: "ltr",
1917
2122
  children: t
1918
2123
  })]
1919
2124
  });
1920
2125
  }
1921
- function vt(e) {
2126
+ function Gt(e) {
1922
2127
  let t = Math.max(0, Math.round(e / 1e3)), n = Math.floor(t / 60), r = t % 60;
1923
2128
  return `${n.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}`;
1924
2129
  }
1925
- function yt(e) {
2130
+ function Kt(e) {
1926
2131
  return e === "fr" ? "الفَرَنْسِيَّةِ" : "العَرَبِيَّةِ";
1927
2132
  }
1928
- function bt(e) {
2133
+ function qt(e) {
1929
2134
  let t = e;
1930
2135
  return t.code === "MISSING_PERMISSION" ? "يَجِبُ السَّماحُ بِاسْتِعْمالِ المِيكْرُوفُونِ لِتَسْجِيلِ الإِجابَةِ." : t.code === "MODEL_VOCAB_MISMATCH" ? "مَلَفُّ نَمُوذَجِ اللُّغَةِ لا يُطابِقُ قامُوسَهُ. يُرْجى تَصْحِيحُ مَلَفِّ النَّمُوذَجِ." : t.message ? t.message : typeof e == "string" ? e : "حَدَثَ خَطَأٌ أَثْناءَ تَسْجِيلِ الإِجابَةِ الصَّوْتِيَّةِ.";
1931
2136
  }
1932
- function xt(e, t) {
2137
+ function Jt(e, t) {
1933
2138
  return e === "checking" ? "جارِي تَجْهِيزُ المِيكْرُوفُونِ" : e === "recording" ? "جارِي التَّسْجِيلُ... تَكَلَّمِ الآنَ" : e === "processing" ? "جارِي تَحْلِيلُ النُّطْقِ" : e === "error" ? "تَعَذَّرَ تَحْلِيلُ التَّسْجِيلِ" : t ? "اِكْتَمَلَ تَحْلِيلُ الإِجابَةِ" : "المِيكْرُوفُونُ جاهِزٌ";
1934
2139
  }
1935
- function St(e) {
2140
+ function Yt(e) {
1936
2141
  return e === "correct" ? "أَحْسَنْتَ! إِجابَةٌ صَحِيحَةٌ" : e === "no-speech" ? "لَمْ نَسْمَعْ كَلِمَةً واضِحَةً" : e === "language-mismatch" ? "اُسْتُعْمِلَ نَمُوذَجُ لُغَةٍ مُخْتَلِفَةٍ" : "حاوِلْ مَرَّةً أُخْرى";
1937
2142
  }
1938
- function Ct(e, t) {
2143
+ function Xt(e, t) {
1939
2144
  return e === "correct" ? `نَطَقْتَ «${t}» بِشَكْلٍ صَحِيحٍ.` : e === "no-speech" ? `قَرِّبْ فَمَكَ مِنَ المِيكْرُوفُونِ وَقُلْ «${t}».` : `اِسْتَمِعْ إِلى نُطْقِ «${t}» ثُمَّ أَعِدِ المُحاوَلَةَ.`;
1940
2145
  }
1941
2146
  //#endregion
1942
2147
  //#region src/exam-session/interactions/SortableAnswer.tsx
1943
- function wt({ answerId: e, items: t, value: n, onChange: r }) {
1944
- let i = new Map(t.map((e) => [e.id, e])), o = n?.itemIds.length === t.length ? n.itemIds.filter((e) => i.has(e)) : t.map((e) => e.id);
1945
- return /* @__PURE__ */ a(s, {
2148
+ function Zt({ answerId: e, items: t, value: n, onChange: r }) {
2149
+ 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);
2150
+ return /* @__PURE__ */ o(c, {
1946
2151
  onDragEnd: (e) => {
1947
2152
  e.canceled || r({
1948
2153
  kind: "order",
1949
- itemIds: E(o, e).map((e) => e.toString())
2154
+ itemIds: F(a, e).map((e) => e.toString())
1950
2155
  });
1951
2156
  },
1952
- children: /* @__PURE__ */ a("div", {
2157
+ children: /* @__PURE__ */ o("div", {
1953
2158
  className: "sortable-answer",
1954
- children: o.map((t, n) => {
2159
+ children: a.map((t, n) => {
1955
2160
  let r = i.get(t);
1956
- return r ? /* @__PURE__ */ a(Tt, {
2161
+ return r ? /* @__PURE__ */ o(Qt, {
1957
2162
  group: e,
1958
2163
  index: n,
1959
2164
  item: r
@@ -1962,18 +2167,18 @@ function wt({ answerId: e, items: t, value: n, onChange: r }) {
1962
2167
  })
1963
2168
  });
1964
2169
  }
1965
- function Tt({ group: e, index: t, item: n }) {
1966
- let { ref: r, isDragging: i, isDropTarget: o } = D({
2170
+ function Qt({ group: e, index: t, item: n }) {
2171
+ let { ref: r, isDragging: i, isDropTarget: a } = I({
1967
2172
  id: n.id,
1968
2173
  index: t,
1969
2174
  group: e,
1970
2175
  type: "sortable-answer"
1971
2176
  });
1972
- return /* @__PURE__ */ a("button", {
2177
+ return /* @__PURE__ */ o("button", {
1973
2178
  className: [
1974
2179
  "sortable-token",
1975
2180
  i ? "sortable-token--dragging" : "",
1976
- o ? "sortable-token--target" : ""
2181
+ a ? "sortable-token--target" : ""
1977
2182
  ].filter(Boolean).join(" "),
1978
2183
  ref: r,
1979
2184
  type: "button",
@@ -1982,8 +2187,8 @@ function Tt({ group: e, index: t, item: n }) {
1982
2187
  }
1983
2188
  //#endregion
1984
2189
  //#region src/exam-session/interactions/TextAnswer.tsx
1985
- function Et({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onChange: i }) {
1986
- return /* @__PURE__ */ a("input", {
2190
+ function $t({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onChange: i }) {
2191
+ return /* @__PURE__ */ o("input", {
1987
2192
  "aria-label": e,
1988
2193
  className: t,
1989
2194
  inputMode: n,
@@ -1995,35 +2200,186 @@ function Et({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onCha
1995
2200
  });
1996
2201
  }
1997
2202
  //#endregion
2203
+ //#region src/renderer/visualScene.tsx
2204
+ var en = {
2205
+ apple: d,
2206
+ circle: p,
2207
+ flower: g,
2208
+ heart: _,
2209
+ hexagon: v,
2210
+ square: C,
2211
+ star: w,
2212
+ sun: T,
2213
+ triangle: E
2214
+ }, tn = {
2215
+ blue: "#4d89d9",
2216
+ gray: "#8c97a0",
2217
+ green: "#1f9d63",
2218
+ orange: "#f39b2b",
2219
+ purple: "#8a63d2",
2220
+ red: "#eb5b5b",
2221
+ yellow: "#f2c641"
2222
+ }, nn = {
2223
+ "counter-rows": { rows: [{
2224
+ color: "yellow",
2225
+ count: 5,
2226
+ icon: "circle",
2227
+ id: "counter-top",
2228
+ state: "plain"
2229
+ }, {
2230
+ color: "yellow",
2231
+ count: 4,
2232
+ icon: "circle",
2233
+ id: "counter-bottom",
2234
+ state: "crossed"
2235
+ }] },
2236
+ "sun-stars": { rows: [{
2237
+ color: "yellow",
2238
+ count: 4,
2239
+ icon: "sun",
2240
+ id: "sun-row",
2241
+ state: "plain"
2242
+ }, {
2243
+ color: "gray",
2244
+ count: 2,
2245
+ icon: "star",
2246
+ id: "star-row",
2247
+ state: "plain"
2248
+ }] }
2249
+ }, rn = [
2250
+ {
2251
+ label: "Cercle",
2252
+ value: "circle"
2253
+ },
2254
+ {
2255
+ label: "Etoile",
2256
+ value: "star"
2257
+ },
2258
+ {
2259
+ label: "Soleil",
2260
+ value: "sun"
2261
+ },
2262
+ {
2263
+ label: "Pomme",
2264
+ value: "apple"
2265
+ },
2266
+ {
2267
+ label: "Triangle",
2268
+ value: "triangle"
2269
+ },
2270
+ {
2271
+ label: "Carre",
2272
+ value: "square"
2273
+ },
2274
+ {
2275
+ label: "Coeur",
2276
+ value: "heart"
2277
+ },
2278
+ {
2279
+ label: "Fleur",
2280
+ value: "flower"
2281
+ },
2282
+ {
2283
+ label: "Hexagone",
2284
+ value: "hexagon"
2285
+ }
2286
+ ], an = [
2287
+ {
2288
+ label: "Jaune",
2289
+ value: "yellow"
2290
+ },
2291
+ {
2292
+ label: "Bleu",
2293
+ value: "blue"
2294
+ },
2295
+ {
2296
+ label: "Vert",
2297
+ value: "green"
2298
+ },
2299
+ {
2300
+ label: "Rouge",
2301
+ value: "red"
2302
+ },
2303
+ {
2304
+ label: "Orange",
2305
+ value: "orange"
2306
+ },
2307
+ {
2308
+ label: "Violet",
2309
+ value: "purple"
2310
+ },
2311
+ {
2312
+ label: "Gris",
2313
+ value: "gray"
2314
+ }
2315
+ ], on = [{
2316
+ label: "Normal",
2317
+ value: "plain"
2318
+ }, {
2319
+ label: "Barre",
2320
+ value: "crossed"
2321
+ }];
2322
+ function sn(e) {
2323
+ return { rows: nn[e].rows.map((e) => ({ ...e })) };
2324
+ }
2325
+ function cn(e) {
2326
+ return tn[e];
2327
+ }
2328
+ function ln({ scene: e }) {
2329
+ return /* @__PURE__ */ o("div", {
2330
+ className: "visual-panel visual-panel--custom",
2331
+ "aria-hidden": "true",
2332
+ children: /* @__PURE__ */ o("div", {
2333
+ className: "visual-scene",
2334
+ children: e.rows.map((e) => /* @__PURE__ */ o("div", {
2335
+ className: "visual-scene-row",
2336
+ children: Array.from({ length: Math.max(1, Math.floor(e.count) || 1) }, (t, n) => /* @__PURE__ */ o(un, {
2337
+ color: e.color,
2338
+ icon: e.icon,
2339
+ state: e.state
2340
+ }, `${e.id}-${n}`))
2341
+ }, e.id))
2342
+ })
2343
+ });
2344
+ }
2345
+ function un({ color: e, icon: t, state: n }) {
2346
+ let r = en[t];
2347
+ return /* @__PURE__ */ o("span", {
2348
+ className: n === "crossed" ? "visual-scene-icon visual-scene-icon--crossed" : "visual-scene-icon",
2349
+ style: { color: cn(e) },
2350
+ children: /* @__PURE__ */ o(r, { "aria-hidden": "true" })
2351
+ });
2352
+ }
2353
+ //#endregion
1998
2354
  //#region src/renderer/QuestionRenderer.tsx
1999
- function Dt({ adapters: e, clearAnswer: t, question: n, getAnswer: r, updateAnswer: i }) {
2000
- return /* @__PURE__ */ o("article", {
2355
+ function dn({ adapters: e, clearAnswer: t, question: n, getAnswer: r, updateAnswer: i }) {
2356
+ return /* @__PURE__ */ s("article", {
2001
2357
  className: `question-block question-block--${n.type}`,
2002
- children: [/* @__PURE__ */ a(kt, {
2358
+ children: [/* @__PURE__ */ o(pn, {
2003
2359
  number: n.number,
2004
2360
  prompt: n.prompt
2005
- }), At(n, r, i, t, e)]
2361
+ }), mn(n, r, i, t, e)]
2006
2362
  });
2007
2363
  }
2008
- function Ot({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswer: i }) {
2009
- return /* @__PURE__ */ o("section", {
2364
+ function fn({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswer: i }) {
2365
+ return /* @__PURE__ */ s("section", {
2010
2366
  className: `question-section question-section--${n.tone}`,
2011
- children: [/* @__PURE__ */ o("header", {
2367
+ children: [/* @__PURE__ */ s("header", {
2012
2368
  className: "section-heading",
2013
2369
  children: [
2014
- /* @__PURE__ */ o("span", {
2370
+ /* @__PURE__ */ s("span", {
2015
2371
  className: "section-points",
2016
- children: [/* @__PURE__ */ a("small", { children: "ن" }), n.points]
2372
+ children: [/* @__PURE__ */ o("small", { children: "ن" }), n.points]
2017
2373
  }),
2018
- /* @__PURE__ */ a("h3", { children: n.title }),
2019
- /* @__PURE__ */ a("span", {
2374
+ /* @__PURE__ */ o("h3", { children: n.title }),
2375
+ /* @__PURE__ */ o("span", {
2020
2376
  className: "section-badge",
2021
2377
  children: n.badge
2022
2378
  })
2023
2379
  ]
2024
- }), /* @__PURE__ */ a("div", {
2380
+ }), /* @__PURE__ */ o("div", {
2025
2381
  className: "section-body",
2026
- children: n.questions.map((n) => /* @__PURE__ */ a(Dt, {
2382
+ children: n.questions.map((n) => /* @__PURE__ */ o(dn, {
2027
2383
  adapters: e,
2028
2384
  clearAnswer: t,
2029
2385
  getAnswer: r,
@@ -2033,87 +2389,101 @@ function Ot({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswe
2033
2389
  })]
2034
2390
  });
2035
2391
  }
2036
- function kt({ number: e, prompt: t }) {
2037
- return /* @__PURE__ */ o("div", {
2392
+ function pn({ number: e, prompt: t }) {
2393
+ return /* @__PURE__ */ s("div", {
2038
2394
  className: "question-prompt",
2039
- children: [e > 0 ? /* @__PURE__ */ a("span", { children: e }) : null, /* @__PURE__ */ a("strong", { children: t })]
2395
+ children: [e > 0 ? /* @__PURE__ */ o("span", { children: e }) : null, /* @__PURE__ */ o("strong", { children: t })]
2040
2396
  });
2041
2397
  }
2042
- function At(e, t, n, r, s) {
2398
+ function mn(e, t, n, r, i) {
2043
2399
  switch (e.type) {
2044
- case "inline-inputs": return /* @__PURE__ */ a("div", {
2400
+ case "inline-inputs": return /* @__PURE__ */ o("div", {
2045
2401
  className: "inline-equation-grid",
2046
- children: e.items.map((i) => {
2047
- let c = `${e.id}:${i.id}`;
2048
- return /* @__PURE__ */ o("div", {
2049
- className: "equation-card",
2050
- children: [
2051
- /* @__PURE__ */ a("span", { children: i.before }),
2052
- /* @__PURE__ */ a(q, {
2053
- ariaLabel: i.before,
2054
- onChange: (e) => n(c, e),
2055
- onClear: () => r(c),
2056
- recognizer: s?.handwritingRecognizer,
2057
- value: Mt(t(c))
2058
- }),
2059
- i.after ? /* @__PURE__ */ a("span", { children: i.after }) : null
2060
- ]
2061
- }, i.id);
2062
- })
2402
+ children: e.items.map((a) => hn({
2403
+ adapters: i,
2404
+ className: "equation-card",
2405
+ clearAnswer: r,
2406
+ getAnswer: t,
2407
+ item: a,
2408
+ questionId: e.id,
2409
+ updateAnswer: n
2410
+ }))
2063
2411
  });
2064
- case "visual-choice": return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(Ut, {
2412
+ case "visual-choice": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(On, {
2065
2413
  choices: e.choices,
2066
2414
  onChange: (t) => n(e.id, t),
2067
- value: Pt(t(e.id)),
2415
+ scene: e.scene,
2416
+ value: vn(t(e.id)),
2068
2417
  visual: e.visual
2069
- }), e.inputLabel ? /* @__PURE__ */ o("div", {
2418
+ }), e.inputLabel ? /* @__PURE__ */ s("div", {
2070
2419
  className: "compact-answer",
2071
- children: [/* @__PURE__ */ a("span", { children: e.inputLabel }), /* @__PURE__ */ a(q, {
2420
+ children: [/* @__PURE__ */ o("span", { children: e.inputLabel }), /* @__PURE__ */ o(G, {
2072
2421
  ariaLabel: e.inputLabel,
2073
2422
  onChange: (t) => n(`${e.id}:input`, t),
2074
2423
  onClear: () => r(`${e.id}:input`),
2075
- recognizer: s?.handwritingRecognizer,
2076
- value: Mt(t(`${e.id}:input`))
2424
+ recognizer: i?.handwritingRecognizer,
2425
+ value: Q(t(`${e.id}:input`))
2077
2426
  })]
2078
2427
  }) : null] });
2079
- case "number-line": return /* @__PURE__ */ a(st, {
2428
+ case "number-line": return /* @__PURE__ */ o(kt, {
2080
2429
  answerId: e.id,
2081
2430
  expression: e.expression,
2082
2431
  onClear: r,
2083
2432
  onChange: n,
2084
- recognizer: s?.handwritingRecognizer,
2085
- value: Mt(t(e.id))
2433
+ recognizer: i?.handwritingRecognizer,
2434
+ value: Q(t(e.id))
2435
+ });
2436
+ case "operation-solving": return /* @__PURE__ */ s("div", {
2437
+ className: `operation-solving operation-solving--${e.solutionMode}`,
2438
+ children: [
2439
+ /* @__PURE__ */ o("div", {
2440
+ className: "operation-solving__equation-card",
2441
+ children: /* @__PURE__ */ o("span", { children: wn(e) })
2442
+ }),
2443
+ e.solutionMode === "full-process" ? /* @__PURE__ */ s("div", {
2444
+ className: "operation-solving__work",
2445
+ children: [/* @__PURE__ */ o("strong", { children: "أَنْجِزُ الْعَمَلِيَّةَ" }), /* @__PURE__ */ o(Nt, {
2446
+ ariaLabel: "مساحة إنجاز العملية",
2447
+ onChange: (t) => n(`${e.id}:work`, t),
2448
+ onClear: () => r(`${e.id}:work`),
2449
+ value: xn(t(`${e.id}:work`))
2450
+ })]
2451
+ }) : null,
2452
+ /* @__PURE__ */ s("div", {
2453
+ className: "operation-solving__answer compact-answer",
2454
+ children: [/* @__PURE__ */ o("span", { children: "النَّتِيجَةُ" }), /* @__PURE__ */ o(G, {
2455
+ ariaLabel: "اكتب نتيجة العملية",
2456
+ onChange: (t) => n(e.id, t),
2457
+ onClear: () => r(e.id),
2458
+ recognizer: i?.handwritingRecognizer,
2459
+ value: Q(t(e.id))
2460
+ })]
2461
+ })
2462
+ ]
2086
2463
  });
2087
- case "equation-inputs": return /* @__PURE__ */ a("div", {
2464
+ case "equation-inputs": return /* @__PURE__ */ o("div", {
2088
2465
  className: "stacked-equations",
2089
- children: e.items.map((i) => {
2090
- let c = `${e.id}:${i.id}`;
2091
- return /* @__PURE__ */ o("div", {
2092
- className: "wide-equation-card",
2093
- children: [
2094
- /* @__PURE__ */ a("span", { children: i.before }),
2095
- /* @__PURE__ */ a(q, {
2096
- ariaLabel: `${e.prompt} ${i.before}`,
2097
- onChange: (e) => n(c, e),
2098
- onClear: () => r(c),
2099
- recognizer: s?.handwritingRecognizer,
2100
- value: Mt(t(c))
2101
- }),
2102
- i.after ? /* @__PURE__ */ a("span", { children: i.after }) : null
2103
- ]
2104
- }, i.id);
2105
- })
2466
+ children: e.items.map((a) => hn({
2467
+ adapters: i,
2468
+ ariaPrefix: e.prompt,
2469
+ className: "wide-equation-card",
2470
+ clearAnswer: r,
2471
+ getAnswer: t,
2472
+ item: a,
2473
+ questionId: e.id,
2474
+ updateAnswer: n
2475
+ }))
2106
2476
  });
2107
- case "length-estimation": return /* @__PURE__ */ a(Wt, {
2477
+ case "length-estimation": return /* @__PURE__ */ o(kn, {
2108
2478
  answerId: e.id,
2109
2479
  choices: e.choices,
2110
2480
  getAnswer: t,
2111
2481
  items: e.items,
2112
2482
  updateAnswer: n
2113
2483
  });
2114
- case "shape-choice": return /* @__PURE__ */ o("div", {
2484
+ case "shape-choice": return /* @__PURE__ */ s("div", {
2115
2485
  className: "shape-choice-layout",
2116
- children: [/* @__PURE__ */ a(me, {
2486
+ children: [/* @__PURE__ */ o(Pe, {
2117
2487
  items: e.choices.map((e) => ({
2118
2488
  id: `${e.id}-label`,
2119
2489
  label: e.label
@@ -2121,62 +2491,79 @@ function At(e, t, n, r, s) {
2121
2491
  onChange: (t) => n(e.id, t),
2122
2492
  targets: e.choices.map((e) => ({
2123
2493
  id: `${e.id}-target`,
2124
- label: Bt(e.id)
2494
+ label: En(e.id)
2125
2495
  })),
2126
- value: Pt(t(e.id))
2127
- }), /* @__PURE__ */ a("div", {
2496
+ value: vn(t(e.id))
2497
+ }), /* @__PURE__ */ o("div", {
2128
2498
  className: "shape-row",
2129
2499
  "aria-hidden": "true",
2130
- children: e.choices.map((e) => /* @__PURE__ */ a("span", { className: `shape-drawing shape-drawing--${e.id}` }, e.id))
2500
+ children: e.choices.map((e) => /* @__PURE__ */ o("span", { className: `shape-drawing shape-drawing--${e.id}` }, e.id))
2131
2501
  })]
2132
2502
  });
2133
- case "drawing-grid": return /* @__PURE__ */ a(rt, {
2134
- actionLabel: e.actionLabel,
2503
+ case "drawing-grid": return /* @__PURE__ */ o(Tt, {
2135
2504
  onChange: (t) => n(e.id, t),
2136
2505
  points: e.points,
2137
- value: Lt(t(e.id))
2506
+ value: xn(t(e.id))
2138
2507
  });
2139
- case "table-response": return /* @__PURE__ */ a(pe, {
2508
+ case "table-response": return /* @__PURE__ */ o(Oe, {
2140
2509
  columns: e.columns,
2141
2510
  onChange: (t) => n(e.id, t),
2142
- value: Rt(t(e.id))
2511
+ value: Sn(t(e.id))
2143
2512
  });
2144
- case "text-input": return e.before && !e.after && e.number === 0 ? /* @__PURE__ */ a("p", {
2513
+ case "text-input": return e.before && !e.after && e.number === 0 ? /* @__PURE__ */ o("p", {
2145
2514
  className: "problem-statement",
2146
2515
  children: e.before
2147
- }) : /* @__PURE__ */ o("div", {
2516
+ }) : /* @__PURE__ */ s("div", {
2148
2517
  className: "sentence-answer",
2149
2518
  children: [
2150
- e.before ? /* @__PURE__ */ a("span", { children: e.before }) : null,
2151
- /* @__PURE__ */ a(q, {
2519
+ e.before ? /* @__PURE__ */ o("span", { children: e.before }) : null,
2520
+ /* @__PURE__ */ o(G, {
2152
2521
  ariaLabel: e.prompt,
2153
2522
  onChange: (t) => n(e.id, t),
2154
2523
  onClear: () => r(e.id),
2155
- recognizer: s?.handwritingRecognizer,
2156
- value: Mt(t(e.id))
2524
+ recognizer: i?.handwritingRecognizer,
2525
+ value: Q(t(e.id))
2157
2526
  }),
2158
- e.after ? /* @__PURE__ */ a("span", { children: e.after }) : null
2527
+ e.after ? /* @__PURE__ */ o("span", { children: e.after }) : null
2159
2528
  ]
2160
2529
  });
2161
- case "drag-match": return /* @__PURE__ */ a(me, {
2530
+ case "word-problem": return /* @__PURE__ */ s("div", {
2531
+ className: "word-problem",
2532
+ children: [/* @__PURE__ */ o("p", {
2533
+ className: "problem-statement word-problem__situation",
2534
+ children: e.situation
2535
+ }), /* @__PURE__ */ o("div", {
2536
+ className: "word-problem__parts",
2537
+ children: e.parts.map((a, s) => /* @__PURE__ */ o(Tn, {
2538
+ adapters: i,
2539
+ clearAnswer: r,
2540
+ getAnswer: t,
2541
+ part: a,
2542
+ parentQuestionId: e.id,
2543
+ partNumber: s + 1,
2544
+ updateAnswer: n
2545
+ }, a.id))
2546
+ })]
2547
+ });
2548
+ case "drag-match": return /* @__PURE__ */ o(Pe, {
2162
2549
  items: e.items,
2163
2550
  onChange: (t) => n(e.id, t),
2164
2551
  targets: e.targets,
2165
- value: Pt(t(e.id))
2552
+ value: vn(t(e.id))
2166
2553
  });
2167
- case "sortable-answer": return /* @__PURE__ */ a(wt, {
2554
+ case "sortable-answer": return /* @__PURE__ */ o(Zt, {
2168
2555
  answerId: e.id,
2169
2556
  items: e.items,
2170
2557
  onChange: (t) => n(e.id, t),
2171
- value: Ft(t(e.id))
2558
+ value: yn(t(e.id))
2172
2559
  });
2173
- case "label-placement": return /* @__PURE__ */ a(it, {
2560
+ case "label-placement": return /* @__PURE__ */ o(Et, {
2174
2561
  labels: e.labels,
2175
2562
  onChange: (t) => n(e.id, t),
2176
2563
  targets: e.targets,
2177
- value: It(t(e.id))
2564
+ value: bn(t(e.id))
2178
2565
  });
2179
- case "audio-recording": return /* @__PURE__ */ a(gt, {
2566
+ case "audio-recording": return /* @__PURE__ */ o(Ht, {
2180
2567
  acceptedPronunciations: e.acceptedPronunciations,
2181
2568
  expectedText: e.expectedAnswer,
2182
2569
  imageAlt: e.imageAlt,
@@ -2186,137 +2573,169 @@ function At(e, t, n, r, s) {
2186
2573
  minimumSimilarity: e.minimumSimilarity,
2187
2574
  onChange: (t) => n(e.id, t),
2188
2575
  onReset: () => r(e.id),
2189
- recorder: s?.audioRecorder,
2190
- value: zt(t(e.id))
2576
+ recorder: i?.audioRecorder,
2577
+ value: Cn(t(e.id))
2191
2578
  });
2192
2579
  }
2193
2580
  }
2194
- function jt(e) {
2581
+ function hn({ adapters: t, ariaPrefix: n, className: r, clearAnswer: i, getAnswer: a, item: c, questionId: l, updateAnswer: u }) {
2582
+ if (c.answers?.length) return /* @__PURE__ */ s("div", {
2583
+ className: r,
2584
+ children: [c.answers.map((r) => {
2585
+ let d = `${l}:${c.id}:${r.id}`, f = [n, r.before].filter(Boolean).join(" ");
2586
+ return /* @__PURE__ */ s(e, { children: [r.before ? /* @__PURE__ */ o("span", { children: r.before }) : null, /* @__PURE__ */ o(G, {
2587
+ ariaLabel: f,
2588
+ onChange: (e) => u(d, e),
2589
+ onClear: () => i(d),
2590
+ recognizer: t?.handwritingRecognizer,
2591
+ value: Q(a(d))
2592
+ })] }, r.id);
2593
+ }), c.after ? /* @__PURE__ */ o("span", { children: c.after }) : null]
2594
+ }, c.id);
2595
+ if (!c.correctAnswer) return /* @__PURE__ */ s("div", {
2596
+ className: r,
2597
+ children: [/* @__PURE__ */ o("span", { children: c.before }), c.after ? /* @__PURE__ */ o("span", { children: c.after }) : null]
2598
+ }, c.id);
2599
+ let d = `${l}:${c.id}`;
2600
+ return /* @__PURE__ */ s("div", {
2601
+ className: r,
2602
+ children: [
2603
+ /* @__PURE__ */ o("span", { children: c.before }),
2604
+ /* @__PURE__ */ o(G, {
2605
+ ariaLabel: [n, c.before].filter(Boolean).join(" "),
2606
+ onChange: (e) => u(d, e),
2607
+ onClear: () => i(d),
2608
+ recognizer: t?.handwritingRecognizer,
2609
+ value: Q(a(d))
2610
+ }),
2611
+ c.after ? /* @__PURE__ */ o("span", { children: c.after }) : null
2612
+ ]
2613
+ }, c.id);
2614
+ }
2615
+ function gn(e) {
2195
2616
  return e?.kind === "text" ? e : void 0;
2196
2617
  }
2197
- function Mt(e) {
2618
+ function Q(e) {
2198
2619
  return e?.kind === "handwritten-number" ? e : void 0;
2199
2620
  }
2200
- function Nt(e) {
2621
+ function _n(e) {
2201
2622
  return e?.kind === "choice" ? e : void 0;
2202
2623
  }
2203
- function Pt(e) {
2624
+ function vn(e) {
2204
2625
  return e?.kind === "matches" ? e : void 0;
2205
2626
  }
2206
- function Ft(e) {
2627
+ function yn(e) {
2207
2628
  return e?.kind === "order" ? e : void 0;
2208
2629
  }
2209
- function It(e) {
2630
+ function bn(e) {
2210
2631
  return e?.kind === "placements" ? e : void 0;
2211
2632
  }
2212
- function Lt(e) {
2633
+ function xn(e) {
2213
2634
  return e?.kind === "drawing" ? e : void 0;
2214
2635
  }
2215
- function Rt(e) {
2636
+ function Sn(e) {
2216
2637
  return e?.kind === "coin-table" ? e : void 0;
2217
2638
  }
2218
- function zt(e) {
2639
+ function Cn(e) {
2219
2640
  return e?.kind === "audio-recording" ? e : void 0;
2220
2641
  }
2221
- function Bt(e) {
2222
- return e === "triangle" ? "△" : e === "square" ? "□" : e === "rectangle" ? "▭" : e;
2223
- }
2224
- function Vt({ variant: e }) {
2225
- return e === "counter-rows" ? /* @__PURE__ */ o("div", {
2226
- className: "visual-panel visual-panel--counters",
2227
- "aria-hidden": "true",
2228
- children: [/* @__PURE__ */ a("div", { children: Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ a("span", { className: "counter-dot" }, `top-${t}`)) }), /* @__PURE__ */ a("div", { children: Array.from({ length: 4 }, (e, t) => /* @__PURE__ */ a("span", { className: "counter-dot counter-dot--crossed" }, `bottom-${t}`)) })]
2229
- }) : /* @__PURE__ */ o("div", {
2230
- className: "visual-panel visual-panel--suns",
2231
- "aria-hidden": "true",
2232
- children: [/* @__PURE__ */ a("div", { children: Array.from({ length: 4 }, (e, t) => /* @__PURE__ */ a("span", {
2233
- className: "sun-icon",
2234
- children: "☀"
2235
- }, `sun-${t}`)) }), /* @__PURE__ */ a("div", { children: Array.from({ length: 2 }, (e, t) => /* @__PURE__ */ a("span", {
2236
- className: "star-outline",
2237
- children: "✩"
2238
- }, `star-${t}`)) })]
2642
+ function wn(e) {
2643
+ return `${e.leftOperand} ${e.operator} ${e.rightOperand} =`;
2644
+ }
2645
+ function Tn({ adapters: e, clearAnswer: t, getAnswer: n, parentQuestionId: r, part: i, partNumber: a, updateAnswer: c }) {
2646
+ let l = `${r}:${i.id}`;
2647
+ return /* @__PURE__ */ s("section", {
2648
+ className: "word-problem-part",
2649
+ children: [/* @__PURE__ */ s("div", {
2650
+ className: "word-problem-part__prompt",
2651
+ children: [/* @__PURE__ */ o("span", { children: a }), /* @__PURE__ */ o("strong", { children: i.prompt })]
2652
+ }), i.type === "coin-table" ? /* @__PURE__ */ o(Oe, {
2653
+ columns: i.columns,
2654
+ onChange: (e) => c(l, e),
2655
+ value: Sn(n(l))
2656
+ }) : /* @__PURE__ */ s("div", {
2657
+ className: "sentence-answer word-problem-part__sentence",
2658
+ children: [
2659
+ i.before ? /* @__PURE__ */ o("span", { children: i.before }) : null,
2660
+ /* @__PURE__ */ o(G, {
2661
+ ariaLabel: i.prompt,
2662
+ onChange: (e) => c(l, e),
2663
+ onClear: () => t(l),
2664
+ recognizer: e?.handwritingRecognizer,
2665
+ value: Q(n(l))
2666
+ }),
2667
+ i.after ? /* @__PURE__ */ o("span", { children: i.after }) : null
2668
+ ]
2669
+ })]
2239
2670
  });
2240
2671
  }
2241
- var Ht = "picture";
2242
- function Ut({ choices: t, onChange: i, value: s, visual: c }) {
2243
- let l = n(null), u = n(null), d = n({}), f = n(null), p = s?.pairs[Ht], [m, h] = r(null), [g, _] = r(null);
2244
- function v(e, t) {
2245
- let n = l.current;
2246
- if (!n) return null;
2247
- let r = n.getBoundingClientRect();
2672
+ function En(e) {
2673
+ return e === "triangle" ? "△" : e === "square" ? "□" : e === "rectangle" ? "▭" : e;
2674
+ }
2675
+ var Dn = "picture";
2676
+ function On({ choices: e, onChange: n, scene: a, value: c, visual: l }) {
2677
+ let u = r(null), d = r(null), f = r(null), p = r({}), m = r(null), h = c?.pairs[Dn], [g, _] = i(null), [v, y] = i(null);
2678
+ function b(e, t) {
2679
+ let n = d.current;
2680
+ if (n) {
2681
+ let r = n.createSVGPoint(), i = n.getScreenCTM();
2682
+ if (r.x = e, r.y = t, i) return r.matrixTransform(i.inverse());
2683
+ }
2684
+ let r = u.current;
2685
+ if (!r) return null;
2686
+ let i = r.getBoundingClientRect();
2248
2687
  return {
2249
- x: e - r.left,
2250
- y: t - r.top
2688
+ x: e - i.left,
2689
+ y: t - i.top
2251
2690
  };
2252
2691
  }
2253
- function y(e) {
2692
+ function x(e) {
2254
2693
  if (!e) return null;
2255
2694
  let t = e.getBoundingClientRect();
2256
- return v(t.left + t.width / 2, t.top + t.height / 2);
2695
+ return b(t.left + t.width / 2, t.top + t.height / 2);
2257
2696
  }
2258
- e(() => {
2697
+ t(() => {
2259
2698
  function e(e) {
2260
- let t = l.current;
2261
- if (!t || !e) return null;
2262
- let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
2263
- return {
2264
- x: r.left + r.width / 2 - n.left,
2265
- y: r.top + r.height / 2 - n.top
2266
- };
2699
+ if (!e) return null;
2700
+ let t = e.getBoundingClientRect();
2701
+ return b(t.left + t.width / 2, t.top + t.height / 2);
2267
2702
  }
2268
2703
  function t() {
2269
- if (!p) {
2270
- h(null);
2704
+ if (!h) {
2705
+ _(null);
2271
2706
  return;
2272
2707
  }
2273
- let t = e(d.current[p]), n = e(u.current);
2708
+ let t = e(p.current[h]), n = e(f.current);
2274
2709
  if (!t || !n) {
2275
- h(null);
2710
+ _(null);
2276
2711
  return;
2277
2712
  }
2278
- h({
2279
- x1: t.x,
2280
- x2: n.x,
2281
- y1: t.y,
2282
- y2: n.y
2713
+ _({
2714
+ x1: n.x,
2715
+ x2: t.x,
2716
+ y1: n.y,
2717
+ y2: t.y
2283
2718
  });
2284
2719
  }
2285
2720
  let n = window.setTimeout(t, 0), r = () => t();
2286
2721
  return window.addEventListener("resize", r), () => {
2287
2722
  window.clearTimeout(n), window.removeEventListener("resize", r);
2288
2723
  };
2289
- }, [p]);
2290
- function b(e, t) {
2291
- let n = y(t.currentTarget), r = v(t.clientX, t.clientY);
2292
- !n || !r || (t.preventDefault(), t.currentTarget.setPointerCapture(t.pointerId), f.current = {
2293
- choiceId: e,
2294
- origin: "answer",
2295
- pointerId: t.pointerId
2296
- }, _({
2297
- x1: n.x,
2298
- x2: r.x,
2299
- y1: n.y,
2300
- y2: r.y
2301
- }));
2302
- }
2303
- function x(e) {
2304
- let t = y(u.current), n = v(e.clientX, e.clientY);
2305
- !t || !n || (e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), f.current = {
2306
- origin: "target",
2307
- pointerId: e.pointerId
2308
- }, _({
2724
+ }, [h]);
2725
+ function S(e) {
2726
+ let t = x(f.current), n = b(e.clientX, e.clientY);
2727
+ !t || !n || (e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), m.current = { pointerId: e.pointerId }, y({
2309
2728
  x1: t.x,
2310
2729
  x2: n.x,
2311
2730
  y1: t.y,
2312
2731
  y2: n.y
2313
2732
  }));
2314
2733
  }
2315
- function S(e) {
2316
- let t = f.current;
2734
+ function ee(e) {
2735
+ let t = m.current;
2317
2736
  if (!t || t.pointerId !== e.pointerId) return;
2318
- let n = v(e.clientX, e.clientY), r = y(t.origin === "answer" && t.choiceId ? d.current[t.choiceId] : u.current);
2319
- !r || !n || _({
2737
+ let n = b(e.clientX, e.clientY), r = x(f.current);
2738
+ !r || !n || y({
2320
2739
  x1: r.x,
2321
2740
  x2: n.x,
2322
2741
  y1: r.y,
@@ -2324,80 +2743,72 @@ function Ut({ choices: t, onChange: i, value: s, visual: c }) {
2324
2743
  });
2325
2744
  }
2326
2745
  function C(e) {
2327
- let t = f.current;
2328
- if (!(!t || t.pointerId !== e.pointerId)) {
2329
- if (e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), t.origin === "answer" && t.choiceId && w(u.current, e.clientX, e.clientY) && i({
2330
- kind: "matches",
2331
- pairs: { [Ht]: t.choiceId }
2332
- }), t.origin === "target") {
2333
- let t = T(e.clientX, e.clientY);
2334
- t && i({
2335
- kind: "matches",
2336
- pairs: { [Ht]: t }
2337
- });
2338
- }
2339
- f.current = null, _(null);
2340
- }
2746
+ let t = m.current;
2747
+ if (!t || t.pointerId !== e.pointerId) return;
2748
+ e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId);
2749
+ let r = T(e.clientX, e.clientY);
2750
+ r && n({
2751
+ kind: "matches",
2752
+ pairs: { [Dn]: r }
2753
+ }), m.current = null, y(null);
2341
2754
  }
2342
2755
  function w(e, t, n) {
2343
2756
  if (!e) return !1;
2344
2757
  let r = e.getBoundingClientRect(), i = r.left + r.width / 2, a = r.top + r.height / 2;
2345
- return Math.hypot(t - i, n - a) <= Math.max(r.width, r.height) * 1.5;
2758
+ return Math.hypot(t - i, n - a) <= Math.max(42, Math.max(r.width, r.height) * 2.4);
2346
2759
  }
2347
- function T(e, n) {
2348
- return t.find((t) => w(d.current[t.id], e, n))?.id;
2760
+ function T(t, n) {
2761
+ return e.find((e) => w(p.current[e.id], t, n))?.id;
2349
2762
  }
2350
- return /* @__PURE__ */ o("div", {
2763
+ return /* @__PURE__ */ s("div", {
2351
2764
  className: "visual-line-match",
2352
- ref: l,
2765
+ ref: u,
2353
2766
  children: [
2354
- /* @__PURE__ */ o("svg", {
2767
+ /* @__PURE__ */ s("svg", {
2355
2768
  className: "visual-line-match__lines",
2356
2769
  "aria-hidden": "true",
2357
- children: [m ? /* @__PURE__ */ a("line", {
2770
+ ref: d,
2771
+ children: [g ? /* @__PURE__ */ o("line", {
2358
2772
  className: "visual-line-match__line visual-line-match__line--settled",
2359
- x1: m.x1,
2360
- x2: m.x2,
2361
- y1: m.y1,
2362
- y2: m.y2
2363
- }) : null, g ? /* @__PURE__ */ a("line", {
2364
- className: "visual-line-match__line visual-line-match__line--draft",
2365
2773
  x1: g.x1,
2366
2774
  x2: g.x2,
2367
2775
  y1: g.y1,
2368
2776
  y2: g.y2
2777
+ }) : null, v ? /* @__PURE__ */ o("line", {
2778
+ className: "visual-line-match__line visual-line-match__line--draft",
2779
+ x1: v.x1,
2780
+ x2: v.x2,
2781
+ y1: v.y1,
2782
+ y2: v.y2
2369
2783
  }) : null]
2370
2784
  }),
2371
- /* @__PURE__ */ o("div", {
2785
+ /* @__PURE__ */ s("div", {
2372
2786
  className: "visual-match-picture",
2373
- children: [/* @__PURE__ */ a(Vt, { variant: c }), /* @__PURE__ */ a("button", {
2787
+ children: [/* @__PURE__ */ o(ln, { scene: a ?? sn(l) }), /* @__PURE__ */ o("button", {
2374
2788
  "aria-label": "اربط الصورة بالإجابة",
2375
- className: p ? "visual-match-point visual-match-point--target visual-match-point--target-active" : "visual-match-point visual-match-point--target",
2789
+ className: h ? "visual-match-point visual-match-point--target visual-match-point--target-active" : "visual-match-point visual-match-point--target",
2376
2790
  onPointerCancel: C,
2377
- onPointerDown: x,
2378
- onPointerMove: S,
2791
+ onPointerDown: S,
2792
+ onPointerMove: ee,
2379
2793
  onPointerUp: C,
2380
- ref: u,
2794
+ ref: f,
2381
2795
  type: "button"
2382
2796
  })]
2383
2797
  }),
2384
- /* @__PURE__ */ a("div", {
2798
+ /* @__PURE__ */ o("div", {
2385
2799
  className: "visual-line-match__answers",
2386
- children: t.map((e) => /* @__PURE__ */ o("div", {
2387
- className: p === e.id ? "visual-match-answer visual-match-answer--matched" : "visual-match-answer",
2388
- children: [/* @__PURE__ */ a("span", {
2800
+ children: e.map((e) => /* @__PURE__ */ s("div", {
2801
+ className: h === e.id ? "visual-match-answer visual-match-answer--matched" : "visual-match-answer",
2802
+ children: [/* @__PURE__ */ o("span", {
2389
2803
  className: "answer-chip__label answer-chip__label--math",
2390
2804
  children: e.label
2391
- }), /* @__PURE__ */ a("button", {
2805
+ }), /* @__PURE__ */ o("button", {
2392
2806
  "aria-label": `اربط ${e.label} بالصورة`,
2393
2807
  className: "visual-match-point visual-match-point--answer",
2394
- onPointerCancel: C,
2395
- onPointerDown: (t) => b(e.id, t),
2396
- onPointerMove: S,
2397
- onPointerUp: C,
2398
2808
  ref: (t) => {
2399
- d.current[e.id] = t;
2809
+ p.current[e.id] = t;
2400
2810
  },
2811
+ tabIndex: -1,
2401
2812
  type: "button"
2402
2813
  })]
2403
2814
  }, e.id))
@@ -2405,8 +2816,8 @@ function Ut({ choices: t, onChange: i, value: s, visual: c }) {
2405
2816
  ]
2406
2817
  });
2407
2818
  }
2408
- function Wt({ answerId: e, choices: t, getAnswer: i, items: s, updateAnswer: c }) {
2409
- let l = Math.max(...s.map((e) => e.squareLength)) + 2, u = Ce(t), [d, f] = r(null), [p, m] = r(!1), [h, g] = r({}), _ = n(null);
2819
+ function kn({ answerId: e, choices: t, getAnswer: n, items: a, updateAnswer: c }) {
2820
+ let l = Math.max(...a.map((e) => e.squareLength)) + 2, u = We(t), [d, f] = i(null), [p, m] = i(!1), [h, g] = i({}), _ = r(null);
2410
2821
  function v(e, t, n) {
2411
2822
  let r = d;
2412
2823
  r && g((i) => {
@@ -2443,27 +2854,27 @@ function Wt({ answerId: e, choices: t, getAnswer: i, items: s, updateAnswer: c }
2443
2854
  function x(e) {
2444
2855
  e?.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), _.current = null, m(!1);
2445
2856
  }
2446
- return /* @__PURE__ */ o("div", {
2857
+ return /* @__PURE__ */ s("div", {
2447
2858
  className: "length-estimation-task",
2448
2859
  "data-coloring": p ? "true" : "false",
2449
2860
  onPointerCancel: () => x(),
2450
2861
  onPointerUp: () => x(),
2451
- children: [/* @__PURE__ */ a(ye, {
2862
+ children: [/* @__PURE__ */ o(Be, {
2452
2863
  ariaLabel: "ألوان الأقلام",
2453
2864
  className: "length-color-picker",
2454
2865
  colors: u,
2455
2866
  onChange: f,
2456
2867
  selectedColorId: d
2457
- }), /* @__PURE__ */ a("div", {
2868
+ }), /* @__PURE__ */ o("div", {
2458
2869
  className: "length-card-row",
2459
- children: s.map((t) => {
2460
- let n = `${e}:squares:${t.id}`, r = `${e}:color:${t.id}`, s = Nt(i(r)), d = h[t.id], f = d?.colorId ?? s?.choiceId, p = d?.fill ?? +!!s?.choiceId, m = f ? Se(u, f) : "#9aa3a8", g = `${16 + Math.min(p, 1) * 68}%`;
2461
- return /* @__PURE__ */ o("div", {
2870
+ children: a.map((t) => {
2871
+ let r = `${e}:squares:${t.id}`, i = `${e}:color:${t.id}`, a = _n(n(i)), d = h[t.id], f = d?.colorId ?? a?.choiceId, p = d?.fill ?? +!!a?.choiceId, m = f ? Ue(u, f) : "#9aa3a8", g = `${16 + Math.min(p, 1) * 68}%`;
2872
+ return /* @__PURE__ */ s("div", {
2462
2873
  className: "length-card",
2463
- children: [/* @__PURE__ */ a("div", {
2874
+ children: [/* @__PURE__ */ o("div", {
2464
2875
  className: "square-measure-strip",
2465
2876
  style: { "--measure-squares": l },
2466
- children: /* @__PURE__ */ a("button", {
2877
+ children: /* @__PURE__ */ o("button", {
2467
2878
  "aria-label": `تلوين ${t.label}`,
2468
2879
  className: [
2469
2880
  "pencil-pencil",
@@ -2471,13 +2882,13 @@ function Wt({ answerId: e, choices: t, getAnswer: i, items: s, updateAnswer: c }
2471
2882
  p > 0 ? "pencil-pencil--colored" : ""
2472
2883
  ].filter(Boolean).join(" "),
2473
2884
  onKeyDown: (e) => {
2474
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), v(t.id, r, .22));
2885
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), v(t.id, i, .22));
2475
2886
  },
2476
2887
  onPointerDown: (e) => {
2477
- y(t.id, r, e);
2888
+ y(t.id, i, e);
2478
2889
  },
2479
2890
  onPointerMove: (e) => {
2480
- b(t.id, r, e);
2891
+ b(t.id, i, e);
2481
2892
  },
2482
2893
  onPointerUp: x,
2483
2894
  style: {
@@ -2488,17 +2899,17 @@ function Wt({ answerId: e, choices: t, getAnswer: i, items: s, updateAnswer: c }
2488
2899
  },
2489
2900
  type: "button"
2490
2901
  })
2491
- }), /* @__PURE__ */ o("label", {
2902
+ }), /* @__PURE__ */ s("label", {
2492
2903
  className: "length-value-row",
2493
2904
  children: [
2494
- /* @__PURE__ */ a("span", { children: t.label }),
2495
- /* @__PURE__ */ a(Et, {
2905
+ /* @__PURE__ */ o("span", { children: t.label }),
2906
+ /* @__PURE__ */ o($t, {
2496
2907
  ariaLabel: `طول ${t.label} بالمربعات`,
2497
2908
  inputMode: "numeric",
2498
- onChange: (e) => c(n, e),
2499
- value: jt(i(n))
2909
+ onChange: (e) => c(r, e),
2910
+ value: gn(n(r))
2500
2911
  }),
2501
- /* @__PURE__ */ a("span", { children: "مربعات" })
2912
+ /* @__PURE__ */ o("span", { children: "مربعات" })
2502
2913
  ]
2503
2914
  })]
2504
2915
  }, t.id);
@@ -2508,51 +2919,664 @@ function Wt({ answerId: e, choices: t, getAnswer: i, items: s, updateAnswer: c }
2508
2919
  }
2509
2920
  //#endregion
2510
2921
  //#region src/renderer/QuestionPreviewPanel.tsx
2511
- function Gt({ adapters: e, question: t }) {
2512
- let [n, i] = r({});
2513
- function o(e, t) {
2514
- i((n) => ({
2922
+ function An({ adapters: e, answers: t, onAnswersChange: n, question: r }) {
2923
+ let [a, s] = i({}), c = t ?? a;
2924
+ function l(e) {
2925
+ if (t !== void 0) {
2926
+ n?.(e(t));
2927
+ return;
2928
+ }
2929
+ s(e);
2930
+ }
2931
+ function u(e, t) {
2932
+ l((n) => ({
2515
2933
  ...n,
2516
2934
  [e]: t
2517
2935
  }));
2518
2936
  }
2519
- function s(e) {
2520
- i((t) => {
2937
+ function d(e) {
2938
+ l((t) => {
2521
2939
  let n = { ...t };
2522
2940
  return delete n[e], n;
2523
2941
  });
2524
2942
  }
2525
- return /* @__PURE__ */ a("div", {
2943
+ return /* @__PURE__ */ o("div", {
2526
2944
  className: "exam-renderer-preview",
2527
- children: /* @__PURE__ */ a(Dt, {
2945
+ children: /* @__PURE__ */ o(dn, {
2528
2946
  adapters: e,
2529
- clearAnswer: s,
2530
- getAnswer: (e) => n[e],
2531
- question: t,
2532
- updateAnswer: o
2947
+ clearAnswer: d,
2948
+ getAnswer: (e) => c[e],
2949
+ question: r,
2950
+ updateAnswer: u
2533
2951
  })
2534
2952
  });
2535
2953
  }
2536
2954
  //#endregion
2955
+ //#region src/renderer/PrintableExamDocument.tsx
2956
+ var jn = {
2957
+ ariaLabel: "معلومات المؤسسة",
2958
+ logoAlt: "شعار المملكة المغربية",
2959
+ logoSrc: "/logo/morocco-logo.png",
2960
+ title: "المملكة المغربية",
2961
+ lines: [
2962
+ "وزارة التربية الوطنية والتعليم الأولي والرياضة",
2963
+ "الأكاديمية الجهوية للتربية والتكوين لجهة طنجة تطوان الحسيمة",
2964
+ "المديرية الإقليمية"
2965
+ ]
2966
+ };
2967
+ function Mn({ exam: e, locale: t = "fr", variant: n }) {
2968
+ let r = tr(t), i = zn(e);
2969
+ return /* @__PURE__ */ s("article", {
2970
+ className: `printable-exam printable-exam--${n}`,
2971
+ dir: er(t) ? "rtl" : "ltr",
2972
+ children: [/* @__PURE__ */ s("div", {
2973
+ className: "printable-exam__top",
2974
+ children: [/* @__PURE__ */ o(Nn, {}), /* @__PURE__ */ s("header", {
2975
+ className: "printable-exam__header",
2976
+ children: [/* @__PURE__ */ s("div", {
2977
+ className: "printable-exam__title-row",
2978
+ children: [/* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("span", {
2979
+ className: "printable-exam__eyebrow",
2980
+ children: e.subject
2981
+ }), /* @__PURE__ */ o("h1", { children: e.title })] }), /* @__PURE__ */ o(Rn, {
2982
+ noteLabel: r.obtainedNote,
2983
+ totalPoints: i
2984
+ })]
2985
+ }), /* @__PURE__ */ s("div", {
2986
+ className: "printable-exam__meta",
2987
+ children: [
2988
+ /* @__PURE__ */ o(Ln, {
2989
+ label: r.duration,
2990
+ value: e.timer
2991
+ }),
2992
+ /* @__PURE__ */ o(Ln, {
2993
+ label: r.level,
2994
+ value: e.level
2995
+ }),
2996
+ /* @__PURE__ */ o(Ln, {
2997
+ label: er(t) ? "المادة" : r.subject ?? "Matiere",
2998
+ value: e.subject
2999
+ })
3000
+ ]
3001
+ })]
3002
+ })]
3003
+ }), /* @__PURE__ */ o("div", {
3004
+ className: "printable-exam__sections",
3005
+ children: e.sections.map((e) => /* @__PURE__ */ o(Pn, {
3006
+ locale: t,
3007
+ section: e,
3008
+ variant: n
3009
+ }, e.id))
3010
+ })]
3011
+ });
3012
+ }
3013
+ function Nn() {
3014
+ return /* @__PURE__ */ s("section", {
3015
+ "aria-label": jn.ariaLabel,
3016
+ className: "printable-institution-header",
3017
+ dir: "rtl",
3018
+ children: [
3019
+ /* @__PURE__ */ o("img", {
3020
+ alt: jn.logoAlt,
3021
+ className: "printable-institution-header__logo",
3022
+ src: jn.logoSrc
3023
+ }),
3024
+ /* @__PURE__ */ o("h1", { children: jn.title }),
3025
+ jn.lines.map((e) => /* @__PURE__ */ o("p", { children: e }, e))
3026
+ ]
3027
+ });
3028
+ }
3029
+ function Pn({ locale: e = "fr", section: t, variant: n }) {
3030
+ let r = tr(e);
3031
+ return /* @__PURE__ */ s("section", {
3032
+ className: `printable-section printable-section--${t.tone}`,
3033
+ "data-variant": n,
3034
+ children: [/* @__PURE__ */ s("header", {
3035
+ className: "printable-section__header",
3036
+ children: [
3037
+ /* @__PURE__ */ s("div", {
3038
+ className: "printable-section__score",
3039
+ children: [/* @__PURE__ */ o("span", {
3040
+ className: "printable-section__points",
3041
+ children: t.points
3042
+ }), /* @__PURE__ */ s("span", {
3043
+ className: "printable-section__obtained",
3044
+ children: [/* @__PURE__ */ o("small", { children: r.obtainedNote }), /* @__PURE__ */ s("strong", { children: [/* @__PURE__ */ o("i", { "aria-hidden": "true" }), /* @__PURE__ */ s("b", { children: ["/ ", t.points] })] })]
3045
+ })]
3046
+ }),
3047
+ /* @__PURE__ */ o("h2", { children: t.title }),
3048
+ /* @__PURE__ */ o("span", {
3049
+ className: "printable-section__badge",
3050
+ children: t.badge
3051
+ })
3052
+ ]
3053
+ }), /* @__PURE__ */ o("div", {
3054
+ className: "printable-section__body",
3055
+ children: t.questions.map((t) => /* @__PURE__ */ o(Fn, {
3056
+ locale: e,
3057
+ question: t,
3058
+ variant: n
3059
+ }, t.id))
3060
+ })]
3061
+ });
3062
+ }
3063
+ function Fn({ locale: e = "fr", question: t, variant: n }) {
3064
+ let r = tr(e);
3065
+ return /* @__PURE__ */ s("article", {
3066
+ className: `printable-question printable-question--${t.type}`,
3067
+ children: [/* @__PURE__ */ s("div", {
3068
+ className: "printable-question__prompt",
3069
+ children: [t.number > 0 ? /* @__PURE__ */ o("span", {
3070
+ className: "printable-question__number",
3071
+ children: t.number
3072
+ }) : null, /* @__PURE__ */ o("strong", { children: t.prompt })]
3073
+ }), In(t, n, r, e)]
3074
+ });
3075
+ }
3076
+ function In(e, t, n, r) {
3077
+ switch (e.type) {
3078
+ case "inline-inputs":
3079
+ case "equation-inputs": return /* @__PURE__ */ o("div", {
3080
+ className: "printable-equation-grid",
3081
+ children: e.items.map((e) => /* @__PURE__ */ o("div", {
3082
+ className: "printable-equation-card",
3083
+ children: /* @__PURE__ */ o(Qn, { item: e })
3084
+ }, e.id))
3085
+ });
3086
+ case "number-line": return /* @__PURE__ */ s("div", {
3087
+ className: "printable-number-line-layout",
3088
+ children: [/* @__PURE__ */ s("div", {
3089
+ className: "printable-number-line-expression",
3090
+ children: [/* @__PURE__ */ o("span", { children: e.expression }), /* @__PURE__ */ o($n, {})]
3091
+ }), /* @__PURE__ */ o(Yn, {})]
3092
+ });
3093
+ case "operation-solving": return /* @__PURE__ */ s("div", {
3094
+ className: `printable-operation-solving printable-operation-solving--${e.solutionMode}`,
3095
+ children: [
3096
+ /* @__PURE__ */ o("div", {
3097
+ className: "printable-operation-solving__equation",
3098
+ children: Vn(e)
3099
+ }),
3100
+ e.solutionMode === "full-process" ? /* @__PURE__ */ o("div", {
3101
+ className: "printable-operation-solving__work",
3102
+ children: /* @__PURE__ */ o("span", { children: er(r) ? "أَنْجِزُ الْعَمَلِيَّةَ" : "Zone de travail" })
3103
+ }) : null,
3104
+ /* @__PURE__ */ s("div", {
3105
+ className: "printable-inline-answer printable-operation-solving__answer",
3106
+ children: [/* @__PURE__ */ o("span", { children: er(r) ? "النَّتِيجَةُ" : "Resultat" }), /* @__PURE__ */ o($n, {})]
3107
+ })
3108
+ ]
3109
+ });
3110
+ case "visual-choice": return /* @__PURE__ */ s("div", {
3111
+ className: "printable-visual-match",
3112
+ children: [/* @__PURE__ */ o(Hn, {
3113
+ choices: e.choices,
3114
+ scene: e.scene ?? sn(e.visual)
3115
+ }), e.inputLabel ? /* @__PURE__ */ s("div", {
3116
+ className: "printable-inline-answer",
3117
+ children: [/* @__PURE__ */ o("span", { children: e.inputLabel }), /* @__PURE__ */ o($, {})]
3118
+ }) : null]
3119
+ });
3120
+ case "length-estimation": return /* @__PURE__ */ o("div", {
3121
+ className: "printable-length-task",
3122
+ children: /* @__PURE__ */ o("div", {
3123
+ className: "printable-length-list",
3124
+ children: e.items.map((e) => /* @__PURE__ */ o(Xn, {
3125
+ item: e,
3126
+ squareUnit: er(r) ? "مربعات" : "carres",
3127
+ variant: t
3128
+ }, e.id))
3129
+ })
3130
+ });
3131
+ case "shape-choice": return /* @__PURE__ */ s("div", {
3132
+ className: "printable-shape-match",
3133
+ children: [
3134
+ /* @__PURE__ */ o("div", {
3135
+ className: "printable-shape-bank",
3136
+ children: e.choices.map((e) => /* @__PURE__ */ o("div", {
3137
+ className: "printable-shape-card",
3138
+ children: /* @__PURE__ */ o(Ne, { shapeId: e.id })
3139
+ }, e.id))
3140
+ }),
3141
+ /* @__PURE__ */ o("div", {
3142
+ className: "printable-shape-labels",
3143
+ children: e.choices.map((e, t) => /* @__PURE__ */ s("div", {
3144
+ className: "printable-choice-chip",
3145
+ children: [/* @__PURE__ */ s("span", { children: [t + 1, "."] }), /* @__PURE__ */ o("strong", { children: e.label })]
3146
+ }, e.id))
3147
+ }),
3148
+ /* @__PURE__ */ o(Bn, { label: n.dragArea })
3149
+ ]
3150
+ });
3151
+ case "drawing-grid": return /* @__PURE__ */ o("div", {
3152
+ className: "printable-drawing-block",
3153
+ children: /* @__PURE__ */ o(Jn, { points: e.points })
3154
+ });
3155
+ case "table-response": return /* @__PURE__ */ o("div", {
3156
+ className: "printable-table-response",
3157
+ children: e.columns.map((e) => /* @__PURE__ */ s("div", {
3158
+ className: "printable-table-column",
3159
+ children: [
3160
+ /* @__PURE__ */ o("strong", { children: e.title }),
3161
+ /* @__PURE__ */ o("div", { className: "printable-table-area" }),
3162
+ /* @__PURE__ */ s("div", {
3163
+ className: "printable-inline-answer",
3164
+ children: [/* @__PURE__ */ o("span", { children: e.answerLabel }), /* @__PURE__ */ o($, {})]
3165
+ })
3166
+ ]
3167
+ }, e.id))
3168
+ });
3169
+ case "text-input": return e.before && !e.after && e.number === 0 ? /* @__PURE__ */ o("p", {
3170
+ className: "printable-statement",
3171
+ children: e.before
3172
+ }) : /* @__PURE__ */ s("div", {
3173
+ className: "printable-inline-answer printable-inline-answer--sentence",
3174
+ children: [
3175
+ e.before ? /* @__PURE__ */ o("span", { children: e.before }) : null,
3176
+ /* @__PURE__ */ o($, {}),
3177
+ e.after ? /* @__PURE__ */ o("span", { children: e.after }) : null
3178
+ ]
3179
+ });
3180
+ case "word-problem": return /* @__PURE__ */ s("div", {
3181
+ className: "printable-word-problem",
3182
+ children: [/* @__PURE__ */ o("p", {
3183
+ className: "printable-statement printable-word-problem__situation",
3184
+ children: e.situation
3185
+ }), /* @__PURE__ */ o("div", {
3186
+ className: "printable-word-problem__parts",
3187
+ children: e.parts.map((e, t) => /* @__PURE__ */ o(Zn, {
3188
+ part: e,
3189
+ partNumber: t + 1
3190
+ }, e.id))
3191
+ })]
3192
+ });
3193
+ case "drag-match": return /* @__PURE__ */ o(Wn, {
3194
+ items: e.items,
3195
+ targets: e.targets
3196
+ });
3197
+ case "sortable-answer": return /* @__PURE__ */ s("div", {
3198
+ className: "printable-sortable",
3199
+ children: [/* @__PURE__ */ o("div", {
3200
+ className: "printable-sortable__bank",
3201
+ children: e.items.map((e) => /* @__PURE__ */ o("span", {
3202
+ className: "printable-choice-chip",
3203
+ children: /* @__PURE__ */ o("strong", { children: e.label })
3204
+ }, e.id))
3205
+ }), /* @__PURE__ */ s("div", {
3206
+ className: "printable-sortable__slots",
3207
+ children: [/* @__PURE__ */ o("strong", { children: n.sortOrder }), e.items.map((e, t) => /* @__PURE__ */ s("div", {
3208
+ className: "printable-sortable__slot",
3209
+ children: [/* @__PURE__ */ s("span", { children: [t + 1, "."] }), /* @__PURE__ */ o($, {})]
3210
+ }, e.id))]
3211
+ })]
3212
+ });
3213
+ case "label-placement": return /* @__PURE__ */ s("div", {
3214
+ className: "printable-label-placement",
3215
+ children: [
3216
+ /* @__PURE__ */ o(qn, { targets: e.targets }),
3217
+ /* @__PURE__ */ o("div", {
3218
+ className: "printable-placement-labels",
3219
+ children: e.labels.map((e) => /* @__PURE__ */ o("span", {
3220
+ className: "printable-choice-chip",
3221
+ children: /* @__PURE__ */ o("strong", { children: e.label })
3222
+ }, e.id))
3223
+ }),
3224
+ /* @__PURE__ */ o(Bn, { label: n.placeLabels })
3225
+ ]
3226
+ });
3227
+ case "audio-recording": return /* @__PURE__ */ s("div", {
3228
+ className: "printable-audio-card",
3229
+ children: [/* @__PURE__ */ o("div", {
3230
+ className: "printable-audio-card__image",
3231
+ children: /* @__PURE__ */ o("img", {
3232
+ alt: e.imageAlt,
3233
+ src: e.imageSrc
3234
+ })
3235
+ }), /* @__PURE__ */ s("div", {
3236
+ className: "printable-audio-card__copy",
3237
+ children: [
3238
+ /* @__PURE__ */ o("span", { children: n.oralAnswer }),
3239
+ /* @__PURE__ */ o("strong", {
3240
+ dir: e.language === "ar" ? "rtl" : "ltr",
3241
+ children: e.expectedAnswer
3242
+ }),
3243
+ /* @__PURE__ */ o("p", { children: e.instruction })
3244
+ ]
3245
+ })]
3246
+ });
3247
+ }
3248
+ }
3249
+ function Ln({ label: e, value: t }) {
3250
+ return /* @__PURE__ */ s("div", {
3251
+ className: "printable-meta-pill",
3252
+ children: [/* @__PURE__ */ o("span", { children: e }), /* @__PURE__ */ o("strong", { children: t })]
3253
+ });
3254
+ }
3255
+ function Rn({ noteLabel: e, totalPoints: t }) {
3256
+ return /* @__PURE__ */ s("div", {
3257
+ className: "printable-note-box",
3258
+ children: [/* @__PURE__ */ o("span", { children: e }), /* @__PURE__ */ s("strong", { children: [/* @__PURE__ */ o("i", { "aria-hidden": "true" }), /* @__PURE__ */ s("b", { children: ["/ ", t] })] })]
3259
+ });
3260
+ }
3261
+ function zn(e) {
3262
+ let t = e.sections.filter((e) => e.isScored !== !1).map((e) => Number.parseFloat(e.points.replace(",", "."))).filter((e) => Number.isFinite(e));
3263
+ if (t.length === 0) return "";
3264
+ let n = t.reduce((e, t) => e + t, 0);
3265
+ return String(Number.isInteger(n) ? n : Number(n.toFixed(2)));
3266
+ }
3267
+ function Bn({ label: e }) {
3268
+ return /* @__PURE__ */ s("div", {
3269
+ className: "printable-hint-line",
3270
+ children: [/* @__PURE__ */ o("span", { children: e }), /* @__PURE__ */ o($, {})]
3271
+ });
3272
+ }
3273
+ function Vn(e) {
3274
+ return `${e.leftOperand} ${e.operator} ${e.rightOperand} =`;
3275
+ }
3276
+ function Hn({ choices: e, scene: t }) {
3277
+ return /* @__PURE__ */ o("div", {
3278
+ className: "printable-visual-match__preview",
3279
+ children: /* @__PURE__ */ s("div", {
3280
+ className: "visual-line-match printable-visual-line-match",
3281
+ children: [/* @__PURE__ */ s("div", {
3282
+ className: "visual-match-picture printable-visual-match-picture",
3283
+ children: [/* @__PURE__ */ o(ln, { scene: t }), /* @__PURE__ */ o("span", {
3284
+ "aria-hidden": "true",
3285
+ className: "visual-match-point visual-match-point--target printable-match-point printable-match-point--target"
3286
+ })]
3287
+ }), /* @__PURE__ */ o("div", {
3288
+ className: "visual-line-match__answers printable-visual-line-match__answers",
3289
+ children: e.map((e) => /* @__PURE__ */ o(Un, { choice: e }, e.id))
3290
+ })]
3291
+ })
3292
+ });
3293
+ }
3294
+ function Un({ choice: e }) {
3295
+ return /* @__PURE__ */ s("div", {
3296
+ className: "visual-match-answer printable-visual-match-answer",
3297
+ children: [/* @__PURE__ */ o("span", {
3298
+ "aria-hidden": "true",
3299
+ className: "visual-match-point visual-match-point--answer printable-match-point printable-match-point--choice"
3300
+ }), /* @__PURE__ */ o("div", {
3301
+ className: "printable-choice-chip printable-choice-chip--visual",
3302
+ children: /* @__PURE__ */ o("strong", { children: e.label })
3303
+ })]
3304
+ });
3305
+ }
3306
+ function Wn({ items: e, targets: t }) {
3307
+ return /* @__PURE__ */ s("div", {
3308
+ className: "printable-drag-match-board",
3309
+ children: [
3310
+ /* @__PURE__ */ o("div", {
3311
+ className: "printable-drag-match-column printable-drag-match-column--targets",
3312
+ children: t.map((e, t) => /* @__PURE__ */ o(Gn, {
3313
+ index: t,
3314
+ target: e
3315
+ }, e.id))
3316
+ }),
3317
+ /* @__PURE__ */ o("div", {
3318
+ "aria-hidden": "true",
3319
+ className: "printable-drag-match-lane",
3320
+ children: Array.from({ length: Math.max(e.length, t.length) }).map((e, t) => /* @__PURE__ */ o("span", { className: "printable-drag-match-guide" }, t))
3321
+ }),
3322
+ /* @__PURE__ */ o("div", {
3323
+ className: "printable-drag-match-column printable-drag-match-column--answers",
3324
+ children: e.map((e, t) => /* @__PURE__ */ o(Kn, {
3325
+ index: t,
3326
+ item: e
3327
+ }, e.id))
3328
+ })
3329
+ ]
3330
+ });
3331
+ }
3332
+ function Gn({ index: e, target: t }) {
3333
+ return /* @__PURE__ */ s("div", {
3334
+ className: "printable-drag-match-card printable-drag-match-card--target",
3335
+ children: [
3336
+ /* @__PURE__ */ o("span", {
3337
+ className: "printable-drag-match-index",
3338
+ children: String.fromCharCode(65 + e)
3339
+ }),
3340
+ /* @__PURE__ */ o("div", {
3341
+ className: "printable-drag-match-content",
3342
+ children: t.shapeId ? /* @__PURE__ */ o(Ne, { shapeId: t.shapeId }) : /* @__PURE__ */ o("strong", { children: t.label })
3343
+ }),
3344
+ /* @__PURE__ */ o("span", {
3345
+ "aria-hidden": "true",
3346
+ className: "printable-match-point printable-drag-match-dot printable-drag-match-dot--target"
3347
+ })
3348
+ ]
3349
+ });
3350
+ }
3351
+ function Kn({ index: e, item: t }) {
3352
+ return /* @__PURE__ */ s("div", {
3353
+ className: "printable-drag-match-card printable-drag-match-card--answer",
3354
+ children: [
3355
+ /* @__PURE__ */ o("span", {
3356
+ "aria-hidden": "true",
3357
+ className: "printable-match-point printable-drag-match-dot printable-drag-match-dot--answer"
3358
+ }),
3359
+ /* @__PURE__ */ o("div", {
3360
+ className: "printable-drag-match-content",
3361
+ children: /* @__PURE__ */ o("strong", { children: t.label })
3362
+ }),
3363
+ /* @__PURE__ */ o("span", {
3364
+ className: "printable-drag-match-index",
3365
+ children: e + 1
3366
+ })
3367
+ ]
3368
+ });
3369
+ }
3370
+ function qn({ targets: e }) {
3371
+ return /* @__PURE__ */ o("div", {
3372
+ className: "printable-placement-board",
3373
+ children: e.map((e, t) => /* @__PURE__ */ o("div", {
3374
+ className: "printable-placement-target",
3375
+ style: {
3376
+ left: `${e.x}%`,
3377
+ top: `${e.y}%`
3378
+ },
3379
+ children: /* @__PURE__ */ o("span", { children: e.label || String(t + 1) })
3380
+ }, e.id))
3381
+ });
3382
+ }
3383
+ function Jn({ points: e }) {
3384
+ return /* @__PURE__ */ s("svg", {
3385
+ className: "printable-drawing-grid",
3386
+ viewBox: "0 0 1000 420",
3387
+ children: [
3388
+ Array.from({ length: 34 }, (e, t) => /* @__PURE__ */ o("line", {
3389
+ className: "printable-drawing-grid__line",
3390
+ x1: t * 30,
3391
+ x2: t * 30,
3392
+ y1: "0",
3393
+ y2: 420
3394
+ }, `vx-${t}`)),
3395
+ Array.from({ length: 15 }, (e, t) => /* @__PURE__ */ o("line", {
3396
+ className: "printable-drawing-grid__line",
3397
+ x1: "0",
3398
+ x2: "1000",
3399
+ y1: t * 30,
3400
+ y2: t * 30
3401
+ }, `hy-${t}`)),
3402
+ e.map((e, t) => e.hidden ? null : /* @__PURE__ */ s("g", {
3403
+ className: "printable-drawing-grid__point",
3404
+ transform: `translate(${e.x / 100 * 1e3} ${e.y / 100 * 420})`,
3405
+ children: [/* @__PURE__ */ o("circle", { r: "6" }), /* @__PURE__ */ o("text", {
3406
+ x: "12",
3407
+ y: "-10",
3408
+ children: e.label?.trim() || String(t + 1)
3409
+ })]
3410
+ }, e.id))
3411
+ ]
3412
+ });
3413
+ }
3414
+ function Yn() {
3415
+ return /* @__PURE__ */ s("svg", {
3416
+ className: "printable-number-line",
3417
+ viewBox: "0 0 420 90",
3418
+ children: [/* @__PURE__ */ o("line", {
3419
+ x1: "20",
3420
+ x2: "400",
3421
+ y1: "35",
3422
+ y2: "35"
3423
+ }), Array.from({ length: 11 }, (e, t) => /* @__PURE__ */ s("g", {
3424
+ transform: `translate(${20 + t * 38} 0)`,
3425
+ children: [/* @__PURE__ */ o("line", {
3426
+ x1: "0",
3427
+ x2: "0",
3428
+ y1: "24",
3429
+ y2: "46"
3430
+ }), /* @__PURE__ */ o("text", {
3431
+ x: "0",
3432
+ y: "70",
3433
+ children: t
3434
+ })]
3435
+ }, t))]
3436
+ });
3437
+ }
3438
+ function Xn({ item: e, squareUnit: t, variant: n }) {
3439
+ return /* @__PURE__ */ s("div", {
3440
+ className: "length-card printable-length-card",
3441
+ children: [/* @__PURE__ */ o("div", {
3442
+ className: "square-measure-strip printable-square-measure-strip",
3443
+ style: { "--measure-squares": e.squareLength + 2 },
3444
+ children: /* @__PURE__ */ s("span", {
3445
+ "aria-hidden": "true",
3446
+ className: "printable-length-pencil",
3447
+ "data-variant": n,
3448
+ style: {
3449
+ "--pencil-squares": e.squareLength,
3450
+ "--pencil-start-square": 1
3451
+ },
3452
+ children: [
3453
+ /* @__PURE__ */ o("span", {
3454
+ className: "printable-length-pencil__tip",
3455
+ children: /* @__PURE__ */ o("span", { className: "printable-length-pencil__lead" })
3456
+ }),
3457
+ /* @__PURE__ */ o("span", { className: "printable-length-pencil__body" }),
3458
+ /* @__PURE__ */ o("span", { className: "printable-length-pencil__ferrule" }),
3459
+ /* @__PURE__ */ o("span", { className: "printable-length-pencil__eraser" }),
3460
+ /* @__PURE__ */ o("span", { className: "printable-length-pencil__shine" })
3461
+ ]
3462
+ })
3463
+ }), /* @__PURE__ */ s("div", {
3464
+ className: "length-value-row printable-length-value-row",
3465
+ children: [
3466
+ /* @__PURE__ */ o("span", { children: e.label }),
3467
+ /* @__PURE__ */ o($n, {}),
3468
+ /* @__PURE__ */ o("span", { children: t })
3469
+ ]
3470
+ })]
3471
+ });
3472
+ }
3473
+ function Zn({ part: e, partNumber: t }) {
3474
+ return /* @__PURE__ */ s("section", {
3475
+ className: "printable-word-problem__part",
3476
+ children: [/* @__PURE__ */ s("div", {
3477
+ className: "printable-word-problem__part-prompt",
3478
+ children: [/* @__PURE__ */ o("span", { children: t }), /* @__PURE__ */ o("strong", { children: e.prompt })]
3479
+ }), e.type === "coin-table" ? /* @__PURE__ */ o("div", {
3480
+ className: "printable-table-response printable-word-problem__table",
3481
+ children: e.columns.map((e) => /* @__PURE__ */ s("div", {
3482
+ className: "printable-table-column",
3483
+ children: [
3484
+ /* @__PURE__ */ o("strong", { children: e.title }),
3485
+ /* @__PURE__ */ o("div", { className: "printable-table-area" }),
3486
+ /* @__PURE__ */ s("div", {
3487
+ className: "printable-inline-answer",
3488
+ children: [/* @__PURE__ */ o("span", { children: e.answerLabel }), /* @__PURE__ */ o($, {})]
3489
+ })
3490
+ ]
3491
+ }, e.id))
3492
+ }) : /* @__PURE__ */ s("div", {
3493
+ className: "printable-inline-answer printable-inline-answer--sentence",
3494
+ children: [
3495
+ e.before ? /* @__PURE__ */ o("span", { children: e.before }) : null,
3496
+ /* @__PURE__ */ o($, {}),
3497
+ e.after ? /* @__PURE__ */ o("span", { children: e.after }) : null
3498
+ ]
3499
+ })]
3500
+ });
3501
+ }
3502
+ function Qn({ item: t }) {
3503
+ 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($n, {})] }, t.id)), t.after ? /* @__PURE__ */ o("span", { children: t.after }) : null] }) : t.correctAnswer ? /* @__PURE__ */ s(a, { children: [
3504
+ /* @__PURE__ */ o("span", { children: t.before }),
3505
+ /* @__PURE__ */ o($n, {}),
3506
+ t.after ? /* @__PURE__ */ o("span", { children: t.after }) : null
3507
+ ] }) : /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("span", { children: t.before }), t.after ? /* @__PURE__ */ o("span", { children: t.after }) : null] });
3508
+ }
3509
+ function $() {
3510
+ return /* @__PURE__ */ o("span", {
3511
+ className: "printable-blank-line",
3512
+ "aria-hidden": "true"
3513
+ });
3514
+ }
3515
+ function $n() {
3516
+ return /* @__PURE__ */ o("span", {
3517
+ className: "printable-blank-box",
3518
+ "aria-hidden": "true"
3519
+ });
3520
+ }
3521
+ function er(e) {
3522
+ return e.startsWith("ar");
3523
+ }
3524
+ function tr(e) {
3525
+ return er(e) ? {
3526
+ answerArea: "مساحة الجواب",
3527
+ countShort: "عدد",
3528
+ dragArea: "اربط أو اكتب الجواب",
3529
+ duration: "المدة",
3530
+ level: "المستوى",
3531
+ model: "النموذج",
3532
+ obtainedNote: "النقطة المحصل عليها",
3533
+ oralAnswer: "الإجابة الشفوية",
3534
+ phase: "المرحلة",
3535
+ placeLabels: "ضع التسميات في أماكنها",
3536
+ sortOrder: "رتب العناصر",
3537
+ totalPoints: "المجموع",
3538
+ traceArea: "مساحة الرسم",
3539
+ targets: "الأهداف",
3540
+ writeAnswer: "اكتب الجواب"
3541
+ } : {
3542
+ answerArea: "Zone de reponse",
3543
+ countShort: "Nb.",
3544
+ dragArea: "Relier ou ecrire la reponse",
3545
+ duration: "Duree",
3546
+ level: "Niveau",
3547
+ model: "Modele",
3548
+ obtainedNote: "Note obtenue",
3549
+ oralAnswer: "Reponse orale",
3550
+ phase: "Phase",
3551
+ placeLabels: "Placer les etiquettes",
3552
+ sortOrder: "Classer les elements",
3553
+ subject: "Matiere",
3554
+ totalPoints: "Total",
3555
+ traceArea: "Zone de trace",
3556
+ targets: "Cibles",
3557
+ writeAnswer: "Ecrire la reponse"
3558
+ };
3559
+ }
3560
+ //#endregion
2537
3561
  //#region src/exam-session/interactions/DraftSheet.tsx
2538
- function Kt({ disabled: e, onChange: t, value: n }) {
2539
- let [i, s] = r(!1);
2540
- return /* @__PURE__ */ a("aside", {
3562
+ function nr({ disabled: e, onChange: t, value: n }) {
3563
+ let [r, a] = i(!1);
3564
+ return /* @__PURE__ */ o("aside", {
2541
3565
  className: "draft-sheet",
2542
3566
  "data-disabled": e ? "true" : "false",
2543
- "data-open": i ? "true" : "false",
3567
+ "data-open": r ? "true" : "false",
2544
3568
  dir: "rtl",
2545
- children: i ? /* @__PURE__ */ o("div", {
3569
+ children: r ? /* @__PURE__ */ s("div", {
2546
3570
  className: "draft-sheet__panel",
2547
3571
  "aria-label": "ورقة وساخ",
2548
- children: [/* @__PURE__ */ o("header", {
3572
+ children: [/* @__PURE__ */ s("header", {
2549
3573
  className: "draft-sheet__header",
2550
- children: [/* @__PURE__ */ a("strong", { children: "ورقة وساخ" }), /* @__PURE__ */ a("button", {
2551
- onClick: () => s(!1),
3574
+ children: [/* @__PURE__ */ o("strong", { children: "ورقة وساخ" }), /* @__PURE__ */ o("button", {
3575
+ onClick: () => a(!1),
2552
3576
  type: "button",
2553
3577
  children: "إِغْلاقٌ"
2554
3578
  })]
2555
- }), /* @__PURE__ */ a(je, {
3579
+ }), /* @__PURE__ */ o(Qe, {
2556
3580
  actionLabel: "مساحة ورقة وساخ",
2557
3581
  canvasHeight: 430,
2558
3582
  disabled: e,
@@ -2560,25 +3584,25 @@ function Kt({ disabled: e, onChange: t, value: n }) {
2560
3584
  value: n,
2561
3585
  variant: "draft"
2562
3586
  })]
2563
- }) : /* @__PURE__ */ o("button", {
3587
+ }) : /* @__PURE__ */ s("button", {
2564
3588
  className: "draft-sheet__toggle",
2565
3589
  disabled: e,
2566
- onClick: () => s(!0),
3590
+ onClick: () => a(!0),
2567
3591
  type: "button",
2568
- children: [/* @__PURE__ */ a(p, { "aria-hidden": "true" }), /* @__PURE__ */ a("span", { children: "ورقة وساخ" })]
3592
+ children: [/* @__PURE__ */ o(b, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: "ورقة وساخ" })]
2569
3593
  })
2570
3594
  });
2571
3595
  }
2572
3596
  //#endregion
2573
3597
  //#region src/exam-session/interactions/SingleChoice.tsx
2574
- function qt({ answerId: e, choices: t, value: n, onChange: r }) {
2575
- return /* @__PURE__ */ a("div", {
3598
+ function rr({ answerId: e, choices: t, value: n, onChange: r }) {
3599
+ return /* @__PURE__ */ o("div", {
2576
3600
  className: "choice-group",
2577
3601
  role: "radiogroup",
2578
3602
  "aria-label": `اِخْتِياراتُ الإِجابَةِ ${e}`,
2579
3603
  children: t.map((e) => {
2580
3604
  let t = /[0-9+\-=]/.test(e.label);
2581
- return /* @__PURE__ */ a("button", {
3605
+ return /* @__PURE__ */ o("button", {
2582
3606
  "aria-checked": n?.choiceId === e.id,
2583
3607
  className: n?.choiceId === e.id ? "answer-chip answer-chip--selected" : "answer-chip",
2584
3608
  onClick: () => r({
@@ -2587,7 +3611,7 @@ function qt({ answerId: e, choices: t, value: n, onChange: r }) {
2587
3611
  }),
2588
3612
  role: "radio",
2589
3613
  type: "button",
2590
- children: /* @__PURE__ */ a("span", {
3614
+ children: /* @__PURE__ */ o("span", {
2591
3615
  className: t ? "answer-chip__label answer-chip__label--math" : "answer-chip__label",
2592
3616
  children: e.label
2593
3617
  })
@@ -2596,4 +3620,4 @@ function qt({ answerId: e, choices: t, value: n, onChange: r }) {
2596
3620
  });
2597
3621
  }
2598
3622
  //#endregion
2599
- export { pe as CoinTableResponse, ye as ColorPenPicker, J as DEFAULT_GEOMETRY_COLORS, lt as DEFAULT_NATIVE_VOICE_AI_CONFIG, Kt as DraftSheet, me as DragMatch, Ot as ExamSectionRenderer, je as GeometryCanvas, q as HandwrittenNumberAnswer, rt as KonvaDrawingGrid, it as LabelPlacement, st as NumberLineAnswer, gt as PronunciationRecorder, Gt as QuestionPreviewPanel, Dt as QuestionRenderer, qt as SingleChoice, wt as SortableAnswer, Et as TextAnswer, j as calculateExamResult, ut as evaluateVoiceAiResult, Se as getColorValue, xe as getDefaultColorId, Ce as mapChoicesToGeometryColors, dt as normalizeVoiceText };
3623
+ export { Oe as CoinTableResponse, Be as ColorPenPicker, K as DEFAULT_GEOMETRY_COLORS, Ft as DEFAULT_NATIVE_VOICE_AI_CONFIG, nr as DraftSheet, Pe as DragMatch, fn as ExamSectionRenderer, Qe as GeometryCanvas, G as HandwrittenNumberAnswer, Tt as KonvaDrawingGrid, Et as LabelPlacement, kt as NumberLineAnswer, Nt as OperationWorkArea, Mn as PrintableExamDocument, Fn as PrintableQuestionRenderer, Pn as PrintableSectionRenderer, Ht as PronunciationRecorder, An as QuestionPreviewPanel, dn as QuestionRenderer, Ne as ShapeGlyph, rr as SingleChoice, Zt as SortableAnswer, $t as TextAnswer, ln as VisualSceneGraphic, ie as calculateExamResult, sn as createVisualSceneFromVariant, It as evaluateVoiceAiResult, je as examShapeOptions, Ue as getColorValue, He as getDefaultColorId, Me as getExamShapeLabel, cn as getVisualSceneColorValue, We as mapChoicesToGeometryColors, Lt as normalizeVoiceText, an as visualSceneColorOptions, rn as visualSceneIconOptions, on as visualSceneStateOptions };