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