@pie-element/multiple-choice 11.0.5-esm.0 → 11.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/esm/controller.js DELETED
@@ -1,324 +0,0 @@
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 _extends() {
6
- _extends = Object.assign || function (target) {
7
- for (var i = 1; i < arguments.length; i++) {
8
- var source = arguments[i];
9
-
10
- for (var key in source) {
11
- if (Object.prototype.hasOwnProperty.call(source, key)) {
12
- target[key] = source[key];
13
- }
14
- }
15
- }
16
-
17
- return target;
18
- };
19
-
20
- return _extends.apply(this, arguments);
21
- }
22
-
23
- function _objectWithoutPropertiesLoose(source, excluded) {
24
- if (source == null) return {};
25
- var target = {};
26
- var sourceKeys = Object.keys(source);
27
- var key, i;
28
-
29
- for (i = 0; i < sourceKeys.length; i++) {
30
- key = sourceKeys[i];
31
- if (excluded.indexOf(key) >= 0) continue;
32
- target[key] = source[key];
33
- }
34
-
35
- return target;
36
- }
37
-
38
- const getCorrectResponse = choices => choices.filter(c => c.correct).map(c => c.value).sort();
39
- const isResponseCorrect = (question, session) => {
40
- let correctResponse = getCorrectResponse(question.choices);
41
- return session && isEqual((session.value || []).sort(), correctResponse);
42
- };
43
-
44
- var defaults = {
45
- choiceMode: 'checkbox',
46
- choicePrefix: 'letters',
47
- choices: [],
48
- choicesLayout: 'vertical',
49
- feedbackEnabled: false,
50
- gridColumns: 2,
51
- lockChoiceOrder: true,
52
- partialScoring: true,
53
- prompt: '',
54
- promptEnabled: true,
55
- rationale: '',
56
- rationaleEnabled: true,
57
- scoringType: 'auto',
58
- studentInstructionsEnabled: true,
59
- teacherInstructions: '',
60
- teacherInstructionsEnabled: true,
61
- toolbarEditorPosition: 'bottom',
62
- selectedAnswerBackgroundColor: 'initial',
63
- selectedAnswerStrokeColor: 'initial',
64
- selectedAnswerStrokeWidth: 'initial',
65
- hoverAnswerBackgroundColor: 'initial',
66
- hoverAnswerStrokeColor: 'initial',
67
- hoverAnswerStrokeWidth: 'initial',
68
- keyboardEventsEnabled: false
69
- };
70
-
71
- const _excluded = ["verticalMode", "choicesLayout"];
72
-
73
- const prepareChoice = (model, env, defaultFeedback) => choice => {
74
- const {
75
- role,
76
- mode
77
- } = env || {};
78
- const out = {
79
- label: choice.label,
80
- value: choice.value
81
- };
82
-
83
- if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {
84
- out.rationale = model.rationaleEnabled ? choice.rationale : null;
85
- } else {
86
- out.rationale = null;
87
- }
88
-
89
- if (mode === 'evaluate') {
90
- out.correct = !!choice.correct;
91
-
92
- if (model.feedbackEnabled) {
93
- const feedbackType = choice.feedback && choice.feedback.type || 'none';
94
-
95
- if (feedbackType === 'default') {
96
- out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];
97
- } else if (feedbackType === 'custom') {
98
- out.feedback = choice.feedback.value;
99
- }
100
- }
101
- }
102
-
103
- return out;
104
- };
105
-
106
- function createDefaultModel(model = {}) {
107
- return new Promise(resolve => resolve(_extends({}, defaults, model)));
108
- }
109
- const normalize = question => {
110
- const _ref = question || {},
111
- {
112
- verticalMode,
113
- choicesLayout
114
- } = _ref,
115
- questionProps = _objectWithoutPropertiesLoose(_ref, _excluded);
116
-
117
- return _extends({}, defaults, questionProps, {
118
- // This is used for offering support for old models which have the property verticalMode
119
- // Same thing is set in authoring : packages/multiple-choice/configure/src/index.jsx - createDefaultModel
120
- choicesLayout: choicesLayout || verticalMode === false && 'horizontal' || defaults.choicesLayout
121
- });
122
- };
123
- /**
124
- *
125
- * @param {*} question
126
- * @param {*} session
127
- * @param {*} env
128
- * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.
129
- */
130
-
131
- async function model(question, session, env, updateSession) {
132
- const normalizedQuestion = normalize(question);
133
- const defaultFeedback = Object.assign({
134
- correct: 'Correct',
135
- incorrect: 'Incorrect'
136
- }, normalizedQuestion.defaultFeedback);
137
- let choices = (normalizedQuestion.choices || []).map(prepareChoice(normalizedQuestion, env, defaultFeedback));
138
- const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);
139
-
140
- if (!lockChoiceOrder) {
141
- choices = await getShuffledChoices(choices, session, updateSession, 'value');
142
- }
143
-
144
- const out = {
145
- disabled: env.mode !== 'gather',
146
- mode: env.mode,
147
- prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,
148
- choicesLayout: normalizedQuestion.choicesLayout,
149
- gridColumns: normalizedQuestion.gridColumns,
150
- choiceMode: normalizedQuestion.choiceMode,
151
- keyMode: normalizedQuestion.choicePrefix,
152
- choices,
153
- responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined,
154
- language: normalizedQuestion.language,
155
- extraCSSRules: normalizedQuestion.extraCSSRules,
156
- fontSizeFactor: normalizedQuestion.fontSizeFactor,
157
- isSelectionButtonBelow: normalizedQuestion.isSelectionButtonBelow,
158
- selectedAnswerBackgroundColor: normalizedQuestion.selectedAnswerBackgroundColor || 'initial',
159
- selectedAnswerStrokeColor: normalizedQuestion.selectedAnswerStrokeColor || 'initial',
160
- selectedAnswerStrokeWidth: normalizedQuestion.selectedAnswerStrokeWidth || 'initial',
161
- hoverAnswerBackgroundColor: normalizedQuestion.hoverAnswerBackgroundColor || 'initial',
162
- hoverAnswerStrokeColor: normalizedQuestion.hoverAnswerStrokeColor || 'initial',
163
- hoverAnswerStrokeWidth: normalizedQuestion.hoverAnswerStrokeWidth || 'initial',
164
- minSelections: normalizedQuestion.minSelections,
165
- maxSelections: normalizedQuestion.maxSelections,
166
- keyboardEventsEnabled: normalizedQuestion.keyboardEventsEnabled,
167
- autoplayAudioEnabled: normalizedQuestion.autoplayAudioEnabled,
168
- completeAudioEnabled: normalizedQuestion.completeAudioEnabled,
169
- customAudioButton: normalizedQuestion.customAudioButton
170
- };
171
- const {
172
- role,
173
- mode
174
- } = env || {};
175
-
176
- if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {
177
- out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
178
- } else {
179
- out.teacherInstructions = null;
180
- }
181
-
182
- return out;
183
- }
184
- const getScore = (config, session) => {
185
- if (!session || isEmpty(session)) {
186
- return 0;
187
- }
188
-
189
- const selectedChoices = session.value || [];
190
- const correctChoices = (config.choices || []).filter(ch => ch.correct);
191
- let score = selectedChoices.reduce((acc, selectedChoice) => acc + (correctChoices.find(ch => ch.value === selectedChoice) ? 1 : 0), 0);
192
-
193
- if (correctChoices.length < selectedChoices.length) {
194
- score -= selectedChoices.length - correctChoices.length;
195
-
196
- if (score < 0) {
197
- score = 0;
198
- }
199
- }
200
-
201
- const str = correctChoices.length ? score / correctChoices.length : 0;
202
- return parseFloat(str.toFixed(2));
203
- };
204
- /**
205
- *
206
- * The score is partial by default for checkbox mode, allOrNothing for radio mode.
207
- * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring = false. the value in `env` will
208
- * override the value in `model`.
209
- * @param {Object} model - the main model
210
- * @param {*} session
211
- * @param {Object} env
212
- */
213
-
214
- function outcome(model, session, env) {
215
- return new Promise(resolve => {
216
- if (!session || isEmpty(session)) {
217
- resolve({
218
- score: 0,
219
- empty: true
220
- });
221
- } else {
222
- const partialScoringEnabled = partialScoring.enabled(model, env) && model.choiceMode !== 'radio';
223
- const score = getScore(model, session);
224
- resolve({
225
- score: partialScoringEnabled ? score : score === 1 ? 1 : 0,
226
- empty: false
227
- });
228
- }
229
- });
230
- }
231
- const createCorrectResponseSession = (question, env) => {
232
- return new Promise(resolve => {
233
- if (env.mode !== 'evaluate' && env.role === 'instructor') {
234
- const {
235
- choices
236
- } = question || {
237
- choices: []
238
- };
239
- resolve({
240
- id: '1',
241
- value: choices.filter(c => c.correct).map(c => c.value)
242
- });
243
- } else {
244
- resolve(null);
245
- }
246
- });
247
- }; // remove all html tags
248
-
249
-
250
- const getContent = html => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
251
-
252
- const validate = (model = {}, config = {}) => {
253
- const {
254
- choices
255
- } = model;
256
- const {
257
- minAnswerChoices = 2,
258
- maxAnswerChoices
259
- } = config;
260
- const reversedChoices = [...(choices || [])].reverse();
261
- const choicesErrors = {};
262
- const rationaleErrors = {};
263
- const errors = {};
264
- ['teacherInstructions', 'prompt'].forEach(field => {
265
- var _config$field;
266
-
267
- if ((_config$field = config[field]) != null && _config$field.required && !getContent(model[field])) {
268
- errors[field] = 'This field is required.';
269
- }
270
- });
271
- let hasCorrectResponse = false;
272
- reversedChoices.forEach((choice, index) => {
273
- var _config$rationale;
274
-
275
- const {
276
- correct,
277
- value,
278
- label,
279
- rationale
280
- } = choice;
281
-
282
- if (correct) {
283
- hasCorrectResponse = true;
284
- }
285
-
286
- if (!getContent(label)) {
287
- choicesErrors[value] = 'Content should not be empty.';
288
- } else {
289
- const identicalAnswer = reversedChoices.slice(index + 1).some(c => c.label === label);
290
-
291
- if (identicalAnswer) {
292
- choicesErrors[value] = 'Content should be unique.';
293
- }
294
- }
295
-
296
- if ((_config$rationale = config.rationale) != null && _config$rationale.required && !getContent(rationale)) {
297
- rationaleErrors[value] = 'This field is required.';
298
- }
299
- });
300
- const nbOfChoices = (choices || []).length;
301
-
302
- if (nbOfChoices < minAnswerChoices) {
303
- errors.answerChoices = `There should be at least ${minAnswerChoices} choices defined.`;
304
- } else if (nbOfChoices > maxAnswerChoices) {
305
- errors.answerChoices = `No more than ${maxAnswerChoices} choices should be defined.`;
306
- }
307
-
308
- if (!hasCorrectResponse) {
309
- errors.correctResponse = 'No correct response defined.';
310
- }
311
-
312
- if (!isEmpty(choicesErrors)) {
313
- errors.choices = choicesErrors;
314
- }
315
-
316
- if (!isEmpty(rationaleErrors)) {
317
- errors.rationale = rationaleErrors;
318
- }
319
-
320
- return errors;
321
- };
322
-
323
- export { createCorrectResponseSession, createDefaultModel, getScore, model, normalize, outcome, validate };
324
- //# sourceMappingURL=controller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"controller.js","sources":["../controller/src/utils.js","../controller/src/defaults.js","../controller/src/index.js"],"sourcesContent":["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":["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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,kBAAkB,GAAIC,OAAD,IAChCA,OAAO,CACJC,MADH,CACWC,CAAD,IAAOA,CAAC,CAACC,OADnB,CAAA,CAEGC,GAFH,CAEQF,CAAD,IAAOA,CAAC,CAACG,KAFhB,CAGGC,CAAAA,IAHH,EADK,CAAA;AAMA,MAAMC,iBAAiB,GAAG,CAACC,QAAD,EAAWC,OAAX,KAAuB;AACtD,EAAA,IAAIC,eAAe,GA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