alexsys-exam-renderer 0.1.3 → 0.1.4
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/exam-session/examPoints.d.ts +9 -0
- package/dist/exam-session/examPoints.d.ts.map +1 -0
- package/dist/exam-session/examScoring.d.ts +2 -0
- package/dist/exam-session/examScoring.d.ts.map +1 -1
- package/dist/exam-session/examSessionTypes.d.ts +1 -9
- package/dist/exam-session/examSessionTypes.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +534 -707
- package/dist/renderer/PrintableExamDocument.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +56 -56
- package/dist/exam-session/interactions/OperationWorkArea.d.ts +0 -11
- package/dist/exam-session/interactions/OperationWorkArea.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -2,13 +2,48 @@ import { Fragment as e, useEffect as t, useMemo as n, useRef as r, useState as i
|
|
|
2
2
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
3
|
import { DragDropProvider as c, useDraggable as l, useDroppable as u } from "@dnd-kit/react";
|
|
4
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
|
|
6
|
-
import { move as
|
|
7
|
-
import { useSortable as
|
|
5
|
+
import { Arc as k, Circle as A, Group as j, Layer as te, Line as M, Rect as N, Stage as ne, Text as re } from "react-konva";
|
|
6
|
+
import { move as P } from "@dnd-kit/helpers";
|
|
7
|
+
import { useSortable as F } from "@dnd-kit/react/sortable";
|
|
8
|
+
//#region src/exam-session/examPoints.ts
|
|
9
|
+
function ie(e) {
|
|
10
|
+
if (!e) return 0;
|
|
11
|
+
let t = Number.parseFloat(e.replace(",", "."));
|
|
12
|
+
return Number.isFinite(t) ? t : 0;
|
|
13
|
+
}
|
|
14
|
+
function I(e) {
|
|
15
|
+
let t = Math.round(e * 100) / 100;
|
|
16
|
+
return String(t);
|
|
17
|
+
}
|
|
18
|
+
function ae(e) {
|
|
19
|
+
return ie(e.maxScore);
|
|
20
|
+
}
|
|
21
|
+
function oe(e) {
|
|
22
|
+
return e.questions.some((e) => se(e.maxScore));
|
|
23
|
+
}
|
|
24
|
+
function L(e) {
|
|
25
|
+
return oe(e) ? ce(e.questions.reduce((e, t) => e + ae(t), 0)) : ie(e.points);
|
|
26
|
+
}
|
|
27
|
+
function R(e) {
|
|
28
|
+
return I(L(e));
|
|
29
|
+
}
|
|
30
|
+
function z(e) {
|
|
31
|
+
return {
|
|
32
|
+
...e,
|
|
33
|
+
points: R(e)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function se(e) {
|
|
37
|
+
return typeof e == "string" && e.trim().length > 0;
|
|
38
|
+
}
|
|
39
|
+
function ce(e) {
|
|
40
|
+
return Math.round(e * 100) / 100;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
8
43
|
//#region src/exam-session/examScoring.ts
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
let n = e.sections.filter((e) => e.isScored !== !1).map((e) =>
|
|
44
|
+
var le = 1e3, ue = 600, B = 70;
|
|
45
|
+
function de(e, t) {
|
|
46
|
+
let n = e.sections.filter((e) => e.isScored !== !1).map((e) => fe(e, t)), r = U(n, (e) => e.correctCount), i = U(n, (e) => e.incorrectCount), a = U(n, (e) => e.unansweredCount), o = i + a, s = U(n, (e) => e.totalUnits), c = W(U(n, (e) => e.maxScore)), l = W(U(n, (e) => e.score));
|
|
12
47
|
return {
|
|
13
48
|
attentionWarningCount: 0,
|
|
14
49
|
correctCount: r,
|
|
@@ -16,7 +51,7 @@ function ie(e, t) {
|
|
|
16
51
|
incorrectCount: i,
|
|
17
52
|
maxScore: c,
|
|
18
53
|
notCorrectCount: o,
|
|
19
|
-
percentage: c > 0 ?
|
|
54
|
+
percentage: c > 0 ? W(l / c * 100) : 0,
|
|
20
55
|
score: l,
|
|
21
56
|
sections: n,
|
|
22
57
|
subject: e.subject,
|
|
@@ -25,117 +60,121 @@ function ie(e, t) {
|
|
|
25
60
|
unansweredCount: a
|
|
26
61
|
};
|
|
27
62
|
}
|
|
28
|
-
function
|
|
29
|
-
let n =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
})),
|
|
63
|
+
function fe(e, t) {
|
|
64
|
+
let n = oe(e), r = L(e), i = e.questions.map((e) => ({
|
|
65
|
+
maxScore: n ? ae(e) : 0,
|
|
66
|
+
units: pe(e, t)
|
|
67
|
+
})), a = !n && U(i, (e) => e.units.length) > 0 ? r / U(i, (e) => e.units.length) : 0, o = i.flatMap((t) => {
|
|
68
|
+
let r = n ? t.units.length > 0 ? t.maxScore / t.units.length : 0 : a;
|
|
69
|
+
return t.units.map((t) => ({
|
|
70
|
+
...t,
|
|
71
|
+
maxScore: W(r),
|
|
72
|
+
score: t.status === "correct" ? W(r) : 0,
|
|
73
|
+
sectionId: e.id
|
|
74
|
+
}));
|
|
75
|
+
}), s = Ae(o, "correct"), c = Ae(o, "incorrect"), l = Ae(o, "unanswered"), u = c + l;
|
|
33
76
|
return {
|
|
34
77
|
badge: e.badge,
|
|
35
|
-
correctCount:
|
|
78
|
+
correctCount: s,
|
|
36
79
|
id: e.id,
|
|
37
|
-
incorrectCount:
|
|
80
|
+
incorrectCount: c,
|
|
38
81
|
maxScore: r,
|
|
39
|
-
notCorrectCount:
|
|
40
|
-
score:
|
|
82
|
+
notCorrectCount: u,
|
|
83
|
+
score: W(U(o, (e) => e.score)),
|
|
41
84
|
title: e.title,
|
|
42
85
|
tone: e.tone,
|
|
43
|
-
totalUnits:
|
|
44
|
-
unansweredCount:
|
|
45
|
-
units:
|
|
86
|
+
totalUnits: o.length,
|
|
87
|
+
unansweredCount: l,
|
|
88
|
+
units: o
|
|
46
89
|
};
|
|
47
90
|
}
|
|
48
|
-
function
|
|
91
|
+
function pe(e, t) {
|
|
49
92
|
switch (e.type) {
|
|
50
93
|
case "inline-inputs":
|
|
51
94
|
case "equation-inputs": return e.items.flatMap((n) => {
|
|
52
95
|
if (n.answers?.length) return n.answers.flatMap((r) => {
|
|
53
96
|
if (!r.correctAnswer) return [];
|
|
54
97
|
let i = `${e.id}:${n.id}:${r.id}`;
|
|
55
|
-
return [
|
|
98
|
+
return [V(i, e.id, r.before, r.correctAnswer, t[i])];
|
|
56
99
|
});
|
|
57
100
|
if (!n.correctAnswer) return [];
|
|
58
101
|
let r = `${e.id}:${n.id}`;
|
|
59
|
-
return [
|
|
102
|
+
return [V(r, e.id, n.before, n.correctAnswer, t[r])];
|
|
60
103
|
});
|
|
61
|
-
case "number-line": return [
|
|
62
|
-
case "
|
|
63
|
-
case "
|
|
64
|
-
case "
|
|
65
|
-
case "
|
|
66
|
-
case "
|
|
67
|
-
case "
|
|
68
|
-
case "
|
|
69
|
-
case "text-input": return e.correctAnswer ? [B(e.id, e.id, e.prompt, e.correctAnswer, t[e.id])] : [];
|
|
104
|
+
case "number-line": return [V(e.id, e.id, e.expression, e.correctAnswer, t[e.id])];
|
|
105
|
+
case "visual-choice": return he(e.id, e.id, e.grading.pairs, t[e.id]);
|
|
106
|
+
case "length-estimation": return ge(e, t);
|
|
107
|
+
case "shape-choice": return he(e.id, e.id, e.grading.pairs, t[e.id]);
|
|
108
|
+
case "drag-match": return he(e.id, e.id, e.grading?.pairs, t[e.id]);
|
|
109
|
+
case "drawing-grid": return [xe(e, t[e.id])];
|
|
110
|
+
case "table-response": return ve(e, t[e.id]);
|
|
111
|
+
case "text-input": return e.correctAnswer ? [V(e.id, e.id, e.prompt, e.correctAnswer, t[e.id])] : [];
|
|
70
112
|
case "word-problem": return e.parts.flatMap((n) => {
|
|
71
113
|
let r = `${e.id}:${n.id}`;
|
|
72
|
-
return n.type === "coin-table" ?
|
|
114
|
+
return n.type === "coin-table" ? ye(e.id, n, t[r]) : n.correctAnswer ? [V(r, e.id, n.prompt, n.correctAnswer, t[r])] : [];
|
|
73
115
|
});
|
|
74
116
|
case "sortable-answer": return [];
|
|
75
|
-
case "label-placement": return
|
|
76
|
-
case "audio-recording": return [
|
|
117
|
+
case "label-placement": return be(e.id, e.grading?.targetsByLabelId, t[e.id]);
|
|
118
|
+
case "audio-recording": return [me(e, t[e.id])];
|
|
77
119
|
}
|
|
78
120
|
}
|
|
79
|
-
function
|
|
80
|
-
return t?.kind === "audio-recording" ?
|
|
81
|
-
}
|
|
82
|
-
function se(e) {
|
|
83
|
-
return `${e.leftOperand} ${e.operator} ${e.rightOperand} =`;
|
|
121
|
+
function me(e, t) {
|
|
122
|
+
return t?.kind === "audio-recording" ? H(e.id, e.id, e.expectedAnswer, t.evaluation.isCorrect ? "correct" : "incorrect") : H(e.id, e.id, e.expectedAnswer, "unanswered");
|
|
84
123
|
}
|
|
85
|
-
function
|
|
86
|
-
return r ? i?.kind === "handwritten-number" ? i.strokes.length === 0 ?
|
|
124
|
+
function V(e, t, n, r, i) {
|
|
125
|
+
return r ? i?.kind === "handwritten-number" ? i.strokes.length === 0 ? H(e, t, n, "unanswered") : H(e, t, n, i.recognizedValue && Oe(i.recognizedValue, r) ? "correct" : "incorrect") : i?.kind !== "text" || ke(i.value) === "" ? H(e, t, n, "unanswered") : H(e, t, n, Oe(i.value, r) ? "correct" : "incorrect") : H(e, t, n, "incorrect");
|
|
87
126
|
}
|
|
88
|
-
function
|
|
127
|
+
function he(e, t, n, r) {
|
|
89
128
|
return n ? Object.entries(n).map(([n, i]) => {
|
|
90
129
|
let a = r?.kind === "matches" ? r.pairs[n] : void 0, o = a ? a === i ? "correct" : "incorrect" : "unanswered";
|
|
91
|
-
return
|
|
130
|
+
return H(`${e}:${n}`, t, n, o);
|
|
92
131
|
}) : [];
|
|
93
132
|
}
|
|
94
|
-
function
|
|
133
|
+
function ge(e, t) {
|
|
95
134
|
let n = e.items.map((n) => {
|
|
96
135
|
let r = `${e.id}:squares:${n.id}`;
|
|
97
|
-
return
|
|
136
|
+
return V(r, e.id, n.label, n.squareLength.toString(), t[r]);
|
|
98
137
|
}), r = e.items.flatMap((n) => {
|
|
99
138
|
if (!n.correctColorId) return [];
|
|
100
139
|
let r = `${e.id}:color:${n.id}`;
|
|
101
|
-
return [
|
|
140
|
+
return [_e(r, e.id, n.label, n.correctColorId, t[r])];
|
|
102
141
|
});
|
|
103
142
|
return n.concat(r);
|
|
104
143
|
}
|
|
105
|
-
function
|
|
106
|
-
return i?.kind !== "choice" || !i.choiceId ?
|
|
144
|
+
function _e(e, t, n, r, i) {
|
|
145
|
+
return i?.kind !== "choice" || !i.choiceId ? H(e, t, n, "unanswered") : H(e, t, n, i.choiceId === r ? "correct" : "incorrect");
|
|
107
146
|
}
|
|
108
|
-
function
|
|
147
|
+
function ve(e, t) {
|
|
109
148
|
return e.columns.flatMap((n) => {
|
|
110
149
|
if (typeof n.correctCount != "number") return [];
|
|
111
150
|
let r = t?.kind === "coin-table" ? t.counts[n.id] : void 0, i = r === void 0 ? "unanswered" : r === n.correctCount ? "correct" : "incorrect";
|
|
112
|
-
return
|
|
151
|
+
return H(`${e.id}:${n.id}`, e.id, n.title, i);
|
|
113
152
|
});
|
|
114
153
|
}
|
|
115
|
-
function
|
|
154
|
+
function ye(e, t, n) {
|
|
116
155
|
return t.columns.flatMap((r) => {
|
|
117
156
|
if (typeof r.correctCount != "number") return [];
|
|
118
157
|
let i = n?.kind === "coin-table" ? n.counts[r.id] : void 0, a = i === void 0 ? "unanswered" : i === r.correctCount ? "correct" : "incorrect";
|
|
119
|
-
return
|
|
158
|
+
return H(`${e}:${t.id}:${r.id}`, e, r.title, a);
|
|
120
159
|
});
|
|
121
160
|
}
|
|
122
|
-
function
|
|
161
|
+
function be(e, t, n) {
|
|
123
162
|
return t ? Object.entries(t).map(([t, r]) => {
|
|
124
163
|
let i = n?.kind === "placements" ? n.placements[t]?.targetId : void 0, a = i ? i === r ? "correct" : "incorrect" : "unanswered";
|
|
125
|
-
return
|
|
164
|
+
return H(`${e}:${t}`, e, t, a);
|
|
126
165
|
}) : [];
|
|
127
166
|
}
|
|
128
|
-
function
|
|
167
|
+
function xe(e, t) {
|
|
129
168
|
let n = e.grading.expectedSegments, r = t?.kind === "drawing" && ((t.elements?.length ?? 0) > 0 || (t.strokes?.length ?? 0) > 0);
|
|
130
|
-
if (t?.kind !== "drawing" || !r) return
|
|
131
|
-
let i = n.every((n) =>
|
|
132
|
-
return
|
|
169
|
+
if (t?.kind !== "drawing" || !r) return H(e.id, e.id, e.prompt, "unanswered");
|
|
170
|
+
let i = n.every((n) => Se(t, e, n));
|
|
171
|
+
return H(e.id, e.id, e.prompt, i ? "correct" : "incorrect");
|
|
133
172
|
}
|
|
134
|
-
function
|
|
135
|
-
let r =
|
|
136
|
-
return !r || !i ? !1 :
|
|
173
|
+
function Se(e, t, n) {
|
|
174
|
+
let r = Ee(t, n.from), i = Ee(t, n.to);
|
|
175
|
+
return !r || !i ? !1 : Ce(e).some((e) => we(e, r, i));
|
|
137
176
|
}
|
|
138
|
-
function
|
|
177
|
+
function Ce(e) {
|
|
139
178
|
let t = e.elements.flatMap((e) => e.type === "line" ? [{
|
|
140
179
|
end: {
|
|
141
180
|
x: e.points[2],
|
|
@@ -169,31 +208,31 @@ function ge(e) {
|
|
|
169
208
|
}]) ?? [];
|
|
170
209
|
return t.concat(n);
|
|
171
210
|
}
|
|
172
|
-
function
|
|
173
|
-
let r =
|
|
174
|
-
return !r && !i ? !1 :
|
|
211
|
+
function we(e, t, n) {
|
|
212
|
+
let r = je(e.start, t) <= B && je(e.end, n) <= B, i = je(e.start, n) <= B && je(e.end, t) <= B;
|
|
213
|
+
return !r && !i ? !1 : Te(e.points, t, n, B);
|
|
175
214
|
}
|
|
176
|
-
function
|
|
177
|
-
for (let i = 0; i < e.length - 1; i += 4) if (
|
|
215
|
+
function Te(e, t, n, r) {
|
|
216
|
+
for (let i = 0; i < e.length - 1; i += 4) if (Me({
|
|
178
217
|
x: e[i],
|
|
179
218
|
y: e[i + 1]
|
|
180
219
|
}, t, n) > r) return !1;
|
|
181
220
|
return !0;
|
|
182
221
|
}
|
|
183
|
-
function
|
|
222
|
+
function Ee(e, t) {
|
|
184
223
|
if ("pointId" in t) {
|
|
185
224
|
let n = e.points.find((e) => e.id === t.pointId);
|
|
186
|
-
return n ?
|
|
225
|
+
return n ? De(n.x, n.y) : null;
|
|
187
226
|
}
|
|
188
|
-
return
|
|
227
|
+
return De(t.percentX, t.percentY);
|
|
189
228
|
}
|
|
190
|
-
function
|
|
229
|
+
function De(e, t) {
|
|
191
230
|
return {
|
|
192
|
-
x: e / 100 *
|
|
193
|
-
y: t / 100 *
|
|
231
|
+
x: e / 100 * le,
|
|
232
|
+
y: t / 100 * ue
|
|
194
233
|
};
|
|
195
234
|
}
|
|
196
|
-
function
|
|
235
|
+
function H(e, t, n, r) {
|
|
197
236
|
return {
|
|
198
237
|
id: e,
|
|
199
238
|
label: n,
|
|
@@ -201,41 +240,41 @@ function V(e, t, n, r) {
|
|
|
201
240
|
status: r
|
|
202
241
|
};
|
|
203
242
|
}
|
|
204
|
-
function
|
|
205
|
-
let n =
|
|
243
|
+
function Oe(e, t) {
|
|
244
|
+
let n = ke(e), r = ke(t), i = Number(n), a = Number(r);
|
|
206
245
|
return Number.isFinite(i) && Number.isFinite(a) ? i === a : n === r;
|
|
207
246
|
}
|
|
208
|
-
function
|
|
247
|
+
function ke(e) {
|
|
209
248
|
return e.trim().replace(/[٠-٩]/g, (e) => `${e.charCodeAt(0) - 1632}`).replace(/[۰-۹]/g, (e) => `${e.charCodeAt(0) - 1776}`);
|
|
210
249
|
}
|
|
211
|
-
function
|
|
250
|
+
function Ae(e, t) {
|
|
212
251
|
return e.filter((e) => e.status === t).length;
|
|
213
252
|
}
|
|
214
|
-
function
|
|
253
|
+
function U(e, t) {
|
|
215
254
|
return e.reduce((e, n) => e + t(n), 0);
|
|
216
255
|
}
|
|
217
|
-
function
|
|
256
|
+
function W(e) {
|
|
218
257
|
return Math.round(e * 100) / 100;
|
|
219
258
|
}
|
|
220
|
-
function
|
|
259
|
+
function je(e, t) {
|
|
221
260
|
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
222
261
|
}
|
|
223
|
-
function
|
|
262
|
+
function Me(e, t, n) {
|
|
224
263
|
let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
|
|
225
|
-
if (a === 0) return
|
|
264
|
+
if (a === 0) return je(e, t);
|
|
226
265
|
let o = Math.max(0, Math.min(1, ((e.x - t.x) * r + (e.y - t.y) * i) / a));
|
|
227
|
-
return
|
|
266
|
+
return je(e, {
|
|
228
267
|
x: t.x + o * r,
|
|
229
268
|
y: t.y + o * i
|
|
230
269
|
});
|
|
231
270
|
}
|
|
232
271
|
//#endregion
|
|
233
272
|
//#region src/exam-session/interactions/CoinTableResponse.tsx
|
|
234
|
-
var
|
|
235
|
-
function
|
|
273
|
+
var Ne = 0, Pe = 12;
|
|
274
|
+
function Fe({ columns: e, value: t, onChange: n }) {
|
|
236
275
|
let r = t?.counts ?? {};
|
|
237
276
|
function i(e, t) {
|
|
238
|
-
let i = e.maxCoins ??
|
|
277
|
+
let i = e.maxCoins ?? Pe, a = Math.max(Ne, Math.min(i, t));
|
|
239
278
|
n({
|
|
240
279
|
kind: "coin-table",
|
|
241
280
|
counts: {
|
|
@@ -247,7 +286,7 @@ function Oe({ columns: e, value: t, onChange: n }) {
|
|
|
247
286
|
return /* @__PURE__ */ o("div", {
|
|
248
287
|
className: "response-table",
|
|
249
288
|
children: e.map((e) => {
|
|
250
|
-
let t = r[e.id] ?? 0, n = e.maxCoins ??
|
|
289
|
+
let t = r[e.id] ?? 0, n = e.maxCoins ?? Pe;
|
|
251
290
|
return /* @__PURE__ */ s("div", {
|
|
252
291
|
className: "response-column",
|
|
253
292
|
children: [
|
|
@@ -272,7 +311,7 @@ function Oe({ columns: e, value: t, onChange: n }) {
|
|
|
272
311
|
children: "إِضافَةٌ"
|
|
273
312
|
}), /* @__PURE__ */ o("button", {
|
|
274
313
|
className: "coin-action coin-action--secondary",
|
|
275
|
-
disabled: t <=
|
|
314
|
+
disabled: t <= Ne,
|
|
276
315
|
onClick: () => i(e, t - 1),
|
|
277
316
|
type: "button",
|
|
278
317
|
children: "حَذْفٌ"
|
|
@@ -299,7 +338,7 @@ function Oe({ columns: e, value: t, onChange: n }) {
|
|
|
299
338
|
}
|
|
300
339
|
//#endregion
|
|
301
340
|
//#region src/renderer/shapeCatalog.tsx
|
|
302
|
-
var
|
|
341
|
+
var Ie = {
|
|
303
342
|
circle: p,
|
|
304
343
|
diamond: m,
|
|
305
344
|
heart: _,
|
|
@@ -309,7 +348,7 @@ var ke = {
|
|
|
309
348
|
square: C,
|
|
310
349
|
star: w,
|
|
311
350
|
triangle: E
|
|
312
|
-
},
|
|
351
|
+
}, Le = {
|
|
313
352
|
circle: "Cercle",
|
|
314
353
|
diamond: "Losange",
|
|
315
354
|
heart: "Coeur",
|
|
@@ -319,15 +358,15 @@ var ke = {
|
|
|
319
358
|
square: "Carre",
|
|
320
359
|
star: "Etoile",
|
|
321
360
|
triangle: "Triangle"
|
|
322
|
-
},
|
|
323
|
-
label:
|
|
361
|
+
}, Re = Object.keys(Le).map((e) => ({
|
|
362
|
+
label: Le[e],
|
|
324
363
|
value: e
|
|
325
364
|
}));
|
|
326
|
-
function
|
|
327
|
-
return
|
|
365
|
+
function ze(e) {
|
|
366
|
+
return Le[e];
|
|
328
367
|
}
|
|
329
|
-
function
|
|
330
|
-
let n =
|
|
368
|
+
function Be({ shapeId: e, title: t }) {
|
|
369
|
+
let n = Ie[e];
|
|
331
370
|
return /* @__PURE__ */ o("span", {
|
|
332
371
|
"aria-label": t,
|
|
333
372
|
role: t ? "img" : void 0,
|
|
@@ -337,7 +376,7 @@ function Ne({ shapeId: e, title: t }) {
|
|
|
337
376
|
}
|
|
338
377
|
//#endregion
|
|
339
378
|
//#region src/exam-session/interactions/DragMatch.tsx
|
|
340
|
-
function
|
|
379
|
+
function Ve({ items: e, targets: t, value: n, onChange: r }) {
|
|
341
380
|
let i = n?.pairs ?? {}, a = new Set(Object.values(i));
|
|
342
381
|
return /* @__PURE__ */ o(c, {
|
|
343
382
|
onDragEnd: (e) => {
|
|
@@ -355,10 +394,10 @@ function Pe({ items: e, targets: t, value: n, onChange: r }) {
|
|
|
355
394
|
className: "drag-match",
|
|
356
395
|
children: [/* @__PURE__ */ o("div", {
|
|
357
396
|
className: "drag-match__items",
|
|
358
|
-
children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ o(
|
|
397
|
+
children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ o(He, { item: e }, e.id))
|
|
359
398
|
}), /* @__PURE__ */ o("div", {
|
|
360
399
|
className: "drag-match__targets",
|
|
361
|
-
children: t.map((t) => /* @__PURE__ */ o(
|
|
400
|
+
children: t.map((t) => /* @__PURE__ */ o(Ue, {
|
|
362
401
|
assignedItem: e.find((e) => e.id === i[t.id]),
|
|
363
402
|
target: t
|
|
364
403
|
}, t.id))
|
|
@@ -366,7 +405,7 @@ function Pe({ items: e, targets: t, value: n, onChange: r }) {
|
|
|
366
405
|
})
|
|
367
406
|
});
|
|
368
407
|
}
|
|
369
|
-
function
|
|
408
|
+
function He({ item: e }) {
|
|
370
409
|
let { ref: t, isDragging: n } = l({ id: e.id });
|
|
371
410
|
return /* @__PURE__ */ o("button", {
|
|
372
411
|
className: n ? "drag-pill drag-pill--dragging" : "drag-pill",
|
|
@@ -375,23 +414,23 @@ function Fe({ item: e }) {
|
|
|
375
414
|
children: e.label
|
|
376
415
|
});
|
|
377
416
|
}
|
|
378
|
-
function
|
|
417
|
+
function Ue({ assignedItem: e, target: t }) {
|
|
379
418
|
let { ref: n, isDropTarget: r } = u({ id: t.id });
|
|
380
419
|
return /* @__PURE__ */ s("div", {
|
|
381
420
|
className: r ? "drop-slot drop-slot--active" : "drop-slot",
|
|
382
421
|
ref: n,
|
|
383
422
|
children: [/* @__PURE__ */ o("span", {
|
|
384
423
|
className: t.shapeId ? "drop-slot__visual drop-slot__visual--shape" : "drop-slot__visual",
|
|
385
|
-
children: t.shapeId ? /* @__PURE__ */ o(
|
|
424
|
+
children: t.shapeId ? /* @__PURE__ */ o(Be, {
|
|
386
425
|
shapeId: t.shapeId,
|
|
387
426
|
title: t.label
|
|
388
427
|
}) : t.label
|
|
389
|
-
}), e ? /* @__PURE__ */ o(
|
|
428
|
+
}), e ? /* @__PURE__ */ o(He, { item: e }) : /* @__PURE__ */ o("span", { children: "ضع الإجابة هنا" })]
|
|
390
429
|
});
|
|
391
430
|
}
|
|
392
431
|
//#endregion
|
|
393
432
|
//#region src/exam-session/interactions/HandwrittenNumberAnswer.tsx
|
|
394
|
-
var
|
|
433
|
+
var We = 132, Ge = 88, Ke = 650;
|
|
395
434
|
function G({ ariaLabel: e, onChange: n, onClear: a, recognizer: c, value: l }) {
|
|
396
435
|
let u = l?.strokes ?? [], d = u.length === 0, f = r(n), [p, m] = i(!1), [g, _] = i(!1), v = !!c?.isAvailable(), y = c?.getStatus?.() ?? (v ? "ready" : "unavailable"), b = y === "preparing" || y === "error", x = y === "preparing" ? "preparing-model" : y === "error" ? "model-error" : d || p ? "idle" : l?.recognizedValue === void 0 ? !v || y === "unavailable" ? "unavailable" : g ? "unrecognized" : "recognizing" : "recognized";
|
|
397
436
|
t(() => {
|
|
@@ -410,7 +449,7 @@ function G({ ariaLabel: e, onChange: n, onClear: a, recognizer: c, value: l }) {
|
|
|
410
449
|
}).catch(() => {
|
|
411
450
|
e || _(!0);
|
|
412
451
|
});
|
|
413
|
-
},
|
|
452
|
+
}, Ke);
|
|
414
453
|
return () => {
|
|
415
454
|
e = !0, window.clearTimeout(t);
|
|
416
455
|
};
|
|
@@ -424,8 +463,8 @@ function G({ ariaLabel: e, onChange: n, onClear: a, recognizer: c, value: l }) {
|
|
|
424
463
|
]);
|
|
425
464
|
function S(e) {
|
|
426
465
|
_(!1), n({
|
|
427
|
-
canvasHeight:
|
|
428
|
-
canvasWidth:
|
|
466
|
+
canvasHeight: Ge,
|
|
467
|
+
canvasWidth: We,
|
|
429
468
|
kind: "handwritten-number",
|
|
430
469
|
strokes: e
|
|
431
470
|
});
|
|
@@ -466,23 +505,23 @@ function G({ ariaLabel: e, onChange: n, onClear: a, recognizer: c, value: l }) {
|
|
|
466
505
|
children: [
|
|
467
506
|
/* @__PURE__ */ s(ne, {
|
|
468
507
|
className: "handwritten-number-stage",
|
|
469
|
-
height:
|
|
508
|
+
height: Ge,
|
|
470
509
|
onPointerCancel: w,
|
|
471
510
|
onPointerDown: ee,
|
|
472
511
|
onPointerMove: C,
|
|
473
512
|
onPointerUp: w,
|
|
474
513
|
role: "img",
|
|
475
|
-
width:
|
|
514
|
+
width: We,
|
|
476
515
|
children: [/* @__PURE__ */ s(te, {
|
|
477
516
|
listening: !1,
|
|
478
517
|
children: [
|
|
479
518
|
/* @__PURE__ */ o(N, {
|
|
480
519
|
cornerRadius: 14,
|
|
481
520
|
fill: "#fff",
|
|
482
|
-
height:
|
|
521
|
+
height: Ge,
|
|
483
522
|
stroke: "#cfe3d9",
|
|
484
523
|
strokeWidth: 2,
|
|
485
|
-
width:
|
|
524
|
+
width: We,
|
|
486
525
|
x: 0,
|
|
487
526
|
y: 0
|
|
488
527
|
}),
|
|
@@ -490,23 +529,23 @@ function G({ ariaLabel: e, onChange: n, onClear: a, recognizer: c, value: l }) {
|
|
|
490
529
|
dash: [6, 8],
|
|
491
530
|
points: [
|
|
492
531
|
16,
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
532
|
+
Ge - 18,
|
|
533
|
+
We - 16,
|
|
534
|
+
Ge - 18
|
|
496
535
|
],
|
|
497
536
|
stroke: "#dbe9e2",
|
|
498
537
|
strokeWidth: 2
|
|
499
538
|
}),
|
|
500
|
-
d ? /* @__PURE__ */ o(
|
|
539
|
+
d ? /* @__PURE__ */ o(re, {
|
|
501
540
|
align: "center",
|
|
502
541
|
fill: "#9aaca3",
|
|
503
542
|
fontFamily: "Arial, sans-serif",
|
|
504
543
|
fontSize: 15,
|
|
505
544
|
fontStyle: "bold",
|
|
506
|
-
height:
|
|
545
|
+
height: Ge,
|
|
507
546
|
text: "ارسم هنا",
|
|
508
547
|
verticalAlign: "middle",
|
|
509
|
-
width:
|
|
548
|
+
width: We,
|
|
510
549
|
x: 0,
|
|
511
550
|
y: 0
|
|
512
551
|
}) : null
|
|
@@ -533,12 +572,12 @@ function G({ ariaLabel: e, onChange: n, onClear: a, recognizer: c, value: l }) {
|
|
|
533
572
|
"aria-live": "polite",
|
|
534
573
|
className: "handwritten-number-status",
|
|
535
574
|
"data-state": x,
|
|
536
|
-
children:
|
|
575
|
+
children: qe(x, l?.recognizedValue)
|
|
537
576
|
}) : null
|
|
538
577
|
]
|
|
539
578
|
});
|
|
540
579
|
}
|
|
541
|
-
function
|
|
580
|
+
function qe(e, t) {
|
|
542
581
|
switch (e) {
|
|
543
582
|
case "recognizing": return "جارٍ التعرّف على الرقم…";
|
|
544
583
|
case "recognized": return `تمّ التعرّف: ${t ?? ""}`;
|
|
@@ -551,7 +590,7 @@ function ze(e, t) {
|
|
|
551
590
|
}
|
|
552
591
|
//#endregion
|
|
553
592
|
//#region src/exam-session/interactions/ColorPenPicker.tsx
|
|
554
|
-
function
|
|
593
|
+
function Je({ ariaLabel: e, className: t = "", colors: n, disabled: r = !1, onChange: i, selectedColorId: a }) {
|
|
555
594
|
return /* @__PURE__ */ o("div", {
|
|
556
595
|
"aria-label": e,
|
|
557
596
|
className: ["color-pen-picker", t].filter(Boolean).join(" "),
|
|
@@ -596,28 +635,28 @@ var K = [
|
|
|
596
635
|
label: "أَسْوَدُ",
|
|
597
636
|
value: "#17212b"
|
|
598
637
|
}
|
|
599
|
-
],
|
|
638
|
+
], Ye = {
|
|
600
639
|
black: "#17212b",
|
|
601
640
|
blue: "#256fd2",
|
|
602
641
|
green: "#0b7f45",
|
|
603
642
|
red: "#e34a58"
|
|
604
643
|
};
|
|
605
|
-
function
|
|
644
|
+
function Xe(e, t) {
|
|
606
645
|
return t ? e.find((e) => e.id === t || e.value === t)?.id ?? e[0]?.id ?? "green" : e[0]?.id ?? "green";
|
|
607
646
|
}
|
|
608
|
-
function
|
|
647
|
+
function Ze(e, t) {
|
|
609
648
|
return e.find((e) => e.id === t)?.value ?? e[0]?.value ?? K[0].value;
|
|
610
649
|
}
|
|
611
|
-
function
|
|
650
|
+
function Qe(e) {
|
|
612
651
|
return e.map((e) => ({
|
|
613
652
|
id: e.id,
|
|
614
653
|
label: e.label,
|
|
615
|
-
value:
|
|
654
|
+
value: Ye[e.id] ?? K[0].value
|
|
616
655
|
}));
|
|
617
656
|
}
|
|
618
657
|
//#endregion
|
|
619
658
|
//#region src/exam-session/interactions/GeometryCanvas.tsx
|
|
620
|
-
var
|
|
659
|
+
var $e = 1e3, et = 600, q = 30, tt = 240, nt = 12, rt = K[0].value, J = "#0a8f55", it = [
|
|
621
660
|
{
|
|
622
661
|
id: "pen",
|
|
623
662
|
icon: "✎",
|
|
@@ -648,39 +687,39 @@ var Ge = 1e3, Ke = 600, q = 30, qe = 240, Je = 12, Ye = K[0].value, J = "#0a8f55
|
|
|
648
687
|
icon: "⌖",
|
|
649
688
|
label: "بَرْكارٌ"
|
|
650
689
|
}
|
|
651
|
-
],
|
|
690
|
+
], at = /* @__PURE__ */ new Set([
|
|
652
691
|
"ruler",
|
|
653
692
|
"protractor",
|
|
654
693
|
"compass"
|
|
655
694
|
]);
|
|
656
|
-
function
|
|
657
|
-
let _ = c.length > 0 ? c : K, [v, y] = i(null), [b, x] = i([]), [S, ee] = i(() =>
|
|
695
|
+
function ot({ actionLabel: e, canvasHeight: t = et, canvasWidth: n = $e, className: a = "", colorOptions: c = K, defaultColor: l, disabled: u = !1, minStageWidth: d = tt, onChange: f, points: p = [], showColorPalette: m = !0, value: h, variant: g = "question" }) {
|
|
696
|
+
let _ = c.length > 0 ? c : K, [v, y] = i(null), [b, x] = i([]), [S, ee] = i(() => Xe(_, l ?? "black")), [C, w] = i(() => gt(h)), [T, E] = i(() => h?.guides ?? ht(n, t)), [D, O] = i(null), [k, A] = i({
|
|
658
697
|
height: t,
|
|
659
698
|
scale: 1,
|
|
660
699
|
width: n
|
|
661
700
|
}), [j, M] = i({
|
|
662
701
|
canRedo: !1,
|
|
663
702
|
canUndo: !1
|
|
664
|
-
}),
|
|
665
|
-
|
|
666
|
-
let
|
|
703
|
+
}), re = r(null), P = r([Y(C)]), F = r(0), ie = r(0), I = r(null);
|
|
704
|
+
st(re, n, t, d, A);
|
|
705
|
+
let ae = vt(p, n, t), oe = [
|
|
667
706
|
"geometry-canvas",
|
|
668
707
|
`geometry-canvas--${g}`,
|
|
669
708
|
a
|
|
670
|
-
].filter(Boolean).join(" "),
|
|
709
|
+
].filter(Boolean).join(" "), L = _.some((e) => e.id === S) ? S : Xe(_, "black"), R = Ze(_, L), z = xt(v);
|
|
671
710
|
function se(e) {
|
|
672
|
-
return
|
|
711
|
+
return at.has(e) ? !z && b.includes(e) : v === e || b.includes(e);
|
|
673
712
|
}
|
|
674
|
-
function
|
|
713
|
+
function ce(e) {
|
|
675
714
|
x((t) => t.includes(e) ? t.filter((t) => t !== e) : t.concat(e));
|
|
676
715
|
}
|
|
677
|
-
function
|
|
716
|
+
function le(e) {
|
|
678
717
|
if (e === "ruler" || e === "protractor") {
|
|
679
718
|
if (z) {
|
|
680
719
|
y(null), x((t) => t.includes(e) ? t : t.concat(e));
|
|
681
720
|
return;
|
|
682
721
|
}
|
|
683
|
-
|
|
722
|
+
ce(e);
|
|
684
723
|
return;
|
|
685
724
|
}
|
|
686
725
|
if (e === "compass") {
|
|
@@ -693,65 +732,65 @@ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, classNa
|
|
|
693
732
|
}
|
|
694
733
|
y(e);
|
|
695
734
|
}
|
|
696
|
-
function
|
|
697
|
-
return
|
|
735
|
+
function ue(e) {
|
|
736
|
+
return ie.current += 1, `${e}-${Date.now()}-${ie.current}`;
|
|
698
737
|
}
|
|
699
|
-
function
|
|
738
|
+
function B(e, t = T) {
|
|
700
739
|
f({
|
|
701
740
|
elements: Y(e),
|
|
702
741
|
guides: t,
|
|
703
742
|
kind: "drawing",
|
|
704
|
-
strokes:
|
|
743
|
+
strokes: _t(e)
|
|
705
744
|
});
|
|
706
745
|
}
|
|
707
746
|
function de() {
|
|
708
747
|
M({
|
|
709
|
-
canRedo:
|
|
710
|
-
canUndo:
|
|
748
|
+
canRedo: F.current < P.current.length - 1,
|
|
749
|
+
canUndo: F.current > 0
|
|
711
750
|
});
|
|
712
751
|
}
|
|
713
752
|
function fe(e, t = T) {
|
|
714
|
-
let n = Y(e), r =
|
|
715
|
-
r.push(n),
|
|
753
|
+
let n = Y(e), r = P.current.slice(0, F.current + 1);
|
|
754
|
+
r.push(n), P.current = r, F.current = r.length - 1, w(n), B(n, t), de();
|
|
716
755
|
}
|
|
717
756
|
function pe(e) {
|
|
718
|
-
E(e),
|
|
757
|
+
E(e), B(C, e);
|
|
719
758
|
}
|
|
720
759
|
function me() {
|
|
721
760
|
if (!j.canUndo || u) return;
|
|
722
|
-
--
|
|
723
|
-
let e = Y(
|
|
724
|
-
w(e),
|
|
761
|
+
--F.current;
|
|
762
|
+
let e = Y(P.current[F.current]);
|
|
763
|
+
w(e), B(e), de();
|
|
725
764
|
}
|
|
726
|
-
function
|
|
765
|
+
function V() {
|
|
727
766
|
if (!j.canRedo || u) return;
|
|
728
|
-
|
|
729
|
-
let e = Y(
|
|
730
|
-
w(e),
|
|
767
|
+
F.current += 1;
|
|
768
|
+
let e = Y(P.current[F.current]);
|
|
769
|
+
w(e), B(e), de();
|
|
731
770
|
}
|
|
732
|
-
function
|
|
771
|
+
function he() {
|
|
733
772
|
u || C.length === 0 || fe([]);
|
|
734
773
|
}
|
|
735
|
-
function
|
|
774
|
+
function ge(e) {
|
|
736
775
|
let r = e.target.getStage()?.getPointerPosition();
|
|
737
776
|
return r ? {
|
|
738
|
-
x:
|
|
739
|
-
y:
|
|
777
|
+
x: jt(r.x / k.scale, 0, n),
|
|
778
|
+
y: jt(r.y / k.scale, 0, t)
|
|
740
779
|
} : null;
|
|
741
780
|
}
|
|
742
|
-
function
|
|
743
|
-
if (u || !z &&
|
|
744
|
-
let t =
|
|
781
|
+
function _e(e) {
|
|
782
|
+
if (u || !z && bt(e.target)) return;
|
|
783
|
+
let t = ge(e);
|
|
745
784
|
if (!t || !v) return;
|
|
746
785
|
if (v === "eraser") {
|
|
747
|
-
|
|
786
|
+
be(t);
|
|
748
787
|
return;
|
|
749
788
|
}
|
|
750
|
-
let n =
|
|
789
|
+
let n = yt(t, ae);
|
|
751
790
|
if (v === "pen") {
|
|
752
|
-
|
|
753
|
-
color:
|
|
754
|
-
id:
|
|
791
|
+
I.current = n, O({
|
|
792
|
+
color: R,
|
|
793
|
+
id: ue("freehand"),
|
|
755
794
|
points: [n.x, n.y],
|
|
756
795
|
strokeWidth: 4,
|
|
757
796
|
type: "freehand"
|
|
@@ -759,9 +798,9 @@ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, classNa
|
|
|
759
798
|
return;
|
|
760
799
|
}
|
|
761
800
|
if (v === "line") {
|
|
762
|
-
|
|
763
|
-
color:
|
|
764
|
-
id:
|
|
801
|
+
I.current = n, O({
|
|
802
|
+
color: R,
|
|
803
|
+
id: ue("line"),
|
|
765
804
|
points: [
|
|
766
805
|
n.x,
|
|
767
806
|
n.y,
|
|
@@ -773,23 +812,23 @@ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, classNa
|
|
|
773
812
|
});
|
|
774
813
|
return;
|
|
775
814
|
}
|
|
776
|
-
v === "compass" && (
|
|
815
|
+
v === "compass" && (I.current = n, O({
|
|
777
816
|
center: n,
|
|
778
|
-
color:
|
|
779
|
-
id:
|
|
817
|
+
color: R,
|
|
818
|
+
id: ue("circle"),
|
|
780
819
|
radius: 1,
|
|
781
820
|
strokeWidth: 3,
|
|
782
821
|
type: "circle"
|
|
783
822
|
}));
|
|
784
823
|
}
|
|
785
|
-
function
|
|
786
|
-
let t =
|
|
824
|
+
function ve(e) {
|
|
825
|
+
let t = ge(e);
|
|
787
826
|
if (t) {
|
|
788
827
|
if (v === "eraser" && !u) {
|
|
789
|
-
|
|
828
|
+
be(t);
|
|
790
829
|
return;
|
|
791
830
|
}
|
|
792
|
-
if (!(!D || !
|
|
831
|
+
if (!(!D || !I.current || u)) {
|
|
793
832
|
if (D.type === "freehand") {
|
|
794
833
|
O({
|
|
795
834
|
...D,
|
|
@@ -798,12 +837,12 @@ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, classNa
|
|
|
798
837
|
return;
|
|
799
838
|
}
|
|
800
839
|
if (D.type === "line") {
|
|
801
|
-
let e =
|
|
840
|
+
let e = yt(t, ae);
|
|
802
841
|
O({
|
|
803
842
|
...D,
|
|
804
843
|
points: [
|
|
805
|
-
|
|
806
|
-
|
|
844
|
+
I.current.x,
|
|
845
|
+
I.current.y,
|
|
807
846
|
e.x,
|
|
808
847
|
e.y
|
|
809
848
|
]
|
|
@@ -817,13 +856,13 @@ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, classNa
|
|
|
817
856
|
}
|
|
818
857
|
}
|
|
819
858
|
}
|
|
820
|
-
function
|
|
859
|
+
function ye() {
|
|
821
860
|
if (!D || u) {
|
|
822
|
-
|
|
861
|
+
I.current = null, O(null);
|
|
823
862
|
return;
|
|
824
863
|
}
|
|
825
864
|
let e = D;
|
|
826
|
-
if (
|
|
865
|
+
if (I.current = null, O(null), Ct(e)) {
|
|
827
866
|
if (e.type === "circle") {
|
|
828
867
|
let t = {
|
|
829
868
|
...T,
|
|
@@ -838,28 +877,28 @@ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, classNa
|
|
|
838
877
|
fe(C.concat(e));
|
|
839
878
|
}
|
|
840
879
|
}
|
|
841
|
-
function
|
|
880
|
+
function be(e) {
|
|
842
881
|
if (C.length === 0) return;
|
|
843
|
-
let t =
|
|
882
|
+
let t = wt(C, e);
|
|
844
883
|
t < 0 || fe(C.filter((e, n) => n !== t));
|
|
845
884
|
}
|
|
846
885
|
return /* @__PURE__ */ s("div", {
|
|
847
|
-
className:
|
|
886
|
+
className: oe,
|
|
848
887
|
"data-disabled": u ? "true" : "false",
|
|
849
888
|
dir: "rtl",
|
|
850
889
|
children: [
|
|
851
890
|
/* @__PURE__ */ o("div", {
|
|
852
891
|
className: "geometry-toolbar",
|
|
853
892
|
"aria-label": "أَدَواتُ الوَرَقَةِ المُسَوَّدَةِ",
|
|
854
|
-
children:
|
|
893
|
+
children: it.map((e) => /* @__PURE__ */ s("button", {
|
|
855
894
|
"aria-pressed": se(e.id),
|
|
856
895
|
className: [
|
|
857
896
|
"geometry-tool-button",
|
|
858
897
|
se(e.id) ? "geometry-tool-button--active" : "",
|
|
859
|
-
|
|
898
|
+
at.has(e.id) ? "geometry-tool-button--guide" : ""
|
|
860
899
|
].filter(Boolean).join(" "),
|
|
861
900
|
disabled: u,
|
|
862
|
-
onClick: () =>
|
|
901
|
+
onClick: () => le(e.id),
|
|
863
902
|
type: "button",
|
|
864
903
|
children: [/* @__PURE__ */ o("span", {
|
|
865
904
|
"aria-hidden": "true",
|
|
@@ -867,26 +906,26 @@ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, classNa
|
|
|
867
906
|
}), /* @__PURE__ */ o("span", { children: e.label })]
|
|
868
907
|
}, e.id))
|
|
869
908
|
}),
|
|
870
|
-
m ? /* @__PURE__ */ o(
|
|
909
|
+
m ? /* @__PURE__ */ o(Je, {
|
|
871
910
|
ariaLabel: "أَلْوانُ الأَقْلامِ",
|
|
872
911
|
className: "geometry-color-picker",
|
|
873
912
|
colors: _,
|
|
874
913
|
disabled: u,
|
|
875
914
|
onChange: ee,
|
|
876
|
-
selectedColorId:
|
|
915
|
+
selectedColorId: L
|
|
877
916
|
}) : null,
|
|
878
917
|
/* @__PURE__ */ o("div", {
|
|
879
918
|
className: "geometry-stage-shell",
|
|
880
|
-
ref:
|
|
919
|
+
ref: re,
|
|
881
920
|
children: /* @__PURE__ */ o(ne, {
|
|
882
921
|
height: k.height,
|
|
883
|
-
onMouseDown:
|
|
884
|
-
onMouseLeave:
|
|
885
|
-
onMouseMove:
|
|
886
|
-
onMouseUp:
|
|
887
|
-
onTouchEnd:
|
|
888
|
-
onTouchMove:
|
|
889
|
-
onTouchStart:
|
|
922
|
+
onMouseDown: _e,
|
|
923
|
+
onMouseLeave: ye,
|
|
924
|
+
onMouseMove: ve,
|
|
925
|
+
onMouseUp: ye,
|
|
926
|
+
onTouchEnd: ye,
|
|
927
|
+
onTouchMove: ve,
|
|
928
|
+
onTouchStart: _e,
|
|
890
929
|
width: k.width,
|
|
891
930
|
children: /* @__PURE__ */ s(te, {
|
|
892
931
|
scaleX: k.scale,
|
|
@@ -899,18 +938,18 @@ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, classNa
|
|
|
899
938
|
strokeWidth: 1,
|
|
900
939
|
width: n
|
|
901
940
|
}),
|
|
902
|
-
/* @__PURE__ */ o(
|
|
941
|
+
/* @__PURE__ */ o(ct, {
|
|
903
942
|
canvasHeight: t,
|
|
904
943
|
canvasWidth: n
|
|
905
944
|
}),
|
|
906
|
-
p.map((e, r) => e.hidden ? null : /* @__PURE__ */ o(
|
|
907
|
-
label:
|
|
945
|
+
p.map((e, r) => e.hidden ? null : /* @__PURE__ */ o(lt, {
|
|
946
|
+
label: ut(e, r),
|
|
908
947
|
x: e.x / 100 * n,
|
|
909
948
|
y: e.y / 100 * t
|
|
910
949
|
}, e.id)),
|
|
911
|
-
C.map((e) =>
|
|
912
|
-
D ?
|
|
913
|
-
b.includes("ruler") ? /* @__PURE__ */ o(
|
|
950
|
+
C.map((e) => mt(e)),
|
|
951
|
+
D ? mt(D, !0) : null,
|
|
952
|
+
b.includes("ruler") ? /* @__PURE__ */ o(dt, {
|
|
914
953
|
disabled: u,
|
|
915
954
|
guide: T.ruler,
|
|
916
955
|
locked: z,
|
|
@@ -919,7 +958,7 @@ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, classNa
|
|
|
919
958
|
ruler: e
|
|
920
959
|
})
|
|
921
960
|
}, `${T.ruler.x}:${T.ruler.y}:${T.ruler.length}:${T.ruler.rotation}`) : null,
|
|
922
|
-
b.includes("protractor") ? /* @__PURE__ */ o(
|
|
961
|
+
b.includes("protractor") ? /* @__PURE__ */ o(ft, {
|
|
923
962
|
disabled: u,
|
|
924
963
|
guide: T.protractor,
|
|
925
964
|
locked: z,
|
|
@@ -928,7 +967,7 @@ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, classNa
|
|
|
928
967
|
protractor: e
|
|
929
968
|
})
|
|
930
969
|
}) : null,
|
|
931
|
-
b.includes("compass") ? /* @__PURE__ */ o(
|
|
970
|
+
b.includes("compass") ? /* @__PURE__ */ o(pt, {
|
|
932
971
|
disabled: u,
|
|
933
972
|
guide: T.compass,
|
|
934
973
|
locked: z,
|
|
@@ -953,13 +992,13 @@ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, classNa
|
|
|
953
992
|
}),
|
|
954
993
|
/* @__PURE__ */ o("button", {
|
|
955
994
|
disabled: !j.canRedo || u,
|
|
956
|
-
onClick:
|
|
995
|
+
onClick: V,
|
|
957
996
|
type: "button",
|
|
958
997
|
children: "إِعادَةٌ"
|
|
959
998
|
}),
|
|
960
999
|
/* @__PURE__ */ o("button", {
|
|
961
1000
|
disabled: C.length === 0 || u,
|
|
962
|
-
onClick:
|
|
1001
|
+
onClick: he,
|
|
963
1002
|
type: "button",
|
|
964
1003
|
children: "مَسْحٌ"
|
|
965
1004
|
})
|
|
@@ -968,7 +1007,7 @@ function Qe({ actionLabel: e, canvasHeight: t = Ke, canvasWidth: n = Ge, classNa
|
|
|
968
1007
|
]
|
|
969
1008
|
});
|
|
970
1009
|
}
|
|
971
|
-
function
|
|
1010
|
+
function st(e, n, r, i, a) {
|
|
972
1011
|
t(() => {
|
|
973
1012
|
let t = e.current;
|
|
974
1013
|
if (!t) return;
|
|
@@ -994,7 +1033,7 @@ function $e(e, n, r, i, a) {
|
|
|
994
1033
|
a
|
|
995
1034
|
]);
|
|
996
1035
|
}
|
|
997
|
-
function
|
|
1036
|
+
function ct({ canvasHeight: e, canvasWidth: t }) {
|
|
998
1037
|
let n = Math.floor(t / q), r = Math.floor(e / q);
|
|
999
1038
|
return /* @__PURE__ */ s(a, { children: [Array.from({ length: n + 1 }, (t, n) => /* @__PURE__ */ o(M, {
|
|
1000
1039
|
points: [
|
|
@@ -1016,7 +1055,7 @@ function et({ canvasHeight: e, canvasWidth: t }) {
|
|
|
1016
1055
|
strokeWidth: 1
|
|
1017
1056
|
}, `horizontal-${n}`))] });
|
|
1018
1057
|
}
|
|
1019
|
-
function
|
|
1058
|
+
function lt({ label: e, x: t, y: n }) {
|
|
1020
1059
|
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(A, {
|
|
1021
1060
|
fill: "#e63542",
|
|
1022
1061
|
radius: 4.75,
|
|
@@ -1026,7 +1065,7 @@ function tt({ label: e, x: t, y: n }) {
|
|
|
1026
1065
|
strokeWidth: 1.7,
|
|
1027
1066
|
x: t,
|
|
1028
1067
|
y: n
|
|
1029
|
-
}), /* @__PURE__ */ o(
|
|
1068
|
+
}), /* @__PURE__ */ o(re, {
|
|
1030
1069
|
fill: "#111",
|
|
1031
1070
|
fontSize: 14,
|
|
1032
1071
|
fontStyle: "bold",
|
|
@@ -1035,18 +1074,18 @@ function tt({ label: e, x: t, y: n }) {
|
|
|
1035
1074
|
y: n - 18
|
|
1036
1075
|
})] });
|
|
1037
1076
|
}
|
|
1038
|
-
function
|
|
1077
|
+
function ut(e, t) {
|
|
1039
1078
|
let n = e.label?.trim();
|
|
1040
1079
|
return n && n.length > 0 ? n : String(t + 1);
|
|
1041
1080
|
}
|
|
1042
|
-
function
|
|
1081
|
+
function dt({ disabled: e, guide: t, locked: n, onCommit: c }) {
|
|
1043
1082
|
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
1083
|
function v(e) {
|
|
1045
1084
|
d.current = e, u(e);
|
|
1046
1085
|
}
|
|
1047
1086
|
function y(e) {
|
|
1048
1087
|
e.cancelBubble = !0;
|
|
1049
|
-
let t =
|
|
1088
|
+
let t = St(e);
|
|
1050
1089
|
t && (v({
|
|
1051
1090
|
...d.current,
|
|
1052
1091
|
x: t.x,
|
|
@@ -1064,8 +1103,8 @@ function rt({ disabled: e, guide: t, locked: n, onCommit: c }) {
|
|
|
1064
1103
|
}
|
|
1065
1104
|
function x(e, t) {
|
|
1066
1105
|
e.cancelBubble = !0;
|
|
1067
|
-
let n =
|
|
1068
|
-
n && (v(
|
|
1106
|
+
let n = St(e);
|
|
1107
|
+
n && (v(kt(d.current, n, t)), e.currentTarget.position({
|
|
1069
1108
|
x: 0,
|
|
1070
1109
|
y: 0
|
|
1071
1110
|
}));
|
|
@@ -1073,7 +1112,7 @@ function rt({ disabled: e, guide: t, locked: n, onCommit: c }) {
|
|
|
1073
1112
|
function S() {
|
|
1074
1113
|
let e = {
|
|
1075
1114
|
...d.current,
|
|
1076
|
-
rotation:
|
|
1115
|
+
rotation: Mt(d.current.rotation + 90)
|
|
1077
1116
|
};
|
|
1078
1117
|
v(e), c(e);
|
|
1079
1118
|
}
|
|
@@ -1235,8 +1274,8 @@ function rt({ disabled: e, guide: t, locked: n, onCommit: c }) {
|
|
|
1235
1274
|
]
|
|
1236
1275
|
}) });
|
|
1237
1276
|
}
|
|
1238
|
-
function
|
|
1239
|
-
let i = !e && !n, c =
|
|
1277
|
+
function ft({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
1278
|
+
let i = !e && !n, c = Dt({
|
|
1240
1279
|
x: 136,
|
|
1241
1280
|
y: 0
|
|
1242
1281
|
}, t.rotation, {
|
|
@@ -1300,7 +1339,7 @@ function it({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
|
1300
1339
|
180
|
|
1301
1340
|
].map((e) => {
|
|
1302
1341
|
let t = (180 - e) * Math.PI / 180;
|
|
1303
|
-
return /* @__PURE__ */ o(
|
|
1342
|
+
return /* @__PURE__ */ o(re, {
|
|
1304
1343
|
fill: J,
|
|
1305
1344
|
fontSize: 12,
|
|
1306
1345
|
fontStyle: "bold",
|
|
@@ -1329,7 +1368,7 @@ function it({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
|
1329
1368
|
y: c.y
|
|
1330
1369
|
})] });
|
|
1331
1370
|
}
|
|
1332
|
-
function
|
|
1371
|
+
function pt({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
1333
1372
|
let i = !e && !n, c = {
|
|
1334
1373
|
x: t.center.x + t.radius,
|
|
1335
1374
|
y: t.center.y
|
|
@@ -1414,7 +1453,7 @@ function at({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
|
1414
1453
|
})
|
|
1415
1454
|
] });
|
|
1416
1455
|
}
|
|
1417
|
-
function
|
|
1456
|
+
function mt(e, t = !1) {
|
|
1418
1457
|
let n = t ? .58 : 1;
|
|
1419
1458
|
return e.type === "freehand" ? /* @__PURE__ */ o(M, {
|
|
1420
1459
|
lineCap: "round",
|
|
@@ -1439,7 +1478,7 @@ function ot(e, t = !1) {
|
|
|
1439
1478
|
y: e.center.y
|
|
1440
1479
|
}, e.id);
|
|
1441
1480
|
}
|
|
1442
|
-
function
|
|
1481
|
+
function ht(e, t) {
|
|
1443
1482
|
return {
|
|
1444
1483
|
compass: {
|
|
1445
1484
|
center: {
|
|
@@ -1461,16 +1500,16 @@ function st(e, t) {
|
|
|
1461
1500
|
}
|
|
1462
1501
|
};
|
|
1463
1502
|
}
|
|
1464
|
-
function
|
|
1503
|
+
function gt(e) {
|
|
1465
1504
|
return e?.elements?.length ? Y(e.elements) : (e?.strokes ?? []).filter((e) => e.tool === "pen" && e.points.length >= 4).map((e) => ({
|
|
1466
|
-
color:
|
|
1505
|
+
color: rt,
|
|
1467
1506
|
id: e.id,
|
|
1468
1507
|
points: e.points.slice(),
|
|
1469
1508
|
strokeWidth: 4,
|
|
1470
1509
|
type: "freehand"
|
|
1471
1510
|
}));
|
|
1472
1511
|
}
|
|
1473
|
-
function
|
|
1512
|
+
function _t(e) {
|
|
1474
1513
|
return e.flatMap((e) => e.type === "freehand" ? [{
|
|
1475
1514
|
id: e.id,
|
|
1476
1515
|
points: e.points.slice(),
|
|
@@ -1498,7 +1537,7 @@ function Y(e) {
|
|
|
1498
1537
|
center: { ...e.center }
|
|
1499
1538
|
});
|
|
1500
1539
|
}
|
|
1501
|
-
function
|
|
1540
|
+
function vt(e, t, n) {
|
|
1502
1541
|
let r = e.map((e) => ({
|
|
1503
1542
|
x: e.x / 100 * t,
|
|
1504
1543
|
y: e.y / 100 * n
|
|
@@ -1509,14 +1548,14 @@ function ut(e, t, n) {
|
|
|
1509
1548
|
});
|
|
1510
1549
|
return r.concat(i);
|
|
1511
1550
|
}
|
|
1512
|
-
function
|
|
1513
|
-
let n = e, r =
|
|
1551
|
+
function yt(e, t) {
|
|
1552
|
+
let n = e, r = nt;
|
|
1514
1553
|
return t.forEach((t) => {
|
|
1515
1554
|
let i = X(e, t);
|
|
1516
1555
|
i < r && (n = t, r = i);
|
|
1517
1556
|
}), n;
|
|
1518
1557
|
}
|
|
1519
|
-
function
|
|
1558
|
+
function bt(e) {
|
|
1520
1559
|
let t = e;
|
|
1521
1560
|
for (; t;) {
|
|
1522
1561
|
if (t.name().split(" ").includes("geometry-guide")) return !0;
|
|
@@ -1524,10 +1563,10 @@ function ft(e) {
|
|
|
1524
1563
|
}
|
|
1525
1564
|
return !1;
|
|
1526
1565
|
}
|
|
1527
|
-
function
|
|
1566
|
+
function xt(e) {
|
|
1528
1567
|
return e === "pen" || e === "line" || e === "eraser";
|
|
1529
1568
|
}
|
|
1530
|
-
function
|
|
1569
|
+
function St(e) {
|
|
1531
1570
|
let t = e.target.getStage()?.getPointerPosition();
|
|
1532
1571
|
if (!t) return null;
|
|
1533
1572
|
let n = e.target.getLayer(), r = n?.scaleX() || 1, i = n?.scaleY() || r;
|
|
@@ -1536,16 +1575,16 @@ function mt(e) {
|
|
|
1536
1575
|
y: t.y / i
|
|
1537
1576
|
};
|
|
1538
1577
|
}
|
|
1539
|
-
function
|
|
1540
|
-
return e.type === "freehand" ? e.points.length >= 4 : e.type === "line" ?
|
|
1578
|
+
function Ct(e) {
|
|
1579
|
+
return e.type === "freehand" ? e.points.length >= 4 : e.type === "line" ? At(e.points) > 6 : e.radius > 6;
|
|
1541
1580
|
}
|
|
1542
|
-
function
|
|
1543
|
-
for (let n = e.length - 1; n >= 0; --n) if (
|
|
1581
|
+
function wt(e, t) {
|
|
1582
|
+
for (let n = e.length - 1; n >= 0; --n) if (Tt(e[n], t)) return n;
|
|
1544
1583
|
return -1;
|
|
1545
1584
|
}
|
|
1546
|
-
function
|
|
1585
|
+
function Tt(e, t) {
|
|
1547
1586
|
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 (
|
|
1587
|
+
for (let n = 0; n < e.points.length - 2; n += 2) if (Et(t, {
|
|
1549
1588
|
x1: e.points[n],
|
|
1550
1589
|
x2: e.points[n + 2],
|
|
1551
1590
|
y1: e.points[n + 1],
|
|
@@ -1553,27 +1592,27 @@ function _t(e, t) {
|
|
|
1553
1592
|
}) <= 14) return !0;
|
|
1554
1593
|
return !1;
|
|
1555
1594
|
}
|
|
1556
|
-
function
|
|
1595
|
+
function Et(e, t) {
|
|
1557
1596
|
let n = t.x2 - t.x1, r = t.y2 - t.y1, i = n * n + r * r;
|
|
1558
1597
|
if (i === 0) return X(e, {
|
|
1559
1598
|
x: t.x1,
|
|
1560
1599
|
y: t.y1
|
|
1561
1600
|
});
|
|
1562
|
-
let a =
|
|
1601
|
+
let a = jt(((e.x - t.x1) * n + (e.y - t.y1) * r) / i, 0, 1);
|
|
1563
1602
|
return X(e, {
|
|
1564
1603
|
x: t.x1 + a * n,
|
|
1565
1604
|
y: t.y1 + a * r
|
|
1566
1605
|
});
|
|
1567
1606
|
}
|
|
1568
|
-
function
|
|
1607
|
+
function Dt(e, t, n) {
|
|
1569
1608
|
let r = t * Math.PI / 180, i = Math.cos(r), a = Math.sin(r);
|
|
1570
1609
|
return {
|
|
1571
1610
|
x: n.x + e.x * i - e.y * a,
|
|
1572
1611
|
y: n.y + e.x * a + e.y * i
|
|
1573
1612
|
};
|
|
1574
1613
|
}
|
|
1575
|
-
function
|
|
1576
|
-
return
|
|
1614
|
+
function Ot(e, t) {
|
|
1615
|
+
return Dt({
|
|
1577
1616
|
x: t === "left" ? -e.length / 2 : e.length / 2,
|
|
1578
1617
|
y: 0
|
|
1579
1618
|
}, e.rotation, {
|
|
@@ -1581,8 +1620,8 @@ function bt(e, t) {
|
|
|
1581
1620
|
y: e.y
|
|
1582
1621
|
});
|
|
1583
1622
|
}
|
|
1584
|
-
function
|
|
1585
|
-
let r = n === "right" ? "left" : "right", i =
|
|
1623
|
+
function kt(e, t, n) {
|
|
1624
|
+
let r = n === "right" ? "left" : "right", i = Ot(e, r), a = Math.atan2(t.y - i.y, t.x - i.x) * 180 / Math.PI, o = Mt(n === "right" ? a : a + 180), s = o * Math.PI / 180, c = e.length / 2, l = r === "left" ? 1 : -1;
|
|
1586
1625
|
return {
|
|
1587
1626
|
...e,
|
|
1588
1627
|
rotation: o,
|
|
@@ -1590,7 +1629,7 @@ function xt(e, t, n) {
|
|
|
1590
1629
|
y: i.y + Math.sin(s) * c * l
|
|
1591
1630
|
};
|
|
1592
1631
|
}
|
|
1593
|
-
function
|
|
1632
|
+
function At(e) {
|
|
1594
1633
|
return X({
|
|
1595
1634
|
x: e[0],
|
|
1596
1635
|
y: e[1]
|
|
@@ -1602,16 +1641,16 @@ function St(e) {
|
|
|
1602
1641
|
function X(e, t) {
|
|
1603
1642
|
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
1604
1643
|
}
|
|
1605
|
-
function
|
|
1644
|
+
function jt(e, t, n) {
|
|
1606
1645
|
return Math.min(Math.max(e, t), n);
|
|
1607
1646
|
}
|
|
1608
|
-
function
|
|
1647
|
+
function Mt(e) {
|
|
1609
1648
|
return (e % 360 + 360) % 360;
|
|
1610
1649
|
}
|
|
1611
1650
|
//#endregion
|
|
1612
1651
|
//#region src/exam-session/interactions/KonvaDrawingGrid.tsx
|
|
1613
|
-
function
|
|
1614
|
-
return /* @__PURE__ */ o(
|
|
1652
|
+
function Nt({ points: e, value: t, onChange: n }) {
|
|
1653
|
+
return /* @__PURE__ */ o(ot, {
|
|
1615
1654
|
onChange: n,
|
|
1616
1655
|
points: e,
|
|
1617
1656
|
value: t,
|
|
@@ -1620,7 +1659,7 @@ function Tt({ points: e, value: t, onChange: n }) {
|
|
|
1620
1659
|
}
|
|
1621
1660
|
//#endregion
|
|
1622
1661
|
//#region src/exam-session/interactions/LabelPlacement.tsx
|
|
1623
|
-
function
|
|
1662
|
+
function Pt({ labels: e, targets: t, value: n, onChange: r }) {
|
|
1624
1663
|
let i = n?.placements ?? {}, a = new Set(Object.keys(i));
|
|
1625
1664
|
return /* @__PURE__ */ o(c, {
|
|
1626
1665
|
onDragEnd: (e) => {
|
|
@@ -1643,10 +1682,10 @@ function Et({ labels: e, targets: t, value: n, onChange: r }) {
|
|
|
1643
1682
|
className: "label-placement",
|
|
1644
1683
|
children: [/* @__PURE__ */ o("div", {
|
|
1645
1684
|
className: "label-placement__bank",
|
|
1646
|
-
children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ o(
|
|
1685
|
+
children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ o(Ft, { label: e }, e.id))
|
|
1647
1686
|
}), /* @__PURE__ */ o("div", {
|
|
1648
1687
|
className: "label-placement__diagram",
|
|
1649
|
-
children: t.map((t) => /* @__PURE__ */ o(
|
|
1688
|
+
children: t.map((t) => /* @__PURE__ */ o(It, {
|
|
1650
1689
|
label: e.find((e) => i[e.id]?.targetId === t.id),
|
|
1651
1690
|
target: t
|
|
1652
1691
|
}, t.id))
|
|
@@ -1654,7 +1693,7 @@ function Et({ labels: e, targets: t, value: n, onChange: r }) {
|
|
|
1654
1693
|
})
|
|
1655
1694
|
});
|
|
1656
1695
|
}
|
|
1657
|
-
function
|
|
1696
|
+
function Ft({ label: e }) {
|
|
1658
1697
|
let { ref: t, isDragging: n } = l({ id: e.id });
|
|
1659
1698
|
return /* @__PURE__ */ o("button", {
|
|
1660
1699
|
className: n ? "placement-label placement-label--dragging" : "placement-label",
|
|
@@ -1663,7 +1702,7 @@ function Dt({ label: e }) {
|
|
|
1663
1702
|
children: e.label
|
|
1664
1703
|
});
|
|
1665
1704
|
}
|
|
1666
|
-
function
|
|
1705
|
+
function It({ label: e, target: t }) {
|
|
1667
1706
|
let { ref: n, isDropTarget: r } = u({ id: t.id });
|
|
1668
1707
|
return /* @__PURE__ */ s("div", {
|
|
1669
1708
|
className: r ? "placement-target placement-target--active" : "placement-target",
|
|
@@ -1675,15 +1714,15 @@ function Ot({ label: e, target: t }) {
|
|
|
1675
1714
|
children: [/* @__PURE__ */ o("span", {
|
|
1676
1715
|
"aria-hidden": "true",
|
|
1677
1716
|
children: t.label
|
|
1678
|
-
}), e ? /* @__PURE__ */ o(
|
|
1717
|
+
}), e ? /* @__PURE__ */ o(Ft, { label: e }) : null]
|
|
1679
1718
|
});
|
|
1680
1719
|
}
|
|
1681
1720
|
//#endregion
|
|
1682
1721
|
//#region src/exam-session/interactions/NumberLineAnswer.tsx
|
|
1683
|
-
function
|
|
1722
|
+
function Lt({ answerId: e, expression: t, value: n, onChange: r, onClear: i, recognizer: a }) {
|
|
1684
1723
|
return /* @__PURE__ */ s("div", {
|
|
1685
1724
|
className: "number-line-layout",
|
|
1686
|
-
children: [/* @__PURE__ */ o(
|
|
1725
|
+
children: [/* @__PURE__ */ o(Rt, {}), /* @__PURE__ */ s("div", {
|
|
1687
1726
|
className: "compact-answer",
|
|
1688
1727
|
children: [/* @__PURE__ */ o("span", { children: t }), /* @__PURE__ */ o(G, {
|
|
1689
1728
|
ariaLabel: t,
|
|
@@ -1695,7 +1734,7 @@ function kt({ answerId: e, expression: t, value: n, onChange: r, onClear: i, rec
|
|
|
1695
1734
|
})]
|
|
1696
1735
|
});
|
|
1697
1736
|
}
|
|
1698
|
-
function
|
|
1737
|
+
function Rt() {
|
|
1699
1738
|
return /* @__PURE__ */ s("svg", {
|
|
1700
1739
|
className: "number-line",
|
|
1701
1740
|
viewBox: "0 0 520 86",
|
|
@@ -1722,152 +1761,8 @@ function At() {
|
|
|
1722
1761
|
});
|
|
1723
1762
|
}
|
|
1724
1763
|
//#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
|
|
1869
1764
|
//#region src/voice/evaluateVoiceAiResult.ts
|
|
1870
|
-
var
|
|
1765
|
+
var zt = {
|
|
1871
1766
|
audioConfig: {
|
|
1872
1767
|
bitDepth: 16,
|
|
1873
1768
|
channels: 1,
|
|
@@ -1877,18 +1772,18 @@ var Ft = {
|
|
|
1877
1772
|
lang: "fr",
|
|
1878
1773
|
useModelAi: !0
|
|
1879
1774
|
};
|
|
1880
|
-
function
|
|
1881
|
-
let r =
|
|
1775
|
+
function Bt(e, t, n) {
|
|
1776
|
+
let r = Wt([t, ...n.acceptedPronunciations ?? []]), i = r.map(Vt), a = Vt(e.transcript), o = i.map((e, t) => ({
|
|
1882
1777
|
index: t,
|
|
1883
|
-
similarity:
|
|
1778
|
+
similarity: Ut(a, e)
|
|
1884
1779
|
})).reduce((e, t) => t.similarity > e.similarity ? t : e, {
|
|
1885
1780
|
index: -1,
|
|
1886
1781
|
similarity: 0
|
|
1887
|
-
}), s = o.index >= 0 ? r[o.index] : null, c = o.similarity === 1, l =
|
|
1782
|
+
}), s = o.index >= 0 ? r[o.index] : null, c = o.similarity === 1, l = Gt(n.minimumSimilarity ?? Ht(s), 0, 1), u = e.language === n.expectedLanguage, d = a.length > 0, f = d && u && o.similarity >= l, p = d ? u ? f ? "correct" : "incorrect" : "language-mismatch" : "no-speech";
|
|
1888
1783
|
return {
|
|
1889
1784
|
acceptedPronunciations: r,
|
|
1890
1785
|
confidence: e.confidence,
|
|
1891
|
-
confidencePercent: Math.round(
|
|
1786
|
+
confidencePercent: Math.round(Gt(e.confidence, 0, 1) * 100),
|
|
1892
1787
|
detectedPronunciation: e.transcript,
|
|
1893
1788
|
expectedLanguage: n.expectedLanguage,
|
|
1894
1789
|
expectedText: t,
|
|
@@ -1907,13 +1802,13 @@ function It(e, t, n) {
|
|
|
1907
1802
|
timestamps: e.timestamps ?? []
|
|
1908
1803
|
};
|
|
1909
1804
|
}
|
|
1910
|
-
function
|
|
1805
|
+
function Vt(e) {
|
|
1911
1806
|
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();
|
|
1912
1807
|
}
|
|
1913
|
-
function
|
|
1914
|
-
return (e ?
|
|
1808
|
+
function Ht(e) {
|
|
1809
|
+
return (e ? Vt(e).length : 0) <= 4 ? 1 : .85;
|
|
1915
1810
|
}
|
|
1916
|
-
function
|
|
1811
|
+
function Ut(e, t) {
|
|
1917
1812
|
let n = Array.from(e), r = Array.from(t), i = Math.max(n.length, r.length);
|
|
1918
1813
|
if (i === 0) return 0;
|
|
1919
1814
|
let a = Array.from({ length: r.length + 1 }, (e, t) => t);
|
|
@@ -1925,22 +1820,22 @@ function zt(e, t) {
|
|
|
1925
1820
|
}
|
|
1926
1821
|
a.splice(0, a.length, ...t);
|
|
1927
1822
|
}
|
|
1928
|
-
return
|
|
1823
|
+
return Gt(1 - a[r.length] / i, 0, 1);
|
|
1929
1824
|
}
|
|
1930
|
-
function
|
|
1825
|
+
function Wt(e) {
|
|
1931
1826
|
let t = /* @__PURE__ */ new Set();
|
|
1932
1827
|
return e.filter((e) => {
|
|
1933
|
-
let n =
|
|
1828
|
+
let n = Vt(e);
|
|
1934
1829
|
return !n || t.has(n) ? !1 : (t.add(n), !0);
|
|
1935
1830
|
});
|
|
1936
1831
|
}
|
|
1937
|
-
function
|
|
1832
|
+
function Gt(e, t, n) {
|
|
1938
1833
|
return Math.min(n, Math.max(t, e));
|
|
1939
1834
|
}
|
|
1940
1835
|
//#endregion
|
|
1941
1836
|
//#region src/exam-session/interactions/PronunciationRecorder.tsx
|
|
1942
|
-
function
|
|
1943
|
-
let [_, v] = i("idle"), [b, x] = i(null), [S, w] = i(0), T = r(null), E = r(!1), D = n(() => g ?
|
|
1837
|
+
function Kt({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc: l, instruction: u, language: d, minimumSimilarity: f, onChange: p, onReset: m, recorder: h, value: g }) {
|
|
1838
|
+
let [_, v] = i("idle"), [b, x] = i(null), [S, w] = i(0), T = r(null), E = r(!1), D = n(() => g ? Bt(g.result.modelAiResult, a, {
|
|
1944
1839
|
acceptedPronunciations: e,
|
|
1945
1840
|
expectedLanguage: d,
|
|
1946
1841
|
minimumSimilarity: f
|
|
@@ -1967,14 +1862,14 @@ function Ht({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc:
|
|
|
1967
1862
|
try {
|
|
1968
1863
|
if (!h) throw Error("Ù…ÙØ³Ø¬Ù‘ÙÙ„ الصَّوت غَير Ù…ÙØªØ§ØÙ ÙÙÙŠ هذا التَّطبÙيق.");
|
|
1969
1864
|
let e = {
|
|
1970
|
-
...
|
|
1865
|
+
...zt,
|
|
1971
1866
|
lang: d,
|
|
1972
1867
|
maxDuration: 10
|
|
1973
1868
|
};
|
|
1974
1869
|
if (!(await h.startRecording(e)).started) throw Error("تعذّر بدء التسجيل الصوتي.");
|
|
1975
1870
|
E.current = !0, T.current = Date.now(), w(0), v("recording");
|
|
1976
1871
|
} catch (e) {
|
|
1977
|
-
E.current = !1, T.current = null, x(
|
|
1872
|
+
E.current = !1, T.current = null, x(Xt(e)), v("error");
|
|
1978
1873
|
}
|
|
1979
1874
|
}
|
|
1980
1875
|
}
|
|
@@ -1983,7 +1878,7 @@ function Ht({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc:
|
|
|
1983
1878
|
v("processing"), x(null);
|
|
1984
1879
|
try {
|
|
1985
1880
|
if (!h) throw Error("Ù…ÙØ³Ø¬Ù‘ÙÙ„ الصَّوت غَير Ù…ÙØªØ§ØÙ ÙÙÙŠ هذا التَّطبÙيق.");
|
|
1986
|
-
let t = await h.stopRecording(), n =
|
|
1881
|
+
let t = await h.stopRecording(), n = Bt(t.modelAiResult, a, {
|
|
1987
1882
|
acceptedPronunciations: e,
|
|
1988
1883
|
expectedLanguage: d,
|
|
1989
1884
|
minimumSimilarity: f
|
|
@@ -1994,7 +1889,7 @@ function Ht({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc:
|
|
|
1994
1889
|
result: t
|
|
1995
1890
|
}), v("idle");
|
|
1996
1891
|
} catch (e) {
|
|
1997
|
-
E.current = !1, T.current = null, x(
|
|
1892
|
+
E.current = !1, T.current = null, x(Xt(e)), v("error");
|
|
1998
1893
|
}
|
|
1999
1894
|
}
|
|
2000
1895
|
}
|
|
@@ -2019,7 +1914,7 @@ function Ht({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc:
|
|
|
2019
1914
|
children: [
|
|
2020
1915
|
/* @__PURE__ */ s("span", { children: [
|
|
2021
1916
|
"اُنْطِقِ الكَلِمَةَ بِـ",
|
|
2022
|
-
|
|
1917
|
+
Yt(d),
|
|
2023
1918
|
":"
|
|
2024
1919
|
] }),
|
|
2025
1920
|
/* @__PURE__ */ o("strong", {
|
|
@@ -2037,7 +1932,7 @@ function Ht({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc:
|
|
|
2037
1932
|
className: "audio-debug-card__icon",
|
|
2038
1933
|
"aria-hidden": "true",
|
|
2039
1934
|
children: /* @__PURE__ */ o(y, {})
|
|
2040
|
-
}), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("strong", { children:
|
|
1935
|
+
}), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("strong", { children: Zt(_, !!g) }), /* @__PURE__ */ o("span", { children: Jt(te) })] })]
|
|
2041
1936
|
}),
|
|
2042
1937
|
/* @__PURE__ */ s("div", {
|
|
2043
1938
|
className: "audio-debug-actions",
|
|
@@ -2077,31 +1972,31 @@ function Ht({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc:
|
|
|
2077
1972
|
role: "status",
|
|
2078
1973
|
children: [/* @__PURE__ */ s("div", {
|
|
2079
1974
|
className: "audio-pronunciation-feedback__headline",
|
|
2080
|
-
children: [/* @__PURE__ */ o(
|
|
1975
|
+
children: [/* @__PURE__ */ o(qt, { status: D.status }), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("strong", { children: Qt(D.status) }), /* @__PURE__ */ o("span", { children: $t(D.status, a) })] })]
|
|
2081
1976
|
}), /* @__PURE__ */ s("div", {
|
|
2082
1977
|
className: "audio-debug-metadata",
|
|
2083
1978
|
children: [
|
|
2084
|
-
/* @__PURE__ */ o(
|
|
1979
|
+
/* @__PURE__ */ o(Z, {
|
|
2085
1980
|
label: "ما تَعَرَّفَ عَلَيْهِ النَّمُوذَجُ",
|
|
2086
1981
|
value: D.detectedPronunciation || "—"
|
|
2087
1982
|
}),
|
|
2088
|
-
/* @__PURE__ */ o(
|
|
1983
|
+
/* @__PURE__ */ o(Z, {
|
|
2089
1984
|
label: "نِسْبَةُ التَّطابُقِ",
|
|
2090
1985
|
value: `${D.similarityPercent}%`
|
|
2091
1986
|
}),
|
|
2092
|
-
/* @__PURE__ */ o(
|
|
1987
|
+
/* @__PURE__ */ o(Z, {
|
|
2093
1988
|
label: "ثِقَةُ النَّمُوذَجِ",
|
|
2094
1989
|
value: `${D.confidencePercent}%`
|
|
2095
1990
|
}),
|
|
2096
|
-
/* @__PURE__ */ o(
|
|
1991
|
+
/* @__PURE__ */ o(Z, {
|
|
2097
1992
|
label: "اللُّغَةُ",
|
|
2098
1993
|
value: D.language.toUpperCase()
|
|
2099
1994
|
}),
|
|
2100
|
-
/* @__PURE__ */ o(
|
|
1995
|
+
/* @__PURE__ */ o(Z, {
|
|
2101
1996
|
label: "زَمَنُ التَّحْلِيلِ",
|
|
2102
1997
|
value: `${D.latencyMs} ms`
|
|
2103
1998
|
}),
|
|
2104
|
-
/* @__PURE__ */ o(
|
|
1999
|
+
/* @__PURE__ */ o(Z, {
|
|
2105
2000
|
label: "عَدَدُ الرُّمُوزِ الصَّوْتِيَّةِ",
|
|
2106
2001
|
value: D.timestamps.length.toString()
|
|
2107
2002
|
})
|
|
@@ -2111,10 +2006,10 @@ function Ht({ acceptedPronunciations: e, expectedText: a, imageAlt: c, imageSrc:
|
|
|
2111
2006
|
]
|
|
2112
2007
|
});
|
|
2113
2008
|
}
|
|
2114
|
-
function
|
|
2009
|
+
function qt({ status: e }) {
|
|
2115
2010
|
return o(e === "correct" ? f : e === "no-speech" ? D : O, { "aria-hidden": "true" });
|
|
2116
2011
|
}
|
|
2117
|
-
function
|
|
2012
|
+
function Z({ label: e, value: t }) {
|
|
2118
2013
|
return /* @__PURE__ */ s("span", {
|
|
2119
2014
|
className: "audio-debug-meta-card",
|
|
2120
2015
|
children: [/* @__PURE__ */ o("small", { children: e }), /* @__PURE__ */ o("strong", {
|
|
@@ -2123,42 +2018,42 @@ function Wt({ label: e, value: t }) {
|
|
|
2123
2018
|
})]
|
|
2124
2019
|
});
|
|
2125
2020
|
}
|
|
2126
|
-
function
|
|
2021
|
+
function Jt(e) {
|
|
2127
2022
|
let t = Math.max(0, Math.round(e / 1e3)), n = Math.floor(t / 60), r = t % 60;
|
|
2128
2023
|
return `${n.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}`;
|
|
2129
2024
|
}
|
|
2130
|
-
function
|
|
2025
|
+
function Yt(e) {
|
|
2131
2026
|
return e === "fr" ? "الفَرَنْسِيَّةِ" : "العَرَبِيَّةِ";
|
|
2132
2027
|
}
|
|
2133
|
-
function
|
|
2028
|
+
function Xt(e) {
|
|
2134
2029
|
let t = e;
|
|
2135
2030
|
return t.code === "MISSING_PERMISSION" ? "يَجِبُ السَّماحُ بِاسْتِعْمالِ المِيكْرُوفُونِ لِتَسْجِيلِ الإِجابَةِ." : t.code === "MODEL_VOCAB_MISMATCH" ? "مَلَفُّ نَمُوذَجِ اللُّغَةِ لا يُطابِقُ قامُوسَهُ. يُرْجى تَصْحِيحُ مَلَفِّ النَّمُوذَجِ." : t.message ? t.message : typeof e == "string" ? e : "حَدَثَ خَطَأٌ أَثْناءَ تَسْجِيلِ الإِجابَةِ الصَّوْتِيَّةِ.";
|
|
2136
2031
|
}
|
|
2137
|
-
function
|
|
2032
|
+
function Zt(e, t) {
|
|
2138
2033
|
return e === "checking" ? "جارِي تَجْهِيزُ المِيكْرُوفُونِ" : e === "recording" ? "جارِي التَّسْجِيلُ... تَكَلَّمِ الآنَ" : e === "processing" ? "جارِي تَحْلِيلُ النُّطْقِ" : e === "error" ? "تَعَذَّرَ تَحْلِيلُ التَّسْجِيلِ" : t ? "اِكْتَمَلَ تَحْلِيلُ الإِجابَةِ" : "المِيكْرُوفُونُ جاهِزٌ";
|
|
2139
2034
|
}
|
|
2140
|
-
function
|
|
2035
|
+
function Qt(e) {
|
|
2141
2036
|
return e === "correct" ? "أَحْسَنْتَ! إِجابَةٌ صَحِيحَةٌ" : e === "no-speech" ? "لَمْ نَسْمَعْ كَلِمَةً واضِحَةً" : e === "language-mismatch" ? "اُسْتُعْمِلَ نَمُوذَجُ لُغَةٍ مُخْتَلِفَةٍ" : "حاوِلْ مَرَّةً أُخْرى";
|
|
2142
2037
|
}
|
|
2143
|
-
function
|
|
2038
|
+
function $t(e, t) {
|
|
2144
2039
|
return e === "correct" ? `نَطَقْتَ «${t}» بِشَكْلٍ صَحِيحٍ.` : e === "no-speech" ? `قَرِّبْ فَمَكَ مِنَ المِيكْرُوفُونِ وَقُلْ «${t}».` : `اِسْتَمِعْ إِلى نُطْقِ «${t}» ثُمَّ أَعِدِ المُحاوَلَةَ.`;
|
|
2145
2040
|
}
|
|
2146
2041
|
//#endregion
|
|
2147
2042
|
//#region src/exam-session/interactions/SortableAnswer.tsx
|
|
2148
|
-
function
|
|
2043
|
+
function en({ answerId: e, items: t, value: n, onChange: r }) {
|
|
2149
2044
|
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
2045
|
return /* @__PURE__ */ o(c, {
|
|
2151
2046
|
onDragEnd: (e) => {
|
|
2152
2047
|
e.canceled || r({
|
|
2153
2048
|
kind: "order",
|
|
2154
|
-
itemIds:
|
|
2049
|
+
itemIds: P(a, e).map((e) => e.toString())
|
|
2155
2050
|
});
|
|
2156
2051
|
},
|
|
2157
2052
|
children: /* @__PURE__ */ o("div", {
|
|
2158
2053
|
className: "sortable-answer",
|
|
2159
2054
|
children: a.map((t, n) => {
|
|
2160
2055
|
let r = i.get(t);
|
|
2161
|
-
return r ? /* @__PURE__ */ o(
|
|
2056
|
+
return r ? /* @__PURE__ */ o(tn, {
|
|
2162
2057
|
group: e,
|
|
2163
2058
|
index: n,
|
|
2164
2059
|
item: r
|
|
@@ -2167,8 +2062,8 @@ function Zt({ answerId: e, items: t, value: n, onChange: r }) {
|
|
|
2167
2062
|
})
|
|
2168
2063
|
});
|
|
2169
2064
|
}
|
|
2170
|
-
function
|
|
2171
|
-
let { ref: r, isDragging: i, isDropTarget: a } =
|
|
2065
|
+
function tn({ group: e, index: t, item: n }) {
|
|
2066
|
+
let { ref: r, isDragging: i, isDropTarget: a } = F({
|
|
2172
2067
|
id: n.id,
|
|
2173
2068
|
index: t,
|
|
2174
2069
|
group: e,
|
|
@@ -2187,7 +2082,7 @@ function Qt({ group: e, index: t, item: n }) {
|
|
|
2187
2082
|
}
|
|
2188
2083
|
//#endregion
|
|
2189
2084
|
//#region src/exam-session/interactions/TextAnswer.tsx
|
|
2190
|
-
function
|
|
2085
|
+
function nn({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onChange: i }) {
|
|
2191
2086
|
return /* @__PURE__ */ o("input", {
|
|
2192
2087
|
"aria-label": e,
|
|
2193
2088
|
className: t,
|
|
@@ -2201,7 +2096,7 @@ function $t({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onCha
|
|
|
2201
2096
|
}
|
|
2202
2097
|
//#endregion
|
|
2203
2098
|
//#region src/renderer/visualScene.tsx
|
|
2204
|
-
var
|
|
2099
|
+
var rn = {
|
|
2205
2100
|
apple: d,
|
|
2206
2101
|
circle: p,
|
|
2207
2102
|
flower: g,
|
|
@@ -2211,7 +2106,7 @@ var en = {
|
|
|
2211
2106
|
star: w,
|
|
2212
2107
|
sun: T,
|
|
2213
2108
|
triangle: E
|
|
2214
|
-
},
|
|
2109
|
+
}, an = {
|
|
2215
2110
|
blue: "#4d89d9",
|
|
2216
2111
|
gray: "#8c97a0",
|
|
2217
2112
|
green: "#1f9d63",
|
|
@@ -2219,7 +2114,7 @@ var en = {
|
|
|
2219
2114
|
purple: "#8a63d2",
|
|
2220
2115
|
red: "#eb5b5b",
|
|
2221
2116
|
yellow: "#f2c641"
|
|
2222
|
-
},
|
|
2117
|
+
}, on = {
|
|
2223
2118
|
"counter-rows": { rows: [{
|
|
2224
2119
|
color: "yellow",
|
|
2225
2120
|
count: 5,
|
|
@@ -2246,7 +2141,7 @@ var en = {
|
|
|
2246
2141
|
id: "star-row",
|
|
2247
2142
|
state: "plain"
|
|
2248
2143
|
}] }
|
|
2249
|
-
},
|
|
2144
|
+
}, sn = [
|
|
2250
2145
|
{
|
|
2251
2146
|
label: "Cercle",
|
|
2252
2147
|
value: "circle"
|
|
@@ -2283,7 +2178,7 @@ var en = {
|
|
|
2283
2178
|
label: "Hexagone",
|
|
2284
2179
|
value: "hexagon"
|
|
2285
2180
|
}
|
|
2286
|
-
],
|
|
2181
|
+
], cn = [
|
|
2287
2182
|
{
|
|
2288
2183
|
label: "Jaune",
|
|
2289
2184
|
value: "yellow"
|
|
@@ -2312,20 +2207,20 @@ var en = {
|
|
|
2312
2207
|
label: "Gris",
|
|
2313
2208
|
value: "gray"
|
|
2314
2209
|
}
|
|
2315
|
-
],
|
|
2210
|
+
], ln = [{
|
|
2316
2211
|
label: "Normal",
|
|
2317
2212
|
value: "plain"
|
|
2318
2213
|
}, {
|
|
2319
2214
|
label: "Barre",
|
|
2320
2215
|
value: "crossed"
|
|
2321
2216
|
}];
|
|
2322
|
-
function
|
|
2323
|
-
return { rows:
|
|
2217
|
+
function un(e) {
|
|
2218
|
+
return { rows: on[e].rows.map((e) => ({ ...e })) };
|
|
2324
2219
|
}
|
|
2325
|
-
function
|
|
2326
|
-
return
|
|
2220
|
+
function dn(e) {
|
|
2221
|
+
return an[e];
|
|
2327
2222
|
}
|
|
2328
|
-
function
|
|
2223
|
+
function fn({ scene: e }) {
|
|
2329
2224
|
return /* @__PURE__ */ o("div", {
|
|
2330
2225
|
className: "visual-panel visual-panel--custom",
|
|
2331
2226
|
"aria-hidden": "true",
|
|
@@ -2333,7 +2228,7 @@ function ln({ scene: e }) {
|
|
|
2333
2228
|
className: "visual-scene",
|
|
2334
2229
|
children: e.rows.map((e) => /* @__PURE__ */ o("div", {
|
|
2335
2230
|
className: "visual-scene-row",
|
|
2336
|
-
children: Array.from({ length: Math.max(1, Math.floor(e.count) || 1) }, (t, n) => /* @__PURE__ */ o(
|
|
2231
|
+
children: Array.from({ length: Math.max(1, Math.floor(e.count) || 1) }, (t, n) => /* @__PURE__ */ o(pn, {
|
|
2337
2232
|
color: e.color,
|
|
2338
2233
|
icon: e.icon,
|
|
2339
2234
|
state: e.state
|
|
@@ -2342,26 +2237,26 @@ function ln({ scene: e }) {
|
|
|
2342
2237
|
})
|
|
2343
2238
|
});
|
|
2344
2239
|
}
|
|
2345
|
-
function
|
|
2346
|
-
let r =
|
|
2240
|
+
function pn({ color: e, icon: t, state: n }) {
|
|
2241
|
+
let r = rn[t];
|
|
2347
2242
|
return /* @__PURE__ */ o("span", {
|
|
2348
2243
|
className: n === "crossed" ? "visual-scene-icon visual-scene-icon--crossed" : "visual-scene-icon",
|
|
2349
|
-
style: { color:
|
|
2244
|
+
style: { color: dn(e) },
|
|
2350
2245
|
children: /* @__PURE__ */ o(r, { "aria-hidden": "true" })
|
|
2351
2246
|
});
|
|
2352
2247
|
}
|
|
2353
2248
|
//#endregion
|
|
2354
2249
|
//#region src/renderer/QuestionRenderer.tsx
|
|
2355
|
-
function
|
|
2250
|
+
function mn({ adapters: e, clearAnswer: t, question: n, getAnswer: r, updateAnswer: i }) {
|
|
2356
2251
|
return /* @__PURE__ */ s("article", {
|
|
2357
2252
|
className: `question-block question-block--${n.type}`,
|
|
2358
|
-
children: [/* @__PURE__ */ o(
|
|
2253
|
+
children: [/* @__PURE__ */ o(gn, {
|
|
2359
2254
|
number: n.number,
|
|
2360
2255
|
prompt: n.prompt
|
|
2361
|
-
}),
|
|
2256
|
+
}), _n(n, r, i, t, e)]
|
|
2362
2257
|
});
|
|
2363
2258
|
}
|
|
2364
|
-
function
|
|
2259
|
+
function hn({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswer: i }) {
|
|
2365
2260
|
return /* @__PURE__ */ s("section", {
|
|
2366
2261
|
className: `question-section question-section--${n.tone}`,
|
|
2367
2262
|
children: [/* @__PURE__ */ s("header", {
|
|
@@ -2369,7 +2264,7 @@ function fn({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswe
|
|
|
2369
2264
|
children: [
|
|
2370
2265
|
/* @__PURE__ */ s("span", {
|
|
2371
2266
|
className: "section-points",
|
|
2372
|
-
children: [/* @__PURE__ */ o("small", { children: "ن" }), n
|
|
2267
|
+
children: [/* @__PURE__ */ o("small", { children: "ن" }), R(n)]
|
|
2373
2268
|
}),
|
|
2374
2269
|
/* @__PURE__ */ o("h3", { children: n.title }),
|
|
2375
2270
|
/* @__PURE__ */ o("span", {
|
|
@@ -2379,7 +2274,7 @@ function fn({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswe
|
|
|
2379
2274
|
]
|
|
2380
2275
|
}), /* @__PURE__ */ o("div", {
|
|
2381
2276
|
className: "section-body",
|
|
2382
|
-
children: n.questions.map((n) => /* @__PURE__ */ o(
|
|
2277
|
+
children: n.questions.map((n) => /* @__PURE__ */ o(mn, {
|
|
2383
2278
|
adapters: e,
|
|
2384
2279
|
clearAnswer: t,
|
|
2385
2280
|
getAnswer: r,
|
|
@@ -2389,17 +2284,17 @@ function fn({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswe
|
|
|
2389
2284
|
})]
|
|
2390
2285
|
});
|
|
2391
2286
|
}
|
|
2392
|
-
function
|
|
2287
|
+
function gn({ number: e, prompt: t }) {
|
|
2393
2288
|
return /* @__PURE__ */ s("div", {
|
|
2394
2289
|
className: "question-prompt",
|
|
2395
2290
|
children: [e > 0 ? /* @__PURE__ */ o("span", { children: e }) : null, /* @__PURE__ */ o("strong", { children: t })]
|
|
2396
2291
|
});
|
|
2397
2292
|
}
|
|
2398
|
-
function
|
|
2293
|
+
function _n(e, t, n, r, i) {
|
|
2399
2294
|
switch (e.type) {
|
|
2400
2295
|
case "inline-inputs": return /* @__PURE__ */ o("div", {
|
|
2401
2296
|
className: "inline-equation-grid",
|
|
2402
|
-
children: e.items.map((a) =>
|
|
2297
|
+
children: e.items.map((a) => vn({
|
|
2403
2298
|
adapters: i,
|
|
2404
2299
|
className: "equation-card",
|
|
2405
2300
|
clearAnswer: r,
|
|
@@ -2409,11 +2304,11 @@ function mn(e, t, n, r, i) {
|
|
|
2409
2304
|
updateAnswer: n
|
|
2410
2305
|
}))
|
|
2411
2306
|
});
|
|
2412
|
-
case "visual-choice": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(
|
|
2307
|
+
case "visual-choice": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(An, {
|
|
2413
2308
|
choices: e.choices,
|
|
2414
2309
|
onChange: (t) => n(e.id, t),
|
|
2415
2310
|
scene: e.scene,
|
|
2416
|
-
value:
|
|
2311
|
+
value: xn(t(e.id)),
|
|
2417
2312
|
visual: e.visual
|
|
2418
2313
|
}), e.inputLabel ? /* @__PURE__ */ s("div", {
|
|
2419
2314
|
className: "compact-answer",
|
|
@@ -2425,7 +2320,7 @@ function mn(e, t, n, r, i) {
|
|
|
2425
2320
|
value: Q(t(`${e.id}:input`))
|
|
2426
2321
|
})]
|
|
2427
2322
|
}) : null] });
|
|
2428
|
-
case "number-line": return /* @__PURE__ */ o(
|
|
2323
|
+
case "number-line": return /* @__PURE__ */ o(Lt, {
|
|
2429
2324
|
answerId: e.id,
|
|
2430
2325
|
expression: e.expression,
|
|
2431
2326
|
onClear: r,
|
|
@@ -2433,37 +2328,9 @@ function mn(e, t, n, r, i) {
|
|
|
2433
2328
|
recognizer: i?.handwritingRecognizer,
|
|
2434
2329
|
value: Q(t(e.id))
|
|
2435
2330
|
});
|
|
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
|
-
]
|
|
2463
|
-
});
|
|
2464
2331
|
case "equation-inputs": return /* @__PURE__ */ o("div", {
|
|
2465
2332
|
className: "stacked-equations",
|
|
2466
|
-
children: e.items.map((a) =>
|
|
2333
|
+
children: e.items.map((a) => vn({
|
|
2467
2334
|
adapters: i,
|
|
2468
2335
|
ariaPrefix: e.prompt,
|
|
2469
2336
|
className: "wide-equation-card",
|
|
@@ -2474,7 +2341,7 @@ function mn(e, t, n, r, i) {
|
|
|
2474
2341
|
updateAnswer: n
|
|
2475
2342
|
}))
|
|
2476
2343
|
});
|
|
2477
|
-
case "length-estimation": return /* @__PURE__ */ o(
|
|
2344
|
+
case "length-estimation": return /* @__PURE__ */ o(jn, {
|
|
2478
2345
|
answerId: e.id,
|
|
2479
2346
|
choices: e.choices,
|
|
2480
2347
|
getAnswer: t,
|
|
@@ -2483,7 +2350,7 @@ function mn(e, t, n, r, i) {
|
|
|
2483
2350
|
});
|
|
2484
2351
|
case "shape-choice": return /* @__PURE__ */ s("div", {
|
|
2485
2352
|
className: "shape-choice-layout",
|
|
2486
|
-
children: [/* @__PURE__ */ o(
|
|
2353
|
+
children: [/* @__PURE__ */ o(Ve, {
|
|
2487
2354
|
items: e.choices.map((e) => ({
|
|
2488
2355
|
id: `${e.id}-label`,
|
|
2489
2356
|
label: e.label
|
|
@@ -2491,24 +2358,24 @@ function mn(e, t, n, r, i) {
|
|
|
2491
2358
|
onChange: (t) => n(e.id, t),
|
|
2492
2359
|
targets: e.choices.map((e) => ({
|
|
2493
2360
|
id: `${e.id}-target`,
|
|
2494
|
-
label:
|
|
2361
|
+
label: On(e.id)
|
|
2495
2362
|
})),
|
|
2496
|
-
value:
|
|
2363
|
+
value: xn(t(e.id))
|
|
2497
2364
|
}), /* @__PURE__ */ o("div", {
|
|
2498
2365
|
className: "shape-row",
|
|
2499
2366
|
"aria-hidden": "true",
|
|
2500
2367
|
children: e.choices.map((e) => /* @__PURE__ */ o("span", { className: `shape-drawing shape-drawing--${e.id}` }, e.id))
|
|
2501
2368
|
})]
|
|
2502
2369
|
});
|
|
2503
|
-
case "drawing-grid": return /* @__PURE__ */ o(
|
|
2370
|
+
case "drawing-grid": return /* @__PURE__ */ o(Nt, {
|
|
2504
2371
|
onChange: (t) => n(e.id, t),
|
|
2505
2372
|
points: e.points,
|
|
2506
|
-
value:
|
|
2373
|
+
value: wn(t(e.id))
|
|
2507
2374
|
});
|
|
2508
|
-
case "table-response": return /* @__PURE__ */ o(
|
|
2375
|
+
case "table-response": return /* @__PURE__ */ o(Fe, {
|
|
2509
2376
|
columns: e.columns,
|
|
2510
2377
|
onChange: (t) => n(e.id, t),
|
|
2511
|
-
value:
|
|
2378
|
+
value: Tn(t(e.id))
|
|
2512
2379
|
});
|
|
2513
2380
|
case "text-input": return e.before && !e.after && e.number === 0 ? /* @__PURE__ */ o("p", {
|
|
2514
2381
|
className: "problem-statement",
|
|
@@ -2534,7 +2401,7 @@ function mn(e, t, n, r, i) {
|
|
|
2534
2401
|
children: e.situation
|
|
2535
2402
|
}), /* @__PURE__ */ o("div", {
|
|
2536
2403
|
className: "word-problem__parts",
|
|
2537
|
-
children: e.parts.map((a, s) => /* @__PURE__ */ o(
|
|
2404
|
+
children: e.parts.map((a, s) => /* @__PURE__ */ o(Dn, {
|
|
2538
2405
|
adapters: i,
|
|
2539
2406
|
clearAnswer: r,
|
|
2540
2407
|
getAnswer: t,
|
|
@@ -2545,25 +2412,25 @@ function mn(e, t, n, r, i) {
|
|
|
2545
2412
|
}, a.id))
|
|
2546
2413
|
})]
|
|
2547
2414
|
});
|
|
2548
|
-
case "drag-match": return /* @__PURE__ */ o(
|
|
2415
|
+
case "drag-match": return /* @__PURE__ */ o(Ve, {
|
|
2549
2416
|
items: e.items,
|
|
2550
2417
|
onChange: (t) => n(e.id, t),
|
|
2551
2418
|
targets: e.targets,
|
|
2552
|
-
value:
|
|
2419
|
+
value: xn(t(e.id))
|
|
2553
2420
|
});
|
|
2554
|
-
case "sortable-answer": return /* @__PURE__ */ o(
|
|
2421
|
+
case "sortable-answer": return /* @__PURE__ */ o(en, {
|
|
2555
2422
|
answerId: e.id,
|
|
2556
2423
|
items: e.items,
|
|
2557
2424
|
onChange: (t) => n(e.id, t),
|
|
2558
|
-
value:
|
|
2425
|
+
value: Sn(t(e.id))
|
|
2559
2426
|
});
|
|
2560
|
-
case "label-placement": return /* @__PURE__ */ o(
|
|
2427
|
+
case "label-placement": return /* @__PURE__ */ o(Pt, {
|
|
2561
2428
|
labels: e.labels,
|
|
2562
2429
|
onChange: (t) => n(e.id, t),
|
|
2563
2430
|
targets: e.targets,
|
|
2564
|
-
value:
|
|
2431
|
+
value: Cn(t(e.id))
|
|
2565
2432
|
});
|
|
2566
|
-
case "audio-recording": return /* @__PURE__ */ o(
|
|
2433
|
+
case "audio-recording": return /* @__PURE__ */ o(Kt, {
|
|
2567
2434
|
acceptedPronunciations: e.acceptedPronunciations,
|
|
2568
2435
|
expectedText: e.expectedAnswer,
|
|
2569
2436
|
imageAlt: e.imageAlt,
|
|
@@ -2574,11 +2441,11 @@ function mn(e, t, n, r, i) {
|
|
|
2574
2441
|
onChange: (t) => n(e.id, t),
|
|
2575
2442
|
onReset: () => r(e.id),
|
|
2576
2443
|
recorder: i?.audioRecorder,
|
|
2577
|
-
value:
|
|
2444
|
+
value: En(t(e.id))
|
|
2578
2445
|
});
|
|
2579
2446
|
}
|
|
2580
2447
|
}
|
|
2581
|
-
function
|
|
2448
|
+
function vn({ adapters: t, ariaPrefix: n, className: r, clearAnswer: i, getAnswer: a, item: c, questionId: l, updateAnswer: u }) {
|
|
2582
2449
|
if (c.answers?.length) return /* @__PURE__ */ s("div", {
|
|
2583
2450
|
className: r,
|
|
2584
2451
|
children: [c.answers.map((r) => {
|
|
@@ -2612,47 +2479,44 @@ function hn({ adapters: t, ariaPrefix: n, className: r, clearAnswer: i, getAnswe
|
|
|
2612
2479
|
]
|
|
2613
2480
|
}, c.id);
|
|
2614
2481
|
}
|
|
2615
|
-
function
|
|
2482
|
+
function yn(e) {
|
|
2616
2483
|
return e?.kind === "text" ? e : void 0;
|
|
2617
2484
|
}
|
|
2618
2485
|
function Q(e) {
|
|
2619
2486
|
return e?.kind === "handwritten-number" ? e : void 0;
|
|
2620
2487
|
}
|
|
2621
|
-
function
|
|
2488
|
+
function bn(e) {
|
|
2622
2489
|
return e?.kind === "choice" ? e : void 0;
|
|
2623
2490
|
}
|
|
2624
|
-
function
|
|
2491
|
+
function xn(e) {
|
|
2625
2492
|
return e?.kind === "matches" ? e : void 0;
|
|
2626
2493
|
}
|
|
2627
|
-
function
|
|
2494
|
+
function Sn(e) {
|
|
2628
2495
|
return e?.kind === "order" ? e : void 0;
|
|
2629
2496
|
}
|
|
2630
|
-
function
|
|
2497
|
+
function Cn(e) {
|
|
2631
2498
|
return e?.kind === "placements" ? e : void 0;
|
|
2632
2499
|
}
|
|
2633
|
-
function
|
|
2500
|
+
function wn(e) {
|
|
2634
2501
|
return e?.kind === "drawing" ? e : void 0;
|
|
2635
2502
|
}
|
|
2636
|
-
function
|
|
2503
|
+
function Tn(e) {
|
|
2637
2504
|
return e?.kind === "coin-table" ? e : void 0;
|
|
2638
2505
|
}
|
|
2639
|
-
function
|
|
2506
|
+
function En(e) {
|
|
2640
2507
|
return e?.kind === "audio-recording" ? e : void 0;
|
|
2641
2508
|
}
|
|
2642
|
-
function
|
|
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 }) {
|
|
2509
|
+
function Dn({ adapters: e, clearAnswer: t, getAnswer: n, parentQuestionId: r, part: i, partNumber: a, updateAnswer: c }) {
|
|
2646
2510
|
let l = `${r}:${i.id}`;
|
|
2647
2511
|
return /* @__PURE__ */ s("section", {
|
|
2648
2512
|
className: "word-problem-part",
|
|
2649
2513
|
children: [/* @__PURE__ */ s("div", {
|
|
2650
2514
|
className: "word-problem-part__prompt",
|
|
2651
2515
|
children: [/* @__PURE__ */ o("span", { children: a }), /* @__PURE__ */ o("strong", { children: i.prompt })]
|
|
2652
|
-
}), i.type === "coin-table" ? /* @__PURE__ */ o(
|
|
2516
|
+
}), i.type === "coin-table" ? /* @__PURE__ */ o(Fe, {
|
|
2653
2517
|
columns: i.columns,
|
|
2654
2518
|
onChange: (e) => c(l, e),
|
|
2655
|
-
value:
|
|
2519
|
+
value: Tn(n(l))
|
|
2656
2520
|
}) : /* @__PURE__ */ s("div", {
|
|
2657
2521
|
className: "sentence-answer word-problem-part__sentence",
|
|
2658
2522
|
children: [
|
|
@@ -2669,12 +2533,12 @@ function Tn({ adapters: e, clearAnswer: t, getAnswer: n, parentQuestionId: r, pa
|
|
|
2669
2533
|
})]
|
|
2670
2534
|
});
|
|
2671
2535
|
}
|
|
2672
|
-
function
|
|
2536
|
+
function On(e) {
|
|
2673
2537
|
return e === "triangle" ? "△" : e === "square" ? "□" : e === "rectangle" ? "▭" : e;
|
|
2674
2538
|
}
|
|
2675
|
-
var
|
|
2676
|
-
function
|
|
2677
|
-
let u = r(null), d = r(null), f = r(null), p = r({}), m = r(null), h = c?.pairs[
|
|
2539
|
+
var kn = "picture";
|
|
2540
|
+
function An({ choices: e, onChange: n, scene: a, value: c, visual: l }) {
|
|
2541
|
+
let u = r(null), d = r(null), f = r(null), p = r({}), m = r(null), h = c?.pairs[kn], [g, _] = i(null), [v, y] = i(null);
|
|
2678
2542
|
function b(e, t) {
|
|
2679
2543
|
let n = d.current;
|
|
2680
2544
|
if (n) {
|
|
@@ -2749,7 +2613,7 @@ function On({ choices: e, onChange: n, scene: a, value: c, visual: l }) {
|
|
|
2749
2613
|
let r = T(e.clientX, e.clientY);
|
|
2750
2614
|
r && n({
|
|
2751
2615
|
kind: "matches",
|
|
2752
|
-
pairs: { [
|
|
2616
|
+
pairs: { [kn]: r }
|
|
2753
2617
|
}), m.current = null, y(null);
|
|
2754
2618
|
}
|
|
2755
2619
|
function w(e, t, n) {
|
|
@@ -2784,7 +2648,7 @@ function On({ choices: e, onChange: n, scene: a, value: c, visual: l }) {
|
|
|
2784
2648
|
}),
|
|
2785
2649
|
/* @__PURE__ */ s("div", {
|
|
2786
2650
|
className: "visual-match-picture",
|
|
2787
|
-
children: [/* @__PURE__ */ o(
|
|
2651
|
+
children: [/* @__PURE__ */ o(fn, { scene: a ?? un(l) }), /* @__PURE__ */ o("button", {
|
|
2788
2652
|
"aria-label": "اربط الصورة بالإجابة",
|
|
2789
2653
|
className: h ? "visual-match-point visual-match-point--target visual-match-point--target-active" : "visual-match-point visual-match-point--target",
|
|
2790
2654
|
onPointerCancel: C,
|
|
@@ -2816,8 +2680,8 @@ function On({ choices: e, onChange: n, scene: a, value: c, visual: l }) {
|
|
|
2816
2680
|
]
|
|
2817
2681
|
});
|
|
2818
2682
|
}
|
|
2819
|
-
function
|
|
2820
|
-
let l = Math.max(...a.map((e) => e.squareLength)) + 2, u =
|
|
2683
|
+
function jn({ answerId: e, choices: t, getAnswer: n, items: a, updateAnswer: c }) {
|
|
2684
|
+
let l = Math.max(...a.map((e) => e.squareLength)) + 2, u = Qe(t), [d, f] = i(null), [p, m] = i(!1), [h, g] = i({}), _ = r(null);
|
|
2821
2685
|
function v(e, t, n) {
|
|
2822
2686
|
let r = d;
|
|
2823
2687
|
r && g((i) => {
|
|
@@ -2859,7 +2723,7 @@ function kn({ answerId: e, choices: t, getAnswer: n, items: a, updateAnswer: c }
|
|
|
2859
2723
|
"data-coloring": p ? "true" : "false",
|
|
2860
2724
|
onPointerCancel: () => x(),
|
|
2861
2725
|
onPointerUp: () => x(),
|
|
2862
|
-
children: [/* @__PURE__ */ o(
|
|
2726
|
+
children: [/* @__PURE__ */ o(Je, {
|
|
2863
2727
|
ariaLabel: "ألوان الأقلام",
|
|
2864
2728
|
className: "length-color-picker",
|
|
2865
2729
|
colors: u,
|
|
@@ -2868,7 +2732,7 @@ function kn({ answerId: e, choices: t, getAnswer: n, items: a, updateAnswer: c }
|
|
|
2868
2732
|
}), /* @__PURE__ */ o("div", {
|
|
2869
2733
|
className: "length-card-row",
|
|
2870
2734
|
children: a.map((t) => {
|
|
2871
|
-
let r = `${e}:squares:${t.id}`, i = `${e}:color:${t.id}`, a =
|
|
2735
|
+
let r = `${e}:squares:${t.id}`, i = `${e}:color:${t.id}`, a = bn(n(i)), d = h[t.id], f = d?.colorId ?? a?.choiceId, p = d?.fill ?? +!!a?.choiceId, m = f ? Ze(u, f) : "#9aa3a8", g = `${16 + Math.min(p, 1) * 68}%`;
|
|
2872
2736
|
return /* @__PURE__ */ s("div", {
|
|
2873
2737
|
className: "length-card",
|
|
2874
2738
|
children: [/* @__PURE__ */ o("div", {
|
|
@@ -2903,11 +2767,11 @@ function kn({ answerId: e, choices: t, getAnswer: n, items: a, updateAnswer: c }
|
|
|
2903
2767
|
className: "length-value-row",
|
|
2904
2768
|
children: [
|
|
2905
2769
|
/* @__PURE__ */ o("span", { children: t.label }),
|
|
2906
|
-
/* @__PURE__ */ o(
|
|
2770
|
+
/* @__PURE__ */ o(nn, {
|
|
2907
2771
|
ariaLabel: `طول ${t.label} بالمربعات`,
|
|
2908
2772
|
inputMode: "numeric",
|
|
2909
2773
|
onChange: (e) => c(r, e),
|
|
2910
|
-
value:
|
|
2774
|
+
value: yn(n(r))
|
|
2911
2775
|
}),
|
|
2912
2776
|
/* @__PURE__ */ o("span", { children: "مربعات" })
|
|
2913
2777
|
]
|
|
@@ -2919,7 +2783,7 @@ function kn({ answerId: e, choices: t, getAnswer: n, items: a, updateAnswer: c }
|
|
|
2919
2783
|
}
|
|
2920
2784
|
//#endregion
|
|
2921
2785
|
//#region src/renderer/QuestionPreviewPanel.tsx
|
|
2922
|
-
function
|
|
2786
|
+
function Mn({ adapters: e, answers: t, onAnswersChange: n, question: r }) {
|
|
2923
2787
|
let [a, s] = i({}), c = t ?? a;
|
|
2924
2788
|
function l(e) {
|
|
2925
2789
|
if (t !== void 0) {
|
|
@@ -2942,7 +2806,7 @@ function An({ adapters: e, answers: t, onAnswersChange: n, question: r }) {
|
|
|
2942
2806
|
}
|
|
2943
2807
|
return /* @__PURE__ */ o("div", {
|
|
2944
2808
|
className: "exam-renderer-preview",
|
|
2945
|
-
children: /* @__PURE__ */ o(
|
|
2809
|
+
children: /* @__PURE__ */ o(mn, {
|
|
2946
2810
|
adapters: e,
|
|
2947
2811
|
clearAnswer: d,
|
|
2948
2812
|
getAnswer: (e) => c[e],
|
|
@@ -2953,7 +2817,7 @@ function An({ adapters: e, answers: t, onAnswersChange: n, question: r }) {
|
|
|
2953
2817
|
}
|
|
2954
2818
|
//#endregion
|
|
2955
2819
|
//#region src/renderer/PrintableExamDocument.tsx
|
|
2956
|
-
var
|
|
2820
|
+
var Nn = {
|
|
2957
2821
|
ariaLabel: "معلومات المؤسسة",
|
|
2958
2822
|
logoAlt: "شعار المملكة المغربية",
|
|
2959
2823
|
logoSrc: "/logo/morocco-logo.png",
|
|
@@ -2964,45 +2828,39 @@ var jn = {
|
|
|
2964
2828
|
"المديرية الإقليمية"
|
|
2965
2829
|
]
|
|
2966
2830
|
};
|
|
2967
|
-
function
|
|
2968
|
-
let r =
|
|
2831
|
+
function Pn({ exam: e, locale: t = "fr", variant: n }) {
|
|
2832
|
+
let r = nr(t), i = Vn(e);
|
|
2969
2833
|
return /* @__PURE__ */ s("article", {
|
|
2970
2834
|
className: `printable-exam printable-exam--${n}`,
|
|
2971
|
-
dir:
|
|
2835
|
+
dir: tr(t) ? "rtl" : "ltr",
|
|
2972
2836
|
children: [/* @__PURE__ */ s("div", {
|
|
2973
2837
|
className: "printable-exam__top",
|
|
2974
|
-
children: [/* @__PURE__ */
|
|
2838
|
+
children: [/* @__PURE__ */ s("header", {
|
|
2975
2839
|
className: "printable-exam__header",
|
|
2976
2840
|
children: [/* @__PURE__ */ s("div", {
|
|
2977
2841
|
className: "printable-exam__title-row",
|
|
2978
|
-
children: [/* @__PURE__ */
|
|
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
|
-
})]
|
|
2842
|
+
children: [/* @__PURE__ */ o(Bn, { totalPoints: i }), /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("h1", { children: e.title }) })]
|
|
2985
2843
|
}), /* @__PURE__ */ s("div", {
|
|
2986
2844
|
className: "printable-exam__meta",
|
|
2987
2845
|
children: [
|
|
2988
|
-
/* @__PURE__ */ o(
|
|
2846
|
+
/* @__PURE__ */ o(zn, {
|
|
2989
2847
|
label: r.duration,
|
|
2990
2848
|
value: e.timer
|
|
2991
2849
|
}),
|
|
2992
|
-
/* @__PURE__ */ o(
|
|
2850
|
+
/* @__PURE__ */ o(zn, {
|
|
2993
2851
|
label: r.level,
|
|
2994
2852
|
value: e.level
|
|
2995
2853
|
}),
|
|
2996
|
-
/* @__PURE__ */ o(
|
|
2997
|
-
label:
|
|
2854
|
+
/* @__PURE__ */ o(zn, {
|
|
2855
|
+
label: tr(t) ? "المادة" : r.subject ?? "Matiere",
|
|
2998
2856
|
value: e.subject
|
|
2999
2857
|
})
|
|
3000
2858
|
]
|
|
3001
2859
|
})]
|
|
3002
|
-
})]
|
|
2860
|
+
}), /* @__PURE__ */ o(Fn, {})]
|
|
3003
2861
|
}), /* @__PURE__ */ o("div", {
|
|
3004
2862
|
className: "printable-exam__sections",
|
|
3005
|
-
children: e.sections.map((e) => /* @__PURE__ */ o(
|
|
2863
|
+
children: e.sections.map((e) => /* @__PURE__ */ o(In, {
|
|
3006
2864
|
locale: t,
|
|
3007
2865
|
section: e,
|
|
3008
2866
|
variant: n
|
|
@@ -3010,39 +2868,36 @@ function Mn({ exam: e, locale: t = "fr", variant: n }) {
|
|
|
3010
2868
|
})]
|
|
3011
2869
|
});
|
|
3012
2870
|
}
|
|
3013
|
-
function
|
|
2871
|
+
function Fn() {
|
|
3014
2872
|
return /* @__PURE__ */ s("section", {
|
|
3015
|
-
"aria-label":
|
|
2873
|
+
"aria-label": Nn.ariaLabel,
|
|
3016
2874
|
className: "printable-institution-header",
|
|
3017
2875
|
dir: "rtl",
|
|
3018
2876
|
children: [
|
|
3019
2877
|
/* @__PURE__ */ o("img", {
|
|
3020
|
-
alt:
|
|
2878
|
+
alt: Nn.logoAlt,
|
|
3021
2879
|
className: "printable-institution-header__logo",
|
|
3022
|
-
src:
|
|
2880
|
+
src: Nn.logoSrc
|
|
3023
2881
|
}),
|
|
3024
|
-
/* @__PURE__ */ o("h1", { children:
|
|
3025
|
-
|
|
2882
|
+
/* @__PURE__ */ o("h1", { children: Nn.title }),
|
|
2883
|
+
Nn.lines.map((e) => /* @__PURE__ */ o("p", { children: e }, e))
|
|
3026
2884
|
]
|
|
3027
2885
|
});
|
|
3028
2886
|
}
|
|
3029
|
-
function
|
|
3030
|
-
let r =
|
|
2887
|
+
function In({ locale: e = "fr", section: t, variant: n }) {
|
|
2888
|
+
let r = nr(e);
|
|
3031
2889
|
return /* @__PURE__ */ s("section", {
|
|
3032
2890
|
className: `printable-section printable-section--${t.tone}`,
|
|
3033
2891
|
"data-variant": n,
|
|
3034
2892
|
children: [/* @__PURE__ */ s("header", {
|
|
3035
2893
|
className: "printable-section__header",
|
|
3036
2894
|
children: [
|
|
3037
|
-
/* @__PURE__ */
|
|
2895
|
+
/* @__PURE__ */ o("div", {
|
|
3038
2896
|
className: "printable-section__score",
|
|
3039
|
-
children:
|
|
3040
|
-
className: "printable-section__points",
|
|
3041
|
-
children: t.points
|
|
3042
|
-
}), /* @__PURE__ */ s("span", {
|
|
2897
|
+
children: /* @__PURE__ */ s("span", {
|
|
3043
2898
|
className: "printable-section__obtained",
|
|
3044
|
-
children: [/* @__PURE__ */
|
|
3045
|
-
})
|
|
2899
|
+
children: [/* @__PURE__ */ s("strong", { children: [/* @__PURE__ */ o("i", { "aria-hidden": "true" }), /* @__PURE__ */ s("b", { children: ["/ ", R(t)] })] }), /* @__PURE__ */ o("small", { children: r.obtainedNote })]
|
|
2900
|
+
})
|
|
3046
2901
|
}),
|
|
3047
2902
|
/* @__PURE__ */ o("h2", { children: t.title }),
|
|
3048
2903
|
/* @__PURE__ */ o("span", {
|
|
@@ -3052,7 +2907,7 @@ function Pn({ locale: e = "fr", section: t, variant: n }) {
|
|
|
3052
2907
|
]
|
|
3053
2908
|
}), /* @__PURE__ */ o("div", {
|
|
3054
2909
|
className: "printable-section__body",
|
|
3055
|
-
children: t.questions.map((t) => /* @__PURE__ */ o(
|
|
2910
|
+
children: t.questions.map((t) => /* @__PURE__ */ o(Ln, {
|
|
3056
2911
|
locale: e,
|
|
3057
2912
|
question: t,
|
|
3058
2913
|
variant: n
|
|
@@ -3060,58 +2915,55 @@ function Pn({ locale: e = "fr", section: t, variant: n }) {
|
|
|
3060
2915
|
})]
|
|
3061
2916
|
});
|
|
3062
2917
|
}
|
|
3063
|
-
function
|
|
3064
|
-
let r =
|
|
2918
|
+
function Ln({ locale: e = "fr", question: t, variant: n }) {
|
|
2919
|
+
let r = nr(e), i = ae(t), a = i > 0 ? I(i) : "";
|
|
3065
2920
|
return /* @__PURE__ */ s("article", {
|
|
3066
2921
|
className: `printable-question printable-question--${t.type}`,
|
|
3067
|
-
children: [/* @__PURE__ */
|
|
2922
|
+
children: [/* @__PURE__ */ o("div", {
|
|
3068
2923
|
className: "printable-question__prompt",
|
|
3069
|
-
children:
|
|
3070
|
-
className: "printable-
|
|
3071
|
-
children:
|
|
3072
|
-
|
|
3073
|
-
|
|
2924
|
+
children: /* @__PURE__ */ s("div", {
|
|
2925
|
+
className: "printable-question__prompt-text",
|
|
2926
|
+
children: [
|
|
2927
|
+
t.number > 0 ? /* @__PURE__ */ o("span", {
|
|
2928
|
+
className: "printable-question__number",
|
|
2929
|
+
children: t.number
|
|
2930
|
+
}) : null,
|
|
2931
|
+
/* @__PURE__ */ o("strong", { children: t.prompt }),
|
|
2932
|
+
a ? /* @__PURE__ */ s("span", {
|
|
2933
|
+
className: "printable-question__score-inline",
|
|
2934
|
+
children: [
|
|
2935
|
+
"(",
|
|
2936
|
+
a,
|
|
2937
|
+
"pts)"
|
|
2938
|
+
]
|
|
2939
|
+
}) : null
|
|
2940
|
+
]
|
|
2941
|
+
})
|
|
2942
|
+
}), Rn(t, n, r, e)]
|
|
3074
2943
|
});
|
|
3075
2944
|
}
|
|
3076
|
-
function
|
|
2945
|
+
function Rn(e, t, n, r) {
|
|
3077
2946
|
switch (e.type) {
|
|
3078
2947
|
case "inline-inputs":
|
|
3079
2948
|
case "equation-inputs": return /* @__PURE__ */ o("div", {
|
|
3080
2949
|
className: "printable-equation-grid",
|
|
3081
2950
|
children: e.items.map((e) => /* @__PURE__ */ o("div", {
|
|
3082
2951
|
className: "printable-equation-card",
|
|
3083
|
-
children: /* @__PURE__ */ o(
|
|
2952
|
+
children: /* @__PURE__ */ o($n, { item: e })
|
|
3084
2953
|
}, e.id))
|
|
3085
2954
|
});
|
|
3086
2955
|
case "number-line": return /* @__PURE__ */ s("div", {
|
|
3087
2956
|
className: "printable-number-line-layout",
|
|
3088
2957
|
children: [/* @__PURE__ */ s("div", {
|
|
3089
2958
|
className: "printable-number-line-expression",
|
|
3090
|
-
children: [/* @__PURE__ */ o("span", { children: e.expression }), /* @__PURE__ */ o(
|
|
3091
|
-
}), /* @__PURE__ */ o(
|
|
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
|
-
]
|
|
2959
|
+
children: [/* @__PURE__ */ o("span", { children: e.expression }), /* @__PURE__ */ o(er, {})]
|
|
2960
|
+
}), /* @__PURE__ */ o(Xn, {})]
|
|
3109
2961
|
});
|
|
3110
2962
|
case "visual-choice": return /* @__PURE__ */ s("div", {
|
|
3111
2963
|
className: "printable-visual-match",
|
|
3112
|
-
children: [/* @__PURE__ */ o(
|
|
2964
|
+
children: [/* @__PURE__ */ o(Un, {
|
|
3113
2965
|
choices: e.choices,
|
|
3114
|
-
scene: e.scene ??
|
|
2966
|
+
scene: e.scene ?? un(e.visual)
|
|
3115
2967
|
}), e.inputLabel ? /* @__PURE__ */ s("div", {
|
|
3116
2968
|
className: "printable-inline-answer",
|
|
3117
2969
|
children: [/* @__PURE__ */ o("span", { children: e.inputLabel }), /* @__PURE__ */ o($, {})]
|
|
@@ -3121,9 +2973,9 @@ function In(e, t, n, r) {
|
|
|
3121
2973
|
className: "printable-length-task",
|
|
3122
2974
|
children: /* @__PURE__ */ o("div", {
|
|
3123
2975
|
className: "printable-length-list",
|
|
3124
|
-
children: e.items.map((e) => /* @__PURE__ */ o(
|
|
2976
|
+
children: e.items.map((e) => /* @__PURE__ */ o(Zn, {
|
|
3125
2977
|
item: e,
|
|
3126
|
-
squareUnit:
|
|
2978
|
+
squareUnit: tr(r) ? "مربعات" : "carres",
|
|
3127
2979
|
variant: t
|
|
3128
2980
|
}, e.id))
|
|
3129
2981
|
})
|
|
@@ -3135,7 +2987,7 @@ function In(e, t, n, r) {
|
|
|
3135
2987
|
className: "printable-shape-bank",
|
|
3136
2988
|
children: e.choices.map((e) => /* @__PURE__ */ o("div", {
|
|
3137
2989
|
className: "printable-shape-card",
|
|
3138
|
-
children: /* @__PURE__ */ o(
|
|
2990
|
+
children: /* @__PURE__ */ o(Be, { shapeId: e.id })
|
|
3139
2991
|
}, e.id))
|
|
3140
2992
|
}),
|
|
3141
2993
|
/* @__PURE__ */ o("div", {
|
|
@@ -3145,12 +2997,12 @@ function In(e, t, n, r) {
|
|
|
3145
2997
|
children: [/* @__PURE__ */ s("span", { children: [t + 1, "."] }), /* @__PURE__ */ o("strong", { children: e.label })]
|
|
3146
2998
|
}, e.id))
|
|
3147
2999
|
}),
|
|
3148
|
-
/* @__PURE__ */ o(
|
|
3000
|
+
/* @__PURE__ */ o(Hn, { label: n.dragArea })
|
|
3149
3001
|
]
|
|
3150
3002
|
});
|
|
3151
3003
|
case "drawing-grid": return /* @__PURE__ */ o("div", {
|
|
3152
3004
|
className: "printable-drawing-block",
|
|
3153
|
-
children: /* @__PURE__ */ o(
|
|
3005
|
+
children: /* @__PURE__ */ o(Yn, { points: e.points })
|
|
3154
3006
|
});
|
|
3155
3007
|
case "table-response": return /* @__PURE__ */ o("div", {
|
|
3156
3008
|
className: "printable-table-response",
|
|
@@ -3184,13 +3036,13 @@ function In(e, t, n, r) {
|
|
|
3184
3036
|
children: e.situation
|
|
3185
3037
|
}), /* @__PURE__ */ o("div", {
|
|
3186
3038
|
className: "printable-word-problem__parts",
|
|
3187
|
-
children: e.parts.map((e, t) => /* @__PURE__ */ o(
|
|
3039
|
+
children: e.parts.map((e, t) => /* @__PURE__ */ o(Qn, {
|
|
3188
3040
|
part: e,
|
|
3189
3041
|
partNumber: t + 1
|
|
3190
3042
|
}, e.id))
|
|
3191
3043
|
})]
|
|
3192
3044
|
});
|
|
3193
|
-
case "drag-match": return /* @__PURE__ */ o(
|
|
3045
|
+
case "drag-match": return /* @__PURE__ */ o(Gn, {
|
|
3194
3046
|
items: e.items,
|
|
3195
3047
|
targets: e.targets
|
|
3196
3048
|
});
|
|
@@ -3213,7 +3065,7 @@ function In(e, t, n, r) {
|
|
|
3213
3065
|
case "label-placement": return /* @__PURE__ */ s("div", {
|
|
3214
3066
|
className: "printable-label-placement",
|
|
3215
3067
|
children: [
|
|
3216
|
-
/* @__PURE__ */ o(
|
|
3068
|
+
/* @__PURE__ */ o(Jn, { targets: e.targets }),
|
|
3217
3069
|
/* @__PURE__ */ o("div", {
|
|
3218
3070
|
className: "printable-placement-labels",
|
|
3219
3071
|
children: e.labels.map((e) => /* @__PURE__ */ o("span", {
|
|
@@ -3221,7 +3073,7 @@ function In(e, t, n, r) {
|
|
|
3221
3073
|
children: /* @__PURE__ */ o("strong", { children: e.label })
|
|
3222
3074
|
}, e.id))
|
|
3223
3075
|
}),
|
|
3224
|
-
/* @__PURE__ */ o(
|
|
3076
|
+
/* @__PURE__ */ o(Hn, { label: n.placeLabels })
|
|
3225
3077
|
]
|
|
3226
3078
|
});
|
|
3227
3079
|
case "audio-recording": return /* @__PURE__ */ s("div", {
|
|
@@ -3246,52 +3098,49 @@ function In(e, t, n, r) {
|
|
|
3246
3098
|
});
|
|
3247
3099
|
}
|
|
3248
3100
|
}
|
|
3249
|
-
function
|
|
3101
|
+
function zn({ label: e, value: t }) {
|
|
3250
3102
|
return /* @__PURE__ */ s("div", {
|
|
3251
3103
|
className: "printable-meta-pill",
|
|
3252
3104
|
children: [/* @__PURE__ */ o("span", { children: e }), /* @__PURE__ */ o("strong", { children: t })]
|
|
3253
3105
|
});
|
|
3254
3106
|
}
|
|
3255
|
-
function
|
|
3256
|
-
return /* @__PURE__ */
|
|
3107
|
+
function Bn({ totalPoints: e }) {
|
|
3108
|
+
return /* @__PURE__ */ o("div", {
|
|
3257
3109
|
className: "printable-note-box",
|
|
3258
|
-
children:
|
|
3110
|
+
children: /* @__PURE__ */ s("strong", { children: [/* @__PURE__ */ o("i", { "aria-hidden": "true" }), /* @__PURE__ */ s("b", { children: ["/ ", e] })] })
|
|
3259
3111
|
});
|
|
3260
3112
|
}
|
|
3261
|
-
function
|
|
3262
|
-
let t = e.sections.filter((e) => e.isScored !== !1).map((e) =>
|
|
3113
|
+
function Vn(e) {
|
|
3114
|
+
let t = e.sections.filter((e) => e.isScored !== !1).map((e) => L(e)).filter((e) => Number.isFinite(e));
|
|
3263
3115
|
if (t.length === 0) return "";
|
|
3264
3116
|
let n = t.reduce((e, t) => e + t, 0);
|
|
3265
3117
|
return String(Number.isInteger(n) ? n : Number(n.toFixed(2)));
|
|
3266
3118
|
}
|
|
3267
|
-
function
|
|
3119
|
+
function Hn({ label: e }) {
|
|
3268
3120
|
return /* @__PURE__ */ s("div", {
|
|
3269
3121
|
className: "printable-hint-line",
|
|
3270
3122
|
children: [/* @__PURE__ */ o("span", { children: e }), /* @__PURE__ */ o($, {})]
|
|
3271
3123
|
});
|
|
3272
3124
|
}
|
|
3273
|
-
function
|
|
3274
|
-
return `${e.leftOperand} ${e.operator} ${e.rightOperand} =`;
|
|
3275
|
-
}
|
|
3276
|
-
function Hn({ choices: e, scene: t }) {
|
|
3125
|
+
function Un({ choices: e, scene: t }) {
|
|
3277
3126
|
return /* @__PURE__ */ o("div", {
|
|
3278
3127
|
className: "printable-visual-match__preview",
|
|
3279
3128
|
children: /* @__PURE__ */ s("div", {
|
|
3280
3129
|
className: "visual-line-match printable-visual-line-match",
|
|
3281
3130
|
children: [/* @__PURE__ */ s("div", {
|
|
3282
3131
|
className: "visual-match-picture printable-visual-match-picture",
|
|
3283
|
-
children: [/* @__PURE__ */ o(
|
|
3132
|
+
children: [/* @__PURE__ */ o(fn, { scene: t }), /* @__PURE__ */ o("span", {
|
|
3284
3133
|
"aria-hidden": "true",
|
|
3285
3134
|
className: "visual-match-point visual-match-point--target printable-match-point printable-match-point--target"
|
|
3286
3135
|
})]
|
|
3287
3136
|
}), /* @__PURE__ */ o("div", {
|
|
3288
3137
|
className: "visual-line-match__answers printable-visual-line-match__answers",
|
|
3289
|
-
children: e.map((e) => /* @__PURE__ */ o(
|
|
3138
|
+
children: e.map((e) => /* @__PURE__ */ o(Wn, { choice: e }, e.id))
|
|
3290
3139
|
})]
|
|
3291
3140
|
})
|
|
3292
3141
|
});
|
|
3293
3142
|
}
|
|
3294
|
-
function
|
|
3143
|
+
function Wn({ choice: e }) {
|
|
3295
3144
|
return /* @__PURE__ */ s("div", {
|
|
3296
3145
|
className: "visual-match-answer printable-visual-match-answer",
|
|
3297
3146
|
children: [/* @__PURE__ */ o("span", {
|
|
@@ -3303,71 +3152,49 @@ function Un({ choice: e }) {
|
|
|
3303
3152
|
})]
|
|
3304
3153
|
});
|
|
3305
3154
|
}
|
|
3306
|
-
function
|
|
3155
|
+
function Gn({ items: e, targets: t }) {
|
|
3307
3156
|
return /* @__PURE__ */ s("div", {
|
|
3308
3157
|
className: "printable-drag-match-board",
|
|
3309
|
-
children: [
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
/* @__PURE__ */ o(
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
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
|
-
]
|
|
3158
|
+
children: [/* @__PURE__ */ o("div", {
|
|
3159
|
+
className: "printable-drag-match-row printable-drag-match-row--answers",
|
|
3160
|
+
children: e.map((e, t) => /* @__PURE__ */ o(qn, {
|
|
3161
|
+
index: t,
|
|
3162
|
+
item: e
|
|
3163
|
+
}, e.id))
|
|
3164
|
+
}), /* @__PURE__ */ o("div", {
|
|
3165
|
+
className: "printable-drag-match-row printable-drag-match-row--targets",
|
|
3166
|
+
children: t.map((e, t) => /* @__PURE__ */ o(Kn, {
|
|
3167
|
+
index: t,
|
|
3168
|
+
target: e
|
|
3169
|
+
}, e.id))
|
|
3170
|
+
})]
|
|
3330
3171
|
});
|
|
3331
3172
|
}
|
|
3332
|
-
function
|
|
3173
|
+
function Kn({ index: e, target: t }) {
|
|
3333
3174
|
return /* @__PURE__ */ s("div", {
|
|
3334
3175
|
className: "printable-drag-match-card printable-drag-match-card--target",
|
|
3335
|
-
children: [
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
/* @__PURE__ */ o("
|
|
3341
|
-
|
|
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
|
-
]
|
|
3176
|
+
children: [/* @__PURE__ */ o("span", {
|
|
3177
|
+
className: "printable-drag-match-index",
|
|
3178
|
+
children: String.fromCharCode(65 + e)
|
|
3179
|
+
}), /* @__PURE__ */ o("div", {
|
|
3180
|
+
className: "printable-drag-match-content",
|
|
3181
|
+
children: t.shapeId ? /* @__PURE__ */ o(Be, { shapeId: t.shapeId }) : /* @__PURE__ */ o("strong", { children: t.label })
|
|
3182
|
+
})]
|
|
3349
3183
|
});
|
|
3350
3184
|
}
|
|
3351
|
-
function
|
|
3185
|
+
function qn({ index: e, item: t }) {
|
|
3352
3186
|
return /* @__PURE__ */ s("div", {
|
|
3353
3187
|
className: "printable-drag-match-card printable-drag-match-card--answer",
|
|
3354
|
-
children: [
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
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
|
-
]
|
|
3188
|
+
children: [/* @__PURE__ */ o("div", {
|
|
3189
|
+
className: "printable-drag-match-content",
|
|
3190
|
+
children: /* @__PURE__ */ o("strong", { children: t.label })
|
|
3191
|
+
}), /* @__PURE__ */ o("span", {
|
|
3192
|
+
className: "printable-drag-match-index",
|
|
3193
|
+
children: e + 1
|
|
3194
|
+
})]
|
|
3368
3195
|
});
|
|
3369
3196
|
}
|
|
3370
|
-
function
|
|
3197
|
+
function Jn({ targets: e }) {
|
|
3371
3198
|
return /* @__PURE__ */ o("div", {
|
|
3372
3199
|
className: "printable-placement-board",
|
|
3373
3200
|
children: e.map((e, t) => /* @__PURE__ */ o("div", {
|
|
@@ -3380,7 +3207,7 @@ function qn({ targets: e }) {
|
|
|
3380
3207
|
}, e.id))
|
|
3381
3208
|
});
|
|
3382
3209
|
}
|
|
3383
|
-
function
|
|
3210
|
+
function Yn({ points: e }) {
|
|
3384
3211
|
return /* @__PURE__ */ s("svg", {
|
|
3385
3212
|
className: "printable-drawing-grid",
|
|
3386
3213
|
viewBox: "0 0 1000 420",
|
|
@@ -3411,7 +3238,7 @@ function Jn({ points: e }) {
|
|
|
3411
3238
|
]
|
|
3412
3239
|
});
|
|
3413
3240
|
}
|
|
3414
|
-
function
|
|
3241
|
+
function Xn() {
|
|
3415
3242
|
return /* @__PURE__ */ s("svg", {
|
|
3416
3243
|
className: "printable-number-line",
|
|
3417
3244
|
viewBox: "0 0 420 90",
|
|
@@ -3435,7 +3262,7 @@ function Yn() {
|
|
|
3435
3262
|
}, t))]
|
|
3436
3263
|
});
|
|
3437
3264
|
}
|
|
3438
|
-
function
|
|
3265
|
+
function Zn({ item: e, squareUnit: t, variant: n }) {
|
|
3439
3266
|
return /* @__PURE__ */ s("div", {
|
|
3440
3267
|
className: "length-card printable-length-card",
|
|
3441
3268
|
children: [/* @__PURE__ */ o("div", {
|
|
@@ -3464,13 +3291,13 @@ function Xn({ item: e, squareUnit: t, variant: n }) {
|
|
|
3464
3291
|
className: "length-value-row printable-length-value-row",
|
|
3465
3292
|
children: [
|
|
3466
3293
|
/* @__PURE__ */ o("span", { children: e.label }),
|
|
3467
|
-
/* @__PURE__ */ o(
|
|
3294
|
+
/* @__PURE__ */ o(er, {}),
|
|
3468
3295
|
/* @__PURE__ */ o("span", { children: t })
|
|
3469
3296
|
]
|
|
3470
3297
|
})]
|
|
3471
3298
|
});
|
|
3472
3299
|
}
|
|
3473
|
-
function
|
|
3300
|
+
function Qn({ part: e, partNumber: t }) {
|
|
3474
3301
|
return /* @__PURE__ */ s("section", {
|
|
3475
3302
|
className: "printable-word-problem__part",
|
|
3476
3303
|
children: [/* @__PURE__ */ s("div", {
|
|
@@ -3499,10 +3326,10 @@ function Zn({ part: e, partNumber: t }) {
|
|
|
3499
3326
|
})]
|
|
3500
3327
|
});
|
|
3501
3328
|
}
|
|
3502
|
-
function
|
|
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(
|
|
3329
|
+
function $n({ item: t }) {
|
|
3330
|
+
return t.answers?.length ? /* @__PURE__ */ s(a, { children: [t.answers.map((t) => /* @__PURE__ */ s(e, { children: [t.before ? /* @__PURE__ */ o("span", { children: t.before }) : null, /* @__PURE__ */ o(er, {})] }, t.id)), t.after ? /* @__PURE__ */ o("span", { children: t.after }) : null] }) : t.correctAnswer ? /* @__PURE__ */ s(a, { children: [
|
|
3504
3331
|
/* @__PURE__ */ o("span", { children: t.before }),
|
|
3505
|
-
/* @__PURE__ */ o(
|
|
3332
|
+
/* @__PURE__ */ o(er, {}),
|
|
3506
3333
|
t.after ? /* @__PURE__ */ o("span", { children: t.after }) : null
|
|
3507
3334
|
] }) : /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("span", { children: t.before }), t.after ? /* @__PURE__ */ o("span", { children: t.after }) : null] });
|
|
3508
3335
|
}
|
|
@@ -3512,17 +3339,17 @@ function $() {
|
|
|
3512
3339
|
"aria-hidden": "true"
|
|
3513
3340
|
});
|
|
3514
3341
|
}
|
|
3515
|
-
function
|
|
3342
|
+
function er() {
|
|
3516
3343
|
return /* @__PURE__ */ o("span", {
|
|
3517
3344
|
className: "printable-blank-box",
|
|
3518
3345
|
"aria-hidden": "true"
|
|
3519
3346
|
});
|
|
3520
3347
|
}
|
|
3521
|
-
function
|
|
3348
|
+
function tr(e) {
|
|
3522
3349
|
return e.startsWith("ar");
|
|
3523
3350
|
}
|
|
3524
|
-
function
|
|
3525
|
-
return
|
|
3351
|
+
function nr(e) {
|
|
3352
|
+
return tr(e) ? {
|
|
3526
3353
|
answerArea: "مساحة الجواب",
|
|
3527
3354
|
countShort: "عدد",
|
|
3528
3355
|
dragArea: "اربط أو اكتب الجواب",
|
|
@@ -3545,7 +3372,7 @@ function tr(e) {
|
|
|
3545
3372
|
duration: "Duree",
|
|
3546
3373
|
level: "Niveau",
|
|
3547
3374
|
model: "Modele",
|
|
3548
|
-
obtainedNote: "
|
|
3375
|
+
obtainedNote: "التحكم",
|
|
3549
3376
|
oralAnswer: "Reponse orale",
|
|
3550
3377
|
phase: "Phase",
|
|
3551
3378
|
placeLabels: "Placer les etiquettes",
|
|
@@ -3559,7 +3386,7 @@ function tr(e) {
|
|
|
3559
3386
|
}
|
|
3560
3387
|
//#endregion
|
|
3561
3388
|
//#region src/exam-session/interactions/DraftSheet.tsx
|
|
3562
|
-
function
|
|
3389
|
+
function rr({ disabled: e, onChange: t, value: n }) {
|
|
3563
3390
|
let [r, a] = i(!1);
|
|
3564
3391
|
return /* @__PURE__ */ o("aside", {
|
|
3565
3392
|
className: "draft-sheet",
|
|
@@ -3576,7 +3403,7 @@ function nr({ disabled: e, onChange: t, value: n }) {
|
|
|
3576
3403
|
type: "button",
|
|
3577
3404
|
children: "إِغْلاقٌ"
|
|
3578
3405
|
})]
|
|
3579
|
-
}), /* @__PURE__ */ o(
|
|
3406
|
+
}), /* @__PURE__ */ o(ot, {
|
|
3580
3407
|
actionLabel: "مساحة ورقة وساخ",
|
|
3581
3408
|
canvasHeight: 430,
|
|
3582
3409
|
disabled: e,
|
|
@@ -3595,7 +3422,7 @@ function nr({ disabled: e, onChange: t, value: n }) {
|
|
|
3595
3422
|
}
|
|
3596
3423
|
//#endregion
|
|
3597
3424
|
//#region src/exam-session/interactions/SingleChoice.tsx
|
|
3598
|
-
function
|
|
3425
|
+
function ir({ answerId: e, choices: t, value: n, onChange: r }) {
|
|
3599
3426
|
return /* @__PURE__ */ o("div", {
|
|
3600
3427
|
className: "choice-group",
|
|
3601
3428
|
role: "radiogroup",
|
|
@@ -3620,4 +3447,4 @@ function rr({ answerId: e, choices: t, value: n, onChange: r }) {
|
|
|
3620
3447
|
});
|
|
3621
3448
|
}
|
|
3622
3449
|
//#endregion
|
|
3623
|
-
export {
|
|
3450
|
+
export { Fe as CoinTableResponse, Je as ColorPenPicker, K as DEFAULT_GEOMETRY_COLORS, zt as DEFAULT_NATIVE_VOICE_AI_CONFIG, rr as DraftSheet, Ve as DragMatch, hn as ExamSectionRenderer, ot as GeometryCanvas, G as HandwrittenNumberAnswer, Nt as KonvaDrawingGrid, Pt as LabelPlacement, Lt as NumberLineAnswer, Pn as PrintableExamDocument, Ln as PrintableQuestionRenderer, In as PrintableSectionRenderer, Kt as PronunciationRecorder, Mn as QuestionPreviewPanel, mn as QuestionRenderer, Be as ShapeGlyph, ir as SingleChoice, en as SortableAnswer, nn as TextAnswer, fn as VisualSceneGraphic, de as calculateExamResult, un as createVisualSceneFromVariant, Bt as evaluateVoiceAiResult, Re as examShapeOptions, I as formatScoreValue, Ze as getColorValue, Xe as getDefaultColorId, ze as getExamShapeLabel, ae as getQuestionMaxScore, L as getSectionMaxScore, R as getSectionMaxScoreLabel, dn as getVisualSceneColorValue, Qe as mapChoicesToGeometryColors, Vt as normalizeVoiceText, ie as parseScoreValue, oe as sectionHasQuestionScores, cn as visualSceneColorOptions, sn as visualSceneIconOptions, ln as visualSceneStateOptions, z as withDerivedSectionScore };
|