@memizy/oqse 0.1.0
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/LICENSE +21 -0
- package/README.md +58 -0
- package/SPECIFICATION.md +2444 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +845 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/manifest.d.ts +429 -0
- package/dist/src/manifestValidation.d.ts +167 -0
- package/dist/src/manifestValidation.test.d.ts +1 -0
- package/dist/src/oqse.d.ts +1121 -0
- package/dist/src/oqseValidation.d.ts +6120 -0
- package/dist/src/oqseValidation.test.d.ts +1 -0
- package/dist/src/progress.d.ts +42 -0
- package/dist/src/progressValidation.d.ts +9 -0
- package/dist/src/progressValidation.test.d.ts +1 -0
- package/dist/src/utils.d.ts +3 -0
- package/package.json +40 -0
- package/schemas/README.md +1 -0
- package/schemas/oqse-manifest-v0.1.json +256 -0
- package/schemas/oqse-v0.1.json +7573 -0
- package/schemas/oqsep-v0.1.json +172 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
//#region src/oqse.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
return e.type === "note";
|
|
5
|
+
}
|
|
6
|
+
function n(e) {
|
|
7
|
+
return e.type === "flashcard";
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
10
|
+
return e.type === "true-false";
|
|
11
|
+
}
|
|
12
|
+
function i(e) {
|
|
13
|
+
return e.type === "mcq-single";
|
|
14
|
+
}
|
|
15
|
+
function a(e) {
|
|
16
|
+
return e.type === "mcq-multi";
|
|
17
|
+
}
|
|
18
|
+
function ee(e) {
|
|
19
|
+
return e.type === "short-answer";
|
|
20
|
+
}
|
|
21
|
+
function te(e) {
|
|
22
|
+
return e.type === "fill-in-blanks";
|
|
23
|
+
}
|
|
24
|
+
function ne(e) {
|
|
25
|
+
return e.type === "fill-in-select";
|
|
26
|
+
}
|
|
27
|
+
function re(e) {
|
|
28
|
+
return e.type === "match-pairs";
|
|
29
|
+
}
|
|
30
|
+
function ie(e) {
|
|
31
|
+
return e.type === "match-complex";
|
|
32
|
+
}
|
|
33
|
+
function ae(e) {
|
|
34
|
+
return e.type === "sort-items";
|
|
35
|
+
}
|
|
36
|
+
function oe(e) {
|
|
37
|
+
return e.type === "slider";
|
|
38
|
+
}
|
|
39
|
+
function se(e) {
|
|
40
|
+
return e.type === "pin-on-image";
|
|
41
|
+
}
|
|
42
|
+
function ce(e) {
|
|
43
|
+
return e.type === "categorize";
|
|
44
|
+
}
|
|
45
|
+
function le(e) {
|
|
46
|
+
return e.type === "timeline";
|
|
47
|
+
}
|
|
48
|
+
function ue(e) {
|
|
49
|
+
return e.type === "matrix";
|
|
50
|
+
}
|
|
51
|
+
function de(e) {
|
|
52
|
+
return e.type === "math-input";
|
|
53
|
+
}
|
|
54
|
+
function fe(e) {
|
|
55
|
+
return e.type === "diagram-label";
|
|
56
|
+
}
|
|
57
|
+
function pe(e) {
|
|
58
|
+
return e.type === "open-ended";
|
|
59
|
+
}
|
|
60
|
+
function me(e) {
|
|
61
|
+
return e.type === "numeric-input";
|
|
62
|
+
}
|
|
63
|
+
function he(e) {
|
|
64
|
+
return e.type === "pin-on-model";
|
|
65
|
+
}
|
|
66
|
+
function ge(e) {
|
|
67
|
+
return e.type === "chess-puzzle";
|
|
68
|
+
}
|
|
69
|
+
function o(e) {
|
|
70
|
+
return [
|
|
71
|
+
"note",
|
|
72
|
+
"flashcard",
|
|
73
|
+
"mcq-single",
|
|
74
|
+
"short-answer"
|
|
75
|
+
].includes(e.type);
|
|
76
|
+
}
|
|
77
|
+
function _e(e) {
|
|
78
|
+
return !o(e);
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/oqseValidation.ts
|
|
82
|
+
var s = e.string().uuid({ message: "Neplatn+� form+�t UUID" }), c = e.string().min(2, "K+-d jazyka mus+� m+�t alespo+� 2 znaky").regex(/^[a-z]{2,3}(-[A-Z][a-z]{3})?(-[A-Z]{2})?$/, "Neplatn+� form+�t BCP 47 (nap+�. \"cs\", \"en-US\")"), l = e.string().min(1, "Identifik+�tor licence nesm+� b+�t pr+�zdn+�"), u = e.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z|[+-]\d{2}:\d{2})?)?$/, "Neplatn+� form+�t ISO 8601 (nap+�. \"2025-11-21T14:30:00Z\")"), d = e.string().url({ message: "Mus+� b+�t platn+� absolutn+� URL adresa" }), f = e.string().regex(/^[a-z0-9_-]+$/, "Kl+��� assetu mus+� obsahovat pouze mal+� p+�smena, ��+�sla, poml��ky a podtr+�+�tka"), p = e.string().min(1, "Text nesm+� b+�t pr+�zdn+�"), m = e.string().min(1, "Obsah nesm+� b+�t pr+�zdn+�"), h = e.string().optional(), g = e.object({
|
|
83
|
+
lang: c,
|
|
84
|
+
value: e.string().min(1, "URI titulk+� nesm+� b+�t pr+�zdn+�"),
|
|
85
|
+
label: e.string().optional(),
|
|
86
|
+
kind: e.enum([
|
|
87
|
+
"captions",
|
|
88
|
+
"subtitles",
|
|
89
|
+
"descriptions"
|
|
90
|
+
]).optional()
|
|
91
|
+
}), ve = e.object({
|
|
92
|
+
type: e.enum([
|
|
93
|
+
"image",
|
|
94
|
+
"audio",
|
|
95
|
+
"video",
|
|
96
|
+
"model"
|
|
97
|
+
]),
|
|
98
|
+
value: e.string().min(1, "URI m+�dia nesm+� b+�t pr+�zdn+�"),
|
|
99
|
+
mimeType: e.string().optional(),
|
|
100
|
+
altText: e.string().optional(),
|
|
101
|
+
transcript: m.optional(),
|
|
102
|
+
caption: m.optional(),
|
|
103
|
+
width: e.number().int().positive().optional(),
|
|
104
|
+
height: e.number().int().positive().optional(),
|
|
105
|
+
start: e.number().nonnegative().optional(),
|
|
106
|
+
end: e.number().positive().optional(),
|
|
107
|
+
loop: e.boolean().optional(),
|
|
108
|
+
subtitles: e.array(g).optional(),
|
|
109
|
+
license: l.optional(),
|
|
110
|
+
attribution: e.string().optional(),
|
|
111
|
+
checksums: e.record(e.string(), e.string()).optional()
|
|
112
|
+
}).refine((e) => e.start !== void 0 && e.end !== void 0 ? e.start < e.end : !0, {
|
|
113
|
+
message: "Po��+�te��n+� ��as mus+� b+�t men+�+� ne+� koncov+� ��as",
|
|
114
|
+
path: ["end"]
|
|
115
|
+
}).refine((e) => !(e.type === "image" && !e.altText), {
|
|
116
|
+
message: "Obr+�zky mus+� m+�t definovan+� alternativn+� text (altText) pro p+�+�stupnost",
|
|
117
|
+
path: ["altText"]
|
|
118
|
+
}), _ = e.record(f, ve), v = e.object({
|
|
119
|
+
name: p,
|
|
120
|
+
role: e.string().optional(),
|
|
121
|
+
email: e.string().email("Neplatn+� form+�t e-mailov+� adresy").optional(),
|
|
122
|
+
url: d.optional()
|
|
123
|
+
}), y = e.enum([
|
|
124
|
+
"url",
|
|
125
|
+
"doi",
|
|
126
|
+
"isbn",
|
|
127
|
+
"pdf",
|
|
128
|
+
"textbook",
|
|
129
|
+
"video",
|
|
130
|
+
"audio",
|
|
131
|
+
"image",
|
|
132
|
+
"model",
|
|
133
|
+
"other"
|
|
134
|
+
]), b = e.object({
|
|
135
|
+
id: p,
|
|
136
|
+
type: y,
|
|
137
|
+
value: p,
|
|
138
|
+
title: p,
|
|
139
|
+
description: e.string().optional(),
|
|
140
|
+
authors: e.array(p).optional(),
|
|
141
|
+
publishedDate: u.optional(),
|
|
142
|
+
retrievedAt: u.optional(),
|
|
143
|
+
license: l.optional()
|
|
144
|
+
}).refine((e) => {
|
|
145
|
+
if ([
|
|
146
|
+
"url",
|
|
147
|
+
"pdf",
|
|
148
|
+
"video",
|
|
149
|
+
"audio",
|
|
150
|
+
"image"
|
|
151
|
+
].includes(e.type)) try {
|
|
152
|
+
return new URL(e.value), !0;
|
|
153
|
+
} catch {
|
|
154
|
+
return !1;
|
|
155
|
+
}
|
|
156
|
+
return !0;
|
|
157
|
+
}, {
|
|
158
|
+
message: "Pro typy url, pdf, video, audio a image mus+� b+�t value platn+� URL adresa",
|
|
159
|
+
path: ["value"]
|
|
160
|
+
}), x = e.object({
|
|
161
|
+
id: p,
|
|
162
|
+
location: e.string().optional(),
|
|
163
|
+
quote: m.optional()
|
|
164
|
+
}), S = e.object({
|
|
165
|
+
wikidataId: e.string().regex(/^Q\d+$/, "Wikidata ID mus+� m+�t form+�t Q n+�sledovan+� ��+�slem").optional(),
|
|
166
|
+
description: e.string().optional()
|
|
167
|
+
}), C = e.record(e.string(), S), w = e.object({
|
|
168
|
+
features: e.array(e.string().min(1, "Kl+��� funkce nesm+� b+�t pr+�zdn+�")).optional(),
|
|
169
|
+
latexPackages: e.array(e.string().min(1, "N+�zev bal+���ku nesm+� b+�t pr+�zdn+�")).optional(),
|
|
170
|
+
itemProperties: e.array(e.string().min(1, "Kl+��� vlastnosti nesm+� b+�t pr+�zdn+�")).optional(),
|
|
171
|
+
metaProperties: e.array(e.string().min(1, "Kl+��� vlastnosti nesm+� b+�t pr+�zdn+�")).optional()
|
|
172
|
+
}), T = e.enum([
|
|
173
|
+
"official",
|
|
174
|
+
"experimental",
|
|
175
|
+
"proprietary"
|
|
176
|
+
]), ye = e.enum([
|
|
177
|
+
"math",
|
|
178
|
+
"media-image",
|
|
179
|
+
"media-audio",
|
|
180
|
+
"media-video",
|
|
181
|
+
"hotspots",
|
|
182
|
+
"complex-pairing",
|
|
183
|
+
"open-text"
|
|
184
|
+
]), E = e.object({
|
|
185
|
+
name: p,
|
|
186
|
+
type: T,
|
|
187
|
+
vendor: e.string().optional()
|
|
188
|
+
}).refine((e) => !(e.type === "proprietary" && !e.vendor), {
|
|
189
|
+
message: "Propriet+�rn+� funkce mus+� m+�t definovan+� vendor (nap+�. \"memizy.com\")",
|
|
190
|
+
path: ["vendor"]
|
|
191
|
+
}), D = e.object({
|
|
192
|
+
lang: c,
|
|
193
|
+
id: s,
|
|
194
|
+
title: p,
|
|
195
|
+
downloadUrl: d.optional()
|
|
196
|
+
}), O = e.object({
|
|
197
|
+
id: s,
|
|
198
|
+
title: p,
|
|
199
|
+
downloadUrl: d.optional()
|
|
200
|
+
}), k = e.enum([
|
|
201
|
+
"remember",
|
|
202
|
+
"understand",
|
|
203
|
+
"apply",
|
|
204
|
+
"analyze",
|
|
205
|
+
"evaluate",
|
|
206
|
+
"create"
|
|
207
|
+
]), A = e.enum([
|
|
208
|
+
"low",
|
|
209
|
+
"medium",
|
|
210
|
+
"high"
|
|
211
|
+
]), j = e.object({
|
|
212
|
+
bloomLevel: k.optional(),
|
|
213
|
+
irtDifficulty: e.number().optional(),
|
|
214
|
+
irtDiscrimination: e.number().optional(),
|
|
215
|
+
irtGuessing: e.number().min(0).max(1, "IRT guessing mus+� b+�t mezi 0 a 1").optional(),
|
|
216
|
+
avgTime: e.number().positive().optional(),
|
|
217
|
+
cognitiveLoad: A.optional(),
|
|
218
|
+
partialCredit: e.boolean().optional(),
|
|
219
|
+
penaltyPerWrong: e.number().min(0).max(1, "Penalizace mus+� b+�t mezi 0 a 1").optional()
|
|
220
|
+
}), M = e.enum(["katex", "mathjax"]), N = e.object({
|
|
221
|
+
renderer: M.optional(),
|
|
222
|
+
packages: e.array(e.string()).optional()
|
|
223
|
+
}), P = e.object({
|
|
224
|
+
id: s,
|
|
225
|
+
language: c,
|
|
226
|
+
title: p.max(500, "Titulek nesm+� b+�t del+�+� ne+� 500 znak+�"),
|
|
227
|
+
description: m.max(5e3, "Popis nesm+� b+�t del+�+� ne+� 5000 znak+�").optional(),
|
|
228
|
+
thumbnail: f.optional(),
|
|
229
|
+
assets: _.optional(),
|
|
230
|
+
ageMin: e.number().int().nonnegative().optional(),
|
|
231
|
+
ageMax: e.number().int().nonnegative().optional(),
|
|
232
|
+
subject: e.string().optional(),
|
|
233
|
+
createdAt: u,
|
|
234
|
+
updatedAt: u,
|
|
235
|
+
author: v.optional(),
|
|
236
|
+
contributors: e.array(v).optional(),
|
|
237
|
+
license: l.optional(),
|
|
238
|
+
licenseUrl: d.optional(),
|
|
239
|
+
requirements: w.optional(),
|
|
240
|
+
requiredFeatures: e.array(E).optional(),
|
|
241
|
+
tags: e.array(p).optional(),
|
|
242
|
+
tagDefinitions: C.optional(),
|
|
243
|
+
translations: e.array(D).optional(),
|
|
244
|
+
sourceMaterials: e.array(b).optional(),
|
|
245
|
+
estimatedTime: e.number().positive().optional(),
|
|
246
|
+
prerequisites: e.array(O).optional(),
|
|
247
|
+
relatedSets: e.array(O).optional(),
|
|
248
|
+
mathSettings: N.optional(),
|
|
249
|
+
customData: e.record(e.string(), e.unknown()).optional(),
|
|
250
|
+
appSpecific: e.record(e.string(), e.unknown()).optional()
|
|
251
|
+
}).refine((e) => e.ageMin !== void 0 && e.ageMax !== void 0 ? e.ageMin <= e.ageMax : !0, {
|
|
252
|
+
message: "Minim+�ln+� v��k (ageMin) mus+� b+�t men+�+� nebo roven maxim+�ln+�mu v��ku (ageMax)",
|
|
253
|
+
path: ["ageMax"]
|
|
254
|
+
}).refine((e) => new Date(e.createdAt) <= new Date(e.updatedAt), {
|
|
255
|
+
message: "Datum vytvo+�en+� (createdAt) mus+� b+�t p+�ed nebo stejn+� jako datum aktualizace (updatedAt)",
|
|
256
|
+
path: ["updatedAt"]
|
|
257
|
+
}), F = e.object({
|
|
258
|
+
id: s,
|
|
259
|
+
type: e.string(),
|
|
260
|
+
assets: _.optional(),
|
|
261
|
+
lang: c.optional(),
|
|
262
|
+
tags: e.array(p).optional(),
|
|
263
|
+
difficulty: e.number().int().min(1, "Obt+�+�nost mus+� b+�t minim+�ln�� 1").max(5, "Obt+�+�nost mus+� b+�t maxim+�ln�� 5").optional(),
|
|
264
|
+
timeLimit: e.number().positive("��asov+� limit mus+� b+�t kladn+� ��+�slo").optional(),
|
|
265
|
+
hints: e.array(m.max(2e3, "N+�pov��da nesm+� b+�t del+�+� ne+� 2000 znak+�")).max(20, "Maxim+�ln�� 20 n+�pov��d na polo+�ku").optional(),
|
|
266
|
+
explanation: m.max(1e4, "Vysv��tlen+� nesm+� b+�t del+�+� ne+� 10000 znak+�").optional(),
|
|
267
|
+
incorrectFeedback: m.optional(),
|
|
268
|
+
sources: e.array(x).optional(),
|
|
269
|
+
relatedItems: e.array(s).optional(),
|
|
270
|
+
dependencyItems: e.array(s).optional(),
|
|
271
|
+
pedagogy: j.optional(),
|
|
272
|
+
customData: e.record(e.string(), e.unknown()).optional(),
|
|
273
|
+
appSpecific: e.record(e.string(), e.unknown()).optional()
|
|
274
|
+
}), I = e.object({
|
|
275
|
+
options: e.array(m).min(1, "Mus+� b+�t alespo+� 1 mo+�nost"),
|
|
276
|
+
correctIndex: e.number().int().nonnegative()
|
|
277
|
+
}).refine((e) => e.correctIndex < e.options.length, {
|
|
278
|
+
message: "Index spr+�vn+� odpov��di odkazuje na neexistuj+�c+� mo+�nost",
|
|
279
|
+
path: ["correctIndex"]
|
|
280
|
+
}), L = e.object({
|
|
281
|
+
type: e.literal("rect"),
|
|
282
|
+
label: e.string().optional(),
|
|
283
|
+
x: e.number().min(0).max(100, "X mus+� b+�t v rozmez+� 0-100%"),
|
|
284
|
+
y: e.number().min(0).max(100, "Y mus+� b+�t v rozmez+� 0-100%"),
|
|
285
|
+
width: e.number().min(0).max(100, "+�+�+�ka mus+� b+�t v rozmez+� 0-100%"),
|
|
286
|
+
height: e.number().min(0).max(100, "V+�+�ka mus+� b+�t v rozmez+� 0-100%")
|
|
287
|
+
}), R = e.object({
|
|
288
|
+
type: e.literal("circle"),
|
|
289
|
+
label: e.string().optional(),
|
|
290
|
+
x: e.number().min(0).max(100, "X mus+� b+�t v rozmez+� 0-100%"),
|
|
291
|
+
y: e.number().min(0).max(100, "Y mus+� b+�t v rozmez+� 0-100%"),
|
|
292
|
+
radius: e.number().min(0).max(100, "Polom��r mus+� b+�t v rozmez+� 0-100%")
|
|
293
|
+
}), z = e.object({
|
|
294
|
+
type: e.literal("polygon"),
|
|
295
|
+
label: e.string().optional(),
|
|
296
|
+
points: e.array(e.object({
|
|
297
|
+
x: e.number().min(0).max(100),
|
|
298
|
+
y: e.number().min(0).max(100)
|
|
299
|
+
})).min(3, "Polygon mus+� m+�t alespo+� 3 body")
|
|
300
|
+
}), B = e.object({
|
|
301
|
+
type: e.literal("mesh"),
|
|
302
|
+
label: e.string().optional(),
|
|
303
|
+
targetName: p
|
|
304
|
+
}), V = e.discriminatedUnion("type", [
|
|
305
|
+
L,
|
|
306
|
+
R,
|
|
307
|
+
z,
|
|
308
|
+
B
|
|
309
|
+
]), H = e.object({
|
|
310
|
+
x: e.number(),
|
|
311
|
+
y: e.number(),
|
|
312
|
+
z: e.number()
|
|
313
|
+
}), U = e.object({
|
|
314
|
+
position: H.optional(),
|
|
315
|
+
target: H.optional()
|
|
316
|
+
}), be = e.object({
|
|
317
|
+
id: p,
|
|
318
|
+
text: m,
|
|
319
|
+
correctCategoryIndex: e.number().int().nonnegative()
|
|
320
|
+
}), xe = e.enum([
|
|
321
|
+
"year",
|
|
322
|
+
"month",
|
|
323
|
+
"day",
|
|
324
|
+
"datetime"
|
|
325
|
+
]), Se = e.object({
|
|
326
|
+
id: p,
|
|
327
|
+
text: m,
|
|
328
|
+
date: u,
|
|
329
|
+
precision: xe.optional()
|
|
330
|
+
}), Ce = e.union([
|
|
331
|
+
L.extend({ correctLabelIndex: e.number().int().nonnegative() }),
|
|
332
|
+
R.extend({ correctLabelIndex: e.number().int().nonnegative() }),
|
|
333
|
+
z.extend({ correctLabelIndex: e.number().int().nonnegative() })
|
|
334
|
+
]), we = e.object({
|
|
335
|
+
label: p,
|
|
336
|
+
percentage: e.number().min(0, "Procenta mus+� b+�t nez+�porn+�").max(100, "Procenta nesm+� p+�es+�hnout 100"),
|
|
337
|
+
description: e.string().optional()
|
|
338
|
+
}), Te = e.object({ criteria: e.array(we).min(1, "Rubrika mus+� m+�t alespo+� 1 krit+�rium") }).refine((e) => e.criteria.reduce((e, t) => e + t.percentage, 0) > 0, {
|
|
339
|
+
message: "Sou��et procent v+�ech krit+�ri+� mus+� b+�t v��t+�+� ne+� 0",
|
|
340
|
+
path: ["criteria"]
|
|
341
|
+
}), Ee = e.object({
|
|
342
|
+
min: e.number(),
|
|
343
|
+
max: e.number()
|
|
344
|
+
}).refine((e) => e.min <= e.max, {
|
|
345
|
+
message: "Minim+�ln+� hodnota mus+� b+�t men+�+� nebo rovna maxim+�ln+� hodnot��",
|
|
346
|
+
path: ["max"]
|
|
347
|
+
}), De = F.extend({
|
|
348
|
+
type: e.literal("note"),
|
|
349
|
+
title: e.string().optional(),
|
|
350
|
+
content: m.max(1e4, "Obsah nesm+� b+�t del+�+� ne+� 10000 znak+�")
|
|
351
|
+
}), Oe = F.extend({
|
|
352
|
+
type: e.literal("flashcard"),
|
|
353
|
+
front: m.max(1e4, "P+�edn+� strana nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
354
|
+
back: m.max(1e4, "Zadn+� strana nesm+� b+�t del+�+� ne+� 10000 znak+�")
|
|
355
|
+
}), ke = F.extend({
|
|
356
|
+
type: e.literal("true-false"),
|
|
357
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
358
|
+
answer: e.boolean()
|
|
359
|
+
}), Ae = F.extend({
|
|
360
|
+
type: e.literal("mcq-single"),
|
|
361
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
362
|
+
options: e.array(m.max(2e3, "Mo+�nost nesm+� b+�t del+�+� ne+� 2000 znak+�")).min(2, "Ot+�zka mus+� m+�t alespo+� 2 mo+�nosti").max(100, "Maxim+�ln�� 100 mo+�nost+�"),
|
|
363
|
+
correctIndex: e.number().int().nonnegative(),
|
|
364
|
+
shuffleOptions: e.boolean().optional(),
|
|
365
|
+
optionExplanations: e.array(e.union([m, e.null()])).optional()
|
|
366
|
+
}).refine((e) => e.correctIndex < e.options.length, {
|
|
367
|
+
message: "Index spr+�vn+� odpov��di odkazuje na neexistuj+�c+� mo+�nost",
|
|
368
|
+
path: ["correctIndex"]
|
|
369
|
+
}).refine((e) => e.optionExplanations ? e.optionExplanations.length === e.options.length : !0, {
|
|
370
|
+
message: "Po��et vysv��tlen+� mo+�nost+� mus+� b+�t stejn+� jako po��et mo+�nost+�",
|
|
371
|
+
path: ["optionExplanations"]
|
|
372
|
+
}), je = F.extend({
|
|
373
|
+
type: e.literal("mcq-multi"),
|
|
374
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
375
|
+
options: e.array(m.max(2e3, "Mo+�nost nesm+� b+�t del+�+� ne+� 2000 znak+�")).min(2, "Ot+�zka mus+� m+�t alespo+� 2 mo+�nosti").max(100, "Maxim+�ln�� 100 mo+�nost+�"),
|
|
376
|
+
correctIndices: e.array(e.number().int().nonnegative()).min(1, "Mus+� b+�t alespo+� 1 spr+�vn+� odpov����"),
|
|
377
|
+
minSelections: e.number().int().positive().optional(),
|
|
378
|
+
maxSelections: e.number().int().positive().optional(),
|
|
379
|
+
shuffleOptions: e.boolean().optional(),
|
|
380
|
+
optionExplanations: e.array(e.union([m, e.null()])).optional()
|
|
381
|
+
}).refine((e) => e.correctIndices.every((t) => t < e.options.length), {
|
|
382
|
+
message: "N��kter+� z index+� spr+�vn+�ch odpov��d+� odkazuje na neexistuj+�c+� mo+�nost",
|
|
383
|
+
path: ["correctIndices"]
|
|
384
|
+
}).refine((e) => new Set(e.correctIndices).size === e.correctIndices.length, {
|
|
385
|
+
message: "Indexy spr+�vn+�ch odpov��d+� obsahuj+� duplicity",
|
|
386
|
+
path: ["correctIndices"]
|
|
387
|
+
}).refine((e) => e.minSelections && e.maxSelections ? e.minSelections <= e.maxSelections : !0, {
|
|
388
|
+
message: "Minim+�ln+� po��et v+�b��r+� mus+� b+�t men+�+� nebo roven maxim+�ln+�mu po��tu",
|
|
389
|
+
path: ["maxSelections"]
|
|
390
|
+
}).refine((e) => e.maxSelections ? e.maxSelections <= e.options.length : !0, {
|
|
391
|
+
message: "Maxim+�ln+� po��et v+�b��r+� nesm+� p+�es+�hnout po��et mo+�nost+�",
|
|
392
|
+
path: ["maxSelections"]
|
|
393
|
+
}).refine((e) => e.optionExplanations ? e.optionExplanations.length === e.options.length : !0, {
|
|
394
|
+
message: "Po��et vysv��tlen+� mo+�nost+� mus+� b+�t stejn+� jako po��et mo+�nost+�",
|
|
395
|
+
path: ["optionExplanations"]
|
|
396
|
+
}), W = F.extend({
|
|
397
|
+
type: e.literal("short-answer"),
|
|
398
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
399
|
+
answers: e.array(p).min(1, "Mus+� b+�t alespo+� 1 spr+�vn+� odpov����"),
|
|
400
|
+
caseSensitive: e.boolean().optional(),
|
|
401
|
+
trimWhitespace: e.boolean().optional(),
|
|
402
|
+
acceptPartial: e.boolean().optional(),
|
|
403
|
+
ignoreDiacritics: e.boolean().optional()
|
|
404
|
+
}), Me = F.extend({
|
|
405
|
+
type: e.literal("fill-in-blanks"),
|
|
406
|
+
question: h,
|
|
407
|
+
text: m.max(1e4, "Text nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
408
|
+
blanks: e.record(e.string(), e.array(p).min(1, "Ka+�d+� mezera mus+� m+�t alespo+� 1 spr+�vnou odpov����")),
|
|
409
|
+
caseSensitive: e.boolean().optional(),
|
|
410
|
+
trimWhitespace: e.boolean().optional()
|
|
411
|
+
}).refine((e) => Object.keys(e.blanks).length > 0, {
|
|
412
|
+
message: "Text mus+� obsahovat alespo+� 1 mezeru k dopln��n+�",
|
|
413
|
+
path: ["blanks"]
|
|
414
|
+
}).refine((e) => {
|
|
415
|
+
let t = /<blank:([a-zA-Z0-9_-]{1,64})\s*\/>/g, n = /* @__PURE__ */ new Set(), r;
|
|
416
|
+
for (; (r = t.exec(e.text)) !== null;) r[1] && n.add(r[1]);
|
|
417
|
+
let i = new Set(Object.keys(e.blanks));
|
|
418
|
+
for (let e of n) if (!i.has(e)) return !1;
|
|
419
|
+
for (let e of i) if (!n.has(e)) return !1;
|
|
420
|
+
return !0;
|
|
421
|
+
}, {
|
|
422
|
+
message: "V+�echny tokeny v textu mus+� m+�t definici v blanks a v+�echny definice mus+� b+�t pou+�ity v textu",
|
|
423
|
+
path: ["blanks"]
|
|
424
|
+
}), Ne = F.extend({
|
|
425
|
+
type: e.literal("fill-in-select"),
|
|
426
|
+
question: h,
|
|
427
|
+
text: m.max(1e4, "Text nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
428
|
+
blanks: e.record(e.string(), I)
|
|
429
|
+
}).refine((e) => Object.keys(e.blanks).length > 0, {
|
|
430
|
+
message: "Text mus+� obsahovat alespo+� 1 mezeru k v+�b��ru",
|
|
431
|
+
path: ["blanks"]
|
|
432
|
+
}).refine((e) => {
|
|
433
|
+
let t = /<blank:([a-zA-Z0-9_-]{1,64})\s*\/>/g, n = /* @__PURE__ */ new Set(), r;
|
|
434
|
+
for (; (r = t.exec(e.text)) !== null;) r[1] && n.add(r[1]);
|
|
435
|
+
let i = new Set(Object.keys(e.blanks));
|
|
436
|
+
for (let e of n) if (!i.has(e)) return !1;
|
|
437
|
+
for (let e of i) if (!n.has(e)) return !1;
|
|
438
|
+
return !0;
|
|
439
|
+
}, {
|
|
440
|
+
message: "V+�echny tokeny v textu mus+� m+�t definici v blanks a v+�echny definice mus+� b+�t pou+�ity v textu",
|
|
441
|
+
path: ["blanks"]
|
|
442
|
+
}), Pe = F.extend({
|
|
443
|
+
type: e.literal("match-pairs"),
|
|
444
|
+
question: h,
|
|
445
|
+
prompts: e.array(m).min(2, "Mus+� b+�t alespo+� 2 p+�ry k p+�i+�azen+�"),
|
|
446
|
+
matches: e.array(m).min(2, "Mus+� b+�t alespo+� 2 p+�ry k p+�i+�azen+�")
|
|
447
|
+
}).refine((e) => e.prompts.length === e.matches.length, {
|
|
448
|
+
message: "Po��et ot+�zek (prompts) mus+� b+�t stejn+� jako po��et odpov��d+� (matches)",
|
|
449
|
+
path: ["matches"]
|
|
450
|
+
}), Fe = F.extend({
|
|
451
|
+
type: e.literal("match-complex"),
|
|
452
|
+
question: h,
|
|
453
|
+
leftItems: e.array(m).min(1, "Mus+� b+�t alespo+� 1 polo+�ka vlevo"),
|
|
454
|
+
rightItems: e.array(m).min(1, "Mus+� b+�t alespo+� 1 polo+�ka vpravo"),
|
|
455
|
+
connections: e.array(e.tuple([e.number().int().nonnegative(), e.number().int().nonnegative()])).min(1, "Mus+� b+�t alespo+� 1 propojen+�"),
|
|
456
|
+
minCorrect: e.number().int().positive().optional()
|
|
457
|
+
}).refine((e) => e.connections.every(([t, n]) => t < e.leftItems.length && n < e.rightItems.length), {
|
|
458
|
+
message: "N��kter+� propojen+� odkazuje na neexistuj+�c+� polo+�ku",
|
|
459
|
+
path: ["connections"]
|
|
460
|
+
}).refine((e) => new Set(e.connections.map((e) => `${e[0]}-${e[1]}`)).size === e.connections.length, {
|
|
461
|
+
message: "Propojen+� obsahuj+� duplicity",
|
|
462
|
+
path: ["connections"]
|
|
463
|
+
}).refine((e) => e.minCorrect ? e.minCorrect <= e.connections.length : !0, {
|
|
464
|
+
message: "Minim+�ln+� po��et spr+�vn+�ch odpov��d+� nesm+� p+�es+�hnout celkov+� po��et propojen+�",
|
|
465
|
+
path: ["minCorrect"]
|
|
466
|
+
}), Ie = F.extend({
|
|
467
|
+
type: e.literal("sort-items"),
|
|
468
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
469
|
+
items: e.array(m).min(2, "Mus+� b+�t alespo+� 2 polo+�ky k se+�azen+�")
|
|
470
|
+
}), Le = F.extend({
|
|
471
|
+
type: e.literal("slider"),
|
|
472
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
473
|
+
min: e.number(),
|
|
474
|
+
max: e.number(),
|
|
475
|
+
step: e.number().positive("Krok mus+� b+�t kladn+� ��+�slo"),
|
|
476
|
+
correctAnswer: e.number(),
|
|
477
|
+
tolerance: e.number().nonnegative("Tolerance mus+� b+�t nez+�porn+�"),
|
|
478
|
+
unit: e.string().optional()
|
|
479
|
+
}).refine((e) => e.min < e.max, {
|
|
480
|
+
message: "Minim+�ln+� hodnota mus+� b+�t men+�+� ne+� maxim+�ln+� hodnota",
|
|
481
|
+
path: ["max"]
|
|
482
|
+
}).refine((e) => e.correctAnswer >= e.min && e.correctAnswer <= e.max, {
|
|
483
|
+
message: "Spr+�vn+� odpov���� mus+� b+�t v rozmez+� min-max",
|
|
484
|
+
path: ["correctAnswer"]
|
|
485
|
+
}).refine((e) => {
|
|
486
|
+
let t = (e.correctAnswer - e.min) / e.step;
|
|
487
|
+
return Math.abs(t - Math.round(t)) < 1e-4;
|
|
488
|
+
}, {
|
|
489
|
+
message: "Spr+�vn+� odpov���� mus+� b+�t dosa+�iteln+� pomoc+� definovan+�ho kroku",
|
|
490
|
+
path: ["correctAnswer"]
|
|
491
|
+
}).refine((e) => e.tolerance <= (e.max - e.min) / 2, {
|
|
492
|
+
message: "Tolerance nesm+� b+�t v��t+�+� ne+� polovina rozsahu hodnot",
|
|
493
|
+
path: ["tolerance"]
|
|
494
|
+
}), Re = F.extend({
|
|
495
|
+
type: e.literal("pin-on-image"),
|
|
496
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
497
|
+
targetAsset: f,
|
|
498
|
+
hotspots: e.array(V).min(1, "Mus+� b+�t alespo+� 1 hotspot"),
|
|
499
|
+
multipleCorrect: e.boolean().optional(),
|
|
500
|
+
minCorrect: e.number().int().positive().optional()
|
|
501
|
+
}).refine((e) => e.minCorrect ? e.minCorrect <= e.hotspots.length : !0, {
|
|
502
|
+
message: "Minim+�ln+� po��et spr+�vn+�ch odpov��d+� nesm+� p+�es+�hnout po��et hotspot+�",
|
|
503
|
+
path: ["minCorrect"]
|
|
504
|
+
}), ze = F.extend({
|
|
505
|
+
type: e.literal("categorize"),
|
|
506
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
507
|
+
categories: e.array(p).min(2, "Mus+� b+�t alespo+� 2 kategorie"),
|
|
508
|
+
items: e.array(be).min(1, "Mus+� b+�t alespo+� 1 polo+�ka ke kategorizaci")
|
|
509
|
+
}).refine((e) => e.items.every((t) => t.correctCategoryIndex < e.categories.length), {
|
|
510
|
+
message: "N��kter+� polo+�ka odkazuje na neexistuj+�c+� kategorii",
|
|
511
|
+
path: ["items"]
|
|
512
|
+
}), Be = F.extend({
|
|
513
|
+
type: e.literal("timeline"),
|
|
514
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
515
|
+
events: e.array(Se).min(2, "Mus+� b+�t alespo+� 2 ud+�losti"),
|
|
516
|
+
randomize: e.boolean().optional()
|
|
517
|
+
}), Ve = F.extend({
|
|
518
|
+
type: e.literal("matrix"),
|
|
519
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
520
|
+
rows: e.array(p).min(1, "Mus+� b+�t alespo+� 1 +�+�dek"),
|
|
521
|
+
columns: e.array(p).min(1, "Mus+� b+�t alespo+� 1 sloupec"),
|
|
522
|
+
correctCells: e.array(e.tuple([e.number().int().nonnegative(), e.number().int().nonnegative()])).min(1, "Mus+� b+�t alespo+� 1 spr+�vn+� bu+�ka"),
|
|
523
|
+
multiplePerRow: e.boolean().optional()
|
|
524
|
+
}).refine((e) => e.correctCells.every(([t, n]) => t < e.rows.length && n < e.columns.length), {
|
|
525
|
+
message: "N��kter+� sou+�adnice bu+�ky odkazuj+� na neexistuj+�c+� +�+�dek nebo sloupec",
|
|
526
|
+
path: ["correctCells"]
|
|
527
|
+
}).refine((e) => new Set(e.correctCells.map((e) => `${e[0]}-${e[1]}`)).size === e.correctCells.length, {
|
|
528
|
+
message: "Spr+�vn+� bu+�ky obsahuj+� duplicity",
|
|
529
|
+
path: ["correctCells"]
|
|
530
|
+
}).refine((e) => {
|
|
531
|
+
if (!e.multiplePerRow) {
|
|
532
|
+
let t = /* @__PURE__ */ new Map();
|
|
533
|
+
for (let [n] of e.correctCells) t.set(n, (t.get(n) || 0) + 1);
|
|
534
|
+
return Array.from(t.values()).every((e) => e <= 1);
|
|
535
|
+
}
|
|
536
|
+
return !0;
|
|
537
|
+
}, {
|
|
538
|
+
message: "Pokud multiplePerRow je false, ka+�d+� +�+�dek sm+� m+�t maxim+�ln�� 1 spr+�vnou bu+�ku",
|
|
539
|
+
path: ["correctCells"]
|
|
540
|
+
}), He = F.extend({
|
|
541
|
+
type: e.literal("math-input"),
|
|
542
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
543
|
+
correctAnswer: p,
|
|
544
|
+
alternativeAnswers: e.array(p).optional(),
|
|
545
|
+
tolerance: e.number().nonnegative().optional()
|
|
546
|
+
}), Ue = F.extend({
|
|
547
|
+
type: e.literal("diagram-label"),
|
|
548
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
549
|
+
targetAsset: f,
|
|
550
|
+
labels: e.array(m).min(1, "Mus+� b+�t alespo+� 1 +�t+�tek"),
|
|
551
|
+
caseSensitive: e.boolean().optional(),
|
|
552
|
+
requireTyping: e.boolean().optional(),
|
|
553
|
+
zones: e.array(Ce).min(1, "Mus+� b+�t alespo+� 1 z+-na")
|
|
554
|
+
}).refine((e) => e.zones.every((t) => t.correctLabelIndex < e.labels.length), {
|
|
555
|
+
message: "N��kter+� z+-na odkazuje na neexistuj+�c+� +�t+�tek",
|
|
556
|
+
path: ["zones"]
|
|
557
|
+
}), We = F.extend({
|
|
558
|
+
type: e.literal("open-ended"),
|
|
559
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
560
|
+
minWords: e.number().int().positive().optional(),
|
|
561
|
+
maxWords: e.number().int().positive().optional(),
|
|
562
|
+
sampleAnswer: m.optional(),
|
|
563
|
+
rubric: Te.optional()
|
|
564
|
+
}).refine((e) => e.minWords && e.maxWords ? e.minWords <= e.maxWords : !0, {
|
|
565
|
+
message: "Minim+�ln+� po��et slov mus+� b+�t men+�+� nebo roven maxim+�ln+�mu po��tu",
|
|
566
|
+
path: ["maxWords"]
|
|
567
|
+
}), Ge = F.extend({
|
|
568
|
+
type: e.literal("numeric-input"),
|
|
569
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
570
|
+
value: e.number(),
|
|
571
|
+
tolerance: e.number().nonnegative().optional(),
|
|
572
|
+
range: Ee.optional(),
|
|
573
|
+
unit: e.string().optional()
|
|
574
|
+
}), Ke = F.extend({
|
|
575
|
+
type: e.literal("pin-on-model"),
|
|
576
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
577
|
+
targetAsset: f,
|
|
578
|
+
hotspots: e.array(B).min(1, "Mus+� b+�t alespo+� 1 hotspot"),
|
|
579
|
+
multipleCorrect: e.boolean().optional(),
|
|
580
|
+
minCorrect: e.number().int().positive().optional(),
|
|
581
|
+
camera: U.optional()
|
|
582
|
+
}).refine((e) => e.minCorrect ? e.minCorrect <= e.hotspots.length : !0, {
|
|
583
|
+
message: "Minim+�ln+� po��et spr+�vn+�ch odpov��d+� nesm+� p+�es+�hnout po��et hotspot+�",
|
|
584
|
+
path: ["minCorrect"]
|
|
585
|
+
}), qe = F.extend({
|
|
586
|
+
type: e.literal("chess-puzzle"),
|
|
587
|
+
question: m.max(1e4, "Ot+�zka nesm+� b+�t del+�+� ne+� 10000 znak+�"),
|
|
588
|
+
fen: p,
|
|
589
|
+
answers: e.array(e.array(p).min(1, "Sekvence tah+� nesm+� b+�t pr+�zdn+�")).min(1, "Mus+� b+�t alespo+� 1 spr+�vn+� sekvence tah+�"),
|
|
590
|
+
elo: e.number().int().nonnegative("ELO mus+� b+�t nez+�porn+� cel+� ��+�slo").optional()
|
|
591
|
+
}), G = e.discriminatedUnion("type", [
|
|
592
|
+
De,
|
|
593
|
+
Oe,
|
|
594
|
+
ke,
|
|
595
|
+
Ae,
|
|
596
|
+
je,
|
|
597
|
+
W,
|
|
598
|
+
Me,
|
|
599
|
+
Ne,
|
|
600
|
+
Pe,
|
|
601
|
+
Fe,
|
|
602
|
+
Ie,
|
|
603
|
+
Le,
|
|
604
|
+
Re,
|
|
605
|
+
ze,
|
|
606
|
+
Be,
|
|
607
|
+
Ve,
|
|
608
|
+
He,
|
|
609
|
+
Ue,
|
|
610
|
+
We,
|
|
611
|
+
Ge,
|
|
612
|
+
Ke,
|
|
613
|
+
qe
|
|
614
|
+
]), K = e.object({
|
|
615
|
+
$schema: e.string().url().optional(),
|
|
616
|
+
version: e.string().regex(/^\d+\.\d+$/, "Verze musi byt ve formatu \"X.Y\" (napr. \"0.1\")"),
|
|
617
|
+
meta: P,
|
|
618
|
+
items: e.array(G).max(1e4, "Maxim+�ln�� 10000 polo+�ek na sadu")
|
|
619
|
+
}).refine((e) => {
|
|
620
|
+
let t = new Set(e.items.map((e) => e.id));
|
|
621
|
+
for (let n of e.items) {
|
|
622
|
+
if (n.relatedItems) {
|
|
623
|
+
for (let e of n.relatedItems) if (!t.has(e)) return !1;
|
|
624
|
+
}
|
|
625
|
+
if (n.dependencyItems) {
|
|
626
|
+
for (let e of n.dependencyItems) if (!t.has(e)) return !1;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
return !0;
|
|
630
|
+
}, {
|
|
631
|
+
message: "N��kter+� polo+�ka odkazuje na neexistuj+�c+� relatedItems nebo dependencyItems",
|
|
632
|
+
path: ["items"]
|
|
633
|
+
}).refine((e) => e.meta.thumbnail && e.meta.assets ? e.meta.thumbnail in e.meta.assets : !0, {
|
|
634
|
+
message: "Thumbnail odkazuje na neexistuj+�c+� asset",
|
|
635
|
+
path: ["meta", "thumbnail"]
|
|
636
|
+
}).refine((e) => {
|
|
637
|
+
let t = new Set((e.meta.sourceMaterials || []).map((e) => e.id));
|
|
638
|
+
for (let n of e.items) if (n.sources) {
|
|
639
|
+
for (let e of n.sources) if (!t.has(e.id)) return !1;
|
|
640
|
+
}
|
|
641
|
+
return !0;
|
|
642
|
+
}, {
|
|
643
|
+
message: "N��kter+� polo+�ka odkazuje na neexistuj+�c+� source material",
|
|
644
|
+
path: ["items"]
|
|
645
|
+
});
|
|
646
|
+
function Je(e) {
|
|
647
|
+
return K.parse(e);
|
|
648
|
+
}
|
|
649
|
+
function Ye(e) {
|
|
650
|
+
let t = K.safeParse(e);
|
|
651
|
+
return t.success ? {
|
|
652
|
+
success: !0,
|
|
653
|
+
data: t.data
|
|
654
|
+
} : {
|
|
655
|
+
success: !1,
|
|
656
|
+
error: t.error
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
function Xe(e) {
|
|
660
|
+
return G.parse(e);
|
|
661
|
+
}
|
|
662
|
+
function Ze(e) {
|
|
663
|
+
let t = G.safeParse(e);
|
|
664
|
+
return t.success ? {
|
|
665
|
+
success: !0,
|
|
666
|
+
data: t.data
|
|
667
|
+
} : {
|
|
668
|
+
success: !1,
|
|
669
|
+
error: t.error
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
function Qe(e) {
|
|
673
|
+
return e.issues.map((e) => {
|
|
674
|
+
let t = e.path.join(" ��� ");
|
|
675
|
+
return t ? `${t}: ${e.message}` : e.message;
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region src/manifest.ts
|
|
680
|
+
function q(e) {
|
|
681
|
+
return /^\d+\.\d+$/.test(e);
|
|
682
|
+
}
|
|
683
|
+
function $e(e) {
|
|
684
|
+
return /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/.test(e);
|
|
685
|
+
}
|
|
686
|
+
function J(e, t) {
|
|
687
|
+
let [n = 0, r = 0] = e.split(".").map(Number), [i = 0, a = 0] = t.split(".").map(Number);
|
|
688
|
+
return n === i ? r - a : n - i;
|
|
689
|
+
}
|
|
690
|
+
function et(e) {
|
|
691
|
+
if (typeof e != "object" || !e) return !1;
|
|
692
|
+
let t = e;
|
|
693
|
+
return typeof t.version == "string" && typeof t.id == "string" && typeof t.appName == "string" && t.appName !== "" && typeof t.capabilities == "object" && t.capabilities !== null && Array.isArray(t.capabilities.actions);
|
|
694
|
+
}
|
|
695
|
+
function tt(e, t) {
|
|
696
|
+
return !(!q(e) || t.minOqseVersion && q(t.minOqseVersion) && J(e, t.minOqseVersion) < 0 || t.maxOqseVersion && q(t.maxOqseVersion) && J(e, t.maxOqseVersion) > 0);
|
|
697
|
+
}
|
|
698
|
+
//#endregion
|
|
699
|
+
//#region src/manifestValidation.ts
|
|
700
|
+
var Y = e.string().min(1, "Hodnota nesm+� b+�t pr+�zdn+�").trim(), nt = e.string().url("Mus+� b+�t platn+� absolutn+� URL").refine((e) => e.startsWith("http://") || e.startsWith("https://"), { message: "URL mus+� pou+�+�vat sch+�ma http nebo https" }), X = e.string().regex(/^\d+\.\d+$/, "Verze mus+� b+�t ve form+�tu MAJOR.MINOR (nap+�. \"0.1\")"), rt = e.string().regex(/^\d+\.\d+\.\d+$/, "Verze mus+� b+�t ve form+�tu MAJOR.MINOR.PATCH (nap+�. \"1.2.3\")"), it = [
|
|
701
|
+
"render",
|
|
702
|
+
"edit",
|
|
703
|
+
"validate",
|
|
704
|
+
"import",
|
|
705
|
+
"export"
|
|
706
|
+
], at = e.string().refine((e) => it.includes(e) || e.startsWith("x-"), { message: "Akce mus+� b+�t jedna z [render, edit, validate, import, export] nebo m+�t prefix \"x-\"" }), ot = e.enum([
|
|
707
|
+
"game",
|
|
708
|
+
"fun",
|
|
709
|
+
"drill"
|
|
710
|
+
]), st = e.enum([
|
|
711
|
+
"low",
|
|
712
|
+
"medium",
|
|
713
|
+
"high"
|
|
714
|
+
]), ct = [
|
|
715
|
+
"math",
|
|
716
|
+
"media",
|
|
717
|
+
"media-image",
|
|
718
|
+
"media-audio",
|
|
719
|
+
"media-video",
|
|
720
|
+
"media-model",
|
|
721
|
+
"hotspots",
|
|
722
|
+
"hotspots-3d",
|
|
723
|
+
"complex-pairing",
|
|
724
|
+
"open-text",
|
|
725
|
+
"chess"
|
|
726
|
+
], lt = e.string().refine((e) => ct.includes(e) || e.startsWith("x-"), { message: "Funkce mus+� b+�t jedna z ofici+�ln+�ch kl+���+� nebo m+�t prefix \"x-\"" }), ut = e.string().min(1, "Kl+��� vlastnosti polo+�ky nesm+� b+�t pr+�zdn+�"), dt = e.string().min(1, "Kl+��� vlastnosti metadat nesm+� b+�t pr+�zdn+�");
|
|
727
|
+
function Z(t) {
|
|
728
|
+
return e.union([
|
|
729
|
+
e.tuple([e.literal("*")]),
|
|
730
|
+
e.array(t),
|
|
731
|
+
e.null()
|
|
732
|
+
]);
|
|
733
|
+
}
|
|
734
|
+
var ft = e.string().refine((e) => e.startsWith("image/"), { message: "Mus+� b+�t platn+� MIME typ obr+�zku (image/...)" }), pt = e.string().refine((e) => e.startsWith("audio/"), { message: "Mus+� b+�t platn+� MIME typ zvuku (audio/...)" }), mt = e.string().refine((e) => e.startsWith("video/"), { message: "Mus+� b+�t platn+� MIME typ videa (video/...)" }), ht = e.string().refine((e) => e.startsWith("model/") || e === "application/octet-stream", { message: "Mus+� b+�t platn+� MIME typ 3D modelu (model/... nebo application/octet-stream)" }), gt = e.object({
|
|
735
|
+
image: Z(ft).optional(),
|
|
736
|
+
audio: Z(pt).optional(),
|
|
737
|
+
video: Z(mt).optional(),
|
|
738
|
+
model: Z(ht).optional()
|
|
739
|
+
}), _t = w.extend({
|
|
740
|
+
actions: e.array(at).min(1, "Aplikace mus+� podporovat alespo+� jednu akci"),
|
|
741
|
+
types: Z(Y).optional(),
|
|
742
|
+
assets: gt.optional()
|
|
743
|
+
}), Q = e.object({
|
|
744
|
+
$schema: nt.optional(),
|
|
745
|
+
id: Y.regex(/^[a-z0-9-]+(\.[a-z0-9-]+)*$/, "ID mus+� b+�t ve tvaru reverse-domain (nap+�. \"com.acme.app\")"),
|
|
746
|
+
appName: Y.max(100, "N+�zev nesm+� b+�t del+�+� ne+� 100 znak+�"),
|
|
747
|
+
version: X,
|
|
748
|
+
pluginVersion: rt.optional(),
|
|
749
|
+
minOqseVersion: X.optional(),
|
|
750
|
+
maxOqseVersion: X.optional(),
|
|
751
|
+
capabilities: _t,
|
|
752
|
+
author: e.string().max(100, "N+�zev autora nesm+� b+�t del+�+� ne+� 100 znak+�").optional(),
|
|
753
|
+
authorUrl: nt.optional(),
|
|
754
|
+
locales: e.array(Y).optional(),
|
|
755
|
+
description: e.string().max(500, "Popis nesm+� b+�t del+�+� ne+� 500 znak+�").optional(),
|
|
756
|
+
emoji: e.string().optional(),
|
|
757
|
+
tags: e.array(Y).optional(),
|
|
758
|
+
studyMode: ot.optional(),
|
|
759
|
+
questionDensity: st.optional(),
|
|
760
|
+
appSpecific: e.record(e.string(), e.unknown()).optional()
|
|
761
|
+
}).refine((e) => {
|
|
762
|
+
if (!e.minOqseVersion || !e.maxOqseVersion) return !0;
|
|
763
|
+
let t = e.minOqseVersion.split("."), n = e.maxOqseVersion.split("."), r = Number(t[0]), i = Number(t[1]), a = Number(n[0]), ee = Number(n[1]);
|
|
764
|
+
return r === a ? i <= ee : r < a;
|
|
765
|
+
}, {
|
|
766
|
+
message: "minOqseVersion nesm+� b+�t vy+�+�+� ne+� maxOqseVersion",
|
|
767
|
+
path: ["minOqseVersion"]
|
|
768
|
+
});
|
|
769
|
+
function vt(e) {
|
|
770
|
+
return Q.parse(e);
|
|
771
|
+
}
|
|
772
|
+
function yt(e) {
|
|
773
|
+
return Q.safeParse(e);
|
|
774
|
+
}
|
|
775
|
+
function bt(e) {
|
|
776
|
+
return e.issues.map((e) => {
|
|
777
|
+
let t = e.path.map((e) => String(e)).join(".");
|
|
778
|
+
return t ? `${t}: ${e.message}` : e.message;
|
|
779
|
+
}).join("\n");
|
|
780
|
+
}
|
|
781
|
+
function xt(e) {
|
|
782
|
+
return Q.safeParse(e).success;
|
|
783
|
+
}
|
|
784
|
+
//#endregion
|
|
785
|
+
//#region src/progressValidation.ts
|
|
786
|
+
var St = e.object({
|
|
787
|
+
attempts: e.number().int().nonnegative(),
|
|
788
|
+
incorrect: e.number().int().nonnegative(),
|
|
789
|
+
streak: e.number().int().nonnegative()
|
|
790
|
+
}).refine((e) => e.incorrect <= e.attempts, {
|
|
791
|
+
message: "incorrect nesmí být vyšší než attempts",
|
|
792
|
+
path: ["incorrect"]
|
|
793
|
+
}), Ct = e.object({
|
|
794
|
+
isCorrect: e.boolean(),
|
|
795
|
+
confidence: e.union([
|
|
796
|
+
e.literal(1),
|
|
797
|
+
e.literal(2),
|
|
798
|
+
e.literal(3),
|
|
799
|
+
e.literal(4)
|
|
800
|
+
]).optional(),
|
|
801
|
+
answeredAt: u,
|
|
802
|
+
timeSpent: e.number().int().nonnegative().optional(),
|
|
803
|
+
hintsUsed: e.number().int().nonnegative().optional(),
|
|
804
|
+
isSkipped: e.boolean().optional()
|
|
805
|
+
}).refine((e) => !e.isSkipped || e.isCorrect === !1, {
|
|
806
|
+
message: "Pokud je isSkipped=true, isCorrect má být false",
|
|
807
|
+
path: ["isCorrect"]
|
|
808
|
+
}), wt = e.object({
|
|
809
|
+
bucket: e.union([
|
|
810
|
+
e.literal(0),
|
|
811
|
+
e.literal(1),
|
|
812
|
+
e.literal(2),
|
|
813
|
+
e.literal(3),
|
|
814
|
+
e.literal(4)
|
|
815
|
+
]),
|
|
816
|
+
nextReviewAt: u.optional(),
|
|
817
|
+
stats: St,
|
|
818
|
+
lastAnswer: Ct.optional(),
|
|
819
|
+
appSpecific: e.record(e.string(), e.unknown()).optional()
|
|
820
|
+
}), Tt = e.object({
|
|
821
|
+
setId: s,
|
|
822
|
+
exportedAt: u,
|
|
823
|
+
algorithm: e.string().regex(/^[a-z0-9-]+$/, "algorithm musí mít formát lowercase alphanumeric s pomlčkami").optional()
|
|
824
|
+
}), $ = e.object({
|
|
825
|
+
$schema: e.string().url().optional(),
|
|
826
|
+
version: e.string().regex(/^\d+\.\d+$/, "Verze musí být ve formátu MAJOR.MINOR"),
|
|
827
|
+
meta: Tt,
|
|
828
|
+
records: e.record(s, wt)
|
|
829
|
+
});
|
|
830
|
+
function Et(e) {
|
|
831
|
+
return $.parse(e);
|
|
832
|
+
}
|
|
833
|
+
function Dt(e) {
|
|
834
|
+
return $.safeParse(e);
|
|
835
|
+
}
|
|
836
|
+
//#endregion
|
|
837
|
+
//#region src/utils.ts
|
|
838
|
+
function Ot(e) {
|
|
839
|
+
return s.safeParse(e).success;
|
|
840
|
+
}
|
|
841
|
+
function kt() {
|
|
842
|
+
return crypto.randomUUID();
|
|
843
|
+
}
|
|
844
|
+
//#endregion
|
|
845
|
+
export { d as AbsoluteURLSchema, _ as AssetDictionarySchema, f as AssetKeySchema, pt as AudioMimeTypeSchema, F as BaseItemSchema, k as BloomLevelSchema, U as CameraSetupSchema, be as CategorizeItemSchema, ze as CategorizeItemTypeSchema, qe as ChessPuzzleItemSchema, R as CircleHotspotSchema, A as CognitiveLoadSchema, Ue as DiagramLabelItemSchema, Ce as DiagramZoneSchema, lt as FeatureFlagSchema, w as FeatureProfileSchema, E as FeatureRequirementSchema, T as FeatureTypeSchema, Me as FillInBlanksItemSchema, Ne as FillInSelectItemSchema, Oe as FlashcardItemSchema, V as HotspotObjectSchema, u as ISO8601DateTimeSchema, ft as ImageMimeTypeSchema, ut as ItemPropertyKeySchema, c as LanguageCodeSchema, Ct as LastAnswerObjectSchema, O as LinkedSetObjectSchema, je as MCQMultiItemSchema, Ae as MCQSingleItemSchema, gt as ManifestAssetsSchema, _t as ManifestCapabilitiesSchema, Fe as MatchComplexItemSchema, Pe as MatchPairsItemSchema, He as MathInputItemSchema, M as MathRendererSchema, N as MathSettingsSchema, Ve as MatrixItemSchema, ve as MediaObjectSchema, B as MeshHotspotSchema, dt as MetaPropertyKeySchema, ht as ModelMimeTypeSchema, De as NoteItemSchema, Ge as NumericInputItemSchema, Ee as NumericRangeSchema, at as OQSEActionSchema, K as OQSEFileSchema, G as OQSEItemSchema, Q as OQSEManifestSchema, P as OQSEMetaSchema, $ as OQSEPFileSchema, st as OQSEQuestionDensitySchema, ot as OQSEStudyModeSchema, ye as OfficialFeatureNameSchema, We as OpenEndedItemSchema, h as OptionalRichContentSchema, j as PedagogySchema, v as PersonObjectSchema, Re as PinOnImageItemSchema, Ke as PinOnModelItemSchema, p as PlainTextSchema, z as PolygonHotspotSchema, Tt as ProgressMetaSchema, wt as ProgressRecordSchema, L as RectHotspotSchema, m as RichContentSchema, we as RubricCriterionSchema, Te as RubricSchema, l as SPDXLicenseSchema, I as SelectBlankObjectSchema, W as ShortAnswerItemSchema, Le as SliderItemSchema, Ie as SortItemsItemSchema, b as SourceMaterialSchema, y as SourceMaterialTypeSchema, x as SourceReferenceSchema, St as StatsObjectSchema, g as SubtitleTrackSchema, C as TagDefinitionDictionarySchema, S as TagDefinitionSchema, Se as TimelineEventSchema, Be as TimelineItemSchema, xe as TimelinePrecisionSchema, D as TranslationObjectSchema, ke as TrueFalseItemSchema, s as UUIDSchema, H as Vector3Schema, mt as VideoMimeTypeSchema, J as compareManifestVersions, bt as formatManifestErrors, Qe as formatValidationErrors, kt as generateUUID, ce as isCategorize, ge as isChessPuzzle, o as isCoreItem, fe as isDiagramLabel, _e as isExtendedItem, te as isFillInBlanks, ne as isFillInSelect, n as isFlashcard, a as isMCQMulti, i as isMCQSingle, ie as isMatchComplex, re as isMatchPairs, de as isMathInput, ue as isMatrix, t as isNote, me as isNumericInput, et as isOQSEManifest, pe as isOpenEnded, se as isPinOnImage, he as isPinOnModel, ee as isShortAnswer, oe as isSlider, ae as isSortItems, le as isTimeline, r as isTrueFalse, q as isValidManifestVersion, xt as isValidOQSEManifest, $e as isValidSemVer, Ot as isValidUUID, tt as isVersionCompatible, yt as safeValidateManifest, Ye as safeValidateOQSEFile, Ze as safeValidateOQSEItem, Dt as safeValidateOQSEPFile, vt as validateManifest, Je as validateOQSEFile, Xe as validateOQSEItem, Et as validateOQSEPFile };
|