@pie-element/inline-dropdown 10.1.2-next.4 → 10.1.2-next.6

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.
@@ -1,4 +1,4 @@
1
- import { l as e, o as t, r as n, s as r } from "../dist-Oyzav2lb.js";
1
+ import { l as e, o as t, r as n, s as r } from "../dist-BJd6t-uW.js";
2
2
  //#region ../../shared/controller-utils/dist/index.js
3
3
  var i = Object.defineProperty, a = (e, t) => {
4
4
  let n = {};
@@ -20,7 +20,7 @@ function s(e) {
20
20
  return t;
21
21
  }
22
22
  function c(e) {
23
- return e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1;
23
+ return e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == "object" && Object.keys(e).length === 0;
24
24
  }
25
25
  async function l(e, t, n, r = "value") {
26
26
  let i = o(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);
@@ -44,7 +44,7 @@ function u(e, t, n) {
44
44
  }
45
45
  var d = /* @__PURE__ */ a({ enabled: () => f });
46
46
  function f(e, t, n) {
47
- return e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n == "boolean" ? n : !0;
47
+ return e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != "boolean" || n;
48
48
  }
49
49
  //#endregion
50
50
  //#region src/controller/defaults.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../shared/controller-utils/dist/index.js","../../../src/controller/defaults.ts","../../../src/controller/utils.ts","../../../src/controller/index.ts"],"sourcesContent":["//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" ? Object.keys(e).length === 0 : !1;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : t.id && t.element && await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n[\"@pie-element\"]?.lockChoiceOrder || (n.role ?? \"student\") === \"instructor\");\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n == \"boolean\" ? n : !0;\n}\n//#endregion\nexport { a as getShuffledChoices, o as lockChoices, s as partialScoring };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/inline-dropdown/controller/src/defaults.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nexport default {\n alternateResponse: {},\n choiceRationaleEnabled: true,\n choices: {},\n disabled: false,\n displayType: 'block',\n markup: '',\n mode: 'gather',\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n shuffle: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/inline-dropdown/controller/src/utils.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { forEach } from '@pie-element/shared-lodash';\n\nexport const getAllCorrectResponses = ({ choices, alternateResponse }) => {\n alternateResponse = alternateResponse || {};\n const correctAnswers = {};\n\n forEach(choices, (respArea, key) => {\n if (!correctAnswers[key]) {\n correctAnswers[key] = [];\n }\n\n if (respArea) {\n respArea.forEach((choice) => {\n if (choice.correct) {\n correctAnswers[key].push(choice.value);\n\n if (alternateResponse[key]) {\n correctAnswers[key] = [...correctAnswers[key], ...alternateResponse[key]];\n }\n }\n });\n }\n });\n\n return correctAnswers;\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/inline-dropdown/controller/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { isEmpty, map, reduce } from '@pie-element/shared-lodash';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-element/shared-controller-utils';\nimport defaults from './defaults.js';\n\nimport { getAllCorrectResponses } from './utils.js';\n\nconst getFeedback = (correct) => {\n if (correct) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\nexport const normalize = (question) => ({ ...defaults, ...question });\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 const { value = {} } = session || {};\n let choices = reduce(\n normalizedQuestion.choices,\n (obj, area, key) => {\n obj[key] = map(area, (choice) => choice);\n\n return obj;\n },\n {},\n );\n\n let feedback = {};\n\n if (env.mode === 'evaluate') {\n const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);\n const respAreaLength = Object.keys(allCorrectResponses).length;\n let correctResponses = 0;\n\n for (let i = 0; i < respAreaLength; i++) {\n const result = reduce(\n allCorrectResponses,\n (obj, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n const isCorrect = answer && correctChoice && correctChoice === answer;\n\n obj.feedback[key] = getFeedback(isCorrect);\n\n if (isCorrect) {\n obj.correctResponses += 1;\n }\n\n return obj;\n },\n { correctResponses: 0, feedback: {} },\n );\n\n if (result.correctResponses >= correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n\n if (result.correctResponses === respAreaLength) {\n break;\n }\n }\n }\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n const shuffledValues = {};\n const keys = Object.keys(choices);\n\n const us = (part) => (id, element, update) => {\n return new Promise((resolve) => {\n shuffledValues[part] = update.shuffledValues;\n resolve();\n });\n };\n\n let i;\n\n for (i = 0; i < keys.length; i++) {\n const key = keys[i];\n const storedValues = session?.shuffledValues?.[key];\n\n choices[key] = await getShuffledChoices(\n choices[key],\n // the shuffledValues structure was updated to an object like { choice_key: [] }\n // and we need to override shuffledValues if it's not an array\n { shuffledValues: Array.isArray(storedValues) ? storedValues : [] },\n us(key),\n 'value',\n );\n }\n\n if (!isEmpty(shuffledValues)) {\n if (session && updateSession && typeof updateSession === 'function') {\n updateSession(session.id, session.element, {\n shuffledValues,\n }).catch((e) => {\n // eslint-disable-next-line no-console\n console.error('update session failed', e);\n });\n }\n }\n }\n\n let teacherInstructions = null;\n let rationale = null;\n\n const choicesWillNullRationales = (Object.keys(choices) || []).reduce((acc, currentValue) => {\n acc[currentValue] = (choices[currentValue] || []).map((choice) => ({\n ...choice,\n rationale: null,\n }));\n\n return acc;\n }, {});\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n\n choices = normalizedQuestion.choiceRationaleEnabled ? normalizedQuestion.choices : choicesWillNullRationales;\n } else {\n rationale = null;\n teacherInstructions = null;\n choices = choicesWillNullRationales;\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n displayType: normalizedQuestion.displayType,\n markup: normalizedQuestion.markup,\n choices,\n feedback,\n\n responseCorrect: env.mode === 'evaluate' ? getScore(normalizedQuestion, session) === 1 : undefined,\n rationale,\n teacherInstructions,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n return out;\n}\n\nexport const getScore = (config, session) => {\n const { value = {} } = session || {};\n const maxScore = config && config.choices ? Object.keys(config.choices).length : 0;\n const allCorrectResponses = getAllCorrectResponses(config);\n let correctCount = 0;\n\n for (let i = 0; i < maxScore; i++) {\n const result = reduce(\n allCorrectResponses,\n (total, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n\n if (correctChoice && answer && correctChoice === answer) {\n return total;\n }\n\n return total - 1;\n },\n maxScore,\n );\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = (correctCount / maxScore).toFixed(2);\n\n return parseFloat(str);\n};\n\n/**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (model, session, env) => {\n const traceLog = [];\n const { value = {} } = session || {};\n const allCorrectResponses = getAllCorrectResponses(model);\n const responseAreaKeys = Object.keys(allCorrectResponses);\n const totalAreas = responseAreaKeys.length;\n \n traceLog.push(`${totalAreas} dropdown response area(s) defined in this question.`);\n \n if (value && Object.keys(value).length > 0) {\n const selectedAreas = Object.entries(value).filter(([key, val]) => val && val.trim()).length;\n traceLog.push(`Student selected options in ${selectedAreas} out of ${totalAreas} dropdown(s).`);\n \n responseAreaKeys.forEach((areaKey) => {\n const studentSelection = (value && value[areaKey]) || '';\n const correctOptions = allCorrectResponses[areaKey] || [];\n \n if (studentSelection.trim()) {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: student selected '${studentSelection}' (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n } else {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: no selection made (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n }\n });\n } else {\n traceLog.push('Student did not make any selections in the dropdowns.');\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n traceLog.push(\n `Scoring method: ${\n partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring'\n }.`\n );\n\n const score = getScore(model, session);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\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 =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(model, session, env = {}) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['Student did not make any selections in the dropdowns. Score is 0.'] \n });\n } else {\n const traceLog = getLogTrace(model, session, env);\n const score = getScore(model, session);\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n resolve({\n score: partialScoringEnabled ? score : Math.floor(score),\n empty: false,\n traceLog\n });\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;\n const value = {};\n\n if (choices) {\n Object.keys(choices).forEach((key, i) => {\n const correctChoices = choices[key] && choices[key].filter((c) => c.correct);\n\n value[i] = correctChoices && correctChoices[0].value;\n });\n }\n\n resolve({\n id: '1',\n 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 { markup, choices } = model;\n const { maxResponseAreas, maxResponseAreaChoices } = config;\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n\n if (nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be defined at least 1 response area.';\n }\n\n (Object.keys(choices) || []).forEach((choiceKey) => {\n if (choices[choiceKey] && choices[choiceKey].length > maxResponseAreaChoices) {\n errors.responseAreaChoicesError = `No more than ${maxResponseAreaChoices} choices per response area should be defined.`;\n }\n });\n\n return errors;\n};\n"],"mappings":";;AACA,IAAI,IAAI,OAAO,gBAAgB,KAAK,GAAG,MAAM;CAC5C,IAAI,IAAI,CAAC;CACT,KAAK,IAAI,KAAK,GAAG,EAAE,GAAG,GAAG;EACxB,KAAK,EAAE;EACP,YAAY,CAAC;CACd,CAAC;CACD,OAAO,KAAK,EAAE,GAAG,OAAO,aAAa,EAA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AClD,AAAI,EAAQ,MAAc,EAAQ,GAAW,SAAS,MACpD,EAAO,2BAA2B,gBAAgB,EAAuB;CAE7E,CAAC,GAEM;AACT"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../shared/controller-utils/dist/index.js","../../../src/controller/defaults.ts","../../../src/controller/utils.ts","../../../src/controller/index.ts"],"sourcesContent":["//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" && Object.keys(e).length === 0;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : t.id && t.element && await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n[\"@pie-element\"]?.lockChoiceOrder || (n.role ?? \"student\") === \"instructor\");\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != \"boolean\" || n;\n}\n//#endregion\nexport { a as getShuffledChoices, o as lockChoices, s as partialScoring };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/inline-dropdown/controller/src/defaults.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nexport default {\n alternateResponse: {},\n choiceRationaleEnabled: true,\n choices: {},\n disabled: false,\n displayType: 'block',\n markup: '',\n mode: 'gather',\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n shuffle: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/inline-dropdown/controller/src/utils.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { forEach } from '@pie-element/shared-lodash';\n\nexport const getAllCorrectResponses = ({ choices, alternateResponse }) => {\n alternateResponse = alternateResponse || {};\n const correctAnswers = {};\n\n forEach(choices, (respArea, key) => {\n if (!correctAnswers[key]) {\n correctAnswers[key] = [];\n }\n\n if (respArea) {\n respArea.forEach((choice) => {\n if (choice.correct) {\n correctAnswers[key].push(choice.value);\n\n if (alternateResponse[key]) {\n correctAnswers[key] = [...correctAnswers[key], ...alternateResponse[key]];\n }\n }\n });\n }\n });\n\n return correctAnswers;\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/inline-dropdown/controller/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { isEmpty, map, reduce } from '@pie-element/shared-lodash';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-element/shared-controller-utils';\nimport defaults from './defaults.js';\n\nimport { getAllCorrectResponses } from './utils.js';\n\nconst getFeedback = (correct) => {\n if (correct) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\nexport const normalize = (question) => ({ ...defaults, ...question });\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 const { value = {} } = session || {};\n let choices = reduce(\n normalizedQuestion.choices,\n (obj, area, key) => {\n obj[key] = map(area, (choice) => choice);\n\n return obj;\n },\n {},\n );\n\n let feedback = {};\n\n if (env.mode === 'evaluate') {\n const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);\n const respAreaLength = Object.keys(allCorrectResponses).length;\n let correctResponses = 0;\n\n for (let i = 0; i < respAreaLength; i++) {\n const result = reduce(\n allCorrectResponses,\n (obj, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n const isCorrect = answer && correctChoice && correctChoice === answer;\n\n obj.feedback[key] = getFeedback(isCorrect);\n\n if (isCorrect) {\n obj.correctResponses += 1;\n }\n\n return obj;\n },\n { correctResponses: 0, feedback: {} },\n );\n\n if (result.correctResponses >= correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n\n if (result.correctResponses === respAreaLength) {\n break;\n }\n }\n }\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n const shuffledValues = {};\n const keys = Object.keys(choices);\n\n const us = (part) => (id, element, update) => {\n return new Promise((resolve) => {\n shuffledValues[part] = update.shuffledValues;\n resolve();\n });\n };\n\n let i;\n\n for (i = 0; i < keys.length; i++) {\n const key = keys[i];\n const storedValues = session?.shuffledValues?.[key];\n\n choices[key] = await getShuffledChoices(\n choices[key],\n // the shuffledValues structure was updated to an object like { choice_key: [] }\n // and we need to override shuffledValues if it's not an array\n { shuffledValues: Array.isArray(storedValues) ? storedValues : [] },\n us(key),\n 'value',\n );\n }\n\n if (!isEmpty(shuffledValues)) {\n if (session && updateSession && typeof updateSession === 'function') {\n updateSession(session.id, session.element, {\n shuffledValues,\n }).catch((e) => {\n // eslint-disable-next-line no-console\n console.error('update session failed', e);\n });\n }\n }\n }\n\n let teacherInstructions = null;\n let rationale = null;\n\n const choicesWillNullRationales = (Object.keys(choices) || []).reduce((acc, currentValue) => {\n acc[currentValue] = (choices[currentValue] || []).map((choice) => ({\n ...choice,\n rationale: null,\n }));\n\n return acc;\n }, {});\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n\n choices = normalizedQuestion.choiceRationaleEnabled ? normalizedQuestion.choices : choicesWillNullRationales;\n } else {\n rationale = null;\n teacherInstructions = null;\n choices = choicesWillNullRationales;\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n displayType: normalizedQuestion.displayType,\n markup: normalizedQuestion.markup,\n choices,\n feedback,\n\n responseCorrect: env.mode === 'evaluate' ? getScore(normalizedQuestion, session) === 1 : undefined,\n rationale,\n teacherInstructions,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n return out;\n}\n\nexport const getScore = (config, session) => {\n const { value = {} } = session || {};\n const maxScore = config && config.choices ? Object.keys(config.choices).length : 0;\n const allCorrectResponses = getAllCorrectResponses(config);\n let correctCount = 0;\n\n for (let i = 0; i < maxScore; i++) {\n const result = reduce(\n allCorrectResponses,\n (total, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n\n if (correctChoice && answer && correctChoice === answer) {\n return total;\n }\n\n return total - 1;\n },\n maxScore,\n );\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = (correctCount / maxScore).toFixed(2);\n\n return parseFloat(str);\n};\n\n/**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (model, session, env) => {\n const traceLog = [];\n const { value = {} } = session || {};\n const allCorrectResponses = getAllCorrectResponses(model);\n const responseAreaKeys = Object.keys(allCorrectResponses);\n const totalAreas = responseAreaKeys.length;\n \n traceLog.push(`${totalAreas} dropdown response area(s) defined in this question.`);\n \n if (value && Object.keys(value).length > 0) {\n const selectedAreas = Object.entries(value).filter(([key, val]) => val && val.trim()).length;\n traceLog.push(`Student selected options in ${selectedAreas} out of ${totalAreas} dropdown(s).`);\n \n responseAreaKeys.forEach((areaKey) => {\n const studentSelection = (value && value[areaKey]) || '';\n const correctOptions = allCorrectResponses[areaKey] || [];\n \n if (studentSelection.trim()) {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: student selected '${studentSelection}' (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n } else {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: no selection made (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n }\n });\n } else {\n traceLog.push('Student did not make any selections in the dropdowns.');\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n traceLog.push(\n `Scoring method: ${\n partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring'\n }.`\n );\n\n const score = getScore(model, session);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\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 =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(model, session, env = {}) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['Student did not make any selections in the dropdowns. Score is 0.'] \n });\n } else {\n const traceLog = getLogTrace(model, session, env);\n const score = getScore(model, session);\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n resolve({\n score: partialScoringEnabled ? score : Math.floor(score),\n empty: false,\n traceLog\n });\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;\n const value = {};\n\n if (choices) {\n Object.keys(choices).forEach((key, i) => {\n const correctChoices = choices[key] && choices[key].filter((c) => c.correct);\n\n value[i] = correctChoices && correctChoices[0].value;\n });\n }\n\n resolve({\n id: '1',\n 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 { markup, choices } = model;\n const { maxResponseAreas, maxResponseAreaChoices } = config;\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n\n if (nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be defined at least 1 response area.';\n }\n\n (Object.keys(choices) || []).forEach((choiceKey) => {\n if (choices[choiceKey] && choices[choiceKey].length > maxResponseAreaChoices) {\n errors.responseAreaChoicesError = `No more than ${maxResponseAreaChoices} choices per response area should be defined.`;\n }\n });\n\n return errors;\n};\n"],"mappings":";;AACA,IAAI,IAAI,OAAO,gBAAgB,KAAK,GAAG,MAAM;CAC5C,IAAI,IAAI,CAAC;CACT,KAAK,IAAI,KAAK,GAAG,EAAE,GAAG,GAAG;EACxB,KAAK,EAAE;EACP,YAAY,CAAC;CACd,CAAC;CACD,OAAO,KAAK,EAAE,GAAG,OAAO,aAAa,EAAE,OAAO,SAAS,CAAC,GAAG;AAC5D;AAGA,SAAS,EAAE,GAAG;CACb,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,QAAQ,MAAM,KAAK,IAAI,IAAI,CAAC;AACzD;AACA,SAAS,EAAE,GAAG;CACb,IAAI,IAAI,CAAC,GAAG,CAAC;CACb,KAAK,IAAI,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,KAAK;EACtC,IAAI,IAAI,KAAK,MAAM,KAAK,OAAO,KAAK,IAAI,EAAE;EAC1C,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE;CAC3B;CACA,OAAO;AACR;AACA,SAAS,EAAE,GAAG;CACb,OAAO,KAAK,OAAO,CAAC,IAAI,MAAM,QAAQ,CAAC,IAAI,EAAE,WAAW,IAAI,OAAO,KAAK,YAAY,OAAO,KAAK,CAAC,CAAC,CAAC,WAAW;AAC/G;AACA,eAAe,EAAE,GAAG,GAAG,GAAG,IAAI,SAAS;CACtC,IAAI,IAAI,EAAE,GAAG,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,CAAC;CAC5D,IAAI,CAAC,GAAG;EACP,QAAQ,KAAK,6DAA6D;EAC1E;CACD;CACA,IAAI,CAAC,EAAE,CAAC,GAAG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c,OAAU,KAAQ,GAAA,CAAI,QAAQ,sCAAsC,EAAE,GAE7E,KAAY,IAAQ,CAAC,GAAG,IAAS,CAAC,MAAM;CACnD,IAAM,EAAE,WAAQ,eAAY,GACtB,EAAE,qBAAkB,8BAA2B,GAC/C,IAAS,CAAC;CAEhB;EAAC;EAAuB;EAAU;CAAW,CAAC,CAAC,SAAS,MAAU;EAChE,AAAI,EAAO,EAAM,EAAE,YAAY,CAAC,EAAW,EAAM,EAAM,MACrD,EAAO,KAAS;CAEpB,CAAC;CAED,IAAM,MAAsB,KAAU,GAAA,CAAI,MAAM,gBAAgB,KAAK,CAAC,EAAA,CAAG;CAczE,OAZI,IAAoB,IACtB,EAAO,qBAAqB,gBAAgB,EAAiB,sCACpD,IAAoB,MAC7B,EAAO,qBAAqB,uDAG7B,OAAO,KAAK,CAAO,KAAK,CAAC,EAAA,CAAG,SAAS,MAAc;EAClD,AAAI,EAAQ,MAAc,EAAQ,EAAU,CAAC,SAAS,MACpD,EAAO,2BAA2B,gBAAgB,EAAuB;CAE7E,CAAC,GAEM;AACT"}
@@ -1,5 +1,6 @@
1
- import { Ft as e, L as t, Nt as n, Rt as r, S as i, a, d as o, f as s, ft as c, ht as l, i as u, j as d, k as f, m as p, n as m, o as h, p as g, pt as _, t as v, v as y, w as b } from "../Close-mCudNyrp.js";
2
- import { _ as x, o as S } from "../dist-Oyzav2lb.js";
1
+ import { i as e } from "../rolldown-runtime-CWhphoD1.js";
2
+ import { It as t, L as n, Lt as r, S as i, a, d as o, dt as s, f as c, i as l, j as u, k as d, m as f, n as p, o as m, p as h, pt as g, t as _, ut as v, v as y, w as b } from "../Close-_y0oVYUk.js";
3
+ import { _ as x, o as S } from "../dist-BJd6t-uW.js";
3
4
  import C, { useRef as w } from "react";
4
5
  import { createRoot as T } from "react-dom/client";
5
6
  import E from "react-dom";
@@ -34,7 +35,7 @@ var te = class e extends CustomEvent {
34
35
  }
35
36
  }), this.component = t, this.complete = n;
