alexsys-exam-renderer 0.1.1 → 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 +43 -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/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 +1747 -922
- 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 +1 -1
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,35 +362,38 @@ 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 = l?.strokes ?? [],
|
|
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) {
|
|
@@ -343,44 +401,44 @@ function q({ ariaLabel: t, onChange: i, onClear: s, recognizer: c, value: l }) {
|
|
|
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,
|
|
358
416
|
y,
|
|
359
417
|
v,
|
|
360
418
|
c,
|
|
361
419
|
l
|
|
362
420
|
]);
|
|
363
|
-
function
|
|
364
|
-
_(!1),
|
|
365
|
-
canvasHeight:
|
|
366
|
-
canvasWidth:
|
|
421
|
+
function S(e) {
|
|
422
|
+
_(!1), n({
|
|
423
|
+
canvasHeight: W,
|
|
424
|
+
canvasWidth: Ie,
|
|
367
425
|
kind: "handwritten-number",
|
|
368
426
|
strokes: e
|
|
369
427
|
});
|
|
370
428
|
}
|
|
371
|
-
function
|
|
429
|
+
function ee(e) {
|
|
372
430
|
if (b) return;
|
|
373
431
|
let t = e.target.getStage()?.getPointerPosition();
|
|
374
|
-
t && (e.evt.preventDefault(),
|
|
432
|
+
t && (e.evt.preventDefault(), m(!0), S([...u, {
|
|
375
433
|
id: `stroke-${Date.now()}-${Math.round(t.x)}-${Math.round(t.y)}`,
|
|
376
434
|
points: [t.x, t.y],
|
|
377
435
|
timestamps: [Date.now()]
|
|
378
436
|
}]));
|
|
379
437
|
}
|
|
380
|
-
function
|
|
381
|
-
if (b ||
|
|
438
|
+
function C(e) {
|
|
439
|
+
if (b || d || !e.evt.buttons && e.evt.pointerType === "mouse") return;
|
|
382
440
|
let t = e.target.getStage()?.getPointerPosition();
|
|
383
|
-
t && (e.evt.preventDefault(),
|
|
441
|
+
t && (e.evt.preventDefault(), S(u.map((e, n) => n === u.length - 1 ? {
|
|
384
442
|
...e,
|
|
385
443
|
points: [
|
|
386
444
|
...e.points,
|
|
@@ -390,66 +448,66 @@ function q({ ariaLabel: t, onChange: i, onClear: s, recognizer: c, value: l }) {
|
|
|
390
448
|
timestamps: [...e.timestamps ?? [], Date.now()]
|
|
391
449
|
} : e)));
|
|
392
450
|
}
|
|
393
|
-
function
|
|
394
|
-
b || (e.evt.preventDefault(),
|
|
451
|
+
function w(e) {
|
|
452
|
+
b || (e.evt.preventDefault(), m(!1));
|
|
395
453
|
}
|
|
396
|
-
function
|
|
397
|
-
|
|
454
|
+
function T() {
|
|
455
|
+
m(!1), S([]), a?.();
|
|
398
456
|
}
|
|
399
|
-
return /* @__PURE__ */
|
|
457
|
+
return /* @__PURE__ */ s("div", {
|
|
400
458
|
"aria-disabled": b,
|
|
401
|
-
"aria-label":
|
|
459
|
+
"aria-label": e,
|
|
402
460
|
className: "handwritten-number-answer",
|
|
403
461
|
"data-model-state": y,
|
|
404
462
|
children: [
|
|
405
|
-
/* @__PURE__ */
|
|
463
|
+
/* @__PURE__ */ s(ne, {
|
|
406
464
|
className: "handwritten-number-stage",
|
|
407
|
-
height:
|
|
408
|
-
onPointerCancel:
|
|
409
|
-
onPointerDown:
|
|
410
|
-
onPointerMove:
|
|
411
|
-
onPointerUp:
|
|
465
|
+
height: W,
|
|
466
|
+
onPointerCancel: w,
|
|
467
|
+
onPointerDown: ee,
|
|
468
|
+
onPointerMove: C,
|
|
469
|
+
onPointerUp: w,
|
|
412
470
|
role: "img",
|
|
413
|
-
width:
|
|
414
|
-
children: [/* @__PURE__ */
|
|
471
|
+
width: Ie,
|
|
472
|
+
children: [/* @__PURE__ */ s(te, {
|
|
415
473
|
listening: !1,
|
|
416
474
|
children: [
|
|
417
|
-
/* @__PURE__ */
|
|
475
|
+
/* @__PURE__ */ o(N, {
|
|
418
476
|
cornerRadius: 14,
|
|
419
477
|
fill: "#fff",
|
|
420
|
-
height:
|
|
478
|
+
height: W,
|
|
421
479
|
stroke: "#cfe3d9",
|
|
422
480
|
strokeWidth: 2,
|
|
423
|
-
width:
|
|
481
|
+
width: Ie,
|
|
424
482
|
x: 0,
|
|
425
483
|
y: 0
|
|
426
484
|
}),
|
|
427
|
-
/* @__PURE__ */
|
|
485
|
+
/* @__PURE__ */ o(M, {
|
|
428
486
|
dash: [6, 8],
|
|
429
487
|
points: [
|
|
430
488
|
16,
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
489
|
+
W - 18,
|
|
490
|
+
Ie - 16,
|
|
491
|
+
W - 18
|
|
434
492
|
],
|
|
435
493
|
stroke: "#dbe9e2",
|
|
436
494
|
strokeWidth: 2
|
|
437
495
|
}),
|
|
438
|
-
|
|
496
|
+
d ? /* @__PURE__ */ o(P, {
|
|
439
497
|
align: "center",
|
|
440
498
|
fill: "#9aaca3",
|
|
441
499
|
fontFamily: "Arial, sans-serif",
|
|
442
500
|
fontSize: 15,
|
|
443
501
|
fontStyle: "bold",
|
|
444
|
-
height:
|
|
502
|
+
height: W,
|
|
445
503
|
text: "ارسم هنا",
|
|
446
504
|
verticalAlign: "middle",
|
|
447
|
-
width:
|
|
505
|
+
width: Ie,
|
|
448
506
|
x: 0,
|
|
449
507
|
y: 0
|
|
450
508
|
}) : null
|
|
451
509
|
]
|
|
452
|
-
}), /* @__PURE__ */
|
|
510
|
+
}), /* @__PURE__ */ o(te, { children: u.map((e) => /* @__PURE__ */ o(M, {
|
|
453
511
|
globalCompositeOperation: "source-over",
|
|
454
512
|
lineCap: "round",
|
|
455
513
|
lineJoin: "round",
|
|
@@ -459,24 +517,24 @@ function q({ ariaLabel: t, onChange: i, onClear: s, recognizer: c, value: l }) {
|
|
|
459
517
|
tension: .28
|
|
460
518
|
}, e.id)) })]
|
|
461
519
|
}),
|
|
462
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ o("button", {
|
|
463
521
|
"aria-label": "مسح الجواب المرسوم",
|
|
464
522
|
className: "handwritten-number-clear",
|
|
465
|
-
disabled:
|
|
466
|
-
onClick:
|
|
523
|
+
disabled: d || b,
|
|
524
|
+
onClick: T,
|
|
467
525
|
type: "button",
|
|
468
|
-
children: /* @__PURE__ */
|
|
526
|
+
children: /* @__PURE__ */ o(h, { "aria-hidden": "true" })
|
|
469
527
|
}),
|
|
470
|
-
|
|
528
|
+
x !== "idle" && x !== "unavailable" ? /* @__PURE__ */ o("span", {
|
|
471
529
|
"aria-live": "polite",
|
|
472
530
|
className: "handwritten-number-status",
|
|
473
|
-
"data-state":
|
|
474
|
-
children:
|
|
531
|
+
"data-state": x,
|
|
532
|
+
children: Re(x, l?.recognizedValue)
|
|
475
533
|
}) : null
|
|
476
534
|
]
|
|
477
535
|
});
|
|
478
536
|
}
|
|
479
|
-
function
|
|
537
|
+
function Re(e, t) {
|
|
480
538
|
switch (e) {
|
|
481
539
|
case "recognizing": return "جارٍ التعرّف على الرقم…";
|
|
482
540
|
case "recognized": return `تمّ التعرّف: ${t ?? ""}`;
|
|
@@ -489,22 +547,22 @@ function ve(e, t) {
|
|
|
489
547
|
}
|
|
490
548
|
//#endregion
|
|
491
549
|
//#region src/exam-session/interactions/ColorPenPicker.tsx
|
|
492
|
-
function
|
|
493
|
-
return /* @__PURE__ */
|
|
550
|
+
function ze({ ariaLabel: e, className: t = "", colors: n, disabled: r = !1, onChange: i, selectedColorId: a }) {
|
|
551
|
+
return /* @__PURE__ */ o("div", {
|
|
494
552
|
"aria-label": e,
|
|
495
553
|
className: ["color-pen-picker", t].filter(Boolean).join(" "),
|
|
496
554
|
role: "group",
|
|
497
|
-
children: n.map((e) => /* @__PURE__ */
|
|
498
|
-
"aria-pressed":
|
|
499
|
-
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",
|
|
500
558
|
disabled: r,
|
|
501
559
|
onClick: () => i(e.id),
|
|
502
560
|
style: { "--pen-color": e.value },
|
|
503
561
|
type: "button",
|
|
504
|
-
children: [/* @__PURE__ */
|
|
562
|
+
children: [/* @__PURE__ */ o("span", {
|
|
505
563
|
className: "color-pen-button__indicator",
|
|
506
564
|
"aria-hidden": "true"
|
|
507
|
-
}), /* @__PURE__ */
|
|
565
|
+
}), /* @__PURE__ */ o("span", {
|
|
508
566
|
className: "color-pen-button__label",
|
|
509
567
|
children: e.label
|
|
510
568
|
})]
|
|
@@ -513,7 +571,7 @@ function ye({ ariaLabel: e, className: t = "", colors: n, disabled: r = !1, onCh
|
|
|
513
571
|
}
|
|
514
572
|
//#endregion
|
|
515
573
|
//#region src/exam-session/interactions/geometryColors.ts
|
|
516
|
-
var
|
|
574
|
+
var K = [
|
|
517
575
|
{
|
|
518
576
|
id: "green",
|
|
519
577
|
label: "أَخْضَرُ",
|
|
@@ -534,28 +592,28 @@ var J = [
|
|
|
534
592
|
label: "أَسْوَدُ",
|
|
535
593
|
value: "#17212b"
|
|
536
594
|
}
|
|
537
|
-
],
|
|
595
|
+
], Be = {
|
|
538
596
|
black: "#17212b",
|
|
539
597
|
blue: "#256fd2",
|
|
540
598
|
green: "#0b7f45",
|
|
541
599
|
red: "#e34a58"
|
|
542
600
|
};
|
|
543
|
-
function
|
|
601
|
+
function Ve(e, t) {
|
|
544
602
|
return t ? e.find((e) => e.id === t || e.value === t)?.id ?? e[0]?.id ?? "green" : e[0]?.id ?? "green";
|
|
545
603
|
}
|
|
546
|
-
function
|
|
547
|
-
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;
|
|
548
606
|
}
|
|
549
|
-
function
|
|
607
|
+
function Ue(e) {
|
|
550
608
|
return e.map((e) => ({
|
|
551
609
|
id: e.id,
|
|
552
610
|
label: e.label,
|
|
553
|
-
value:
|
|
611
|
+
value: Be[e.id] ?? K[0].value
|
|
554
612
|
}));
|
|
555
613
|
}
|
|
556
614
|
//#endregion
|
|
557
615
|
//#region src/exam-session/interactions/GeometryCanvas.tsx
|
|
558
|
-
var
|
|
616
|
+
var We = 1e3, Ge = 600, q = 30, Ke = 240, qe = 12, Je = K[0].value, J = "#0a8f55", Ye = [
|
|
559
617
|
{
|
|
560
618
|
id: "pen",
|
|
561
619
|
icon: "✎",
|
|
@@ -586,44 +644,44 @@ var we = 1e3, Te = 600, Y = 30, Ee = 240, De = 12, Oe = J[0].value, X = "#0a8f55
|
|
|
586
644
|
icon: "⌖",
|
|
587
645
|
label: "بَرْكارٌ"
|
|
588
646
|
}
|
|
589
|
-
],
|
|
647
|
+
], Xe = /* @__PURE__ */ new Set([
|
|
590
648
|
"ruler",
|
|
591
649
|
"protractor",
|
|
592
650
|
"compass"
|
|
593
651
|
]);
|
|
594
|
-
function
|
|
595
|
-
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({
|
|
596
654
|
height: t,
|
|
597
655
|
scale: 1,
|
|
598
|
-
width:
|
|
599
|
-
}), [
|
|
656
|
+
width: n
|
|
657
|
+
}), [j, M] = i({
|
|
600
658
|
canRedo: !1,
|
|
601
659
|
canUndo: !1
|
|
602
|
-
}),
|
|
603
|
-
|
|
604
|
-
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 = [
|
|
605
663
|
"geometry-canvas",
|
|
606
664
|
`geometry-canvas--${g}`,
|
|
607
|
-
|
|
608
|
-
].filter(Boolean).join(" "),
|
|
609
|
-
function
|
|
610
|
-
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);
|
|
611
669
|
}
|
|
612
|
-
function
|
|
613
|
-
|
|
670
|
+
function se(e) {
|
|
671
|
+
x((t) => t.includes(e) ? t.filter((t) => t !== e) : t.concat(e));
|
|
614
672
|
}
|
|
615
|
-
function
|
|
673
|
+
function ce(e) {
|
|
616
674
|
if (e === "ruler" || e === "protractor") {
|
|
617
|
-
if (
|
|
618
|
-
y(null),
|
|
675
|
+
if (z) {
|
|
676
|
+
y(null), x((t) => t.includes(e) ? t : t.concat(e));
|
|
619
677
|
return;
|
|
620
678
|
}
|
|
621
|
-
|
|
679
|
+
se(e);
|
|
622
680
|
return;
|
|
623
681
|
}
|
|
624
682
|
if (e === "compass") {
|
|
625
683
|
let e = v !== "compass" || !b.includes("compass");
|
|
626
|
-
y(e ? "compass" : null),
|
|
684
|
+
y(e ? "compass" : null), x((t) => {
|
|
627
685
|
let n = t.filter((e) => e !== "compass");
|
|
628
686
|
return e ? [...n, "compass"] : n;
|
|
629
687
|
});
|
|
@@ -631,65 +689,65 @@ function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, classNa
|
|
|
631
689
|
}
|
|
632
690
|
y(e);
|
|
633
691
|
}
|
|
634
|
-
function
|
|
692
|
+
function le(e) {
|
|
635
693
|
return re.current += 1, `${e}-${Date.now()}-${re.current}`;
|
|
636
694
|
}
|
|
637
|
-
function
|
|
695
|
+
function ue(e, t = T) {
|
|
638
696
|
f({
|
|
639
|
-
elements:
|
|
697
|
+
elements: Y(e),
|
|
640
698
|
guides: t,
|
|
641
699
|
kind: "drawing",
|
|
642
|
-
strokes:
|
|
700
|
+
strokes: ct(e)
|
|
643
701
|
});
|
|
644
702
|
}
|
|
645
|
-
function
|
|
646
|
-
|
|
703
|
+
function de() {
|
|
704
|
+
M({
|
|
647
705
|
canRedo: I.current < F.current.length - 1,
|
|
648
706
|
canUndo: I.current > 0
|
|
649
707
|
});
|
|
650
708
|
}
|
|
651
|
-
function
|
|
652
|
-
let n =
|
|
653
|
-
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();
|
|
654
712
|
}
|
|
655
|
-
function
|
|
656
|
-
|
|
713
|
+
function pe(e) {
|
|
714
|
+
E(e), ue(C, e);
|
|
657
715
|
}
|
|
658
|
-
function
|
|
659
|
-
if (!
|
|
716
|
+
function me() {
|
|
717
|
+
if (!j.canUndo || u) return;
|
|
660
718
|
--I.current;
|
|
661
|
-
let e =
|
|
662
|
-
|
|
719
|
+
let e = Y(F.current[I.current]);
|
|
720
|
+
w(e), ue(e), de();
|
|
663
721
|
}
|
|
664
|
-
function
|
|
665
|
-
if (!
|
|
722
|
+
function he() {
|
|
723
|
+
if (!j.canRedo || u) return;
|
|
666
724
|
I.current += 1;
|
|
667
|
-
let e =
|
|
668
|
-
|
|
725
|
+
let e = Y(F.current[I.current]);
|
|
726
|
+
w(e), ue(e), de();
|
|
669
727
|
}
|
|
670
|
-
function
|
|
671
|
-
u ||
|
|
728
|
+
function ge() {
|
|
729
|
+
u || C.length === 0 || fe([]);
|
|
672
730
|
}
|
|
673
|
-
function
|
|
674
|
-
let
|
|
675
|
-
return
|
|
676
|
-
x:
|
|
677
|
-
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)
|
|
678
736
|
} : null;
|
|
679
737
|
}
|
|
680
|
-
function
|
|
681
|
-
if (u || !
|
|
682
|
-
let t =
|
|
738
|
+
function ve(e) {
|
|
739
|
+
if (u || !z && dt(e.target)) return;
|
|
740
|
+
let t = _e(e);
|
|
683
741
|
if (!t || !v) return;
|
|
684
742
|
if (v === "eraser") {
|
|
685
|
-
|
|
743
|
+
be(t);
|
|
686
744
|
return;
|
|
687
745
|
}
|
|
688
|
-
let n =
|
|
746
|
+
let n = ut(t, R);
|
|
689
747
|
if (v === "pen") {
|
|
690
|
-
L.current = n,
|
|
691
|
-
color:
|
|
692
|
-
id:
|
|
748
|
+
L.current = n, O({
|
|
749
|
+
color: oe,
|
|
750
|
+
id: le("freehand"),
|
|
693
751
|
points: [n.x, n.y],
|
|
694
752
|
strokeWidth: 4,
|
|
695
753
|
type: "freehand"
|
|
@@ -697,9 +755,9 @@ function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, classNa
|
|
|
697
755
|
return;
|
|
698
756
|
}
|
|
699
757
|
if (v === "line") {
|
|
700
|
-
L.current = n,
|
|
701
|
-
color:
|
|
702
|
-
id:
|
|
758
|
+
L.current = n, O({
|
|
759
|
+
color: oe,
|
|
760
|
+
id: le("line"),
|
|
703
761
|
points: [
|
|
704
762
|
n.x,
|
|
705
763
|
n.y,
|
|
@@ -711,34 +769,34 @@ function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, classNa
|
|
|
711
769
|
});
|
|
712
770
|
return;
|
|
713
771
|
}
|
|
714
|
-
v === "compass" && (L.current = n,
|
|
772
|
+
v === "compass" && (L.current = n, O({
|
|
715
773
|
center: n,
|
|
716
|
-
color:
|
|
717
|
-
id:
|
|
774
|
+
color: oe,
|
|
775
|
+
id: le("circle"),
|
|
718
776
|
radius: 1,
|
|
719
777
|
strokeWidth: 3,
|
|
720
778
|
type: "circle"
|
|
721
779
|
}));
|
|
722
780
|
}
|
|
723
|
-
function
|
|
724
|
-
let t =
|
|
781
|
+
function ye(e) {
|
|
782
|
+
let t = _e(e);
|
|
725
783
|
if (t) {
|
|
726
784
|
if (v === "eraser" && !u) {
|
|
727
|
-
|
|
785
|
+
be(t);
|
|
728
786
|
return;
|
|
729
787
|
}
|
|
730
|
-
if (!(!
|
|
731
|
-
if (
|
|
732
|
-
|
|
733
|
-
...
|
|
734
|
-
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])
|
|
735
793
|
});
|
|
736
794
|
return;
|
|
737
795
|
}
|
|
738
|
-
if (
|
|
739
|
-
let e =
|
|
740
|
-
|
|
741
|
-
...
|
|
796
|
+
if (D.type === "line") {
|
|
797
|
+
let e = ut(t, R);
|
|
798
|
+
O({
|
|
799
|
+
...D,
|
|
742
800
|
points: [
|
|
743
801
|
L.current.x,
|
|
744
802
|
L.current.y,
|
|
@@ -748,130 +806,130 @@ function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, classNa
|
|
|
748
806
|
});
|
|
749
807
|
return;
|
|
750
808
|
}
|
|
751
|
-
|
|
752
|
-
...
|
|
753
|
-
radius:
|
|
809
|
+
D.type === "circle" && O({
|
|
810
|
+
...D,
|
|
811
|
+
radius: X(D.center, t)
|
|
754
812
|
});
|
|
755
813
|
}
|
|
756
814
|
}
|
|
757
815
|
}
|
|
758
|
-
function
|
|
759
|
-
if (!
|
|
760
|
-
L.current = null,
|
|
816
|
+
function V() {
|
|
817
|
+
if (!D || u) {
|
|
818
|
+
L.current = null, O(null);
|
|
761
819
|
return;
|
|
762
820
|
}
|
|
763
|
-
let e =
|
|
764
|
-
if (L.current = null,
|
|
821
|
+
let e = D;
|
|
822
|
+
if (L.current = null, O(null), mt(e)) {
|
|
765
823
|
if (e.type === "circle") {
|
|
766
824
|
let t = {
|
|
767
|
-
...
|
|
825
|
+
...T,
|
|
768
826
|
compass: {
|
|
769
827
|
center: e.center,
|
|
770
828
|
radius: e.radius
|
|
771
829
|
}
|
|
772
830
|
};
|
|
773
|
-
|
|
831
|
+
E(t), fe(C.concat(e), t);
|
|
774
832
|
return;
|
|
775
833
|
}
|
|
776
|
-
|
|
834
|
+
fe(C.concat(e));
|
|
777
835
|
}
|
|
778
836
|
}
|
|
779
|
-
function
|
|
780
|
-
if (
|
|
781
|
-
let t =
|
|
782
|
-
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));
|
|
783
841
|
}
|
|
784
|
-
return /* @__PURE__ */
|
|
785
|
-
className:
|
|
842
|
+
return /* @__PURE__ */ s("div", {
|
|
843
|
+
className: ie,
|
|
786
844
|
"data-disabled": u ? "true" : "false",
|
|
787
845
|
dir: "rtl",
|
|
788
846
|
children: [
|
|
789
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ o("div", {
|
|
790
848
|
className: "geometry-toolbar",
|
|
791
849
|
"aria-label": "أَدَواتُ الوَرَقَةِ المُسَوَّدَةِ",
|
|
792
|
-
children:
|
|
793
|
-
"aria-pressed":
|
|
850
|
+
children: Ye.map((e) => /* @__PURE__ */ s("button", {
|
|
851
|
+
"aria-pressed": B(e.id),
|
|
794
852
|
className: [
|
|
795
853
|
"geometry-tool-button",
|
|
796
|
-
|
|
797
|
-
|
|
854
|
+
B(e.id) ? "geometry-tool-button--active" : "",
|
|
855
|
+
Xe.has(e.id) ? "geometry-tool-button--guide" : ""
|
|
798
856
|
].filter(Boolean).join(" "),
|
|
799
857
|
disabled: u,
|
|
800
|
-
onClick: () =>
|
|
858
|
+
onClick: () => ce(e.id),
|
|
801
859
|
type: "button",
|
|
802
|
-
children: [/* @__PURE__ */
|
|
860
|
+
children: [/* @__PURE__ */ o("span", {
|
|
803
861
|
"aria-hidden": "true",
|
|
804
862
|
children: e.icon
|
|
805
|
-
}), /* @__PURE__ */
|
|
863
|
+
}), /* @__PURE__ */ o("span", { children: e.label })]
|
|
806
864
|
}, e.id))
|
|
807
865
|
}),
|
|
808
|
-
m ? /* @__PURE__ */
|
|
866
|
+
m ? /* @__PURE__ */ o(ze, {
|
|
809
867
|
ariaLabel: "أَلْوانُ الأَقْلامِ",
|
|
810
868
|
className: "geometry-color-picker",
|
|
811
869
|
colors: _,
|
|
812
870
|
disabled: u,
|
|
813
|
-
onChange:
|
|
814
|
-
selectedColorId:
|
|
871
|
+
onChange: ee,
|
|
872
|
+
selectedColorId: ae
|
|
815
873
|
}) : null,
|
|
816
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ o("div", {
|
|
817
875
|
className: "geometry-stage-shell",
|
|
818
|
-
ref:
|
|
819
|
-
children: /* @__PURE__ */
|
|
820
|
-
height:
|
|
821
|
-
onMouseDown:
|
|
822
|
-
onMouseLeave:
|
|
823
|
-
onMouseMove:
|
|
824
|
-
onMouseUp:
|
|
825
|
-
onTouchEnd:
|
|
826
|
-
onTouchMove:
|
|
827
|
-
onTouchStart:
|
|
828
|
-
width:
|
|
829
|
-
children: /* @__PURE__ */
|
|
830
|
-
scaleX:
|
|
831
|
-
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,
|
|
832
890
|
children: [
|
|
833
|
-
/* @__PURE__ */
|
|
891
|
+
/* @__PURE__ */ o(N, {
|
|
834
892
|
fill: "#fff",
|
|
835
893
|
height: t,
|
|
836
894
|
stroke: "#bad3c8",
|
|
837
895
|
strokeWidth: 1,
|
|
838
|
-
width:
|
|
896
|
+
width: n
|
|
839
897
|
}),
|
|
840
|
-
/* @__PURE__ */
|
|
898
|
+
/* @__PURE__ */ o($e, {
|
|
841
899
|
canvasHeight: t,
|
|
842
|
-
canvasWidth:
|
|
900
|
+
canvasWidth: n
|
|
843
901
|
}),
|
|
844
|
-
p.map((e,
|
|
845
|
-
label:
|
|
846
|
-
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,
|
|
847
905
|
y: e.y / 100 * t
|
|
848
906
|
}, e.id)),
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
b.includes("ruler") ? /* @__PURE__ */
|
|
907
|
+
C.map((e) => at(e)),
|
|
908
|
+
D ? at(D, !0) : null,
|
|
909
|
+
b.includes("ruler") ? /* @__PURE__ */ o(nt, {
|
|
852
910
|
disabled: u,
|
|
853
|
-
guide:
|
|
854
|
-
locked:
|
|
855
|
-
onCommit: (e) =>
|
|
856
|
-
...
|
|
911
|
+
guide: T.ruler,
|
|
912
|
+
locked: z,
|
|
913
|
+
onCommit: (e) => pe({
|
|
914
|
+
...T,
|
|
857
915
|
ruler: e
|
|
858
916
|
})
|
|
859
|
-
}) : null,
|
|
860
|
-
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, {
|
|
861
919
|
disabled: u,
|
|
862
|
-
guide:
|
|
863
|
-
locked:
|
|
864
|
-
onChange: (e) =>
|
|
865
|
-
...
|
|
920
|
+
guide: T.protractor,
|
|
921
|
+
locked: z,
|
|
922
|
+
onChange: (e) => pe({
|
|
923
|
+
...T,
|
|
866
924
|
protractor: e
|
|
867
925
|
})
|
|
868
926
|
}) : null,
|
|
869
|
-
b.includes("compass") ? /* @__PURE__ */
|
|
927
|
+
b.includes("compass") ? /* @__PURE__ */ o(it, {
|
|
870
928
|
disabled: u,
|
|
871
|
-
guide:
|
|
872
|
-
locked:
|
|
873
|
-
onChange: (e) =>
|
|
874
|
-
...
|
|
929
|
+
guide: T.compass,
|
|
930
|
+
locked: z,
|
|
931
|
+
onChange: (e) => pe({
|
|
932
|
+
...T,
|
|
875
933
|
compass: e
|
|
876
934
|
})
|
|
877
935
|
}) : null
|
|
@@ -879,25 +937,25 @@ function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, classNa
|
|
|
879
937
|
})
|
|
880
938
|
})
|
|
881
939
|
}),
|
|
882
|
-
/* @__PURE__ */
|
|
940
|
+
/* @__PURE__ */ s("div", {
|
|
883
941
|
className: "geometry-actions",
|
|
884
942
|
children: [
|
|
885
|
-
e ? /* @__PURE__ */
|
|
886
|
-
/* @__PURE__ */
|
|
887
|
-
disabled: !
|
|
888
|
-
onClick:
|
|
943
|
+
e ? /* @__PURE__ */ o("span", { children: e }) : null,
|
|
944
|
+
/* @__PURE__ */ o("button", {
|
|
945
|
+
disabled: !j.canUndo || u,
|
|
946
|
+
onClick: me,
|
|
889
947
|
type: "button",
|
|
890
948
|
children: "تَراجُعٌ"
|
|
891
949
|
}),
|
|
892
|
-
/* @__PURE__ */
|
|
893
|
-
disabled: !
|
|
894
|
-
onClick:
|
|
950
|
+
/* @__PURE__ */ o("button", {
|
|
951
|
+
disabled: !j.canRedo || u,
|
|
952
|
+
onClick: he,
|
|
895
953
|
type: "button",
|
|
896
954
|
children: "إِعادَةٌ"
|
|
897
955
|
}),
|
|
898
|
-
/* @__PURE__ */
|
|
899
|
-
disabled:
|
|
900
|
-
onClick:
|
|
956
|
+
/* @__PURE__ */ o("button", {
|
|
957
|
+
disabled: C.length === 0 || u,
|
|
958
|
+
onClick: ge,
|
|
901
959
|
type: "button",
|
|
902
960
|
children: "مَسْحٌ"
|
|
903
961
|
})
|
|
@@ -906,10 +964,10 @@ function je({ actionLabel: e, canvasHeight: t = Te, canvasWidth: i = we, classNa
|
|
|
906
964
|
]
|
|
907
965
|
});
|
|
908
966
|
}
|
|
909
|
-
function
|
|
910
|
-
|
|
911
|
-
let
|
|
912
|
-
if (!
|
|
967
|
+
function Qe(e, n, r, i, a) {
|
|
968
|
+
t(() => {
|
|
969
|
+
let t = e.current;
|
|
970
|
+
if (!t) return;
|
|
913
971
|
let o = (e) => {
|
|
914
972
|
let t = Math.min(n, Math.max(1, e > 0 ? e : i)), o = t / n;
|
|
915
973
|
a({
|
|
@@ -918,75 +976,75 @@ function Me(t, n, r, i, a) {
|
|
|
918
976
|
width: t
|
|
919
977
|
});
|
|
920
978
|
};
|
|
921
|
-
o(
|
|
979
|
+
o(t.clientWidth);
|
|
922
980
|
let s = new ResizeObserver((e) => {
|
|
923
981
|
let t = e[0];
|
|
924
982
|
t && o(t.contentRect.width);
|
|
925
983
|
});
|
|
926
|
-
return s.observe(
|
|
984
|
+
return s.observe(t), () => s.disconnect();
|
|
927
985
|
}, [
|
|
928
986
|
r,
|
|
929
|
-
|
|
987
|
+
e,
|
|
930
988
|
n,
|
|
931
989
|
i,
|
|
932
990
|
a
|
|
933
991
|
]);
|
|
934
992
|
}
|
|
935
|
-
function
|
|
936
|
-
let n = Math.floor(t /
|
|
937
|
-
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, {
|
|
938
996
|
points: [
|
|
939
|
-
n *
|
|
997
|
+
n * q,
|
|
940
998
|
0,
|
|
941
|
-
n *
|
|
999
|
+
n * q,
|
|
942
1000
|
e
|
|
943
1001
|
],
|
|
944
1002
|
stroke: "#d2ded8",
|
|
945
1003
|
strokeWidth: 1
|
|
946
|
-
}, `vertical-${n}`)), Array.from({ length: r + 1 }, (e, n) => /* @__PURE__ */
|
|
1004
|
+
}, `vertical-${n}`)), Array.from({ length: r + 1 }, (e, n) => /* @__PURE__ */ o(M, {
|
|
947
1005
|
points: [
|
|
948
1006
|
0,
|
|
949
|
-
n *
|
|
1007
|
+
n * q,
|
|
950
1008
|
t,
|
|
951
|
-
n *
|
|
1009
|
+
n * q
|
|
952
1010
|
],
|
|
953
1011
|
stroke: "#d2ded8",
|
|
954
1012
|
strokeWidth: 1
|
|
955
1013
|
}, `horizontal-${n}`))] });
|
|
956
1014
|
}
|
|
957
|
-
function
|
|
958
|
-
return /* @__PURE__ */
|
|
1015
|
+
function et({ label: e, x: t, y: n }) {
|
|
1016
|
+
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(A, {
|
|
959
1017
|
fill: "#e63542",
|
|
960
|
-
radius:
|
|
961
|
-
shadowBlur:
|
|
1018
|
+
radius: 4.75,
|
|
1019
|
+
shadowBlur: 5,
|
|
962
1020
|
shadowColor: "rgba(230, 53, 66, 0.28)",
|
|
963
1021
|
stroke: "#fff",
|
|
964
|
-
strokeWidth:
|
|
1022
|
+
strokeWidth: 1.7,
|
|
965
1023
|
x: t,
|
|
966
1024
|
y: n
|
|
967
|
-
}), /* @__PURE__ */
|
|
1025
|
+
}), /* @__PURE__ */ o(P, {
|
|
968
1026
|
fill: "#111",
|
|
969
|
-
fontSize:
|
|
1027
|
+
fontSize: 14,
|
|
970
1028
|
fontStyle: "bold",
|
|
971
1029
|
text: e,
|
|
972
|
-
x: t +
|
|
973
|
-
y: n -
|
|
1030
|
+
x: t + 8,
|
|
1031
|
+
y: n - 18
|
|
974
1032
|
})] });
|
|
975
1033
|
}
|
|
976
|
-
function
|
|
977
|
-
let
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
let
|
|
982
|
-
function
|
|
983
|
-
|
|
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);
|
|
984
1042
|
}
|
|
985
|
-
function
|
|
1043
|
+
function y(e) {
|
|
986
1044
|
e.cancelBubble = !0;
|
|
987
|
-
let t =
|
|
988
|
-
t && (
|
|
989
|
-
...
|
|
1045
|
+
let t = pt(e);
|
|
1046
|
+
t && (v({
|
|
1047
|
+
...d.current,
|
|
990
1048
|
x: t.x,
|
|
991
1049
|
y: t.y
|
|
992
1050
|
}), e.currentTarget.position({
|
|
@@ -994,61 +1052,61 @@ function Fe({ disabled: t, guide: s, locked: c, onCommit: l }) {
|
|
|
994
1052
|
y: 0
|
|
995
1053
|
}));
|
|
996
1054
|
}
|
|
997
|
-
function
|
|
1055
|
+
function b(e) {
|
|
998
1056
|
e.cancelBubble = !0, e.currentTarget.position({
|
|
999
1057
|
x: 0,
|
|
1000
1058
|
y: 0
|
|
1001
|
-
}),
|
|
1059
|
+
}), c(d.current);
|
|
1002
1060
|
}
|
|
1003
|
-
function
|
|
1061
|
+
function x(e, t) {
|
|
1004
1062
|
e.cancelBubble = !0;
|
|
1005
|
-
let n =
|
|
1006
|
-
n && (
|
|
1063
|
+
let n = pt(e);
|
|
1064
|
+
n && (v(bt(d.current, n, t)), e.currentTarget.position({
|
|
1007
1065
|
x: 0,
|
|
1008
1066
|
y: 0
|
|
1009
1067
|
}));
|
|
1010
1068
|
}
|
|
1011
|
-
function
|
|
1069
|
+
function S() {
|
|
1012
1070
|
let e = {
|
|
1013
|
-
...
|
|
1014
|
-
rotation:
|
|
1071
|
+
...d.current,
|
|
1072
|
+
rotation: Ct(d.current.rotation + 90)
|
|
1015
1073
|
};
|
|
1016
|
-
|
|
1074
|
+
v(e), c(e);
|
|
1017
1075
|
}
|
|
1018
|
-
return /* @__PURE__ */ a
|
|
1019
|
-
listening:
|
|
1076
|
+
return /* @__PURE__ */ o(a, { children: /* @__PURE__ */ s(j, {
|
|
1077
|
+
listening: _,
|
|
1020
1078
|
name: "geometry-guide",
|
|
1021
|
-
onDblClick:
|
|
1022
|
-
onDblTap:
|
|
1023
|
-
rotation:
|
|
1024
|
-
x:
|
|
1025
|
-
y:
|
|
1079
|
+
onDblClick: S,
|
|
1080
|
+
onDblTap: S,
|
|
1081
|
+
rotation: l.rotation,
|
|
1082
|
+
x: l.x,
|
|
1083
|
+
y: l.y,
|
|
1026
1084
|
children: [
|
|
1027
|
-
/* @__PURE__ */
|
|
1085
|
+
/* @__PURE__ */ o(N, {
|
|
1028
1086
|
cornerRadius: 7,
|
|
1029
1087
|
fill: "rgba(14, 173, 100, 0.13)",
|
|
1030
1088
|
height: 38,
|
|
1031
1089
|
listening: !1,
|
|
1032
|
-
offsetX:
|
|
1090
|
+
offsetX: l.length / 2,
|
|
1033
1091
|
offsetY: 38 / 2,
|
|
1034
|
-
stroke:
|
|
1092
|
+
stroke: J,
|
|
1035
1093
|
strokeWidth: 2,
|
|
1036
|
-
width:
|
|
1094
|
+
width: l.length
|
|
1037
1095
|
}),
|
|
1038
|
-
/* @__PURE__ */
|
|
1096
|
+
/* @__PURE__ */ o(M, {
|
|
1039
1097
|
points: [
|
|
1040
|
-
-
|
|
1098
|
+
-l.length / 2 + 12,
|
|
1041
1099
|
0,
|
|
1042
|
-
|
|
1100
|
+
l.length / 2 - 12,
|
|
1043
1101
|
0
|
|
1044
1102
|
],
|
|
1045
1103
|
listening: !1,
|
|
1046
|
-
stroke:
|
|
1104
|
+
stroke: J,
|
|
1047
1105
|
strokeWidth: 2
|
|
1048
1106
|
}),
|
|
1049
|
-
Array.from({ length: Math.floor(
|
|
1050
|
-
let n = -
|
|
1051
|
-
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, {
|
|
1052
1110
|
listening: !1,
|
|
1053
1111
|
points: [
|
|
1054
1112
|
n,
|
|
@@ -1056,94 +1114,94 @@ function Fe({ disabled: t, guide: s, locked: c, onCommit: l }) {
|
|
|
1056
1114
|
n,
|
|
1057
1115
|
r ? 4 : 10
|
|
1058
1116
|
],
|
|
1059
|
-
stroke:
|
|
1117
|
+
stroke: J,
|
|
1060
1118
|
strokeWidth: r ? 1.5 : 1
|
|
1061
1119
|
}, t);
|
|
1062
1120
|
}),
|
|
1063
|
-
/* @__PURE__ */
|
|
1121
|
+
/* @__PURE__ */ o(M, {
|
|
1064
1122
|
dash: [7, 7],
|
|
1065
1123
|
listening: !1,
|
|
1066
1124
|
opacity: .72,
|
|
1067
1125
|
points: [
|
|
1068
|
-
|
|
1126
|
+
h,
|
|
1069
1127
|
0,
|
|
1070
|
-
|
|
1128
|
+
p,
|
|
1071
1129
|
0
|
|
1072
1130
|
],
|
|
1073
|
-
stroke:
|
|
1131
|
+
stroke: J,
|
|
1074
1132
|
strokeWidth: 2
|
|
1075
1133
|
}),
|
|
1076
|
-
/* @__PURE__ */
|
|
1134
|
+
/* @__PURE__ */ o(M, {
|
|
1077
1135
|
dash: [7, 7],
|
|
1078
1136
|
listening: !1,
|
|
1079
1137
|
opacity: .72,
|
|
1080
1138
|
points: [
|
|
1081
|
-
|
|
1139
|
+
g,
|
|
1082
1140
|
0,
|
|
1083
|
-
|
|
1141
|
+
m,
|
|
1084
1142
|
0
|
|
1085
1143
|
],
|
|
1086
|
-
stroke:
|
|
1144
|
+
stroke: J,
|
|
1087
1145
|
strokeWidth: 2
|
|
1088
1146
|
}),
|
|
1089
|
-
/* @__PURE__ */
|
|
1090
|
-
draggable:
|
|
1147
|
+
/* @__PURE__ */ o(j, {
|
|
1148
|
+
draggable: _,
|
|
1091
1149
|
name: "geometry-guide",
|
|
1092
|
-
onDblClick:
|
|
1093
|
-
onDblTap:
|
|
1094
|
-
onDragEnd:
|
|
1095
|
-
onDragMove: (e) =>
|
|
1096
|
-
children: /* @__PURE__ */
|
|
1150
|
+
onDblClick: S,
|
|
1151
|
+
onDblTap: S,
|
|
1152
|
+
onDragEnd: b,
|
|
1153
|
+
onDragMove: (e) => x(e, "right"),
|
|
1154
|
+
children: /* @__PURE__ */ o(N, {
|
|
1097
1155
|
fill: "rgba(255, 255, 255, 0.01)",
|
|
1098
1156
|
height: 106,
|
|
1099
1157
|
offsetY: 53,
|
|
1100
|
-
width:
|
|
1158
|
+
width: p + 24,
|
|
1101
1159
|
x: 0
|
|
1102
1160
|
})
|
|
1103
1161
|
}),
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
draggable:
|
|
1162
|
+
/* @__PURE__ */ o(j, {
|
|
1163
|
+
draggable: _,
|
|
1106
1164
|
name: "geometry-guide",
|
|
1107
|
-
onDblClick:
|
|
1108
|
-
onDblTap:
|
|
1109
|
-
onDragEnd:
|
|
1110
|
-
onDragMove: (e) =>
|
|
1111
|
-
children: /* @__PURE__ */
|
|
1165
|
+
onDblClick: S,
|
|
1166
|
+
onDblTap: S,
|
|
1167
|
+
onDragEnd: b,
|
|
1168
|
+
onDragMove: (e) => x(e, "left"),
|
|
1169
|
+
children: /* @__PURE__ */ o(N, {
|
|
1112
1170
|
fill: "rgba(255, 255, 255, 0.01)",
|
|
1113
1171
|
height: 106,
|
|
1114
1172
|
offsetY: 53,
|
|
1115
|
-
width: Math.abs(
|
|
1116
|
-
x:
|
|
1173
|
+
width: Math.abs(m) + 24,
|
|
1174
|
+
x: m - 24
|
|
1117
1175
|
})
|
|
1118
1176
|
}),
|
|
1119
|
-
/* @__PURE__ */
|
|
1177
|
+
/* @__PURE__ */ o(A, {
|
|
1120
1178
|
fill: "#f7fffb",
|
|
1121
1179
|
listening: !1,
|
|
1122
1180
|
radius: 16,
|
|
1123
1181
|
shadowBlur: 10,
|
|
1124
1182
|
shadowColor: "rgba(10, 143, 85, 0.35)",
|
|
1125
|
-
stroke:
|
|
1183
|
+
stroke: J,
|
|
1126
1184
|
strokeWidth: 4,
|
|
1127
|
-
x:
|
|
1185
|
+
x: p,
|
|
1128
1186
|
y: 0
|
|
1129
1187
|
}),
|
|
1130
|
-
/* @__PURE__ */
|
|
1188
|
+
/* @__PURE__ */ o(A, {
|
|
1131
1189
|
fill: "#f7fffb",
|
|
1132
1190
|
listening: !1,
|
|
1133
1191
|
radius: 16,
|
|
1134
1192
|
shadowBlur: 10,
|
|
1135
1193
|
shadowColor: "rgba(10, 143, 85, 0.35)",
|
|
1136
|
-
stroke:
|
|
1194
|
+
stroke: J,
|
|
1137
1195
|
strokeWidth: 4,
|
|
1138
|
-
x:
|
|
1196
|
+
x: m,
|
|
1139
1197
|
y: 0
|
|
1140
1198
|
}),
|
|
1141
|
-
/* @__PURE__ */
|
|
1142
|
-
draggable:
|
|
1199
|
+
/* @__PURE__ */ s(j, {
|
|
1200
|
+
draggable: _,
|
|
1143
1201
|
name: "geometry-guide",
|
|
1144
|
-
onDragEnd:
|
|
1145
|
-
onDragMove:
|
|
1146
|
-
children: [/* @__PURE__ */
|
|
1202
|
+
onDragEnd: b,
|
|
1203
|
+
onDragMove: y,
|
|
1204
|
+
children: [/* @__PURE__ */ o(N, {
|
|
1147
1205
|
cornerRadius: 13,
|
|
1148
1206
|
fill: "#ffffff",
|
|
1149
1207
|
height: 26,
|
|
@@ -1151,14 +1209,14 @@ function Fe({ disabled: t, guide: s, locked: c, onCommit: l }) {
|
|
|
1151
1209
|
offsetY: 13,
|
|
1152
1210
|
shadowBlur: 8,
|
|
1153
1211
|
shadowColor: "rgba(10, 143, 85, 0.2)",
|
|
1154
|
-
stroke:
|
|
1212
|
+
stroke: J,
|
|
1155
1213
|
strokeWidth: 2,
|
|
1156
1214
|
width: 70
|
|
1157
1215
|
}), [
|
|
1158
1216
|
-14,
|
|
1159
1217
|
0,
|
|
1160
1218
|
14
|
|
1161
|
-
].map((e) => /* @__PURE__ */
|
|
1219
|
+
].map((e) => /* @__PURE__ */ o(M, {
|
|
1162
1220
|
lineCap: "round",
|
|
1163
1221
|
points: [
|
|
1164
1222
|
e,
|
|
@@ -1166,24 +1224,24 @@ function Fe({ disabled: t, guide: s, locked: c, onCommit: l }) {
|
|
|
1166
1224
|
e,
|
|
1167
1225
|
7
|
|
1168
1226
|
],
|
|
1169
|
-
stroke:
|
|
1227
|
+
stroke: J,
|
|
1170
1228
|
strokeWidth: 2
|
|
1171
1229
|
}, e))]
|
|
1172
1230
|
})
|
|
1173
1231
|
]
|
|
1174
1232
|
}) });
|
|
1175
1233
|
}
|
|
1176
|
-
function
|
|
1177
|
-
let
|
|
1234
|
+
function rt({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
1235
|
+
let i = !e && !n, c = vt({
|
|
1178
1236
|
x: 136,
|
|
1179
1237
|
y: 0
|
|
1180
1238
|
}, t.rotation, {
|
|
1181
1239
|
x: t.x,
|
|
1182
1240
|
y: t.y
|
|
1183
1241
|
});
|
|
1184
|
-
return /* @__PURE__ */
|
|
1185
|
-
draggable:
|
|
1186
|
-
listening:
|
|
1242
|
+
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ s(j, {
|
|
1243
|
+
draggable: i,
|
|
1244
|
+
listening: i,
|
|
1187
1245
|
name: "geometry-guide",
|
|
1188
1246
|
onDragMove: (e) => r({
|
|
1189
1247
|
...t,
|
|
@@ -1194,41 +1252,41 @@ function Ie({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
|
1194
1252
|
x: t.x,
|
|
1195
1253
|
y: t.y,
|
|
1196
1254
|
children: [
|
|
1197
|
-
/* @__PURE__ */
|
|
1255
|
+
/* @__PURE__ */ o(k, {
|
|
1198
1256
|
angle: 180,
|
|
1199
1257
|
fill: "rgba(14, 173, 100, 0.11)",
|
|
1200
1258
|
innerRadius: 0,
|
|
1201
1259
|
outerRadius: 110,
|
|
1202
1260
|
rotation: 180,
|
|
1203
|
-
stroke:
|
|
1261
|
+
stroke: J,
|
|
1204
1262
|
strokeWidth: 2
|
|
1205
1263
|
}),
|
|
1206
|
-
/* @__PURE__ */
|
|
1264
|
+
/* @__PURE__ */ o(M, {
|
|
1207
1265
|
points: [
|
|
1208
1266
|
-110,
|
|
1209
1267
|
0,
|
|
1210
1268
|
110,
|
|
1211
1269
|
0
|
|
1212
1270
|
],
|
|
1213
|
-
stroke:
|
|
1271
|
+
stroke: J,
|
|
1214
1272
|
strokeWidth: 2
|
|
1215
1273
|
}),
|
|
1216
1274
|
Array.from({ length: 19 }, (e, t) => {
|
|
1217
1275
|
let n = t * 10, r = (180 - n) * Math.PI / 180, i = {
|
|
1218
1276
|
x: Math.cos(r) * 110,
|
|
1219
1277
|
y: -Math.sin(r) * 110
|
|
1220
|
-
},
|
|
1278
|
+
}, a = {
|
|
1221
1279
|
x: Math.cos(r) * (t % 3 == 0 ? 92 : 100),
|
|
1222
1280
|
y: -Math.sin(r) * (t % 3 == 0 ? 92 : 100)
|
|
1223
1281
|
};
|
|
1224
|
-
return /* @__PURE__ */
|
|
1282
|
+
return /* @__PURE__ */ o(M, {
|
|
1225
1283
|
points: [
|
|
1226
|
-
|
|
1227
|
-
|
|
1284
|
+
a.x,
|
|
1285
|
+
a.y,
|
|
1228
1286
|
i.x,
|
|
1229
1287
|
i.y
|
|
1230
1288
|
],
|
|
1231
|
-
stroke:
|
|
1289
|
+
stroke: J,
|
|
1232
1290
|
strokeWidth: t % 3 == 0 ? 1.4 : 1
|
|
1233
1291
|
}, n);
|
|
1234
1292
|
}),
|
|
@@ -1238,8 +1296,8 @@ function Ie({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
|
1238
1296
|
180
|
|
1239
1297
|
].map((e) => {
|
|
1240
1298
|
let t = (180 - e) * Math.PI / 180;
|
|
1241
|
-
return /* @__PURE__ */
|
|
1242
|
-
fill:
|
|
1299
|
+
return /* @__PURE__ */ o(P, {
|
|
1300
|
+
fill: J,
|
|
1243
1301
|
fontSize: 12,
|
|
1244
1302
|
fontStyle: "bold",
|
|
1245
1303
|
text: `${e}`,
|
|
@@ -1248,10 +1306,10 @@ function Ie({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
|
1248
1306
|
}, e);
|
|
1249
1307
|
})
|
|
1250
1308
|
]
|
|
1251
|
-
}), /* @__PURE__ */
|
|
1252
|
-
draggable:
|
|
1309
|
+
}), /* @__PURE__ */ o(A, {
|
|
1310
|
+
draggable: i,
|
|
1253
1311
|
fill: "#fff",
|
|
1254
|
-
listening:
|
|
1312
|
+
listening: i,
|
|
1255
1313
|
name: "geometry-guide",
|
|
1256
1314
|
onDragMove: (e) => {
|
|
1257
1315
|
let n = e.target.position();
|
|
@@ -1261,30 +1319,30 @@ function Ie({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
|
1261
1319
|
});
|
|
1262
1320
|
},
|
|
1263
1321
|
radius: 10,
|
|
1264
|
-
stroke:
|
|
1322
|
+
stroke: J,
|
|
1265
1323
|
strokeWidth: 3,
|
|
1266
1324
|
x: c.x,
|
|
1267
1325
|
y: c.y
|
|
1268
1326
|
})] });
|
|
1269
1327
|
}
|
|
1270
|
-
function
|
|
1271
|
-
let
|
|
1328
|
+
function it({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
1329
|
+
let i = !e && !n, c = {
|
|
1272
1330
|
x: t.center.x + t.radius,
|
|
1273
1331
|
y: t.center.y
|
|
1274
1332
|
}, l = {
|
|
1275
1333
|
x: t.center.x + t.radius / 2,
|
|
1276
1334
|
y: t.center.y - Math.min(90, Math.max(34, t.radius * .68))
|
|
1277
1335
|
};
|
|
1278
|
-
return /* @__PURE__ */
|
|
1279
|
-
/* @__PURE__ */
|
|
1336
|
+
return /* @__PURE__ */ s(a, { children: [
|
|
1337
|
+
/* @__PURE__ */ o(A, {
|
|
1280
1338
|
dash: [8, 8],
|
|
1281
1339
|
radius: t.radius,
|
|
1282
|
-
stroke:
|
|
1340
|
+
stroke: J,
|
|
1283
1341
|
strokeWidth: 2,
|
|
1284
1342
|
x: t.center.x,
|
|
1285
1343
|
y: t.center.y
|
|
1286
1344
|
}),
|
|
1287
|
-
/* @__PURE__ */
|
|
1345
|
+
/* @__PURE__ */ o(M, {
|
|
1288
1346
|
dash: [8, 8],
|
|
1289
1347
|
points: [
|
|
1290
1348
|
t.center.x,
|
|
@@ -1292,10 +1350,10 @@ function Le({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
|
1292
1350
|
c.x,
|
|
1293
1351
|
c.y
|
|
1294
1352
|
],
|
|
1295
|
-
stroke:
|
|
1353
|
+
stroke: J,
|
|
1296
1354
|
strokeWidth: 2
|
|
1297
1355
|
}),
|
|
1298
|
-
/* @__PURE__ */
|
|
1356
|
+
/* @__PURE__ */ o(M, {
|
|
1299
1357
|
lineCap: "round",
|
|
1300
1358
|
lineJoin: "round",
|
|
1301
1359
|
points: [
|
|
@@ -1306,55 +1364,55 @@ function Le({ disabled: e, guide: t, locked: n, onChange: r }) {
|
|
|
1306
1364
|
c.x,
|
|
1307
1365
|
c.y
|
|
1308
1366
|
],
|
|
1309
|
-
stroke:
|
|
1367
|
+
stroke: J,
|
|
1310
1368
|
strokeWidth: 4
|
|
1311
1369
|
}),
|
|
1312
|
-
/* @__PURE__ */
|
|
1370
|
+
/* @__PURE__ */ o(A, {
|
|
1313
1371
|
fill: "#fff",
|
|
1314
1372
|
radius: 8,
|
|
1315
|
-
stroke:
|
|
1373
|
+
stroke: J,
|
|
1316
1374
|
strokeWidth: 3,
|
|
1317
1375
|
x: l.x,
|
|
1318
1376
|
y: l.y
|
|
1319
1377
|
}),
|
|
1320
|
-
/* @__PURE__ */
|
|
1321
|
-
draggable:
|
|
1378
|
+
/* @__PURE__ */ o(A, {
|
|
1379
|
+
draggable: i,
|
|
1322
1380
|
fill: "#fff",
|
|
1323
|
-
listening:
|
|
1381
|
+
listening: i,
|
|
1324
1382
|
name: "geometry-guide",
|
|
1325
1383
|
onDragMove: (e) => r({
|
|
1326
1384
|
...t,
|
|
1327
1385
|
center: e.target.position()
|
|
1328
1386
|
}),
|
|
1329
1387
|
radius: 11,
|
|
1330
|
-
stroke:
|
|
1388
|
+
stroke: J,
|
|
1331
1389
|
strokeWidth: 3,
|
|
1332
1390
|
x: t.center.x,
|
|
1333
1391
|
y: t.center.y
|
|
1334
1392
|
}),
|
|
1335
|
-
/* @__PURE__ */
|
|
1336
|
-
draggable:
|
|
1393
|
+
/* @__PURE__ */ o(A, {
|
|
1394
|
+
draggable: i,
|
|
1337
1395
|
fill: "#fff",
|
|
1338
|
-
listening:
|
|
1396
|
+
listening: i,
|
|
1339
1397
|
name: "geometry-guide",
|
|
1340
1398
|
onDragMove: (e) => {
|
|
1341
1399
|
let n = e.target.position();
|
|
1342
1400
|
r({
|
|
1343
1401
|
...t,
|
|
1344
|
-
radius: Math.max(14,
|
|
1402
|
+
radius: Math.max(14, X(t.center, n))
|
|
1345
1403
|
});
|
|
1346
1404
|
},
|
|
1347
1405
|
radius: 9,
|
|
1348
|
-
stroke:
|
|
1406
|
+
stroke: J,
|
|
1349
1407
|
strokeWidth: 3,
|
|
1350
1408
|
x: c.x,
|
|
1351
1409
|
y: c.y
|
|
1352
1410
|
})
|
|
1353
1411
|
] });
|
|
1354
1412
|
}
|
|
1355
|
-
function
|
|
1413
|
+
function at(e, t = !1) {
|
|
1356
1414
|
let n = t ? .58 : 1;
|
|
1357
|
-
return e.type === "freehand" ? /* @__PURE__ */
|
|
1415
|
+
return e.type === "freehand" ? /* @__PURE__ */ o(M, {
|
|
1358
1416
|
lineCap: "round",
|
|
1359
1417
|
lineJoin: "round",
|
|
1360
1418
|
opacity: n,
|
|
@@ -1362,13 +1420,13 @@ function Re(e, t = !1) {
|
|
|
1362
1420
|
stroke: e.color,
|
|
1363
1421
|
strokeWidth: e.strokeWidth,
|
|
1364
1422
|
tension: .45
|
|
1365
|
-
}, e.id) : e.type === "line" ? /* @__PURE__ */
|
|
1423
|
+
}, e.id) : e.type === "line" ? /* @__PURE__ */ o(M, {
|
|
1366
1424
|
lineCap: "round",
|
|
1367
1425
|
opacity: n,
|
|
1368
1426
|
points: e.points,
|
|
1369
1427
|
stroke: e.color,
|
|
1370
1428
|
strokeWidth: e.strokeWidth
|
|
1371
|
-
}, e.id) : /* @__PURE__ */
|
|
1429
|
+
}, e.id) : /* @__PURE__ */ o(A, {
|
|
1372
1430
|
opacity: n,
|
|
1373
1431
|
radius: e.radius,
|
|
1374
1432
|
stroke: e.color,
|
|
@@ -1377,7 +1435,7 @@ function Re(e, t = !1) {
|
|
|
1377
1435
|
y: e.center.y
|
|
1378
1436
|
}, e.id);
|
|
1379
1437
|
}
|
|
1380
|
-
function
|
|
1438
|
+
function ot(e, t) {
|
|
1381
1439
|
return {
|
|
1382
1440
|
compass: {
|
|
1383
1441
|
center: {
|
|
@@ -1399,16 +1457,16 @@ function ze(e, t) {
|
|
|
1399
1457
|
}
|
|
1400
1458
|
};
|
|
1401
1459
|
}
|
|
1402
|
-
function
|
|
1403
|
-
return e?.elements?.length ?
|
|
1404
|
-
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,
|
|
1405
1463
|
id: e.id,
|
|
1406
1464
|
points: e.points.slice(),
|
|
1407
1465
|
strokeWidth: 4,
|
|
1408
1466
|
type: "freehand"
|
|
1409
1467
|
}));
|
|
1410
1468
|
}
|
|
1411
|
-
function
|
|
1469
|
+
function ct(e) {
|
|
1412
1470
|
return e.flatMap((e) => e.type === "freehand" ? [{
|
|
1413
1471
|
id: e.id,
|
|
1414
1472
|
points: e.points.slice(),
|
|
@@ -1419,7 +1477,7 @@ function Ve(e) {
|
|
|
1419
1477
|
tool: "pen"
|
|
1420
1478
|
}] : []);
|
|
1421
1479
|
}
|
|
1422
|
-
function
|
|
1480
|
+
function Y(e) {
|
|
1423
1481
|
return e.map((e) => e.type === "freehand" ? {
|
|
1424
1482
|
...e,
|
|
1425
1483
|
points: e.points.slice()
|
|
@@ -1436,25 +1494,25 @@ function Z(e) {
|
|
|
1436
1494
|
center: { ...e.center }
|
|
1437
1495
|
});
|
|
1438
1496
|
}
|
|
1439
|
-
function
|
|
1497
|
+
function lt(e, t, n) {
|
|
1440
1498
|
let r = e.map((e) => ({
|
|
1441
1499
|
x: e.x / 100 * t,
|
|
1442
1500
|
y: e.y / 100 * n
|
|
1443
1501
|
})), i = [];
|
|
1444
|
-
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({
|
|
1445
1503
|
x: e,
|
|
1446
1504
|
y: t
|
|
1447
1505
|
});
|
|
1448
1506
|
return r.concat(i);
|
|
1449
1507
|
}
|
|
1450
|
-
function
|
|
1451
|
-
let n = e, r =
|
|
1508
|
+
function ut(e, t) {
|
|
1509
|
+
let n = e, r = qe;
|
|
1452
1510
|
return t.forEach((t) => {
|
|
1453
|
-
let i =
|
|
1511
|
+
let i = X(e, t);
|
|
1454
1512
|
i < r && (n = t, r = i);
|
|
1455
1513
|
}), n;
|
|
1456
1514
|
}
|
|
1457
|
-
function
|
|
1515
|
+
function dt(e) {
|
|
1458
1516
|
let t = e;
|
|
1459
1517
|
for (; t;) {
|
|
1460
1518
|
if (t.name().split(" ").includes("geometry-guide")) return !0;
|
|
@@ -1462,10 +1520,10 @@ function We(e) {
|
|
|
1462
1520
|
}
|
|
1463
1521
|
return !1;
|
|
1464
1522
|
}
|
|
1465
|
-
function
|
|
1523
|
+
function ft(e) {
|
|
1466
1524
|
return e === "pen" || e === "line" || e === "eraser";
|
|
1467
1525
|
}
|
|
1468
|
-
function
|
|
1526
|
+
function pt(e) {
|
|
1469
1527
|
let t = e.target.getStage()?.getPointerPosition();
|
|
1470
1528
|
if (!t) return null;
|
|
1471
1529
|
let n = e.target.getLayer(), r = n?.scaleX() || 1, i = n?.scaleY() || r;
|
|
@@ -1474,16 +1532,16 @@ function Ke(e) {
|
|
|
1474
1532
|
y: t.y / i
|
|
1475
1533
|
};
|
|
1476
1534
|
}
|
|
1477
|
-
function
|
|
1478
|
-
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;
|
|
1479
1537
|
}
|
|
1480
|
-
function
|
|
1481
|
-
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;
|
|
1482
1540
|
return -1;
|
|
1483
1541
|
}
|
|
1484
|
-
function
|
|
1485
|
-
if (e.type === "circle") return Math.abs(
|
|
1486
|
-
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, {
|
|
1487
1545
|
x1: e.points[n],
|
|
1488
1546
|
x2: e.points[n + 2],
|
|
1489
1547
|
y1: e.points[n + 1],
|
|
@@ -1491,27 +1549,27 @@ function Ye(e, t) {
|
|
|
1491
1549
|
}) <= 14) return !0;
|
|
1492
1550
|
return !1;
|
|
1493
1551
|
}
|
|
1494
|
-
function
|
|
1552
|
+
function _t(e, t) {
|
|
1495
1553
|
let n = t.x2 - t.x1, r = t.y2 - t.y1, i = n * n + r * r;
|
|
1496
|
-
if (i === 0) return
|
|
1554
|
+
if (i === 0) return X(e, {
|
|
1497
1555
|
x: t.x1,
|
|
1498
1556
|
y: t.y1
|
|
1499
1557
|
});
|
|
1500
|
-
let a =
|
|
1501
|
-
return
|
|
1558
|
+
let a = St(((e.x - t.x1) * n + (e.y - t.y1) * r) / i, 0, 1);
|
|
1559
|
+
return X(e, {
|
|
1502
1560
|
x: t.x1 + a * n,
|
|
1503
1561
|
y: t.y1 + a * r
|
|
1504
1562
|
});
|
|
1505
1563
|
}
|
|
1506
|
-
function
|
|
1564
|
+
function vt(e, t, n) {
|
|
1507
1565
|
let r = t * Math.PI / 180, i = Math.cos(r), a = Math.sin(r);
|
|
1508
1566
|
return {
|
|
1509
1567
|
x: n.x + e.x * i - e.y * a,
|
|
1510
1568
|
y: n.y + e.x * a + e.y * i
|
|
1511
1569
|
};
|
|
1512
1570
|
}
|
|
1513
|
-
function
|
|
1514
|
-
return
|
|
1571
|
+
function yt(e, t) {
|
|
1572
|
+
return vt({
|
|
1515
1573
|
x: t === "left" ? -e.length / 2 : e.length / 2,
|
|
1516
1574
|
y: 0
|
|
1517
1575
|
}, e.rotation, {
|
|
@@ -1519,8 +1577,8 @@ function Qe(e, t) {
|
|
|
1519
1577
|
y: e.y
|
|
1520
1578
|
});
|
|
1521
1579
|
}
|
|
1522
|
-
function
|
|
1523
|
-
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;
|
|
1524
1582
|
return {
|
|
1525
1583
|
...e,
|
|
1526
1584
|
rotation: o,
|
|
@@ -1528,8 +1586,8 @@ function $e(e, t, n) {
|
|
|
1528
1586
|
y: i.y + Math.sin(s) * c * l
|
|
1529
1587
|
};
|
|
1530
1588
|
}
|
|
1531
|
-
function
|
|
1532
|
-
return
|
|
1589
|
+
function xt(e) {
|
|
1590
|
+
return X({
|
|
1533
1591
|
x: e[0],
|
|
1534
1592
|
y: e[1]
|
|
1535
1593
|
}, {
|
|
@@ -1537,31 +1595,30 @@ function et(e) {
|
|
|
1537
1595
|
y: e[3]
|
|
1538
1596
|
});
|
|
1539
1597
|
}
|
|
1540
|
-
function
|
|
1598
|
+
function X(e, t) {
|
|
1541
1599
|
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
1542
1600
|
}
|
|
1543
|
-
function
|
|
1601
|
+
function St(e, t, n) {
|
|
1544
1602
|
return Math.min(Math.max(e, t), n);
|
|
1545
1603
|
}
|
|
1546
|
-
function
|
|
1604
|
+
function Ct(e) {
|
|
1547
1605
|
return (e % 360 + 360) % 360;
|
|
1548
1606
|
}
|
|
1549
1607
|
//#endregion
|
|
1550
1608
|
//#region src/exam-session/interactions/KonvaDrawingGrid.tsx
|
|
1551
|
-
function
|
|
1552
|
-
return /* @__PURE__ */
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
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,
|
|
1557
1614
|
variant: "question"
|
|
1558
1615
|
});
|
|
1559
1616
|
}
|
|
1560
1617
|
//#endregion
|
|
1561
1618
|
//#region src/exam-session/interactions/LabelPlacement.tsx
|
|
1562
|
-
function
|
|
1563
|
-
let i = n?.placements ?? {},
|
|
1564
|
-
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, {
|
|
1565
1622
|
onDragEnd: (e) => {
|
|
1566
1623
|
if (e.canceled) return;
|
|
1567
1624
|
let n = e.operation.source?.id?.toString(), a = e.operation.target?.id?.toString(), o = t.find((e) => e.id === a);
|
|
@@ -1578,14 +1635,14 @@ function it({ labels: e, targets: t, value: n, onChange: r }) {
|
|
|
1578
1635
|
}
|
|
1579
1636
|
});
|
|
1580
1637
|
},
|
|
1581
|
-
children: /* @__PURE__ */
|
|
1638
|
+
children: /* @__PURE__ */ s("div", {
|
|
1582
1639
|
className: "label-placement",
|
|
1583
|
-
children: [/* @__PURE__ */
|
|
1640
|
+
children: [/* @__PURE__ */ o("div", {
|
|
1584
1641
|
className: "label-placement__bank",
|
|
1585
|
-
children: e.filter((e) => !
|
|
1586
|
-
}), /* @__PURE__ */
|
|
1642
|
+
children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ o(Et, { label: e }, e.id))
|
|
1643
|
+
}), /* @__PURE__ */ o("div", {
|
|
1587
1644
|
className: "label-placement__diagram",
|
|
1588
|
-
children: t.map((t) => /* @__PURE__ */
|
|
1645
|
+
children: t.map((t) => /* @__PURE__ */ o(Dt, {
|
|
1589
1646
|
label: e.find((e) => i[e.id]?.targetId === t.id),
|
|
1590
1647
|
target: t
|
|
1591
1648
|
}, t.id))
|
|
@@ -1593,66 +1650,66 @@ function it({ labels: e, targets: t, value: n, onChange: r }) {
|
|
|
1593
1650
|
})
|
|
1594
1651
|
});
|
|
1595
1652
|
}
|
|
1596
|
-
function
|
|
1597
|
-
let { ref: t, isDragging: n } =
|
|
1598
|
-
return /* @__PURE__ */
|
|
1653
|
+
function Et({ label: e }) {
|
|
1654
|
+
let { ref: t, isDragging: n } = l({ id: e.id });
|
|
1655
|
+
return /* @__PURE__ */ o("button", {
|
|
1599
1656
|
className: n ? "placement-label placement-label--dragging" : "placement-label",
|
|
1600
1657
|
ref: t,
|
|
1601
1658
|
type: "button",
|
|
1602
1659
|
children: e.label
|
|
1603
1660
|
});
|
|
1604
1661
|
}
|
|
1605
|
-
function
|
|
1606
|
-
let { ref: n, isDropTarget: r } =
|
|
1607
|
-
return /* @__PURE__ */
|
|
1662
|
+
function Dt({ label: e, target: t }) {
|
|
1663
|
+
let { ref: n, isDropTarget: r } = u({ id: t.id });
|
|
1664
|
+
return /* @__PURE__ */ s("div", {
|
|
1608
1665
|
className: r ? "placement-target placement-target--active" : "placement-target",
|
|
1609
1666
|
ref: n,
|
|
1610
1667
|
style: {
|
|
1611
1668
|
left: `${t.x}%`,
|
|
1612
1669
|
top: `${t.y}%`
|
|
1613
1670
|
},
|
|
1614
|
-
children: [/* @__PURE__ */
|
|
1671
|
+
children: [/* @__PURE__ */ o("span", {
|
|
1615
1672
|
"aria-hidden": "true",
|
|
1616
1673
|
children: t.label
|
|
1617
|
-
}), e ? /* @__PURE__ */
|
|
1674
|
+
}), e ? /* @__PURE__ */ o(Et, { label: e }) : null]
|
|
1618
1675
|
});
|
|
1619
1676
|
}
|
|
1620
1677
|
//#endregion
|
|
1621
1678
|
//#region src/exam-session/interactions/NumberLineAnswer.tsx
|
|
1622
|
-
function
|
|
1623
|
-
return /* @__PURE__ */
|
|
1679
|
+
function Ot({ answerId: e, expression: t, value: n, onChange: r, onClear: i, recognizer: a }) {
|
|
1680
|
+
return /* @__PURE__ */ s("div", {
|
|
1624
1681
|
className: "number-line-layout",
|
|
1625
|
-
children: [/* @__PURE__ */
|
|
1682
|
+
children: [/* @__PURE__ */ o(kt, {}), /* @__PURE__ */ s("div", {
|
|
1626
1683
|
className: "compact-answer",
|
|
1627
|
-
children: [/* @__PURE__ */
|
|
1684
|
+
children: [/* @__PURE__ */ o("span", { children: t }), /* @__PURE__ */ o(G, {
|
|
1628
1685
|
ariaLabel: t,
|
|
1629
1686
|
onChange: (t) => r(e, t),
|
|
1630
1687
|
onClear: () => i(e),
|
|
1631
|
-
recognizer:
|
|
1688
|
+
recognizer: a,
|
|
1632
1689
|
value: n
|
|
1633
1690
|
})]
|
|
1634
1691
|
})]
|
|
1635
1692
|
});
|
|
1636
1693
|
}
|
|
1637
|
-
function
|
|
1638
|
-
return /* @__PURE__ */
|
|
1694
|
+
function kt() {
|
|
1695
|
+
return /* @__PURE__ */ s("svg", {
|
|
1639
1696
|
className: "number-line",
|
|
1640
1697
|
viewBox: "0 0 520 86",
|
|
1641
1698
|
role: "img",
|
|
1642
1699
|
"aria-label": "مُسْتَقِيمٌ عَدَدِيٌّ مِنْ 0 إِلَى 10",
|
|
1643
|
-
children: [/* @__PURE__ */
|
|
1700
|
+
children: [/* @__PURE__ */ o("line", {
|
|
1644
1701
|
x1: "32",
|
|
1645
1702
|
x2: "488",
|
|
1646
1703
|
y1: "36",
|
|
1647
1704
|
y2: "36"
|
|
1648
1705
|
}), Array.from({ length: 11 }, (e, t) => {
|
|
1649
1706
|
let n = 32 + t * 45.6;
|
|
1650
|
-
return /* @__PURE__ */
|
|
1707
|
+
return /* @__PURE__ */ s("g", { children: [/* @__PURE__ */ o("line", {
|
|
1651
1708
|
x1: n,
|
|
1652
1709
|
x2: n,
|
|
1653
1710
|
y1: "28",
|
|
1654
1711
|
y2: "44"
|
|
1655
|
-
}), /* @__PURE__ */
|
|
1712
|
+
}), /* @__PURE__ */ o("text", {
|
|
1656
1713
|
x: n,
|
|
1657
1714
|
y: "66",
|
|
1658
1715
|
children: t
|
|
@@ -1662,7 +1719,7 @@ function ct() {
|
|
|
1662
1719
|
}
|
|
1663
1720
|
//#endregion
|
|
1664
1721
|
//#region src/voice/evaluateVoiceAiResult.ts
|
|
1665
|
-
var
|
|
1722
|
+
var At = {
|
|
1666
1723
|
audioConfig: {
|
|
1667
1724
|
bitDepth: 16,
|
|
1668
1725
|
channels: 1,
|
|
@@ -1672,18 +1729,18 @@ var lt = {
|
|
|
1672
1729
|
lang: "fr",
|
|
1673
1730
|
useModelAi: !0
|
|
1674
1731
|
};
|
|
1675
|
-
function
|
|
1676
|
-
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) => ({
|
|
1677
1734
|
index: t,
|
|
1678
|
-
similarity:
|
|
1735
|
+
similarity: Pt(a, e)
|
|
1679
1736
|
})).reduce((e, t) => t.similarity > e.similarity ? t : e, {
|
|
1680
1737
|
index: -1,
|
|
1681
1738
|
similarity: 0
|
|
1682
|
-
}), 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";
|
|
1683
1740
|
return {
|
|
1684
1741
|
acceptedPronunciations: r,
|
|
1685
1742
|
confidence: e.confidence,
|
|
1686
|
-
confidencePercent: Math.round(
|
|
1743
|
+
confidencePercent: Math.round(It(e.confidence, 0, 1) * 100),
|
|
1687
1744
|
detectedPronunciation: e.transcript,
|
|
1688
1745
|
expectedLanguage: n.expectedLanguage,
|
|
1689
1746
|
expectedText: t,
|
|
@@ -1702,13 +1759,13 @@ function ut(e, t, n) {
|
|
|
1702
1759
|
timestamps: e.timestamps ?? []
|
|
1703
1760
|
};
|
|
1704
1761
|
}
|
|
1705
|
-
function
|
|
1762
|
+
function Mt(e) {
|
|
1706
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();
|
|
1707
1764
|
}
|
|
1708
|
-
function
|
|
1709
|
-
return (e ?
|
|
1765
|
+
function Nt(e) {
|
|
1766
|
+
return (e ? Mt(e).length : 0) <= 4 ? 1 : .85;
|
|
1710
1767
|
}
|
|
1711
|
-
function
|
|
1768
|
+
function Pt(e, t) {
|
|
1712
1769
|
let n = Array.from(e), r = Array.from(t), i = Math.max(n.length, r.length);
|
|
1713
1770
|
if (i === 0) return 0;
|
|
1714
1771
|
let a = Array.from({ length: r.length + 1 }, (e, t) => t);
|
|
@@ -1720,185 +1777,185 @@ function pt(e, t) {
|
|
|
1720
1777
|
}
|
|
1721
1778
|
a.splice(0, a.length, ...t);
|
|
1722
1779
|
}
|
|
1723
|
-
return
|
|
1780
|
+
return It(1 - a[r.length] / i, 0, 1);
|
|
1724
1781
|
}
|
|
1725
|
-
function
|
|
1782
|
+
function Ft(e) {
|
|
1726
1783
|
let t = /* @__PURE__ */ new Set();
|
|
1727
1784
|
return e.filter((e) => {
|
|
1728
|
-
let n =
|
|
1785
|
+
let n = Mt(e);
|
|
1729
1786
|
return !n || t.has(n) ? !1 : (t.add(n), !0);
|
|
1730
1787
|
});
|
|
1731
1788
|
}
|
|
1732
|
-
function
|
|
1789
|
+
function It(e, t, n) {
|
|
1733
1790
|
return Math.min(n, Math.max(t, e));
|
|
1734
1791
|
}
|
|
1735
1792
|
//#endregion
|
|
1736
1793
|
//#region src/exam-session/interactions/PronunciationRecorder.tsx
|
|
1737
|
-
function
|
|
1738
|
-
let [
|
|
1739
|
-
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,
|
|
1740
1797
|
expectedLanguage: d,
|
|
1741
|
-
minimumSimilarity:
|
|
1798
|
+
minimumSimilarity: f
|
|
1742
1799
|
}) : null, [
|
|
1743
|
-
|
|
1744
|
-
|
|
1800
|
+
e,
|
|
1801
|
+
a,
|
|
1745
1802
|
d,
|
|
1746
|
-
|
|
1747
|
-
|
|
1803
|
+
f,
|
|
1804
|
+
g
|
|
1748
1805
|
]);
|
|
1749
|
-
|
|
1750
|
-
if (
|
|
1806
|
+
t(() => {
|
|
1807
|
+
if (_ !== "recording") return;
|
|
1751
1808
|
let e = window.setInterval(() => {
|
|
1752
|
-
let e =
|
|
1753
|
-
e !== null &&
|
|
1809
|
+
let e = T.current;
|
|
1810
|
+
e !== null && w(Date.now() - e);
|
|
1754
1811
|
}, 200);
|
|
1755
1812
|
return () => window.clearInterval(e);
|
|
1756
|
-
}, [
|
|
1757
|
-
|
|
1758
|
-
}, [
|
|
1759
|
-
async function
|
|
1760
|
-
if (
|
|
1761
|
-
|
|
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();
|
|
1762
1819
|
try {
|
|
1763
|
-
if (!
|
|
1820
|
+
if (!h) throw Error("Ù…ÙØ³Ø¬Ù‘ÙÙ„ الصَّوت غَير Ù…ÙØªØ§ØÙ ÙÙÙŠ هذا التَّطبÙيق.");
|
|
1764
1821
|
let e = {
|
|
1765
|
-
...
|
|
1822
|
+
...At,
|
|
1766
1823
|
lang: d,
|
|
1767
1824
|
maxDuration: 10
|
|
1768
1825
|
};
|
|
1769
|
-
if (!(await
|
|
1770
|
-
|
|
1826
|
+
if (!(await h.startRecording(e)).started) throw Error("تعذّر بدء التسجيل الصوتي.");
|
|
1827
|
+
E.current = !0, T.current = Date.now(), w(0), v("recording");
|
|
1771
1828
|
} catch (e) {
|
|
1772
|
-
|
|
1829
|
+
E.current = !1, T.current = null, x(Vt(e)), v("error");
|
|
1773
1830
|
}
|
|
1774
1831
|
}
|
|
1775
1832
|
}
|
|
1776
|
-
async function
|
|
1777
|
-
if (
|
|
1778
|
-
|
|
1833
|
+
async function k() {
|
|
1834
|
+
if (_ === "recording") {
|
|
1835
|
+
v("processing"), x(null);
|
|
1779
1836
|
try {
|
|
1780
|
-
if (!
|
|
1781
|
-
let
|
|
1782
|
-
acceptedPronunciations:
|
|
1837
|
+
if (!h) throw Error("Ù…ÙØ³Ø¬Ù‘ÙÙ„ الصَّوت غَير Ù…ÙØªØ§ØÙ ÙÙÙŠ هذا التَّطبÙيق.");
|
|
1838
|
+
let t = await h.stopRecording(), n = jt(t.modelAiResult, a, {
|
|
1839
|
+
acceptedPronunciations: e,
|
|
1783
1840
|
expectedLanguage: d,
|
|
1784
|
-
minimumSimilarity:
|
|
1841
|
+
minimumSimilarity: f
|
|
1785
1842
|
});
|
|
1786
|
-
|
|
1787
|
-
evaluation:
|
|
1843
|
+
E.current = !1, T.current = null, w(t.duration), p({
|
|
1844
|
+
evaluation: n,
|
|
1788
1845
|
kind: "audio-recording",
|
|
1789
|
-
result:
|
|
1790
|
-
}),
|
|
1846
|
+
result: t
|
|
1847
|
+
}), v("idle");
|
|
1791
1848
|
} catch (e) {
|
|
1792
|
-
|
|
1849
|
+
E.current = !1, T.current = null, x(Vt(e)), v("error");
|
|
1793
1850
|
}
|
|
1794
1851
|
}
|
|
1795
1852
|
}
|
|
1796
|
-
function
|
|
1797
|
-
|
|
1853
|
+
function A() {
|
|
1854
|
+
x(null), w(0), v("idle"), m();
|
|
1798
1855
|
}
|
|
1799
|
-
let
|
|
1800
|
-
return /* @__PURE__ */
|
|
1856
|
+
let j = _ === "checking" || _ === "processing", te = _ === "recording" ? S : g?.result.duration ?? S;
|
|
1857
|
+
return /* @__PURE__ */ s("div", {
|
|
1801
1858
|
className: "audio-debug-card",
|
|
1802
|
-
"data-status":
|
|
1859
|
+
"data-status": _,
|
|
1803
1860
|
children: [
|
|
1804
|
-
/* @__PURE__ */
|
|
1861
|
+
/* @__PURE__ */ s("div", {
|
|
1805
1862
|
className: "audio-pronunciation-target",
|
|
1806
|
-
children: [/* @__PURE__ */
|
|
1863
|
+
children: [/* @__PURE__ */ o("div", {
|
|
1807
1864
|
className: "audio-pronunciation-image-frame",
|
|
1808
|
-
children: /* @__PURE__ */
|
|
1865
|
+
children: /* @__PURE__ */ o("img", {
|
|
1809
1866
|
alt: c,
|
|
1810
1867
|
src: l
|
|
1811
1868
|
})
|
|
1812
|
-
}), /* @__PURE__ */
|
|
1869
|
+
}), /* @__PURE__ */ s("div", {
|
|
1813
1870
|
className: "audio-pronunciation-copy",
|
|
1814
1871
|
children: [
|
|
1815
|
-
/* @__PURE__ */
|
|
1872
|
+
/* @__PURE__ */ s("span", { children: [
|
|
1816
1873
|
"اُنْطِقِ الكَلِمَةَ بِـ",
|
|
1817
|
-
|
|
1874
|
+
Bt(d),
|
|
1818
1875
|
":"
|
|
1819
1876
|
] }),
|
|
1820
|
-
/* @__PURE__ */
|
|
1877
|
+
/* @__PURE__ */ o("strong", {
|
|
1821
1878
|
dir: d === "ar" ? "rtl" : "ltr",
|
|
1822
|
-
children:
|
|
1879
|
+
children: a
|
|
1823
1880
|
}),
|
|
1824
|
-
/* @__PURE__ */
|
|
1881
|
+
/* @__PURE__ */ o("p", { children: u })
|
|
1825
1882
|
]
|
|
1826
1883
|
})]
|
|
1827
1884
|
}),
|
|
1828
|
-
/* @__PURE__ */
|
|
1885
|
+
/* @__PURE__ */ s("div", {
|
|
1829
1886
|
className: "audio-debug-card__hero",
|
|
1830
1887
|
"aria-live": "polite",
|
|
1831
|
-
children: [/* @__PURE__ */
|
|
1888
|
+
children: [/* @__PURE__ */ o("span", {
|
|
1832
1889
|
className: "audio-debug-card__icon",
|
|
1833
1890
|
"aria-hidden": "true",
|
|
1834
|
-
children: /* @__PURE__ */
|
|
1835
|
-
}), /* @__PURE__ */
|
|
1891
|
+
children: /* @__PURE__ */ o(y, {})
|
|
1892
|
+
}), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("strong", { children: Ht(_, !!g) }), /* @__PURE__ */ o("span", { children: zt(te) })] })]
|
|
1836
1893
|
}),
|
|
1837
|
-
/* @__PURE__ */
|
|
1894
|
+
/* @__PURE__ */ s("div", {
|
|
1838
1895
|
className: "audio-debug-actions",
|
|
1839
1896
|
children: [
|
|
1840
|
-
/* @__PURE__ */
|
|
1897
|
+
/* @__PURE__ */ s("button", {
|
|
1841
1898
|
className: "audio-debug-button audio-debug-button--record",
|
|
1842
|
-
disabled:
|
|
1843
|
-
onClick:
|
|
1899
|
+
disabled: _ === "recording" || j,
|
|
1900
|
+
onClick: O,
|
|
1844
1901
|
type: "button",
|
|
1845
|
-
children: [/* @__PURE__ */
|
|
1902
|
+
children: [/* @__PURE__ */ o(y, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: g ? "سَجِّلْ مُحاوَلَةً جَدِيدَةً" : "اِبْدَأِ التَّسْجِيلَ" })]
|
|
1846
1903
|
}),
|
|
1847
|
-
/* @__PURE__ */
|
|
1904
|
+
/* @__PURE__ */ s("button", {
|
|
1848
1905
|
className: "audio-debug-button audio-debug-button--stop",
|
|
1849
|
-
disabled:
|
|
1850
|
-
onClick:
|
|
1906
|
+
disabled: _ !== "recording",
|
|
1907
|
+
onClick: k,
|
|
1851
1908
|
type: "button",
|
|
1852
|
-
children: [/* @__PURE__ */
|
|
1909
|
+
children: [/* @__PURE__ */ o(C, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: "أَنْهِ التَّسْجِيلَ" })]
|
|
1853
1910
|
}),
|
|
1854
|
-
/* @__PURE__ */
|
|
1911
|
+
/* @__PURE__ */ s("button", {
|
|
1855
1912
|
className: "audio-debug-button audio-debug-button--reset",
|
|
1856
|
-
disabled:
|
|
1857
|
-
onClick:
|
|
1913
|
+
disabled: _ === "recording" || j || !g && !b,
|
|
1914
|
+
onClick: A,
|
|
1858
1915
|
type: "button",
|
|
1859
|
-
children: [/* @__PURE__ */
|
|
1916
|
+
children: [/* @__PURE__ */ o(ee, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: "إِعادَةُ المُحاوَلَةِ" })]
|
|
1860
1917
|
})
|
|
1861
1918
|
]
|
|
1862
1919
|
}),
|
|
1863
|
-
|
|
1920
|
+
b ? /* @__PURE__ */ o("p", {
|
|
1864
1921
|
className: "audio-debug-message",
|
|
1865
1922
|
role: "alert",
|
|
1866
|
-
children:
|
|
1923
|
+
children: b
|
|
1867
1924
|
}) : null,
|
|
1868
|
-
|
|
1925
|
+
g && D ? /* @__PURE__ */ s("section", {
|
|
1869
1926
|
className: "audio-pronunciation-feedback",
|
|
1870
|
-
"data-outcome":
|
|
1927
|
+
"data-outcome": D.status,
|
|
1871
1928
|
"data-testid": "pronunciation-feedback",
|
|
1872
1929
|
role: "status",
|
|
1873
|
-
children: [/* @__PURE__ */
|
|
1930
|
+
children: [/* @__PURE__ */ s("div", {
|
|
1874
1931
|
className: "audio-pronunciation-feedback__headline",
|
|
1875
|
-
children: [/* @__PURE__ */
|
|
1876
|
-
}), /* @__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", {
|
|
1877
1934
|
className: "audio-debug-metadata",
|
|
1878
1935
|
children: [
|
|
1879
|
-
/* @__PURE__ */
|
|
1936
|
+
/* @__PURE__ */ o(Z, {
|
|
1880
1937
|
label: "ما تَعَرَّفَ عَلَيْهِ النَّمُوذَجُ",
|
|
1881
|
-
value:
|
|
1938
|
+
value: D.detectedPronunciation || "—"
|
|
1882
1939
|
}),
|
|
1883
|
-
/* @__PURE__ */
|
|
1940
|
+
/* @__PURE__ */ o(Z, {
|
|
1884
1941
|
label: "نِسْبَةُ التَّطابُقِ",
|
|
1885
|
-
value: `${
|
|
1942
|
+
value: `${D.similarityPercent}%`
|
|
1886
1943
|
}),
|
|
1887
|
-
/* @__PURE__ */
|
|
1944
|
+
/* @__PURE__ */ o(Z, {
|
|
1888
1945
|
label: "ثِقَةُ النَّمُوذَجِ",
|
|
1889
|
-
value: `${
|
|
1946
|
+
value: `${D.confidencePercent}%`
|
|
1890
1947
|
}),
|
|
1891
|
-
/* @__PURE__ */
|
|
1948
|
+
/* @__PURE__ */ o(Z, {
|
|
1892
1949
|
label: "اللُّغَةُ",
|
|
1893
|
-
value:
|
|
1950
|
+
value: D.language.toUpperCase()
|
|
1894
1951
|
}),
|
|
1895
|
-
/* @__PURE__ */
|
|
1952
|
+
/* @__PURE__ */ o(Z, {
|
|
1896
1953
|
label: "زَمَنُ التَّحْلِيلِ",
|
|
1897
|
-
value: `${
|
|
1954
|
+
value: `${D.latencyMs} ms`
|
|
1898
1955
|
}),
|
|
1899
|
-
/* @__PURE__ */
|
|
1956
|
+
/* @__PURE__ */ o(Z, {
|
|
1900
1957
|
label: "عَدَدُ الرُّمُوزِ الصَّوْتِيَّةِ",
|
|
1901
|
-
value:
|
|
1958
|
+
value: D.timestamps.length.toString()
|
|
1902
1959
|
})
|
|
1903
1960
|
]
|
|
1904
1961
|
})]
|
|
@@ -1906,54 +1963,54 @@ function gt({ acceptedPronunciations: i, expectedText: s, imageAlt: c, imageSrc:
|
|
|
1906
1963
|
]
|
|
1907
1964
|
});
|
|
1908
1965
|
}
|
|
1909
|
-
function
|
|
1910
|
-
return
|
|
1966
|
+
function Rt({ status: e }) {
|
|
1967
|
+
return o(e === "correct" ? f : e === "no-speech" ? D : O, { "aria-hidden": "true" });
|
|
1911
1968
|
}
|
|
1912
|
-
function
|
|
1913
|
-
return /* @__PURE__ */
|
|
1969
|
+
function Z({ label: e, value: t }) {
|
|
1970
|
+
return /* @__PURE__ */ s("span", {
|
|
1914
1971
|
className: "audio-debug-meta-card",
|
|
1915
|
-
children: [/* @__PURE__ */
|
|
1972
|
+
children: [/* @__PURE__ */ o("small", { children: e }), /* @__PURE__ */ o("strong", {
|
|
1916
1973
|
dir: "ltr",
|
|
1917
1974
|
children: t
|
|
1918
1975
|
})]
|
|
1919
1976
|
});
|
|
1920
1977
|
}
|
|
1921
|
-
function
|
|
1978
|
+
function zt(e) {
|
|
1922
1979
|
let t = Math.max(0, Math.round(e / 1e3)), n = Math.floor(t / 60), r = t % 60;
|
|
1923
1980
|
return `${n.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}`;
|
|
1924
1981
|
}
|
|
1925
|
-
function
|
|
1982
|
+
function Bt(e) {
|
|
1926
1983
|
return e === "fr" ? "الفَرَنْسِيَّةِ" : "العَرَبِيَّةِ";
|
|
1927
1984
|
}
|
|
1928
|
-
function
|
|
1985
|
+
function Vt(e) {
|
|
1929
1986
|
let t = e;
|
|
1930
1987
|
return t.code === "MISSING_PERMISSION" ? "يَجِبُ السَّماحُ بِاسْتِعْمالِ المِيكْرُوفُونِ لِتَسْجِيلِ الإِجابَةِ." : t.code === "MODEL_VOCAB_MISMATCH" ? "مَلَفُّ نَمُوذَجِ اللُّغَةِ لا يُطابِقُ قامُوسَهُ. يُرْجى تَصْحِيحُ مَلَفِّ النَّمُوذَجِ." : t.message ? t.message : typeof e == "string" ? e : "حَدَثَ خَطَأٌ أَثْناءَ تَسْجِيلِ الإِجابَةِ الصَّوْتِيَّةِ.";
|
|
1931
1988
|
}
|
|
1932
|
-
function
|
|
1989
|
+
function Ht(e, t) {
|
|
1933
1990
|
return e === "checking" ? "جارِي تَجْهِيزُ المِيكْرُوفُونِ" : e === "recording" ? "جارِي التَّسْجِيلُ... تَكَلَّمِ الآنَ" : e === "processing" ? "جارِي تَحْلِيلُ النُّطْقِ" : e === "error" ? "تَعَذَّرَ تَحْلِيلُ التَّسْجِيلِ" : t ? "اِكْتَمَلَ تَحْلِيلُ الإِجابَةِ" : "المِيكْرُوفُونُ جاهِزٌ";
|
|
1934
1991
|
}
|
|
1935
|
-
function
|
|
1992
|
+
function Ut(e) {
|
|
1936
1993
|
return e === "correct" ? "أَحْسَنْتَ! إِجابَةٌ صَحِيحَةٌ" : e === "no-speech" ? "لَمْ نَسْمَعْ كَلِمَةً واضِحَةً" : e === "language-mismatch" ? "اُسْتُعْمِلَ نَمُوذَجُ لُغَةٍ مُخْتَلِفَةٍ" : "حاوِلْ مَرَّةً أُخْرى";
|
|
1937
1994
|
}
|
|
1938
|
-
function
|
|
1995
|
+
function Wt(e, t) {
|
|
1939
1996
|
return e === "correct" ? `نَطَقْتَ «${t}» بِشَكْلٍ صَحِيحٍ.` : e === "no-speech" ? `قَرِّبْ فَمَكَ مِنَ المِيكْرُوفُونِ وَقُلْ «${t}».` : `اِسْتَمِعْ إِلى نُطْقِ «${t}» ثُمَّ أَعِدِ المُحاوَلَةَ.`;
|
|
1940
1997
|
}
|
|
1941
1998
|
//#endregion
|
|
1942
1999
|
//#region src/exam-session/interactions/SortableAnswer.tsx
|
|
1943
|
-
function
|
|
1944
|
-
let i = new Map(t.map((e) => [e.id, e])),
|
|
1945
|
-
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, {
|
|
1946
2003
|
onDragEnd: (e) => {
|
|
1947
2004
|
e.canceled || r({
|
|
1948
2005
|
kind: "order",
|
|
1949
|
-
itemIds:
|
|
2006
|
+
itemIds: F(a, e).map((e) => e.toString())
|
|
1950
2007
|
});
|
|
1951
2008
|
},
|
|
1952
|
-
children: /* @__PURE__ */
|
|
2009
|
+
children: /* @__PURE__ */ o("div", {
|
|
1953
2010
|
className: "sortable-answer",
|
|
1954
|
-
children:
|
|
2011
|
+
children: a.map((t, n) => {
|
|
1955
2012
|
let r = i.get(t);
|
|
1956
|
-
return r ? /* @__PURE__ */
|
|
2013
|
+
return r ? /* @__PURE__ */ o(Kt, {
|
|
1957
2014
|
group: e,
|
|
1958
2015
|
index: n,
|
|
1959
2016
|
item: r
|
|
@@ -1962,18 +2019,18 @@ function wt({ answerId: e, items: t, value: n, onChange: r }) {
|
|
|
1962
2019
|
})
|
|
1963
2020
|
});
|
|
1964
2021
|
}
|
|
1965
|
-
function
|
|
1966
|
-
let { ref: r, isDragging: i, isDropTarget:
|
|
2022
|
+
function Kt({ group: e, index: t, item: n }) {
|
|
2023
|
+
let { ref: r, isDragging: i, isDropTarget: a } = I({
|
|
1967
2024
|
id: n.id,
|
|
1968
2025
|
index: t,
|
|
1969
2026
|
group: e,
|
|
1970
2027
|
type: "sortable-answer"
|
|
1971
2028
|
});
|
|
1972
|
-
return /* @__PURE__ */
|
|
2029
|
+
return /* @__PURE__ */ o("button", {
|
|
1973
2030
|
className: [
|
|
1974
2031
|
"sortable-token",
|
|
1975
2032
|
i ? "sortable-token--dragging" : "",
|
|
1976
|
-
|
|
2033
|
+
a ? "sortable-token--target" : ""
|
|
1977
2034
|
].filter(Boolean).join(" "),
|
|
1978
2035
|
ref: r,
|
|
1979
2036
|
type: "button",
|
|
@@ -1982,8 +2039,8 @@ function Tt({ group: e, index: t, item: n }) {
|
|
|
1982
2039
|
}
|
|
1983
2040
|
//#endregion
|
|
1984
2041
|
//#region src/exam-session/interactions/TextAnswer.tsx
|
|
1985
|
-
function
|
|
1986
|
-
return /* @__PURE__ */
|
|
2042
|
+
function qt({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onChange: i }) {
|
|
2043
|
+
return /* @__PURE__ */ o("input", {
|
|
1987
2044
|
"aria-label": e,
|
|
1988
2045
|
className: t,
|
|
1989
2046
|
inputMode: n,
|
|
@@ -1995,35 +2052,186 @@ function Et({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onCha
|
|
|
1995
2052
|
});
|
|
1996
2053
|
}
|
|
1997
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
|
|
1998
2206
|
//#region src/renderer/QuestionRenderer.tsx
|
|
1999
|
-
function
|
|
2000
|
-
return /* @__PURE__ */
|
|
2207
|
+
function an({ adapters: e, clearAnswer: t, question: n, getAnswer: r, updateAnswer: i }) {
|
|
2208
|
+
return /* @__PURE__ */ s("article", {
|
|
2001
2209
|
className: `question-block question-block--${n.type}`,
|
|
2002
|
-
children: [/* @__PURE__ */
|
|
2210
|
+
children: [/* @__PURE__ */ o(sn, {
|
|
2003
2211
|
number: n.number,
|
|
2004
2212
|
prompt: n.prompt
|
|
2005
|
-
}),
|
|
2213
|
+
}), cn(n, r, i, t, e)]
|
|
2006
2214
|
});
|
|
2007
2215
|
}
|
|
2008
|
-
function
|
|
2009
|
-
return /* @__PURE__ */
|
|
2216
|
+
function on({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswer: i }) {
|
|
2217
|
+
return /* @__PURE__ */ s("section", {
|
|
2010
2218
|
className: `question-section question-section--${n.tone}`,
|
|
2011
|
-
children: [/* @__PURE__ */
|
|
2219
|
+
children: [/* @__PURE__ */ s("header", {
|
|
2012
2220
|
className: "section-heading",
|
|
2013
2221
|
children: [
|
|
2014
|
-
/* @__PURE__ */
|
|
2222
|
+
/* @__PURE__ */ s("span", {
|
|
2015
2223
|
className: "section-points",
|
|
2016
|
-
children: [/* @__PURE__ */
|
|
2224
|
+
children: [/* @__PURE__ */ o("small", { children: "ن" }), n.points]
|
|
2017
2225
|
}),
|
|
2018
|
-
/* @__PURE__ */
|
|
2019
|
-
/* @__PURE__ */
|
|
2226
|
+
/* @__PURE__ */ o("h3", { children: n.title }),
|
|
2227
|
+
/* @__PURE__ */ o("span", {
|
|
2020
2228
|
className: "section-badge",
|
|
2021
2229
|
children: n.badge
|
|
2022
2230
|
})
|
|
2023
2231
|
]
|
|
2024
|
-
}), /* @__PURE__ */
|
|
2232
|
+
}), /* @__PURE__ */ o("div", {
|
|
2025
2233
|
className: "section-body",
|
|
2026
|
-
children: n.questions.map((n) => /* @__PURE__ */
|
|
2234
|
+
children: n.questions.map((n) => /* @__PURE__ */ o(an, {
|
|
2027
2235
|
adapters: e,
|
|
2028
2236
|
clearAnswer: t,
|
|
2029
2237
|
getAnswer: r,
|
|
@@ -2033,87 +2241,73 @@ function Ot({ adapters: e, clearAnswer: t, section: n, getAnswer: r, updateAnswe
|
|
|
2033
2241
|
})]
|
|
2034
2242
|
});
|
|
2035
2243
|
}
|
|
2036
|
-
function
|
|
2037
|
-
return /* @__PURE__ */
|
|
2244
|
+
function sn({ number: e, prompt: t }) {
|
|
2245
|
+
return /* @__PURE__ */ s("div", {
|
|
2038
2246
|
className: "question-prompt",
|
|
2039
|
-
children: [e > 0 ? /* @__PURE__ */
|
|
2247
|
+
children: [e > 0 ? /* @__PURE__ */ o("span", { children: e }) : null, /* @__PURE__ */ o("strong", { children: t })]
|
|
2040
2248
|
});
|
|
2041
2249
|
}
|
|
2042
|
-
function
|
|
2250
|
+
function cn(e, t, n, r, i) {
|
|
2043
2251
|
switch (e.type) {
|
|
2044
|
-
case "inline-inputs": return /* @__PURE__ */
|
|
2252
|
+
case "inline-inputs": return /* @__PURE__ */ o("div", {
|
|
2045
2253
|
className: "inline-equation-grid",
|
|
2046
|
-
children: e.items.map((
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
onClear: () => r(c),
|
|
2056
|
-
recognizer: s?.handwritingRecognizer,
|
|
2057
|
-
value: Mt(t(c))
|
|
2058
|
-
}),
|
|
2059
|
-
i.after ? /* @__PURE__ */ a("span", { children: i.after }) : null
|
|
2060
|
-
]
|
|
2061
|
-
}, i.id);
|
|
2062
|
-
})
|
|
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
|
+
}))
|
|
2063
2263
|
});
|
|
2064
|
-
case "visual-choice": return /* @__PURE__ */
|
|
2264
|
+
case "visual-choice": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(xn, {
|
|
2065
2265
|
choices: e.choices,
|
|
2066
2266
|
onChange: (t) => n(e.id, t),
|
|
2067
|
-
|
|
2267
|
+
scene: e.scene,
|
|
2268
|
+
value: fn(t(e.id)),
|
|
2068
2269
|
visual: e.visual
|
|
2069
|
-
}), e.inputLabel ? /* @__PURE__ */
|
|
2270
|
+
}), e.inputLabel ? /* @__PURE__ */ s("div", {
|
|
2070
2271
|
className: "compact-answer",
|
|
2071
|
-
children: [/* @__PURE__ */
|
|
2272
|
+
children: [/* @__PURE__ */ o("span", { children: e.inputLabel }), /* @__PURE__ */ o(G, {
|
|
2072
2273
|
ariaLabel: e.inputLabel,
|
|
2073
2274
|
onChange: (t) => n(`${e.id}:input`, t),
|
|
2074
2275
|
onClear: () => r(`${e.id}:input`),
|
|
2075
|
-
recognizer:
|
|
2076
|
-
value:
|
|
2276
|
+
recognizer: i?.handwritingRecognizer,
|
|
2277
|
+
value: Q(t(`${e.id}:input`))
|
|
2077
2278
|
})]
|
|
2078
2279
|
}) : null] });
|
|
2079
|
-
case "number-line": return /* @__PURE__ */
|
|
2280
|
+
case "number-line": return /* @__PURE__ */ o(Ot, {
|
|
2080
2281
|
answerId: e.id,
|
|
2081
2282
|
expression: e.expression,
|
|
2082
2283
|
onClear: r,
|
|
2083
2284
|
onChange: n,
|
|
2084
|
-
recognizer:
|
|
2085
|
-
value:
|
|
2285
|
+
recognizer: i?.handwritingRecognizer,
|
|
2286
|
+
value: Q(t(e.id))
|
|
2086
2287
|
});
|
|
2087
|
-
case "equation-inputs": return /* @__PURE__ */
|
|
2288
|
+
case "equation-inputs": return /* @__PURE__ */ o("div", {
|
|
2088
2289
|
className: "stacked-equations",
|
|
2089
|
-
children: e.items.map((
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
recognizer: s?.handwritingRecognizer,
|
|
2100
|
-
value: Mt(t(c))
|
|
2101
|
-
}),
|
|
2102
|
-
i.after ? /* @__PURE__ */ a("span", { children: i.after }) : null
|
|
2103
|
-
]
|
|
2104
|
-
}, i.id);
|
|
2105
|
-
})
|
|
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
|
+
}))
|
|
2106
2300
|
});
|
|
2107
|
-
case "length-estimation": return /* @__PURE__ */
|
|
2301
|
+
case "length-estimation": return /* @__PURE__ */ o(Sn, {
|
|
2108
2302
|
answerId: e.id,
|
|
2109
2303
|
choices: e.choices,
|
|
2110
2304
|
getAnswer: t,
|
|
2111
2305
|
items: e.items,
|
|
2112
2306
|
updateAnswer: n
|
|
2113
2307
|
});
|
|
2114
|
-
case "shape-choice": return /* @__PURE__ */
|
|
2308
|
+
case "shape-choice": return /* @__PURE__ */ s("div", {
|
|
2115
2309
|
className: "shape-choice-layout",
|
|
2116
|
-
children: [/* @__PURE__ */
|
|
2310
|
+
children: [/* @__PURE__ */ o(Ne, {
|
|
2117
2311
|
items: e.choices.map((e) => ({
|
|
2118
2312
|
id: `${e.id}-label`,
|
|
2119
2313
|
label: e.label
|
|
@@ -2121,62 +2315,79 @@ function At(e, t, n, r, s) {
|
|
|
2121
2315
|
onChange: (t) => n(e.id, t),
|
|
2122
2316
|
targets: e.choices.map((e) => ({
|
|
2123
2317
|
id: `${e.id}-target`,
|
|
2124
|
-
label:
|
|
2318
|
+
label: yn(e.id)
|
|
2125
2319
|
})),
|
|
2126
|
-
value:
|
|
2127
|
-
}), /* @__PURE__ */
|
|
2320
|
+
value: fn(t(e.id))
|
|
2321
|
+
}), /* @__PURE__ */ o("div", {
|
|
2128
2322
|
className: "shape-row",
|
|
2129
2323
|
"aria-hidden": "true",
|
|
2130
|
-
children: e.choices.map((e) => /* @__PURE__ */
|
|
2324
|
+
children: e.choices.map((e) => /* @__PURE__ */ o("span", { className: `shape-drawing shape-drawing--${e.id}` }, e.id))
|
|
2131
2325
|
})]
|
|
2132
2326
|
});
|
|
2133
|
-
case "drawing-grid": return /* @__PURE__ */
|
|
2134
|
-
actionLabel: e.actionLabel,
|
|
2327
|
+
case "drawing-grid": return /* @__PURE__ */ o(wt, {
|
|
2135
2328
|
onChange: (t) => n(e.id, t),
|
|
2136
2329
|
points: e.points,
|
|
2137
|
-
value:
|
|
2330
|
+
value: hn(t(e.id))
|
|
2138
2331
|
});
|
|
2139
|
-
case "table-response": return /* @__PURE__ */
|
|
2332
|
+
case "table-response": return /* @__PURE__ */ o(De, {
|
|
2140
2333
|
columns: e.columns,
|
|
2141
2334
|
onChange: (t) => n(e.id, t),
|
|
2142
|
-
value:
|
|
2335
|
+
value: gn(t(e.id))
|
|
2143
2336
|
});
|
|
2144
|
-
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", {
|
|
2145
2338
|
className: "problem-statement",
|
|
2146
2339
|
children: e.before
|
|
2147
|
-
}) : /* @__PURE__ */
|
|
2340
|
+
}) : /* @__PURE__ */ s("div", {
|
|
2148
2341
|
className: "sentence-answer",
|
|
2149
2342
|
children: [
|
|
2150
|
-
e.before ? /* @__PURE__ */
|
|
2151
|
-
/* @__PURE__ */
|
|
2343
|
+
e.before ? /* @__PURE__ */ o("span", { children: e.before }) : null,
|
|
2344
|
+
/* @__PURE__ */ o(G, {
|
|
2152
2345
|
ariaLabel: e.prompt,
|
|
2153
2346
|
onChange: (t) => n(e.id, t),
|
|
2154
2347
|
onClear: () => r(e.id),
|
|
2155
|
-
recognizer:
|
|
2156
|
-
value:
|
|
2348
|
+
recognizer: i?.handwritingRecognizer,
|
|
2349
|
+
value: Q(t(e.id))
|
|
2157
2350
|
}),
|
|
2158
|
-
e.after ? /* @__PURE__ */
|
|
2351
|
+
e.after ? /* @__PURE__ */ o("span", { children: e.after }) : null
|
|
2159
2352
|
]
|
|
2160
2353
|
});
|
|
2161
|
-
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, {
|
|
2162
2373
|
items: e.items,
|
|
2163
2374
|
onChange: (t) => n(e.id, t),
|
|
2164
2375
|
targets: e.targets,
|
|
2165
|
-
value:
|
|
2376
|
+
value: fn(t(e.id))
|
|
2166
2377
|
});
|
|
2167
|
-
case "sortable-answer": return /* @__PURE__ */
|
|
2378
|
+
case "sortable-answer": return /* @__PURE__ */ o(Gt, {
|
|
2168
2379
|
answerId: e.id,
|
|
2169
2380
|
items: e.items,
|
|
2170
2381
|
onChange: (t) => n(e.id, t),
|
|
2171
|
-
value:
|
|
2382
|
+
value: pn(t(e.id))
|
|
2172
2383
|
});
|
|
2173
|
-
case "label-placement": return /* @__PURE__ */
|
|
2384
|
+
case "label-placement": return /* @__PURE__ */ o(Tt, {
|
|
2174
2385
|
labels: e.labels,
|
|
2175
2386
|
onChange: (t) => n(e.id, t),
|
|
2176
2387
|
targets: e.targets,
|
|
2177
|
-
value:
|
|
2388
|
+
value: mn(t(e.id))
|
|
2178
2389
|
});
|
|
2179
|
-
case "audio-recording": return /* @__PURE__ */
|
|
2390
|
+
case "audio-recording": return /* @__PURE__ */ o(Lt, {
|
|
2180
2391
|
acceptedPronunciations: e.acceptedPronunciations,
|
|
2181
2392
|
expectedText: e.expectedAnswer,
|
|
2182
2393
|
imageAlt: e.imageAlt,
|
|
@@ -2186,137 +2397,166 @@ function At(e, t, n, r, s) {
|
|
|
2186
2397
|
minimumSimilarity: e.minimumSimilarity,
|
|
2187
2398
|
onChange: (t) => n(e.id, t),
|
|
2188
2399
|
onReset: () => r(e.id),
|
|
2189
|
-
recorder:
|
|
2190
|
-
value:
|
|
2400
|
+
recorder: i?.audioRecorder,
|
|
2401
|
+
value: _n(t(e.id))
|
|
2191
2402
|
});
|
|
2192
2403
|
}
|
|
2193
2404
|
}
|
|
2194
|
-
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) {
|
|
2195
2440
|
return e?.kind === "text" ? e : void 0;
|
|
2196
2441
|
}
|
|
2197
|
-
function
|
|
2442
|
+
function Q(e) {
|
|
2198
2443
|
return e?.kind === "handwritten-number" ? e : void 0;
|
|
2199
2444
|
}
|
|
2200
|
-
function
|
|
2445
|
+
function dn(e) {
|
|
2201
2446
|
return e?.kind === "choice" ? e : void 0;
|
|
2202
2447
|
}
|
|
2203
|
-
function
|
|
2448
|
+
function fn(e) {
|
|
2204
2449
|
return e?.kind === "matches" ? e : void 0;
|
|
2205
2450
|
}
|
|
2206
|
-
function
|
|
2451
|
+
function pn(e) {
|
|
2207
2452
|
return e?.kind === "order" ? e : void 0;
|
|
2208
2453
|
}
|
|
2209
|
-
function
|
|
2454
|
+
function mn(e) {
|
|
2210
2455
|
return e?.kind === "placements" ? e : void 0;
|
|
2211
2456
|
}
|
|
2212
|
-
function
|
|
2457
|
+
function hn(e) {
|
|
2213
2458
|
return e?.kind === "drawing" ? e : void 0;
|
|
2214
2459
|
}
|
|
2215
|
-
function
|
|
2460
|
+
function gn(e) {
|
|
2216
2461
|
return e?.kind === "coin-table" ? e : void 0;
|
|
2217
2462
|
}
|
|
2218
|
-
function
|
|
2463
|
+
function _n(e) {
|
|
2219
2464
|
return e?.kind === "audio-recording" ? e : void 0;
|
|
2220
2465
|
}
|
|
2221
|
-
function
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
className: "
|
|
2234
|
-
children:
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
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
|
+
})]
|
|
2239
2491
|
});
|
|
2240
2492
|
}
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
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();
|
|
2248
2508
|
return {
|
|
2249
|
-
x: e -
|
|
2250
|
-
y: t -
|
|
2509
|
+
x: e - i.left,
|
|
2510
|
+
y: t - i.top
|
|
2251
2511
|
};
|
|
2252
2512
|
}
|
|
2253
|
-
function
|
|
2513
|
+
function x(e) {
|
|
2254
2514
|
if (!e) return null;
|
|
2255
2515
|
let t = e.getBoundingClientRect();
|
|
2256
|
-
return
|
|
2516
|
+
return b(t.left + t.width / 2, t.top + t.height / 2);
|
|
2257
2517
|
}
|
|
2258
|
-
|
|
2518
|
+
t(() => {
|
|
2259
2519
|
function e(e) {
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
return {
|
|
2264
|
-
x: r.left + r.width / 2 - n.left,
|
|
2265
|
-
y: r.top + r.height / 2 - n.top
|
|
2266
|
-
};
|
|
2520
|
+
if (!e) return null;
|
|
2521
|
+
let t = e.getBoundingClientRect();
|
|
2522
|
+
return b(t.left + t.width / 2, t.top + t.height / 2);
|
|
2267
2523
|
}
|
|
2268
2524
|
function t() {
|
|
2269
|
-
if (!
|
|
2270
|
-
|
|
2525
|
+
if (!h) {
|
|
2526
|
+
_(null);
|
|
2271
2527
|
return;
|
|
2272
2528
|
}
|
|
2273
|
-
let t = e(
|
|
2529
|
+
let t = e(p.current[h]), n = e(f.current);
|
|
2274
2530
|
if (!t || !n) {
|
|
2275
|
-
|
|
2531
|
+
_(null);
|
|
2276
2532
|
return;
|
|
2277
2533
|
}
|
|
2278
|
-
|
|
2279
|
-
x1:
|
|
2280
|
-
x2:
|
|
2281
|
-
y1:
|
|
2282
|
-
y2:
|
|
2534
|
+
_({
|
|
2535
|
+
x1: n.x,
|
|
2536
|
+
x2: t.x,
|
|
2537
|
+
y1: n.y,
|
|
2538
|
+
y2: t.y
|
|
2283
2539
|
});
|
|
2284
2540
|
}
|
|
2285
2541
|
let n = window.setTimeout(t, 0), r = () => t();
|
|
2286
2542
|
return window.addEventListener("resize", r), () => {
|
|
2287
2543
|
window.clearTimeout(n), window.removeEventListener("resize", r);
|
|
2288
2544
|
};
|
|
2289
|
-
}, [
|
|
2290
|
-
function
|
|
2291
|
-
let
|
|
2292
|
-
!
|
|
2293
|
-
choiceId: e,
|
|
2294
|
-
origin: "answer",
|
|
2295
|
-
pointerId: t.pointerId
|
|
2296
|
-
}, _({
|
|
2297
|
-
x1: n.x,
|
|
2298
|
-
x2: r.x,
|
|
2299
|
-
y1: n.y,
|
|
2300
|
-
y2: r.y
|
|
2301
|
-
}));
|
|
2302
|
-
}
|
|
2303
|
-
function x(e) {
|
|
2304
|
-
let t = y(u.current), n = v(e.clientX, e.clientY);
|
|
2305
|
-
!t || !n || (e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), f.current = {
|
|
2306
|
-
origin: "target",
|
|
2307
|
-
pointerId: e.pointerId
|
|
2308
|
-
}, _({
|
|
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({
|
|
2309
2549
|
x1: t.x,
|
|
2310
2550
|
x2: n.x,
|
|
2311
2551
|
y1: t.y,
|
|
2312
2552
|
y2: n.y
|
|
2313
2553
|
}));
|
|
2314
2554
|
}
|
|
2315
|
-
function
|
|
2316
|
-
let t =
|
|
2555
|
+
function ee(e) {
|
|
2556
|
+
let t = m.current;
|
|
2317
2557
|
if (!t || t.pointerId !== e.pointerId) return;
|
|
2318
|
-
let n =
|
|
2319
|
-
!r || !n ||
|
|
2558
|
+
let n = b(e.clientX, e.clientY), r = x(f.current);
|
|
2559
|
+
!r || !n || y({
|
|
2320
2560
|
x1: r.x,
|
|
2321
2561
|
x2: n.x,
|
|
2322
2562
|
y1: r.y,
|
|
@@ -2324,80 +2564,72 @@ function Ut({ choices: t, onChange: i, value: s, visual: c }) {
|
|
|
2324
2564
|
});
|
|
2325
2565
|
}
|
|
2326
2566
|
function C(e) {
|
|
2327
|
-
let t =
|
|
2328
|
-
if (!
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
kind: "matches",
|
|
2336
|
-
pairs: { [Ht]: t }
|
|
2337
|
-
});
|
|
2338
|
-
}
|
|
2339
|
-
f.current = null, _(null);
|
|
2340
|
-
}
|
|
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);
|
|
2341
2575
|
}
|
|
2342
2576
|
function w(e, t, n) {
|
|
2343
2577
|
if (!e) return !1;
|
|
2344
2578
|
let r = e.getBoundingClientRect(), i = r.left + r.width / 2, a = r.top + r.height / 2;
|
|
2345
|
-
return Math.hypot(t - i, n - a) <= Math.max(r.width, r.height) *
|
|
2579
|
+
return Math.hypot(t - i, n - a) <= Math.max(42, Math.max(r.width, r.height) * 2.4);
|
|
2346
2580
|
}
|
|
2347
|
-
function T(
|
|
2348
|
-
return
|
|
2581
|
+
function T(t, n) {
|
|
2582
|
+
return e.find((e) => w(p.current[e.id], t, n))?.id;
|
|
2349
2583
|
}
|
|
2350
|
-
return /* @__PURE__ */
|
|
2584
|
+
return /* @__PURE__ */ s("div", {
|
|
2351
2585
|
className: "visual-line-match",
|
|
2352
|
-
ref:
|
|
2586
|
+
ref: u,
|
|
2353
2587
|
children: [
|
|
2354
|
-
/* @__PURE__ */
|
|
2588
|
+
/* @__PURE__ */ s("svg", {
|
|
2355
2589
|
className: "visual-line-match__lines",
|
|
2356
2590
|
"aria-hidden": "true",
|
|
2357
|
-
|
|
2591
|
+
ref: d,
|
|
2592
|
+
children: [g ? /* @__PURE__ */ o("line", {
|
|
2358
2593
|
className: "visual-line-match__line visual-line-match__line--settled",
|
|
2359
|
-
x1: m.x1,
|
|
2360
|
-
x2: m.x2,
|
|
2361
|
-
y1: m.y1,
|
|
2362
|
-
y2: m.y2
|
|
2363
|
-
}) : null, g ? /* @__PURE__ */ a("line", {
|
|
2364
|
-
className: "visual-line-match__line visual-line-match__line--draft",
|
|
2365
2594
|
x1: g.x1,
|
|
2366
2595
|
x2: g.x2,
|
|
2367
2596
|
y1: g.y1,
|
|
2368
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
|
|
2369
2604
|
}) : null]
|
|
2370
2605
|
}),
|
|
2371
|
-
/* @__PURE__ */
|
|
2606
|
+
/* @__PURE__ */ s("div", {
|
|
2372
2607
|
className: "visual-match-picture",
|
|
2373
|
-
children: [/* @__PURE__ */
|
|
2608
|
+
children: [/* @__PURE__ */ o(nn, { scene: a ?? en(l) }), /* @__PURE__ */ o("button", {
|
|
2374
2609
|
"aria-label": "اربط الصورة بالإجابة",
|
|
2375
|
-
className:
|
|
2610
|
+
className: h ? "visual-match-point visual-match-point--target visual-match-point--target-active" : "visual-match-point visual-match-point--target",
|
|
2376
2611
|
onPointerCancel: C,
|
|
2377
|
-
onPointerDown:
|
|
2378
|
-
onPointerMove:
|
|
2612
|
+
onPointerDown: S,
|
|
2613
|
+
onPointerMove: ee,
|
|
2379
2614
|
onPointerUp: C,
|
|
2380
|
-
ref:
|
|
2615
|
+
ref: f,
|
|
2381
2616
|
type: "button"
|
|
2382
2617
|
})]
|
|
2383
2618
|
}),
|
|
2384
|
-
/* @__PURE__ */
|
|
2619
|
+
/* @__PURE__ */ o("div", {
|
|
2385
2620
|
className: "visual-line-match__answers",
|
|
2386
|
-
children:
|
|
2387
|
-
className:
|
|
2388
|
-
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", {
|
|
2389
2624
|
className: "answer-chip__label answer-chip__label--math",
|
|
2390
2625
|
children: e.label
|
|
2391
|
-
}), /* @__PURE__ */
|
|
2626
|
+
}), /* @__PURE__ */ o("button", {
|
|
2392
2627
|
"aria-label": `اربط ${e.label} بالصورة`,
|
|
2393
2628
|
className: "visual-match-point visual-match-point--answer",
|
|
2394
|
-
onPointerCancel: C,
|
|
2395
|
-
onPointerDown: (t) => b(e.id, t),
|
|
2396
|
-
onPointerMove: S,
|
|
2397
|
-
onPointerUp: C,
|
|
2398
2629
|
ref: (t) => {
|
|
2399
|
-
|
|
2630
|
+
p.current[e.id] = t;
|
|
2400
2631
|
},
|
|
2632
|
+
tabIndex: -1,
|
|
2401
2633
|
type: "button"
|
|
2402
2634
|
})]
|
|
2403
2635
|
}, e.id))
|
|
@@ -2405,8 +2637,8 @@ function Ut({ choices: t, onChange: i, value: s, visual: c }) {
|
|
|
2405
2637
|
]
|
|
2406
2638
|
});
|
|
2407
2639
|
}
|
|
2408
|
-
function
|
|
2409
|
-
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);
|
|
2410
2642
|
function v(e, t, n) {
|
|
2411
2643
|
let r = d;
|
|
2412
2644
|
r && g((i) => {
|
|
@@ -2443,27 +2675,27 @@ function Wt({ answerId: e, choices: t, getAnswer: i, items: s, updateAnswer: c }
|
|
|
2443
2675
|
function x(e) {
|
|
2444
2676
|
e?.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), _.current = null, m(!1);
|
|
2445
2677
|
}
|
|
2446
|
-
return /* @__PURE__ */
|
|
2678
|
+
return /* @__PURE__ */ s("div", {
|
|
2447
2679
|
className: "length-estimation-task",
|
|
2448
2680
|
"data-coloring": p ? "true" : "false",
|
|
2449
2681
|
onPointerCancel: () => x(),
|
|
2450
2682
|
onPointerUp: () => x(),
|
|
2451
|
-
children: [/* @__PURE__ */
|
|
2683
|
+
children: [/* @__PURE__ */ o(ze, {
|
|
2452
2684
|
ariaLabel: "ألوان الأقلام",
|
|
2453
2685
|
className: "length-color-picker",
|
|
2454
2686
|
colors: u,
|
|
2455
2687
|
onChange: f,
|
|
2456
2688
|
selectedColorId: d
|
|
2457
|
-
}), /* @__PURE__ */
|
|
2689
|
+
}), /* @__PURE__ */ o("div", {
|
|
2458
2690
|
className: "length-card-row",
|
|
2459
|
-
children:
|
|
2460
|
-
let
|
|
2461
|
-
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", {
|
|
2462
2694
|
className: "length-card",
|
|
2463
|
-
children: [/* @__PURE__ */
|
|
2695
|
+
children: [/* @__PURE__ */ o("div", {
|
|
2464
2696
|
className: "square-measure-strip",
|
|
2465
2697
|
style: { "--measure-squares": l },
|
|
2466
|
-
children: /* @__PURE__ */
|
|
2698
|
+
children: /* @__PURE__ */ o("button", {
|
|
2467
2699
|
"aria-label": `تلوين ${t.label}`,
|
|
2468
2700
|
className: [
|
|
2469
2701
|
"pencil-pencil",
|
|
@@ -2471,13 +2703,13 @@ function Wt({ answerId: e, choices: t, getAnswer: i, items: s, updateAnswer: c }
|
|
|
2471
2703
|
p > 0 ? "pencil-pencil--colored" : ""
|
|
2472
2704
|
].filter(Boolean).join(" "),
|
|
2473
2705
|
onKeyDown: (e) => {
|
|
2474
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), v(t.id,
|
|
2706
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), v(t.id, i, .22));
|
|
2475
2707
|
},
|
|
2476
2708
|
onPointerDown: (e) => {
|
|
2477
|
-
y(t.id,
|
|
2709
|
+
y(t.id, i, e);
|
|
2478
2710
|
},
|
|
2479
2711
|
onPointerMove: (e) => {
|
|
2480
|
-
b(t.id,
|
|
2712
|
+
b(t.id, i, e);
|
|
2481
2713
|
},
|
|
2482
2714
|
onPointerUp: x,
|
|
2483
2715
|
style: {
|
|
@@ -2488,17 +2720,17 @@ function Wt({ answerId: e, choices: t, getAnswer: i, items: s, updateAnswer: c }
|
|
|
2488
2720
|
},
|
|
2489
2721
|
type: "button"
|
|
2490
2722
|
})
|
|
2491
|
-
}), /* @__PURE__ */
|
|
2723
|
+
}), /* @__PURE__ */ s("label", {
|
|
2492
2724
|
className: "length-value-row",
|
|
2493
2725
|
children: [
|
|
2494
|
-
/* @__PURE__ */
|
|
2495
|
-
/* @__PURE__ */
|
|
2726
|
+
/* @__PURE__ */ o("span", { children: t.label }),
|
|
2727
|
+
/* @__PURE__ */ o(qt, {
|
|
2496
2728
|
ariaLabel: `طول ${t.label} بالمربعات`,
|
|
2497
2729
|
inputMode: "numeric",
|
|
2498
|
-
onChange: (e) => c(
|
|
2499
|
-
value:
|
|
2730
|
+
onChange: (e) => c(r, e),
|
|
2731
|
+
value: un(n(r))
|
|
2500
2732
|
}),
|
|
2501
|
-
/* @__PURE__ */
|
|
2733
|
+
/* @__PURE__ */ o("span", { children: "مربعات" })
|
|
2502
2734
|
]
|
|
2503
2735
|
})]
|
|
2504
2736
|
}, t.id);
|
|
@@ -2508,51 +2740,644 @@ function Wt({ answerId: e, choices: t, getAnswer: i, items: s, updateAnswer: c }
|
|
|
2508
2740
|
}
|
|
2509
2741
|
//#endregion
|
|
2510
2742
|
//#region src/renderer/QuestionPreviewPanel.tsx
|
|
2511
|
-
function
|
|
2512
|
-
let [
|
|
2513
|
-
function
|
|
2514
|
-
|
|
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) => ({
|
|
2515
2754
|
...n,
|
|
2516
2755
|
[e]: t
|
|
2517
2756
|
}));
|
|
2518
2757
|
}
|
|
2519
|
-
function
|
|
2520
|
-
|
|
2758
|
+
function d(e) {
|
|
2759
|
+
l((t) => {
|
|
2521
2760
|
let n = { ...t };
|
|
2522
2761
|
return delete n[e], n;
|
|
2523
2762
|
});
|
|
2524
2763
|
}
|
|
2525
|
-
return /* @__PURE__ */
|
|
2764
|
+
return /* @__PURE__ */ o("div", {
|
|
2526
2765
|
className: "exam-renderer-preview",
|
|
2527
|
-
children: /* @__PURE__ */
|
|
2766
|
+
children: /* @__PURE__ */ o(an, {
|
|
2528
2767
|
adapters: e,
|
|
2529
|
-
clearAnswer:
|
|
2530
|
-
getAnswer: (e) =>
|
|
2531
|
-
question:
|
|
2532
|
-
updateAnswer:
|
|
2768
|
+
clearAnswer: d,
|
|
2769
|
+
getAnswer: (e) => c[e],
|
|
2770
|
+
question: r,
|
|
2771
|
+
updateAnswer: u
|
|
2772
|
+
})
|
|
2773
|
+
});
|
|
2774
|
+
}
|
|
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
|
+
})]
|
|
2533
3092
|
})
|
|
2534
3093
|
});
|
|
2535
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
|
+
}
|
|
2536
3361
|
//#endregion
|
|
2537
3362
|
//#region src/exam-session/interactions/DraftSheet.tsx
|
|
2538
|
-
function
|
|
2539
|
-
let [
|
|
2540
|
-
return /* @__PURE__ */
|
|
3363
|
+
function Jn({ disabled: e, onChange: t, value: n }) {
|
|
3364
|
+
let [r, a] = i(!1);
|
|
3365
|
+
return /* @__PURE__ */ o("aside", {
|
|
2541
3366
|
className: "draft-sheet",
|
|
2542
3367
|
"data-disabled": e ? "true" : "false",
|
|
2543
|
-
"data-open":
|
|
3368
|
+
"data-open": r ? "true" : "false",
|
|
2544
3369
|
dir: "rtl",
|
|
2545
|
-
children:
|
|
3370
|
+
children: r ? /* @__PURE__ */ s("div", {
|
|
2546
3371
|
className: "draft-sheet__panel",
|
|
2547
3372
|
"aria-label": "ورقة وساخ",
|
|
2548
|
-
children: [/* @__PURE__ */
|
|
3373
|
+
children: [/* @__PURE__ */ s("header", {
|
|
2549
3374
|
className: "draft-sheet__header",
|
|
2550
|
-
children: [/* @__PURE__ */
|
|
2551
|
-
onClick: () =>
|
|
3375
|
+
children: [/* @__PURE__ */ o("strong", { children: "ورقة وساخ" }), /* @__PURE__ */ o("button", {
|
|
3376
|
+
onClick: () => a(!1),
|
|
2552
3377
|
type: "button",
|
|
2553
3378
|
children: "إِغْلاقٌ"
|
|
2554
3379
|
})]
|
|
2555
|
-
}), /* @__PURE__ */
|
|
3380
|
+
}), /* @__PURE__ */ o(Ze, {
|
|
2556
3381
|
actionLabel: "مساحة ورقة وساخ",
|
|
2557
3382
|
canvasHeight: 430,
|
|
2558
3383
|
disabled: e,
|
|
@@ -2560,25 +3385,25 @@ function Kt({ disabled: e, onChange: t, value: n }) {
|
|
|
2560
3385
|
value: n,
|
|
2561
3386
|
variant: "draft"
|
|
2562
3387
|
})]
|
|
2563
|
-
}) : /* @__PURE__ */
|
|
3388
|
+
}) : /* @__PURE__ */ s("button", {
|
|
2564
3389
|
className: "draft-sheet__toggle",
|
|
2565
3390
|
disabled: e,
|
|
2566
|
-
onClick: () =>
|
|
3391
|
+
onClick: () => a(!0),
|
|
2567
3392
|
type: "button",
|
|
2568
|
-
children: [/* @__PURE__ */
|
|
3393
|
+
children: [/* @__PURE__ */ o(b, { "aria-hidden": "true" }), /* @__PURE__ */ o("span", { children: "ورقة وساخ" })]
|
|
2569
3394
|
})
|
|
2570
3395
|
});
|
|
2571
3396
|
}
|
|
2572
3397
|
//#endregion
|
|
2573
3398
|
//#region src/exam-session/interactions/SingleChoice.tsx
|
|
2574
|
-
function
|
|
2575
|
-
return /* @__PURE__ */
|
|
3399
|
+
function Yn({ answerId: e, choices: t, value: n, onChange: r }) {
|
|
3400
|
+
return /* @__PURE__ */ o("div", {
|
|
2576
3401
|
className: "choice-group",
|
|
2577
3402
|
role: "radiogroup",
|
|
2578
3403
|
"aria-label": `اِخْتِياراتُ الإِجابَةِ ${e}`,
|
|
2579
3404
|
children: t.map((e) => {
|
|
2580
3405
|
let t = /[0-9+\-=]/.test(e.label);
|
|
2581
|
-
return /* @__PURE__ */
|
|
3406
|
+
return /* @__PURE__ */ o("button", {
|
|
2582
3407
|
"aria-checked": n?.choiceId === e.id,
|
|
2583
3408
|
className: n?.choiceId === e.id ? "answer-chip answer-chip--selected" : "answer-chip",
|
|
2584
3409
|
onClick: () => r({
|
|
@@ -2587,7 +3412,7 @@ function qt({ answerId: e, choices: t, value: n, onChange: r }) {
|
|
|
2587
3412
|
}),
|
|
2588
3413
|
role: "radio",
|
|
2589
3414
|
type: "button",
|
|
2590
|
-
children: /* @__PURE__ */
|
|
3415
|
+
children: /* @__PURE__ */ o("span", {
|
|
2591
3416
|
className: t ? "answer-chip__label answer-chip__label--math" : "answer-chip__label",
|
|
2592
3417
|
children: e.label
|
|
2593
3418
|
})
|
|
@@ -2596,4 +3421,4 @@ function qt({ answerId: e, choices: t, value: n, onChange: r }) {
|
|
|
2596
3421
|
});
|
|
2597
3422
|
}
|
|
2598
3423
|
//#endregion
|
|
2599
|
-
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 };
|