@pie-element/multiple-choice 11.0.0 → 11.0.1-esm.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/configure/package.json +1 -1
- package/controller/package.json +1 -1
- package/esm/configure.js +16525 -0
- package/esm/configure.js.map +1 -0
- package/esm/controller.js +391 -0
- package/esm/controller.js.map +1 -0
- package/esm/element.js +14443 -0
- package/esm/element.js.map +1 -0
- package/esm/print.js +14173 -0
- package/esm/print.js.map +1 -0
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/index.js +2 -0
- package/module/manifest.json +1 -1
- package/module/print.html +1 -1
- package/module/print.js +1 -1
- package/package.json +22 -4
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import isEmpty from 'lodash/isEmpty';
|
|
2
|
+
import isEqual from 'lodash/isEqual';
|
|
3
|
+
import { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';
|
|
4
|
+
|
|
5
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
6
|
+
try {
|
|
7
|
+
var info = gen[key](arg);
|
|
8
|
+
var value = info.value;
|
|
9
|
+
} catch (error) {
|
|
10
|
+
reject(error);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (info.done) {
|
|
15
|
+
resolve(value);
|
|
16
|
+
} else {
|
|
17
|
+
Promise.resolve(value).then(_next, _throw);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function _asyncToGenerator(fn) {
|
|
22
|
+
return function () {
|
|
23
|
+
var self = this,
|
|
24
|
+
args = arguments;
|
|
25
|
+
return new Promise(function (resolve, reject) {
|
|
26
|
+
var gen = fn.apply(self, args);
|
|
27
|
+
|
|
28
|
+
function _next(value) {
|
|
29
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function _throw(err) {
|
|
33
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_next(undefined);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
42
|
+
if (source == null) return {};
|
|
43
|
+
var target = {};
|
|
44
|
+
var sourceKeys = Object.keys(source);
|
|
45
|
+
var key, i;
|
|
46
|
+
|
|
47
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
48
|
+
key = sourceKeys[i];
|
|
49
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
50
|
+
target[key] = source[key];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return target;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function _objectWithoutProperties(source, excluded) {
|
|
57
|
+
if (source == null) return {};
|
|
58
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
59
|
+
var key, i;
|
|
60
|
+
|
|
61
|
+
if (Object.getOwnPropertySymbols) {
|
|
62
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
63
|
+
|
|
64
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
65
|
+
key = sourceSymbolKeys[i];
|
|
66
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
67
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
68
|
+
target[key] = source[key];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return target;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function _defineProperty(obj, key, value) {
|
|
76
|
+
if (key in obj) {
|
|
77
|
+
Object.defineProperty(obj, key, {
|
|
78
|
+
value: value,
|
|
79
|
+
enumerable: true,
|
|
80
|
+
configurable: true,
|
|
81
|
+
writable: true
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
obj[key] = value;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return obj;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var getCorrectResponse = choices => choices.filter(c => c.correct).map(c => c.value).sort();
|
|
91
|
+
var isResponseCorrect = (question, session) => {
|
|
92
|
+
var correctResponse = getCorrectResponse(question.choices);
|
|
93
|
+
return session && isEqual((session.value || []).sort(), correctResponse);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
var defaults = {
|
|
97
|
+
choiceMode: 'checkbox',
|
|
98
|
+
choicePrefix: 'letters',
|
|
99
|
+
choices: [],
|
|
100
|
+
choicesLayout: 'vertical',
|
|
101
|
+
feedbackEnabled: false,
|
|
102
|
+
gridColumns: 2,
|
|
103
|
+
lockChoiceOrder: true,
|
|
104
|
+
partialScoring: true,
|
|
105
|
+
prompt: '',
|
|
106
|
+
promptEnabled: true,
|
|
107
|
+
rationale: '',
|
|
108
|
+
rationaleEnabled: true,
|
|
109
|
+
scoringType: 'auto',
|
|
110
|
+
studentInstructionsEnabled: true,
|
|
111
|
+
teacherInstructions: '',
|
|
112
|
+
teacherInstructionsEnabled: true,
|
|
113
|
+
toolbarEditorPosition: 'bottom',
|
|
114
|
+
selectedAnswerBackgroundColor: 'initial',
|
|
115
|
+
selectedAnswerStrokeColor: 'initial',
|
|
116
|
+
selectedAnswerStrokeWidth: 'initial',
|
|
117
|
+
hoverAnswerBackgroundColor: 'initial',
|
|
118
|
+
hoverAnswerStrokeColor: 'initial',
|
|
119
|
+
hoverAnswerStrokeWidth: 'initial',
|
|
120
|
+
keyboardEventsEnabled: false
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
var _excluded = ["verticalMode", "choicesLayout"];
|
|
124
|
+
|
|
125
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
126
|
+
|
|
127
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
128
|
+
|
|
129
|
+
var prepareChoice = (model, env, defaultFeedback) => choice => {
|
|
130
|
+
var {
|
|
131
|
+
role,
|
|
132
|
+
mode
|
|
133
|
+
} = env || {};
|
|
134
|
+
var out = {
|
|
135
|
+
label: choice.label,
|
|
136
|
+
value: choice.value
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {
|
|
140
|
+
out.rationale = model.rationaleEnabled ? choice.rationale : null;
|
|
141
|
+
} else {
|
|
142
|
+
out.rationale = null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (mode === 'evaluate') {
|
|
146
|
+
out.correct = !!choice.correct;
|
|
147
|
+
|
|
148
|
+
if (model.feedbackEnabled) {
|
|
149
|
+
var feedbackType = choice.feedback && choice.feedback.type || 'none';
|
|
150
|
+
|
|
151
|
+
if (feedbackType === 'default') {
|
|
152
|
+
out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];
|
|
153
|
+
} else if (feedbackType === 'custom') {
|
|
154
|
+
out.feedback = choice.feedback.value;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return out;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
function createDefaultModel() {
|
|
163
|
+
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
164
|
+
return new Promise(resolve => resolve(_objectSpread(_objectSpread({}, defaults), model)));
|
|
165
|
+
}
|
|
166
|
+
var normalize = question => {
|
|
167
|
+
var _ref = question || {},
|
|
168
|
+
{
|
|
169
|
+
verticalMode,
|
|
170
|
+
choicesLayout
|
|
171
|
+
} = _ref,
|
|
172
|
+
questionProps = _objectWithoutProperties(_ref, _excluded);
|
|
173
|
+
|
|
174
|
+
return _objectSpread(_objectSpread(_objectSpread({}, defaults), questionProps), {}, {
|
|
175
|
+
// This is used for offering support for old models which have the property verticalMode
|
|
176
|
+
// Same thing is set in authoring : packages/multiple-choice/configure/src/index.jsx - createDefaultModel
|
|
177
|
+
choicesLayout: choicesLayout || verticalMode === false && 'horizontal' || defaults.choicesLayout
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
*
|
|
182
|
+
* @param {*} question
|
|
183
|
+
* @param {*} session
|
|
184
|
+
* @param {*} env
|
|
185
|
+
* @param {*} updateSession - optional - a function that will set the properties passed into it on the session.
|
|
186
|
+
*/
|
|
187
|
+
|
|
188
|
+
function model(_x, _x2, _x3, _x4) {
|
|
189
|
+
return _model.apply(this, arguments);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function _model() {
|
|
193
|
+
_model = _asyncToGenerator(function* (question, session, env, updateSession) {
|
|
194
|
+
var normalizedQuestion = normalize(question);
|
|
195
|
+
var defaultFeedback = Object.assign({
|
|
196
|
+
correct: 'Correct',
|
|
197
|
+
incorrect: 'Incorrect'
|
|
198
|
+
}, normalizedQuestion.defaultFeedback);
|
|
199
|
+
var choices = (normalizedQuestion.choices || []).map(prepareChoice(normalizedQuestion, env, defaultFeedback));
|
|
200
|
+
var lockChoiceOrder = lockChoices(normalizedQuestion, session, env);
|
|
201
|
+
|
|
202
|
+
if (!lockChoiceOrder) {
|
|
203
|
+
choices = yield getShuffledChoices(choices, session, updateSession, 'value');
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
var out = {
|
|
207
|
+
disabled: env.mode !== 'gather',
|
|
208
|
+
mode: env.mode,
|
|
209
|
+
prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,
|
|
210
|
+
choicesLayout: normalizedQuestion.choicesLayout,
|
|
211
|
+
gridColumns: normalizedQuestion.gridColumns,
|
|
212
|
+
choiceMode: normalizedQuestion.choiceMode,
|
|
213
|
+
keyMode: normalizedQuestion.choicePrefix,
|
|
214
|
+
choices,
|
|
215
|
+
responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined,
|
|
216
|
+
language: normalizedQuestion.language,
|
|
217
|
+
extraCSSRules: normalizedQuestion.extraCSSRules,
|
|
218
|
+
fontSizeFactor: normalizedQuestion.fontSizeFactor,
|
|
219
|
+
isSelectionButtonBelow: normalizedQuestion.isSelectionButtonBelow,
|
|
220
|
+
selectedAnswerBackgroundColor: normalizedQuestion.selectedAnswerBackgroundColor || 'initial',
|
|
221
|
+
selectedAnswerStrokeColor: normalizedQuestion.selectedAnswerStrokeColor || 'initial',
|
|
222
|
+
selectedAnswerStrokeWidth: normalizedQuestion.selectedAnswerStrokeWidth || 'initial',
|
|
223
|
+
hoverAnswerBackgroundColor: normalizedQuestion.hoverAnswerBackgroundColor || 'initial',
|
|
224
|
+
hoverAnswerStrokeColor: normalizedQuestion.hoverAnswerStrokeColor || 'initial',
|
|
225
|
+
hoverAnswerStrokeWidth: normalizedQuestion.hoverAnswerStrokeWidth || 'initial',
|
|
226
|
+
minSelections: normalizedQuestion.minSelections,
|
|
227
|
+
maxSelections: normalizedQuestion.maxSelections,
|
|
228
|
+
keyboardEventsEnabled: normalizedQuestion.keyboardEventsEnabled,
|
|
229
|
+
autoplayAudioEnabled: normalizedQuestion.autoplayAudioEnabled,
|
|
230
|
+
completeAudioEnabled: normalizedQuestion.completeAudioEnabled,
|
|
231
|
+
customAudioButton: normalizedQuestion.customAudioButton
|
|
232
|
+
};
|
|
233
|
+
var {
|
|
234
|
+
role,
|
|
235
|
+
mode
|
|
236
|
+
} = env || {};
|
|
237
|
+
|
|
238
|
+
if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {
|
|
239
|
+
out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
|
|
240
|
+
} else {
|
|
241
|
+
out.teacherInstructions = null;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return out;
|
|
245
|
+
});
|
|
246
|
+
return _model.apply(this, arguments);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
var getScore = (config, session) => {
|
|
250
|
+
if (!session || isEmpty(session)) {
|
|
251
|
+
return 0;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
var selectedChoices = session.value || [];
|
|
255
|
+
var correctChoices = (config.choices || []).filter(ch => ch.correct);
|
|
256
|
+
var score = selectedChoices.reduce((acc, selectedChoice) => acc + (correctChoices.find(ch => ch.value === selectedChoice) ? 1 : 0), 0);
|
|
257
|
+
|
|
258
|
+
if (correctChoices.length < selectedChoices.length) {
|
|
259
|
+
score -= selectedChoices.length - correctChoices.length;
|
|
260
|
+
|
|
261
|
+
if (score < 0) {
|
|
262
|
+
score = 0;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
var str = correctChoices.length ? score / correctChoices.length : 0;
|
|
267
|
+
return parseFloat(str.toFixed(2));
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
*
|
|
271
|
+
* The score is partial by default for checkbox mode, allOrNothing for radio mode.
|
|
272
|
+
* To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring = false. the value in `env` will
|
|
273
|
+
* override the value in `model`.
|
|
274
|
+
* @param {Object} model - the main model
|
|
275
|
+
* @param {*} session
|
|
276
|
+
* @param {Object} env
|
|
277
|
+
*/
|
|
278
|
+
|
|
279
|
+
function outcome(model, session, env) {
|
|
280
|
+
return new Promise(resolve => {
|
|
281
|
+
if (!session || isEmpty(session)) {
|
|
282
|
+
resolve({
|
|
283
|
+
score: 0,
|
|
284
|
+
empty: true
|
|
285
|
+
});
|
|
286
|
+
} else {
|
|
287
|
+
var partialScoringEnabled = partialScoring.enabled(model, env) && model.choiceMode !== 'radio';
|
|
288
|
+
var score = getScore(model, session);
|
|
289
|
+
resolve({
|
|
290
|
+
score: partialScoringEnabled ? score : score === 1 ? 1 : 0,
|
|
291
|
+
empty: false
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
var createCorrectResponseSession = (question, env) => {
|
|
297
|
+
return new Promise(resolve => {
|
|
298
|
+
if (env.mode !== 'evaluate' && env.role === 'instructor') {
|
|
299
|
+
var {
|
|
300
|
+
choices
|
|
301
|
+
} = question || {
|
|
302
|
+
choices: []
|
|
303
|
+
};
|
|
304
|
+
resolve({
|
|
305
|
+
id: '1',
|
|
306
|
+
value: choices.filter(c => c.correct).map(c => c.value)
|
|
307
|
+
});
|
|
308
|
+
} else {
|
|
309
|
+
resolve(null);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}; // remove all html tags
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
var getContent = html => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
|
|
316
|
+
|
|
317
|
+
var validate = function validate() {
|
|
318
|
+
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
319
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
320
|
+
var {
|
|
321
|
+
choices
|
|
322
|
+
} = model;
|
|
323
|
+
var {
|
|
324
|
+
minAnswerChoices = 2,
|
|
325
|
+
maxAnswerChoices
|
|
326
|
+
} = config;
|
|
327
|
+
var reversedChoices = [...(choices || [])].reverse();
|
|
328
|
+
var choicesErrors = {};
|
|
329
|
+
var rationaleErrors = {};
|
|
330
|
+
var errors = {};
|
|
331
|
+
['teacherInstructions', 'prompt'].forEach(field => {
|
|
332
|
+
var _config$field;
|
|
333
|
+
|
|
334
|
+
if ((_config$field = config[field]) !== null && _config$field !== void 0 && _config$field.required && !getContent(model[field])) {
|
|
335
|
+
errors[field] = 'This field is required.';
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
var hasCorrectResponse = false;
|
|
339
|
+
reversedChoices.forEach((choice, index) => {
|
|
340
|
+
var _config$rationale;
|
|
341
|
+
|
|
342
|
+
var {
|
|
343
|
+
correct,
|
|
344
|
+
value,
|
|
345
|
+
label,
|
|
346
|
+
rationale
|
|
347
|
+
} = choice;
|
|
348
|
+
|
|
349
|
+
if (correct) {
|
|
350
|
+
hasCorrectResponse = true;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (!getContent(label)) {
|
|
354
|
+
choicesErrors[value] = 'Content should not be empty.';
|
|
355
|
+
} else {
|
|
356
|
+
var identicalAnswer = reversedChoices.slice(index + 1).some(c => c.label === label);
|
|
357
|
+
|
|
358
|
+
if (identicalAnswer) {
|
|
359
|
+
choicesErrors[value] = 'Content should be unique.';
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if ((_config$rationale = config.rationale) !== null && _config$rationale !== void 0 && _config$rationale.required && !getContent(rationale)) {
|
|
364
|
+
rationaleErrors[value] = 'This field is required.';
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
var nbOfChoices = (choices || []).length;
|
|
368
|
+
|
|
369
|
+
if (nbOfChoices < minAnswerChoices) {
|
|
370
|
+
errors.answerChoices = "There should be at least ".concat(minAnswerChoices, " choices defined.");
|
|
371
|
+
} else if (nbOfChoices > maxAnswerChoices) {
|
|
372
|
+
errors.answerChoices = "No more than ".concat(maxAnswerChoices, " choices should be defined.");
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (!hasCorrectResponse) {
|
|
376
|
+
errors.correctResponse = 'No correct response defined.';
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (!isEmpty(choicesErrors)) {
|
|
380
|
+
errors.choices = choicesErrors;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
if (!isEmpty(rationaleErrors)) {
|
|
384
|
+
errors.rationale = rationaleErrors;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return errors;
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
export { createCorrectResponseSession, createDefaultModel, getScore, model, normalize, outcome, validate };
|
|
391
|
+
//# sourceMappingURL=controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.js","sources":["../../../node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","../../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../controller/src/utils.js","../controller/src/defaults.js","../controller/src/index.js"],"sourcesContent":["function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import isEqual from 'lodash/isEqual';\n\nexport const getCorrectResponse = (choices) =>\n choices\n .filter((c) => c.correct)\n .map((c) => c.value)\n .sort();\n\nexport const isResponseCorrect = (question, session) => {\n let correctResponse = getCorrectResponse(question.choices);\n return session && isEqual((session.value || []).sort(), correctResponse);\n};\n","export default {\n choiceMode: 'checkbox',\n choicePrefix: 'letters',\n choices: [],\n choicesLayout: 'vertical',\n feedbackEnabled: false,\n gridColumns: 2,\n lockChoiceOrder: true,\n partialScoring: true,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n scoringType: 'auto',\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n selectedAnswerBackgroundColor: 'initial',\n selectedAnswerStrokeColor: 'initial',\n selectedAnswerStrokeWidth: 'initial',\n hoverAnswerBackgroundColor: 'initial',\n hoverAnswerStrokeColor: 'initial',\n hoverAnswerStrokeWidth: 'initial',\n keyboardEventsEnabled: false,\n};\n","/* eslint-disable no-console */\nimport isEmpty from 'lodash/isEmpty';\nimport { isResponseCorrect } from './utils';\nimport defaults from './defaults';\nimport { lockChoices, partialScoring, getShuffledChoices } from '@pie-lib/controller-utils';\n\nconst prepareChoice = (model, env, defaultFeedback) => (choice) => {\n const { role, mode } = env || {};\n const out = {\n label: choice.label,\n value: choice.value,\n };\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = model.rationaleEnabled ? choice.rationale : null;\n } else {\n out.rationale = null;\n }\n\n if (mode === 'evaluate') {\n out.correct = !!choice.correct;\n\n if (model.feedbackEnabled) {\n const feedbackType = (choice.feedback && choice.feedback.type) || 'none';\n\n if (feedbackType === 'default') {\n out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];\n } else if (feedbackType === 'custom') {\n out.feedback = choice.feedback.value;\n }\n }\n }\n\n return out;\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = (question) => {\n const { verticalMode, choicesLayout, ...questionProps } = question || {};\n\n return {\n ...defaults,\n ...questionProps,\n // This is used for offering support for old models which have the property verticalMode\n // Same thing is set in authoring : packages/multiple-choice/configure/src/index.jsx - createDefaultModel\n choicesLayout: choicesLayout || (verticalMode === false && 'horizontal') || defaults.choicesLayout,\n };\n};\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n\n const defaultFeedback = Object.assign(\n { correct: 'Correct', incorrect: 'Incorrect' },\n normalizedQuestion.defaultFeedback,\n );\n\n let choices = (normalizedQuestion.choices || []).map(prepareChoice(normalizedQuestion, env, defaultFeedback));\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'value');\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n choicesLayout: normalizedQuestion.choicesLayout,\n gridColumns: normalizedQuestion.gridColumns,\n choiceMode: normalizedQuestion.choiceMode,\n keyMode: normalizedQuestion.choicePrefix,\n choices,\n responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n fontSizeFactor: normalizedQuestion.fontSizeFactor,\n isSelectionButtonBelow: normalizedQuestion.isSelectionButtonBelow,\n selectedAnswerBackgroundColor: normalizedQuestion.selectedAnswerBackgroundColor || 'initial',\n selectedAnswerStrokeColor: normalizedQuestion.selectedAnswerStrokeColor || 'initial',\n selectedAnswerStrokeWidth: normalizedQuestion.selectedAnswerStrokeWidth || 'initial',\n hoverAnswerBackgroundColor: normalizedQuestion.hoverAnswerBackgroundColor || 'initial',\n hoverAnswerStrokeColor: normalizedQuestion.hoverAnswerStrokeColor || 'initial',\n hoverAnswerStrokeWidth: normalizedQuestion.hoverAnswerStrokeWidth || 'initial',\n minSelections: normalizedQuestion.minSelections,\n maxSelections: normalizedQuestion.maxSelections,\n keyboardEventsEnabled: normalizedQuestion.keyboardEventsEnabled,\n autoplayAudioEnabled: normalizedQuestion.autoplayAudioEnabled,\n completeAudioEnabled: normalizedQuestion.completeAudioEnabled,\n customAudioButton: normalizedQuestion.customAudioButton,\n };\n\n const { role, mode } = env || {};\n\n if (role === 'instructor' && (mode === 'view' || 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 getScore = (config, session) => {\n if (!session || isEmpty(session)) {\n return 0;\n }\n\n const selectedChoices = session.value || [];\n const correctChoices = (config.choices || []).filter((ch) => ch.correct);\n\n let score = selectedChoices.reduce(\n (acc, selectedChoice) => acc + (correctChoices.find((ch) => ch.value === selectedChoice) ? 1 : 0),\n 0,\n );\n\n if (correctChoices.length < selectedChoices.length) {\n score -= selectedChoices.length - correctChoices.length;\n\n if (score < 0) {\n score = 0;\n }\n }\n\n const str = correctChoices.length ? score / correctChoices.length : 0;\n\n return parseFloat(str.toFixed(2));\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring = false. the value in `env` will\n * override the value in `model`.\n * @param {Object} model - the main model\n * @param {*} session\n * @param {Object} env\n */\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n } else {\n const partialScoringEnabled = partialScoring.enabled(model, env) && model.choiceMode !== 'radio';\n const score = getScore(model, session);\n\n resolve({ score: partialScoringEnabled ? score : score === 1 ? 1 : 0, empty: false });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question || { choices: [] };\n\n resolve({\n id: '1',\n value: choices.filter((c) => c.correct).map((c) => c.value),\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { choices } = model;\n const { minAnswerChoices = 2, maxAnswerChoices } = config;\n const reversedChoices = [...(choices || [])].reverse();\n const choicesErrors = {};\n const rationaleErrors = {};\n const errors = {};\n\n ['teacherInstructions', 'prompt'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n let hasCorrectResponse = false;\n\n reversedChoices.forEach((choice, index) => {\n const { correct, value, label, rationale } = choice;\n\n if (correct) {\n hasCorrectResponse = true;\n }\n\n if (!getContent(label)) {\n choicesErrors[value] = 'Content should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.label === label);\n\n if (identicalAnswer) {\n choicesErrors[value] = 'Content should be unique.';\n }\n }\n\n if (config.rationale?.required && !getContent(rationale)) {\n rationaleErrors[value] = 'This field is required.';\n }\n });\n\n const nbOfChoices = (choices || []).length;\n\n if (nbOfChoices < minAnswerChoices) {\n errors.answerChoices = `There should be at least ${minAnswerChoices} choices defined.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.answerChoices = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (!hasCorrectResponse) {\n errors.correctResponse = 'No correct response defined.';\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choices = choicesErrors;\n }\n\n if (!isEmpty(rationaleErrors)) {\n errors.rationale = rationaleErrors;\n }\n\n return errors;\n};\n"],"names":["objectWithoutPropertiesLoose","getCorrectResponse","choices","filter","c","correct","map","value","sort","isResponseCorrect","question","session","correctResponse","isEqual","choiceMode","choicePrefix","choicesLayout","feedbackEnabled","gridColumns","lockChoiceOrder","partialScoring","prompt","promptEnabled","rationale","rationaleEnabled","scoringType","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","selectedAnswerBackgroundColor","selectedAnswerStrokeColor","selectedAnswerStrokeWidth","hoverAnswerBackgroundColor","hoverAnswerStrokeColor","hoverAnswerStrokeWidth","keyboardEventsEnabled","prepareChoice","model","env","defaultFeedback","choice","role","mode","out","label","feedbackType","feedback","type","createDefaultModel","Promise","resolve","defaults","normalize","verticalMode","questionProps","updateSession","normalizedQuestion","Object","assign","incorrect","lockChoices","getShuffledChoices","disabled","keyMode","responseCorrect","undefined","language","extraCSSRules","fontSizeFactor","isSelectionButtonBelow","minSelections","maxSelections","autoplayAudioEnabled","completeAudioEnabled","customAudioButton","getScore","config","isEmpty","selectedChoices","correctChoices","ch","score","reduce","acc","selectedChoice","find","length","str","parseFloat","toFixed","outcome","empty","partialScoringEnabled","enabled","createCorrectResponseSession","id","getContent","html","replace","validate","minAnswerChoices","maxAnswerChoices","reversedChoices","reverse","choicesErrors","rationaleErrors","errors","forEach","field","required","hasCorrectResponse","index","identicalAnswer","slice","some","nbOfChoices","answerChoices"],"mappings":";;;;AAAA,SAAS,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE;AAC3E,EAAE,IAA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