36
37
  }
37
- }, k = /* @__PURE__ */ r(n(), 1), re = "height ease-in 300ms, opacity ease-in 300ms", ie = l("div")(() => ({
38
+ }, k = /* @__PURE__ */ e(t(), 1), re = "height ease-in 300ms, opacity ease-in 300ms", ie = g("div")(() => ({
38
39
  position: "relative",
39
40
  height: 0,
40
41
  overflow: "hidden",
@@ -70,7 +71,7 @@ var te = class e extends CustomEvent {
70
71
  }
71
72
  })), ae = (e) => {
72
73
  let { show: t, children: n, className: r } = e, i = w(null);
73
- return /* @__PURE__ */ D(_, {
74
+ return /* @__PURE__ */ D(s, {
74
75
  nodeRef: i,
75
76
  in: t,
76
77
  appear: !0,
@@ -167,7 +168,7 @@ se.propTypes = {
167
168
  fgFill: k.default.string.isRequired,
168
169
  borderFill: k.default.string.isRequired
169
170
  };
170
- var ce = l("div")(({ size: e }) => ({
171
+ var ce = g("div")(({ size: e }) => ({
171
172
  width: e || "25px",
172
173
  height: e || "25px"
173
174
  })), A = ({ open: e, size: t }) => /* @__PURE__ */ D(ce, {
@@ -977,7 +978,7 @@ var je = {}, V = (e) => !j(e) && typeof e != "boolean" && typeof e != "number",
977
978
  init(e = {}) {
978
979
  e.interpolation ||= { escapeValue: !0 };
979
980
  let { escape: t, escapeValue: n, useRawValueToEscape: r, prefix: i, prefixEscaped: a, suffix: o, suffixEscaped: s, formatSeparator: c, unescapeSuffix: l, unescapePrefix: u, nestingPrefix: d, nestingPrefixEscaped: f, nestingSuffix: p, nestingSuffixEscaped: m, nestingOptionsSeparator: h, maxReplaces: g, alwaysFormat: _ } = e.interpolation;
980
- this.escape = t === void 0 ? xe : t, this.escapeValue = n === void 0 ? !0 : n, this.useRawValueToEscape = r === void 0 ? !1 : r, this.prefix = i ? F(i) : a || "{{", this.suffix = o ? F(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? F(d) : f || F("$t("), this.nestingSuffix = p ? F(p) : m || F(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ === void 0 ? !1 : _, this.resetRegExp();
981
+ this.escape = t === void 0 ? xe : t, this.escapeValue = n === void 0 || n, this.useRawValueToEscape = r !== void 0 && r, this.prefix = i ? F(i) : a || "{{", this.suffix = o ? F(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? F(d) : f || F("$t("), this.nestingSuffix = p ? F(p) : m || F(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ !== void 0 && _, this.resetRegExp();
981
982
  }
982
983
  reset() {
983
984
  this.options && this.init(this.options);
@@ -1616,29 +1617,29 @@ function G(e) {
1616
1617
  function $e(e, t) {
1617
1618
  return !e || G(e) ? e : G(e.default) ? e.default : t && G(e[t]) ? e[t] : t && G(e[t]?.default) ? e[t].default : e;
1618
1619
  }
1619
- var et = $e(g, "Readable") || $e(rt.Readable, "Readable"), tt = a, nt = tt.default, rt = nt && typeof nt == "object" ? nt : tt, { translator: K } = Qe, it = {
1620
+ var et = $e(h, "Readable") || $e(rt.Readable, "Readable"), tt = a, nt = tt.default, rt = nt && typeof nt == "object" ? nt : tt, { translator: K } = Qe, it = {
1620
1621
  WebkitTouchCallout: "none",
1621
1622
  WebkitUserSelect: "none",
1622
1623
  KhtmlUserSelect: "none",
1623
1624
  MozUserSelect: "none",
1624
1625
  msUserSelect: "none",
1625
1626
  userSelect: "none"
1626
- }, at = l("div")(() => ({
1627
+ }, at = g("div")(() => ({
1627
1628
  width: "100%",
1628
1629
  cursor: "pointer"
1629
- })), ot = l("div")(() => ({
1630
+ })), ot = g("div")(() => ({
1630
1631
  margin: "0 auto",
1631
1632
  textAlign: "center",
1632
1633
  display: "flex"
1633
- })), st = l("div")(() => ({
1634
+ })), st = g("div")(() => ({
1634
1635
  width: "fit-content",
1635
1636
  minWidth: "140px",
1636
1637
  alignSelf: "center",
1637
1638
  verticalAlign: "middle",
1638
- color: `var(--correct-answer-toggle-label-color, ${c.text()})`,
1639
+ color: `var(--correct-answer-toggle-label-color, ${v.text()})`,
1639
1640
  fontWeight: "normal",
1640
1641
  ...it
1641
- })), ct = l("div")(() => ({
1642
+ })), ct = g("div")(() => ({
1642
1643
  position: "absolute",
1643
1644
  width: "25px",
1644
1645
  "&.enter": { opacity: "0" },
@@ -1651,7 +1652,7 @@ var et = $e(g, "Readable") || $e(rt.Readable, "Readable"), tt = a, nt = tt.defau
1651
1652
  opacity: "0",
1652
1653
  transition: "opacity 0.3s ease-in"
1653
1654
  }
1654
- })), lt = l("div")(() => ({
1655
+ })), lt = g("div")(() => ({
1655
1656
  width: "25px",
1656
1657
  marginRight: "5px",
1657
1658
  display: "flex",
@@ -1701,7 +1702,7 @@ var et = $e(g, "Readable") || $e(rt.Readable, "Readable"), tt = a, nt = tt.defau
1701
1702
  children: /* @__PURE__ */ O(ot, {
1702
1703
  onClick: this.onClick.bind(this),
1703
1704
  onTouchEnd: this.onTouch.bind(this),
1704
- children: [/* @__PURE__ */ O(lt, { children: [/* @__PURE__ */ D(_, {
1705
+ children: [/* @__PURE__ */ O(lt, { children: [/* @__PURE__ */ D(s, {
1705
1706
  nodeRef: this.openIconRef,
1706
1707
  timeout: 400,
1707
1708
  in: t,
@@ -1716,7 +1717,7 @@ var et = $e(g, "Readable") || $e(rt.Readable, "Readable"), tt = a, nt = tt.defau
1716
1717
  ref: this.openIconRef,
1717
1718
  children: /* @__PURE__ */ D(A, { open: t }, "correct-open")
1718
1719
  })
1719
- }), /* @__PURE__ */ D(_, {
1720
+ }), /* @__PURE__ */ D(s, {
1720
1721
  nodeRef: this.closedIconRef,
1721
1722
  timeout: 5e3,
1722
1723
  in: !t,
@@ -1989,7 +1990,7 @@ var kt = /* @__PURE__ */ q(((e, t) => {
1989
1990
  kt();
1990
1991
  //#endregion
1991
1992
  //#region ../../lib-react/mask-markup/dist/serialization.js
1992
- var At = /* @__PURE__ */ r(d(), 1), jt = kt(), Mt = (0, At.default)("@pie-lib:mask-markup:serialization"), Nt = ["span"], Pt = [
1993
+ var At = /* @__PURE__ */ e(u(), 1), jt = kt(), Mt = (0, At.default)("@pie-lib:mask-markup:serialization"), Nt = ["span"], Pt = [
1993
1994
  "em",
1994
1995
  "strong",
1995
1996
  "u"
@@ -2115,10 +2116,10 @@ var At = /* @__PURE__ */ r(d(), 1), jt = kt(), Mt = (0, At.default)("@pie-lib:ma
2115
2116
  nodes: t
2116
2117
  }
2117
2118
  };
2118
- }, Xt = l("div")(({ theme: e }) => ({
2119
+ }, Xt = g("div")(({ theme: e }) => ({
2119
2120
  paddingTop: e.spacing(.5),
2120
2121
  paddingBottom: e.spacing(.5)
2121
- })), Zt = l("span")(() => ({
2122
+ })), Zt = g("span")(() => ({
2122
2123
  display: "inline-block",
2123
2124
  width: ".75em"
2124
2125
  })), Qt = ["tbody", "tr"], $t = (e, t) => {
@@ -2126,7 +2127,7 @@ var At = /* @__PURE__ */ r(d(), 1), jt = kt(), Mt = (0, At.default)("@pie-lib:ma
2126
2127
  if (!(n && Qt.includes(r))) return t;
2127
2128
  }, en = (e) => {
2128
2129
  let t = e.leaves.find((e) => x(e, "marks", []).length);
2129
- return t ? t.marks[0] : null;
2130
+ return t ? t.marks : null;
2130
2131
  }, tn = (e, t, n, r, i, a) => {
2131
2132
  if (!t) return null;
2132
2133
  let o = [];
@@ -2146,13 +2147,9 @@ var At = /* @__PURE__ */ r(d(), 1), jt = kt(), Mt = (0, At.default)("@pie-lib:ma
2146
2147
  let n = t.text, r = $t(i, n);
2147
2148
  return r ? e + r : e;
2148
2149
  }, ""), n = en(e);
2149
- if (n) {
2150
- let e;
2151
- for (e in Kt) if (Kt[e] === n.type) {
2152
- let n = e;
2153
- o.push(/* @__PURE__ */ D(n, { children: t }, c));
2154
- break;
2155
- }
2150
+ if (n?.length > 0) {
2151
+ let e = n.map((e) => Object.keys(Kt).find((t) => Kt[t] === e.type)).filter(Boolean);
2152
+ e.length > 0 ? o.push(e.reduceRight((e, t, n) => /* @__PURE__ */ D(t, { children: e }, `${c}-${t}-${n}`), t)) : o.push(t);
2156
2153
  } else t.length > 0 && o.push(t);
2157
2154
  } else {
2158
2155
  let i = tn(e, t, n, r, e, a);
@@ -2166,7 +2163,7 @@ var At = /* @__PURE__ */ r(d(), 1), jt = kt(), Mt = (0, At.default)("@pie-lib:ma
2166
2163
  }
2167
2164
  }
2168
2165
  }), o;
2169
- }, nn = l("div")(() => ({
2166
+ }, nn = g("div")(() => ({
2170
2167
  display: "initial",
2171
2168
  "&:not(.MathJax) table": { borderCollapse: "collapse" },
2172
2169
  "&:not(.MathJax) table td, &:not(.MathJax) table th": {
@@ -2186,8 +2183,8 @@ var At = /* @__PURE__ */ r(d(), 1), jt = kt(), Mt = (0, At.default)("@pie-lib:ma
2186
2183
  containerRef: k.default.oneOfType([k.default.func, k.default.shape({ current: k.default.instanceOf(Element) })])
2187
2184
  };
2188
2185
  componentDidMount() {
2189
- let t = this.props.containerRef || this.internalContainerRef;
2190
- t.current && typeof e == "function" && e(t.current);
2186
+ let e = this.props.containerRef || this.internalContainerRef;
2187
+ e.current && typeof r == "function" && r(e.current);
2191
2188
  }
2192
2189
  handleChange = (e, t) => {
2193
2190
  let n = {
@@ -2238,7 +2235,7 @@ var At = /* @__PURE__ */ r(d(), 1), jt = kt(), Mt = (0, At.default)("@pie-lib:ma
2238
2235
  renderChildren: t(this.props)
2239
2236
  });
2240
2237
  }
2241
- }, sn = t(/*#__PURE__*/ D("path", { d: "m7 10 5 5 5-5z" }), "ArrowDropDown"), cn = t(/*#__PURE__*/ D("path", { d: "m7 14 5-5 5 5z" }), "ArrowDropUp");
2238
+ }, sn = n(/*#__PURE__*/ D("path", { d: "m7 10 5 5 5-5z" }), "ArrowDropDown"), cn = n(/*#__PURE__*/ D("path", { d: "m7 14 5-5 5 5z" }), "ArrowDropUp");
2242
2239
  //#endregion
2243
2240
  //#region ../../lib-react/mask-markup/dist/components/dropdown.js
2244
2241
  function J(e) {
@@ -2247,12 +2244,12 @@ function J(e) {
2247
2244
  function ln(e, t) {
2248
2245
  return !e || J(e) ? e : J(e.default) ? e.default : t && J(e[t]) ? e[t] : t && J(e[t]?.default) ? e[t].default : e;
2249
2246
  }
2250
- var un = ln(h, "InlineMenu") || ln(fn.InlineMenu, "InlineMenu"), dn = a, Y = dn.default, fn = Y && typeof Y == "object" ? Y : dn, pn = l(b)(() => ({
2251
- color: c.text(),
2252
- border: `1px solid ${c.borderGray()}`,
2247
+ var un = ln(m, "InlineMenu") || ln(fn.InlineMenu, "InlineMenu"), dn = a, Y = dn.default, fn = Y && typeof Y == "object" ? Y : dn, pn = g(b)(() => ({
2248
+ color: v.text(),
2249
+ border: `1px solid ${v.borderGray()}`,
2253
2250
  borderRadius: "4px",
2254
2251
  justifyContent: "space-between",
2255
- backgroundColor: c.background(),
2252
+ backgroundColor: v.background(),
2256
2253
  position: "relative",
2257
2254
  height: "45px",
2258
2255
  width: "fit-content",
@@ -2264,37 +2261,28 @@ var un = ln(h, "InlineMenu") || ln(fn.InlineMenu, "InlineMenu"), dn = a, Y = dn.
2264
2261
  right: "4px",
2265
2262
  top: "calc(50% - 12px)",
2266
2263
  pointerEvents: "none",
2267
- color: c.text(),
2264
+ color: v.text(),
2268
2265
  marginLeft: "5px"
2269
2266
  },
2270
2267
  "&.Mui-focused": {
2271
- outline: `3px solid ${c.tertiary()}`,
2268
+ outline: `3px solid ${v.tertiary()}`,
2272
2269
  outlineOffset: "2px",
2273
2270
  borderWidth: "3px"
2274
2271
  },
2275
2272
  "&.disabledCorrect": {
2276
2273
  borderWidth: "2px",
2277
- borderColor: c.correct(),
2278
- color: `${c.text()} !important`
2274
+ borderColor: v.correct(),
2275
+ color: `${v.text()} !important`
2279
2276
  },
2280
2277
  "&.disabledIncorrect": {
2281
2278
  borderWidth: "2px",
2282
- borderColor: c.incorrectWithIcon(),
2283
- color: `${c.text()} !important`
2279
+ borderColor: v.incorrectWithIcon(),
2280
+ color: `${v.text()} !important`
2284
2281
  }
2285
- })), mn = l(un)(() => ({
2286
- backgroundColor: c.background(),
2287
- border: `1px solid ${c.correct()} !important`,
2288
- "&:hover": {
2289
- border: `1px solid ${c.text()} `,
2290
- borderColor: "initial"
2291
- },
2292
- "&:focus": {
2293
- border: `1px solid ${c.text()}`,
2294
- borderColor: "initial"
2295
- },
2282
+ })), mn = g(un)(() => ({
2283
+ "& .MuiPaper-root": { backgroundColor: v.background() },
2296
2284
  "& .MuiList-root": { padding: 0 }
2297
- })), hn = l(m)(() => ({
2285
+ })), hn = g(p)(() => ({
2298
2286
  height: 24,
2299
2287
  overflow: "hidden",
2300
2288
  fontSize: "1rem",
@@ -2302,42 +2290,42 @@ var un = ln(h, "InlineMenu") || ln(fn.InlineMenu, "InlineMenu"), dn = a, Y = dn.
2302
2290
  fontFamily: "inherit",
2303
2291
  lineHeight: "1.5em",
2304
2292
  whiteSpace: "nowrap",
2305
- color: c.text(),
2306
- backgroundColor: c.background(),
2293
+ color: v.text(),
2294
+ backgroundColor: v.background(),
2307
2295
  "&.Mui-focusVisible": {
2308
- outline: `3px solid ${c.tertiary()}`,
2296
+ outline: `3px solid ${v.tertiary()}`,
2309
2297
  outlineOffset: "-1px",
2310
- color: c.text(),
2311
- backgroundColor: c.background()
2298
+ color: v.text(),
2299
+ backgroundColor: v.background()
2312
2300
  },
2313
2301
  "&:hover": {
2314
- color: c.text(),
2315
- backgroundColor: c.dropdownBackground()
2302
+ color: v.text(),
2303
+ backgroundColor: v.dropdownBackground()
2316
2304
  },
2317
2305
  boxSizing: "border-box",
2318
2306
  padding: "16px 8px",
2319
2307
  borderRadius: "4px",
2320
2308
  "&.selected": {
2321
- color: `${c.text()} !important`,
2322
- backgroundColor: `${c.background()} !important`,
2309
+ color: `${v.text()} !important`,
2310
+ backgroundColor: `${v.background()} !important`,
2323
2311
  "&:hover": {
2324
- color: c.text(),
2325
- backgroundColor: `${c.dropdownBackground()} !important`
2312
+ color: v.text(),
2313
+ backgroundColor: `${v.dropdownBackground()} !important`
2326
2314
  }
2327
2315
  }
2328
- })), gn = l("span")(() => ({ fontSize: "max(1rem, 14px)" })), _n = l("span")(() => ({
2316
+ })), gn = g("span")(() => ({ fontSize: "max(1rem, 14px)" })), _n = g("span")(() => ({
2329
2317
  fontSize: "max(1rem, 14px)",
2330
2318
  flexShrink: 0,
2331
2319
  paddingLeft: "8px"
2332
- })), vn = l(y)(() => ({
2320
+ })), vn = g(y)(() => ({
2333
2321
  position: "absolute",
2334
2322
  left: "-10000px",
2335
2323
  top: "auto",
2336
2324
  width: "1px",
2337
2325
  height: "1px",
2338
2326
  overflow: "hidden"
2339
- })), yn = l(u)(() => ({
2340
- color: `${c.white()} !important`,
2327
+ })), yn = g(l)(() => ({
2328
+ color: `${v.white()} !important`,
2341
2329
  position: "absolute",
2342
2330
  top: "-8px !important",
2343
2331
  left: "-8px",
@@ -2345,10 +2333,10 @@ var un = ln(h, "InlineMenu") || ln(fn.InlineMenu, "InlineMenu"), dn = a, Y = dn.
2345
2333
  borderRadius: "50%",
2346
2334
  fontSize: "16px",
2347
2335
  padding: "2px",
2348
- "&.correct": { backgroundColor: c.correct() },
2349
- "&.incorrect": { backgroundColor: c.incorrectWithIcon() }
2350
- })), bn = l(v)(() => ({
2351
- color: `${c.white()} !important`,
2336
+ "&.correct": { backgroundColor: v.correct() },
2337
+ "&.incorrect": { backgroundColor: v.incorrectWithIcon() }
2338
+ })), bn = g(_)(() => ({
2339
+ color: `${v.white()} !important`,
2352
2340
  position: "absolute",
2353
2341
  top: "-8px !important",
2354
2342
  left: "-8px",
@@ -2356,8 +2344,8 @@ var un = ln(h, "InlineMenu") || ln(fn.InlineMenu, "InlineMenu"), dn = a, Y = dn.
2356
2344
  borderRadius: "50%",
2357
2345
  fontSize: "16px",
2358
2346
  padding: "2px",
2359
- "&.correct": { backgroundColor: c.correct() },
2360
- "&.incorrect": { backgroundColor: c.incorrectWithIcon() }
2347
+ "&.correct": { backgroundColor: v.correct() },
2348
+ "&.incorrect": { backgroundColor: v.incorrectWithIcon() }
2361
2349
  })), xn = class extends C.Component {
2362
2350
  static propTypes = {
2363
2351
  id: k.default.string,
@@ -2384,17 +2372,17 @@ var un = ln(h, "InlineMenu") || ln(fn.InlineMenu, "InlineMenu"), dn = a, Y = dn.
2384
2372
  componentDidMount() {
2385
2373
  this.hiddenRef.current && this.state.menuWidth === null && this.setState({ menuWidth: this.hiddenRef.current.clientWidth });
2386
2374
  }
2387
- componentDidUpdate(t, n) {
2388
- let r = this.hiddenRef.current;
2389
- if (!n.anchorEl && this.state.anchorEl && this.elementRefs.forEach((t) => {
2390
- if (!t) return;
2391
- let n = t.querySelector("[data-latex], [data-raw]"), r = t.querySelector("mjx-container"), i = t.querySelector("[data-math-handled=\"true\"]");
2392
- n && (!i || !r) && e(t);
2393
- }), r) {
2394
- let t = r.clientWidth;
2395
- t !== this.state.menuWidth && (this.elementRefs.forEach((t) => {
2396
- t && e(t);
2397
- }), e(r), this.setState({ menuWidth: t }));
2375
+ componentDidUpdate(e, t) {
2376
+ let n = this.hiddenRef.current;
2377
+ if (!t.anchorEl && this.state.anchorEl && this.elementRefs.forEach((e) => {
2378
+ if (!e) return;
2379
+ let t = e.querySelector("[data-latex], [data-raw]"), n = e.querySelector("mjx-container"), i = e.querySelector("[data-math-handled=\"true\"]");
2380
+ t && (!i || !n) && r(e);
2381
+ }), n) {
2382
+ let e = n.clientWidth;
2383
+ e !== this.state.menuWidth && (this.elementRefs.forEach((e) => {
2384
+ e && r(e);
2385
+ }), r(n), this.setState({ menuWidth: e }));
2398
2386
  }
2399
2387
  }
2400
2388
  handleClick = (e) => {
@@ -2568,16 +2556,16 @@ function X(e) {
2568
2556
  function Z(e, t) {
2569
2557
  return !e || X(e) ? e : X(e.default) ? e.default : t && X(e[t]) ? e[t] : t && X(e[t]?.default) ? e[t].default : e;
2570
2558
  }
2571
- var Cn = Z(i, "UiLayout") || Z($.UiLayout, "UiLayout"), Q = Z(p, "PreviewPrompt") || Z($.PreviewPrompt, "PreviewPrompt"), wn = Z(f, "Collapsible") || Z($.Collapsible, "Collapsible"), Tn = a, En = Tn.default, $ = En && typeof En == "object" ? En : Tn, Dn = l(Cn)({
2572
- color: c.text(),
2573
- backgroundColor: c.background()
2574
- }), On = l(wn)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), kn = l("div")(({ theme: e }) => ({ "&:not(:last-child)": { marginBottom: e.spacing(2) } })), An = l("div")({
2559
+ var Cn = Z(i, "UiLayout") || Z($.UiLayout, "UiLayout"), Q = Z(f, "PreviewPrompt") || Z($.PreviewPrompt, "PreviewPrompt"), wn = Z(d, "Collapsible") || Z($.Collapsible, "Collapsible"), Tn = a, En = Tn.default, $ = En && typeof En == "object" ? En : Tn, Dn = g(Cn)({
2560
+ color: v.text(),
2561
+ backgroundColor: v.background()
2562
+ }), On = g(wn)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), kn = g("div")(({ theme: e }) => ({ "&:not(:last-child)": { marginBottom: e.spacing(2) } })), An = g("div")({
2575
2563
  display: "flex",
2576
2564
  whiteSpace: "break-spaces"
2577
- }), jn = l("div")(({ correct: e }) => ({
2565
+ }), jn = g("div")(({ correct: e }) => ({
2578
2566
  display: "flex",
2579
- ...e ? { color: c.correct() } : { color: c.incorrectWithIcon() }
2580
- })), Mn = l("h2")({
2567
+ ...e ? { color: v.correct() } : { color: v.incorrectWithIcon() }
2568
+ })), Mn = g("h2")({
2581
2569
  position: "absolute",
2582
2570
  left: "-10000px",
2583
2571
  top: "auto",
@@ -2606,13 +2594,13 @@ var Cn = Z(i, "UiLayout") || Z($.UiLayout, "UiLayout"), Q = Z(p, "PreviewPrompt"
2606
2594
  S(e.feedback) && this.setState({ showCorrectAnswer: !1 });
2607
2595
  }
2608
2596
  componentDidUpdate() {
2609
- e(E.findDOMNode(this));
2597
+ r(E.findDOMNode(this));
2610
2598
  }
2611
2599
  toggleShowCorrect = () => {
2612
2600
  this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });
2613
2601
  };
2614
2602
  render() {
2615
- let { showCorrectAnswer: e } = this.state, { prompt: t, mode: n, model: r, rationale: i, teacherInstructions: a, choices: c, displayType: l, language: u } = this.props, { extraCSSRules: d } = r || {}, f = n === "evaluate", p = !1, m = i && (s(i) || o(i)), h = a && (s(a) || o(a)), g = (Object.keys(c) || []).map((e) => (c[e] || []).reduce((e, t) => (t.rationale && s(t.rationale) && (p = !0, e.push(t)), e), []));
2603
+ let { showCorrectAnswer: e } = this.state, { prompt: t, mode: n, model: r, rationale: i, teacherInstructions: a, choices: s, displayType: l, language: u } = this.props, { extraCSSRules: d } = r || {}, f = n === "evaluate", p = !1, m = i && (c(i) || o(i)), h = a && (c(a) || o(a)), g = (Object.keys(s) || []).map((e) => (s[e] || []).reduce((e, t) => (t.rationale && c(t.rationale) && (p = !0, e.push(t)), e), []));
2616
2604
  return /* @__PURE__ */ O(Dn, {
2617
2605
  extraCSSRules: d,
2618
2606
  style: { display: `${l}` },
@@ -2675,7 +2663,7 @@ var Cn = Z(i, "UiLayout") || Z($.UiLayout, "UiLayout"), Q = Z(p, "PreviewPrompt"
2675
2663
  }
2676
2664
  _render = () => {
2677
2665
  if (this._model && this._session) {
2678
- let t = C.createElement(Nn, {
2666
+ let e = C.createElement(Nn, {
2679
2667
  model: this._model,
2680
2668
  prompt: this._model.prompt,
2681
2669
  rationale: this._model.rationale,
@@ -2690,8 +2678,8 @@ var Cn = Z(i, "UiLayout") || Z($.UiLayout, "UiLayout"), Q = Z(p, "PreviewPrompt"
2690
2678
  language: this._model.language,
2691
2679
  onChange: this.changeSession
2692
2680
  });
2693
- this.setLangAttribute(), this._root ||= T(this), this._root.render(t), queueMicrotask(() => {
2694
- e(this);
2681
+ this.setLangAttribute(), this._root ||= T(this), this._root.render(e), queueMicrotask(() => {
2682
+ r(this);
2695
2683
  });
2696
2684
  }
2697
2685
  };
@@ -2705,7 +2693,7 @@ var Cn = Z(i, "UiLayout") || Z($.UiLayout, "UiLayout"), Q = Z(p, "PreviewPrompt"
2705
2693
  this.setAttribute("aria-label", "Inline Dropdown Question"), this.setAttribute("role", "region"), this._render();
2706
2694
  }
2707
2695
  disconnectedCallback() {
2708
- this._root && this._root.unmount();
2696
+ this._root &&= (this._root.unmount(), null);
2709
2697
  }
2710
2698
  };
2711
2699
  //#endregion