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