@pie-element/mc-populated-blank 0.2.13 → 0.3.0-next.10
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/README.md +8 -5
- package/author.js +2 -0
- package/configure.js +2 -0
- package/dist/author/defaults.d.ts +74 -0
- package/dist/author/index.d.ts +0 -1
- package/dist/author/index.js +1732 -1553
- package/dist/author/index.js.map +1 -1
- package/dist/browser/author/index.js +41 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/client-6I83eQqA.js +2396 -0
- package/dist/browser/client-6I83eQqA.js.map +1 -0
- package/dist/browser/controller/index.js +209 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +1131 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/i18n-CQZqUmjk.js +1542 -0
- package/dist/browser/i18n-CQZqUmjk.js.map +1 -0
- package/dist/browser/layoutLimits-Bp17YP2V.js +42 -0
- package/dist/browser/layoutLimits-Bp17YP2V.js.map +1 -0
- package/dist/browser/print/index.js +151 -0
- package/dist/browser/print/index.js.map +1 -0
- package/dist/controller/defaults.d.ts +8 -30
- package/dist/controller/index.d.ts +79 -63
- package/dist/controller/index.js +108 -85
- package/dist/controller/index.js.map +1 -1
- package/dist/delivery/computeAudioMode.d.ts +0 -1
- package/dist/delivery/computeChoiceCorrectness.d.ts +0 -1
- package/dist/delivery/computeDisplayState.d.ts +7 -8
- package/dist/delivery/computeLayoutProfile.d.ts +0 -1
- package/dist/delivery/computeLayoutStyle.d.ts +0 -2
- package/dist/delivery/i18n.d.ts +8 -0
- package/dist/delivery/index.d.ts +22 -1
- package/dist/delivery/index.js +5742 -3222
- package/dist/delivery/index.js.map +1 -1
- package/dist/delivery/variant-css-map.d.ts +15 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -156
- package/dist/index.iife.js +139 -38
- package/dist/index.js +5742 -3222
- package/dist/index.js.map +1 -1
- package/dist/print/index.d.ts +4 -1
- package/dist/print/index.js +5418 -2879
- package/dist/print/index.js.map +1 -1
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +14 -0
- package/dist/runtime-support.js.map +1 -0
- package/dist/shared/layoutLimits.d.ts +1 -2
- package/dist/shared/types.d.ts +20 -19
- package/module/print.js +3883 -0
- package/module/print.js.map +1 -0
- package/package.json +42 -13
- package/print.js +2 -0
- package/dist/author/index.d.ts.map +0 -1
- package/dist/controller/defaults.d.ts.map +0 -1
- package/dist/controller/index.d.ts.map +0 -1
- package/dist/delivery/computeAudioMode.d.ts.map +0 -1
- package/dist/delivery/computeChoiceCorrectness.d.ts.map +0 -1
- package/dist/delivery/computeDisplayState.d.ts.map +0 -1
- package/dist/delivery/computeLayoutProfile.d.ts.map +0 -1
- package/dist/delivery/computeLayoutStyle.d.ts.map +0 -1
- package/dist/delivery/index.d.ts.map +0 -1
- package/dist/delivery/variant-css-map.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.iife.d.ts.map +0 -1
- package/dist/print/index.d.ts.map +0 -1
- package/dist/shared/layoutLimits.d.ts.map +0 -1
- package/dist/shared/types.d.ts.map +0 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { t as e } from "../layoutLimits-Bp17YP2V.js";
|
|
2
|
+
//#region src/controller/defaults.ts
|
|
3
|
+
var t = "{{blank}}", n = { model: {
|
|
4
|
+
prompt: "",
|
|
5
|
+
promptEnabled: !0,
|
|
6
|
+
interactionMode: "populate_blank",
|
|
7
|
+
layoutProfile: "",
|
|
8
|
+
choiceLayout: "",
|
|
9
|
+
layoutProfilePresets: {},
|
|
10
|
+
layoutLimits: { ...e },
|
|
11
|
+
audioButtonSkin: null,
|
|
12
|
+
audioButtonSkinsByLocale: {},
|
|
13
|
+
sentenceHtml: "",
|
|
14
|
+
template: "",
|
|
15
|
+
choiceMode: "text",
|
|
16
|
+
choices: [],
|
|
17
|
+
choiceGroupLabel: "",
|
|
18
|
+
correctChoiceId: "",
|
|
19
|
+
hasAudio: !1,
|
|
20
|
+
autoplayAudioEnabled: !1,
|
|
21
|
+
completeAudioEnabled: !1,
|
|
22
|
+
audioUrl: "",
|
|
23
|
+
audioTranscript: "",
|
|
24
|
+
locale: "",
|
|
25
|
+
teacherInstructions: "",
|
|
26
|
+
teacherInstructionsEnabled: !0
|
|
27
|
+
} }, r = {
|
|
28
|
+
model: {
|
|
29
|
+
...n.model,
|
|
30
|
+
prompt: "<p><strong>Demo prompt</strong></p>",
|
|
31
|
+
template: `<p>The answer is ${t}.</p>`,
|
|
32
|
+
choices: [
|
|
33
|
+
{
|
|
34
|
+
id: "c1",
|
|
35
|
+
labelHtml: "<p>Option A</p>"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "c2",
|
|
39
|
+
labelHtml: "<p>Option B</p>"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "c3",
|
|
43
|
+
labelHtml: "<p>Option C</p>"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
correctChoiceId: "c2"
|
|
47
|
+
},
|
|
48
|
+
configuration: { prompt: {
|
|
49
|
+
label: "Prompt",
|
|
50
|
+
settings: !0
|
|
51
|
+
} }
|
|
52
|
+
}, i = (e) => !!e && typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0;
|
|
53
|
+
function a(e) {
|
|
54
|
+
return e ? (e.match(/\{\{blank\}\}/g) || []).length : 0;
|
|
55
|
+
}
|
|
56
|
+
var o = (e, t) => {
|
|
57
|
+
if (!t?.choiceId) return "unanswered";
|
|
58
|
+
let n = e?.correctChoiceId || "";
|
|
59
|
+
return t.choiceId === n ? "correct" : "incorrect";
|
|
60
|
+
}, s = (e, t) => +(o(e, t) === "correct"), c = (e, t, n) => new Promise((r) => {
|
|
61
|
+
if (!t || i(t)) {
|
|
62
|
+
r({
|
|
63
|
+
score: 0,
|
|
64
|
+
empty: !0,
|
|
65
|
+
traceLog: ["Student did not select any answers. Score is 0."]
|
|
66
|
+
});
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
t = f(t);
|
|
70
|
+
let a = d(e);
|
|
71
|
+
if (o(a, t) === "unanswered") {
|
|
72
|
+
r({
|
|
73
|
+
score: 0,
|
|
74
|
+
empty: !0,
|
|
75
|
+
traceLog: ["Student did not select any answers. Score is 0."]
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
let c = s(a, t);
|
|
80
|
+
r({
|
|
81
|
+
score: c,
|
|
82
|
+
empty: !1,
|
|
83
|
+
traceLog: [
|
|
84
|
+
`Mode: ${n?.mode || "unknown"}.`,
|
|
85
|
+
`Student selected choice: ${t.choiceId}.`,
|
|
86
|
+
`Correct choice: ${a.correctChoiceId || "none"}.`,
|
|
87
|
+
`Final score: ${c}.`
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
}), l = (t, n = {}) => ({
|
|
91
|
+
...t,
|
|
92
|
+
...n,
|
|
93
|
+
layoutLimits: {
|
|
94
|
+
...e,
|
|
95
|
+
...n?.layoutLimits || {}
|
|
96
|
+
}
|
|
97
|
+
}), u = (e = {}) => l(r.model, e), d = (e = {}) => {
|
|
98
|
+
let { shuffle: t, ...r } = e || {};
|
|
99
|
+
return {
|
|
100
|
+
...l(n.model, r),
|
|
101
|
+
lockChoiceOrder: typeof r.lockChoiceOrder == "boolean" ? r.lockChoiceOrder : t !== !0
|
|
102
|
+
};
|
|
103
|
+
}, f = (e) => ({ ...e }), p = (e, t) => e?.lockChoiceOrder || t?.["@pie-element"]?.lockChoiceOrder ? !0 : t?.role === "instructor";
|
|
104
|
+
function m(e) {
|
|
105
|
+
let t = [...e];
|
|
106
|
+
for (let e = t.length - 1; e > 0; e--) {
|
|
107
|
+
let n = Math.floor(Math.random() * (e + 1));
|
|
108
|
+
[t[e], t[n]] = [t[n], t[e]];
|
|
109
|
+
}
|
|
110
|
+
return t;
|
|
111
|
+
}
|
|
112
|
+
var h = ({ id: e, labelHtml: t, imageUrl: n, imageAlt: r }) => ({
|
|
113
|
+
id: e,
|
|
114
|
+
...t === void 0 ? {} : { labelHtml: t },
|
|
115
|
+
...n === void 0 ? {} : { imageUrl: n },
|
|
116
|
+
...r === void 0 ? {} : { imageAlt: r }
|
|
117
|
+
}), g = (e) => Array.isArray(e?.data?.shuffledValues) ? e.data.shuffledValues : Array.isArray(e?.shuffledValues) ? e.shuffledValues : [], _ = (e, t, n) => {
|
|
118
|
+
let r = t.map((t) => e.find((e) => e?.[n] === t)).filter((e) => !!e);
|
|
119
|
+
if (r.length === e.length) return r;
|
|
120
|
+
let i = new Set(r.map((e) => e[n])), a = e.filter((e) => !i.has(e?.[n]));
|
|
121
|
+
return [...r, ...a];
|
|
122
|
+
}, v = async (e, t, n, r) => {
|
|
123
|
+
let i = Array.isArray(e?.choices) ? [...e.choices] : [];
|
|
124
|
+
if (!i.length || p(e, n || {})) return i;
|
|
125
|
+
let a = g(t);
|
|
126
|
+
if (a.length) return _(i, a, "id");
|
|
127
|
+
let o = m(i);
|
|
128
|
+
if (r && typeof r == "function" && t?.id && t?.element) {
|
|
129
|
+
let e = o.map((e) => e?.id).filter(Boolean);
|
|
130
|
+
e.length && await r(t.id, t.element, { shuffledValues: e });
|
|
131
|
+
}
|
|
132
|
+
return o;
|
|
133
|
+
}, y = async (t, n, r, i) => {
|
|
134
|
+
let a = n || {}, s = r || {}, c = d(t), l = (await v(c, a, s, i)).filter((e) => !!e && typeof e == "object").map(h), u = {
|
|
135
|
+
prompt: c.promptEnabled ? c.prompt : null,
|
|
136
|
+
interactionMode: c.interactionMode || "populate_blank",
|
|
137
|
+
layoutProfile: c.layoutProfile || "",
|
|
138
|
+
choiceLayout: c.choiceLayout || "",
|
|
139
|
+
layoutProfilePresets: c.layoutProfilePresets && typeof c.layoutProfilePresets == "object" ? c.layoutProfilePresets : {},
|
|
140
|
+
layoutLimits: c.layoutLimits || { ...e },
|
|
141
|
+
audioButtonSkin: c.audioButtonSkin && typeof c.audioButtonSkin == "object" ? c.audioButtonSkin : null,
|
|
142
|
+
audioButtonSkinsByLocale: c.audioButtonSkinsByLocale && typeof c.audioButtonSkinsByLocale == "object" ? c.audioButtonSkinsByLocale : {},
|
|
143
|
+
sentenceHtml: c.sentenceHtml || null,
|
|
144
|
+
template: c.template,
|
|
145
|
+
choiceMode: c.choiceMode,
|
|
146
|
+
choices: l,
|
|
147
|
+
choiceGroupLabel: c.choiceGroupLabel || "",
|
|
148
|
+
hasAudio: c.hasAudio,
|
|
149
|
+
autoplayAudioEnabled: !!c.autoplayAudioEnabled,
|
|
150
|
+
completeAudioEnabled: !!c.completeAudioEnabled,
|
|
151
|
+
audioUrl: c.hasAudio ? c.audioUrl : null,
|
|
152
|
+
audioTranscript: c.hasAudio ? c.audioTranscript : null,
|
|
153
|
+
customType: c.customType || "",
|
|
154
|
+
useFeatureButtonAudio: typeof c.useFeatureButtonAudio == "boolean" ? c.useFeatureButtonAudio : void 0,
|
|
155
|
+
locale: c.locale || "",
|
|
156
|
+
language: c.language || c.locale || void 0,
|
|
157
|
+
disabled: s.mode !== "gather",
|
|
158
|
+
mode: s.mode
|
|
159
|
+
};
|
|
160
|
+
if (s.mode === "evaluate") {
|
|
161
|
+
let e = o(c, a);
|
|
162
|
+
u.correctness = e, u.responseCorrect = e === "correct", u.correctChoiceId = c.correctChoiceId;
|
|
163
|
+
}
|
|
164
|
+
return s.role === "instructor" && (s.mode === "view" || s.mode === "evaluate") ? u.teacherInstructions = c.teacherInstructionsEnabled ? c.teacherInstructions : null : u.teacherInstructions = null, u;
|
|
165
|
+
}, b = (e, t) => new Promise((n) => {
|
|
166
|
+
t.mode !== "evaluate" && t.role === "instructor" ? n({
|
|
167
|
+
id: "1",
|
|
168
|
+
choiceId: e?.correctChoiceId || ""
|
|
169
|
+
}) : n(null);
|
|
170
|
+
}), x = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, "").trim(), S = (e = {}, n = {}) => {
|
|
171
|
+
let r = {}, { minAnswerChoices: i = 2, maxAnswerChoices: o } = n;
|
|
172
|
+
(e.promptEnabled || n.prompt?.required) && !x(e.prompt) && (r.prompt = "This field is required."), n.teacherInstructions?.required && !x(e.teacherInstructions) && (r.teacherInstructions = "This field is required.");
|
|
173
|
+
let s = e.interactionMode || "populate_blank", c = a(e.template || "");
|
|
174
|
+
s === "audio_mc_only" ? c > 0 && (r.template = `Template cannot contain ${t} in audio-only mode`) : s === "populate_blank" ? c === 0 ? r.template = `Template must contain exactly one ${t} placeholder` : c > 1 && (r.template = `Template must contain only one ${t} placeholder`) : r.interactionMode = "Unknown interaction mode";
|
|
175
|
+
let l = Array.isArray(e.choices) ? e.choices : [];
|
|
176
|
+
l.length < i ? r.answerChoices = `There should be at least ${i} choices defined.` : o != null && l.length > o && (r.answerChoices = `No more than ${o} choices should be defined.`);
|
|
177
|
+
let u = e.choiceMode || "text", d = {}, f = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set();
|
|
178
|
+
l.forEach((e, t) => {
|
|
179
|
+
let n = e?.id || String(t);
|
|
180
|
+
if (!e?.id) {
|
|
181
|
+
d[n] = "Choice needs an id.";
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (f.has(e.id)) {
|
|
185
|
+
d[n] = "Choice id should be unique.";
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (f.add(e.id), u === "text") {
|
|
189
|
+
let t = x(e.labelHtml);
|
|
190
|
+
t ? p.has(t) && (d[n] = "Content should be unique.") : d[n] = "Content should not be empty.", p.add(t);
|
|
191
|
+
} else e.imageUrl?.trim() ? e.imageAlt?.trim() || (d[n] = "Image alt text is required.") : d[n] = "An image is required.";
|
|
192
|
+
}), Object.keys(d).length && (r.choices = d);
|
|
193
|
+
let m = e.correctChoiceId;
|
|
194
|
+
m ? l.some((e) => e?.id === m) || (r.correctResponse = "The correct response must be one of the choices.") : r.correctResponse = "No correct response defined.", e.hasAudio && (e.audioUrl?.trim() || (r.audioUrl = "A playable audio URL is required when audio is enabled"));
|
|
195
|
+
let h = e?.layoutLimits;
|
|
196
|
+
if (h && typeof h == "object") for (let e of /* @__PURE__ */ "blankStandaloneWidthRem.blankWideWidthRem.blankUnderlineWidthPx.blankUnderlineWideWidthPx.horizontalChoiceWidthPx.horizontalChoiceWidthVw.horizontalChoiceTileMinHeightRem.horizontalChoiceContentMinHeightRem.choiceImageMaxHeightRem.choiceImageMaxWidthRem.listenButtonSizePx.stimulusMinColumnPx.textMinColumnPx.legendMaxChars.choiceGroupGapRem.choiceRowGapRem.toggleButtonGapRem.horizontalChoiceRadioTopMarginRem.audioBlankTemplateMarginTopRem.audioBlankTemplateMarginBottomRem.audioInstructionsMaxWidthPx.narrowHorizontalChoiceMaxWidthPx.stimulusGridColumnGapRem.stimulusGridRowGapRem.stimulusSentenceMarginTopRem.stimulusChoicesMarginTopRem.tokenGridColumnGapRem.tokenGridRowGapRem.tokenTemplateMarginTopRem.tokenInlineTokenGapRem.tokenChoicesMarginTopRem.inlineGridColumnGapRem.inlineGridRowGapRem.inlineTemplateMarginTopRem.inlineChoicesMarginTopRem".split(".")) {
|
|
197
|
+
if (h[e] === void 0 || h[e] === null) continue;
|
|
198
|
+
let t = Number(h[e]);
|
|
199
|
+
if (!Number.isFinite(t) || t <= 0) {
|
|
200
|
+
r.layoutLimits = `${e} must be a positive number when provided`;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return r;
|
|
205
|
+
};
|
|
206
|
+
//#endregion
|
|
207
|
+
export { a as countBlankTokens, b as createCorrectResponseSession, u as createDefaultModel, o as getCorrectness, s as getPartialScore, y as model, d as normalize, f as normalizeSession, c as outcome, S as validate };
|
|
208
|
+
|
|
209
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/controller/defaults.ts","../../../src/author/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["import { DEFAULT_LAYOUT_LIMITS } from '../shared/layoutLimits';\n\nexport { DEFAULT_LAYOUT_LIMITS };\n\n/** Token authors must include exactly once in `template` (HTML). */\nexport const BLANK_TOKEN = '{{blank}}';\n\n/**\n * The values `normalize` fills in for fields an item leaves out. They carry no\n * content and no `id` or `element`: those come from the item config, and a\n * default here would stand in for a field the author never set.\n */\nexport default {\n model: {\n prompt: '',\n promptEnabled: true,\n interactionMode: 'populate_blank' as const,\n layoutProfile: '',\n choiceLayout: '',\n layoutProfilePresets: {},\n layoutLimits: { ...DEFAULT_LAYOUT_LIMITS },\n audioButtonSkin: null,\n audioButtonSkinsByLocale: {},\n sentenceHtml: '',\n template: '',\n choiceMode: 'text' as const,\n choices: [],\n choiceGroupLabel: '',\n correctChoiceId: '',\n hasAudio: false,\n autoplayAudioEnabled: false,\n completeAudioEnabled: false,\n audioUrl: '',\n audioTranscript: '',\n locale: '',\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n },\n};\n","import controllerDefaults, { BLANK_TOKEN } from '../controller/defaults';\n\n/** The model a new item starts from: a valid question an author edits in place. */\nexport default {\n model: {\n ...controllerDefaults.model,\n prompt: '<p><strong>Demo prompt</strong></p>',\n template: `<p>The answer is ${BLANK_TOKEN}.</p>`,\n choices: [\n { id: 'c1', labelHtml: '<p>Option A</p>' },\n { id: 'c2', labelHtml: '<p>Option B</p>' },\n { id: 'c3', labelHtml: '<p>Option C</p>' },\n ],\n correctChoiceId: 'c2',\n },\n configuration: {\n prompt: {\n label: 'Prompt',\n settings: true,\n },\n },\n};\n","import authorDefaults from '../author/defaults';\nimport defaults, { BLANK_TOKEN, DEFAULT_LAYOUT_LIMITS } from './defaults';\nimport type {\n McpbChoice,\n McpbQuestion,\n McpbSession,\n McpbEnv,\n McpbCorrectness,\n} from '../shared/types';\n\nconst isEmptyObject = (value: unknown): boolean =>\n !!value &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.keys(value as Record<string, unknown>).length === 0;\n\nexport function countBlankTokens(template: string): number {\n if (!template) return 0;\n const re = /\\{\\{blank\\}\\}/g;\n return (template.match(re) || []).length;\n}\n\nexport const getCorrectness = (question: McpbQuestion, session: McpbSession): McpbCorrectness => {\n if (!session?.choiceId) {\n return 'unanswered';\n }\n const correct = question?.correctChoiceId || '';\n if (session.choiceId === correct) {\n return 'correct';\n }\n return 'incorrect';\n};\n\n/** One blank, one key: an answered session scores 1 only when it picked the key. */\nexport const getPartialScore = (question: McpbQuestion, session: McpbSession) =>\n getCorrectness(question, session) === 'correct' ? 1 : 0;\n\nexport const outcome = (question: McpbQuestion, session: McpbSession, env: McpbEnv) =>\n new Promise((resolve) => {\n if (!session || isEmptyObject(session)) {\n resolve({\n score: 0,\n empty: true,\n traceLog: ['Student did not select any answers. Score is 0.'],\n });\n return;\n }\n\n session = normalizeSession(session);\n const normalizedQuestion = normalize(question);\n const correctness = getCorrectness(normalizedQuestion, session);\n\n if (correctness === 'unanswered') {\n resolve({\n score: 0,\n empty: true,\n traceLog: ['Student did not select any answers. Score is 0.'],\n });\n return;\n }\n\n const score = getPartialScore(normalizedQuestion, session);\n const traceLog = [\n `Mode: ${env?.mode || 'unknown'}.`,\n `Student selected choice: ${session.choiceId}.`,\n `Correct choice: ${normalizedQuestion.correctChoiceId || 'none'}.`,\n `Final score: ${score}.`,\n ];\n resolve({ score, empty: false, traceLog });\n });\n\nconst withDefaults = (base: McpbQuestion, model: McpbQuestion = {}) => ({\n ...base,\n ...model,\n layoutLimits: {\n ...DEFAULT_LAYOUT_LIMITS,\n ...(model?.layoutLimits || {}),\n },\n});\n\n/** The authoring starting point: a question that passes `validate()` as it stands. */\nexport const createDefaultModel = (model: McpbQuestion = {}) =>\n withDefaults(authorDefaults.model, model);\n\n/**\n * What `model()` and `outcome()` read: the item's own fields, with neutral\n * values for the rest. Starter content here would reach a learner as the\n * item's prompt or choices.\n */\nexport const normalize = (question: McpbQuestion = {}) => {\n const { shuffle, ...rest } = question || {};\n return {\n ...withDefaults(defaults.model, rest),\n // `lockChoiceOrder` alone decides the order, as in multiple-choice. Older items\n // spell an unlocked order `shuffle: true`, which counts only when it is unset.\n lockChoiceOrder:\n typeof rest.lockChoiceOrder === 'boolean' ? rest.lockChoiceOrder : shuffle !== true,\n };\n};\n\nexport const normalizeSession = (s: McpbSession): McpbSession => ({ ...s });\n\nconst shouldLockChoices = (question: McpbQuestion, env: McpbEnv) => {\n if (question?.lockChoiceOrder) return true;\n if (env?.['@pie-element']?.lockChoiceOrder) return true;\n return env?.role === 'instructor';\n};\n\nfunction shuffleArray<T>(items: T[]): T[] {\n const out = [...items];\n for (let i = out.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [out[i], out[j]] = [out[j], out[i]];\n }\n return out;\n}\n\n/**\n * The fields delivery renders. An imported choice can carry more, such as a\n * correctness flag or feedback, which must not reach a learner's browser.\n */\nconst toDeliveryChoice = ({ id, labelHtml, imageUrl, imageAlt }: McpbChoice): McpbChoice => ({\n id,\n ...(labelHtml !== undefined ? { labelHtml } : {}),\n ...(imageUrl !== undefined ? { imageUrl } : {}),\n ...(imageAlt !== undefined ? { imageAlt } : {}),\n});\n\nconst getStoredShuffle = (session: McpbSession): string[] =>\n Array.isArray(session?.data?.shuffledValues)\n ? session.data.shuffledValues\n : Array.isArray(session?.shuffledValues)\n ? session.shuffledValues\n : [];\n\nconst applyShuffledValues = (\n choices: McpbChoice[],\n shuffledValues: string[],\n choiceKey: keyof McpbChoice\n) => {\n const orderedChoices = shuffledValues\n .map((value) => choices.find((choice) => choice?.[choiceKey] === value))\n .filter((c): c is McpbChoice => !!c);\n\n if (orderedChoices.length === choices.length) {\n return orderedChoices;\n }\n\n const orderedValues = new Set(orderedChoices.map((choice) => choice[choiceKey]));\n const leftovers = choices.filter((choice) => !orderedValues.has(choice?.[choiceKey]));\n return [...orderedChoices, ...leftovers];\n};\n\ntype UpdateSessionFn = (\n id: string,\n element: string,\n data: { shuffledValues: string[] }\n) => Promise<void>;\n\nconst getOrderedChoices = async (\n question: McpbQuestion,\n session: McpbSession,\n env: McpbEnv,\n updateSession?: UpdateSessionFn\n) => {\n const choices = Array.isArray(question?.choices) ? [...question.choices] : [];\n if (!choices.length || shouldLockChoices(question, env || {})) {\n return choices;\n }\n\n const shuffledValues = getStoredShuffle(session);\n if (shuffledValues.length) {\n return applyShuffledValues(choices, shuffledValues, 'id');\n }\n\n const shuffledChoices = shuffleArray(choices);\n\n if (updateSession && typeof updateSession === 'function' && session?.id && session?.element) {\n const shuffledIds = shuffledChoices.map((choice) => choice?.id).filter(Boolean);\n if (shuffledIds.length) {\n await updateSession(session.id, session.element, { shuffledValues: shuffledIds });\n }\n }\n\n return shuffledChoices;\n};\n\nexport const model = async (\n question: McpbQuestion,\n session: McpbSession | null,\n env: McpbEnv | null,\n updateSession?: UpdateSessionFn\n) => {\n const safeSession: McpbSession = session || {};\n const safeEnv: McpbEnv = env || {};\n const normalizedQuestion = normalize(question);\n const choices = (await getOrderedChoices(normalizedQuestion, safeSession, safeEnv, updateSession))\n .filter((c): c is McpbChoice => !!c && typeof c === 'object')\n .map(toDeliveryChoice);\n\n const out: Record<string, unknown> = {\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n interactionMode: normalizedQuestion.interactionMode || 'populate_blank',\n layoutProfile: normalizedQuestion.layoutProfile || '',\n choiceLayout: normalizedQuestion.choiceLayout || '',\n layoutProfilePresets:\n normalizedQuestion.layoutProfilePresets &&\n typeof normalizedQuestion.layoutProfilePresets === 'object'\n ? normalizedQuestion.layoutProfilePresets\n : {},\n layoutLimits: normalizedQuestion.layoutLimits || { ...DEFAULT_LAYOUT_LIMITS },\n audioButtonSkin:\n normalizedQuestion.audioButtonSkin && typeof normalizedQuestion.audioButtonSkin === 'object'\n ? normalizedQuestion.audioButtonSkin\n : null,\n audioButtonSkinsByLocale:\n normalizedQuestion.audioButtonSkinsByLocale &&\n typeof normalizedQuestion.audioButtonSkinsByLocale === 'object'\n ? normalizedQuestion.audioButtonSkinsByLocale\n : {},\n sentenceHtml: normalizedQuestion.sentenceHtml || null,\n template: normalizedQuestion.template,\n choiceMode: normalizedQuestion.choiceMode,\n choices,\n choiceGroupLabel: normalizedQuestion.choiceGroupLabel || '',\n hasAudio: normalizedQuestion.hasAudio,\n autoplayAudioEnabled: !!normalizedQuestion.autoplayAudioEnabled,\n completeAudioEnabled: !!normalizedQuestion.completeAudioEnabled,\n audioUrl: normalizedQuestion.hasAudio ? normalizedQuestion.audioUrl : null,\n audioTranscript: normalizedQuestion.hasAudio ? normalizedQuestion.audioTranscript : null,\n customType: normalizedQuestion.customType || '',\n useFeatureButtonAudio:\n typeof normalizedQuestion.useFeatureButtonAudio === 'boolean'\n ? normalizedQuestion.useFeatureButtonAudio\n : undefined,\n locale: normalizedQuestion.locale || '',\n language: normalizedQuestion.language || normalizedQuestion.locale || undefined,\n disabled: safeEnv.mode !== 'gather',\n mode: safeEnv.mode,\n };\n\n if (safeEnv.mode === 'evaluate') {\n const correctness = getCorrectness(normalizedQuestion, safeSession);\n out.correctness = correctness;\n out.responseCorrect = correctness === 'correct';\n out.correctChoiceId = normalizedQuestion.correctChoiceId;\n }\n\n if (safeEnv.role === 'instructor' && (safeEnv.mode === 'view' || safeEnv.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n return out;\n};\n\nexport const createCorrectResponseSession = (question: McpbQuestion, env: McpbEnv) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n // The player sets `id` and `element` on the entry from the item config.\n resolve({\n id: '1',\n choiceId: question?.correctChoiceId || '',\n });\n } else {\n resolve(null);\n }\n });\n};\n\n/** Markup with its tags removed, keeping media an author can answer from. */\nconst getContent = (html?: string) =>\n (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '').trim();\n\ntype ValidateConfig = {\n minAnswerChoices?: number;\n maxAnswerChoices?: number;\n prompt?: { required?: boolean };\n teacherInstructions?: { required?: boolean };\n};\n\n/**\n * Authoring errors in multiple-choice's shape: a message per field, and under\n * `choices` a message per choice keyed by its id.\n */\nexport const validate = (question: McpbQuestion = {}, config: ValidateConfig = {}) => {\n const errors: Record<string, string | Record<string, string>> = {};\n const { minAnswerChoices = 2, maxAnswerChoices } = config;\n\n if ((question.promptEnabled || config.prompt?.required) && !getContent(question.prompt)) {\n errors.prompt = 'This field is required.';\n }\n\n if (config.teacherInstructions?.required && !getContent(question.teacherInstructions)) {\n errors.teacherInstructions = 'This field is required.';\n }\n\n const interactionMode = question.interactionMode || 'populate_blank';\n const template = question.template || '';\n const n = countBlankTokens(template);\n if (interactionMode === 'audio_mc_only') {\n if (n > 0) {\n errors.template = `Template cannot contain ${BLANK_TOKEN} in audio-only mode`;\n }\n } else if (interactionMode === 'populate_blank') {\n if (n === 0) {\n errors.template = `Template must contain exactly one ${BLANK_TOKEN} placeholder`;\n } else if (n > 1) {\n errors.template = `Template must contain only one ${BLANK_TOKEN} placeholder`;\n }\n } else {\n errors.interactionMode = 'Unknown interaction mode';\n }\n\n const choices = Array.isArray(question.choices) ? question.choices : [];\n if (choices.length < minAnswerChoices) {\n errors.answerChoices = `There should be at least ${minAnswerChoices} choices defined.`;\n } else if (maxAnswerChoices != null && choices.length > maxAnswerChoices) {\n errors.answerChoices = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n const mode = question.choiceMode || 'text';\n const choicesErrors: Record<string, string> = {};\n const seenIds = new Set<string>();\n const seenLabels = new Set<string>();\n choices.forEach((c, i) => {\n const key = c?.id || String(i);\n if (!c?.id) {\n choicesErrors[key] = 'Choice needs an id.';\n return;\n }\n // The session stores the picked id, so two choices sharing one cannot be told apart.\n if (seenIds.has(c.id)) {\n choicesErrors[key] = 'Choice id should be unique.';\n return;\n }\n seenIds.add(c.id);\n if (mode === 'text') {\n const label = getContent(c.labelHtml);\n if (!label) {\n choicesErrors[key] = 'Content should not be empty.';\n } else if (seenLabels.has(label)) {\n choicesErrors[key] = 'Content should be unique.';\n }\n seenLabels.add(label);\n } else if (!c.imageUrl?.trim()) {\n choicesErrors[key] = 'An image is required.';\n } else if (!c.imageAlt?.trim()) {\n choicesErrors[key] = 'Image alt text is required.';\n }\n });\n if (Object.keys(choicesErrors).length) {\n errors.choices = choicesErrors;\n }\n\n const correct = question.correctChoiceId;\n if (!correct) {\n errors.correctResponse = 'No correct response defined.';\n } else if (!choices.some((c) => c?.id === correct)) {\n errors.correctResponse = 'The correct response must be one of the choices.';\n }\n\n if (question.hasAudio) {\n const hasAudioUrl = !!question.audioUrl?.trim();\n if (!hasAudioUrl) {\n errors.audioUrl = 'A playable audio URL is required when audio is enabled';\n }\n }\n\n const limits = question?.layoutLimits;\n if (limits && typeof limits === 'object') {\n const numericLimitKeys = [\n 'blankStandaloneWidthRem',\n 'blankWideWidthRem',\n 'blankUnderlineWidthPx',\n 'blankUnderlineWideWidthPx',\n 'horizontalChoiceWidthPx',\n 'horizontalChoiceWidthVw',\n 'horizontalChoiceTileMinHeightRem',\n 'horizontalChoiceContentMinHeightRem',\n 'choiceImageMaxHeightRem',\n 'choiceImageMaxWidthRem',\n 'listenButtonSizePx',\n 'stimulusMinColumnPx',\n 'textMinColumnPx',\n 'legendMaxChars',\n 'choiceGroupGapRem',\n 'choiceRowGapRem',\n 'toggleButtonGapRem',\n 'horizontalChoiceRadioTopMarginRem',\n 'audioBlankTemplateMarginTopRem',\n 'audioBlankTemplateMarginBottomRem',\n 'audioInstructionsMaxWidthPx',\n 'narrowHorizontalChoiceMaxWidthPx',\n 'stimulusGridColumnGapRem',\n 'stimulusGridRowGapRem',\n 'stimulusSentenceMarginTopRem',\n 'stimulusChoicesMarginTopRem',\n 'tokenGridColumnGapRem',\n 'tokenGridRowGapRem',\n 'tokenTemplateMarginTopRem',\n 'tokenInlineTokenGapRem',\n 'tokenChoicesMarginTopRem',\n 'inlineGridColumnGapRem',\n 'inlineGridRowGapRem',\n 'inlineTemplateMarginTopRem',\n 'inlineChoicesMarginTopRem',\n ] as const;\n for (const key of numericLimitKeys) {\n if (limits[key] === undefined || limits[key] === null) continue;\n const value = Number(limits[key]);\n if (!Number.isFinite(value) || value <= 0) {\n errors.layoutLimits = `${key} must be a positive number when provided`;\n break;\n }\n }\n }\n\n return errors;\n};\n"],"mappings":";;AAKA,IAAa,IAAc,aAO3B,IAAe,EACb,OAAO;CACL,QAAQ;CACR,eAAe;CACf,iBAAiB;CACjB,eAAe;CACf,cAAc;CACd,sBAAsB,CAAC;CACvB,cAAc,EAAE,GAAG,EAAsB;CACzC,iBAAiB;CACjB,0BAA0B,CAAC;CAC3B,cAAc;CACd,UAAU;CACV,YAAY;CACZ,SAAS,CAAC;CACV,kBAAkB;CAClB,iBAAiB;CACjB,UAAU;CACV,sBAAsB;CACtB,sBAAsB;CACtB,UAAU;CACV,iBAAiB;CACjB,QAAQ;CACR,qBAAqB;CACrB,4BAA4B;AAC9B,EACF,GCnCA,IAAe;CACb,OAAO;EACL,GAAG,EAAmB;EACtB,QAAQ;EACR,UAAU,oBAAoB,EAAY;EAC1C,SAAS;GACP;IAAE,IAAI;IAAM,WAAW;GAAkB;GACzC;IAAE,IAAI;IAAM,WAAW;GAAkB;GACzC;IAAE,IAAI;IAAM,WAAW;GAAkB;EAC3C;EACA,iBAAiB;CACnB;CACA,eAAe,EACb,QAAQ;EACN,OAAO;EACP,UAAU;CACZ,EACF;AACF,GCXM,KAAiB,MACrB,CAAC,CAAC,KACF,OAAO,KAAU,YACjB,CAAC,MAAM,QAAQ,CAAK,KACpB,OAAO,KAAK,CAAgC,CAAC,CAAC,WAAW;AAE3D,SAAgB,EAAiB,GAA0B;CAGzD,OAFK,KAEG,EAAS,MAAM,gBAAE,KAAK,CAAC,EAAA,CAAG,SAFZ;AAGxB;AAEA,IAAa,KAAkB,GAAwB,MAA0C;CAC/F,IAAI,CAAC,GAAS,UACZ,OAAO;CAET,IAAM,IAAU,GAAU,mBAAmB;CAI7C,OAHI,EAAQ,aAAa,IAChB,YA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