@khanacademy/perseus-core 20.1.0 → 20.1.2
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/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/error-codes.ts","../../src/utils/get-matrix-size.ts","../../src/utils/get-decimal-separator.ts","../../src/utils/get-divide-symbol.ts","../../src/utils/equality.ts","../../src/utils/widget-id-utils.ts","../../src/utils/deep-clone.ts","../../src/utils/grapher-util.ts","../../src/utils/test-utils.ts","../../src/utils/item-has-rationales.ts","../../src/utils/item-has-hints.ts","../../src/utils/is-real-json-parse.ts","../../src/parse-perseus-json/result.ts","../../src/parse-perseus-json/error-tracking-parse-context.ts","../../src/parse-perseus-json/object-path.ts","../../src/parse-perseus-json/parse-failure-detail.ts","../../src/parse-perseus-json/parse.ts","../../src/parse-perseus-json/general-purpose-parsers/any.ts","../../src/parse-perseus-json/general-purpose-parsers/array.ts","../../src/parse-perseus-json/general-purpose-parsers/boolean.ts","../../src/parse-perseus-json/general-purpose-parsers/constant.ts","../../src/parse-perseus-json/general-purpose-parsers/defaulted.ts","../../src/parse-perseus-json/general-purpose-parsers/enumeration.ts","../../src/parse-perseus-json/general-purpose-parsers/is-plain-object.ts","../../src/parse-perseus-json/general-purpose-parsers/nullable.ts","../../src/parse-perseus-json/general-purpose-parsers/number.ts","../../src/parse-perseus-json/general-purpose-parsers/object.ts","../../src/parse-perseus-json/general-purpose-parsers/optional.ts","../../src/parse-perseus-json/general-purpose-parsers/pair.ts","../../src/parse-perseus-json/general-purpose-parsers/pipe-parsers.ts","../../src/parse-perseus-json/general-purpose-parsers/record.ts","../../src/parse-perseus-json/general-purpose-parsers/string.ts","../../src/parse-perseus-json/general-purpose-parsers/trio.ts","../../src/parse-perseus-json/general-purpose-parsers/union.ts","../../src/parse-perseus-json/perseus-parsers/perseus-image-detail.ts","../../src/parse-perseus-json/perseus-parsers/images-map.ts","../../src/parse-perseus-json/perseus-parsers/widget.ts","../../src/parse-perseus-json/perseus-parsers/categorizer-widget.ts","../../src/parse-perseus-json/perseus-parsers/cs-program-widget.ts","../../src/parse-perseus-json/perseus-parsers/definition-widget.ts","../../src/parse-perseus-json/perseus-parsers/dropdown-widget.ts","../../src/parse-perseus-json/perseus-parsers/explanation-widget.ts","../../src/keypad.ts","../../src/widgets/expression/derive-extra-keys.ts","../../src/parse-perseus-json/general-purpose-parsers/convert.ts","../../src/parse-perseus-json/perseus-parsers/legacy-button-sets.ts","../../src/parse-perseus-json/perseus-parsers/versioned-widget-options.ts","../../src/parse-perseus-json/perseus-parsers/expression-widget.ts","../../src/parse-perseus-json/perseus-parsers/free-response-widget.ts","../../src/parse-perseus-json/perseus-parsers/graded-group-widget.ts","../../src/parse-perseus-json/perseus-parsers/graded-group-set-widget.ts","../../src/parse-perseus-json/general-purpose-parsers/discriminated-union.ts","../../src/parse-perseus-json/perseus-parsers/grapher-widget.ts","../../src/parse-perseus-json/perseus-parsers/group-widget.ts","../../src/parse-perseus-json/perseus-parsers/iframe-widget.ts","../../src/parse-perseus-json/general-purpose-parsers/string-to-number.ts","../../src/parse-perseus-json/perseus-parsers/perseus-image-background.ts","../../src/parse-perseus-json/perseus-parsers/image-widget.ts","../../src/parse-perseus-json/perseus-parsers/input-number-widget.ts","../../src/parse-perseus-json/perseus-parsers/interaction-widget.ts","../../src/data-schema.ts","../../src/parse-perseus-json/perseus-parsers/interactive-graph-widget.ts","../../src/parse-perseus-json/perseus-parsers/label-image-widget.ts","../../src/parse-perseus-json/perseus-parsers/matcher-widget.ts","../../src/parse-perseus-json/perseus-parsers/matrix-widget.ts","../../src/parse-perseus-json/perseus-parsers/measurer-widget.ts","../../src/parse-perseus-json/perseus-parsers/molecule-renderer-widget.ts","../../src/parse-perseus-json/perseus-parsers/number-line-widget.ts","../../src/parse-perseus-json/perseus-parsers/numeric-input-widget.ts","../../src/parse-perseus-json/perseus-parsers/orderer-widget.ts","../../src/parse-perseus-json/perseus-parsers/passage-ref-widget.ts","../../src/parse-perseus-json/perseus-parsers/passage-widget.ts","../../src/parse-perseus-json/perseus-parsers/phet-simulation-widget.ts","../../src/parse-perseus-json/perseus-parsers/plotter-widget.ts","../../src/parse-perseus-json/perseus-parsers/python-program-widget.ts","../../src/widgets/radio/derive-num-correct.ts","../../src/parse-perseus-json/perseus-parsers/radio-widget.ts","../../src/parse-perseus-json/perseus-parsers/sorter-widget.ts","../../src/parse-perseus-json/perseus-parsers/table-widget.ts","../../src/parse-perseus-json/perseus-parsers/video-widget.ts","../../src/parse-perseus-json/perseus-parsers/widget-id-components.ts","../../src/parse-perseus-json/perseus-parsers/widgets-map.ts","../../src/parse-perseus-json/perseus-parsers/perseus-renderer.ts","../../src/parse-perseus-json/perseus-parsers/perseus-article.ts","../../src/parse-perseus-json/perseus-parsers/hint.ts","../../src/parse-perseus-json/perseus-parsers/perseus-answer-area.ts","../../src/parse-perseus-json/perseus-parsers/perseus-item.ts","../../src/parse-perseus-json/perseus-parsers/categorizer-user-input.ts","../../src/parse-perseus-json/perseus-parsers/cs-program-user-input.ts","../../src/parse-perseus-json/perseus-parsers/dropdown-user-input.ts","../../src/parse-perseus-json/perseus-parsers/expression-user-input.ts","../../src/parse-perseus-json/perseus-parsers/free-response-user-input.ts","../../src/parse-perseus-json/perseus-parsers/grapher-user-input.ts","../../src/parse-perseus-json/perseus-parsers/group-user-input.ts","../../src/parse-perseus-json/perseus-parsers/iframe-user-input.ts","../../src/parse-perseus-json/perseus-parsers/input-number-user-input.ts","../../src/parse-perseus-json/perseus-parsers/interactive-graph-user-input.ts","../../src/parse-perseus-json/perseus-parsers/label-image-user-input.ts","../../src/parse-perseus-json/perseus-parsers/matcher-user-input.ts","../../src/parse-perseus-json/perseus-parsers/matrix-user-input.ts","../../src/parse-perseus-json/perseus-parsers/number-line-user-input.ts","../../src/parse-perseus-json/perseus-parsers/numeric-input-user-input.ts","../../src/parse-perseus-json/perseus-parsers/orderer-user-input.ts","../../src/parse-perseus-json/perseus-parsers/plotter-user-input.ts","../../src/parse-perseus-json/perseus-parsers/radio-user-input.ts","../../src/parse-perseus-json/perseus-parsers/sorter-user-input.ts","../../src/parse-perseus-json/perseus-parsers/table-user-input.ts","../../src/parse-perseus-json/perseus-parsers/user-input-map.ts","../../src/parse-perseus-json/index.ts","../../src/version.ts","../../src/error/errors.ts","../../src/error/perseus-error.ts","../../src/utils/objective_.ts","../../src/widgets/categorizer/categorizer-util.ts","../../src/widgets/categorizer/index.ts","../../src/widgets/cs-program/cs-program-util.ts","../../src/widgets/cs-program/index.ts","../../src/widgets/definition/index.ts","../../src/widgets/dropdown/dropdown-util.ts","../../src/widgets/dropdown/index.ts","../../src/widgets/explanation/index.ts","../../src/widgets/expression/expression-util.ts","../../src/widgets/expression/index.ts","../../src/widgets/graded-group/index.ts","../../src/widgets/free-response/free-response-util.ts","../../src/widgets/free-response/index.ts","../../src/widgets/graded-group-set/index.ts","../../src/widgets/grapher/grapher-util.ts","../../src/widgets/grapher/index.ts","../../src/utils/registry.ts","../../src/widgets/deprecated-standin/index.ts","../../src/widgets/iframe/iframe-util.ts","../../src/widgets/iframe/index.ts","../../src/widgets/image/index.ts","../../src/widgets/input-number/input-number-util.ts","../../src/widgets/input-number/index.ts","../../src/widgets/interaction/index.ts","../../src/utils/util.graphie.ts","../../src/widgets/interactive-graph/interactive-graph-util.ts","../../src/widgets/interactive-graph/index.ts","../../src/widgets/label-image/label-image-util.ts","../../src/widgets/label-image/index.ts","../../src/utils/random-util.ts","../../src/widgets/matcher/matcher-util.ts","../../src/widgets/matcher/index.ts","../../src/widgets/matrix/matrix-util.ts","../../src/widgets/matrix/index.ts","../../src/widgets/measurer/index.ts","../../src/widgets/number-line/number-line-util.ts","../../src/widgets/number-line/index.ts","../../src/widgets/numeric-input/numeric-input-util.ts","../../src/widgets/numeric-input/index.ts","../../src/widgets/orderer/orderer-util.ts","../../src/widgets/orderer/index.ts","../../src/widgets/passage/index.ts","../../src/widgets/passage-ref/passage-ref-upgrade.ts","../../src/widgets/passage-ref/index.ts","../../src/widgets/passage-ref-target/index.ts","../../src/widgets/phet-simulation/index.ts","../../src/widgets/plotter/plotter-util.ts","../../src/widgets/plotter/index.ts","../../src/widgets/python-program/index.ts","../../src/widgets/radio/radio-util.ts","../../src/widgets/radio/index.ts","../../src/widgets/sorter/sorter-util.ts","../../src/widgets/sorter/index.ts","../../src/widgets/table/table-util.ts","../../src/widgets/table/index.ts","../../src/widgets/video/index.ts","../../src/widgets/core-widget-registry.ts","../../src/widgets/apply-defaults.ts","../../src/utils/split-perseus-renderer.ts","../../src/widgets/group/group-util.ts","../../src/widgets/group/index.ts","../../src/utils/get-default-answer-area.ts","../../src/utils/split-perseus-item.ts","../../src/feature-flags.ts","../../src/traversal.ts","../../src/accessibility.ts","../../src/utils/generators/image-widget-generator.ts","../../src/index.ts"],"sourcesContent":["const APPROXIMATED_PI_ERROR = \"APPROXIMATED_PI_ERROR\";\nconst CHOOSE_CORRECT_NUM_ERROR = \"CHOOSE_CORRECT_NUM_ERROR\";\nconst EXTRA_SYMBOLS_ERROR = \"EXTRA_SYMBOLS_ERROR\";\nconst FILL_ALL_CELLS_ERROR = \"FILL_ALL_CELLS_ERROR\";\nconst INVALID_CHOICE_SELECTION = \"INVALID_CHOICE_SELECTION\";\nconst INVALID_SELECTION_ERROR = \"INVALID_SELECTION_ERROR\";\nconst MISSING_PERCENT_ERROR = \"MISSING_PERCENT_ERROR\";\nconst MULTIPLICATION_SIGN_ERROR = \"MULTIPLICATION_SIGN_ERROR\";\nconst NEEDS_TO_BE_SIMPLIFIED_ERROR = \"NEEDS_TO_BE_SIMPLIFIED_ERROR\";\nconst NOT_NONE_ABOVE_ERROR = \"NOT_NONE_ABOVE_ERROR\";\nconst USER_INPUT_EMPTY = \"USER_INPUT_EMPTY\";\nconst USER_INPUT_TOO_LONG = \"USER_INPUT_TOO_LONG\";\nconst WRONG_CASE_ERROR = \"WRONG_CASE_ERROR\";\nconst WRONG_LETTER_ERROR = \"WRONG_LETTER_ERROR\";\n\nconst ErrorCodes = {\n APPROXIMATED_PI_ERROR,\n CHOOSE_CORRECT_NUM_ERROR,\n EXTRA_SYMBOLS_ERROR,\n FILL_ALL_CELLS_ERROR,\n INVALID_CHOICE_SELECTION,\n INVALID_SELECTION_ERROR,\n MISSING_PERCENT_ERROR,\n MULTIPLICATION_SIGN_ERROR,\n NEEDS_TO_BE_SIMPLIFIED_ERROR,\n NOT_NONE_ABOVE_ERROR,\n USER_INPUT_EMPTY,\n USER_INPUT_TOO_LONG,\n WRONG_CASE_ERROR,\n WRONG_LETTER_ERROR,\n};\n\nexport type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];\n\nexport default ErrorCodes;\n","function getMatrixSize(\n matrix:\n | ReadonlyArray<ReadonlyArray<number>>\n | ReadonlyArray<ReadonlyArray<string>>,\n) {\n const matrixSize = [1, 1];\n\n // We need to find the widest row and tallest column to get the correct\n // matrix size.\n matrix.forEach((matrixRow, row) => {\n let rowWidth = 0;\n matrixRow.forEach((matrixCol, col) => {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (matrixCol != null && matrixCol.toString().length) {\n rowWidth = col + 1;\n }\n });\n\n // Matrix width:\n matrixSize[1] = Math.max(matrixSize[1], rowWidth);\n\n // Matrix height:\n if (rowWidth > 0) {\n matrixSize[0] = Math.max(matrixSize[0], row + 1);\n }\n });\n return matrixSize;\n}\n\nexport default getMatrixSize;\n","/**\n * Get the character used for separating decimals.\n */\nconst getDecimalSeparator = (locale: string): string => {\n switch (locale) {\n // TODO(somewhatabstract): Remove this when Chrome supports the `ka`\n // locale properly.\n // https://github.com/formatjs/formatjs/issues/1526#issuecomment-559891201\n //\n // Supported locales in Chrome:\n // https://source.chromium.org/chromium/chromium/src/+/master:third_party/icu/scripts/chrome_ui_languages.list\n case \"ka\":\n return \",\";\n\n default:\n const numberWithDecimalSeparator = 1.1;\n // TODO(FEI-3647): Update to use .formatToParts() once we no longer have to\n // support Safari 12.\n const match = new Intl.NumberFormat(locale)\n .format(numberWithDecimalSeparator)\n // 0x661 is ARABIC-INDIC DIGIT ONE\n // 0x6F1 is EXTENDED ARABIC-INDIC DIGIT ONE\n // 0x967 is DEVANAGARI DIGIT ONE\n // 0x9e7 is BENGALI/BANGLA DIGIT ONE\n .match(/[^\\d\\u0661\\u06F1\\u0967\\u09e7]/);\n return match?.[0] ?? \".\";\n }\n};\n\nexport default getDecimalSeparator;\n","const localesThatUseColon = [\n \"az\",\n \"bg\",\n \"cs\",\n \"da\",\n \"de\",\n \"hu\",\n \"hy\",\n \"id\",\n \"it\",\n \"ky\",\n \"lt\",\n \"lv\",\n \"nb\",\n \"nl\",\n \"pl\",\n \"pt-pt\",\n \"ro\",\n \"sv\",\n \"uk\",\n \"vi\",\n \"ro\",\n \"ru\",\n];\n\n/**\n * Get the character used for dividing numbers depending on the locale.\n */\nexport const getDivideSymbol = (locale: string): string => {\n // If the locale uses a colon for division, return a colon\n if (localesThatUseColon.includes(locale)) {\n return \":\";\n }\n\n // Default to using a forward slash\n return \"/\";\n};\n\n/**\n * Get the TeX command used for dividing numbers depending on the locale.\n */\nexport const getDivideSymbolForTex = (locale: string): string => {\n const divideSymbol = getDivideSymbol(locale);\n\n // If the locale uses the forward slash, return the TeX command for ÷\n return divideSymbol === \"/\" ? \"\\\\div\" : divideSymbol;\n};\n","import _ from \"underscore\";\n\n/**\n * APPROXIMATE equality on numbers and primitives.\n */\nexport function approximateEqual<T>(x: T, y: T): boolean {\n if (typeof x === \"number\" && typeof y === \"number\") {\n return Math.abs(x - y) < 1e-9;\n }\n return x === y;\n}\n\n/**\n * Deep APPROXIMATE equality on primitives, numbers, arrays, and objects.\n * Recursive.\n */\nexport function approximateDeepEqual<T>(x: T, y: T): boolean {\n if (Array.isArray(x) && Array.isArray(y)) {\n if (x.length !== y.length) {\n return false;\n }\n for (let i = 0; i < x.length; i++) {\n if (!approximateDeepEqual(x[i], y[i])) {\n return false;\n }\n }\n return true;\n }\n if (Array.isArray(x) || Array.isArray(y)) {\n return false;\n }\n if (typeof x === \"function\" && typeof y === \"function\") {\n return approximateEqual(x, y);\n }\n if (typeof x === \"function\" || typeof y === \"function\") {\n return false;\n }\n if (typeof x === \"object\" && typeof y === \"object\" && !!x && !!y) {\n return (\n x === y ||\n (_.all(x, function (v, k) {\n // @ts-expect-error - TS2536 - Type 'CollectionKey<T>' cannot be used to index type 'T'.\n return approximateDeepEqual(y[k], v);\n }) &&\n _.all(y, function (v, k) {\n // @ts-expect-error - TS2536 - Type 'CollectionKey<T>' cannot be used to index type 'T'.\n return approximateDeepEqual(x[k], v);\n }))\n );\n }\n if ((typeof x === \"object\" && !!x) || (typeof y === \"object\" && !!y)) {\n return false;\n }\n return approximateEqual(x, y);\n}\n","import type {PerseusWidgetsMap} from \"../data-schema\";\n\n/**\n * Add a widget placeholder using the widget ID.\n * ex. addWidget(\"radio 1\") => \"[[☃ radio 1]]\"\n *\n * @param {string} id\n * @returns {string}\n */\nexport function addWidget(id: string): string {\n return `[[☃ ${id}]]`;\n}\n\n/**\n * Regex for widget placeholders in a string.\n *\n * First capture group is the widget ID (ex. 'radio 1')\n * Second capture group is the widget type (ex. \"radio)\n * exec return will look like: ['[[☃ radio 1]]', 'radio 1', 'radio']\n */\nexport function getWidgetRegex() {\n return /\\[\\[☃ ([A-Za-z0-9- ]+)\\]\\]/g;\n}\n\n/**\n * Extract all widget IDs, which includes the widget type and instance number.\n * example output: ['radio 1', 'categorizer 1', 'categorizor 2']\n *\n * Content should contain Perseus widget placeholders,\n * which look like: '[[☃ radio 1]]'.\n *\n * @param {string} content\n * @returns {ReadonlyArray<string>} widgetIds\n */\nexport function getWidgetIdsFromContent(\n content: string,\n): ReadonlyArray<string> {\n const widgets: Array<string> = [];\n const localWidgetRegex = getWidgetRegex();\n\n let match = localWidgetRegex.exec(content);\n\n while (match !== null) {\n widgets.push(match[1]);\n match = localWidgetRegex.exec(content);\n }\n\n return widgets;\n}\n\n/**\n * Get a list of widget IDs from content,\n * but only for specific widget types\n *\n * @param {string} type the type of widget (ie \"radio\")\n * @param {string} content the string to parse\n * @param {PerseusWidgetsMap} widgetMap widget ID to widget map\n * @returns {ReadonlyArray<string>} the widget type (ie \"radio\")\n */\nexport function getWidgetIdsFromContentByType(\n type: string,\n content: string,\n widgetMap: PerseusWidgetsMap,\n): ReadonlyArray<string> {\n const rv: Array<string> = [];\n const widgetIdsInContent = getWidgetIdsFromContent(content);\n widgetIdsInContent.forEach((widgetId) => {\n const widget = widgetMap[widgetId];\n if (widget?.type === type) {\n rv.push(widgetId);\n }\n });\n return rv;\n}\n","function deepClone<T>(obj: T): T {\n return JSON.parse(JSON.stringify(obj));\n}\n\nexport default deepClone;\n","import _ from \"underscore\";\n\nimport {approximateDeepEqual} from \"./equality\";\n\nimport type {\n LinearType,\n QuadraticType,\n SinusoidType,\n TangentType,\n ExponentialType,\n LogarithmType,\n AbsoluteValueType,\n Coords,\n} from \"./grapher-types\";\nimport type {Coord} from \"../data-schema\";\n\nexport const MOVABLES = {\n PLOT: \"PLOT\",\n PARABOLA: \"PARABOLA\",\n SINUSOID: \"SINUSOID\",\n};\n\n// TODO(charlie): These really need to go into a utility file as they're being\n// used by both interactive-graph and now grapher.\nfunction canonicalSineCoefficients(coeffs: any) {\n // For a curve of the form f(x) = a * Sin(b * x - c) + d,\n // this function ensures that a, b > 0, and c is its\n // smallest possible positive value.\n let amplitude = coeffs[0];\n let angularFrequency = coeffs[1];\n let phase = coeffs[2];\n const verticalOffset = coeffs[3];\n\n // Guarantee a > 0\n if (amplitude < 0) {\n amplitude *= -1;\n angularFrequency *= -1;\n phase *= -1;\n }\n\n const period = 2 * Math.PI;\n // Guarantee b > 0\n if (angularFrequency < 0) {\n angularFrequency *= -1;\n phase *= -1;\n phase += period / 2;\n }\n\n // Guarantee c is smallest possible positive value\n while (phase > 0) {\n phase -= period;\n }\n while (phase < 0) {\n phase += period;\n }\n\n return [amplitude, angularFrequency, phase, verticalOffset];\n}\n\nfunction canonicalTangentCoefficients(coeffs: any) {\n // For a curve of the form f(x) = a * Tan(b * x - c) + d,\n // this function ensures that a, b > 0, and c is its\n // smallest possible positive value.\n let amplitude = coeffs[0];\n let angularFrequency = coeffs[1];\n let phase = coeffs[2];\n const verticalOffset = coeffs[3];\n\n // Guarantee a > 0\n if (amplitude < 0) {\n amplitude *= -1;\n angularFrequency *= -1;\n phase *= -1;\n }\n\n const period = Math.PI;\n // Guarantee b > 0\n if (angularFrequency < 0) {\n angularFrequency *= -1;\n phase *= -1;\n phase += period / 2;\n }\n\n // Guarantee c is smallest possible positive value\n while (phase > 0) {\n phase -= period;\n }\n while (phase < 0) {\n phase += period;\n }\n\n return [amplitude, angularFrequency, phase, verticalOffset];\n}\n\nconst PlotDefaults = {\n areEqual: function (\n coeffs1: ReadonlyArray<number>,\n coeffs2: ReadonlyArray<number>,\n ): boolean {\n return approximateDeepEqual(coeffs1, coeffs2);\n },\n movable: MOVABLES.PLOT,\n getPropsForCoeffs: function (coeffs: ReadonlyArray<number>): {fn: any} {\n return {\n // @ts-expect-error - TS2339 - Property 'getFunctionForCoeffs' does not exist on type '{ readonly areEqual: (coeffs1: any, coeffs2: any) => boolean; readonly Movable: any; readonly getPropsForCoeffs: (coeffs: any) => any; }'.\n fn: _.partial(this.getFunctionForCoeffs, coeffs),\n };\n },\n} as const;\n\nconst Linear: LinearType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/67aaf581e6d9ef9038c10558a1f70ac21c11c9f8.png\",\n\n defaultCoords: [\n [0.25, 0.75],\n [0.75, 0.75],\n ],\n\n getCoefficients: function (\n coords: Coords,\n ): ReadonlyArray<number> | undefined {\n const p1 = coords[0];\n const p2 = coords[1];\n\n const denom = p2[0] - p1[0];\n const num = p2[1] - p1[1];\n\n if (denom === 0) {\n return;\n }\n\n const m = num / denom;\n const b = p2[1] - m * p2[0];\n return [m, b];\n },\n\n getFunctionForCoeffs: function (coeffs: ReadonlyArray<number>, x: number) {\n const m = coeffs[0];\n const b = coeffs[1];\n return m * x + b;\n },\n\n getEquationString: function (coords: Coords) {\n const coeffs: ReadonlyArray<number> = this.getCoefficients(coords);\n const m: number = coeffs[0];\n const b: number = coeffs[1];\n return \"y = \" + m.toFixed(3) + \"x + \" + b.toFixed(3);\n },\n});\n\nconst Quadratic: QuadraticType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/e23d36e6fc29ee37174e92c9daba2a66677128ab.png\",\n\n defaultCoords: [\n [0.5, 0.5],\n [0.75, 0.75],\n ],\n movable: MOVABLES.PARABOLA,\n\n getCoefficients: function (coords: Coords): ReadonlyArray<number> {\n const p1 = coords[0];\n const p2 = coords[1];\n\n // Parabola with vertex (h, k) has form: y = a * (h - k)^2 + k\n const h = p1[0];\n const k = p1[1];\n\n // Use these to calculate familiar a, b, c\n const a = (p2[1] - k) / ((p2[0] - h) * (p2[0] - h));\n const b = -2 * h * a;\n const c = a * h * h + k;\n\n return [a, b, c];\n },\n\n getFunctionForCoeffs: function (\n coeffs: ReadonlyArray<number>,\n x: number,\n ): number {\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n return (a * x + b) * x + c;\n },\n\n getPropsForCoeffs: function (coeffs: ReadonlyArray<number>): {\n a: number;\n b: number;\n c: number;\n } {\n return {\n a: coeffs[0],\n b: coeffs[1],\n c: coeffs[2],\n };\n },\n\n getEquationString: function (coords: Coords) {\n const coeffs = this.getCoefficients(coords);\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n return (\n \"y = \" +\n a.toFixed(3) +\n \"x^2 + \" +\n b.toFixed(3) +\n \"x + \" +\n c.toFixed(3)\n );\n },\n});\n\nconst Sinusoid: SinusoidType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/3d68e7718498475f53b206c2ab285626baf8857e.png\",\n\n defaultCoords: [\n [0.5, 0.5],\n [0.6, 0.6],\n ],\n movable: MOVABLES.SINUSOID,\n\n getCoefficients: function (coords: Coords) {\n const p1 = coords[0];\n const p2 = coords[1];\n\n const a = p2[1] - p1[1];\n const b = Math.PI / (2 * (p2[0] - p1[0]));\n const c = p1[0] * b;\n const d = p1[1];\n\n return [a, b, c, d];\n },\n\n getFunctionForCoeffs: function (coeffs: ReadonlyArray<number>, x: number) {\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n const d = coeffs[3];\n return a * Math.sin(b * x - c) + d;\n },\n\n getPropsForCoeffs: function (coeffs: ReadonlyArray<number>) {\n return {\n a: coeffs[0],\n b: coeffs[1],\n c: coeffs[2],\n d: coeffs[3],\n };\n },\n\n getEquationString: function (coords: Coords) {\n const coeffs = this.getCoefficients(coords);\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n const d = coeffs[3];\n return (\n \"y = \" +\n a.toFixed(3) +\n \" sin(\" +\n b.toFixed(3) +\n \"x - \" +\n c.toFixed(3) +\n \") + \" +\n d.toFixed(3)\n );\n },\n\n areEqual: function (\n coeffs1: ReadonlyArray<number>,\n coeffs2: ReadonlyArray<number>,\n ) {\n return approximateDeepEqual(\n canonicalSineCoefficients(coeffs1),\n canonicalSineCoefficients(coeffs2),\n );\n },\n});\n\nconst Tangent: TangentType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/7db80d23c35214f98659fe1cf0765811c1bbfbba.png\",\n\n defaultCoords: [\n [0.5, 0.5],\n [0.75, 0.75],\n ],\n\n getCoefficients: function (coords: Coords) {\n const p1 = coords[0];\n const p2 = coords[1];\n\n const a = p2[1] - p1[1];\n const b = Math.PI / (4 * (p2[0] - p1[0]));\n const c = p1[0] * b;\n const d = p1[1];\n\n return [a, b, c, d];\n },\n\n getFunctionForCoeffs: function (coeffs: ReadonlyArray<number>, x: number) {\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n const d = coeffs[3];\n return a * Math.tan(b * x - c) + d;\n },\n\n getEquationString: function (coords: Coords) {\n const coeffs = this.getCoefficients(coords);\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n const d = coeffs[3];\n return (\n \"y = \" +\n a.toFixed(3) +\n \" sin(\" +\n b.toFixed(3) +\n \"x - \" +\n c.toFixed(3) +\n \") + \" +\n d.toFixed(3)\n );\n },\n\n areEqual: function (\n coeffs1: ReadonlyArray<number>,\n coeffs2: ReadonlyArray<number>,\n ) {\n return approximateDeepEqual(\n canonicalTangentCoefficients(coeffs1),\n canonicalTangentCoefficients(coeffs2),\n );\n },\n});\n\nconst Exponential: ExponentialType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/9cbfad55525e3ce755a31a631b074670a5dad611.png\",\n\n defaultCoords: [\n [0.5, 0.55],\n [0.75, 0.75],\n ],\n\n defaultAsymptote: [\n [0, 0.5],\n [1.0, 0.5],\n ],\n\n /**\n * Add extra constraints for movement of the points or asymptote (below):\n * newCoord: [x, y]\n * The end position of the point or asymptote endpoint\n * oldCoord: [x, y]\n * The old position of the point or asymptote endpoint\n * coords:\n * An array of coordinates representing the proposed end configuration\n * of the plot coordinates.\n * asymptote:\n * An array of coordinates representing the proposed end configuration\n * of the asymptote.\n *\n * Return: either a coordinate (to be used as the resulting coordinate of\n * the move) or a boolean, where `true` uses newCoord as the resulting\n * coordinate, and `false` uses oldCoord as the resulting coordinate.\n */\n extraCoordConstraint: function (\n newCoord: Coord,\n oldCoord: Coord,\n coords: Coords,\n asymptote: Coords,\n graph,\n ) {\n const y: number = asymptote[0][1];\n return _.all(coords, (coord) => coord[1] !== y);\n },\n\n extraAsymptoteConstraint: function (\n newCoord: Coord,\n oldCoord: Coord,\n coords: Coords,\n asymptote: Coords,\n graph,\n ): Coord {\n const y = newCoord[1];\n const isValid =\n _.all(coords, (coord) => coord[1] > y) ||\n _.all(coords, (coord) => coord[1] < y);\n\n if (isValid) {\n return [oldCoord[0], y];\n }\n // Snap the asymptote as close as possible, i.e., if the user moves\n // the mouse really quickly into an invalid region\n const oldY = oldCoord[1];\n const wasBelow = _.all(coords, (coord) => coord[1] > oldY);\n if (wasBelow) {\n const bottomMost = _.min(_.map(coords, (coord) => coord[1]));\n return [oldCoord[0], bottomMost - graph.snapStep[1]];\n }\n const topMost = _.max(_.map(coords, (coord) => coord[1]));\n return [oldCoord[0], topMost + graph.snapStep[1]];\n },\n\n allowReflectOverAsymptote: true,\n\n getCoefficients: function (\n coords: Coords,\n asymptote: Coords,\n ): ReadonlyArray<number> {\n const p1 = coords[0];\n const p2 = coords[1];\n\n const c = asymptote[0][1];\n const b = Math.log((p1[1] - c) / (p2[1] - c)) / (p1[0] - p2[0]);\n const a = (p1[1] - c) / Math.exp(b * p1[0]);\n return [a, b, c];\n },\n\n getFunctionForCoeffs: function (\n coeffs: ReadonlyArray<number>,\n x: number,\n ): number {\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n return a * Math.exp(b * x) + c;\n },\n\n getEquationString: function (coords: Coords, asymptote: Coords) {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!asymptote) {\n return null;\n }\n const coeffs = this.getCoefficients(coords, asymptote);\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n return (\n \"y = \" +\n a.toFixed(3) +\n \"e^(\" +\n b.toFixed(3) +\n \"x) + \" +\n c.toFixed(3)\n );\n },\n});\n\nconst Logarithm: LogarithmType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/f6491e99d34af34d924bfe0231728ad912068dc3.png\",\n\n defaultCoords: [\n [0.55, 0.5],\n [0.75, 0.75],\n ],\n\n defaultAsymptote: [\n [0.5, 0],\n [0.5, 1.0],\n ],\n\n extraCoordConstraint: function (\n newCoord: Coord,\n oldCoord: Coord,\n coords: Coord,\n asymptote: Coords,\n graph,\n ) {\n const x = asymptote[0][0];\n return (\n _.all(coords, (coord) => coord[0] !== x) &&\n coords[0][1] !== coords[1][1]\n );\n },\n\n extraAsymptoteConstraint: function (\n newCoord: Coord,\n oldCoord: Coord,\n coords: Coords,\n asymptote: Coords,\n graph,\n ): ReadonlyArray<number> {\n const x = newCoord[0];\n const isValid =\n _.all(coords, (coord) => coord[0] > x) ||\n _.all(coords, (coord) => coord[0] < x);\n\n if (isValid) {\n return [x, oldCoord[1]];\n }\n // Snap the asymptote as close as possible, i.e., if the user moves\n // the mouse really quickly into an invalid region\n const oldX = oldCoord[0];\n const wasLeft = _.all(coords, (coord) => coord[0] > oldX);\n if (wasLeft) {\n const leftMost = _.min(_.map(coords, (coord) => coord[0]));\n return [leftMost - graph.snapStep[0], oldCoord[1]];\n }\n const rightMost = _.max(_.map(coords, (coord) => coord[0]));\n return [rightMost + graph.snapStep[0], oldCoord[1]];\n },\n\n allowReflectOverAsymptote: true,\n\n getCoefficients: function (\n coords: Coords,\n asymptote: Coords,\n ): ReadonlyArray<number> | undefined {\n // It's easiest to calculate the logarithm's coefficients by thinking\n // about it as the inverse of the exponential, so we flip x and y and\n // perform some algebra on the coefficients. This also unifies the\n // logic between the two 'models'.\n const flip = (coord: Coord): Coord => [coord[1], coord[0]];\n const inverseCoeffs = Exponential.getCoefficients(\n _.map(coords, flip) as Coords,\n _.map(asymptote, flip) as Coords,\n );\n if (inverseCoeffs) {\n const c = -inverseCoeffs[2] / inverseCoeffs[0];\n const b = 1 / inverseCoeffs[0];\n const a = 1 / inverseCoeffs[1];\n return [a, b, c];\n }\n },\n\n getFunctionForCoeffs: function (\n coeffs: ReadonlyArray<number>,\n x: number,\n asymptote: Coords,\n ) {\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n return a * Math.log(b * x + c);\n },\n\n getEquationString: function (coords: Coords, asymptote: Coords) {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!asymptote) {\n return null;\n }\n const coeffs: ReadonlyArray<number> = this.getCoefficients(\n coords,\n asymptote,\n );\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n return (\n \"y = ln(\" +\n a.toFixed(3) +\n \"x + \" +\n b.toFixed(3) +\n \") + \" +\n c.toFixed(3)\n );\n },\n});\n\nconst AbsoluteValue: AbsoluteValueType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/8256a630175a0cb1d11de223d6de0266daf98721.png\",\n\n defaultCoords: [\n [0.5, 0.5],\n [0.75, 0.75],\n ],\n\n getCoefficients: function (\n coords: Coords,\n ): ReadonlyArray<number> | undefined {\n const p1 = coords[0];\n const p2 = coords[1];\n\n const denom = p2[0] - p1[0];\n const num = p2[1] - p1[1];\n\n if (denom === 0) {\n return;\n }\n\n let m = Math.abs(num / denom);\n if (p2[1] < p1[1]) {\n m *= -1;\n }\n const horizontalOffset = p1[0];\n const verticalOffset = p1[1];\n\n return [m, horizontalOffset, verticalOffset];\n },\n\n getFunctionForCoeffs: function (coeffs: ReadonlyArray<number>, x: number) {\n const m = coeffs[0];\n const horizontalOffset = coeffs[1];\n const verticalOffset = coeffs[2];\n return m * Math.abs(x - horizontalOffset) + verticalOffset;\n },\n\n getEquationString: function (coords: Coords) {\n const coeffs: ReadonlyArray<number> = this.getCoefficients(coords);\n const m = coeffs[0];\n const horizontalOffset = coeffs[1];\n const verticalOffset = coeffs[2];\n return (\n \"y = \" +\n m.toFixed(3) +\n \"| x - \" +\n horizontalOffset.toFixed(3) +\n \"| + \" +\n verticalOffset.toFixed(3)\n );\n },\n});\n\n/* Utility functions for dealing with graphing interfaces. */\nconst functionTypeMapping = {\n linear: Linear,\n quadratic: Quadratic,\n sinusoid: Sinusoid,\n tangent: Tangent,\n exponential: Exponential,\n logarithm: Logarithm,\n absolute_value: AbsoluteValue,\n} as const;\n\nexport const allTypes: any = _.keys(functionTypeMapping);\n\nexport type FunctionTypeMappingKeys = keyof typeof functionTypeMapping;\n\ntype ConditionalGraderType<T extends FunctionTypeMappingKeys> =\n // prettier-ignore\n T extends \"linear\" ? LinearType\n : T extends \"quadratic\" ? QuadraticType\n : T extends \"sinusoid\" ? SinusoidType\n : T extends \"tangent\" ? TangentType\n : T extends \"exponential\" ? ExponentialType\n : T extends \"logarithm\" ? LogarithmType\n : T extends \"absolute_value\" ? AbsoluteValueType\n : never;\n\nexport function functionForType<T extends FunctionTypeMappingKeys>(\n type: T,\n): ConditionalGraderType<T> {\n // @ts-expect-error: TypeScript doesn't know how to use deal with generics\n // and conditional types in this way.\n return functionTypeMapping[type];\n}\n","import _ from \"underscore\";\n\nimport deepClone from \"./deep-clone\";\n\nimport type {PerseusItem, PerseusRenderer} from \"../data-schema\";\n\nconst blankPerseusRenderer: PerseusRenderer = {\n content: \"\",\n images: {},\n widgets: {},\n} as const;\n\nexport function generateTestPerseusRenderer(\n customFields: Partial<PerseusRenderer> = {},\n): PerseusRenderer {\n return deepClone({...blankPerseusRenderer, ...customFields});\n}\n\nconst blankPerseusItemData: PerseusItem = {\n question: generateTestPerseusRenderer(),\n answerArea: {\n calculator: false,\n periodicTable: false,\n financialCalculatorMonthlyPayment: false,\n financialCalculatorTotalAmount: false,\n financialCalculatorTimeToPayOff: false,\n periodicTableWithKey: false,\n },\n hints: [],\n} as const;\n\n/**\n * Generate a Perseus item object for testing purposes.\n *\n * In order to better type Perseus objects used in testing, this function\n * uses a basic Perseus object and updates it with custom values as needed.\n *\n * @param {Partial<PerseusItem>} customFields\n * @returns {PerseusItem}\n */\nexport function generateTestPerseusItem(\n customFields: Partial<PerseusItem> = {},\n): PerseusItem {\n return deepClone({...blankPerseusItemData, ...customFields});\n}\n","import type {\n LabelImageWidget,\n PerseusItem,\n PerseusWidget,\n PerseusWidgetsMap,\n RadioWidget,\n} from \"../data-schema\";\n\n/**\n * Returns true if a Perseus item contains any widget with rationales.\n */\nexport const itemHasRationales = (item: PerseusItem) =>\n widgetsHaveRationales(item.question.widgets);\n\nconst widgetsHaveRationales = (widgets: PerseusWidgetsMap) =>\n Object.values(widgets).some(widgetHasRationales);\n\nconst widgetHasRationales = (widget: PerseusWidget): boolean => {\n switch (widget.type) {\n case \"radio\":\n return radioWidgetHasRationales(widget);\n case \"label-image\":\n return labelImageWidgetHasRationales(widget);\n case \"graded-group\":\n case \"group\":\n return widgetsHaveRationales(widget.options.widgets);\n default:\n return false;\n }\n};\n\nconst radioWidgetHasRationales = (widget: RadioWidget): boolean => {\n return widget.options.choices.some((choice) => !!choice.rationale);\n};\n\nconst labelImageWidgetHasRationales = (widget: LabelImageWidget): boolean => {\n return widget.options.markers.some((marker) => marker.answers.length > 0);\n};\n","import type {PerseusItem} from \"../data-schema\";\n\n/**\n * Returns true if the item has hints\n */\nexport const itemHasHints = (item: PerseusItem): boolean => {\n return item.hints.length > 0;\n};\n","import {approximateDeepEqual} from \"./equality\";\n\nexport function isRealJSONParse(jsonParse: typeof JSON.parse): boolean {\n const randomPhrase = buildRandomPhrase();\n const randomHintPhrase = buildRandomPhrase();\n const randomString = buildRandomString();\n const testingObject = JSON.stringify({\n answerArea: {\n calculator: false,\n financialCalculatorMonthlyPayment: false,\n financialCalculatorTimeToPayOff: false,\n financialCalculatorTotalAmount: false,\n periodicTable: false,\n periodicTableWithKey: false,\n },\n hints: [randomHintPhrase, `=${Math.floor(Math.random() * 50) + 1}`],\n question: {\n content: `${randomPhrase}`,\n images: {},\n widgets: {\n expression1: {\n alignment: \"default\",\n graded: false,\n options: {\n answerForms: [\n {\n considered: \"wrong\",\n form: false,\n key: 0,\n simplify: false,\n value: `${randomString}`,\n },\n ],\n ariaLabel: \"Answer\",\n buttonSets: [\"basic\"],\n functions: [\"f\", \"g\", \"h\"],\n static: true,\n times: false,\n visibleLabel: \"Answer\",\n },\n static: true,\n type: \"expression\",\n version: {major: 1, minor: 0},\n },\n },\n },\n });\n const testJSON = buildTestData(testingObject.replace(/\"/g, '\\\\\"'));\n const parsedTestJSON = jsonParse(testJSON);\n const parsedTestItemData: string =\n parsedTestJSON.data.assessmentItem.item.itemData;\n return approximateDeepEqual(parsedTestItemData, testingObject);\n}\n\nfunction buildRandomString(capitalize: boolean = false) {\n let randomString: string = \"\";\n const randomLength = Math.floor(Math.random() * 8) + 3;\n for (let i = 0; i < randomLength; i++) {\n const randomLetter = String.fromCharCode(\n 97 + Math.floor(Math.random() * 26),\n );\n randomString +=\n capitalize && i === 0 ? randomLetter.toUpperCase() : randomLetter;\n }\n return randomString;\n}\n\nfunction buildRandomPhrase() {\n const phrases: string[] = [];\n const randomLength = Math.floor(Math.random() * 10) + 5;\n for (let i = 0; i < randomLength; i++) {\n phrases.push(buildRandomString(i === 0));\n }\n const modifierStart = [\"**\", \"$\"];\n const modifierEnd = [\"**\", \"$\"];\n const modifierIndex = Math.floor(Math.random() * modifierStart.length);\n return `${modifierStart[modifierIndex]}${phrases.join(\" \")}${modifierEnd[modifierIndex]}`;\n}\n\nfunction buildTestData(testObject: string) {\n return `{\"data\":{\"assessmentItem\":{\"__typename\":\"AssessmentItemOrError\",\"error\":null,\"item\":{\"__typename\":\"AssessmentItem\",\"id\":\"x890b3c70f3e8f4a6\",\"itemData\":\"${testObject}\",\"problemType\":\"Type 1\",\"sha\":\"c7284a3ad65214b4e62bccce236d92f7f5d35941\"}}}}`;\n}\n","import invariant from \"tiny-invariant\";\n\nexport type Result<S, F> = Success<S> | Failure<F>;\n\nexport type Success<T> = {type: \"success\"; value: T};\nexport type Failure<T> = {type: \"failure\"; detail: T};\n\nexport function success<T>(value: T): Success<T> {\n return {type: \"success\", value};\n}\n\nexport function failure<T>(detail: T): Failure<T> {\n return {type: \"failure\", detail};\n}\n\nexport function isFailure<S, F>(result: Result<S, F>): result is Failure<F> {\n return result.type === \"failure\";\n}\n\nexport function isSuccess<S, F>(result: Result<S, F>): result is Success<S> {\n return result.type === \"success\";\n}\n\nexport function assertFailure<S, F>(\n result: Result<S, F>,\n): asserts result is Failure<F> {\n invariant(\n isFailure(result),\n \"expected result to be a Failure, but got a Success\",\n );\n}\n\nexport function assertSuccess<S, F>(\n result: Result<S, F>,\n): asserts result is Success<S> {\n invariant(\n isSuccess(result),\n \"expected result to be a Success, but got a Failure\",\n );\n}\n\n/**\n * @returns a function that transforms the `detail` value of any Failure result\n * passed to it, and leaves Success results unchanged. `mapFailure` is curried\n * for easy composition with Array.map(), mu-lambda's pipe(), etc.\n * @param f the function to apply to Failure `detail`s.\n */\nexport function mapFailure<S, DetailIn, DetailOut>(\n f: (detail: DetailIn) => DetailOut,\n): (result: Result<S, DetailIn>) => Result<S, DetailOut> {\n return (result) => {\n if (isFailure(result)) {\n return failure(f(result.detail));\n }\n return result;\n };\n}\n\n// Result's `all` function is similar to Promise.all: given an array of\n// results, it returns success if all succeeded, and failure if any failed.\nexport function all<S, F>(\n results: Array<Result<S, F>>,\n combineFailureDetails: (a: F, b: F) => F = (a) => a,\n): Result<S[], F> {\n const values: S[] = [];\n const failureDetails: F[] = [];\n for (const result of results) {\n if (result.type === \"success\") {\n values.push(result.value);\n } else {\n failureDetails.push(result.detail);\n }\n }\n\n if (failureDetails.length > 0) {\n return failure(failureDetails.reduce(combineFailureDetails));\n }\n return success(values);\n}\n","import {failure, success} from \"./result\";\n\nimport type {ParseContext, Mismatch, PathSegment} from \"./parser-types\";\nimport type {Failure, Success} from \"./result\";\n\nexport class ErrorTrackingParseContext implements ParseContext {\n constructor(private readonly path: PathSegment[]) {}\n\n failure(\n expected: string | string[],\n badValue: unknown,\n ): Failure<Mismatch[]> {\n return failure([\n {\n expected: wrapInArray(expected),\n badValue,\n path: this.path,\n },\n ]);\n }\n\n forSubtree(key: PathSegment): ParseContext {\n return new ErrorTrackingParseContext([...this.path, key]);\n }\n\n success<T>(value: T): Success<T> {\n return success(value);\n }\n}\n\nfunction wrapInArray(a: string | string[]): string[] {\n return Array.isArray(a) ? a : [a];\n}\n","import type {PathSegment} from \"./parser-types\";\n\nexport function formatPath(path: PathSegment[]): string {\n return \"(root)\" + path.map(formatPathSegment).join(\"\");\n}\n\nfunction formatPathSegment(segment: PathSegment): string {\n if (typeof segment === \"string\") {\n return validIdentifier.test(segment)\n ? \".\" + segment\n : `[${JSON.stringify(segment)}]`;\n }\n return `[${segment.toString()}]`;\n}\n\nconst validIdentifier = /^[A-Za-z$_][A-Za-z$_0-9]*$/;\n","import {formatPath} from \"./object-path\";\n\nimport type {Mismatch} from \"./parser-types\";\n\nexport function message(failure: Mismatch): string {\n const expected = conjoin(failure.expected);\n const path = formatPath(failure.path);\n const badValue = JSON.stringify(failure.badValue);\n return `At ${path} -- expected ${expected}, but got ${badValue}`;\n}\n\nfunction conjoin(items: string[]): string {\n switch (items.length) {\n // FUTURE(benchristel): handle 0 if this is reused elsewhere.\n case 1:\n return items[0];\n case 2:\n return items.join(\" or \");\n default: {\n const allButLast = items.slice(0, items.length - 1);\n const last = items[items.length - 1];\n return allButLast.join(\", \") + \", or \" + last;\n }\n }\n}\n","import {ErrorTrackingParseContext} from \"./error-tracking-parse-context\";\nimport {message} from \"./parse-failure-detail\";\nimport {failure, isFailure} from \"./result\";\n\nimport type {Parser} from \"./parser-types\";\nimport type {Result} from \"./result\";\n\nexport function parse<T>(value: unknown, parser: Parser<T>): Result<T, string> {\n const result = parser(value, new ErrorTrackingParseContext([]));\n if (isFailure(result)) {\n return failure(result.detail.map(message).join(\"; \"));\n }\n return result;\n}\n","import type {Parser} from \"../parser-types\";\n\nexport const any: Parser<any> = (rawValue, ctx) => ctx.success(rawValue);\n","import * as Result from \"../result\";\n\nimport type {ParseContext, Parser} from \"../parser-types\";\n\nexport function array<T>(elementParser: Parser<T>): Parser<T[]> {\n return (rawValue: unknown, ctx: ParseContext) => {\n if (!Array.isArray(rawValue)) {\n return ctx.failure(\"array\", rawValue);\n }\n const elementResults = rawValue.map((elem, i) =>\n elementParser(elem, ctx.forSubtree(i)),\n );\n return Result.all(elementResults, concat);\n };\n}\n\n/**\n * Like the standard `array` parser, but passes the array index to a parser factory function.\n * This allows element parsers to generate index-based default values.\n */\nexport function arrayWithIndex<T>(\n elementParserFactory: (index: number) => Parser<T>,\n): Parser<T[]> {\n return (rawValue: unknown, ctx: ParseContext) => {\n if (!Array.isArray(rawValue)) {\n return ctx.failure(\"array\", rawValue);\n }\n\n const elementResults = rawValue.map((elem, index) => {\n const elementParser = elementParserFactory(index);\n return elementParser(elem, ctx.forSubtree(index));\n });\n\n return Result.all(elementResults, concat);\n };\n}\n\nfunction concat<T>(a: T[], b: T[]): T[] {\n return [...a, ...b];\n}\n","import type {ParseContext, ParseResult} from \"../parser-types\";\n\nexport function boolean(\n rawValue: unknown,\n ctx: ParseContext,\n): ParseResult<boolean> {\n if (typeof rawValue === \"boolean\") {\n return ctx.success(rawValue);\n }\n return ctx.failure(\"boolean\", rawValue);\n}\n","import type {Parser} from \"../parser-types\";\n\ntype Primitive = string | number | boolean | null | undefined;\n\nexport function constant<T extends Primitive>(acceptedValue: T): Parser<T> {\n return (rawValue, ctx) => {\n if (rawValue !== acceptedValue) {\n return ctx.failure(String(JSON.stringify(acceptedValue)), rawValue);\n }\n return ctx.success(acceptedValue);\n };\n}\n","import {success} from \"../result\";\n\nimport type {Parser} from \"../parser-types\";\n\nexport function defaulted<T>(\n parser: Parser<T>,\n fallback: (missingValue: null | undefined) => NoInfer<T>,\n): Parser<T> {\n return (rawValue, ctx) => {\n if (rawValue == null) {\n return success(fallback(rawValue));\n }\n return parser(rawValue, ctx);\n };\n}\n\n/**\n * Similar to defaulted, but specifically handles empty strings as invalid.\n *\n * @param fallback Function that generates a fallback value for empty/missing strings\n * @returns Parser that validates non-empty strings or uses fallback\n */\nexport function defaultedNonEmptyString(\n fallback: () => string,\n): Parser<string> {\n return (rawValue, ctx) => {\n // Handle missing/null values - use fallback\n if (rawValue == null) {\n return ctx.success(fallback());\n }\n\n // Handle string values\n if (typeof rawValue === \"string\") {\n // If empty or whitespace-only, use fallback\n if (rawValue.trim() === \"\") {\n return ctx.success(fallback());\n }\n // Valid non-empty string, use as-is\n return ctx.success(rawValue);\n }\n\n // Invalid type, expect string\n return ctx.failure(\"string\", rawValue);\n };\n}\n","import type {Parser} from \"../parser-types\";\n\nexport function enumeration<T extends readonly string[]>(\n ...acceptedValues: T\n): Parser<T[number]> {\n return (rawValue, ctx) => {\n if (typeof rawValue === \"string\") {\n const index = acceptedValues.indexOf(rawValue);\n if (index > -1) {\n return ctx.success(acceptedValues[index]);\n }\n }\n const expected = acceptedValues.map((v) => JSON.stringify(v));\n return ctx.failure(expected, rawValue);\n };\n}\n","// See the tests for an explanation of why we need this.\nconst objectConstructorString = Object.prototype.constructor.toString();\n\nconst functionToString = Function.prototype.toString;\n\n/**\n * Checks whether a value is a plain JS object (e.g. one constructed with `{}`\n * literal syntax or `Object.create(null)`. Returns true given a plain object\n * from another realm.\n *\n * @param x - the value to check for objectiness\n */\nexport function isPlainObject(x: unknown): x is Record<keyof any, unknown> {\n if (x == null) {\n return false;\n }\n const prototype = Object.getPrototypeOf(x);\n if (prototype == null) {\n return true;\n }\n return (\n typeof prototype.constructor === \"function\" &&\n functionToString.call(prototype.constructor) === objectConstructorString\n );\n}\n","import type {Parser} from \"../parser-types\";\n\nexport function nullable<T>(parseValue: Parser<T>): Parser<T | null> {\n return (rawValue, ctx) => {\n if (rawValue === null) {\n return ctx.success(rawValue);\n }\n return parseValue(rawValue, ctx);\n };\n}\n","import type {Parser} from \"../parser-types\";\n\nexport const number: Parser<number> = (rawValue, ctx) => {\n if (typeof rawValue === \"number\") {\n return ctx.success(rawValue);\n }\n return ctx.failure(\"number\", rawValue);\n};\n","import {failure, isSuccess} from \"../result\";\n\nimport {isPlainObject} from \"./is-plain-object\";\n\nimport type {OptionalizeProperties} from \"./object-types\";\nimport type {Mismatch, ParsedValue, Parser} from \"../parser-types\";\n\ntype ObjectSchema = Record<keyof any, Parser<any>>;\n\nexport function objectWithAllPropertiesRequired<S extends ObjectSchema>(\n schema: S,\n): Parser<{[K in keyof S]: ParsedValue<S[K]>}> {\n return object(schema) as any;\n}\n\nexport function object<S extends ObjectSchema>(\n schema: S,\n): Parser<OptionalizeProperties<{[K in keyof S]: ParsedValue<S[K]>}>> {\n return (rawValue, ctx) => {\n if (!isPlainObject(rawValue)) {\n return ctx.failure(\"object\", rawValue);\n }\n\n const ret: any = {...rawValue};\n const mismatches: Mismatch[] = [];\n for (const [prop, propParser] of Object.entries(schema)) {\n const result = propParser(rawValue[prop], ctx.forSubtree(prop));\n if (isSuccess(result)) {\n if (result.value !== undefined || prop in rawValue) {\n ret[prop] = result.value;\n }\n } else {\n mismatches.push(...result.detail);\n }\n }\n\n if (mismatches.length > 0) {\n return failure(mismatches);\n }\n return ctx.success(ret);\n };\n}\n","import type {Parser} from \"../parser-types\";\n\nexport function optional<T>(parseValue: Parser<T>): Parser<T | undefined> {\n return (rawValue, ctx) => {\n if (rawValue === undefined) {\n return ctx.success(rawValue);\n }\n return parseValue(rawValue, ctx);\n };\n}\n","import {isFailure} from \"../result\";\n\nimport type {Parser} from \"../parser-types\";\n\nexport function pair<A, B>(\n parseA: Parser<A>,\n parseB: Parser<B>,\n): Parser<[A, B]> {\n return (rawValue, ctx) => {\n if (!Array.isArray(rawValue)) {\n return ctx.failure(\"array\", rawValue);\n }\n if (rawValue.length !== 2) {\n return ctx.failure(\"array of length 2\", rawValue);\n }\n const [rawA, rawB] = rawValue;\n const resultA = parseA(rawA, ctx.forSubtree(0));\n if (isFailure(resultA)) {\n return resultA;\n }\n const resultB = parseB(rawB, ctx.forSubtree(1));\n if (isFailure(resultB)) {\n return resultB;\n }\n\n return ctx.success([resultA.value, resultB.value]);\n };\n}\n","import {isFailure} from \"../result\";\n\nimport type {\n ParseContext,\n ParsedValue,\n Parser,\n PartialParser,\n} from \"../parser-types\";\n\nexport function pipeParsers<T>(p: Parser<T>): ParserPipeline<T> {\n return new ParserPipeline(p);\n}\n\nexport class ParserPipeline<T> {\n constructor(public readonly parser: Parser<T>) {}\n\n then<U>(nextParser: PartialParser<T, U>): ParserPipeline<U> {\n return new ParserPipeline<U>(composeParsers(this.parser, nextParser));\n }\n}\n\nfunction composeParsers<\n A extends Parser<any>,\n B extends PartialParser<ParsedValue<A>, any>,\n>(parserA: A, parserB: B): Parser<ParsedValue<B>> {\n return (rawValue: unknown, ctx: ParseContext) => {\n const partialResult = parserA(rawValue, ctx);\n if (isFailure(partialResult)) {\n return partialResult;\n }\n\n return parserB(partialResult.value, ctx);\n };\n}\n","import {failure, isFailure, isSuccess} from \"../result\";\n\nimport {isPlainObject} from \"./is-plain-object\";\n\nimport type {Mismatch, Parser} from \"../parser-types\";\n\nexport function record<K extends string, V>(\n parseKey: Parser<K>,\n parseValue: Parser<V>,\n): Parser<Record<K, V>> {\n return (rawValue, ctx) => {\n if (!isPlainObject(rawValue)) {\n return ctx.failure(\"object\", rawValue);\n }\n\n const result = {} as Record<K, V>;\n const mismatches: Mismatch[] = [];\n for (const [key, value] of Object.entries(rawValue)) {\n const entryCtx = ctx.forSubtree(key);\n const keyResult = parseKey(key, entryCtx);\n if (isFailure(keyResult)) {\n mismatches.push(...keyResult.detail);\n }\n\n const valueResult = parseValue(value, entryCtx);\n if (isFailure(valueResult)) {\n mismatches.push(...valueResult.detail);\n }\n\n if (isSuccess(keyResult) && isSuccess(valueResult)) {\n result[keyResult.value] = valueResult.value;\n }\n }\n\n if (mismatches.length > 0) {\n return failure(mismatches);\n }\n return ctx.success(result);\n };\n}\n","import type {Parser} from \"../parser-types\";\n\nexport const string: Parser<string> = (rawValue, ctx) => {\n if (typeof rawValue === \"string\") {\n return ctx.success(rawValue);\n }\n return ctx.failure(\"string\", rawValue);\n};\n","import {isFailure} from \"../result\";\n\nimport type {Parser} from \"../parser-types\";\n\nexport function trio<A, B, C>(\n parseA: Parser<A>,\n parseB: Parser<B>,\n parseC: Parser<C>,\n): Parser<[A, B, C]> {\n return (rawValue, ctx) => {\n if (!Array.isArray(rawValue)) {\n return ctx.failure(\"array\", rawValue);\n }\n if (rawValue.length !== 3) {\n return ctx.failure(\"array of length 3\", rawValue);\n }\n\n const resultA = parseA(rawValue[0], ctx.forSubtree(0));\n if (isFailure(resultA)) {\n return resultA;\n }\n\n const resultB = parseB(rawValue[1], ctx.forSubtree(1));\n if (isFailure(resultB)) {\n return resultB;\n }\n\n const resultC = parseC(rawValue[2], ctx.forSubtree(2));\n if (isFailure(resultC)) {\n return resultC;\n }\n\n return ctx.success([resultA.value, resultB.value, resultC.value]);\n };\n}\n","import {isSuccess} from \"../result\";\n\nimport type {Parser} from \"../parser-types\";\n\nexport function union<T>(parseBranch: Parser<T>): UnionBuilder<T> {\n return new UnionBuilder(parseBranch);\n}\n\nexport class UnionBuilder<T> {\n constructor(public parser: Parser<T>) {}\n\n or<New>(newBranch: Parser<New>) {\n return new UnionBuilder<T | New>(either(this.parser, newBranch));\n }\n}\n\nfunction either<A, B>(parseA: Parser<A>, parseB: Parser<B>): Parser<A | B> {\n return (rawValue, ctx) => {\n const resultA = parseA(rawValue, ctx);\n if (isSuccess(resultA)) {\n return resultA;\n }\n\n return parseB(rawValue, ctx);\n };\n}\n","import {number, object} from \"../general-purpose-parsers\";\n\nexport const parsePerseusImageDetail = object({\n width: number,\n height: number,\n});\n","import {record, string} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parsePerseusImageDetail} from \"./perseus-image-detail\";\n\nimport type {PerseusImageDetail} from \"../../data-schema\";\nimport type {Parser} from \"../parser-types\";\n\nexport const parseImages: Parser<{[key: string]: PerseusImageDetail}> =\n defaulted(record(string, parsePerseusImageDetail), () => ({}));\n","import {\n boolean,\n nullable,\n number,\n object,\n objectWithAllPropertiesRequired,\n optional,\n string,\n} from \"../general-purpose-parsers\";\n\nimport type {WidgetOptions} from \"../../data-schema\";\nimport type {Parser} from \"../parser-types\";\n\nexport function parseWidget<Type extends string, Options extends object>(\n parseType: Parser<Type>,\n parseOptions: Parser<Options>,\n): Parser<WidgetOptions<Type, Options>> {\n return objectWithAllPropertiesRequired({\n type: parseType,\n static: optional(boolean),\n graded: optional(boolean),\n alignment: optional(string),\n options: parseOptions,\n key: optional(nullable(number)),\n version: optional(\n object({\n major: number,\n minor: number,\n }),\n ),\n });\n}\n\nexport function parseWidgetWithVersion<\n Version extends {major: number; minor: number} | undefined,\n Type extends string,\n Options extends object,\n>(\n parseVersion: Parser<Version>,\n parseType: Parser<Type>,\n parseOptions: Parser<Options>,\n): Parser<WidgetOptions<Type, Options>> {\n return objectWithAllPropertiesRequired({\n type: parseType,\n static: optional(boolean),\n graded: optional(boolean),\n alignment: optional(string),\n options: parseOptions,\n key: optional(nullable(number)),\n version: parseVersion,\n });\n}\n","import {\n array,\n boolean,\n constant,\n number,\n object,\n optional,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseCategorizerWidget = parseWidget(\n constant(\"categorizer\"),\n object({\n items: array(string),\n categories: array(string),\n randomizeItems: defaulted(boolean, () => false),\n static: defaulted(boolean, () => false),\n values: defaulted(array(defaulted(number, () => 0)), () => []),\n highlightLint: optional(boolean),\n linterContext: optional(\n object({\n contentType: string,\n paths: array(string),\n stack: array(string),\n }),\n ),\n }),\n);\n","import {\n any,\n array,\n boolean,\n constant,\n number,\n object,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseCSProgramWidget = parseWidget(\n constant(\"cs-program\"),\n object({\n programID: string,\n programType: any,\n settings: array(object({name: string, value: string})),\n showEditor: boolean,\n showButtons: boolean,\n height: number,\n static: defaulted(boolean, () => false),\n }),\n);\n","import {boolean, constant, object, string} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseDefinitionWidget = parseWidget(\n constant(\"definition\"),\n object({\n togglePrompt: string,\n definition: string,\n static: defaulted(boolean, () => false),\n }),\n);\n","import {\n array,\n boolean,\n constant,\n object,\n string,\n optional,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseDropdownWidget = parseWidget(\n constant(\"dropdown\"),\n object({\n placeholder: defaulted(string, () => \"\"),\n ariaLabel: optional(string),\n visibleLabel: optional(string),\n static: defaulted(boolean, () => false),\n choices: array(\n object({\n content: string,\n correct: defaulted(boolean, () => false),\n }),\n ),\n }),\n);\n","import {boolean, constant, object, string} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\nimport {parseWidgetsMap} from \"./widgets-map\";\n\nexport const parseExplanationWidget = parseWidget(\n constant(\"explanation\"),\n object({\n showPrompt: string,\n hidePrompt: string,\n explanation: string,\n // We wrap parseWidgetsMap in a function here to make sure it is not\n // referenced before it is defined. There is an import cycle between\n // this file and widgets-map.ts that could cause it to be undefined.\n widgets: defaulted(\n (rawVal, ctx) => parseWidgetsMap(rawVal, ctx),\n () => ({}),\n ),\n static: defaulted(boolean, () => false),\n }),\n);\n","export const KeypadKeys = [\n \"PLUS\",\n \"MINUS\",\n \"NEGATIVE\",\n \"TIMES\",\n \"DIVIDE\",\n \"DECIMAL\",\n \"PERIOD\",\n \"PERCENT\",\n \"CDOT\",\n \"EQUAL\",\n \"NEQ\",\n \"GT\",\n \"LT\",\n \"GEQ\",\n \"LEQ\", // mobile native only\n \"FRAC_INCLUSIVE\", // mobile native only\n \"FRAC_EXCLUSIVE\", // mobile native only\n \"FRAC\",\n \"EXP\",\n \"EXP_2\",\n \"EXP_3\",\n \"SQRT\",\n \"CUBE_ROOT\",\n \"RADICAL\",\n \"LEFT_PAREN\",\n \"RIGHT_PAREN\",\n \"LN\",\n \"LOG\",\n \"LOG_N\",\n \"SIN\",\n \"COS\", // TODO(charlie): Add in additional Greek letters.,\n \"TAN\",\n \"PI\",\n \"THETA\",\n \"UP\",\n \"RIGHT\",\n \"DOWN\",\n \"LEFT\",\n \"BACKSPACE\",\n \"DISMISS\",\n \"JUMP_OUT_PARENTHESES\",\n \"JUMP_OUT_EXPONENT\",\n \"JUMP_OUT_BASE\",\n \"JUMP_INTO_NUMERATOR\",\n \"JUMP_OUT_NUMERATOR\",\n \"JUMP_OUT_DENOMINATOR\", // Multi-functional keys.\n \"NUM_0\",\n \"NUM_1\",\n \"NUM_2\",\n \"NUM_3\",\n \"NUM_4\",\n \"NUM_5\",\n \"NUM_6\",\n \"NUM_7\",\n \"NUM_8\",\n \"NUM_9\",\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\",\n] as const;\n\nexport type KeypadKey = (typeof KeypadKeys)[number];\n\nexport type KeypadType = \"FRACTION\" | \"EXPRESSION\";\n\nexport type KeypadConfiguration = {\n keypadType: KeypadType;\n extraKeys?: KeypadKey[];\n times?: boolean;\n scientific?: boolean;\n};\n\n// Used by KeypadContext to pass around a renderer reference\nexport interface KeypadContextRendererInterface {\n blur(): void;\n}\n","import * as KAS from \"@khanacademy/kas\";\n\nimport {\n type KeypadKey,\n type KeypadConfiguration,\n KeypadKeys,\n} from \"../../keypad\";\n\nimport type {PerseusExpressionWidgetOptions} from \"../../data-schema\";\n\n/**\n * Scrape the answer forms for any variables or contants (like Pi)\n * that need to be included as keys on the keypad.\n */\nfunction deriveExtraKeys(\n widgetOptions: PerseusExpressionWidgetOptions,\n): KeypadConfiguration[\"extraKeys\"] {\n if (widgetOptions.extraKeys) {\n return widgetOptions.extraKeys;\n }\n\n // If there are no extra symbols available, we include Pi anyway, so\n // that the \"extra symbols\" button doesn't appear empty.\n const defaultKeys: KeypadKey[] = [\"PI\"];\n\n if (widgetOptions.answerForms == null) {\n return defaultKeys;\n }\n\n // Extract any and all variables and constants from the answer forms.\n const uniqueExtraVariables: Partial<Record<KeypadKey, boolean>> = {};\n const uniqueExtraConstants: Partial<Record<KeypadKey, boolean>> = {};\n for (const answerForm of widgetOptions.answerForms) {\n const maybeExpr = KAS.parse(answerForm.value, widgetOptions);\n if (maybeExpr.parsed) {\n const expr = maybeExpr.expr;\n\n // The keypad expects Greek letters to be capitalized (e.g., it\n // requires `PI` instead of `pi`). Right now, it only supports Pi\n // and Theta, so we special-case.\n const isGreek = (symbol: any) =>\n symbol === \"pi\" || symbol === \"theta\";\n const toKey = (symbol: any) =>\n isGreek(symbol) ? symbol.toUpperCase() : symbol;\n const isKey = (key: string): key is KeypadKey =>\n KeypadKeys.includes(key as KeypadKey);\n\n for (const variable of expr.getVars()) {\n const maybeKey = toKey(variable);\n if (isKey(maybeKey)) {\n uniqueExtraVariables[maybeKey] = true;\n }\n }\n for (const constant of expr.getConsts()) {\n const maybeKey = toKey(constant);\n if (isKey(maybeKey)) {\n uniqueExtraConstants[maybeKey] = true;\n }\n }\n }\n }\n\n // TODO(charlie): Alert the keypad as to which of these symbols should be\n // treated as functions.\n const extraVariables = Object.keys(\n uniqueExtraVariables,\n ).sort() as ReadonlyArray<KeypadKey>;\n\n const extraConstants = Object.keys(\n uniqueExtraConstants,\n ).sort() as ReadonlyArray<KeypadKey>;\n\n const extraKeys = [...extraVariables, ...extraConstants];\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!extraKeys.length) {\n return defaultKeys;\n }\n\n return extraKeys;\n}\n\nexport default deriveExtraKeys;\n","import type {PartialParser} from \"../parser-types\";\n\n// Given a function, creates a PartialParser that converts one type to another\n// using that function. The returned parser never fails.\nexport function convert<A, B>(f: (value: A) => B): PartialParser<A, B> {\n return (rawValue, ctx) => ctx.success(f(rawValue));\n}\n","import {array, enumeration} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nconst parseLegacyButtonSet = enumeration(\n \"basic\",\n \"basic+div\",\n \"trig\",\n \"prealgebra\",\n \"logarithms\",\n \"basic relations\",\n \"advanced relations\",\n \"scientific\",\n);\n\nexport const parseLegacyButtonSets = defaulted(\n array(parseLegacyButtonSet),\n // NOTE(benchristel): I copied the default buttonSets from\n // expression.tsx. See the parse-perseus-json/README.md for\n // an explanation of why we want to duplicate the default here.\n () => [\n \"basic\" as const,\n \"trig\" as const,\n \"prealgebra\" as const,\n \"logarithms\" as const,\n ],\n);\n","import {\n isPlainObject,\n number,\n object,\n pipeParsers,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\nimport {isFailure} from \"../result\";\n\nimport type {Version} from \"../../data-schema\";\nimport type {ParseContext, Parser} from \"../parser-types\";\n\ntype Versioned = {\n version?: Version;\n};\n\n/**\n * Creates a parser for a widget options type with multiple major versions. Old\n * versions are migrated to the latest version. The parse fails if the input\n * data does not match any of the versions.\n *\n * @example\n * const parseOptions = versionedWidgetOptions(3, parseOptionsV3)\n * .withMigrationFrom(2, parseOptionsV2, migrateV2ToV3)\n * .withMigrationFrom(1, parseOptionsV1, migrateV1ToV2)\n * .withMigrationFrom(0, parseOptionsV0, migrateV0ToV1)\n * .parser;\n *\n * @param latestMajorVersion the latest major version of the widget options.\n * @param parseLatest a {@link Parser} for the latest version of the widget\n * options.\n * @returns a builder object, to which migrations from earlier versions can be\n * added. Migrations must be added in \"reverse chronological\" order as in the\n * example above.\n */\nexport function versionedWidgetOptions<Latest extends Versioned>(\n latestMajorVersion: number,\n parseLatest: Parser<Latest>,\n): VersionedWidgetOptionsParserBuilder<Latest, Latest> {\n return new VersionedWidgetOptionsParserBuilder(\n latestMajorVersion,\n parseLatest,\n (latest) => latest,\n (raw, ctx) =>\n ctx.failure(\"widget options with a known version number\", raw),\n );\n}\n\nclass VersionedWidgetOptionsParserBuilder<\n // The latest version of the widget options\n Latest extends Versioned,\n // A version of the widget options which we want to migrate to Latest.\n MigratableWidgetOptions extends Versioned,\n> {\n public parser: Parser<Latest>;\n\n constructor(\n majorVersion: number,\n parseThisVersion: Parser<MigratableWidgetOptions>,\n private migrateToLatest: (m: MigratableWidgetOptions) => Latest,\n private parseOtherVersions: Parser<Latest>,\n ) {\n const parseThisVersionAndMigrateToLatest = pipeParsers(\n parseThisVersion,\n ).then(convert(this.migrateToLatest)).parser;\n\n this.parser = (raw: unknown, ctx: ParseContext) => {\n if (!isPlainObject(raw)) {\n return ctx.failure(\"object\", raw);\n }\n\n const versionParseResult = parseVersionedObject(raw, ctx);\n if (isFailure(versionParseResult)) {\n return versionParseResult;\n }\n\n if (versionParseResult.value.version.major !== majorVersion) {\n return this.parseOtherVersions(raw, ctx);\n }\n\n return parseThisVersionAndMigrateToLatest(raw, ctx);\n };\n }\n\n /**\n * Add a migration from an old version of the widget options.\n */\n withMigrationFrom<Old extends Versioned>(\n majorVersion: number,\n parseOldVersion: Parser<Old>,\n migrateToNextVersion: (old: Old) => MigratableWidgetOptions,\n ): VersionedWidgetOptionsParserBuilder<Latest, Old> {\n const parseOtherVersions = this.parser;\n\n const migrateToLatest = (old: Old) =>\n this.migrateToLatest(migrateToNextVersion(old));\n\n return new VersionedWidgetOptionsParserBuilder(\n majorVersion,\n parseOldVersion,\n migrateToLatest,\n parseOtherVersions,\n );\n }\n}\n\nconst parseVersionedObject = object({\n version: defaulted(object({major: number, minor: number}), () => ({\n major: 0,\n minor: 0,\n })),\n});\n","import {KeypadKeys} from \"../../keypad\";\nimport deriveExtraKeys from \"../../widgets/expression/derive-extra-keys\";\nimport {\n array,\n boolean,\n constant,\n enumeration,\n number,\n object,\n optional,\n pipeParsers,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseLegacyButtonSets} from \"./legacy-button-sets\";\nimport {versionedWidgetOptions} from \"./versioned-widget-options\";\nimport {parseWidgetWithVersion} from \"./widget\";\n\nimport type {ParsedValue} from \"../parser-types\";\n\nconst stringOrNumberOrNullOrUndefined = union(string)\n .or(number)\n .or(constant(null))\n .or(constant(undefined)).parser;\n\nfunction numberOrNullToString(v: string | number | null | undefined) {\n return typeof v === \"number\" || v === null ? String(v) : v;\n}\n\nconst parsePossiblyInvalidAnswerForm = object({\n // `value` is the possibly invalid part of this. It should always be a\n // string, but some answer forms don't have it. The Expression widget\n // ignores invalid values, so we can safely filter them out during parsing.\n value: optional(string),\n form: defaulted(boolean, () => false),\n simplify: defaulted(boolean, () => false),\n considered: enumeration(\"correct\", \"wrong\", \"ungraded\"),\n key: pipeParsers(stringOrNumberOrNullOrUndefined).then(\n convert(numberOrNullToString),\n ).parser,\n});\n\nfunction removeInvalidAnswerForms(\n possiblyInvalid: Array<ParsedValue<typeof parsePossiblyInvalidAnswerForm>>,\n) {\n return possiblyInvalid.flatMap((answerForm) => {\n const {value} = answerForm;\n if (value != null) {\n return [{...answerForm, value}];\n }\n return [];\n });\n}\n\nconst parseAnswerForms = pipeParsers(\n defaulted(array(parsePossiblyInvalidAnswerForm), () => []),\n).then(convert(removeInvalidAnswerForms)).parser;\n\nconst version2 = object({major: constant(2), minor: number});\nconst parseExpressionWidgetV2 = parseWidgetWithVersion(\n version2,\n constant(\"expression\"),\n object({\n answerForms: parseAnswerForms,\n functions: array(string),\n times: boolean,\n visibleLabel: optional(string),\n ariaLabel: optional(string),\n buttonSets: parseLegacyButtonSets,\n buttonsVisible: optional(enumeration(\"always\", \"never\", \"focused\")),\n extraKeys: optional(array(enumeration(...KeypadKeys))),\n }),\n);\n\nconst version1 = object({major: constant(1), minor: number});\nconst parseExpressionWidgetV1 = parseWidgetWithVersion(\n version1,\n constant(\"expression\"),\n object({\n answerForms: parseAnswerForms,\n functions: array(string),\n times: boolean,\n visibleLabel: optional(string),\n ariaLabel: optional(string),\n buttonSets: parseLegacyButtonSets,\n buttonsVisible: optional(enumeration(\"always\", \"never\", \"focused\")),\n }),\n);\n\nfunction migrateV1ToV2(\n widget: ParsedValue<typeof parseExpressionWidgetV1>,\n): ParsedValue<typeof parseExpressionWidgetV2> {\n const {options} = widget;\n return {\n ...widget,\n version: {major: 2, minor: 0},\n options: {\n times: options.times,\n buttonSets: options.buttonSets,\n functions: options.functions,\n buttonsVisible: options.buttonsVisible,\n visibleLabel: options.visibleLabel,\n ariaLabel: options.ariaLabel,\n answerForms: options.answerForms,\n extraKeys: deriveExtraKeys(options) ?? [],\n },\n };\n}\n\nconst version0 = optional(object({major: constant(0), minor: number}));\nconst parseExpressionWidgetV0 = parseWidgetWithVersion(\n version0,\n constant(\"expression\"),\n object({\n functions: array(string),\n times: boolean,\n visibleLabel: optional(string),\n ariaLabel: optional(string),\n form: boolean,\n simplify: boolean,\n value: string,\n buttonSets: parseLegacyButtonSets,\n buttonsVisible: optional(enumeration(\"always\", \"never\", \"focused\")),\n }),\n);\n\nfunction migrateV0ToV1(\n widget: ParsedValue<typeof parseExpressionWidgetV0>,\n): ParsedValue<typeof parseExpressionWidgetV1> {\n const {options} = widget;\n return {\n ...widget,\n version: {major: 1, minor: 0},\n options: {\n times: options.times,\n buttonSets: options.buttonSets as any,\n functions: options.functions,\n buttonsVisible: options.buttonsVisible,\n visibleLabel: options.visibleLabel,\n ariaLabel: options.ariaLabel,\n\n answerForms: [\n {\n considered: \"correct\",\n form: options.form,\n simplify: options.simplify,\n value: options.value,\n },\n ],\n },\n };\n}\n\nexport const parseExpressionWidget = versionedWidgetOptions(\n 2,\n parseExpressionWidgetV2,\n)\n .withMigrationFrom(1, parseExpressionWidgetV1, migrateV1ToV2)\n .withMigrationFrom(0, parseExpressionWidgetV0, migrateV0ToV1).parser;\n","import {\n array,\n boolean,\n constant,\n number,\n object,\n string,\n} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nimport type {FreeResponseWidget} from \"../../data-schema\";\nimport type {Parser} from \"../parser-types\";\n\nexport const parseFreeResponseWidget: Parser<FreeResponseWidget> = parseWidget(\n constant(\"free-response\"),\n object({\n allowUnlimitedCharacters: boolean,\n characterLimit: number,\n placeholder: string,\n question: string,\n scoringCriteria: array(\n object({\n text: string,\n }),\n ),\n }),\n);\n","import {\n boolean,\n constant,\n nullable,\n number,\n object,\n optional,\n pipeParsers,\n record,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parsePerseusRenderer} from \"./perseus-renderer\";\nimport {parseWidget} from \"./widget\";\nimport {parseWidgetsMap} from \"./widgets-map\";\n\nconst falseToNull = pipeParsers(constant(false)).then(\n convert(() => null),\n).parser;\nexport const parseGradedGroupWidgetOptions = object({\n title: defaulted(string, () => \"\"),\n hasHint: optional(nullable(boolean)),\n // This module has an import cycle with parsePerseusRenderer.\n // The anonymous function below ensures that we don't try to access\n // parsePerseusRenderer before it's defined.\n hint: union(falseToNull)\n .or(constant(null))\n .or(constant(undefined))\n .or((rawVal, ctx) => parsePerseusRenderer(rawVal, ctx)).parser,\n content: string,\n // This module has an import cycle with parseWidgetsMap.\n // The anonymous function below ensures that we don't try to access\n // parseWidgetsMap before it's defined.\n widgets: (rawVal, ctx) => parseWidgetsMap(rawVal, ctx),\n widgetEnabled: optional(nullable(boolean)),\n immutableWidgets: optional(nullable(boolean)),\n images: record(\n string,\n object({\n width: number,\n height: number,\n }),\n ),\n});\n\nexport const parseGradedGroupWidget = parseWidget(\n constant(\"graded-group\"),\n parseGradedGroupWidgetOptions,\n);\n","import {array, constant, object} from \"../general-purpose-parsers\";\n\nimport {parseGradedGroupWidgetOptions} from \"./graded-group-widget\";\nimport {parseWidget} from \"./widget\";\n\nexport const parseGradedGroupSetWidget = parseWidget(\n constant(\"graded-group-set\"),\n object({gradedGroups: array(parseGradedGroupWidgetOptions)}),\n);\n","import {isPlainObject} from \"./is-plain-object\";\n\nimport type {ParseContext, Parser} from \"../parser-types\";\n\ntype Primitive = number | string | boolean | null | undefined;\n\n/**\n * discriminatedUnion() should be preferred over union() when parsing a\n * discriminated union type, because discriminatedUnion() produces more\n * understandable failure messages. It takes the discriminant as the source of\n * truth for which variant is to be parsed, and expects the other data to match\n * that variant.\n */\nexport function discriminatedUnionOn<DK extends string>(discriminantKey: DK) {\n const noMoreBranches: Parser<never> = (raw: unknown, ctx: ParseContext) => {\n if (!isPlainObject(raw)) {\n return ctx.failure(\"object\", raw);\n }\n return ctx\n .forSubtree(discriminantKey)\n .failure(\"a valid value\", raw[discriminantKey]);\n };\n\n return new DiscriminatedUnionBuilder(discriminantKey, noMoreBranches);\n}\n\nclass DiscriminatedUnionBuilder<\n DK extends string,\n Union extends {[k in DK]: Primitive},\n> {\n constructor(\n private discriminantKey: DK,\n public parser: Parser<Union>,\n ) {}\n\n withBranch<Variant extends {[k in DK]: Primitive}>(\n discriminantValue: Primitive,\n parseNewVariant: Parser<Variant>,\n ): DiscriminatedUnionBuilder<DK, Union | Variant> {\n const parseNewBranch = discriminatedUnionBranch(\n this.discriminantKey,\n discriminantValue,\n parseNewVariant,\n this.parser,\n );\n\n return new DiscriminatedUnionBuilder(\n this.discriminantKey,\n parseNewBranch,\n );\n }\n}\n\nfunction discriminatedUnionBranch<\n DK extends string,\n DV extends Primitive,\n Variant extends {[k in DK]: DV},\n Rest extends {[k in DK]: DV},\n>(\n discriminantKey: DK,\n discriminantValue: DV,\n parseVariant: Parser<Variant>,\n parseOtherBranches: Parser<Rest>,\n): Parser<Variant | Rest> {\n return (raw: unknown, ctx: ParseContext) => {\n if (!isPlainObject(raw)) {\n return ctx.failure(\"object\", raw);\n }\n\n if (raw[discriminantKey] === discriminantValue) {\n return parseVariant(raw, ctx);\n }\n\n return parseOtherBranches(raw, ctx);\n };\n}\n","import {\n array,\n boolean,\n constant,\n enumeration,\n nullable,\n number,\n object,\n optional,\n pair,\n pipeParsers,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\nimport {discriminatedUnionOn} from \"../general-purpose-parsers/discriminated-union\";\n\nimport {parseWidget} from \"./widget\";\n\nimport type {Parser} from \"../parser-types\";\n\nconst pairOfNumbers = pair(number, number);\n\nconst pairOfPoints = pair(pairOfNumbers, pairOfNumbers);\n\nconst emptyArray: Parser<[]> = (rawVal, ctx) => {\n if (Array.isArray(rawVal) && rawVal.length === 0) {\n return ctx.success([]);\n }\n return ctx.failure(\"empty array\", rawVal);\n};\n\nconst parseCoords = union(nullable(pairOfPoints)).or(\n // We convert [] to null to support some legacy content items.\n // The widget component treats [] and null the same as of 2025-05.\n pipeParsers(emptyArray).then(convert(() => null)).parser,\n).parser;\n\nconst parseCorrect = defaulted(\n discriminatedUnionOn(\"type\")\n .withBranch(\n \"absolute_value\",\n object({\n type: constant(\"absolute_value\"),\n coords: parseCoords,\n }),\n )\n .withBranch(\n \"exponential\",\n object({\n type: constant(\"exponential\"),\n asymptote: pairOfPoints,\n coords: parseCoords,\n }),\n )\n .withBranch(\n \"linear\",\n object({\n type: constant(\"linear\"),\n coords: parseCoords,\n }),\n )\n .withBranch(\n \"logarithm\",\n object({\n type: constant(\"logarithm\"),\n asymptote: pairOfPoints,\n coords: parseCoords,\n }),\n )\n .withBranch(\n \"quadratic\",\n object({\n type: constant(\"quadratic\"),\n coords: parseCoords,\n }),\n )\n .withBranch(\n \"sinusoid\",\n object({\n type: constant(\"sinusoid\"),\n coords: parseCoords,\n }),\n )\n .withBranch(\n \"tangent\",\n object({\n type: constant(\"tangent\"),\n coords: parseCoords,\n }),\n ).parser,\n // Default value. This is the same as the default in DEFAULT_GRAPHER_PROPS,\n // in grapher/util.tsx. See parse-perseus-json/README.md for an explanation\n // of why we want to duplicate defaults in the parser.\n () => ({\n type: \"linear\" as const,\n coords: null,\n }),\n);\n\nexport const parseGrapherWidget = parseWidget(\n constant(\"grapher\"),\n object({\n availableTypes: array(\n enumeration(\n \"absolute_value\",\n \"exponential\",\n \"linear\",\n \"logarithm\",\n \"quadratic\",\n \"sinusoid\",\n \"tangent\",\n ),\n ),\n correct: parseCorrect,\n graph: object({\n backgroundImage: object({\n bottom: optional(number),\n height: optional(number),\n left: optional(number),\n scale: optional(number),\n url: optional(nullable(string)),\n width: optional(number),\n }),\n box: optional(pairOfNumbers),\n editableSettings: optional(\n array(enumeration(\"graph\", \"snap\", \"image\", \"measure\")),\n ),\n gridStep: optional(pairOfNumbers),\n labels: pair(string, string),\n markings: enumeration(\"graph\", \"none\", \"grid\", \"axes\"),\n range: pair(pairOfNumbers, pairOfNumbers),\n rulerLabel: constant(\"\"),\n rulerTicks: number,\n showProtractor: optional(boolean),\n showRuler: optional(boolean),\n showTooltips: optional(boolean),\n snapStep: optional(pairOfNumbers),\n step: pairOfNumbers,\n valid: optional(union(boolean).or(string).parser),\n }),\n }),\n);\n","import {constant} from \"../general-purpose-parsers\";\n\nimport {parsePerseusRenderer} from \"./perseus-renderer\";\nimport {parseWidget} from \"./widget\";\n\nexport const parseGroupWidget = parseWidget(\n constant(\"group\"),\n // This module has an import cycle with parsePerseusRenderer.\n // The anonymous function below ensures that we don't try to access\n // parsePerseusRenderer before it's defined.\n (rawVal, ctx) => parsePerseusRenderer(rawVal, ctx),\n);\n","import {\n array,\n boolean,\n constant,\n number,\n object,\n optional,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseIframeWidget = parseWidget(\n constant(\"iframe\"),\n object({\n url: string,\n settings: optional(array(object({name: string, value: string}))),\n width: union(number).or(string).parser,\n height: union(number).or(string).parser,\n allowFullScreen: defaulted(boolean, () => false),\n allowTopNavigation: optional(boolean),\n static: defaulted(boolean, () => false),\n }),\n);\n","import type {PartialParser} from \"../parser-types\";\n\nexport const stringToNumber: PartialParser<string | number, number> = (\n rawValue,\n ctx,\n) => {\n if (typeof rawValue === \"number\") {\n return ctx.success(rawValue);\n }\n\n const parsedNumber = +rawValue;\n if (rawValue === \"\" || isNaN(parsedNumber)) {\n return ctx.failure(\"a number or numeric string\", rawValue);\n }\n\n return ctx.success(parsedNumber);\n};\n","import {\n nullable,\n number,\n object,\n optional,\n pipeParsers,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\nimport {stringToNumber} from \"../general-purpose-parsers/string-to-number\";\n\nfunction emptyToZero(x: string | number): string | number {\n return x === \"\" ? 0 : x;\n}\n\nconst imageDimensionToNumber = pipeParsers(union(number).or(string).parser)\n // In this specific case, empty string is equivalent to zero. An empty\n // string parses to either NaN (using parseInt) or 0 (using unary +) and\n // CSS will treat NaN as invalid and default to 0 instead.\n .then(convert(emptyToZero))\n .then(stringToNumber).parser;\n\nconst dimensionOrUndefined = defaulted(\n optional(imageDimensionToNumber),\n () => undefined,\n);\n\nexport const parsePerseusImageBackground = object({\n url: optional(nullable(string)),\n width: dimensionOrUndefined,\n height: dimensionOrUndefined,\n top: dimensionOrUndefined,\n left: dimensionOrUndefined,\n bottom: dimensionOrUndefined,\n scale: dimensionOrUndefined,\n});\n","import {\n array,\n boolean,\n constant,\n number,\n object,\n optional,\n pair,\n string,\n} from \"../general-purpose-parsers\";\n\nimport {parsePerseusImageBackground} from \"./perseus-image-background\";\nimport {parseWidget} from \"./widget\";\n\nconst pairOfNumbers = pair(number, number);\n\nexport const parseImageWidget = parseWidget(\n constant(\"image\"),\n object({\n title: optional(string),\n caption: optional(string),\n alt: optional(string),\n longDescription: optional(string),\n decorative: optional(boolean),\n backgroundImage: parsePerseusImageBackground,\n static: optional(boolean),\n labels: optional(\n array(\n object({\n content: string,\n alignment: string,\n coordinates: array(number),\n }),\n ),\n ),\n range: optional(pair(pairOfNumbers, pairOfNumbers)),\n box: optional(pairOfNumbers),\n }),\n);\n","import {\n boolean,\n constant,\n enumeration,\n number,\n object,\n optional,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nimport type {Parser} from \"../parser-types\";\n\nconst booleanToString: Parser<string> = (rawValue, ctx) => {\n if (typeof rawValue === \"boolean\") {\n return ctx.success(String(rawValue));\n }\n return ctx.failure(\"boolean\", rawValue);\n};\n\nexport const parseInputNumberWidget = parseWidget(\n constant(\"input-number\"),\n object({\n answerType: optional(\n enumeration(\n \"number\",\n \"decimal\",\n \"integer\",\n \"rational\",\n \"improper\",\n \"mixed\",\n \"percent\",\n \"pi\",\n ),\n ),\n inexact: optional(boolean),\n maxError: optional(union(number).or(string).parser),\n rightAlign: optional(boolean),\n simplify: enumeration(\"required\", \"optional\", \"enforced\"),\n size: enumeration(\"normal\", \"small\"),\n // TODO(benchristel): there are some content items where value is a\n // boolean, even though that makes no sense. We should figure out if\n // those content items are actually published anywhere, and consider\n // updating them.\n value: defaulted(\n union(number).or(string).or(booleanToString).parser,\n () => 0,\n ),\n customKeypad: optional(boolean),\n }),\n);\n","import {\n array,\n boolean,\n constant,\n enumeration,\n number,\n object,\n optional,\n pair,\n pipeParsers,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\nimport {discriminatedUnionOn} from \"../general-purpose-parsers/discriminated-union\";\n\nimport {parsePerseusImageBackground} from \"./perseus-image-background\";\nimport {parseWidget} from \"./widget\";\n\nconst pairOfNumbers = pair(number, number);\nconst stringOrEmpty = defaulted(string, () => \"\");\n\nconst parseKey = pipeParsers(optional(string)).then(convert(String)).parser;\n\nconst parseFunctionElement = object({\n type: constant(\"function\"),\n key: parseKey,\n options: object({\n value: string,\n funcName: string,\n rangeMin: string,\n rangeMax: string,\n color: string,\n strokeDasharray: string,\n strokeWidth: number,\n }),\n});\n\nconst parseLabelElement = object({\n type: constant(\"label\"),\n key: parseKey,\n options: object({\n label: string,\n color: string,\n coordX: string,\n coordY: string,\n }),\n});\n\nconst parseLineElement = object({\n type: constant(\"line\"),\n key: parseKey,\n options: object({\n color: string,\n startX: string,\n startY: string,\n endX: string,\n endY: string,\n strokeDasharray: string,\n strokeWidth: number,\n arrows: string,\n }),\n});\n\nconst parseMovableLineElement = object({\n type: constant(\"movable-line\"),\n key: parseKey,\n options: object({\n startX: string,\n startY: string,\n startSubscript: number,\n endX: string,\n endY: string,\n endSubscript: number,\n constraint: string,\n snap: number,\n constraintFn: string,\n constraintXMin: string,\n constraintXMax: string,\n constraintYMin: string,\n constraintYMax: string,\n }),\n});\n\nconst parseMovablePointElement = object({\n type: constant(\"movable-point\"),\n key: parseKey,\n options: object({\n startX: string,\n startY: string,\n varSubscript: number,\n constraint: string,\n snap: number,\n constraintFn: string,\n constraintXMin: stringOrEmpty,\n constraintXMax: stringOrEmpty,\n constraintYMin: stringOrEmpty,\n constraintYMax: stringOrEmpty,\n }),\n});\n\nconst parseParametricElement = object({\n type: constant(\"parametric\"),\n key: parseKey,\n options: object({\n x: string,\n y: string,\n rangeMin: string,\n rangeMax: string,\n color: string,\n strokeDasharray: string,\n strokeWidth: number,\n }),\n});\n\nconst parsePointElement = object({\n type: constant(\"point\"),\n key: parseKey,\n options: object({\n color: string,\n coordX: string,\n coordY: string,\n }),\n});\n\nconst parseRectangleElement = object({\n type: constant(\"rectangle\"),\n key: parseKey,\n options: object({\n color: string,\n coordX: string,\n coordY: string,\n width: string,\n height: string,\n }),\n});\n\nexport const parseInteractionWidget = parseWidget(\n constant(\"interaction\"),\n object({\n static: defaulted(boolean, () => false),\n graph: object({\n editableSettings: optional(array(enumeration(\"canvas\", \"graph\"))),\n box: pairOfNumbers,\n labels: array(string),\n range: pair(pairOfNumbers, pairOfNumbers),\n gridStep: pairOfNumbers,\n markings: enumeration(\"graph\", \"grid\", \"none\", \"axes\"),\n snapStep: optional(pairOfNumbers),\n valid: optional(union(boolean).or(string).parser),\n backgroundImage: optional(parsePerseusImageBackground),\n showProtractor: optional(boolean),\n showRuler: optional(boolean),\n rulerLabel: optional(string),\n rulerTicks: optional(number),\n tickStep: pairOfNumbers,\n }),\n elements: array(\n discriminatedUnionOn(\"type\")\n .withBranch(\"function\", parseFunctionElement)\n .withBranch(\"label\", parseLabelElement)\n .withBranch(\"line\", parseLineElement)\n .withBranch(\"movable-line\", parseMovableLineElement)\n .withBranch(\"movable-point\", parseMovablePointElement)\n .withBranch(\"parametric\", parseParametricElement)\n .withBranch(\"point\", parsePointElement)\n .withBranch(\"rectangle\", parseRectangleElement).parser,\n ),\n }),\n);\n","/* eslint-disable max-lines */\n/**\n * The Perseus \"data schema\" file.\n *\n * This file, and the types in it, represents the \"data schema\" that Perseus\n * uses. The @khanacademy/perseus-editor package edits and produces objects\n * that conform to the types in this file. Similarly, the top-level renderers\n * in @khanacademy/perseus, consume objects that conform to these types.\n *\n * WARNING: This file should not import any types from elsewhere so that it is\n * easy to reason about changes that alter the Perseus schema. This helps\n * ensure that it is not changed accidentally when upgrading a dependant\n * package or other part of Perseus code. Note that TypeScript does type\n * checking via something called \"structural typing\". This means that as long\n * as the shape of a type matches, the name it goes by doesn't matter. As a\n * result, a `Coord` type that looks like this `[x: number, y: number]` is\n * _identical_, in TypeScript's eyes, to this `Vector2` type `[x: number, y:\n * number]`. Also, with tuples, the labels for each entry is ignored, so `[x:\n * number, y: number]` is compatible with `[min: number, max: number]`. The\n * labels are for humans, not TypeScript. :)\n *\n * If you make changes to types in this file, be very sure that:\n *\n * a) the changes are backwards compatible. If they are not, old data from\n * previous versions of the \"schema\" could become unrenderable, or worse,\n * introduce hard-to-diagnose bugs.\n * b) the parsing code (`util/parse-perseus-json/`) is updated to handle\n * the new format _as well as_ the old format.\n */\n\n// TODO(LEMS-3080): Don't import KeypadKey here; data-schema.ts is supposed to\n// be independent of everything else.\nimport type {KeypadKey} from \"./keypad\";\n\n// TODO(FEI-4010): Remove `Perseus` prefix for all types here\n\nexport type Coord = [x: number, y: number];\nexport type Interval = [min: number, max: number];\nexport type Vector2 = Coord; // Same name as Mafs\nexport type Range = Interval;\nexport type Size = [width: number, height: number];\nexport type CollinearTuple = [Vector2, Vector2];\nexport type ShowSolutions = \"all\" | \"selected\" | \"none\";\nexport type ShowAxisArrows = {\n xMin: boolean;\n xMax: boolean;\n yMin: boolean;\n yMax: boolean;\n};\n\n/**\n * A utility type that constructs a widget map from a \"registry interface\".\n * The keys of the registry should be the widget type (aka, \"categorizer\" or\n * \"radio\", etc) and the value should be the option type stored in the value\n * of the map.\n *\n * You can think of this as a type that generates another type. We use\n * \"registry interfaces\" as a way to keep a set of widget types to their data\n * type in several places in Perseus. This type then allows us to generate a\n * map type that maps a widget id to its data type and keep strong typing by\n * widget id.\n *\n * For example, given a fictitious registry such as this:\n *\n * ```\n * interface DummyRegistry {\n * categorizer: { categories: string[] };\n * dropdown: { choices: string[] }:\n * }\n * ```\n *\n * If we create a DummyMap using this helper:\n *\n * ```\n * type DummyMap = MakeWidgetMap<DummyRegistry>;\n * ```\n *\n * We'll get a map that looks like this:\n *\n * ```\n * type DummyMap = {\n * `categorizer ${number}`: { categories: string[] };\n * `dropdown ${number}`: { choices: string[] };\n * }\n * ```\n *\n * We use interfaces for the registries so that they can be extended in cases\n * where the consuming app brings along their own widgets. Interfaces in\n * TypeScript are always open (ie. you can extend them) whereas types aren't.\n */\nexport type MakeWidgetMap<TRegistry> = {\n [Property in keyof TRegistry as `${Property & string} ${number}`]: TRegistry[Property];\n};\n\n/**\n * Our core set of Perseus widgets.\n *\n * This interface is the basis for \"registering\" all Perseus widget types.\n * There should be one key/value pair for each supported widget. If you create\n * a new widget, an entry should be added to this interface. Note that this\n * only registers the widget options type, you'll also need to register the\n * widget so that it's available at runtime (@see\n * {@link file://./widgets.ts#registerWidget}).\n *\n * Importantly, the key should be the name that is used in widget IDs. For most\n * widgets that is the same as the widget option's `type` field. In cases where\n * a widget has been deprecated and replaced with the deprecated-standin\n * widget, it should be the original widget type!\n *\n * If you define the widget outside of this package, you can still add the new\n * widget to this interface by writing the following in that package that\n * contains the widget. TypeScript will merge that definition of the\n * `PerseusWidgets` with the one defined below.\n *\n * ```typescript\n * declare module \"@khanacademy/perseus-core\" {\n * interface PerseusWidgetTypes {\n * // A new widget\n * \"new-awesomeness\": MyAwesomeNewWidget;\n *\n * // A deprecated widget\n * \"super-old-widget\": DeprecatedStandinWidget;\n * }\n * }\n *\n * // The new widget's options definition\n * type MyAwesomeNewWidget = WidgetOptions<'new-awesomeness', MyAwesomeNewWidgetOptions>;\n *\n * // The deprecated widget's options definition\n * type SuperOldWidget = WidgetOptions<'super-old-widget', object>;\n * ```\n *\n * This interface can be extended through the magic of TypeScript \"Declaration\n * merging\". Specifically, we augment this module and extend this interface.\n *\n * @see {@link https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation}\n */\nexport interface PerseusWidgetTypes {\n categorizer: CategorizerWidget;\n \"cs-program\": CSProgramWidget;\n definition: DefinitionWidget;\n dropdown: DropdownWidget;\n explanation: ExplanationWidget;\n expression: ExpressionWidget;\n \"free-response\": FreeResponseWidget;\n grapher: GrapherWidget;\n \"graded-group-set\": GradedGroupSetWidget;\n \"graded-group\": GradedGroupWidget;\n group: GroupWidget;\n iframe: IFrameWidget;\n image: ImageWidget;\n \"input-number\": InputNumberWidget;\n interaction: InteractionWidget;\n \"interactive-graph\": InteractiveGraphWidget;\n \"label-image\": LabelImageWidget;\n matcher: MatcherWidget;\n matrix: MatrixWidget;\n measurer: MeasurerWidget;\n \"molecule-renderer\": MoleculeRendererWidget;\n \"number-line\": NumberLineWidget;\n \"numeric-input\": NumericInputWidget;\n orderer: OrdererWidget;\n \"passage-ref-target\": RefTargetWidget;\n \"passage-ref\": PassageRefWidget;\n passage: PassageWidget;\n \"phet-simulation\": PhetSimulationWidget;\n \"python-program\": PythonProgramWidget;\n plotter: PlotterWidget;\n radio: RadioWidget;\n sorter: SorterWidget;\n table: TableWidget;\n video: VideoWidget;\n\n // Deprecated widgets\n \"lights-puzzle\": DeprecatedStandinWidget;\n sequence: DeprecatedStandinWidget;\n simulator: DeprecatedStandinWidget;\n transformer: DeprecatedStandinWidget;\n}\n\n/**\n * A map of widget IDs to widget options. This is most often used as the type\n * for a set of widgets defined in a `PerseusItem` but can also be useful to\n * represent a function parameter where only `widgets` from a `PerseusItem` are\n * needed. Today Widget IDs are made up of the widget type and an incrementing\n * integer (eg. `interactive-graph 1` or `radio 3`). It is suggested to avoid\n * reading/parsing the widget id to derive any information from it, except in\n * the case of this map.\n *\n * @see {@link PerseusWidgetTypes} additional widgets can be added to this map type\n * by augmenting the PerseusWidgetTypes with new widget types!\n */\nexport type PerseusWidgetsMap = MakeWidgetMap<PerseusWidgetTypes>;\n\n/**\n * PerseusWidget is a union of all the different types of widget options that\n * Perseus knows about.\n *\n * Thanks to it being based on PerseusWidgetTypes interface, this union is\n * automatically extended to include widgets used in tests without those widget\n * option types seeping into our production types.\n *\n * @see MockWidget for an example\n */\nexport type PerseusWidget = PerseusWidgetTypes[keyof PerseusWidgetTypes];\n\n/**\n * A \"PerseusItem\" is a classic Perseus item. It is rendered by the\n * `ServerItemRenderer` and the layout is pre-set.\n *\n * To render more complex Perseus items, see the `Item` type in the multi item\n * area.\n */\nexport type PerseusItem = {\n // The details of the question being asked to the user.\n question: PerseusRenderer;\n // A collection of hints to be offered to the user that support answering the question.\n hints: Hint[];\n // Details about the tools the user might need to answer the question\n answerArea: PerseusAnswerArea | null | undefined;\n};\n\n/**\n * A \"PerseusArticle\" is an item that is meant to be rendered as an article.\n * This item is never scored and is rendered by the `ArticleRenderer`.\n */\nexport type PerseusArticle = PerseusRenderer | PerseusRenderer[];\n\nexport type Version = {\n // The major part of the version\n major: number;\n // The minor part of the version\n minor: number;\n};\n\nexport type PerseusRenderer = {\n /**\n * Translatable Markdown content to be rendered. May include references to\n * widgets (as [[☃ widgetName]]) or images (as ).\n * For each image found in this content, there can be an entry in the\n * `images` dict (below) with the key being the image's url which defines\n * additional attributes for the image.\n */\n content: string;\n /**\n * A dictionary of {[widgetName]: Widget} to be referenced from the content\n * field.\n */\n widgets: PerseusWidgetsMap;\n /**\n * Formerly used in the PerseusGradedGroup widget. A list of \"tags\" that\n * are keys that represent other content in the system. Not rendered to\n * the user.\n * @deprecated\n */\n metadata?: any;\n /**\n * A dictionary of {[imageUrl]: PerseusImageDetail}.\n */\n images: {\n [imageUrl: string]: PerseusImageDetail;\n };\n};\n\nexport type Hint = PerseusRenderer & {\n /**\n * When `true`, causes the previous hint to be replaced with this hint when\n * displayed. When `false`, the previous hint remains visible when this one\n * is displayed. This allows for hints that build upon each other.\n */\n replace?: boolean;\n};\n\nexport type PerseusImageDetail = {\n // The width of the image\n width: number;\n // the height of the image\n height: number;\n};\n\nexport const ItemExtras = [\n // The user might benefit from using a Scientific Calculator. Provided on Khan Academy when true\n \"calculator\",\n // The user might benefit from a monthly payments calculator. Provided on Khan Academy when true\n \"financialCalculatorMonthlyPayment\",\n // The user might benefit from a total amount calculator. Provided on Khan Academy when true\n \"financialCalculatorTotalAmount\",\n // The user might benefit from a time to pay off calculator. Provided on Khan Academy when true\n \"financialCalculatorTimeToPayOff\",\n // The user might benefit from using a Periodic Table of Elements. Provided on Khan Academy when true\n \"periodicTable\",\n // The user might benefit from using a Periodic Table of Elements with key. Provided on Khan Academy when true\n \"periodicTableWithKey\",\n] as const;\nexport type PerseusAnswerArea = Record<(typeof ItemExtras)[number], boolean>;\n\n/**\n * The type representing the common structure of all widget's options. The\n * `Options` generic type represents the widget-specific option data.\n */\nexport type WidgetOptions<Type extends string, Options> = {\n // The \"type\" of widget which will define what the Options field looks like\n type: Type;\n // Whether this widget is displayed with the values and is immutable. For display only\n static?: boolean;\n // Whether a widget is scored. Usually true except for IFrame widgets (deprecated)\n // Default: true\n graded?: boolean;\n // The HTML alignment of the widget. \"default\" or \"block\"\n alignment?: string;\n // Options specific to the type field of the widget. See Perseus*WidgetOptions for more details\n options: Options;\n // Only used by interactive child widgets (line, point, etc) to identify the components\n key?: number | null;\n // The version of the widget data spec. Used to differentiate between newer and older content data.\n version?: Version;\n};\n\n// prettier-ignore\nexport type CategorizerWidget = WidgetOptions<'categorizer', PerseusCategorizerWidgetOptions>;\n// prettier-ignore\nexport type CSProgramWidget = WidgetOptions<'cs-program', PerseusCSProgramWidgetOptions>;\n// prettier-ignore\nexport type DefinitionWidget = WidgetOptions<'definition', PerseusDefinitionWidgetOptions>;\n// prettier-ignore\nexport type DropdownWidget = WidgetOptions<'dropdown', PerseusDropdownWidgetOptions>;\n// prettier-ignore\nexport type ExplanationWidget = WidgetOptions<'explanation', PerseusExplanationWidgetOptions>;\n// prettier-ignore\nexport type ExpressionWidget = WidgetOptions<'expression', PerseusExpressionWidgetOptions>;\n// prettier-ignore\nexport type FreeResponseWidget = WidgetOptions<'free-response', PerseusFreeResponseWidgetOptions>;\n// prettier-ignore\nexport type GradedGroupSetWidget = WidgetOptions<'graded-group-set', PerseusGradedGroupSetWidgetOptions>;\n// prettier-ignore\nexport type GradedGroupWidget = WidgetOptions<'graded-group', PerseusGradedGroupWidgetOptions>;\n// prettier-ignore\nexport type GrapherWidget = WidgetOptions<'grapher', PerseusGrapherWidgetOptions>;\n// prettier-ignore\nexport type GroupWidget = WidgetOptions<'group', PerseusGroupWidgetOptions>;\n// prettier-ignore\nexport type IFrameWidget = WidgetOptions<'iframe', PerseusIFrameWidgetOptions>;\n// prettier-ignore\nexport type ImageWidget = WidgetOptions<'image', PerseusImageWidgetOptions>;\n// prettier-ignore\nexport type InteractionWidget = WidgetOptions<'interaction', PerseusInteractionWidgetOptions>;\n// prettier-ignore\nexport type InteractiveGraphWidget = WidgetOptions<'interactive-graph', PerseusInteractiveGraphWidgetOptions>;\n// prettier-ignore\nexport type LabelImageWidget = WidgetOptions<'label-image', PerseusLabelImageWidgetOptions>;\n// prettier-ignore\nexport type MatcherWidget = WidgetOptions<'matcher', PerseusMatcherWidgetOptions>;\n// prettier-ignore\nexport type MatrixWidget = WidgetOptions<'matrix', PerseusMatrixWidgetOptions>;\n// prettier-ignore\nexport type MeasurerWidget = WidgetOptions<'measurer', PerseusMeasurerWidgetOptions>;\n// prettier-ignore\nexport type NumberLineWidget = WidgetOptions<'number-line', PerseusNumberLineWidgetOptions>;\n// prettier-ignore\nexport type NumericInputWidget = WidgetOptions<'numeric-input', PerseusNumericInputWidgetOptions>;\n// prettier-ignore\nexport type OrdererWidget = WidgetOptions<'orderer', PerseusOrdererWidgetOptions>;\n// prettier-ignore\nexport type PassageRefWidget = WidgetOptions<'passage-ref', PerseusPassageRefWidgetOptions>;\n// prettier-ignore\nexport type PassageWidget = WidgetOptions<'passage', PerseusPassageWidgetOptions>;\n// prettier-ignore\nexport type PhetSimulationWidget = WidgetOptions<'phet-simulation', PerseusPhetSimulationWidgetOptions>;\n// prettier-ignore\nexport type PlotterWidget = WidgetOptions<'plotter', PerseusPlotterWidgetOptions>;\n// prettier-ignore\nexport type PythonProgramWidget = WidgetOptions<'python-program', PerseusPythonProgramWidgetOptions>;\n// prettier-ignore\nexport type RadioWidget = WidgetOptions<'radio', PerseusRadioWidgetOptions>;\n// prettier-ignore\nexport type SorterWidget = WidgetOptions<'sorter', PerseusSorterWidgetOptions>;\n// prettier-ignore\nexport type TableWidget = WidgetOptions<'table', PerseusTableWidgetOptions>;\n// prettier-ignore\nexport type InputNumberWidget = WidgetOptions<'input-number', PerseusInputNumberWidgetOptions>;\n// prettier-ignore\nexport type MoleculeRendererWidget = WidgetOptions<'molecule-renderer', PerseusMoleculeRendererWidgetOptions>;\n// prettier-ignore\nexport type RefTargetWidget = WidgetOptions<'passage-ref-target', PerseusPassageRefTargetWidgetOptions>;\n// prettier-ignore\nexport type VideoWidget = WidgetOptions<'video', PerseusVideoWidgetOptions>;\n//prettier-ignore\nexport type DeprecatedStandinWidget = WidgetOptions<'deprecated-standin', object>;\n\n/**\n * A background image applied to various widgets.\n */\nexport type PerseusImageBackground = {\n // The URL of the image\n url?: string | null;\n // The width of the image\n width?: number;\n // The height of the image\n height?: number;\n // The top offset of the image\n top?: number;\n // The left offset of the image\n left?: number;\n // The scale of the image\n scale?: number;\n // The bottom offset of the image\n bottom?: number;\n};\n\n/**\n * The type of markings to display on the graph.\n * - axes: shows the axes without the gride lines\n * - graph: shows the axes and the grid lines\n * - grid: shows only the grid lines\n * - none: shows no markings\n */\nexport type MarkingsType = \"axes\" | \"graph\" | \"grid\" | \"none\";\nexport type AxisLabelLocation = \"onAxis\" | \"alongEdge\";\n\nexport type PerseusCategorizerWidgetOptions = {\n // Translatable text; a list of items to categorize. e.g. [\"banana\", \"yellow\", \"apple\", \"purple\", \"shirt\"]\n items: string[];\n // Translatable text; a list of categories. e.g. [\"fruits\", \"colors\", \"clothing\"]\n categories: string[];\n // Whether the items should be randemized\n randomizeItems: boolean;\n // Whether this widget is displayed with the results and immutable\n static: boolean;\n // The correct answers where index relates to the items and value relates to the category. e.g. [0, 1, 0, 1, 2]\n values: number[];\n // Whether we should highlight i18n linter errors found on this widget\n highlightLint?: boolean;\n};\n\nexport type PerseusDefinitionWidgetOptions = {\n // Translatable text; the word to define. e.g. \"vertex\"\n togglePrompt: string;\n // Translatable text; the definition of the word. e.g. \"where 2 rays connect\"\n definition: string;\n // Always false. Not used for this widget\n static: boolean;\n};\n\nexport type PerseusDropdownWidgetOptions = {\n // A list of choices for the dropdown\n choices: PerseusDropdownChoice[];\n // Translatable Text; placeholder text for a dropdown. e.g. \"Please select a fruit\"\n placeholder: string;\n // Always false. Not used for this widget\n static: boolean;\n // Translatable Text; visible label for the dropdown\n visibleLabel?: string;\n // Translatable Text; aria label that screen readers will read\n ariaLabel?: string;\n};\n\nexport type PerseusDropdownChoice = {\n // Translatable text; The text for the option. e.g. \"Banana\" or \"Orange\"\n content: string;\n // Whether this is the correct option or not\n correct: boolean;\n};\n\nexport type PerseusExplanationWidgetOptions = {\n // Translatable Text; The clickable text to expand an explanation. e.g. \"What is an apple?\"\n showPrompt: string;\n // Translatable Text; The cliclable text to hide an explanation. e.g. \"Thanks. I got it!\"\n hidePrompt: string;\n // Translatable Markdown; The explanation that is shown when showPrompt is clicked. e.g. \"An apple is a tasty fruit.\"\n explanation: string;\n // explanation fields can embed widgets. When they do, the details of the widgets are here.\n widgets: PerseusWidgetsMap;\n // Always false. Not used for this widget\n static: boolean;\n};\n\nexport type LegacyButtonSets = Array<\n | \"basic\"\n | \"basic+div\"\n | \"trig\"\n | \"prealgebra\"\n | \"logarithms\"\n | \"basic relations\"\n | \"advanced relations\"\n | \"scientific\"\n>;\n\nexport type PerseusExpressionWidgetOptions = {\n // The expression forms the answer may come in\n answerForms: PerseusExpressionAnswerForm[];\n buttonSets: LegacyButtonSets;\n // Variables that can be used as functions. Default: [\"f\", \"g\", \"h\"]\n functions: string[];\n // Use x for rendering multiplication instead of a center dot.\n times: boolean;\n // What extra keys need to be displayed on the keypad so that the\n // question can be answerable without a keyboard (ie mobile)\n // TODO: this is really Key[]\n extraKeys?: KeypadKey[];\n // visible label associated with the MathQuill field\n visibleLabel?: string;\n // aria label for screen readers attached to MathQuill field\n ariaLabel?: string;\n // Controls when buttons for special characters are visible when using a\n // desktop browser. Defaults to \"focused\".\n // NOTE: This isn't listed in perseus-format.js or perseus_data.go, but\n // appears in item data in the datastore.\n buttonsVisible?: \"always\" | \"never\" | \"focused\";\n};\n\nexport const PerseusExpressionAnswerFormConsidered = [\n \"correct\",\n \"wrong\",\n \"ungraded\",\n] as const;\n\nexport type PerseusExpressionAnswerForm = {\n // The TeX form of the expression. e.g. \"x\\\\cdot3=y\"\n value: string;\n // The Answer expression must have the same form\n form: boolean;\n // The answer expression must be fully expanded and simplified\n simplify: boolean;\n // Whether the form is considered \"correct\", \"wrong\", or \"ungraded\"\n considered: (typeof PerseusExpressionAnswerFormConsidered)[number];\n // A key to identify the answer form in a list\n // NOTE: perseus-format.js says this is required even though it isn't necessary.\n key?: string;\n};\n\nexport type PerseusGradedGroupWidgetOptions = {\n // Translatable Text; A title to be displayed for the group.\n title: string;\n // Not used in Perseus (but is set in (en, pt) production data)\n hasHint?: boolean | null | undefined;\n // A section to define hints for the group.\n hint?: PerseusRenderer | null | undefined;\n // Translatable Markdown. May include widgets and images embedded.\n content: string;\n // See PerseusRenderer.widgets\n widgets: PerseusWidgetsMap;\n // Not used in Perseus\n widgetEnabled?: boolean | null | undefined;\n // Not used in Perseus\n immutableWidgets?: boolean | null | undefined;\n // See PerseusRenderer.images\n images: {\n [key: string]: PerseusImageDetail;\n };\n};\n\nexport type PerseusGradedGroupSetWidgetOptions = {\n // A list of Widget Groups\n gradedGroups: PerseusGradedGroupWidgetOptions[];\n};\n\n// 2D range: xMin, xMax, yMin, yMax\nexport type GraphRange = [\n x: [min: number, max: number],\n y: [min: number, max: number],\n];\n\nexport type GrapherAnswerTypes =\n | {\n type: \"absolute_value\";\n // If `coords` is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [vertex: Coord, secondPoint: Coord];\n }\n | {\n type: \"exponential\";\n // Two points along the asymptote line. Usually (always?) a\n // horizontal or vertical line.\n asymptote: [Coord, Coord];\n // Two points along the exponential curve. One end of the curve\n // trends towards the asymptote.\n // If `coords` is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [Coord, Coord];\n }\n | {\n type: \"linear\";\n // Two points along the straight line\n // If coords is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [Coord, Coord];\n }\n | {\n type: \"logarithm\";\n // Two points along the asymptote line.\n asymptote: [Coord, Coord];\n // Two points along the logarithmic curve. One end of the curve\n // trends towards the asymptote.\n // If coords is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [Coord, Coord];\n }\n | {\n type: \"quadratic\";\n // If coords is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [vertex: Coord, secondPoint: Coord];\n }\n | {\n type: \"sinusoid\";\n // Two points on the same slope in the sinusoid wave line.\n // If coords is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [Coord, Coord];\n }\n | {\n type: \"tangent\";\n // Two points on the same slope in the tangent wave line.\n // If coords is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [Coord, Coord];\n };\n\nexport type PerseusGrapherWidgetOptions = {\n availableTypes: Array<\n | \"absolute_value\"\n | \"exponential\"\n | \"linear\"\n | \"logarithm\"\n | \"quadratic\"\n | \"sinusoid\"\n | \"tangent\"\n >;\n correct: GrapherAnswerTypes;\n graph: {\n backgroundImage: {\n bottom?: number;\n height?: number;\n left?: number;\n scale?: number;\n url?: string | null | undefined;\n width?: number;\n };\n box?: [number, number];\n editableSettings?: Array<\"graph\" | \"snap\" | \"image\" | \"measure\">;\n gridStep?: [number, number];\n labels: [string, string];\n markings: MarkingsType;\n range: GraphRange;\n rulerLabel: \"\";\n rulerTicks: number;\n showProtractor?: boolean;\n showRuler?: boolean;\n showTooltips?: boolean;\n snapStep?: [number, number];\n step: [number, number];\n valid?: boolean | string;\n };\n};\n\nexport type PerseusGroupWidgetOptions = PerseusRenderer;\n\nexport type PerseusImageWidgetOptions = {\n // Translatable Markdown; Text to be shown for the title of the image\n title?: string;\n // Translatable Markdown; Text to be shown in the caption section of an image\n caption?: string;\n // Translatable Text; The alt text to be shown in the img.alt attribute\n alt?: string;\n // Translatable Markdown; Text to be shown as the long description of an image\n longDescription?: string;\n // When true, standalone image will be rendered with alt=\"\" and without any alt text, caption, title, or long description.\n decorative?: boolean;\n // The image details for the image to be displayed\n backgroundImage: PerseusImageBackground;\n // Always false. Not used for this widget\n static?: boolean;\n // A list of labels to display on the image\n /** @deprecated - labels were removed from the image widget in 2017 */\n labels?: Array<PerseusImageLabel>;\n // The range on the image render for labels\n /** @deprecated - range for labels was removed from the image widget in 2017 */\n range?: [Interval, Interval];\n // The box on the image render for labels. The same as backgroundImage.width and backgroundImage.height\n /** @deprecated - box for labels was removed from the image widget in 2017 */\n box?: Size;\n};\n\nexport type PerseusImageLabel = {\n // Translatable Text; The content of the label to display\n content: string;\n // The visual alignment of the label. default: \"center\"\n alignment: string;\n // The point on the image to display the label\n coordinates: number[];\n};\n\nexport type PerseusInteractiveGraphWidgetOptions = {\n // Where the little black axis lines & labels (ticks) should render.\n // Also known as the tick step. default [1, 1]\n step: [number, number];\n // Where the grid lines on the graph will render. default [1, 1]\n gridStep?: [x: number, y: number];\n // Where the graph points will lock to when they are dragged. default [0.5, 0.5]\n snapStep?: [x: number, y: number];\n // An optional image to use in the background\n backgroundImage?: PerseusImageBackground;\n /**\n * The type of markings to display on the graph.\n */\n markings: MarkingsType;\n // How to label the X and Y axis. default: [\"x\", \"y\"]\n labels?: string[];\n /**\n * Specifies the location of the labels on the graph. default: \"onAxis\".\n * - \"onAxis\": Labels are positioned on the axis at the right (x) and top (y) of the graph.\n * - \"alongEdge\": Labels are centered along the bottom (x) and left (y) edges of the graph.\n * The y label is rotated. Typically used when the range min is near 0 with longer labels.\n */\n labelLocation?: AxisLabelLocation;\n // Which sides of the graph are bounded (removed axis arrows).\n showAxisArrows: ShowAxisArrows;\n // Whether to show the Protractor tool overlayed on top of the graph\n showProtractor: boolean;\n /**\n * Whether to show the Ruler tool overlayed on top of the graph.\n * @deprecated - no longer used by the InteractiveGraph widget. The\n * property is kept on this type to prevent its accidental reuse in future\n * features, since it may appear in production data.\n */\n showRuler?: boolean;\n // Whether to show tooltips on the graph\n showTooltips?: boolean;\n /**\n * The unit to show on the ruler. e.g. \"mm\", \"cm\", \"m\", \"km\", \"in\", \"ft\",\n * \"yd\", \"mi\".\n * @deprecated - no longer used by the InteractiveGraph widget. The\n * property is kept on this type to prevent its accidental reuse in future\n * features, since it may appear in production data.\n */\n rulerLabel?: string;\n /**\n * How many ticks to show on the ruler. e.g. 1, 2, 4, 8, 10, 16. Must be\n * an integer.\n * @deprecated - no longer used by the InteractiveGraph widget. The\n * property is kept on this type to prevent its accidental reuse in future\n * features, since it may appear in production data.\n */\n rulerTicks?: number;\n // The X and Y coordinate ranges for the view of the graph. default: [[-10, 10], [-10, 10]]\n // TODO(kevinb): Add a transform function to interactive-graph.jsx to\n // rename `range` to `ranges` so that things are less confusing.\n range: GraphRange;\n // The type of graph\n graph: PerseusGraphType;\n // The correct kind of graph, if being used to select function type\n // TODO(LEMS-2344): make the type of `correct` more specific\n correct: PerseusGraphType;\n // Shapes (points, chords, etc) displayed on the graph that cannot\n // be moved by the user.\n lockedFigures: LockedFigure[];\n // Aria label that applies to the entire graph.\n fullGraphAriaLabel?: string;\n // Aria description that applies to the entire graph.\n fullGraphAriaDescription?: string;\n};\n\nexport const lockedFigureColorNames = [\n \"blue\",\n \"green\",\n \"grayH\",\n \"purple\",\n \"pink\",\n \"orange\",\n \"red\",\n] as const;\n\nexport type LockedFigureColor = (typeof lockedFigureColorNames)[number];\n\nexport const lockedFigureColors: Record<LockedFigureColor, string> = {\n blue: \"#3D7586\",\n green: \"#447A53\",\n grayH: \"#3B3D45\",\n purple: \"#594094\",\n pink: \"#B25071\",\n red: \"#D92916\",\n orange: \"#946700\",\n} as const;\n\nexport type StrokeWeight = \"thin\" | \"medium\" | \"thick\";\n\nexport type LockedFigure =\n | LockedPointType\n | LockedLineType\n | LockedVectorType\n | LockedEllipseType\n | LockedPolygonType\n | LockedFunctionType\n | LockedLabelType;\nexport type LockedFigureType = LockedFigure[\"type\"];\n\nexport type LockedLineStyle = \"solid\" | \"dashed\";\n\nexport type LockedPointType = {\n type: \"point\";\n coord: Coord;\n color: LockedFigureColor;\n filled: boolean;\n labels: LockedLabelType[];\n ariaLabel?: string;\n};\n\nexport type LockedLineType = {\n type: \"line\";\n kind: \"line\" | \"ray\" | \"segment\";\n points: [point1: LockedPointType, point2: LockedPointType];\n color: LockedFigureColor;\n lineStyle: LockedLineStyle;\n showPoint1: boolean;\n showPoint2: boolean;\n weight: StrokeWeight;\n labels: LockedLabelType[];\n ariaLabel?: string;\n};\n\nexport type LockedVectorType = {\n type: \"vector\";\n points: [tail: Coord, tip: Coord];\n color: LockedFigureColor;\n weight: StrokeWeight;\n labels: LockedLabelType[];\n ariaLabel?: string;\n};\n\nexport type LockedFigureFillType = \"none\" | \"white\" | \"translucent\" | \"solid\";\nexport const lockedFigureFillStyles: Record<LockedFigureFillType, number> = {\n none: 0,\n white: 1,\n translucent: 0.4,\n solid: 1,\n} as const;\n\nexport type LockedEllipseType = {\n type: \"ellipse\";\n center: Coord;\n radius: [x: number, y: number];\n angle: number;\n color: LockedFigureColor;\n fillStyle: LockedFigureFillType;\n strokeStyle: LockedLineStyle;\n weight: StrokeWeight;\n labels: LockedLabelType[];\n ariaLabel?: string;\n};\n\nexport type LockedPolygonType = {\n type: \"polygon\";\n points: Coord[];\n color: LockedFigureColor;\n showVertices: boolean;\n fillStyle: LockedFigureFillType;\n strokeStyle: LockedLineStyle;\n weight: StrokeWeight;\n labels: LockedLabelType[];\n ariaLabel?: string;\n};\n\nexport type LockedFunctionType = {\n type: \"function\";\n color: LockedFigureColor;\n strokeStyle: LockedLineStyle;\n weight: StrokeWeight;\n /**\n * This is the user-defined equation (as it was typed)\n */\n equation: string;\n /**\n * The independent variable of this function\n */\n directionalAxis: \"x\" | \"y\";\n /**\n * The minimum and maximum values along the `directionalAxis` at which\n * this function should be graphed. Values of -Infinity and Infinity are\n * allowed. Note that infinite values are serialized as `null` in JSON.\n */\n domain: [min: number, max: number];\n labels: LockedLabelType[];\n ariaLabel?: string;\n};\n\n// Not associated with a specific figure\nexport type LockedLabelType = {\n type: \"label\";\n coord: Coord;\n // TeX-supported string\n text: string;\n color: LockedFigureColor;\n size: \"small\" | \"medium\" | \"large\";\n};\n\nexport type PerseusGraphType =\n | PerseusGraphTypeAngle\n | PerseusGraphTypeCircle\n | PerseusGraphTypeLinear\n | PerseusGraphTypeLinearSystem\n | PerseusGraphTypeNone\n | PerseusGraphTypePoint\n | PerseusGraphTypePolygon\n | PerseusGraphTypeQuadratic\n | PerseusGraphTypeRay\n | PerseusGraphTypeSegment\n | PerseusGraphTypeSinusoid;\n\nexport type PerseusGraphTypeAngle = {\n type: \"angle\";\n // Whether to show the angle measurements. default: false\n showAngles?: boolean;\n // Allow Reflex Angles if an \"angle\" type. default: true\n allowReflexAngles?: boolean;\n // The angle offset in degrees if an \"angle\" type. default: 0\n angleOffsetDeg?: number;\n // Snap to degree increments if an \"angle\" type. default: 1\n snapDegrees?: number;\n // How to match the answer. If missing, defaults to exact matching.\n match?: \"congruent\";\n // must have 3 coords - ie [Coord, Coord, Coord]\n coords?: [Coord, Coord, Coord];\n // The initial coordinates the graph renders with.\n startCoords?: [Coord, Coord, Coord];\n};\n\nexport type PerseusGraphTypeCircle = {\n type: \"circle\";\n center?: Coord;\n radius?: number;\n // The initial coordinates the graph renders with.\n startCoords?: {\n center: Coord;\n radius: number;\n };\n};\n\nexport type PerseusGraphTypeLinear = {\n type: \"linear\";\n // expects 2 coords\n coords?: CollinearTuple | null;\n // The initial coordinates the graph renders with.\n startCoords?: CollinearTuple;\n};\n\nexport type PerseusGraphTypeLinearSystem = {\n type: \"linear-system\";\n // expects 2 sets of 2 coords\n coords?: CollinearTuple[] | null;\n // The initial coordinates the graph renders with.\n startCoords?: CollinearTuple[];\n};\n\nexport type PerseusGraphTypeNone = {\n type: \"none\";\n};\n\nexport type PerseusGraphTypePoint = {\n type: \"point\";\n // The number of points if a \"point\" type. default: 1. \"unlimited\" if no limit\n numPoints?: number | \"unlimited\";\n coords?: Coord[] | null;\n // The initial coordinates the graph renders with.\n startCoords?: Coord[];\n // Used instead of `coords` in some old graphs that have only one point.\n coord?: Coord;\n};\n\nexport type PerseusGraphTypePolygon = {\n type: \"polygon\";\n // The number of sides. default: 3. \"unlimited\" if no limit\n numSides?: number | \"unlimited\";\n // Whether to the angle measurements. default: false\n showAngles?: boolean;\n // Whether to show side measurements. default: false\n showSides?: boolean;\n // How to snap points. e.g. \"grid\", \"angles\", or \"sides\". default: grid\n snapTo?: \"grid\" | \"angles\" | \"sides\";\n // How to match the answer. If missing, defaults to exact matching.\n match?: \"similar\" | \"congruent\" | \"approx\" | \"exact\";\n coords?: Coord[] | null;\n // The initial coordinates the graph renders with.\n startCoords?: Coord[];\n};\n\nexport type PerseusGraphTypeQuadratic = {\n type: \"quadratic\";\n // expects a list of 3 coords\n coords?: [Coord, Coord, Coord] | null;\n // The initial coordinates the graph renders with.\n startCoords?: [Coord, Coord, Coord];\n};\n\nexport type PerseusGraphTypeSegment = {\n type: \"segment\";\n // The number of segments if a \"segment\" type. default: 1. Max: 6\n numSegments?: number;\n // Expects a list of Coord tuples. Length should match the `numSegments` value.\n coords?: CollinearTuple[] | null;\n // The initial coordinates the graph renders with.\n startCoords?: CollinearTuple[];\n};\n\nexport type PerseusGraphTypeSinusoid = {\n type: \"sinusoid\";\n // Expects a list of 2 Coords\n coords?: Coord[] | null;\n // The initial coordinates the graph renders with.\n startCoords?: Coord[];\n};\n\nexport type PerseusGraphTypeRay = {\n type: \"ray\";\n // Expects a list of 2 Coords\n coords?: CollinearTuple | null;\n // The initial coordinates the graph renders with.\n startCoords?: CollinearTuple;\n};\n\ntype AngleGraphCorrect = {\n type: \"angle\";\n allowReflexAngles: boolean;\n match?: \"congruent\";\n coords: [Coord, Coord, Coord];\n};\n\ntype CircleGraphCorrect = {\n type: \"circle\";\n center: Coord;\n radius: number;\n};\n\ntype LinearGraphCorrect = {\n type: \"linear\";\n coords: CollinearTuple;\n};\n\ntype LinearSystemGraphCorrect = {\n type: \"linear-system\";\n coords: [CollinearTuple, CollinearTuple];\n};\n\ntype NoneGraphCorrect = {\n type: \"none\";\n};\n\ntype PointGraphCorrect = {\n type: \"point\";\n coords: Coord[];\n};\n\ntype PolygonGraphCorrect = {\n type: \"polygon\";\n match: \"similar\" | \"congruent\" | \"approx\";\n coords: Coord[];\n};\n\ntype QuadraticGraphCorrect = {\n type: \"quadratic\";\n coords: [Coord, Coord, Coord];\n};\n\ntype SegmentGraphCorrect = {\n type: \"segment\";\n coords: CollinearTuple[];\n};\n\ntype SinusoidGraphCorrect = {\n type: \"sinusoid\";\n coords: CollinearTuple;\n};\n\ntype RayGraphCorrect = {\n type: \"ray\";\n coords: CollinearTuple;\n};\n\nexport type PerseusGraphCorrectType =\n | AngleGraphCorrect\n | CircleGraphCorrect\n | LinearGraphCorrect\n | LinearSystemGraphCorrect\n | NoneGraphCorrect\n | PointGraphCorrect\n | PolygonGraphCorrect\n | QuadraticGraphCorrect\n | RayGraphCorrect\n | SegmentGraphCorrect\n | SinusoidGraphCorrect;\n\nexport type PerseusLabelImageWidgetOptions = {\n // Translatable Text; Tex representation of choices\n choices: string[];\n // The URL of the image\n imageUrl: string;\n // Translatable Text; To show up in the img.alt attribute\n imageAlt: string;\n // The height of the image\n imageHeight: number;\n // The width of the image\n imageWidth: number;\n // A list of markers to display on the image\n markers: PerseusLabelImageMarker[];\n // Do not display answer choices in instructions\n hideChoicesFromInstructions: boolean;\n // Allow multiple answers per marker\n multipleAnswers: boolean;\n // Always false. Not used for this widget\n static: boolean;\n};\n\nexport type PerseusLabelImageMarker = {\n // A list of correct answers for this marker. Often only one but can have multiple\n answers: string[];\n // Translatable Text; The text to show for the marker. Not displayed directly to the user\n label: string;\n // X Coordiate location of the marker on the image\n x: number;\n // Y Coordinate location of the marker on the image\n y: number;\n};\n\nexport type PerseusMatcherWidgetOptions = {\n // Translatable Text; Labels to adorn the headings for the columns. Only 2 values [left, right]. e.g. [\"Concepts\", \"Things\"]\n labels: string[];\n // Translatable Text; Static concepts to show in the left column. e.g. [\"Fruit\", \"Color\", \"Clothes\"]\n left: string[];\n // Translatable Markup; Values that represent the concepts to be correlated with the concepts. e.g. [\"Red\", \"Shirt\", \"Banana\"]\n right: string[];\n // Order of the matched pairs matters. With this option enabled, only the order provided above will be treated as correct. This is useful when ordering is significant, such as in the context of a proof. If disabled, pairwise matching is sufficient. To make this clear, the left column becomes fixed in the provided order and only the cards in the right column can be moved.\n orderMatters: boolean;\n // Adds padding to the rows. Padding is good for text, but not needed for images.\n padding: boolean;\n};\n\nexport type PerseusMatrixWidgetAnswers = number[][];\nexport type PerseusMatrixWidgetOptions = {\n // Translatable Text; Shown before the matrix\n prefix?: string | undefined;\n // Translatable Text; Shown after the matrix\n suffix?: string | undefined;\n // A data matrix representing the \"correct\" answers to be entered into the matrix\n answers: PerseusMatrixWidgetAnswers;\n // The coordinate location of the cursor position at start. default: [0, 0]\n cursorPosition?: number[] | undefined;\n // The coordinate size of the matrix. Only supports 2-dimensional matrix. default: [3, 3]\n matrixBoardSize: number[];\n // Whether this is meant to statically display the answers (true) or be used as an input field, graded against the answers\n static?: boolean | undefined;\n};\n\nexport type PerseusMeasurerWidgetOptions = {\n // The image that the user is meant to measure\n image: PerseusImageBackground;\n // Whether to show the Protractor tool overlayed on top of the image\n showProtractor: boolean;\n // Whether to show the Ruler tool overlayed on top of the image\n showRuler: boolean;\n // The unit to show on the ruler. e.g. \"mm\", \"cm\", \"m\", \"km\", \"in\", \"ft\", \"yd\", \"mi\"\n rulerLabel: string;\n // How many ticks to show on the ruler. e.g. 1, 2, 4, 8, 10, 16\n rulerTicks: number;\n // The number of image pixels per unit (label)\n rulerPixels: number;\n // The number of units to display on the ruler\n rulerLength: number;\n // Containing area [width, height]\n box: [number, number];\n};\n\nexport type MathFormat =\n | \"integer\"\n | \"mixed\"\n | \"improper\"\n | \"proper\"\n | \"decimal\"\n | \"percent\"\n | \"pi\";\n\nexport type PerseusNumericInputAnswerForm = {\n simplify: PerseusNumericInputSimplify;\n name: MathFormat;\n};\n\n/**\n * Determines how unsimplified fractions are scored.\n *\n * - \"required\" means unsimplified fractions are considered invalid input, and\n * the learner can try again.\n * - \"enforced\" means unsimplified fractions are marked incorrect.\n * - \"optional\" means unsimplified fractions are accepted.\n */\nexport type PerseusNumericInputSimplify = \"required\" | \"enforced\" | \"optional\";\n\nexport type PerseusNumericInputWidgetOptions = {\n // A list of all the possible correct and incorrect answers\n answers: PerseusNumericInputAnswer[];\n // Translatable Text; Text to describe this input. This will be shown to users using screenreaders.\n labelText?: string | undefined;\n // Use size \"Normal\" for all text boxes, unless there are multiple text boxes in one line and the answer area is too narrow to fit them. Options: \"normal\" or \"small\"\n size: string;\n // A coefficient style number allows the student to use - for -1 and an empty string to mean 1.\n coefficient: boolean;\n // Whether to right-align the text or not\n rightAlign?: boolean;\n // Always false. Not used for this widget\n static: boolean;\n};\n\nexport type PerseusNumericInputAnswer = {\n // Translatable Display; A description for why this answer is correct, wrong, or ungraded\n message: string;\n // The expected answer\n value?: number | null;\n // Whether this answer is \"correct\", \"wrong\", or \"ungraded\"\n status: string;\n // The forms available for this answer. Options: \"integer, \"\"decimal\", \"proper\", \"improper\", \"mixed\", or \"pi\"\n answerForms?: MathFormat[];\n // Whether we should check the answer strictly against the the configured answerForms (strict = true)\n // or include the set of default answerForms (strict = false).\n strict: boolean;\n // A range of error +/- the value\n maxError?: number | null;\n // Unsimplified answers are Ungraded, Accepted, or Wrong.\n simplify: PerseusNumericInputSimplify;\n};\n\nexport type PerseusNumberLineWidgetOptions = {\n // The position of the endpoints of the number line. Setting the range constrains the position of the answer and the labels.\n range: number[];\n // This controls the position of the left / right labels. By default, the labels are set by the range. Note: Ensure that the labels line up with the tick marks, or it may be confusing for users.\n labelRange: Array<number | null>;\n // This controls the styling of the labels for the two main labels as well as all the tick mark labels, if applicable. Options: \"decimal\", \"improper\", \"mixed\", \"non-reduced\"\n labelStyle: string;\n // Show label ticks\n labelTicks: boolean;\n // Show tick controller\n isTickCtrl: boolean;\n isInequality: boolean;\n // The range of divisions within the line\n divisionRange: number[];\n // This controls the number (and position) of the tick marks. The number of divisions is constrained to the division range. Note: The user will be able to specify the number of divisions in a number input.\n numDivisions?: number | null;\n // This determines the number of different places the point will snap between two adjacent tick marks. Note: Ensure the required number of snap increments is provided to answer the question.\n snapDivisions: number;\n // This controls the number (and position) of the tick marks; you can either set the number of divisions (2 divisions would split the entire range in two halves), or the tick step (the distance between ticks) and the other value will be updated accordingly. Note: There is no check to see if labels coordinate with the tick marks, which may be confusing for users if the blue labels and black ticks are off-step.\n tickStep?: number | null;\n // The answer to a NumberLine widget is a set of real numbers.\n // `correctRel` expresses the relationship between the numbers in that set\n // and the value of `correctX`.\n correctRel?: \"eq\" | \"lt\" | \"gt\" | \"le\" | \"ge\";\n // This is the correct answer. The answer is validated (as right or wrong) by using only the end position of the point and the relation (=, <, >, ≤, ≥).\n correctX: number | null;\n // This controls the initial position of the point along the number line\n initialX?: number | null;\n // Show tooltips\n showTooltips?: boolean;\n // When true, the answer is displayed and is immutable\n static: boolean;\n};\n\nexport type PerseusOrdererWidgetOptions = {\n // All of the options available to the user. Place the cards in the correct order. The same card can be used more than once in the answer but will only be displayed once at the top of a stack of identical cards.\n options: PerseusRenderer[];\n // The correct order of the options\n correctOptions: PerseusRenderer[];\n // Cards that are not part of the answer\n otherOptions: PerseusRenderer[];\n // \"normal\" for text options. \"auto\" for image options.\n height: \"normal\" | \"auto\";\n // Use the \"horizontal\" layout for short text and small images. The \"vertical\" layout is best for longer text (e.g. proofs).\n layout: \"horizontal\" | \"vertical\";\n};\n\nexport type PerseusPassageWidgetOptions = {\n // Translatable Text; To add footnotes, add ^ characters where they belong in the passage. Then, add ^ in the footnotes area to reference the footnotes in the passage.\n footnotes: string;\n // Translatable Text; The text of the passage\n passageText: string;\n // translatableText - An optional title that will appear directly above the passage in the same font style. (e.g. Passage 1)\n passageTitle: string;\n // Should we show line numbers along with the passage?\n showLineNumbers: boolean;\n // Always false. Not used for this widget\n static: boolean;\n};\n\nexport type PerseusPassageRefWidgetOptions = {\n // The passage number\n passageNumber: number;\n // The reference number\n referenceNumber: number;\n // Short summary of the referenced section. This will be included in parentheses and quotes automatically.\n summaryText?: string;\n};\n\nexport const plotterPlotTypes = [\n \"bar\",\n \"line\",\n \"pic\",\n \"histogram\",\n \"dotplot\",\n] as const;\nexport type PlotType = (typeof plotterPlotTypes)[number];\n\nexport type PerseusPlotterWidgetOptions = {\n // Translatable Text; The Axis labels. e.g. [\"X Label\", \"Y Label\"]\n labels: string[];\n // Translatable Text; Categories to display along the X access. e.g. [\">0\", \">6\", \">12\", \">18\"]\n categories: string[];\n // The type of the graph. options \"bar\", \"line\", \"pic\", \"histogram\", \"dotplot\"\n type: PlotType;\n // The maximimum Y tick to display in the graph\n maxY: number;\n // The scale of the Y Axis\n scaleY: number;\n // Which ticks to display the labels for. For instance, setting this to \"4\" will only show every 4th label (plus the last one)\n labelInterval?: number | null;\n // Creates the specified number of divisions between the horizontal lines. Fewer snaps between lines makes the graph easier for the student to create correctly.\n snapsPerLine: number;\n // The Y values the graph should start with\n starting: number[];\n // The Y values that represent the correct answer expected\n correct: number[];\n // A picture to represent items in a graph.\n picUrl?: string | null;\n // deprecated\n picSize?: number | null;\n // deprecated\n picBoxHeight?: number | null;\n // deprecated\n plotDimensions: number[];\n};\n\nexport type PerseusRadioWidgetOptions = {\n // The choices provided to the user.\n choices: PerseusRadioChoice[];\n // Does this have a \"none of the above\" option?\n hasNoneOfTheAbove?: boolean;\n // If multipleSelect is enabled, Specify the number expected to be correct.\n countChoices?: boolean;\n // How many of the choices are correct, which is conditionally used to tell\n // learners ahead of time how many options they'll need.\n numCorrect?: number;\n // Randomize the order of the options or keep them as defined\n randomize?: boolean;\n // Does this set allow for multiple selections to be correct?\n multipleSelect?: boolean;\n // deprecated\n deselectEnabled?: boolean;\n};\n\nexport type PerseusRadioChoice = {\n // Translatable Markdown; The label for this choice\n content: string;\n /**\n * An opaque string that uniquely identifies this choice within\n * the radio widget. The format of this ID is subject to change.\n */\n id: string;\n // Translatable Markdown; Rationale to give the user when they get it wrong\n rationale?: string;\n // Whether this option is a correct answer or not\n correct?: boolean;\n // If this is none of the above, override the content with \"None of the above\"\n isNoneOfTheAbove?: boolean;\n};\n\nexport type PerseusSorterWidgetOptions = {\n // Translatable Text; The correct answer (in the correct order). The user will see the cards in a randomized order.\n correct: string[];\n // Adds padding to the options. Padding is good for text but not needed for images\n padding: boolean;\n // Use the \"horizontal\" layout for short text and small images. The \"vertical\" layout is best for longer text and larger images.\n layout: \"horizontal\" | \"vertical\";\n};\n\nexport type PerseusTableWidgetOptions = {\n // Translatable Text; A list of column headers\n headers: string[];\n // The number of rows to display\n rows: number;\n // The number of columns to display\n columns: number;\n // Translatable Text; A 2-dimensional array of text to populate the table with\n answers: string[][];\n};\n\nexport type PerseusInteractionWidgetOptions = {\n // The definition of the graph\n graph: PerseusInteractionGraph;\n // The elements of the graph\n elements: PerseusInteractionElement[];\n // Always false. Not used for this widget\n static: boolean;\n};\n\nexport type PerseusInteractionGraph = {\n // \"canvas\", \"graph\"\n editableSettings?: Array<\"canvas\" | \"graph\">;\n // The Grid Canvas size. e.g. [400, 140]\n box: Size;\n // The Axis labels. e.g. [\"x\", \"y\"]\n labels: string[];\n // The Axis ranges. e.g. [[-10, 10], [-10, 10]]\n range: [Interval, Interval];\n // The steps in the grid. default [1, 1]\n gridStep: [number, number];\n /**\n * The type of markings to display on the graph.\n */\n markings: MarkingsType;\n // The snap steps. default [0.5, 0.5]\n snapStep?: [number, number];\n // Whether the grid is valid or not. Do the numbers all make sense?\n // NOTE(jeremy) The editor for this widget sometimes stores the graph\n // editor validation error message into this field. It seems innocuous\n // because it looks like many of these usages don't actually use the graph\n // at all.\n valid?: boolean | string;\n // An optional background image to use\n backgroundImage?: PerseusImageBackground;\n // Whether to show the Protractor tool overlayed on top of the graph\n showProtractor?: boolean;\n // Whether to show the Ruler tool overlayed on top of the graph\n showRuler?: boolean;\n // The unit to show on the ruler. e.g. \"mm\", \"cm\", \"m\", \"km\", \"in\", \"ft\", \"yd\", \"mi\"\n rulerLabel?: string;\n // How many ticks to show on the ruler. e.g. 1, 2, 4, 8, 10, 16\n rulerTicks?: number;\n // This controls the number (and position) of the tick marks for the X and Y axis. e.g. [1, 1]\n tickStep: [number, number];\n};\n\nexport type PerseusInteractionElement =\n | {\n type: \"function\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionFunctionElementOptions;\n }\n | {\n type: \"label\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionLabelElementOptions;\n }\n | {\n type: \"line\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionLineElementOptions;\n }\n | {\n type: \"movable-line\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionMovableLineElementOptions;\n }\n | {\n type: \"movable-point\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionMovablePointElementOptions;\n }\n | {\n type: \"parametric\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionParametricElementOptions;\n }\n | {\n type: \"point\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionPointElementOptions;\n }\n | {\n type: \"rectangle\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionRectangleElementOptions;\n };\n\nexport type PerseusInteractionFunctionElementOptions = {\n // The definition of the function to draw on the graph. e.g \"x^2 + 1\"\n value: string;\n // The name of the function like f(n). default: \"f\"\n funcName: string;\n // The range of points to start plotting\n rangeMin: string;\n // The range of points to end plotting\n rangeMax: string;\n // The color of the stroke. e.g. #6495ED\n color: string;\n // If the function stroke has a dash, what is it? options: \"\", \"-\", \"- \", \".\", \". \"\n strokeDasharray: string;\n // The thickness of the stroke\n strokeWidth: number;\n};\n\nexport type PerseusInteractionLabelElementOptions = {\n // Translatable Text; the content of the label\n label: string;\n // The color of the label. e.g. \"red\"\n color: string;\n // The X location of the label\n coordX: string;\n // The Y location of the label\n coordY: string;\n};\n\nexport type PerseusInteractionLineElementOptions = {\n // A color code for the line segment. e.g. \"#FFOOAF\"\n color: string;\n // The start of the line segment (X)\n startX: string;\n // The start of the line segment (Y)\n startY: string;\n // The end of the line segment (X)\n endX: string;\n // The end of the line segment (Y)\n endY: string;\n // If the line stroke has a dash, what is it? options: \"\", \"-\", \"- \", \".\", \". \"\n strokeDasharray: string;\n // The thickness of the line\n strokeWidth: number;\n // Does the line have an arrow point to it? options: \"\", \"->\"\n arrows: string;\n};\n\nexport type PerseusInteractionMovableLineElementOptions = {\n // The start of the line segment (X)\n startX: string;\n // The start of the line segment (Y)\n startY: string;\n // Start updates (Xn, Yn) for n\n startSubscript: number;\n // The end of the line segment (X)\n endX: string;\n // The end of the line segment (Y)\n endY: string;\n // End updates (Xm, Ym) for m\n endSubscript: number;\n // How to constrain this line? options \"none\", \"snap\", \"x\", \"y\"\n constraint: string;\n // The snap resolution when constraint is set to \"snap\"\n snap: number;\n // The constraint function for when constraint is set to \"x\" or \"y\"\n constraintFn: string;\n // The lowest possible X value\n constraintXMin: string;\n // The highest possible X value\n constraintXMax: string;\n // The lowest possible Y value\n constraintYMin: string;\n // The highest possible Y value\n constraintYMax: string;\n};\n\nexport type PerseusInteractionMovablePointElementOptions = {\n // The X position of the point\n startX: string;\n // The Y position of the point\n startY: string;\n // Update (Xn, Yn) for n\n varSubscript: number;\n // How to constrain this line? options \"none\", \"snap\", \"x\", \"y\"\n constraint: string;\n // The snap resolution when constraint is set to \"snap\"\n snap: number;\n // The constraint function for when constraint is set to \"x\" or \"y\"\n constraintFn: string;\n // The lowest possible X value\n constraintXMin: string;\n // The highest possible X value\n constraintXMax: string;\n // The lowest possible Y value\n constraintYMin: string;\n // The highest possible Y value\n constraintYMax: string;\n};\n\nexport type PerseusInteractionParametricElementOptions = {\n // The function for the X coordinate. e.g. \"\\\\cos(t)\"\n x: string;\n // The function for the Y coordinate. e.g. \"\\\\sin(t)\"\n y: string;\n // The range of points to start plotting\n rangeMin: string;\n // The range of points to end plotting\n rangeMax: string;\n // The color of the stroke. e.g. #6495ED\n color: string;\n // If the function stroke has a dash, what is it? options: \"\", \"-\", \"- \", \".\", \". \"\n strokeDasharray: string;\n // The thickness of the stroke\n strokeWidth: number;\n};\n\nexport type PerseusInteractionPointElementOptions = {\n // The color of the point. e.g. \"black\"\n color: string;\n // The X coordinate of the point\n coordX: string;\n // The Y coordinate of the point\n coordY: string;\n};\n\nexport type PerseusInteractionRectangleElementOptions = {\n // The fill color. e.g. \"#EDD19B\"\n color: string;\n // The lower left point X\n coordX: string;\n // The lower left point Y\n coordY: string;\n // The width of the rectangle\n width: string;\n // The height of the rectangle\n height: string;\n};\n\nexport type PerseusCSProgramWidgetOptions = {\n // The ID of the CS program to embed\n programID: string;\n // Deprecated. Always null and sometimes omitted entirely.\n programType?: any;\n // Settings that you add here are available to the program as an object returned by Program.settings()\n settings: PerseusCSProgramSetting[];\n // If you show the editor, you should use the \"full-width\" alignment to make room for the width of the editor.\n showEditor: boolean;\n // Whether to show the execute buttons\n showButtons: boolean;\n // The height of the widget\n height: number;\n // TODO(benchristel): static is not used. Delete it?\n // Always false\n static: boolean;\n};\n\nexport type PerseusCSProgramSetting = {\n // The name/key of the setting\n name: string;\n // The value of the setting\n value: string;\n};\n\nexport type PerseusPythonProgramWidgetOptions = {\n // The ID of the Python program to embed\n programID: string;\n // The height of the widget in pixels\n height: number;\n};\n\n// This is an object instead of just a string because we think we'll want to add more\n// fields in the future, like a weight, which would allow us to give partial credit\n// and weight each criterion separately.\nexport type PerseusFreeResponseWidgetScoringCriterion = {\n // An English-language description of how to score the response for this criterion.\n text: string;\n};\n\nexport type PerseusFreeResponseWidgetOptions = {\n // Whether to allow the user to enter an unlimited number of characters.\n allowUnlimitedCharacters: boolean;\n // The maximum number of characters that the user can enter.\n characterLimit: number;\n // The placeholder text that will be displayed to the user in the text input field.\n placeholder: string;\n // The question text that will be displayed to the user.\n question: string;\n // A list of scoring criteria for the free response question. This is a list\n // of things the answer should contain to be considered correct.\n scoringCriteria: ReadonlyArray<PerseusFreeResponseWidgetScoringCriterion>;\n};\n\nexport type PerseusIFrameWidgetOptions = {\n // A URL to display OR a CS Program ID\n url: string;\n // Settings that you add here are available to the program as an object returned by Program.settings()\n settings?: PerseusCSProgramSetting[];\n // The width of the widget\n width: number | string;\n // The height of the widget\n height: number | string;\n // Whether to allow the IFrame to become full-screen (like a video)\n allowFullScreen: boolean;\n // Whether to allow the iframe content to redirect the page\n allowTopNavigation?: boolean;\n // Always false\n static: boolean;\n};\n\nexport type PerseusPhetSimulationWidgetOptions = {\n // A URL to display, must start with https://phet.colorado.edu/\n url: string;\n // Translatable Text; Description of the sim for Khanmigo and alt text\n description: string;\n};\n\nexport type PerseusVideoWidgetOptions = {\n location: string;\n static?: boolean;\n};\n\nexport type PerseusInputNumberWidgetOptions = {\n answerType?:\n | \"number\"\n | \"decimal\"\n | \"integer\"\n | \"rational\"\n | \"improper\"\n | \"mixed\"\n | \"percent\"\n | \"pi\";\n inexact?: boolean;\n maxError?: number | string;\n rightAlign?: boolean;\n simplify: \"required\" | \"optional\" | \"enforced\";\n size: \"normal\" | \"small\";\n value: string | number;\n customKeypad?: boolean;\n};\n\nexport type PerseusMoleculeRendererWidgetOptions = {\n widgetId: string;\n rotationAngle?: number;\n smiles?: string;\n};\n\nexport type PerseusPassageRefTargetWidgetOptions = {\n content: string;\n};\n\nexport type PerseusWidgetOptions =\n | PerseusCategorizerWidgetOptions\n | PerseusCSProgramWidgetOptions\n | PerseusDefinitionWidgetOptions\n | PerseusDropdownWidgetOptions\n | PerseusExplanationWidgetOptions\n | PerseusExpressionWidgetOptions\n | PerseusFreeResponseWidgetOptions\n | PerseusGradedGroupSetWidgetOptions\n | PerseusGradedGroupWidgetOptions\n | PerseusIFrameWidgetOptions\n | PerseusImageWidgetOptions\n | PerseusInputNumberWidgetOptions\n | PerseusInteractionWidgetOptions\n | PerseusInteractiveGraphWidgetOptions\n | PerseusLabelImageWidgetOptions\n | PerseusMatcherWidgetOptions\n | PerseusMatrixWidgetOptions\n | PerseusMeasurerWidgetOptions\n | PerseusMoleculeRendererWidgetOptions\n | PerseusNumberLineWidgetOptions\n | PerseusNumericInputWidgetOptions\n | PerseusOrdererWidgetOptions\n | PerseusPassageRefTargetWidgetOptions\n | PerseusPassageRefWidgetOptions\n | PerseusPassageWidgetOptions\n | PerseusPhetSimulationWidgetOptions\n | PerseusPlotterWidgetOptions\n | PerseusRadioWidgetOptions\n | PerseusSorterWidgetOptions\n | PerseusTableWidgetOptions\n | PerseusVideoWidgetOptions;\n","import {lockedFigureColorNames} from \"../../data-schema\";\nimport {\n array,\n boolean,\n constant,\n enumeration,\n nullable,\n number,\n object,\n optional,\n pair,\n pipeParsers,\n string,\n trio,\n union,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\nimport {discriminatedUnionOn} from \"../general-purpose-parsers/discriminated-union\";\n\nimport {parsePerseusImageBackground} from \"./perseus-image-background\";\nimport {parseWidget} from \"./widget\";\n\nimport type {PerseusGraphTypeLinear} from \"../../data-schema\";\n\n// Used to represent 2-D points and ranges\nconst pairOfNumbers = pair(number, number);\n\nconst parsePerseusGraphTypeAngle = object({\n type: constant(\"angle\"),\n showAngles: optional(boolean),\n allowReflexAngles: optional(boolean),\n angleOffsetDeg: optional(number),\n snapDegrees: optional(number),\n match: optional(constant(\"congruent\")),\n coords: optional(trio(pairOfNumbers, pairOfNumbers, pairOfNumbers)),\n startCoords: optional(trio(pairOfNumbers, pairOfNumbers, pairOfNumbers)),\n});\n\nconst parsePerseusGraphTypeCircle = object({\n type: constant(\"circle\"),\n center: optional(pairOfNumbers),\n radius: optional(number),\n startCoords: optional(\n object({\n center: pairOfNumbers,\n radius: number,\n }),\n ),\n});\n\nconst parsePerseusGraphTypeLinear = object({\n type: constant(\"linear\"),\n coords: optional(nullable(pair(pairOfNumbers, pairOfNumbers))),\n startCoords: optional(pair(pairOfNumbers, pairOfNumbers)),\n});\n\nconst parsePerseusGraphTypeLinearSystem = object({\n type: constant(\"linear-system\"),\n // TODO(benchristel): default coords to empty array?\n coords: optional(nullable(array(pair(pairOfNumbers, pairOfNumbers)))),\n startCoords: optional(array(pair(pairOfNumbers, pairOfNumbers))),\n});\n\nconst parsePerseusGraphTypeNone = object({\n type: constant(\"none\"),\n});\n\nconst parsePerseusGraphTypePoint = object({\n type: constant(\"point\"),\n numPoints: optional(union(number).or(constant(\"unlimited\")).parser),\n coords: optional(nullable(array(pairOfNumbers))),\n startCoords: optional(array(pairOfNumbers)),\n coord: optional(pairOfNumbers),\n});\n\nconst parsePerseusGraphTypePolygon = object({\n type: constant(\"polygon\"),\n numSides: optional(union(number).or(constant(\"unlimited\")).parser),\n showAngles: optional(boolean),\n showSides: optional(boolean),\n snapTo: optional(enumeration(\"grid\", \"angles\", \"sides\")),\n match: optional(enumeration(\"similar\", \"congruent\", \"approx\", \"exact\")),\n startCoords: optional(array(pairOfNumbers)),\n coords: optional(nullable(array(pairOfNumbers))),\n});\n\nconst parsePerseusGraphTypeQuadratic = object({\n type: constant(\"quadratic\"),\n coords: optional(\n nullable(trio(pairOfNumbers, pairOfNumbers, pairOfNumbers)),\n ),\n startCoords: optional(trio(pairOfNumbers, pairOfNumbers, pairOfNumbers)),\n});\n\nconst parsePerseusGraphTypeRay = object({\n type: constant(\"ray\"),\n coords: optional(nullable(pair(pairOfNumbers, pairOfNumbers))),\n startCoords: optional(pair(pairOfNumbers, pairOfNumbers)),\n});\n\nconst parsePerseusGraphTypeSegment = object({\n type: constant(\"segment\"),\n // TODO(benchristel): default numSegments?\n numSegments: optional(number),\n coords: optional(nullable(array(pair(pairOfNumbers, pairOfNumbers)))),\n startCoords: optional(array(pair(pairOfNumbers, pairOfNumbers))),\n});\n\nconst parsePerseusGraphTypeSinusoid = object({\n type: constant(\"sinusoid\"),\n coords: optional(nullable(array(pairOfNumbers))),\n startCoords: optional(array(pairOfNumbers)),\n});\n\nexport const parsePerseusGraphType = discriminatedUnionOn(\"type\")\n .withBranch(\"angle\", parsePerseusGraphTypeAngle)\n .withBranch(\"circle\", parsePerseusGraphTypeCircle)\n .withBranch(\"linear\", parsePerseusGraphTypeLinear)\n .withBranch(\"linear-system\", parsePerseusGraphTypeLinearSystem)\n .withBranch(\"none\", parsePerseusGraphTypeNone)\n .withBranch(\"point\", parsePerseusGraphTypePoint)\n .withBranch(\"polygon\", parsePerseusGraphTypePolygon)\n .withBranch(\"quadratic\", parsePerseusGraphTypeQuadratic)\n .withBranch(\"ray\", parsePerseusGraphTypeRay)\n .withBranch(\"segment\", parsePerseusGraphTypeSegment)\n .withBranch(\"sinusoid\", parsePerseusGraphTypeSinusoid).parser;\n\nconst parseLockedFigureColor = enumeration(...lockedFigureColorNames);\n\nconst parseLockedFigureFillType = enumeration(\n \"none\",\n \"white\",\n \"translucent\",\n \"solid\",\n);\n\nconst parseLockedLineStyle = enumeration(\"solid\", \"dashed\");\n\nexport const parseStrokeWeight = defaulted(\n enumeration(\"medium\", \"thin\", \"thick\"),\n () => \"medium\" as const,\n);\n\nconst parseLockedLabelType = object({\n type: constant(\"label\"),\n coord: pairOfNumbers,\n text: string,\n color: parseLockedFigureColor,\n size: enumeration(\"small\", \"medium\", \"large\"),\n});\n\nconst parseLockedPointType = object({\n type: constant(\"point\"),\n coord: pairOfNumbers,\n color: parseLockedFigureColor,\n filled: boolean,\n labels: defaulted(array(parseLockedLabelType), () => []),\n ariaLabel: optional(string),\n});\n\nconst parseLockedLineType = object({\n type: constant(\"line\"),\n kind: enumeration(\"line\", \"ray\", \"segment\"),\n points: pair(parseLockedPointType, parseLockedPointType),\n color: parseLockedFigureColor,\n lineStyle: parseLockedLineStyle,\n showPoint1: defaulted(boolean, () => false),\n showPoint2: defaulted(boolean, () => false),\n weight: parseStrokeWeight,\n labels: defaulted(array(parseLockedLabelType), () => []),\n ariaLabel: optional(string),\n});\n\nconst parseLockedVectorType = object({\n type: constant(\"vector\"),\n points: pair(pairOfNumbers, pairOfNumbers),\n color: parseLockedFigureColor,\n weight: parseStrokeWeight,\n labels: defaulted(array(parseLockedLabelType), () => []),\n ariaLabel: optional(string),\n});\n\nconst parseLockedEllipseType = object({\n type: constant(\"ellipse\"),\n center: pairOfNumbers,\n radius: pairOfNumbers,\n angle: number,\n color: parseLockedFigureColor,\n fillStyle: parseLockedFigureFillType,\n strokeStyle: parseLockedLineStyle,\n weight: parseStrokeWeight,\n labels: defaulted(array(parseLockedLabelType), () => []),\n ariaLabel: optional(string),\n});\n\nconst parseLockedPolygonType = object({\n type: constant(\"polygon\"),\n points: array(pairOfNumbers),\n color: parseLockedFigureColor,\n showVertices: boolean,\n fillStyle: parseLockedFigureFillType,\n strokeStyle: parseLockedLineStyle,\n weight: parseStrokeWeight,\n labels: defaulted(array(parseLockedLabelType), () => []),\n ariaLabel: optional(string),\n});\n\n// Exported for testing.\nexport const parseLockedFunctionDomain = defaulted(\n pair(\n defaulted(number, () => -Infinity),\n defaulted(number, () => Infinity),\n ),\n (): [number, number] => [-Infinity, Infinity],\n);\n\nconst parseLockedFunctionType = object({\n type: constant(\"function\"),\n color: parseLockedFigureColor,\n strokeStyle: parseLockedLineStyle,\n weight: parseStrokeWeight,\n equation: string,\n directionalAxis: enumeration(\"x\", \"y\"),\n domain: parseLockedFunctionDomain,\n labels: defaulted(array(parseLockedLabelType), () => []),\n ariaLabel: optional(string),\n});\n\nconst parseLockedFigure = discriminatedUnionOn(\"type\")\n .withBranch(\"point\", parseLockedPointType)\n .withBranch(\"line\", parseLockedLineType)\n .withBranch(\"vector\", parseLockedVectorType)\n .withBranch(\"ellipse\", parseLockedEllipseType)\n .withBranch(\"polygon\", parseLockedPolygonType)\n .withBranch(\"function\", parseLockedFunctionType)\n .withBranch(\"label\", parseLockedLabelType).parser;\n\nconst parseLabelLocation = union(enumeration(\"onAxis\", \"alongEdge\")).or(\n // If the labelLocation is an empty string, we default to \"onAxis\".\n pipeParsers(constant(\"\")).then(convert(() => \"onAxis\" as const)).parser,\n).parser;\n\nexport const parseInteractiveGraphWidget = parseWidget(\n constant(\"interactive-graph\"),\n object({\n step: pairOfNumbers,\n // TODO(benchristel): rather than making gridStep and snapStep\n // optional, we should duplicate the defaulting logic from the\n // InteractiveGraph component. See parse-perseus-json/README.md for\n // why.\n gridStep: optional(pairOfNumbers),\n snapStep: optional(pairOfNumbers),\n backgroundImage: optional(parsePerseusImageBackground),\n markings: enumeration(\"graph\", \"grid\", \"none\", \"axes\"),\n labels: optional(array(string)),\n labelLocation: optional(parseLabelLocation),\n showProtractor: boolean,\n showRuler: optional(boolean),\n showTooltips: optional(boolean),\n rulerLabel: optional(string),\n rulerTicks: optional(number),\n range: pair(pairOfNumbers, pairOfNumbers),\n showAxisArrows: defaulted(\n object({\n xMin: boolean,\n xMax: boolean,\n yMin: boolean,\n yMax: boolean,\n }),\n () => ({\n xMin: true,\n xMax: true,\n yMin: true,\n yMax: true,\n }),\n ),\n // NOTE(benchristel): I copied the default graph from\n // interactive-graph.tsx. See the parse-perseus-json/README.md for\n // an explanation of why we want to duplicate the default here.\n graph: defaulted(\n parsePerseusGraphType,\n (): PerseusGraphTypeLinear => ({\n type: \"linear\" as const,\n }),\n ),\n correct: defaulted(\n parsePerseusGraphType,\n (): PerseusGraphTypeLinear => ({\n type: \"linear\" as const,\n }),\n ),\n lockedFigures: defaulted(array(parseLockedFigure), () => []),\n fullGraphAriaLabel: optional(string),\n fullGraphAriaDescription: optional(string),\n }),\n);\n","import {\n array,\n boolean,\n constant,\n number,\n object,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseLabelImageWidget = parseWidget(\n constant(\"label-image\"),\n object({\n choices: array(string),\n imageUrl: string,\n imageAlt: string,\n imageHeight: number,\n imageWidth: number,\n markers: array(\n object({\n answers: array(string),\n label: string,\n x: number,\n y: number,\n }),\n ),\n hideChoicesFromInstructions: boolean,\n multipleAnswers: boolean,\n static: defaulted(boolean, () => false),\n }),\n);\n","import {\n array,\n boolean,\n constant,\n object,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nimport type {ParsedValue} from \"../parser-types\";\n\nconst matcherOptions = object({\n labels: array(string),\n left: array(string),\n right: array(string),\n orderMatters: boolean,\n padding: boolean,\n});\n\nfunction getDefaultOptions(): ParsedValue<typeof matcherOptions> {\n // NOTE(benchristel): I copied these default values from the ones used\n // in the editor. See parse-perseus-json/README.md for why we want to\n // duplicate the defaults here.\n return {\n left: [\"$x$\", \"$y$\", \"$z$\"],\n right: [\"$1$\", \"$2$\", \"$3$\"],\n labels: [\"test\", \"label\"],\n orderMatters: false,\n padding: true,\n };\n}\n\nexport const parseMatcherWidget = parseWidget(\n constant(\"matcher\"),\n defaulted(matcherOptions, getDefaultOptions),\n);\n","import {\n array,\n boolean,\n constant,\n number,\n object,\n optional,\n pipeParsers,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\nimport {stringToNumber} from \"../general-purpose-parsers/string-to-number\";\n\nimport {parseWidget} from \"./widget\";\n\nconst numberOrString = union(number).or(string).parser;\nconst numeric = pipeParsers(defaulted(numberOrString, () => NaN)).then(\n stringToNumber,\n).parser;\n\nexport const parseMatrixWidget = parseWidget(\n defaulted(constant(\"matrix\"), () => \"matrix\"),\n object({\n prefix: optional(string),\n suffix: optional(string),\n answers: defaulted(array(array(numeric)), () => []),\n cursorPosition: optional(array(number)),\n matrixBoardSize: array(number),\n static: optional(boolean),\n }),\n);\n","import {\n boolean,\n constant,\n number,\n object,\n pair,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parsePerseusImageBackground} from \"./perseus-image-background\";\nimport {parseWidget} from \"./widget\";\n\nexport const parseMeasurerWidget = parseWidget(\n constant(\"measurer\"),\n object({\n // The default value for image comes from measurer.tsx.\n // See parse-perseus-json/README.md for why we want to duplicate the\n // defaults here.\n image: defaulted(parsePerseusImageBackground, () => ({\n url: null,\n top: 0,\n left: 0,\n })),\n showProtractor: boolean,\n showRuler: boolean,\n rulerLabel: string,\n rulerTicks: number,\n rulerPixels: number,\n rulerLength: number,\n box: pair(number, number),\n }),\n);\n","import {\n constant,\n object,\n string,\n number,\n optional,\n} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseMoleculeRendererWidget = parseWidget(\n constant(\"molecule-renderer\"),\n object({\n widgetId: string,\n rotationAngle: optional(number),\n smiles: optional(string),\n }),\n);\n","import {\n constant,\n object,\n array,\n number,\n string,\n boolean,\n optional,\n nullable,\n pipeParsers,\n union,\n enumeration,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nconst emptyStringToNull = pipeParsers(constant(\"\")).then(\n convert(() => null),\n).parser;\n\nexport const parseNumberLineWidget = parseWidget(\n constant(\"number-line\"),\n object({\n // TODO(LEMS-3081): change `range` to `pair(number, number)` and update the related types\n // in data-schema.ts and number-line.tsx.\n range: array(number),\n labelRange: array(nullable(union(number).or(emptyStringToNull).parser)),\n labelStyle: string,\n labelTicks: boolean,\n // NOTE(matthewcurtis): I copied the default isTickCtrl from\n // number-line.tsx. See the parse-perseus-json/README.md for\n // an explanation of why we want to duplicate the default here.\n isTickCtrl: defaulted(boolean, () => false),\n isInequality: defaulted(boolean, () => false),\n divisionRange: array(number),\n numDivisions: optional(nullable(number)),\n // NOTE(benchristel): I copied the default snapDivisions from\n // number-line.tsx. See the parse-perseus-json/README.md for\n // an explanation of why we want to duplicate the default here.\n snapDivisions: defaulted(number, () => 2),\n tickStep: optional(nullable(number)),\n correctRel: defaulted(\n optional(enumeration(\"eq\", \"lt\", \"gt\", \"le\", \"ge\")),\n // Convert null to undefined:\n () => undefined,\n ),\n correctX: defaulted(nullable(number), () => null),\n initialX: optional(nullable(number)),\n showTooltips: optional(boolean),\n static: defaulted(boolean, () => false),\n }),\n);\n","import {\n constant,\n object,\n array,\n string,\n number,\n optional,\n enumeration,\n boolean,\n nullable,\n union,\n pipeParsers,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nconst parseMathFormat = enumeration(\n \"integer\",\n \"mixed\",\n \"improper\",\n \"proper\",\n \"decimal\",\n \"percent\",\n \"pi\",\n);\n\nexport const parseSimplify = pipeParsers(\n union(constant(null))\n .or(constant(undefined))\n .or(boolean)\n .or(constant(\"true\"))\n .or(constant(\"required\"))\n .or(constant(\"correct\"))\n .or(constant(\"enforced\"))\n .or(constant(\"optional\"))\n .or(constant(\"accepted\")).parser,\n).then(convert(deprecatedSimplifyValuesToRequired)).parser;\n\nfunction deprecatedSimplifyValuesToRequired(\n simplify:\n | null\n | undefined\n | boolean\n | \"true\"\n | \"required\"\n | \"correct\"\n | \"enforced\"\n | \"optional\"\n | \"accepted\",\n): \"enforced\" | \"required\" | \"optional\" {\n switch (simplify) {\n case \"enforced\":\n case \"required\":\n case \"optional\":\n return simplify;\n // NOTE(benchristel): \"accepted\", \"correct\", \"true\", true, false,\n // undefined, and null are all treated the same as \"required\" during\n // scoring, so we convert them to \"required\" here to preserve\n // behavior. See the tests in score-numeric-input.test.ts.\n default:\n return \"required\";\n }\n}\n\nexport const parseNumericInputWidget = parseWidget(\n constant(\"numeric-input\"),\n object({\n answers: array(\n object({\n message: defaulted(string, () => \"\"),\n // TODO(benchristel): value should never be null or undefined,\n // but we have some content where it is anyway. If we backfill\n // the data, simplify this.\n value: optional(nullable(number)),\n status: string,\n answerForms: defaulted(\n optional(array(parseMathFormat)),\n () => undefined,\n ),\n strict: defaulted(boolean, () => false),\n maxError: optional(nullable(number)),\n // TODO(benchristel): simplify should never be a boolean, but we\n // have some content where it is anyway. If we ever backfill\n // the data, we should simplify `simplify`.\n simplify: parseSimplify,\n }),\n ),\n labelText: optional(string),\n size: string,\n coefficient: defaulted(boolean, () => false),\n rightAlign: optional(boolean),\n static: defaulted(boolean, () => false),\n answerForms: optional(\n array(\n object({\n name: parseMathFormat,\n simplify: parseSimplify,\n }),\n ),\n ),\n }),\n);\n","import {\n array,\n constant,\n enumeration,\n object,\n pipeParsers,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parsePerseusRenderer} from \"./perseus-renderer\";\nimport {parseWidget} from \"./widget\";\n\nimport type {PartialParser} from \"../parser-types\";\n\n// There is an import cycle between orderer-widget.ts and perseus-renderer.ts.\n// This wrapper ensures that we don't refer to parsePerseusRenderer before\n// it's defined.\nfunction parseRenderer(rawValue, ctx) {\n return parsePerseusRenderer(rawValue, ctx);\n}\n\nconst largeToAuto: PartialParser<\n \"normal\" | \"auto\" | \"large\",\n \"normal\" | \"auto\"\n> = (height, ctx) => {\n if (height === \"large\") {\n return ctx.success(\"auto\");\n }\n return ctx.success(height);\n};\n\nexport const parseOrdererWidget = parseWidget(\n constant(\"orderer\"),\n object({\n options: defaulted(array(parseRenderer), () => []),\n correctOptions: defaulted(array(parseRenderer), () => []),\n otherOptions: defaulted(array(parseRenderer), () => []),\n height: pipeParsers(enumeration(\"normal\", \"auto\", \"large\")).then(\n largeToAuto,\n ).parser,\n layout: defaulted(\n enumeration(\"horizontal\", \"vertical\"),\n () => \"horizontal\" as const,\n ),\n }),\n);\n","import {\n constant,\n object,\n string,\n number,\n optional,\n} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parsePassageRefWidget = parseWidget(\n constant(\"passage-ref\"),\n object({\n passageNumber: number,\n referenceNumber: number,\n summaryText: optional(string),\n }),\n);\n","import {constant, object, string, boolean} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parsePassageWidget = parseWidget(\n constant(\"passage\"),\n object({\n footnotes: defaulted(string, () => \"\"),\n passageText: string,\n passageTitle: defaulted(string, () => \"\"),\n showLineNumbers: boolean,\n static: defaulted(boolean, () => false),\n }),\n);\n","import {constant, object, string} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parsePhetSimulationWidget = parseWidget(\n constant(\"phet-simulation\"),\n object({\n url: string,\n description: string,\n }),\n);\n","import {plotterPlotTypes} from \"../../data-schema\";\nimport {\n constant,\n object,\n string,\n array,\n number,\n optional,\n nullable,\n enumeration,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parsePlotterWidget = parseWidget(\n constant(\"plotter\"),\n object({\n labels: array(string),\n categories: array(string),\n type: enumeration(...plotterPlotTypes),\n maxY: number,\n // The default value for scaleY comes from plotter.tsx.\n // See parse-perseus-json/README.md for why we want to duplicate the\n // defaults here.\n scaleY: defaulted(number, () => 1),\n labelInterval: optional(nullable(number)),\n // The default value for snapsPerLine comes from plotter.tsx.\n // See parse-perseus-json/README.md for why we want to duplicate the\n // defaults here.\n snapsPerLine: defaulted(number, () => 2),\n starting: array(number),\n correct: defaulted(array(number), () => []),\n picUrl: optional(nullable(string)),\n picSize: optional(nullable(number)),\n picBoxHeight: optional(nullable(number)),\n // NOTE(benchristel): I copied the default plotDimensions from\n // plotter.tsx. See the parse-perseus-json/README.md for an explanation\n // of why we want to duplicate the defaults here.\n plotDimensions: defaulted(array(number), () => [380, 300]),\n }),\n);\n","import {constant, object, string, number} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parsePythonProgramWidget = parseWidget(\n constant(\"python-program\"),\n object({\n programID: string,\n height: number,\n }),\n);\n","interface Choice {\n correct?: boolean;\n}\n\nexport function deriveNumCorrect(choices: Choice[]) {\n return choices.filter((c) => c.correct).length;\n}\n","import {deriveNumCorrect} from \"../../widgets/radio/derive-num-correct\";\nimport {\n any,\n array,\n arrayWithIndex,\n boolean,\n constant,\n defaultedNonEmptyString,\n number,\n object,\n optional,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {versionedWidgetOptions} from \"./versioned-widget-options\";\nimport {parseWidgetWithVersion} from \"./widget\";\nimport {parseWidgetsMap} from \"./widgets-map\";\n\nimport type {ParsedValue} from \"../parser-types\";\n\nconst parseWidgetsMapOrUndefined = defaulted(\n // There is an import cycle between radio-widget.ts and\n // widgets-map.ts. The anonymous function below ensures that we\n // don't refer to parseWidgetsMap before it's defined.\n optional((rawVal, ctx) => parseWidgetsMap(rawVal, ctx)),\n () => undefined,\n);\n\nfunction getDefaultOptions() {\n // See parse-perseus-json/README.md for why we want these defaults here.\n return {\n choices: [\n {content: \"\", id: generateChoiceId(0)},\n {content: \"\", id: generateChoiceId(1)},\n {content: \"\", id: generateChoiceId(2)},\n {content: \"\", id: generateChoiceId(3)},\n ],\n };\n}\n\nconst parseOnePerLine = defaulted(optional(boolean), () => undefined);\nconst parseNoneOfTheAbove = defaulted(\n optional(constant(false)),\n () => undefined,\n);\n\nfunction generateChoiceId(index: number): string {\n return `radio-choice-${index}`;\n}\n\nconst version3 = optional(object({major: constant(3), minor: number}));\nconst parseRadioWidgetV3 = parseWidgetWithVersion(\n version3,\n constant(\"radio\"),\n object({\n numCorrect: optional(number),\n choices: arrayWithIndex((index) =>\n object({\n content: defaulted(string, () => \"\"),\n rationale: optional(string),\n correct: optional(boolean),\n isNoneOfTheAbove: optional(boolean),\n id: defaultedNonEmptyString(() => generateChoiceId(index)),\n }),\n ),\n hasNoneOfTheAbove: optional(boolean),\n countChoices: optional(boolean),\n randomize: optional(boolean),\n multipleSelect: optional(boolean),\n deselectEnabled: optional(boolean),\n }),\n);\n\nconst version2 = optional(object({major: constant(2), minor: number}));\nconst parseRadioWidgetV2 = parseWidgetWithVersion(\n version2,\n constant(\"radio\"),\n defaulted(\n object({\n numCorrect: optional(number),\n choices: array(\n object({\n content: defaulted(string, () => \"\"),\n clue: optional(string),\n correct: optional(boolean),\n isNoneOfTheAbove: optional(boolean),\n // deprecated\n widgets: parseWidgetsMapOrUndefined,\n }),\n ),\n hasNoneOfTheAbove: optional(boolean),\n countChoices: optional(boolean),\n randomize: optional(boolean),\n multipleSelect: optional(boolean),\n deselectEnabled: optional(boolean),\n // deprecated\n onePerLine: parseOnePerLine,\n // deprecated\n displayCount: optional(any),\n // v0 props\n // `noneOfTheAbove` is still in use (but only set to `false`).\n noneOfTheAbove: parseNoneOfTheAbove,\n }),\n getDefaultOptions,\n ),\n);\n\nconst version1 = optional(object({major: constant(1), minor: number}));\nconst parseRadioWidgetV1 = parseWidgetWithVersion(\n version1,\n constant(\"radio\"),\n defaulted(\n object({\n choices: array(\n object({\n content: defaulted(string, () => \"\"),\n clue: optional(string),\n correct: optional(boolean),\n isNoneOfTheAbove: optional(boolean),\n // deprecated\n widgets: parseWidgetsMapOrUndefined,\n }),\n ),\n hasNoneOfTheAbove: optional(boolean),\n countChoices: optional(boolean),\n randomize: optional(boolean),\n multipleSelect: optional(boolean),\n deselectEnabled: optional(boolean),\n // deprecated\n onePerLine: parseOnePerLine,\n // deprecated\n displayCount: optional(any),\n // v0 props\n // `noneOfTheAbove` is still in use (but only set to `false`).\n noneOfTheAbove: parseNoneOfTheAbove,\n }),\n getDefaultOptions,\n ),\n);\n\nconst version0 = optional(object({major: constant(0), minor: number}));\nconst parseRadioWidgetV0 = parseWidgetWithVersion(\n version0,\n constant(\"radio\"),\n defaulted(\n object({\n choices: array(\n object({\n content: defaulted(string, () => \"\"),\n clue: optional(string),\n correct: optional(boolean),\n isNoneOfTheAbove: optional(boolean),\n // deprecated\n widgets: parseWidgetsMapOrUndefined,\n }),\n ),\n hasNoneOfTheAbove: optional(boolean),\n countChoices: optional(boolean),\n randomize: optional(boolean),\n multipleSelect: optional(boolean),\n deselectEnabled: optional(boolean),\n // deprecated\n onePerLine: parseOnePerLine,\n // deprecated\n displayCount: optional(any),\n // v0 props\n // `noneOfTheAbove` is still in use (but only set to `false`).\n noneOfTheAbove: parseNoneOfTheAbove,\n }),\n getDefaultOptions,\n ),\n);\n\n// migrate functions\nexport function migrateV2toV3(\n widget: ParsedValue<typeof parseRadioWidgetV2>,\n): ParsedValue<typeof parseRadioWidgetV3> {\n const {options} = widget;\n return {\n ...widget,\n version: {major: 3, minor: 0},\n options: {\n numCorrect: options.numCorrect,\n hasNoneOfTheAbove: options.hasNoneOfTheAbove,\n countChoices: options.countChoices,\n randomize: options.randomize,\n multipleSelect: options.multipleSelect,\n deselectEnabled: options.deselectEnabled,\n choices: options.choices.map((choice, index) => ({\n content: choice.content,\n rationale: choice[\"rationale\"] || choice.clue,\n correct: choice.correct,\n isNoneOfTheAbove: choice.isNoneOfTheAbove,\n id: generateChoiceId(index),\n })),\n },\n };\n}\n\nexport function migrateV1ToV2(\n widget: ParsedValue<typeof parseRadioWidgetV1>,\n): ParsedValue<typeof parseRadioWidgetV2> {\n const {options} = widget;\n return {\n ...widget,\n version: {major: 2, minor: 0},\n options: {\n ...options,\n numCorrect: deriveNumCorrect(options.choices),\n },\n };\n}\n\nexport function migrateV0ToV1(\n widget: ParsedValue<typeof parseRadioWidgetV0>,\n): ParsedValue<typeof parseRadioWidgetV1> {\n const {options} = widget;\n const {noneOfTheAbove: _, ...rest} = options;\n return {\n ...widget,\n version: {major: 1, minor: 0},\n options: {\n ...rest,\n hasNoneOfTheAbove: false,\n noneOfTheAbove: undefined,\n },\n };\n}\n\nexport const parseRadioWidget = versionedWidgetOptions(3, parseRadioWidgetV3)\n .withMigrationFrom(2, parseRadioWidgetV2, migrateV2toV3)\n .withMigrationFrom(1, parseRadioWidgetV1, migrateV1ToV2)\n .withMigrationFrom(0, parseRadioWidgetV0, migrateV0ToV1).parser;\n","import {\n array,\n boolean,\n constant,\n enumeration,\n object,\n string,\n} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseSorterWidget = parseWidget(\n constant(\"sorter\"),\n object({\n correct: array(string),\n padding: boolean,\n layout: enumeration(\"horizontal\", \"vertical\"),\n }),\n);\n","import {\n array,\n number,\n constant,\n object,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseTableWidget = parseWidget(\n constant(\"table\"),\n object({\n headers: array(string),\n rows: number,\n columns: number,\n answers: defaulted(array(array(string)), () => []),\n }),\n);\n","import {\n constant,\n object,\n string,\n boolean,\n optional,\n} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseVideoWidget = parseWidget(\n constant(\"video\"),\n object({\n location: string,\n static: optional(boolean),\n }),\n);\n","import {pair, string} from \"../general-purpose-parsers\";\n\nimport type {Parser} from \"../parser-types\";\n\n/**\n * Parses a string representation of a non-negative integer.\n *\n * This parser is used for the numeric part of widget IDs (e.g., the \"1\" in \"radio 1\").\n * It accepts string representations of non-negative integers, including \"0\".\n *\n * Note: The article renderer allows widget IDs with 0 (at least for image widgets),\n * but if widget IDs in an exercise contain 0, the exercise renderer may have issues.\n * We allow 0 here for compatibility with articles.\n *\n * @param rawValue - The raw value to parse, expected to be a string\n * @param ctx - The parse context for error reporting\n * @returns A ParseResult containing either the parsed number or an error\n */\nexport const parseStringToNonNegativeInt: Parser<number> = (rawValue, ctx) => {\n // The article renderer seems to allow the numeric part of a widget ID to\n // be 0, at least for image widgets. However, if widget IDs in an exercise\n // contain 0, the exercise renderer will blow up. We allow 0 here for\n // compatibility with articles.\n if (typeof rawValue !== \"string\" || !/^(0|[1-9][0-9]*)$/.test(rawValue)) {\n return ctx.failure(\n \"a string representing a non-negative integer\",\n rawValue,\n );\n }\n return ctx.success(+rawValue);\n};\n\n/**\n * Parses widget ID components into a [type, number] tuple.\n *\n * Widget IDs in Perseus follow the format \"{type} {number}\" (e.g., \"radio 1\", \"dropdown 2\").\n * This parser takes the components of a widget ID (after splitting on spaces) and\n * validates that it consists of exactly two parts: a widget type string and a\n * non-negative integer.\n *\n * @type {Parser<[string, number]>} A parser that returns a tuple of [widgetType, widgetNumber]\n */\nexport const parseWidgetIdComponents = pair(\n string,\n parseStringToNonNegativeInt,\n);\n","import {any, isPlainObject, object, constant} from \"../general-purpose-parsers\";\nimport {isFailure} from \"../result\";\n\nimport {parseCategorizerWidget} from \"./categorizer-widget\";\nimport {parseCSProgramWidget} from \"./cs-program-widget\";\nimport {parseDefinitionWidget} from \"./definition-widget\";\nimport {parseDropdownWidget} from \"./dropdown-widget\";\nimport {parseExplanationWidget} from \"./explanation-widget\";\nimport {parseExpressionWidget} from \"./expression-widget\";\nimport {parseFreeResponseWidget} from \"./free-response-widget\";\nimport {parseGradedGroupSetWidget} from \"./graded-group-set-widget\";\nimport {parseGradedGroupWidget} from \"./graded-group-widget\";\nimport {parseGrapherWidget} from \"./grapher-widget\";\nimport {parseGroupWidget} from \"./group-widget\";\nimport {parseIframeWidget} from \"./iframe-widget\";\nimport {parseImageWidget} from \"./image-widget\";\nimport {parseInputNumberWidget} from \"./input-number-widget\";\nimport {parseInteractionWidget} from \"./interaction-widget\";\nimport {parseInteractiveGraphWidget} from \"./interactive-graph-widget\";\nimport {parseLabelImageWidget} from \"./label-image-widget\";\nimport {parseMatcherWidget} from \"./matcher-widget\";\nimport {parseMatrixWidget} from \"./matrix-widget\";\nimport {parseMeasurerWidget} from \"./measurer-widget\";\nimport {parseMoleculeRendererWidget} from \"./molecule-renderer-widget\";\nimport {parseNumberLineWidget} from \"./number-line-widget\";\nimport {parseNumericInputWidget} from \"./numeric-input-widget\";\nimport {parseOrdererWidget} from \"./orderer-widget\";\nimport {parsePassageRefWidget} from \"./passage-ref-widget\";\nimport {parsePassageWidget} from \"./passage-widget\";\nimport {parsePhetSimulationWidget} from \"./phet-simulation-widget\";\nimport {parsePlotterWidget} from \"./plotter-widget\";\nimport {parsePythonProgramWidget} from \"./python-program-widget\";\nimport {parseRadioWidget} from \"./radio-widget\";\nimport {parseSorterWidget} from \"./sorter-widget\";\nimport {parseTableWidget} from \"./table-widget\";\nimport {parseVideoWidget} from \"./video-widget\";\nimport {parseWidget} from \"./widget\";\nimport {parseWidgetIdComponents} from \"./widget-id-components\";\n\nimport type {\n DeprecatedStandinWidget,\n PerseusWidgetsMap,\n} from \"../../data-schema\";\nimport type {ParseContext, Parser, ParseResult} from \"../parser-types\";\n\nexport const parseWidgetsMap: Parser<PerseusWidgetsMap> = (rawValue, ctx) => {\n if (!isPlainObject(rawValue)) {\n return ctx.failure(\"PerseusWidgetsMap\", rawValue);\n }\n\n const widgetsMap: PerseusWidgetsMap = {};\n for (const key of Object.keys(rawValue)) {\n // parseWidgetsMapEntry modifies the widgetsMap. This is kind of gross,\n // but it's the only way I could find to make TypeScript check the key\n // against the widget type.\n const entryResult = parseWidgetsMapEntry(\n [key, rawValue[key]],\n widgetsMap,\n ctx.forSubtree(key),\n );\n if (isFailure(entryResult)) {\n return entryResult;\n }\n }\n\n return ctx.success(widgetsMap);\n};\n\nconst parseWidgetsMapEntry: (\n entry: [string, unknown],\n widgetMap: PerseusWidgetsMap,\n ctx: ParseContext,\n) => ParseResult<unknown> = ([id, widget], widgetMap, ctx) => {\n const idComponentsResult = parseWidgetIdComponents(\n id.split(\" \"),\n ctx.forSubtree(\"(widget ID)\"),\n );\n if (isFailure(idComponentsResult)) {\n return idComponentsResult;\n }\n const [type, n] = idComponentsResult.value;\n\n function parseAndAssign<K extends keyof PerseusWidgetsMap>(\n key: K,\n parse: Parser<PerseusWidgetsMap[K]>,\n ): ParseResult<unknown> {\n const widgetResult = parse(widget, ctx);\n if (isFailure(widgetResult)) {\n return widgetResult;\n }\n widgetMap[key] = widgetResult.value;\n return ctx.success(undefined);\n }\n\n switch (type) {\n case \"categorizer\":\n return parseAndAssign(`categorizer ${n}`, parseCategorizerWidget);\n case \"cs-program\":\n return parseAndAssign(`cs-program ${n}`, parseCSProgramWidget);\n case \"definition\":\n return parseAndAssign(`definition ${n}`, parseDefinitionWidget);\n case \"dropdown\":\n return parseAndAssign(`dropdown ${n}`, parseDropdownWidget);\n case \"explanation\":\n return parseAndAssign(`explanation ${n}`, parseExplanationWidget);\n case \"expression\":\n return parseAndAssign(`expression ${n}`, parseExpressionWidget);\n case \"free-response\":\n return parseAndAssign(\n `free-response ${n}`,\n parseFreeResponseWidget,\n );\n case \"grapher\":\n return parseAndAssign(`grapher ${n}`, parseGrapherWidget);\n case \"group\":\n return parseAndAssign(`group ${n}`, parseGroupWidget);\n case \"graded-group\":\n return parseAndAssign(`graded-group ${n}`, parseGradedGroupWidget);\n case \"graded-group-set\":\n return parseAndAssign(\n `graded-group-set ${n}`,\n parseGradedGroupSetWidget,\n );\n case \"iframe\":\n return parseAndAssign(`iframe ${n}`, parseIframeWidget);\n case \"image\":\n return parseAndAssign(`image ${n}`, parseImageWidget);\n case \"input-number\":\n return parseAndAssign(`input-number ${n}`, parseInputNumberWidget);\n case \"interaction\":\n return parseAndAssign(`interaction ${n}`, parseInteractionWidget);\n case \"interactive-graph\":\n return parseAndAssign(\n `interactive-graph ${n}`,\n parseInteractiveGraphWidget,\n );\n case \"label-image\":\n return parseAndAssign(`label-image ${n}`, parseLabelImageWidget);\n case \"matcher\":\n return parseAndAssign(`matcher ${n}`, parseMatcherWidget);\n case \"matrix\":\n return parseAndAssign(`matrix ${n}`, parseMatrixWidget);\n case \"measurer\":\n return parseAndAssign(`measurer ${n}`, parseMeasurerWidget);\n case \"molecule-renderer\":\n return parseAndAssign(\n `molecule-renderer ${n}`,\n parseMoleculeRendererWidget,\n );\n case \"number-line\":\n return parseAndAssign(`number-line ${n}`, parseNumberLineWidget);\n case \"numeric-input\":\n return parseAndAssign(\n `numeric-input ${n}`,\n parseNumericInputWidget,\n );\n case \"orderer\":\n return parseAndAssign(`orderer ${n}`, parseOrdererWidget);\n case \"passage\":\n return parseAndAssign(`passage ${n}`, parsePassageWidget);\n case \"passage-ref\":\n return parseAndAssign(`passage-ref ${n}`, parsePassageRefWidget);\n case \"passage-ref-target\":\n // NOTE(benchristel): as of 2024-11-12, passage-ref-target is only\n // used in test content. See:\n // https://www.khanacademy.org/devadmin/content/search?query=widget:passage-ref-target\n return parseAndAssign(`passage-ref-target ${n}`, any);\n case \"phet-simulation\":\n return parseAndAssign(\n `phet-simulation ${n}`,\n parsePhetSimulationWidget,\n );\n case \"plotter\":\n return parseAndAssign(`plotter ${n}`, parsePlotterWidget);\n case \"python-program\":\n return parseAndAssign(\n `python-program ${n}`,\n parsePythonProgramWidget,\n );\n case \"radio\":\n return parseAndAssign(`radio ${n}`, parseRadioWidget);\n case \"sorter\":\n return parseAndAssign(`sorter ${n}`, parseSorterWidget);\n case \"table\":\n return parseAndAssign(`table ${n}`, parseTableWidget);\n case \"video\":\n return parseAndAssign(`video ${n}`, parseVideoWidget);\n case \"sequence\":\n // sequence is a deprecated widget type, and the corresponding\n // widget component no longer exists.\n return parseAndAssign(`sequence ${n}`, parseDeprecatedWidget);\n case \"lights-puzzle\":\n return parseAndAssign(`lights-puzzle ${n}`, parseDeprecatedWidget);\n case \"simulator\":\n return parseAndAssign(`simulator ${n}`, parseDeprecatedWidget);\n case \"transformer\":\n return parseAndAssign(`transformer ${n}`, parseDeprecatedWidget);\n\n default:\n return parseAndAssign(\n `${type} ${n}` as any,\n parseWidget(constant(type), any) as any,\n );\n }\n};\n\nconst parseDeprecatedWidget: Parser<DeprecatedStandinWidget> = parseWidget(\n // Ignore the incoming widget type and hardcode \"deprecated-standin\"\n (_, ctx) => ctx.success(\"deprecated-standin\" as const),\n // Allow any widget options\n object({}),\n);\n","import {any, object, string} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseImages} from \"./images-map\";\nimport {parseWidgetsMap} from \"./widgets-map\";\n\nimport type {PerseusRenderer} from \"../../data-schema\";\nimport type {Parser} from \"../parser-types\";\n\nexport const parsePerseusRenderer: Parser<PerseusRenderer> = defaulted(\n object({\n // TODO(benchristel): content is also defaulted to empty string in\n // renderer.tsx. See if we can remove one default or the other.\n content: defaulted(string, () => \"\"),\n // This module has an import cycle with parseWidgetsMap, because the\n // `group` widget can contain another renderer.\n // The anonymous function below ensures that we don't try to access\n // parseWidgetsMap before it's defined.\n widgets: defaulted(\n (rawVal, ctx) => parseWidgetsMap(rawVal, ctx),\n () => ({}),\n ),\n images: parseImages,\n // deprecated\n metadata: any,\n }),\n // Default value\n () => ({\n content: \"\",\n widgets: {},\n images: {},\n }),\n);\n","import {array, union} from \"../general-purpose-parsers\";\n\nimport {parsePerseusRenderer} from \"./perseus-renderer\";\n\nimport type {PerseusArticle} from \"../../data-schema\";\nimport type {Parser} from \"../parser-types\";\n\nexport const parsePerseusArticle: Parser<PerseusArticle> = union(\n parsePerseusRenderer,\n).or(array(parsePerseusRenderer)).parser;\n","import {\n any,\n boolean,\n object,\n optional,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseImages} from \"./images-map\";\nimport {parseWidgetsMap} from \"./widgets-map\";\n\nexport const parseHint = object({\n replace: defaulted(optional(boolean), () => undefined),\n content: string,\n widgets: defaulted(parseWidgetsMap, () => ({})),\n images: parseImages,\n // deprecated\n metadata: any,\n});\n","import {object, pipeParsers} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nexport const parsePerseusAnswerArea = pipeParsers(\n defaulted(object({}), () => ({})),\n).then(convert(toAnswerArea)).parser;\n\n// Some answerAreas have extra, bogus fields, like:\n//\n// \"answerArea\": {\n// \"type\": \"multiple\",\n// \"options\": {},\n// \"version\": null,\n// \"static\": false,\n// \"graded\": false,\n// \"alignment\": \"\",\n// }\n//\n// This function filters the fields of an answerArea object, keeping only the\n// known ones, and converts `undefined` and `null` values to `false`.\nfunction toAnswerArea(raw: Record<string, unknown>) {\n return {\n calculator: !!raw.calculator,\n financialCalculatorMonthlyPayment:\n !!raw.financialCalculatorMonthlyPayment,\n financialCalculatorTotalAmount: !!raw.financialCalculatorTotalAmount,\n financialCalculatorTimeToPayOff: !!raw.financialCalculatorTimeToPayOff,\n periodicTable: !!raw.periodicTable,\n periodicTableWithKey: !!raw.periodicTableWithKey,\n };\n}\n","import {array, object} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseHint} from \"./hint\";\nimport {parsePerseusAnswerArea} from \"./perseus-answer-area\";\nimport {parsePerseusRenderer} from \"./perseus-renderer\";\n\nimport type {PerseusItem} from \"../../data-schema\";\nimport type {Parser} from \"../parser-types\";\n\nexport const parsePerseusItem: Parser<PerseusItem> = object({\n question: parsePerseusRenderer,\n hints: defaulted(array(parseHint), () => []),\n answerArea: parsePerseusAnswerArea,\n});\n","import {\n object,\n array,\n number,\n optional,\n nullable,\n} from \"../general-purpose-parsers\";\n\nexport const parseCategorizerUserInput = object({\n values: array(optional(nullable(number))),\n});\n","import {\n enumeration,\n nullable,\n object,\n string,\n} from \"../general-purpose-parsers\";\n\nexport const parseCSProgramUserInput = object({\n status: enumeration(\"correct\", \"incorrect\", \"incomplete\"),\n message: nullable(string),\n});\n","import {number, object} from \"../general-purpose-parsers\";\n\nexport const parseDropdownUserInput = object({\n value: number,\n});\n","import {string} from \"../general-purpose-parsers\";\n\nexport const parseExpressionUserInput = string;\n","import {object, string} from \"../general-purpose-parsers\";\n\nexport const parseFreeResponseUserInput = object({\n currentValue: string,\n});\n","import {\n constant,\n nullable,\n number,\n object,\n pair,\n} from \"../general-purpose-parsers\";\nimport {discriminatedUnionOn} from \"../general-purpose-parsers/discriminated-union\";\n\nconst coord = pair(number, number);\nconst coordPair = pair(coord, coord);\n\nconst parseAbsoluteValueBranch = object({\n type: constant(\"absolute_value\"),\n coords: nullable(coordPair),\n});\n\nconst parseExponentialBranch = object({\n type: constant(\"exponential\"),\n asymptote: coordPair,\n coords: nullable(coordPair),\n});\n\nconst parseLinearBranch = object({\n type: constant(\"linear\"),\n coords: nullable(coordPair),\n});\n\nconst parseLogarithmBranch = object({\n type: constant(\"logarithm\"),\n asymptote: coordPair,\n coords: nullable(coordPair),\n});\n\nconst parseQuadraticBranch = object({\n type: constant(\"quadratic\"),\n coords: nullable(coordPair),\n});\n\nconst parseSinusoidBranch = object({\n type: constant(\"sinusoid\"),\n coords: nullable(coordPair),\n});\n\nconst parseTangentBranch = object({\n type: constant(\"tangent\"),\n coords: nullable(coordPair),\n});\n\nexport const parseGrapherUserInput = discriminatedUnionOn(\"type\")\n .withBranch(\"absolute_value\", parseAbsoluteValueBranch)\n .withBranch(\"exponential\", parseExponentialBranch)\n .withBranch(\"linear\", parseLinearBranch)\n .withBranch(\"logarithm\", parseLogarithmBranch)\n .withBranch(\"quadratic\", parseQuadraticBranch)\n .withBranch(\"sinusoid\", parseSinusoidBranch)\n .withBranch(\"tangent\", parseTangentBranch).parser;\n","import {parseUserInputMap} from \"./user-input-map\";\n\nimport type {PerseusGroupUserInput} from \"../../validation.types\";\nimport type {Parser} from \"../parser-types\";\n\n// NOTE(TB): Function wrapper is necessary to avoid circular import issues with user-input-map.ts\nexport const parseGroupUserInput: Parser<PerseusGroupUserInput> = (\n rawVal,\n ctx,\n) => parseUserInputMap(rawVal, ctx);\n","import {\n enumeration,\n nullable,\n object,\n optional,\n string,\n} from \"../general-purpose-parsers\";\n\nexport const parseIFrameUserInput = object({\n status: enumeration(\"correct\", \"incorrect\", \"incomplete\"),\n message: optional(nullable(string)),\n});\n","import {object, string} from \"../general-purpose-parsers\";\n\nexport const parseInputNumberUserInput = object({\n currentValue: string,\n});\n","import {parsePerseusGraphType} from \"./interactive-graph-widget\";\n\nexport const parseInteractiveGraphUserInput = parsePerseusGraphType;\n","import {array, object, optional, string} from \"../general-purpose-parsers\";\n\nexport const parseLabelImageUserInput = object({\n markers: array(\n object({\n selected: optional(array(string)),\n label: string,\n }),\n ),\n});\n","import {object, array, string} from \"../general-purpose-parsers\";\n\nexport const parseMatcherUserInput = object({\n left: array(string),\n right: array(string),\n});\n","import {array, string, object} from \"../general-purpose-parsers\";\n\nexport const parseMatrixUserInput = object({\n answers: array(array(string)),\n});\n","import {object, number, enumeration} from \"../general-purpose-parsers\";\n\nexport const parseNumberLineUserInput = object({\n numLinePosition: number,\n rel: enumeration(\"eq\", \"lt\", \"gt\", \"le\", \"ge\"),\n numDivisions: number,\n});\n","import {object, string} from \"../general-purpose-parsers\";\n\nexport const parseNumericInputUserInput = object({\n currentValue: string,\n});\n","import {array, object, string} from \"../general-purpose-parsers\";\n\nexport const parseOrdererUserInput = object({\n current: array(string),\n});\n","import {array, number} from \"../general-purpose-parsers\";\n\nexport const parsePlotterUserInput = array(number);\n","import {array, object, string} from \"../general-purpose-parsers\";\n\nexport const parseRadioUserInput = object({\n selectedChoiceIds: array(string),\n});\n","import {array, boolean, object, string} from \"../general-purpose-parsers\";\n\nexport const parseSorterUserInput = object({\n options: array(string),\n changed: boolean,\n});\n","import {array, string} from \"../general-purpose-parsers\";\n\nexport const parseTableUserInput = array(array(string));\n","import {any, isPlainObject} from \"../general-purpose-parsers\";\nimport {isFailure} from \"../result\";\n\nimport {parseCategorizerUserInput} from \"./categorizer-user-input\";\nimport {parseCSProgramUserInput} from \"./cs-program-user-input\";\nimport {parseDropdownUserInput} from \"./dropdown-user-input\";\nimport {parseExpressionUserInput} from \"./expression-user-input\";\nimport {parseFreeResponseUserInput} from \"./free-response-user-input\";\nimport {parseGrapherUserInput} from \"./grapher-user-input\";\nimport {parseGroupUserInput} from \"./group-user-input\";\nimport {parseIFrameUserInput} from \"./iframe-user-input\";\nimport {parseInputNumberUserInput} from \"./input-number-user-input\";\nimport {parseInteractiveGraphUserInput} from \"./interactive-graph-user-input\";\nimport {parseLabelImageUserInput} from \"./label-image-user-input\";\nimport {parseMatcherUserInput} from \"./matcher-user-input\";\nimport {parseMatrixUserInput} from \"./matrix-user-input\";\nimport {parseNumberLineUserInput} from \"./number-line-user-input\";\nimport {parseNumericInputUserInput} from \"./numeric-input-user-input\";\nimport {parseOrdererUserInput} from \"./orderer-user-input\";\nimport {parsePlotterUserInput} from \"./plotter-user-input\";\nimport {parseRadioUserInput} from \"./radio-user-input\";\nimport {parseSorterUserInput} from \"./sorter-user-input\";\nimport {parseTableUserInput} from \"./table-user-input\";\nimport {parseWidgetIdComponents} from \"./widget-id-components\";\n\nimport type {UserInputMap} from \"../../validation.types\";\nimport type {ParseContext, Parser, ParseResult} from \"../parser-types\";\n\n/**\n * Parses a UserInputMap, which is a map of widget IDs to their corresponding user input data.\n *\n * A UserInputMap maps widget IDs (like \"radio 1\", \"dropdown 2\") to the user input data\n * for each widget. This is used by Group widgets and other contexts where multiple\n * widgets need to be tracked together.\n *\n * The parser handles recursive structures since Group widgets can contain other Group\n * widgets, each with their own UserInputMap.\n *\n * @param rawValue - The raw value to parse, expected to be a plain object\n * @param ctx - The parse context for error reporting and tracking\n * @returns A ParseResult containing either the parsed UserInputMap or an error\n */\nexport const parseUserInputMap: Parser<UserInputMap> = (rawValue, ctx) => {\n if (!isPlainObject(rawValue)) {\n return ctx.failure(\"UserInputMap\", rawValue);\n }\n\n const userInputMap: UserInputMap = {};\n for (const key of Object.keys(rawValue)) {\n // parseUserInputMapEntry modifies the userInputMap. This is to make\n // TypeScript check the key against the widget type.\n const entryResult = parseUserInputMapEntry(\n [key, rawValue[key]],\n userInputMap,\n ctx.forSubtree(key),\n );\n if (isFailure(entryResult)) {\n return entryResult;\n }\n }\n\n return ctx.success(userInputMap);\n};\n\n/**\n * Parses a single entry in a UserInputMap and adds it to the provided map.\n *\n * This function takes a [widgetId, userInput] pair, parses the widget ID to determine\n * the widget type, then uses the appropriate parser for that widget type's user input.\n * The parsed result is added to the provided userInputMap.\n *\n * This approach is used to maintain strong typing - TypeScript can verify that each\n * widget ID maps to the correct user input type based on the widget type extracted\n * from the ID.\n *\n * @param entry - A tuple of [widgetId, rawUserInput] to parse\n * @param userInputMap - The UserInputMap to modify with the parsed entry\n * @param ctx - The parse context for error reporting\n * @returns A ParseResult indicating success or failure\n */\nconst parseUserInputMapEntry: (\n entry: [string, unknown],\n userInputMap: UserInputMap,\n ctx: ParseContext,\n) => ParseResult<unknown> = ([id, userInput], userInputMap, ctx) => {\n const idComponentsResult = parseWidgetIdComponents(\n id.split(\" \"),\n ctx.forSubtree(\"(widget ID)\"),\n );\n if (isFailure(idComponentsResult)) {\n return idComponentsResult;\n }\n const [type, n] = idComponentsResult.value;\n\n function parseAndAssign<K extends keyof UserInputMap>(\n key: K,\n parse: Parser<UserInputMap[K]>,\n ): ParseResult<unknown> {\n const userInputResult = parse(userInput, ctx);\n if (isFailure(userInputResult)) {\n return userInputResult;\n }\n userInputMap[key] = userInputResult.value;\n return ctx.success(undefined);\n }\n\n switch (type) {\n case \"categorizer\":\n return parseAndAssign(\n `categorizer ${n}`,\n parseCategorizerUserInput,\n );\n case \"cs-program\":\n return parseAndAssign(`cs-program ${n}`, parseCSProgramUserInput);\n case \"dropdown\":\n return parseAndAssign(`dropdown ${n}`, parseDropdownUserInput);\n case \"expression\":\n return parseAndAssign(`expression ${n}`, parseExpressionUserInput);\n case \"free-response\":\n return parseAndAssign(\n `free-response ${n}`,\n parseFreeResponseUserInput,\n );\n case \"grapher\":\n return parseAndAssign(`grapher ${n}`, parseGrapherUserInput);\n case \"group\":\n // Recursive case: group user input is itself a UserInputMap\n return parseAndAssign(`group ${n}`, parseGroupUserInput);\n case \"iframe\":\n return parseAndAssign(`iframe ${n}`, parseIFrameUserInput);\n case \"input-number\":\n return parseAndAssign(\n `input-number ${n}`,\n parseInputNumberUserInput,\n );\n case \"interactive-graph\":\n return parseAndAssign(\n `interactive-graph ${n}`,\n parseInteractiveGraphUserInput,\n );\n case \"label-image\":\n return parseAndAssign(`label-image ${n}`, parseLabelImageUserInput);\n case \"matcher\":\n return parseAndAssign(`matcher ${n}`, parseMatcherUserInput);\n case \"matrix\":\n return parseAndAssign(`matrix ${n}`, parseMatrixUserInput);\n case \"number-line\":\n return parseAndAssign(`number-line ${n}`, parseNumberLineUserInput);\n case \"numeric-input\":\n return parseAndAssign(\n `numeric-input ${n}`,\n parseNumericInputUserInput,\n );\n case \"orderer\":\n return parseAndAssign(`orderer ${n}`, parseOrdererUserInput);\n case \"plotter\":\n return parseAndAssign(`plotter ${n}`, parsePlotterUserInput);\n case \"radio\":\n return parseAndAssign(`radio ${n}`, parseRadioUserInput);\n case \"sorter\":\n return parseAndAssign(`sorter ${n}`, parseSorterUserInput);\n case \"table\":\n return parseAndAssign(`table ${n}`, parseTableUserInput);\n\n default:\n // For unknown widget types, accept any input\n return parseAndAssign(`${type} ${n}` as any, any);\n }\n};\n","import {isRealJSONParse} from \"../utils/is-real-json-parse\";\n\nimport {parse} from \"./parse\";\nimport {parsePerseusArticle as migrateAndTypecheckPerseusArticle} from \"./perseus-parsers/perseus-article\";\nimport {parsePerseusItem as migrateAndTypecheckPerseusItem} from \"./perseus-parsers/perseus-item\";\nimport {parseUserInputMap} from \"./perseus-parsers/user-input-map\";\nimport {failure, isFailure} from \"./result\";\n\nimport type {Result} from \"./result\";\nimport type {PerseusItem, PerseusArticle} from \"../data-schema\";\nimport type {UserInputMap} from \"../validation.types\";\n\n/**\n * Helper to parse PerseusItem JSON\n * Why not just use JSON.parse? We want:\n * - To make sure types are correct\n * - To give us a central place to validate/transform output if needed\n * @deprecated - use parseAndMigratePerseusItem instead\n * @param {string} json - the stringified PerseusItem JSON\n * @returns {PerseusItem} the parsed PerseusItem object\n */\nexport function parsePerseusItem(json: string): PerseusItem {\n // Try to block a cheating vector which relies on monkey-patching\n // JSON.parse\n if (isRealJSONParse(JSON.parse)) {\n return JSON.parse(json);\n }\n throw new Error(\"Something went wrong.\");\n}\n\nexport type ParseFailureDetail = {\n /**\n * A human-readable error message describing where in the object tree\n * parsing failed.\n */\n message: string;\n /**\n * The raw result of parsing the input JSON, with no migrations applied.\n * Use at your own risk.\n */\n invalidObject: unknown;\n};\n\n/**\n * Parses a PerseusItem from a plain object or JSON string, migrates old\n * formats to the latest schema, and runtime-typechecks the result. Use this to\n * parse assessmentItem data.\n *\n * @returns a {@link Result} of the parsed PerseusItem. If the result is a\n * failure, it will contain an error message describing where in the tree\n * parsing failed.\n * @throws SyntaxError if the argument is not well-formed JSON.\n */\nexport function parseAndMigratePerseusItem(\n data: unknown,\n): Result<PerseusItem, ParseFailureDetail> {\n throwErrorIfCheatingDetected();\n const object: unknown = typeof data === \"string\" ? JSON.parse(data) : data;\n const result = parse(object, migrateAndTypecheckPerseusItem);\n if (isFailure(result)) {\n return failure({message: result.detail, invalidObject: object});\n }\n return result;\n}\n\n/**\n * Parses a PerseusArticle from a plain object (or array) or JSON string,\n * migrates old formats to the latest schema, and runtime-typechecks the\n * result.\n *\n * @returns a {@link Result} of the parsed PerseusArticle. If the result is a\n * failure, it will contain an error message describing where in the tree\n * parsing failed.\n * @throws SyntaxError if the argument is not well-formed JSON.\n */\nexport function parseAndMigratePerseusArticle(\n data: unknown,\n): Result<PerseusArticle, ParseFailureDetail> {\n throwErrorIfCheatingDetected();\n const object: unknown = typeof data === \"string\" ? JSON.parse(data) : data;\n const result = parse(object, migrateAndTypecheckPerseusArticle);\n if (isFailure(result)) {\n return failure({message: result.detail, invalidObject: object});\n }\n return result;\n}\n\n/**\n * Parses a UserInputMap from a plain object or JSON string, migrates old\n * formats to the latest schema, and runtime-typechecks the result.\n *\n * @returns a {@link Result} of the parsed UserInputMap. If the result is a\n * failure, it will contain an error message describing where in the tree\n * parsing failed.\n * @throws SyntaxError if the argument is a string that is not well-formed\n * JSON.\n */\nexport function parseAndMigrateUserInputMap(\n data: unknown,\n): Result<UserInputMap, ParseFailureDetail> {\n const object: unknown = typeof data === \"string\" ? JSON.parse(data) : data;\n const result = parse(object, parseUserInputMap);\n if (isFailure(result)) {\n return failure({message: result.detail, invalidObject: object});\n }\n return result;\n}\n\n/**\n * Tries to block a cheating vector that relies on monkey-patching JSON.parse.\n */\n// TODO(LEMS-2331): delete this function once server-side scoring is done.\nfunction throwErrorIfCheatingDetected() {\n if (!isRealJSONParse(JSON.parse)) {\n throw new Error(\"Something went wrong.\");\n }\n}\n","// This file is processed by a Rollup plugin (replace) to inject the production\n// version number during the release build.\n// In dev, you'll never see the version number.\n\nimport {addLibraryVersionToPerseusDebug} from \"@khanacademy/perseus-utils\";\n\nconst libName = \"@khanacademy/perseus-core\";\nexport const libVersion = \"__lib_version__\";\n\naddLibraryVersionToPerseusDebug(libName, libVersion);\n","/**\n * Errors utility for referencing the Perseus error taxonomy.\n */\nexport const Errors = Object.freeze({\n /**\n * @property {ErrorKind} Unknown The kind of error is not known.\n */\n Unknown: \"Unknown\",\n /**\n * @property {ErrorKind} Internal The error is internal to the executing code.\n */\n Internal: \"Internal\",\n /**\n * @property {ErrorKind} InvalidInput There was a problem with the provided\n * input, such as the wrong format or a null value.\n */\n InvalidInput: \"InvalidInput\",\n /**\n * @property {ErrorKind} NotAllowed There was a problem due to the state of\n * the system not matching the requested operation or input. For example,\n * trying to create a username that is valid, but is already taken by\n * another user. Use {@link InvalidInput} instead when the input isn't\n * valid regardless of the state of the system. Use {@link NotFound} when\n * the failure is due to not being able to find a resource.\n */\n NotAllowed: \"NotAllowed\",\n /**\n * @property {ErrorKind} TransientService There was a problem when making a\n * request to a service.\n */\n TransientService: \"TransientService\",\n /**\n * @property {ErrorKind} Service There was a non-transient problem when\n * making a request to service.\n */\n Service: \"Service\",\n});\n\n/**\n * @type {ErrorKind} The kind of error being reported\n */\nexport type ErrorKind = (typeof Errors)[keyof typeof Errors];\n","import type {ErrorKind} from \"./errors\";\nimport type {Metadata} from \"@khanacademy/wonder-stuff-core\";\n\ntype Options = {\n metadata?: Metadata | null | undefined;\n};\n\nexport class PerseusError extends Error {\n kind: ErrorKind;\n metadata: Metadata | null | undefined;\n\n constructor(message: string, kind: ErrorKind, options?: Options) {\n super(message);\n this.kind = kind;\n this.metadata = options?.metadata;\n }\n}\n","/**\n * _ utilities for objects\n */\n\nimport _ from \"underscore\";\n\n/**\n * Does a pluck on keys inside objects in an object\n *\n * Ex:\n * tools = {\n * translation: {\n * enabled: true\n * },\n * rotation: {\n * enabled: false\n * }\n * };\n * pluckObject(tools, \"enabled\") returns {\n * translation: true\n * rotation: false\n * }\n */\nexport const pluck = function (table: any, subKey: string): any {\n return _.object(\n _.map(table, function (value, key) {\n return [key, value[subKey]];\n }),\n );\n};\n\n/**\n * Maps an object to an object\n *\n * > mapObject({a: '1', b: '2'}, (value, key) => {\n * return value + 1;\n * });\n * {a: 2, b: 3}\n */\nexport const mapObject = function <K extends string, V, U>(\n obj: Record<K, V>,\n lambda: (arg1: V, arg2: K) => U,\n): Record<K, U> {\n const result: Record<string, any> = {};\n Object.keys(obj).forEach((key) => {\n // @ts-expect-error - TS2345 - Argument of type 'string' is not assignable to parameter of type 'K'.\n result[key] = lambda(obj[key], key);\n });\n return result;\n};\n","import type {PerseusCategorizerWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusCategorizerWidgetOptions type\n */\nexport type CategorizerPublicWidgetOptions = {\n items: PerseusCategorizerWidgetOptions[\"items\"];\n categories: PerseusCategorizerWidgetOptions[\"categories\"];\n randomizeItems: PerseusCategorizerWidgetOptions[\"randomizeItems\"];\n static: PerseusCategorizerWidgetOptions[\"static\"];\n};\n\n/**\n * Given a PerseusCategorizerWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getCategorizerPublicWidgetOptions(\n options: PerseusCategorizerWidgetOptions,\n): CategorizerPublicWidgetOptions {\n return {\n items: options.items,\n categories: options.categories,\n randomizeItems: options.randomizeItems,\n static: options.static,\n };\n}\n\nexport default getCategorizerPublicWidgetOptions;\n","import getCategorizerPublicWidgetOptions from \"./categorizer-util\";\n\nimport type {PerseusCategorizerWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type CategorizerDefaultWidgetOptions = Pick<\n PerseusCategorizerWidgetOptions,\n \"items\" | \"categories\" | \"values\" | \"randomizeItems\"\n>;\n\nconst defaultWidgetOptions: CategorizerDefaultWidgetOptions = {\n items: [],\n categories: [],\n values: [],\n randomizeItems: false,\n};\n\nconst categorizerWidgetLogic: WidgetLogic = {\n name: \"categorizer\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getCategorizerPublicWidgetOptions,\n accessible: false,\n};\n\nexport default categorizerWidgetLogic;\n","import type {PerseusCSProgramWidgetOptions} from \"../../data-schema\";\n\nexport default function getCSProgramPublicWidgetOptions(\n options: PerseusCSProgramWidgetOptions,\n): PerseusCSProgramWidgetOptions {\n return options;\n}\n","import getCSProgramPublicWidgetOptions from \"./cs-program-util\";\n\nimport type {PerseusCSProgramWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type CSProgramDefaultWidgetOptions = Pick<\n PerseusCSProgramWidgetOptions,\n | \"programID\"\n | \"programType\"\n | \"settings\"\n | \"showEditor\"\n | \"showButtons\"\n | \"height\"\n>;\n\nconst DEFAULT_HEIGHT = 400;\n\nconst defaultWidgetOptions: CSProgramDefaultWidgetOptions = {\n programID: \"\",\n programType: null,\n settings: [{name: \"\", value: \"\"}],\n showEditor: false,\n showButtons: false,\n height: DEFAULT_HEIGHT,\n};\n\nconst csProgramWidgetLogic: WidgetLogic = {\n name: \"cs-program\",\n defaultWidgetOptions,\n supportedAlignments: [\"block\", \"full-width\"],\n getPublicWidgetOptions: getCSProgramPublicWidgetOptions,\n accessible: false,\n};\n\nexport default csProgramWidgetLogic;\n","import type {PerseusDefinitionWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type DefinitionDefaultWidgetOptions = Pick<\n PerseusDefinitionWidgetOptions,\n \"togglePrompt\" | \"definition\"\n>;\n\nconst defaultWidgetOptions: DefinitionDefaultWidgetOptions = {\n togglePrompt: \"\",\n definition: \"\",\n};\n\nconst definitionWidgetLogic: WidgetLogic = {\n name: \"definition\",\n defaultWidgetOptions,\n defaultAlignment: \"inline\",\n accessible: true,\n};\n\nexport default definitionWidgetLogic;\n","import type {PerseusDropdownWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusDropdownWidgetOptions type\n */\nexport type DropdownPublicWidgetOptions = {\n choices: ReadonlyArray<{content: string}>;\n placeholder: PerseusDropdownWidgetOptions[\"placeholder\"];\n static: PerseusDropdownWidgetOptions[\"static\"];\n visibleLabel?: PerseusDropdownWidgetOptions[\"visibleLabel\"];\n ariaLabel?: PerseusDropdownWidgetOptions[\"ariaLabel\"];\n};\n\n/**\n * Given a PerseusDropdownWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getDropdownPublicWidgetOptions(\n options: PerseusDropdownWidgetOptions,\n): DropdownPublicWidgetOptions {\n return {\n choices: options.choices.map((choice) => ({content: choice.content})),\n placeholder: options.placeholder,\n static: options.static,\n visibleLabel: options.visibleLabel,\n ariaLabel: options.ariaLabel,\n };\n}\n\nexport default getDropdownPublicWidgetOptions;\n","import getDropdownPublicWidgetOptions from \"./dropdown-util\";\n\nimport type {PerseusDropdownWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type DropdownDefaultWidgetOptions = Pick<\n PerseusDropdownWidgetOptions,\n \"placeholder\" | \"choices\"\n>;\n\nconst defaultWidgetOptions: DropdownDefaultWidgetOptions = {\n placeholder: \"\",\n choices: [\n {\n content: \"\",\n correct: false,\n },\n ],\n};\n\nconst dropdownWidgetLogic: WidgetLogic = {\n name: \"dropdown\",\n defaultWidgetOptions,\n defaultAlignment: \"inline-block\",\n getPublicWidgetOptions: getDropdownPublicWidgetOptions,\n accessible: true,\n};\n\nexport default dropdownWidgetLogic;\n","import type {PerseusExplanationWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type ExplanationDefaultWidgetOptions = Pick<\n PerseusExplanationWidgetOptions,\n \"showPrompt\" | \"hidePrompt\" | \"explanation\" | \"widgets\"\n>;\n\nconst defaultWidgetOptions: ExplanationDefaultWidgetOptions = {\n showPrompt: \"Explain\",\n hidePrompt: \"Hide explanation\",\n explanation: \"explanation goes here\\n\\nmore explanation\",\n widgets: {},\n};\n\nconst explanationWidgetLogic: WidgetLogic = {\n name: \"explanation\",\n defaultWidgetOptions,\n defaultAlignment: \"inline\",\n accessible: true,\n};\n\nexport default explanationWidgetLogic;\n","import type {PerseusExpressionWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusExpressionWidgetOptions type\n */\nexport type ExpressionPublicWidgetOptions = {\n buttonSets: PerseusExpressionWidgetOptions[\"buttonSets\"];\n functions: PerseusExpressionWidgetOptions[\"functions\"];\n times: PerseusExpressionWidgetOptions[\"times\"];\n visibleLabel?: PerseusExpressionWidgetOptions[\"visibleLabel\"];\n ariaLabel?: PerseusExpressionWidgetOptions[\"ariaLabel\"];\n buttonsVisible?: PerseusExpressionWidgetOptions[\"buttonsVisible\"];\n extraKeys?: PerseusExpressionWidgetOptions[\"extraKeys\"];\n};\n\n/**\n * Given a PerseusExpressionWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getExpressionPublicWidgetOptions(\n options: PerseusExpressionWidgetOptions,\n): ExpressionPublicWidgetOptions {\n return {\n buttonSets: options.buttonSets,\n functions: options.functions,\n times: options.times,\n visibleLabel: options.visibleLabel,\n ariaLabel: options.ariaLabel,\n buttonsVisible: options.buttonsVisible,\n extraKeys: options.extraKeys,\n };\n}\n\nexport default getExpressionPublicWidgetOptions;\n","import getExpressionPublicWidgetOptions from \"./expression-util\";\n\nimport type {PerseusExpressionWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport const currentVersion = {major: 2, minor: 0};\n\nexport type ExpressionDefaultWidgetOptions = Pick<\n PerseusExpressionWidgetOptions,\n \"answerForms\" | \"times\" | \"buttonSets\" | \"functions\"\n>;\n\nexport const defaultWidgetOptions: ExpressionDefaultWidgetOptions = {\n answerForms: [],\n times: false,\n buttonSets: [\"basic\"],\n functions: [\"f\", \"g\", \"h\"],\n};\n\nconst expressionWidgetLogic: WidgetLogic = {\n name: \"expression\",\n version: currentVersion,\n defaultWidgetOptions: defaultWidgetOptions,\n defaultAlignment: \"inline-block\",\n getPublicWidgetOptions: getExpressionPublicWidgetOptions,\n accessible: true,\n};\n\nexport default expressionWidgetLogic;\n","import type {PerseusGradedGroupWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type GradedGroupDefaultWidgetOptions = Pick<\n PerseusGradedGroupWidgetOptions,\n \"title\" | \"content\" | \"widgets\" | \"images\" | \"hint\"\n>;\n\nconst defaultWidgetOptions: GradedGroupDefaultWidgetOptions = {\n title: \"\",\n content: \"\",\n widgets: {},\n images: {},\n hint: null,\n};\n\nconst traverseChildWidgets = function (props: any, traverseRenderer: any): any {\n return {...props, ...traverseRenderer(props)};\n};\n\nconst gradedGroupWidgetLogic: WidgetLogic = {\n name: \"graded-group\",\n defaultWidgetOptions,\n accessible: true,\n traverseChildWidgets: traverseChildWidgets,\n};\n\nexport default gradedGroupWidgetLogic;\n","import type {PerseusFreeResponseWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * {@link PerseusFreeResponseWidgetOptions} type\n */\nexport type FreeResponsePublicWidgetOptions = {\n allowUnlimitedCharacters: PerseusFreeResponseWidgetOptions[\"allowUnlimitedCharacters\"];\n characterLimit: PerseusFreeResponseWidgetOptions[\"characterLimit\"];\n placeholder: PerseusFreeResponseWidgetOptions[\"placeholder\"];\n question: PerseusFreeResponseWidgetOptions[\"question\"];\n};\n\n/**\n * Given a FreeResponsePublicWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getFreeResponsePublicWidgetOptions(\n options: PerseusFreeResponseWidgetOptions,\n): FreeResponsePublicWidgetOptions {\n return {\n allowUnlimitedCharacters: options.allowUnlimitedCharacters,\n characterLimit: options.characterLimit,\n placeholder: options.placeholder,\n question: options.question,\n };\n}\n\nexport default getFreeResponsePublicWidgetOptions;\n","import getFreeResponsePublicWidgetOptions from \"./free-response-util\";\n\nimport type {PerseusFreeResponseWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type FreeResponseDefaultWidgetOptions = Pick<\n PerseusFreeResponseWidgetOptions,\n | \"allowUnlimitedCharacters\"\n | \"characterLimit\"\n | \"placeholder\"\n | \"question\"\n | \"scoringCriteria\"\n>;\n\nconst defaultWidgetOptions: FreeResponseDefaultWidgetOptions = {\n allowUnlimitedCharacters: false,\n characterLimit: 500,\n placeholder: \"Please provide response here\",\n question: \"\",\n // Always display one criterion, since the user will always have to input\n // at least one.\n scoringCriteria: [\n {\n text: \"\",\n },\n ],\n};\n\nconst freeResponseWidgetLogic: WidgetLogic = {\n name: \"free-response\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getFreeResponsePublicWidgetOptions,\n};\n\nexport default freeResponseWidgetLogic;\n","import type {PerseusGradedGroupSetWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type GradedGroupSetDefaultWidgetOptions = Pick<\n PerseusGradedGroupSetWidgetOptions,\n \"gradedGroups\"\n>;\n\nconst defaultWidgetOptions: GradedGroupSetDefaultWidgetOptions = {\n gradedGroups: [],\n};\n\nconst traverseChildWidgets = function (props: any, traverseRenderer: any): any {\n return {...props, ...traverseRenderer(props)};\n};\n\nconst gradedGroupSetWidgetLogic: WidgetLogic = {\n name: \"graded-group-set\",\n defaultWidgetOptions,\n accessible: true,\n traverseChildWidgets: traverseChildWidgets,\n};\n\nexport default gradedGroupSetWidgetLogic;\n","import type {PerseusGrapherWidgetOptions} from \"../../data-schema\";\n\nexport type GrapherPublicWidgetOptions = Pick<\n PerseusGrapherWidgetOptions,\n \"availableTypes\" | \"graph\"\n>;\n\nexport default function getGrapherPublicWidgetOptions(\n options: PerseusGrapherWidgetOptions,\n): GrapherPublicWidgetOptions {\n const {correct: _, ...publicOptions} = options;\n return publicOptions;\n}\n","import getGrapherPublicWidgetOptions from \"./grapher-util\";\n\nimport type {PerseusGrapherWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type GrapherDefaultWidgetOptions = Pick<\n PerseusGrapherWidgetOptions,\n \"graph\" | \"correct\" | \"availableTypes\"\n>;\n\nconst defaultWidgetOptions: GrapherDefaultWidgetOptions = {\n graph: {\n labels: [\"x\", \"y\"],\n range: [\n [-10, 10],\n [-10, 10],\n ],\n step: [1, 1],\n backgroundImage: {\n url: null,\n },\n markings: \"graph\",\n rulerLabel: \"\",\n rulerTicks: 10,\n valid: true,\n showTooltips: false,\n },\n correct: {\n type: \"linear\",\n coords: null,\n },\n availableTypes: [\"linear\"],\n};\n\nconst grapherWidgetLogic: WidgetLogic = {\n name: \"grapher\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getGrapherPublicWidgetOptions,\n accessible: false,\n};\n\nexport default grapherWidgetLogic;\n","class Registry<T> {\n private name: string;\n private contents: Record<string, T> = {};\n private anythingRegistered = false;\n\n constructor(name = \"Registry\") {\n this.name = name;\n }\n\n private throwIfUnregistered() {\n if (!this.anythingRegistered) {\n throw new Error(`${this.name} accessed before initialization!`);\n }\n }\n\n has(key: string): boolean {\n this.throwIfUnregistered();\n return Object.prototype.hasOwnProperty.call(this.contents, key);\n }\n\n get(key: string): T | undefined {\n this.throwIfUnregistered();\n return this.contents[key];\n }\n\n keys(): Array<string> {\n this.throwIfUnregistered();\n return Object.keys(this.contents);\n }\n\n entries(): Array<[string, T]> {\n this.throwIfUnregistered();\n return Object.entries(this.contents);\n }\n\n set(key: string, value: T): void {\n this.anythingRegistered = true;\n this.contents[key] = value;\n }\n}\n\nexport default Registry;\n","import type {WidgetLogic} from \"../logic-export.types\";\n\nconst deprecatedStandinWidgetLogic: WidgetLogic = {\n name: \"deprecated-standin\",\n accessible: true,\n};\n\nexport default deprecatedStandinWidgetLogic;\n","import type {PerseusIFrameWidgetOptions} from \"../../data-schema\";\n\nexport default function getIFramePublicWidgetOptions(\n options: PerseusIFrameWidgetOptions,\n): PerseusIFrameWidgetOptions {\n return options;\n}\n","import getIFramePublicWidgetOptions from \"./iframe-util\";\n\nimport type {PerseusIFrameWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type IFrameDefaultWidgetOptions = Pick<\n PerseusIFrameWidgetOptions,\n | \"url\"\n | \"settings\"\n | \"width\"\n | \"height\"\n | \"allowFullScreen\"\n | \"allowTopNavigation\"\n>;\n\nconst defaultWidgetOptions: IFrameDefaultWidgetOptions = {\n url: \"\",\n settings: [{name: \"\", value: \"\"}],\n width: \"400\",\n height: \"400\",\n allowFullScreen: false,\n allowTopNavigation: false,\n};\n\nconst iframeWidgetLogic: WidgetLogic = {\n name: \"iframe\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getIFramePublicWidgetOptions,\n accessible: false,\n};\n\nexport default iframeWidgetLogic;\n","import type {\n PerseusImageWidgetOptions,\n PerseusWidgetOptions,\n} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type ImageDefaultWidgetOptions = Pick<\n PerseusImageWidgetOptions,\n \"title\" | \"range\" | \"box\" | \"backgroundImage\" | \"labels\" | \"alt\" | \"caption\"\n>;\n\nconst defaultWidgetOptions: ImageDefaultWidgetOptions = {\n title: \"\",\n range: [\n [0, 10],\n [0, 10],\n ],\n box: [400, 400],\n backgroundImage: {\n url: null,\n width: 0,\n height: 0,\n },\n labels: [],\n alt: \"\",\n caption: \"\",\n};\n\nconst imageWidgetLogic: WidgetLogic = {\n name: \"image\",\n defaultWidgetOptions,\n // The float alignments will be set to inline-block floated left or right.\n // This will allow text to wrap around the widget and not have large space\n // on either side.\n supportedAlignments: [\"block\", \"float-left\", \"float-right\", \"full-width\"],\n defaultAlignment: \"block\",\n // This widget's accessibility depends on its widget option: if the image\n // has a background but no alt text, it is not accessible\n accessible: (widgetOptions: PerseusWidgetOptions): boolean => {\n const imageOptions = widgetOptions as PerseusImageWidgetOptions;\n const bgImage = imageOptions.backgroundImage;\n\n // Accessible if:\n // - has background image and alt text (non-empty)\n // - has background image and decorative is true\n const hasBackgroundImage = bgImage.url != null;\n const hasAltText = !!imageOptions.alt;\n const isDecorative = imageOptions.decorative === true;\n\n return hasBackgroundImage && (hasAltText || isDecorative);\n },\n};\n\nexport default imageWidgetLogic;\n","import type {PerseusInputNumberWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusInputNumberWidgetOptions type\n */\ntype InputNumberPublicWidgetOptions = Pick<\n PerseusInputNumberWidgetOptions,\n | \"answerType\"\n | \"inexact\"\n | \"maxError\"\n | \"rightAlign\"\n | \"simplify\"\n | \"size\"\n | \"customKeypad\"\n>;\n\n/**\n * Given a PerseusInputNumberWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getInputNumberPublicWidgetOptions(\n options: PerseusInputNumberWidgetOptions,\n): InputNumberPublicWidgetOptions {\n const {value: _, ...publicWidgetOptions} = options;\n return publicWidgetOptions;\n}\n\nexport default getInputNumberPublicWidgetOptions;\n","import getInputNumberPublicWidgetOptions from \"./input-number-util\";\n\nimport type {PerseusInputNumberWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type InputNumberDefaultWidgetOptions = Pick<\n PerseusInputNumberWidgetOptions,\n | \"value\"\n | \"simplify\"\n | \"size\"\n | \"inexact\"\n | \"maxError\"\n | \"answerType\"\n | \"rightAlign\"\n>;\n\nconst defaultWidgetOptions: InputNumberDefaultWidgetOptions = {\n value: 0,\n simplify: \"required\",\n size: \"normal\",\n inexact: false,\n maxError: 0.1,\n answerType: \"number\",\n rightAlign: false,\n};\n\nconst inputNumberWidgetLogic: WidgetLogic = {\n name: \"input-number\",\n defaultWidgetOptions,\n defaultAlignment: \"inline-block\",\n accessible: false,\n getPublicWidgetOptions: getInputNumberPublicWidgetOptions,\n};\n\nexport default inputNumberWidgetLogic;\n","import type {PerseusInteractionWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type InteractionDefaultWidgetOptions = Pick<\n PerseusInteractionWidgetOptions,\n \"graph\" | \"elements\"\n>;\n\nconst defaultWidgetOptions: InteractionDefaultWidgetOptions = {\n graph: {\n box: [400, 400],\n labels: [\"x\", \"y\"],\n range: [\n [-10, 10],\n [-10, 10],\n ],\n tickStep: [1, 1],\n gridStep: [1, 1],\n markings: \"graph\",\n },\n elements: [],\n};\n\nconst interactionWidgetLogic: WidgetLogic = {\n name: \"interaction\",\n defaultWidgetOptions,\n accessible: false,\n};\n\nexport default interactionWidgetLogic;\n","const svgLabelsRegex = /^web\\+graphie:/;\n// For offline exercises in the mobile app, we download the graphie data\n// (svgs and localized data files) and serve them from the local file\n// system (with file://). We replace urls that start with `web+graphie`\n// in the perseus json with this `file+graphie` prefix to indicate that\n// they should have the `file://` protocol instead of `https://`.\nconst svgLocalLabelsRegex = /^file\\+graphie:/;\n\n// Sometimes other components want to download the actual image e.g. to\n// determine its size. Here, we transform an .svg-labels url into the\n// correct image url, and leave normal image urls alone\nexport function getRealImageUrl(graphieUrl: string): string {\n if (isLabeledSVG(graphieUrl)) {\n return getSvgUrl(graphieUrl);\n }\n return graphieUrl;\n}\n\nexport function isLabeledSVG(graphieUrl: string): boolean {\n return (\n svgLabelsRegex.test(graphieUrl) || svgLocalLabelsRegex.test(graphieUrl)\n );\n}\n\n// For each graphie, there are two urls we need to download from. This gets\n// the base url without the suffix, and `getSvgUrl` and `getDataUrl` apply\n// appropriate suffixes to get the image and other data\nexport function getBaseUrl(graphieUrl: string): string {\n return graphieUrl\n .replace(svgLabelsRegex, \"https:\")\n .replace(svgLocalLabelsRegex, \"file:\");\n}\n\nexport function getSvgUrl(graphieUrl: string): string {\n return getBaseUrl(graphieUrl) + \".svg\";\n}\n\nexport function getDataUrl(graphieUrl: string): string {\n return getBaseUrl(graphieUrl) + \"-data.json\";\n}\n\nexport async function getImageSizeModern(\n url: string,\n): Promise<[number, number]> {\n const image = new Image();\n\n return new Promise((resolve, reject) => {\n // Handle the success case\n image.onload = () => {\n resolve([image.naturalWidth, image.naturalHeight]);\n };\n\n // Handle the error case\n image.onerror = reject;\n\n // Kick off the loading\n image.src = getRealImageUrl(url);\n });\n}\n","import type {PerseusInteractiveGraphWidgetOptions} from \"../../data-schema\";\n\nexport type InteractiveGraphPublicWidgetOptions = Pick<\n PerseusInteractiveGraphWidgetOptions,\n | \"step\"\n | \"gridStep\"\n | \"snapStep\"\n | \"backgroundImage\"\n | \"markings\"\n | \"labels\"\n | \"showProtractor\"\n | \"showRuler\"\n | \"showTooltips\"\n | \"rulerLabel\"\n | \"rulerTicks\"\n | \"range\"\n | \"graph\"\n | \"lockedFigures\"\n | \"fullGraphAriaLabel\"\n | \"fullGraphAriaDescription\"\n>;\n\nexport default function getInteractiveGraphPublicWidgetOptions(\n options: PerseusInteractiveGraphWidgetOptions,\n): InteractiveGraphPublicWidgetOptions {\n const {correct: _, ...publicOptions} = options;\n return publicOptions;\n}\n","import {isLabeledSVG} from \"../../utils/util.graphie\";\n\nimport getInteractiveGraphPublicWidgetOptions from \"./interactive-graph-util\";\n\nimport type {\n PerseusInteractiveGraphWidgetOptions,\n PerseusWidgetOptions,\n} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type InteractiveGraphDefaultWidgetOptions = Pick<\n PerseusInteractiveGraphWidgetOptions,\n | \"labels\"\n | \"labelLocation\"\n | \"range\"\n | \"step\"\n | \"backgroundImage\"\n | \"markings\"\n | \"showTooltips\"\n | \"showProtractor\"\n | \"graph\"\n | \"correct\"\n>;\n\nconst defaultWidgetOptions: InteractiveGraphDefaultWidgetOptions = {\n labels: [\"x\", \"y\"],\n labelLocation: \"onAxis\",\n range: [\n [-10, 10],\n [-10, 10],\n ],\n step: [1, 1],\n backgroundImage: {\n url: null,\n },\n markings: \"graph\",\n showTooltips: false,\n showProtractor: false,\n graph: {\n type: \"linear\",\n },\n correct: {\n type: \"linear\",\n coords: null,\n },\n};\n\nconst interactiveGraphWidgetLogic: WidgetLogic = {\n name: \"interactive-graph\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getInteractiveGraphPublicWidgetOptions,\n // Function determining if a interactive graph is accessible.\n // Interactive Graphs are accessible as long as:\n // 1. They do not contain a protractor\n // 2. They do not contain a graphie background image\n accessible: (widgetOptions: PerseusWidgetOptions): boolean => {\n const interactiveGraphOptions =\n widgetOptions as PerseusInteractiveGraphWidgetOptions;\n\n // Return false (inaccessible) if the interactive graph contains\n // a protractor.\n if (interactiveGraphOptions.showProtractor) {\n return false;\n }\n\n // Return false (inaccessible) if the interactive graph contains\n // a graphie background image.\n if (\n interactiveGraphOptions.backgroundImage?.url &&\n isLabeledSVG(interactiveGraphOptions.backgroundImage?.url)\n ) {\n return false;\n }\n\n return true;\n },\n};\n\nexport default interactiveGraphWidgetLogic;\n","import type {\n PerseusLabelImageMarker,\n PerseusLabelImageWidgetOptions,\n} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusLabelImageWidgetOptions type\n */\nexport type LabelImagePublicWidgetOptions = {\n choices: PerseusLabelImageWidgetOptions[\"choices\"];\n imageUrl: PerseusLabelImageWidgetOptions[\"imageUrl\"];\n imageAlt: PerseusLabelImageWidgetOptions[\"imageAlt\"];\n imageHeight: PerseusLabelImageWidgetOptions[\"imageHeight\"];\n imageWidth: PerseusLabelImageWidgetOptions[\"imageWidth\"];\n markers: ReadonlyArray<LabelImageMarkerPublicData>;\n hideChoicesFromInstructions: PerseusLabelImageWidgetOptions[\"hideChoicesFromInstructions\"];\n multipleAnswers: PerseusLabelImageWidgetOptions[\"multipleAnswers\"];\n static: PerseusLabelImageWidgetOptions[\"static\"];\n};\n\nexport type LabelImageMarkerPublicData = Pick<\n PerseusLabelImageMarker,\n \"x\" | \"y\" | \"label\"\n>;\n\nexport default function getLabelImagePublicWidgetOptions(\n options: PerseusLabelImageWidgetOptions,\n): LabelImagePublicWidgetOptions {\n return {\n ...options,\n markers: options.markers.map(getLabelImageMarkerPublicData),\n };\n}\n\nfunction getLabelImageMarkerPublicData(\n marker: PerseusLabelImageMarker,\n): LabelImageMarkerPublicData {\n const {answers: _, ...publicData} = marker;\n return publicData;\n}\n","import getLabelImagePublicWidgetOptions from \"./label-image-util\";\n\nimport type {\n PerseusLabelImageWidgetOptions,\n PerseusWidgetOptions,\n} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type LabelImageDefaultWidgetOptions = Pick<\n PerseusLabelImageWidgetOptions,\n | \"choices\"\n | \"imageAlt\"\n | \"imageUrl\"\n | \"imageWidth\"\n | \"imageHeight\"\n | \"markers\"\n | \"multipleAnswers\"\n | \"hideChoicesFromInstructions\"\n>;\n\nconst defaultWidgetOptions: LabelImageDefaultWidgetOptions = {\n choices: [],\n imageAlt: \"\",\n imageUrl: \"\",\n imageWidth: 0,\n imageHeight: 0,\n markers: [],\n multipleAnswers: false,\n hideChoicesFromInstructions: false,\n};\n\nconst labelImageWidgetLogic: WidgetLogic = {\n name: \"label-image\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getLabelImagePublicWidgetOptions,\n // Function determining if a label image is accessible.\n // Label Images is inaccessible if it does not have alt text for the image.\n accessible: (widgetOptions: PerseusWidgetOptions): boolean => {\n const labelImageOptions =\n widgetOptions as PerseusLabelImageWidgetOptions;\n\n if (\n labelImageOptions.imageUrl !== \"\" &&\n labelImageOptions.imageAlt === \"\"\n ) {\n return false;\n }\n\n return true;\n },\n};\n\nexport default labelImageWidgetLogic;\n","/* Note(tamara): Brought over from the perseus package packages/perseus/src/util.ts file.\n May be useful to bring other perseus package utilities here. Contains utility functions\n and types used across multiple widgets for randomization and shuffling. */\n\nimport _ from \"underscore\";\n\n/**\n * A random number generator. Should return floats in the interval [0, 1), like\n * Math.random().\n */\nexport type RNG = () => number;\n\nexport const seededRNG: (seed: number) => RNG = function (seed: number): RNG {\n let randomSeed = seed;\n\n return function () {\n // Robert Jenkins' 32 bit integer hash function.\n let seed = randomSeed;\n seed = (seed + 0x7ed55d16 + (seed << 12)) & 0xffffffff;\n seed = (seed ^ 0xc761c23c ^ (seed >>> 19)) & 0xffffffff;\n seed = (seed + 0x165667b1 + (seed << 5)) & 0xffffffff;\n seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff;\n seed = (seed + 0xfd7046c5 + (seed << 3)) & 0xffffffff;\n seed = (seed ^ 0xb55a4f09 ^ (seed >>> 16)) & 0xffffffff;\n return (randomSeed = seed & 0xfffffff) / 0x10000000;\n };\n};\n\n/**\n * Shuffle an array using a given random seed or function.\n * If `ensurePermuted` is true, the input and output are guaranteed to be\n * distinct permutations.\n */\nexport function shuffle<T>(\n array: ReadonlyArray<T>,\n randomSeed: number | RNG,\n ensurePermuted = false,\n): T[] {\n let random;\n if (typeof randomSeed === \"function\") {\n random = randomSeed;\n } else {\n random = seededRNG(randomSeed);\n }\n\n function isValidShuffle(shuffled: readonly T[]) {\n return ensurePermuted ? !_.isEqual(array, shuffled) : true;\n }\n\n return constrainedShuffle(array, random, isValidShuffle);\n}\n\nexport function constrainedShuffle<T>(\n array: readonly T[],\n random: RNG,\n isValidShuffle: (shuffled: readonly T[]) => boolean,\n): T[] {\n const maxIterations = 100;\n const shuffled = [...array];\n\n // Return early if all elements are equal -- both for performance, and\n // to avoid going into an infinite loop in the (common) case where\n // isValidShuffle is checking the order of the values.\n if (shuffled.every((value) => _.isEqual(value, shuffled[0]))) {\n return shuffled;\n }\n\n for (let i = 0; i < maxIterations; i++) {\n shuffleInPlace(shuffled, random);\n if (isValidShuffle(shuffled)) {\n return shuffled;\n }\n }\n\n throw new Error(\n `constrainedShuffle: constraint not met after ${maxIterations} attempts`,\n );\n}\n\nfunction shuffleInPlace<T>(a: T[], random: RNG): void {\n // The Fisher-Yates shuffling algorithm. See:\n // https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\n for (let i = a.length - 1; i > 0; i--) {\n const k = randomIntInRange(0, i, random);\n [a[k], a[i]] = [a[i], a[k]];\n }\n}\n\nexport function randomIntInRange(\n min: number,\n max: number,\n random: RNG,\n): number {\n return Math.floor(random() * (max - min + 1)) + min;\n}\n\nexport const random: RNG = seededRNG(new Date().getTime() & 0xffffffff);\n","import {constrainedShuffle, seededRNG} from \"../../utils/random-util\";\n\nimport type {PerseusMatcherWidgetOptions} from \"../../data-schema\";\nimport type {RNG} from \"../../utils/random-util\";\nimport type {PerseusMatcherUserInput} from \"../../validation.types\";\n\nexport const shuffleMatcher = (\n options: Pick<\n MatcherPublicWidgetOptions,\n \"left\" | \"right\" | \"orderMatters\"\n >,\n problemNum: number,\n): PerseusMatcherUserInput => {\n // Use the same random() function to shuffle both columns sequentially\n const rng = seededRNG(problemNum);\n\n return {\n // If the order of rows doesn't matter, don't shuffle the left column\n left: !options.orderMatters\n ? options.left\n : shuffleDisplacingFirst(options.left, rng),\n right: shuffleDisplacingFirst(options.right, rng),\n };\n};\n\n/**\n * For details on the individual options, see the\n * PerseusMatcherWidgetOptions type\n */\nexport type MatcherPublicWidgetOptions = {\n labels: PerseusMatcherWidgetOptions[\"labels\"];\n left: PerseusMatcherWidgetOptions[\"left\"];\n right: PerseusMatcherWidgetOptions[\"right\"];\n orderMatters: PerseusMatcherWidgetOptions[\"orderMatters\"];\n padding: PerseusMatcherWidgetOptions[\"padding\"];\n};\n\n/**\n * Given a PerseusMatcherWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getMatcherPublicWidgetOptions(\n options: PerseusMatcherWidgetOptions,\n): MatcherPublicWidgetOptions {\n return {\n ...options,\n left: options.orderMatters\n ? sortAllButFirst(options.left)\n : options.left,\n right: sortAllButFirst(options.right),\n };\n}\n\nfunction sortAllButFirst([first, ...rest]: readonly string[]): string[] {\n return [first, ...rest.sort()];\n}\n\nfunction shuffleDisplacingFirst<T>(array: readonly T[], rng: RNG): T[] {\n function isFirstElementDisplaced(shuffled: readonly T[]) {\n return shuffled[0] !== array[0];\n }\n\n return constrainedShuffle(array, rng, isFirstElementDisplaced);\n}\n\nexport default getMatcherPublicWidgetOptions;\n","import getMatcherPublicWidgetOptions from \"./matcher-util\";\n\nimport type {PerseusMatcherWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type MatcherDefaultWidgetOptions = Pick<\n PerseusMatcherWidgetOptions,\n \"left\" | \"right\" | \"labels\" | \"orderMatters\" | \"padding\"\n>;\n\nconst defaultWidgetOptions: MatcherDefaultWidgetOptions = {\n left: [\"$x$\", \"$y$\", \"$z$\"],\n right: [\"$1$\", \"$2$\", \"$3$\"],\n labels: [\"test\", \"label\"],\n orderMatters: false,\n padding: true,\n};\n\nconst matcherWidgetLogic: WidgetLogic = {\n name: \"matcher\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getMatcherPublicWidgetOptions,\n accessible: false,\n};\n\nexport default matcherWidgetLogic;\n","import type {PerseusMatrixWidgetOptions} from \"../../data-schema\";\n\nexport type MatrixPublicWidgetOptions = Pick<\n PerseusMatrixWidgetOptions,\n \"prefix\" | \"suffix\" | \"cursorPosition\" | \"matrixBoardSize\" | \"static\"\n>;\n\nexport default function getMatrixPublicWidgetOptions(\n options: PerseusMatrixWidgetOptions,\n): MatrixPublicWidgetOptions {\n const {answers: _, ...publicOptions} = options;\n return publicOptions;\n}\n","import getMatrixPublicWidgetOptions from \"./matrix-util\";\n\nimport type {PerseusMatrixWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type MatrixDefaultWidgetOptions = Pick<\n PerseusMatrixWidgetOptions,\n \"matrixBoardSize\" | \"answers\" | \"prefix\" | \"suffix\" | \"cursorPosition\"\n>;\n\nconst defaultWidgetOptions: MatrixDefaultWidgetOptions = {\n matrixBoardSize: [3, 3],\n answers: [[]],\n prefix: \"\",\n suffix: \"\",\n cursorPosition: [0, 0],\n};\n\nconst matrixWidgetLogic: WidgetLogic = {\n name: \"matrix\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getMatrixPublicWidgetOptions,\n accessible: false,\n};\n\nexport default matrixWidgetLogic;\n","import type {PerseusMeasurerWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport const currentVersion = {major: 1, minor: 0};\n\nexport type MeasurerDefaultWidgetOptions = Pick<\n PerseusMeasurerWidgetOptions,\n | \"box\"\n | \"image\"\n | \"showProtractor\"\n | \"showRuler\"\n | \"rulerLabel\"\n | \"rulerTicks\"\n | \"rulerPixels\"\n | \"rulerLength\"\n>;\n\nexport const defaultWidgetOptions: MeasurerDefaultWidgetOptions = {\n box: [480, 480],\n image: {} as any,\n showProtractor: true,\n showRuler: false,\n rulerLabel: \"\",\n rulerTicks: 10,\n rulerPixels: 40,\n rulerLength: 10,\n};\n\nconst measurerWidgetLogic: WidgetLogic = {\n name: \"measurer\",\n version: currentVersion,\n defaultWidgetOptions: defaultWidgetOptions,\n accessible: false,\n};\n\nexport default measurerWidgetLogic;\n","import type {PerseusNumberLineWidgetOptions} from \"../../data-schema\";\n\nexport type NumberLinePublicWidgetOptions = Pick<\n PerseusNumberLineWidgetOptions,\n | \"range\"\n | \"labelRange\"\n | \"labelStyle\"\n | \"labelTicks\"\n | \"isTickCtrl\"\n | \"isInequality\"\n | \"divisionRange\"\n | \"numDivisions\"\n | \"snapDivisions\"\n | \"tickStep\"\n | \"initialX\"\n | \"showTooltips\"\n | \"static\"\n>;\n\nexport default function getNumberLinePublicWidgetOptions(\n options: PerseusNumberLineWidgetOptions,\n): NumberLinePublicWidgetOptions {\n const {correctX: _, correctRel: __, ...publicOptions} = options;\n return publicOptions;\n}\n","import getNumberLinePublicWidgetOptions from \"./number-line-util\";\n\nimport type {PerseusNumberLineWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type NumberLineDefaultWidgetOptions = Pick<\n PerseusNumberLineWidgetOptions,\n | \"range\"\n | \"labelRange\"\n | \"labelStyle\"\n | \"labelTicks\"\n | \"divisionRange\"\n | \"numDivisions\"\n | \"snapDivisions\"\n | \"tickStep\"\n | \"correctRel\"\n | \"correctX\"\n | \"initialX\"\n | \"showTooltips\"\n>;\n\nconst defaultWidgetOptions: NumberLineDefaultWidgetOptions = {\n range: [0, 10],\n\n labelRange: [null, null],\n labelStyle: \"decimal\",\n labelTicks: true,\n\n divisionRange: [1, 12],\n numDivisions: 5,\n snapDivisions: 2,\n\n tickStep: null,\n correctRel: \"eq\",\n correctX: null,\n initialX: null,\n\n showTooltips: false,\n};\n\nconst numberLineWidgetLogic: WidgetLogic = {\n name: \"number-line\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getNumberLinePublicWidgetOptions,\n accessible: false,\n};\n\nexport default numberLineWidgetLogic;\n","import type {\n PerseusNumericInputAnswer,\n PerseusNumericInputWidgetOptions,\n} from \"../../data-schema\";\n\ntype NumericInputAnswerPublicData = Pick<\n PerseusNumericInputAnswer,\n \"answerForms\" | \"simplify\" | \"status\"\n>;\n\n/**\n * For details on the individual options, see the\n * PerseusNumericInputWidgetOptions type\n */\ntype NumericInputPublicWidgetOptions = {\n labelText?: PerseusNumericInputWidgetOptions[\"labelText\"];\n size: PerseusNumericInputWidgetOptions[\"size\"];\n coefficient: PerseusNumericInputWidgetOptions[\"coefficient\"];\n rightAlign?: PerseusNumericInputWidgetOptions[\"rightAlign\"];\n static: PerseusNumericInputWidgetOptions[\"static\"];\n answers: ReadonlyArray<NumericInputAnswerPublicData>;\n};\n\n/**\n * This data from `answers` is used pre-scoring to give hints\n * to the learner regarding the format of accepted answers\n */\nfunction getNumericInputAnswerPublicData(\n answer: PerseusNumericInputAnswer,\n): NumericInputAnswerPublicData {\n const {answerForms, simplify, status} = answer;\n return {\n answerForms,\n simplify,\n status,\n };\n}\n\n/**\n * Given a PerseusNumericInputWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getNumericInputPublicWidgetOptions(\n options: PerseusNumericInputWidgetOptions,\n): NumericInputPublicWidgetOptions {\n const {answers, ...publicWidgetOptions} = options;\n return {\n ...publicWidgetOptions,\n answers: answers.map(getNumericInputAnswerPublicData),\n };\n}\n\nexport default getNumericInputPublicWidgetOptions;\n","import getNumericInputPublicWidgetOptions from \"./numeric-input-util\";\n\nimport type {PerseusNumericInputWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type NumericInputDefaultWidgetOptions = Pick<\n PerseusNumericInputWidgetOptions,\n \"answers\" | \"size\" | \"coefficient\" | \"labelText\" | \"rightAlign\"\n>;\n\nconst defaultWidgetOptions: NumericInputDefaultWidgetOptions = {\n answers: [\n {\n value: null,\n status: \"correct\",\n message: \"\",\n simplify: \"required\",\n answerForms: [],\n strict: false,\n maxError: null,\n },\n ],\n size: \"normal\",\n coefficient: false,\n labelText: \"\",\n rightAlign: false,\n};\n\nconst numericInputWidgetLogic: WidgetLogic = {\n name: \"numeric-input\",\n defaultWidgetOptions,\n defaultAlignment: \"inline-block\",\n getPublicWidgetOptions: getNumericInputPublicWidgetOptions,\n accessible: true,\n};\n\nexport default numericInputWidgetLogic;\n","import type {PerseusOrdererWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusOrdererWidgetOptions type\n */\nexport type OrdererPublicWidgetOptions = Pick<\n PerseusOrdererWidgetOptions,\n \"options\" | \"height\" | \"layout\"\n>;\n\n/**\n * Given a PerseusOrdererWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getOrdererPublicWidgetOptions(\n fullOptions: PerseusOrdererWidgetOptions,\n): OrdererPublicWidgetOptions {\n const {options, height, layout} = fullOptions;\n return {options, height, layout};\n}\n\nexport default getOrdererPublicWidgetOptions;\n","import getOrdererPublicWidgetOptions from \"./orderer-util\";\n\nimport type {PerseusOrdererWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type OrdererDefaultWidgetOptions = Pick<\n PerseusOrdererWidgetOptions,\n \"correctOptions\" | \"otherOptions\" | \"height\" | \"layout\"\n>;\n\nconst defaultWidgetOptions: OrdererDefaultWidgetOptions = {\n correctOptions: [{content: \"$x$\"}] as any,\n otherOptions: [{content: \"$y$\"}] as any,\n height: \"normal\",\n layout: \"horizontal\",\n};\n\nconst ordererWidgetLogic: WidgetLogic = {\n name: \"orderer\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getOrdererPublicWidgetOptions,\n accessible: false,\n};\n\nexport default ordererWidgetLogic;\n","import type {PerseusPassageWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type PassageDefaultWidgetOptions = Pick<\n PerseusPassageWidgetOptions,\n \"passageTitle\" | \"passageText\" | \"footnotes\" | \"showLineNumbers\"\n>;\n\nconst defaultWidgetOptions: PassageDefaultWidgetOptions = {\n passageTitle: \"\",\n passageText: \"\",\n footnotes: \"\",\n showLineNumbers: true,\n};\n\nconst passageWidgetLogic: WidgetLogic = {\n name: \"passage\",\n defaultWidgetOptions,\n accessible: false,\n};\n\nexport default passageWidgetLogic;\n","import type {PerseusPassageRefWidgetOptions} from \"../../data-schema\";\n\nexport const currentVersion = {major: 0, minor: 1};\n\nexport type PassageRefDefaultWidgetOptions = Pick<\n PerseusPassageRefWidgetOptions,\n \"passageNumber\" | \"referenceNumber\" | \"summaryText\"\n>;\n\nexport const defaultWidgetOptions: PassageRefDefaultWidgetOptions = {\n passageNumber: 1,\n referenceNumber: 1,\n summaryText: \"\",\n};\n","import {currentVersion, defaultWidgetOptions} from \"./passage-ref-upgrade\";\n\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type {PassageRefDefaultWidgetOptions} from \"./passage-ref-upgrade\";\n\nconst passageRefWidgetLogic: WidgetLogic = {\n name: \"passage-ref\",\n version: currentVersion,\n defaultWidgetOptions: defaultWidgetOptions,\n defaultAlignment: \"inline\",\n accessible: false,\n};\n\nexport default passageRefWidgetLogic;\n","import type {PerseusPassageRefTargetWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type PassageRefTargetDefaultWidgetOptions = Pick<\n PerseusPassageRefTargetWidgetOptions,\n \"content\"\n>;\n\nconst defaultWidgetOptions: PassageRefTargetDefaultWidgetOptions = {\n content: \"\",\n};\n\nconst passageRefTargetWidgetLogic: WidgetLogic = {\n name: \"passage-ref-target\",\n defaultWidgetOptions,\n defaultAlignment: \"inline\",\n accessible: false,\n};\n\nexport default passageRefTargetWidgetLogic;\n","import type {PerseusPhetSimulationWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type PhetSimulationDefaultWidgetOptions = Pick<\n PerseusPhetSimulationWidgetOptions,\n \"url\" | \"description\"\n>;\n\nconst defaultWidgetOptions: PhetSimulationDefaultWidgetOptions = {\n url: \"\",\n description: \"\",\n};\n\nconst phetSimulationWidgetLogic: WidgetLogic = {\n name: \"phet-simulation\",\n defaultWidgetOptions,\n accessible: true,\n};\n\nexport default phetSimulationWidgetLogic;\n","import type {PerseusPlotterWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusPlotterWidgetOptions type\n */\nexport type PlotterPublicWidgetOptions = Omit<\n PerseusPlotterWidgetOptions,\n \"correct\"\n>;\n\n/**\n * Given a PerseusPlotterWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getPlotterPublicWidgetOptions(\n options: PerseusPlotterWidgetOptions,\n): PlotterPublicWidgetOptions {\n const {correct: _, ...publicOptions} = options;\n return publicOptions;\n}\n\nexport default getPlotterPublicWidgetOptions;\n","import getPlotterPublicWidgetOptions from \"./plotter-util\";\n\nimport type {PerseusPlotterWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type PlotterDefaultWidgetOptions = Pick<\n PerseusPlotterWidgetOptions,\n | \"scaleY\"\n | \"maxY\"\n | \"snapsPerLine\"\n | \"correct\"\n | \"starting\"\n | \"type\"\n | \"labels\"\n | \"categories\"\n | \"picSize\"\n | \"picBoxHeight\"\n | \"plotDimensions\"\n | \"labelInterval\"\n | \"picUrl\"\n>;\n\nconst defaultWidgetOptions: PlotterDefaultWidgetOptions = {\n scaleY: 1,\n maxY: 10,\n snapsPerLine: 2,\n correct: [1],\n starting: [1],\n\n type: \"bar\",\n labels: [\"\", \"\"],\n categories: [\"\"],\n\n picSize: 30,\n picBoxHeight: 36,\n plotDimensions: [275, 200],\n labelInterval: 1,\n\n picUrl: null,\n};\n\nconst plotterWidgetLogic: WidgetLogic = {\n name: \"plotter\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getPlotterPublicWidgetOptions,\n accessible: false,\n};\n\nexport default plotterWidgetLogic;\n","import type {PerseusPythonProgramWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type PythonProgramDefaultWidgetOptions = Pick<\n PerseusPythonProgramWidgetOptions,\n \"programID\" | \"height\"\n>;\n\nconst defaultWidgetOptions: PythonProgramDefaultWidgetOptions = {\n programID: \"\",\n height: 400,\n};\n\nconst pythonProgramWidgetLogic: WidgetLogic = {\n name: \"python-program\",\n defaultWidgetOptions,\n accessible: true,\n};\n\nexport default pythonProgramWidgetLogic;\n","import type {\n PerseusRadioChoice,\n PerseusRadioWidgetOptions,\n} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusRadioWidgetOptions type.\n */\nexport type RadioPublicWidgetOptions = {\n choices: ReadonlyArray<RadioChoicePublicData>;\n hasNoneOfTheAbove?: PerseusRadioWidgetOptions[\"hasNoneOfTheAbove\"];\n countChoices?: PerseusRadioWidgetOptions[\"countChoices\"];\n numCorrect?: PerseusRadioWidgetOptions[\"numCorrect\"];\n randomize?: PerseusRadioWidgetOptions[\"randomize\"];\n multipleSelect?: PerseusRadioWidgetOptions[\"multipleSelect\"];\n deselectEnabled?: PerseusRadioWidgetOptions[\"deselectEnabled\"];\n};\n\n/**\n * Only the options from each Radio choice that should be exposed to the client.\n */\ntype RadioChoicePublicData = Pick<\n PerseusRadioChoice,\n \"id\" | \"content\" | \"isNoneOfTheAbove\"\n>;\n\n/**\n * Given a PerseusRadioChoice object, return a new object with only the public\n * data that should be included in the Radio public widget options.\n */\nfunction getRadioChoicePublicData(\n choice: PerseusRadioChoice,\n): RadioChoicePublicData {\n const {id, content, isNoneOfTheAbove} = choice;\n return {\n id,\n content,\n isNoneOfTheAbove,\n };\n}\n\n/**\n * Shared functionality to determine if numCorrect is used, because:\n *\n * 1. numCorrect is conditionally used for rendering pre-scoring\n * 2. numCorrect also exposes information about answers\n *\n * So only include/use numCorrect when we know it's useful.\n */\nexport function usesNumCorrect(\n multipleSelect: PerseusRadioWidgetOptions[\"multipleSelect\"],\n countChoices: PerseusRadioWidgetOptions[\"countChoices\"],\n numCorrect: PerseusRadioWidgetOptions[\"numCorrect\"],\n) {\n return multipleSelect && countChoices && numCorrect;\n}\n\n/**\n * Given a PerseusRadioWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getRadioPublicWidgetOptions(\n options: PerseusRadioWidgetOptions,\n): RadioPublicWidgetOptions {\n const {numCorrect, choices, multipleSelect, countChoices} = options;\n\n return {\n ...options,\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n numCorrect: usesNumCorrect(multipleSelect, countChoices, numCorrect)\n ? numCorrect\n : undefined,\n choices: choices.map(getRadioChoicePublicData),\n };\n}\n\nexport default getRadioPublicWidgetOptions;\n","import getRadioPublicWidgetOptions from \"./radio-util\";\n\nimport type {PerseusRadioWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport const currentVersion = {major: 3, minor: 0};\n\nexport type RadioDefaultWidgetOptions = Pick<\n PerseusRadioWidgetOptions,\n | \"choices\"\n | \"randomize\"\n | \"hasNoneOfTheAbove\"\n | \"multipleSelect\"\n | \"countChoices\"\n | \"deselectEnabled\"\n>;\n\nexport const defaultWidgetOptions: RadioDefaultWidgetOptions = {\n choices: [\n {content: \"\", id: \"radio-choice-0\"},\n {content: \"\", id: \"radio-choice-1\"},\n {content: \"\", id: \"radio-choice-2\"},\n {content: \"\", id: \"radio-choice-3\"},\n ],\n randomize: false,\n hasNoneOfTheAbove: false,\n multipleSelect: false,\n countChoices: false,\n deselectEnabled: false,\n};\n\nconst radioWidgetLogic: WidgetLogic = {\n name: \"radio\",\n version: currentVersion,\n defaultWidgetOptions: defaultWidgetOptions,\n getPublicWidgetOptions: getRadioPublicWidgetOptions,\n accessible: true,\n};\n\nexport default radioWidgetLogic;\n","import {constrainedShuffle, type RNG, seededRNG} from \"../../utils/random-util\";\n\nimport type {PerseusSorterWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusSorterWidgetOptions type\n */\nexport type SorterPublicWidgetOptions = {\n // TODO(benchristel): rename to `cards`; the whole point of public widget\n // options is that this isn't the correct order!\n correct: PerseusSorterWidgetOptions[\"correct\"];\n padding: PerseusSorterWidgetOptions[\"padding\"];\n layout: PerseusSorterWidgetOptions[\"layout\"];\n};\n\n/**\n * Given a PerseusSorterWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getSorterPublicWidgetOptions(\n options: PerseusSorterWidgetOptions,\n): SorterPublicWidgetOptions {\n return {\n ...options,\n // To remove information about the correct answer, we sort the cards.\n // However, we leave the first card in place so the client can avoid\n // showing the correct answer to the learner in the initial state of\n // the widget (since that could be confusing).\n correct: sortAllButFirst(options.correct),\n };\n}\n\nexport function shuffleSorter(\n options: Pick<SorterPublicWidgetOptions, \"correct\">,\n problemNum: number,\n): string[] {\n const {correct} = options;\n const rng = seededRNG(problemNum ?? 0);\n // See getSorterPublicWidgetOptions for an explanation of why we need to\n // displace the first card.\n return shuffleDisplacingFirst(correct, rng);\n}\n\nfunction sortAllButFirst([first, ...rest]: readonly string[]): string[] {\n return [first, ...rest.sort()];\n}\n\nfunction shuffleDisplacingFirst<T>(array: readonly T[], rng: RNG): T[] {\n function isFirstElementDisplaced(shuffled: readonly T[]) {\n return shuffled[0] !== array[0];\n }\n\n return constrainedShuffle(array, rng, isFirstElementDisplaced);\n}\n\nexport default getSorterPublicWidgetOptions;\n","import getSorterPublicWidgetOptions from \"./sorter-util\";\n\nimport type {PerseusSorterWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type SorterDefaultWidgetOptions = Pick<\n PerseusSorterWidgetOptions,\n \"correct\" | \"layout\" | \"padding\"\n>;\n\nconst defaultWidgetOptions: SorterDefaultWidgetOptions = {\n correct: [\"$x$\", \"$y$\", \"$z$\"],\n layout: \"horizontal\",\n padding: true,\n};\n\nconst sorterWidgetLogic: WidgetLogic = {\n name: \"sorter\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getSorterPublicWidgetOptions,\n accessible: false,\n};\n\nexport default sorterWidgetLogic;\n","import type {PerseusTableWidgetOptions} from \"../../data-schema\";\n\ntype TablePublicWidgetOptions = Pick<\n PerseusTableWidgetOptions,\n \"headers\" | \"rows\" | \"columns\"\n>;\n\nexport default function getTablePublicWidgetOptions(\n options: PerseusTableWidgetOptions,\n): TablePublicWidgetOptions {\n const {answers: _, ...publicOptions} = options;\n return publicOptions;\n}\n","import getTablePublicWidgetOptions from \"./table-util\";\n\nimport type {PerseusTableWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type TableDefaultWidgetOptions = Pick<\n PerseusTableWidgetOptions,\n \"headers\" | \"rows\" | \"columns\" | \"answers\"\n>;\n\nconst defaultRows = 4;\nconst defaultColumns = 1;\n\n// initialize a 2D array\n// (defaultRows x defaultColumns) of empty strings\nconst answers = new Array(defaultRows)\n .fill(0)\n .map(() => new Array(defaultColumns).fill(\"\"));\n\nconst defaultWidgetOptions: TableDefaultWidgetOptions = {\n headers: [\"\"],\n rows: defaultRows,\n columns: defaultColumns,\n answers: answers,\n};\n\nconst tableWidgetLogic: WidgetLogic = {\n name: \"table\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getTablePublicWidgetOptions,\n accessible: true,\n};\n\nexport default tableWidgetLogic;\n","import type {PerseusVideoWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type VideoDefaultWidgetOptions = Pick<\n PerseusVideoWidgetOptions,\n \"location\"\n>;\n\nconst defaultWidgetOptions: VideoDefaultWidgetOptions = {\n location: \"\",\n};\n\nconst videoWidgetLogic: WidgetLogic = {\n name: \"video\",\n defaultWidgetOptions,\n supportedAlignments: [\"block\", \"float-left\", \"float-right\", \"full-width\"],\n defaultAlignment: \"block\",\n accessible: true,\n};\n\nexport default videoWidgetLogic;\n","import {Errors} from \"../error/errors\";\nimport {PerseusError} from \"../error/perseus-error\";\nimport Registry from \"../utils/registry\";\n\nimport categorizerWidgetLogic from \"./categorizer\";\nimport csProgramWidgetLogic from \"./cs-program\";\nimport definitionWidgetLogic from \"./definition\";\nimport deprecatedStandinWidgetLogic from \"./deprecated-standin\";\nimport dropdownWidgetLogic from \"./dropdown\";\nimport explanationWidgetLogic from \"./explanation\";\nimport expressionWidgetLogic from \"./expression\";\nimport gradedGroupWidgetLogic from \"./graded-group\";\nimport gradedGroupSetWidgetLogic from \"./graded-group-set\";\nimport grapherWidgetLogic from \"./grapher\";\nimport groupWidgetLogic from \"./group\";\nimport iframeWidgetLogic from \"./iframe\";\nimport imageWidgetLogic from \"./image\";\nimport inputNumberWidgetLogic from \"./input-number\";\nimport interactionWidgetLogic from \"./interaction\";\nimport interactiveGraphWidgetLogic from \"./interactive-graph\";\nimport labelImageWidgetLogic from \"./label-image\";\nimport matcherWidgetLogic from \"./matcher\";\nimport matrixWidgetLogic from \"./matrix\";\nimport measurerWidgetLogic from \"./measurer\";\nimport numberLineWidgetLogic from \"./number-line\";\nimport numericInputWidgetLogic from \"./numeric-input\";\nimport ordererWidgetLogic from \"./orderer\";\nimport passageWidgetLogic from \"./passage\";\nimport passageRefWidgetLogic from \"./passage-ref\";\nimport passageRefTargetWidgetLogic from \"./passage-ref-target\";\nimport phetSimulationWidgetLogic from \"./phet-simulation\";\nimport plotterWidgetLogic from \"./plotter\";\nimport pythonProgramWidgetLogic from \"./python-program\";\nimport radioWidgetLogic from \"./radio\";\nimport sorterWidgetLogic from \"./sorter\";\nimport tableWidgetLogic from \"./table\";\nimport videoWidgetLogic from \"./video\";\n\nimport type {\n PublicWidgetOptionsFunction,\n WidgetLogic,\n} from \"./logic-export.types\";\nimport type {PerseusWidgetOptions, PerseusWidget} from \"../data-schema\";\nimport type {Alignment} from \"../types\";\n\nconst widgets = new Registry<WidgetLogic>(\"Core widget registry\");\n\nexport function registerWidget(type: string, logic: WidgetLogic) {\n widgets.set(type, logic);\n}\n\nexport function isWidgetRegistered(type: string) {\n const widgetLogic = widgets.get(type);\n return Boolean(widgetLogic);\n}\n\nexport function getCurrentVersion(type: string) {\n const widgetLogic = widgets.get(type);\n return widgetLogic?.version || {major: 0, minor: 0};\n}\n\n// TODO(LEMS-2870): getPublicWidgetOptionsFunction/PublicWidgetOptionsFunction\n// need better types\nexport const getPublicWidgetOptionsFunction = (\n type: string,\n): PublicWidgetOptionsFunction => {\n return widgets.get(type)?.getPublicWidgetOptions ?? ((i: any) => i);\n};\n\nexport function getDefaultWidgetOptions(type: string) {\n const widgetLogic = widgets.get(type);\n return widgetLogic?.defaultWidgetOptions || {};\n}\n\nexport function isAccessible(\n type: string,\n widgetOptions: PerseusWidgetOptions,\n): boolean {\n const accessible = widgets.get(type)?.accessible;\n return typeof accessible === \"function\"\n ? accessible(widgetOptions)\n : !!accessible;\n}\n\nexport const traverseChildWidgets = (\n widgetInfo: PerseusWidget,\n traverseRenderer: any,\n): PerseusWidget => {\n if (!traverseRenderer) {\n throw new PerseusError(\n \"traverseRenderer must be provided, but was not\",\n Errors.Internal,\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!widgetInfo || !widgetInfo.type || !widgets.get(widgetInfo.type)) {\n return widgetInfo;\n }\n\n const widgetExports = widgets.get(widgetInfo.type);\n const props = widgetInfo.options;\n\n if (widgetExports?.traverseChildWidgets != null && props != null) {\n const newProps = widgetExports.traverseChildWidgets(\n props,\n traverseRenderer,\n );\n return {...widgetInfo, options: newProps};\n }\n return widgetInfo;\n};\n\n/**\n * Handling for the optional alignments for widgets\n * See widget-container.jsx for details on how alignments are implemented.\n */\n\n/**\n * Returns the list of supported alignments for the given (string) widget\n * type. This is used primarily at editing time to display the choices\n * for the user.\n *\n * Supported alignments are given as an array of strings in the exports of\n * a widget's module.\n */\nexport const getSupportedAlignments = (\n type: string,\n): ReadonlyArray<Alignment> => {\n const widgetLogic = widgets.get(type);\n if (!widgetLogic?.supportedAlignments?.[0]) {\n // default alignments\n return [\"default\"];\n }\n return widgetLogic?.supportedAlignments;\n};\n\n/**\n * For the given (string) widget type, determine the default alignment for\n * the widget. This is used at rendering time to go from \"default\" alignment\n * to the actual alignment displayed on the screen.\n *\n * The default alignment is given either as a string (called\n * `defaultAlignment`) or a function (called `getDefaultAlignment`) on\n * the exports of a widget's module.\n */\nexport const getDefaultAlignment = (type: string): Alignment => {\n const widgetLogic = widgets.get(type);\n if (!widgetLogic?.defaultAlignment) {\n return \"block\";\n }\n return widgetLogic.defaultAlignment;\n};\n\n/**\n * Returns the CSS class name corresponding to the specified widget alignment.\n * Uses explicit mapping to make it easy to locate related CSS style definitions.\n */\nexport const getAlignmentClassName = (\n type: string,\n alignment: Alignment,\n): string => {\n switch (alignment) {\n case \"block\":\n return \" widget-block\";\n case \"inline-block\":\n return \" widget-inline-block\";\n case \"inline\":\n return \" widget-inline\";\n case \"float-left\":\n return \" widget-float-left\";\n case \"float-right\":\n return \" widget-float-right\";\n case \"full-width\":\n return \" widget-full-width\";\n case \"default\":\n // This is for widgets that don't have supportedAlignments\n // It doesn't have any impact on styling it is used for error handling\n return getDefaultAlignment(type);\n default:\n return \"\";\n }\n};\n\n/**\n * We use a function here rather than registering widgets\n * at the top-level of the file to avoid circular dependencies.\n * Logic that needs core widget functionality\n * (like a prod or in tests)\n * need to call this function before trying to use that logic.\n */\nexport function registerCoreWidgets() {\n const widgets = [\n categorizerWidgetLogic,\n csProgramWidgetLogic,\n definitionWidgetLogic,\n deprecatedStandinWidgetLogic,\n dropdownWidgetLogic,\n explanationWidgetLogic,\n expressionWidgetLogic,\n gradedGroupWidgetLogic,\n gradedGroupSetWidgetLogic,\n grapherWidgetLogic,\n groupWidgetLogic,\n iframeWidgetLogic,\n imageWidgetLogic,\n inputNumberWidgetLogic,\n interactionWidgetLogic,\n interactiveGraphWidgetLogic,\n labelImageWidgetLogic,\n matcherWidgetLogic,\n matrixWidgetLogic,\n measurerWidgetLogic,\n numberLineWidgetLogic,\n numericInputWidgetLogic,\n ordererWidgetLogic,\n passageWidgetLogic,\n passageRefWidgetLogic,\n passageRefTargetWidgetLogic,\n phetSimulationWidgetLogic,\n plotterWidgetLogic,\n pythonProgramWidgetLogic,\n radioWidgetLogic,\n sorterWidgetLogic,\n tableWidgetLogic,\n videoWidgetLogic,\n ];\n\n widgets.forEach((w) => {\n registerWidget(w.name, w);\n });\n}\n","import _ from \"underscore\";\n\nimport {Errors} from \"../error/errors\";\nimport {PerseusError} from \"../error/perseus-error\";\nimport {mapObject} from \"../utils/objective_\";\n\nimport {\n getCurrentVersion,\n getDefaultWidgetOptions,\n getSupportedAlignments,\n isWidgetRegistered,\n} from \"./core-widget-registry\";\n\nimport type {PerseusWidget, PerseusWidgetsMap} from \"../data-schema\";\n\nconst DEFAULT_STATIC = false;\n\nexport const applyDefaultsToWidget = (\n oldWidgetInfo: PerseusWidget,\n): PerseusWidget => {\n const type = oldWidgetInfo.type;\n // NOTE(jeremy): This looks like it could be replaced by fixing types so\n // that `type` is non-optional. But we're seeing this in Sentry today so I\n // suspect we have legacy data (potentially unpublished) and we should\n // figure that out before depending solely on types.\n if (!_.isString(type)) {\n throw new PerseusError(\n \"widget type must be a string, but was: \" + type,\n Errors.Internal,\n );\n }\n\n if (!isWidgetRegistered(type)) {\n // If we have a widget that isn't registered, we can't upgrade it\n // TODO(aria): Figure out what the best thing to do here would be\n return oldWidgetInfo;\n }\n\n // Unversioned widgets (pre-July 2014) are all implicitly 0.0\n const initialVersion = oldWidgetInfo.version || {major: 0, minor: 0};\n const latestVersion = getCurrentVersion(type);\n\n // If the widget version is later than what we understand (major\n // version is higher than latest, or major versions are equal and minor\n // version is higher than latest), don't perform any upgrades.\n if (\n initialVersion.major > latestVersion.major ||\n (initialVersion.major === latestVersion.major &&\n initialVersion.minor > latestVersion.minor)\n ) {\n return oldWidgetInfo;\n }\n\n let newEditorOptions = _.clone(oldWidgetInfo.options) ?? {};\n\n // Minor version upgrades (eg. new optional props) don't have\n // transform functions. Instead, we fill in the new props with their\n // defaults.\n const defaultOptions = getDefaultWidgetOptions(type);\n newEditorOptions = {\n ...defaultOptions,\n ...newEditorOptions,\n };\n\n let alignment = oldWidgetInfo.alignment;\n\n // Widgets that support multiple alignments will \"lock in\" the\n // alignment to the alignment that would be listed first in the\n // select box. If the widget only supports one alignment, the\n // alignment value will likely just end up as \"default\".\n if (alignment == null || alignment === \"default\") {\n alignment = getSupportedAlignments(type)?.[0];\n if (!alignment) {\n throw new PerseusError(\n \"No default alignment found when upgrading widget\",\n Errors.Internal,\n {metadata: {widgetType: type}},\n );\n }\n }\n\n let widgetStatic = oldWidgetInfo.static;\n\n if (widgetStatic == null) {\n widgetStatic = DEFAULT_STATIC;\n }\n\n return {\n ...oldWidgetInfo,\n // maintain other info, like type\n // After upgrading we guarantee that the version is up-to-date\n version: latestVersion,\n // Default graded to true (so null/undefined becomes true):\n graded: oldWidgetInfo.graded != null ? oldWidgetInfo.graded : true,\n alignment: alignment,\n static: widgetStatic,\n options: newEditorOptions,\n } as any;\n};\n\nexport function applyDefaultsToWidgets(\n oldWidgetOptions: PerseusWidgetsMap,\n): PerseusWidgetsMap {\n return mapObject(oldWidgetOptions, (widgetInfo, widgetId) => {\n if (!widgetInfo.type || !widgetInfo.alignment) {\n const newValues: Record<string, any> = {};\n\n if (!widgetInfo.type) {\n // TODO: why does widget have no type?\n // We don't want to derive type from widget ID\n // see: LEMS-1845\n newValues.type = widgetId.split(\" \")[0];\n }\n\n if (!widgetInfo.alignment) {\n newValues.alignment = \"default\";\n }\n\n widgetInfo = {...widgetInfo, ...newValues};\n }\n\n return applyDefaultsToWidget(widgetInfo) as any;\n });\n}\n","import _ from \"underscore\";\n\nimport {applyDefaultsToWidgets} from \"../widgets/apply-defaults\";\nimport {getPublicWidgetOptionsFunction} from \"../widgets/core-widget-registry\";\n\nimport deepClone from \"./deep-clone\";\n\nimport type {PerseusRenderer} from \"../data-schema\";\n\n/**\n * Return a copy of a PerseusRenderer with rubric data removed (ie answers)\n *\n * @param original - the original, full PerseusRenderer (which includes the rubric - aka answer data)\n */\nexport default function splitPerseusRenderer(\n original: PerseusRenderer,\n): PerseusRenderer {\n const clone = deepClone(original);\n const originalWidgets = clone.widgets ?? {};\n\n const upgradedWidgets = applyDefaultsToWidgets(originalWidgets);\n const splitWidgets = {};\n\n for (const [id, widget] of Object.entries(upgradedWidgets)) {\n /**\n * Static widgets are presentational, used to represent concepts\n * rather than collect answers from learners. For instance we might\n * want a static InteractiveGraph that shows learners a chart before\n * we give them a Radio widget to check their understanding of the chart.\n * We need to keep the answers in this case because it's pre-scoring information.\n */\n if (widget.static) {\n splitWidgets[id] = widget;\n } else {\n const publicWidgetOptionsFun = getPublicWidgetOptionsFunction(\n widget.type,\n );\n splitWidgets[id] = {\n ...widget,\n options: publicWidgetOptionsFun(widget.options as any),\n };\n }\n }\n\n return {\n ...original,\n widgets: splitWidgets,\n };\n}\n","import splitPerseusRenderer from \"../../utils/split-perseus-renderer\";\n\nimport type {\n PerseusGroupWidgetOptions,\n PerseusRenderer,\n} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusGroupWidgetOptions type\n */\nexport type GroupPublicWidgetOptions = PerseusRenderer;\n\n/**\n * Given a PerseusGroupWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getGroupPublicWidgetOptions(\n options: PerseusGroupWidgetOptions,\n): GroupPublicWidgetOptions {\n return splitPerseusRenderer(options);\n}\n\nexport default getGroupPublicWidgetOptions;\n","import getGroupPublicWidgetOptions from \"./group-util\";\n\nimport type {PerseusGroupWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type GroupDefaultWidgetOptions = Pick<\n PerseusGroupWidgetOptions,\n \"content\" | \"widgets\" | \"images\"\n>;\n\nconst defaultWidgetOptions: GroupDefaultWidgetOptions = {\n content: \"\",\n widgets: {},\n images: {},\n};\n\nconst traverseChildWidgets = function (props: any, traverseRenderer: any): any {\n return {...props, ...traverseRenderer(props)};\n};\n\nconst groupWidgetLogic: WidgetLogic = {\n name: \"group\",\n defaultWidgetOptions,\n accessible: false,\n traverseChildWidgets: traverseChildWidgets,\n getPublicWidgetOptions: getGroupPublicWidgetOptions,\n};\n\nexport default groupWidgetLogic;\n","import {ItemExtras, type PerseusAnswerArea} from \"../data-schema\";\n\nexport default function getDefaultAnswerArea(): PerseusAnswerArea {\n return ItemExtras.reduce(\n (acc, curr) => ({...acc, [curr]: false}),\n {},\n ) as PerseusAnswerArea;\n}\n","import {parseAndMigratePerseusItem} from \"../parse-perseus-json\";\nimport {isFailure} from \"../parse-perseus-json/result\";\n\nimport deepClone from \"./deep-clone\";\nimport splitPerseusRenderer from \"./split-perseus-renderer\";\n\nimport type {PerseusItem} from \"../data-schema\";\n\n/**\n * Return a copy of a PerseusItem with rubric data removed (ie answers)\n *\n * @param original - the original, full PerseusItem (which includes the rubric - aka answer data)\n */\nexport default function splitPerseusItem(original: PerseusItem): PerseusItem {\n const item = deepClone(original);\n\n return {\n ...item,\n question: splitPerseusRenderer(item.question),\n // the final hint often exposes the answer\n // so we consider that part of the answer data\n hints: [],\n };\n}\n\n/**\n * Returns a JSON copy of a PerseusItem with rubric data (i.e. answers and\n * hints) removed. Idempotent and deterministic.\n *\n * @param data a {@linkcode PerseusItem}, either as JSON or as an object.\n * @returns {string} the answerless data formatted as JSON\n * @throws {SyntaxError} given malformed JSON or data that can't be parsed as\n * a Perseus item.\n */\nexport function splitPerseusItemJSON(data: unknown): string {\n const parseResult = parseAndMigratePerseusItem(data);\n if (isFailure(parseResult)) {\n throw new SyntaxError(parseResult.detail.message);\n }\n const item = parseResult.value;\n\n return JSON.stringify(splitPerseusItem(item));\n}\n","/**\n * IMPORTANT:\n * 1. Do not delete this file or the variable below.\n * This will be the definition of the active feature flags in Perseus\n * that will hide features/changes under development. This will be used\n * by flags of APIOptions type.\n * 2. Also add the new flag in front-end repo's perseus-feature-flags.ts file\n * 3. Do cleanup unused feature flags\n * 4. When no active feature flag is available value will be:\n * export const PerseusFeatureFlags = [];\n * 5. Also update the testing/feature-flags-util.ts for testing purpose\n */\nconst PerseusFeatureFlags = [\n \"new-radio-widget\", // TODO(LEMS-2994): cleanup feature flag\n \"image-widget-upgrade\", // TODO(LEMS-3521): cleanup feature flag\n] as const;\n\nexport default PerseusFeatureFlags;\n\n/**\n * Checks if a feature flag is enabled in the given props.\n */\nexport function isFeatureOn(\n props: {apiOptions?: {flags?: Record<string, boolean>}},\n flag: string,\n): boolean {\n return props.apiOptions?.flags?.[flag] ?? false;\n}\n","/**\n * Traverses a {content, widgets, images} renderer props object,\n * such as `itemData.question`\n *\n * This traversal is deep and handles some widget prop upgrades\n * (TODO(aria): Handle minor prop upgrades :) )\n *\n * This is the right way to traverse itemData.\n *\n * NOTE: We should not expose this on the perseus API yet. Instead,\n * build the traversal method you want inside perseus, and use this\n * from that. We might eventually expose this, but I'd like to be\n * more confident in the interface provided first.\n */\n\nimport _ from \"underscore\";\n\nimport {mapObject} from \"./utils/objective_\";\nimport * as Widgets from \"./widgets/core-widget-registry\";\n\nimport type {PerseusRenderer} from \"./data-schema\";\n\nconst noop = function () {};\n\nconst deepCallbackFor = function (\n contentCallback: (arg1: any) => void,\n widgetCallback: (widgetInfo: any, widgetId: string) => any,\n optionsCallback: (arg1: any) => void,\n) {\n const deepCallback = function (widgetInfo: any, widgetId: string) {\n const newWidgetInfo = Widgets.traverseChildWidgets(\n widgetInfo,\n (rendererOptions) => {\n return traverseRenderer(\n rendererOptions,\n contentCallback,\n // so that we traverse grandchildren, too:\n deepCallback,\n optionsCallback,\n );\n },\n );\n\n const userWidgetInfo = widgetCallback(newWidgetInfo, widgetId);\n if (userWidgetInfo !== undefined) {\n return userWidgetInfo;\n }\n return newWidgetInfo;\n };\n return deepCallback;\n};\n\nconst traverseRenderer = function (\n rendererOptions,\n contentCallback: (arg1: any) => void,\n deepWidgetCallback: (widgetInfo: any, widgetId: string) => any,\n optionsCallback: (arg1: any) => void,\n) {\n let newContent = rendererOptions.content;\n if (rendererOptions.content != null) {\n const modifiedContent = contentCallback(rendererOptions.content);\n if (modifiedContent !== undefined) {\n newContent = modifiedContent;\n }\n }\n\n const newWidgets = mapObject(\n rendererOptions.widgets || {},\n function (widgetInfo, widgetId) {\n // Widgets without info or a type are empty widgets, and\n // should always be renderable. It's also annoying to write\n // checks for this everywhere, so we just filter them out once and\n // for all!\n // @ts-expect-error - TS2571 - Object is of type 'unknown'.\n if (widgetInfo == null || widgetInfo.type == null) {\n return widgetInfo;\n }\n return deepWidgetCallback(widgetInfo, widgetId);\n },\n );\n\n const newOptions = _.extend({}, rendererOptions, {\n content: newContent,\n widgets: newWidgets,\n });\n const userOptions = optionsCallback(newOptions);\n if (userOptions !== undefined) {\n return userOptions;\n }\n return newOptions;\n};\n\nexport const traverse = function (\n rendererOptions: PerseusRenderer,\n contentCallback?: ((arg1: any) => any) | null,\n widgetCallback?: ((widgetInfo: any, widgetId: string) => any) | null,\n optionsCallback?: (arg1: any) => void,\n): any {\n contentCallback = contentCallback || noop;\n widgetCallback = widgetCallback || noop;\n optionsCallback = optionsCallback || noop;\n\n return traverseRenderer(\n rendererOptions,\n contentCallback,\n deepCallbackFor(contentCallback, widgetCallback, optionsCallback),\n optionsCallback,\n );\n};\n","/**\n * Identifies whether or not a given perseus item requires the use of a mouse\n * or screen, based on the widgets it contains.\n */\n\nimport {parse, traverseContent} from \"@khanacademy/pure-markdown\";\n\nimport {traverse} from \"./traversal\";\nimport * as Widgets from \"./widgets/core-widget-registry\";\n\nimport type {PerseusItem, PerseusWidgetsMap} from \"./data-schema\";\n\n/**\n * Returns a list of widget types that cause a given Perseus item to require\n * the use of a screen or mouse.\n *\n * For now we'll just check the `accessible` field on each of the widgets\n * in the item data, but in the future we may specify accessibility on\n * each widget with higher granularity.\n *\n * @deprecated This function returns a list of widget _types_ that violate our\n * accessibility requirements which is not very accurate given that some\n * instances _could_ be accessible and some not based on their widget options.\n * In most cases, you should use {@link isItemAccessible} instead.\n *\n * @todo Inline this into {@link isItemAccessible}!\n */\nexport function violatingWidgets(itemData: PerseusItem): Array<string> {\n // TODO(jordan): Hints as well\n const widgetTypes: Array<string> = [];\n\n traverse(itemData.question, null, function (info) {\n if (info.type && !Widgets.isAccessible(info.type, info.options)) {\n widgetTypes.push(info.type);\n }\n });\n\n // Uniquify the list of widgets (by type)\n return [...new Set(widgetTypes)];\n}\n\n/**\n * Returns true if the given Perseus item is accessible (i.e., does not contain\n * any widgets that violate our accessibility requirements).\n */\nexport function isItemAccessible(itemData: PerseusItem): boolean {\n // Traverse the item question Markdown to look for content that is\n // inaccessible.\n const ast = parse(itemData.question.content);\n const widgetIdsInUse = new Set<string>();\n let hasInaccessibleImage = false;\n\n traverseContent(ast, (node) => {\n // Markdown images without alt text are inaccessible!\n if (node.type === \"image\" && (node.alt == null || node.alt === \"\")) {\n hasInaccessibleImage = true;\n return;\n }\n\n // We collect widget IDs used in the Markdown content so we can exclude\n // unused widgets when checking for violating widgets below.\n if (node.type === \"widget\") {\n widgetIdsInUse.add(node.id);\n }\n });\n\n if (hasInaccessibleImage) {\n return false;\n }\n\n // Finally, check if any widgets are inaccessible.\n const itemDataWithOnlyActiveWidgets: PerseusItem = {\n ...itemData,\n question: {\n ...itemData.question,\n // We have to cast the result here to PerseusWidgetsMap manually\n // because TypeScript gets confused by Object.fromEntries() (it\n // can't map that the id matches the object in the entry).\n widgets: Object.fromEntries(\n Object.entries(itemData.question.widgets).filter(([id]) =>\n widgetIdsInUse.has(id),\n ),\n ) as PerseusWidgetsMap,\n },\n };\n return violatingWidgets(itemDataWithOnlyActiveWidgets).length === 0;\n}\n","import type {PerseusImageWidgetOptions, ImageWidget} from \"../../data-schema\";\n\nexport function generateImageOptions(\n options?: Partial<PerseusImageWidgetOptions>,\n): PerseusImageWidgetOptions {\n const defaultImageOptions: PerseusImageWidgetOptions = {\n backgroundImage: {},\n };\n\n return {\n ...defaultImageOptions,\n ...options,\n };\n}\n\nexport function generateImageWidget(\n imageWidgetProperties?: Partial<Omit<ImageWidget, \"type\">>,\n): ImageWidget {\n return {\n type: \"image\",\n graded: true,\n version: {major: 0, minor: 0},\n static: false,\n alignment: \"default\",\n options: generateImageOptions({}), // default options\n ...imageWidgetProperties,\n };\n}\n","export type {PerseusAnalyticsEvent, AnalyticsEventHandlerFn} from \"./analytics\";\nexport type {\n KEScore,\n RendererInterface,\n MarkerType,\n InteractiveMarkerType,\n Relationship,\n Alignment,\n RecursiveReadonly,\n} from \"./types\";\nexport type {\n KeypadKey,\n KeypadConfiguration,\n KeypadContextRendererInterface,\n} from \"./keypad\";\nexport type {ErrorKind} from \"./error/errors\";\nexport {default as ErrorCodes, type ErrorCode} from \"./error-codes\";\nexport type {FunctionTypeMappingKeys} from \"./utils/grapher-util\";\nexport type {Coords} from \"./utils/grapher-types\";\nexport type * from \"./validation.types\";\n\nexport {default as getMatrixSize} from \"./utils/get-matrix-size\";\nexport {default as getDecimalSeparator} from \"./utils/get-decimal-separator\";\nexport {getDivideSymbol} from \"./utils/get-divide-symbol\";\nexport {getDivideSymbolForTex} from \"./utils/get-divide-symbol\";\nexport {approximateEqual, approximateDeepEqual} from \"./utils/equality\";\nexport {\n addWidget,\n getWidgetIdsFromContent,\n getWidgetIdsFromContentByType,\n} from \"./utils/widget-id-utils\";\n\nexport {default as deepClone} from \"./utils/deep-clone\";\nexport * as GrapherUtil from \"./utils/grapher-util\";\nexport {\n generateTestPerseusItem,\n generateTestPerseusRenderer,\n} from \"./utils/test-utils\";\nexport {itemHasRationales} from \"./utils/item-has-rationales\";\nexport {itemHasHints} from \"./utils/item-has-hints\";\n\nexport {\n parsePerseusItem,\n parseAndMigratePerseusItem,\n parseAndMigratePerseusArticle,\n parseAndMigrateUserInputMap,\n type ParseFailureDetail,\n} from \"./parse-perseus-json\";\n\nexport {\n isSuccess,\n isFailure,\n type Result,\n type Success,\n type Failure,\n} from \"./parse-perseus-json/result\";\n\nexport {libVersion} from \"./version\";\n\nexport {Errors} from \"./error/errors\";\nexport {PerseusError} from \"./error/perseus-error\";\n\nexport * from \"./data-schema\";\n\nexport {pluck, mapObject} from \"./utils/objective_\";\n\nexport {default as categorizerLogic} from \"./widgets/categorizer\";\nexport type {CategorizerDefaultWidgetOptions} from \"./widgets/categorizer\";\nexport {default as csProgramLogic} from \"./widgets/cs-program\";\nexport type {CSProgramDefaultWidgetOptions} from \"./widgets/cs-program\";\nexport {default as definitionLogic} from \"./widgets/definition\";\nexport type {DefinitionDefaultWidgetOptions} from \"./widgets/definition\";\nexport {default as dropdownLogic} from \"./widgets/dropdown\";\nexport type {DropdownDefaultWidgetOptions} from \"./widgets/dropdown\";\nexport {default as explanationLogic} from \"./widgets/explanation\";\nexport type {ExplanationDefaultWidgetOptions} from \"./widgets/explanation\";\nexport {default as expressionLogic} from \"./widgets/expression\";\nexport type {ExpressionDefaultWidgetOptions} from \"./widgets/expression\";\nexport {default as deriveExtraKeys} from \"./widgets/expression/derive-extra-keys\";\nexport {default as gradedGroupLogic} from \"./widgets/graded-group\";\nexport {default as freeResponseLogic} from \"./widgets/free-response\";\nexport type {FreeResponseDefaultWidgetOptions} from \"./widgets/free-response\";\nexport type {GradedGroupDefaultWidgetOptions} from \"./widgets/graded-group\";\nexport {default as gradedGroupSetLogic} from \"./widgets/graded-group-set\";\nexport type {GradedGroupSetDefaultWidgetOptions} from \"./widgets/graded-group-set\";\nexport {default as grapherLogic} from \"./widgets/grapher\";\nexport type {GrapherDefaultWidgetOptions} from \"./widgets/grapher\";\nexport {default as groupLogic} from \"./widgets/group\";\nexport type {GroupDefaultWidgetOptions} from \"./widgets/group\";\nexport {default as iframeLogic} from \"./widgets/iframe\";\nexport type {IFrameDefaultWidgetOptions} from \"./widgets/iframe\";\nexport {default as imageLogic} from \"./widgets/image\";\nexport type {ImageDefaultWidgetOptions} from \"./widgets/image\";\nexport {default as inputNumberLogic} from \"./widgets/input-number\";\nexport type {InputNumberDefaultWidgetOptions} from \"./widgets/input-number\";\nexport {default as interactionLogic} from \"./widgets/interaction\";\nexport type {InteractionDefaultWidgetOptions} from \"./widgets/interaction\";\nexport {default as interactiveGraphLogic} from \"./widgets/interactive-graph\";\nexport type {InteractiveGraphDefaultWidgetOptions} from \"./widgets/interactive-graph\";\nexport {default as labelImageLogic} from \"./widgets/label-image\";\nexport type {LabelImageDefaultWidgetOptions} from \"./widgets/label-image\";\nexport {default as matcherLogic} from \"./widgets/matcher\";\nexport type {MatcherDefaultWidgetOptions} from \"./widgets/matcher\";\nexport {default as matrixLogic} from \"./widgets/matrix\";\nexport type {MatrixDefaultWidgetOptions} from \"./widgets/matrix\";\nexport {default as measurerLogic} from \"./widgets/measurer\";\nexport type {MeasurerDefaultWidgetOptions} from \"./widgets/measurer\";\nexport {default as numberLineLogic} from \"./widgets/number-line\";\nexport type {NumberLineDefaultWidgetOptions} from \"./widgets/number-line\";\nexport {default as numericInputLogic} from \"./widgets/numeric-input\";\nexport type {NumericInputDefaultWidgetOptions} from \"./widgets/numeric-input\";\nexport {default as ordererLogic} from \"./widgets/orderer\";\nexport type {OrdererDefaultWidgetOptions} from \"./widgets/orderer\";\nexport {default as passageLogic} from \"./widgets/passage\";\nexport type {PassageDefaultWidgetOptions} from \"./widgets/passage\";\nexport {default as passageRefLogic} from \"./widgets/passage-ref\";\nexport type {PassageRefDefaultWidgetOptions} from \"./widgets/passage-ref\";\nexport {default as passageRefTargetLogic} from \"./widgets/passage-ref-target\";\nexport type {PassageRefTargetDefaultWidgetOptions} from \"./widgets/passage-ref-target\";\nexport {default as phetSimulationLogic} from \"./widgets/phet-simulation\";\nexport type {PhetSimulationDefaultWidgetOptions} from \"./widgets/phet-simulation\";\nexport {default as plotterLogic} from \"./widgets/plotter\";\nexport type {PlotterDefaultWidgetOptions} from \"./widgets/plotter\";\nexport {default as pythonProgramLogic} from \"./widgets/python-program\";\nexport type {PythonProgramDefaultWidgetOptions} from \"./widgets/python-program\";\nexport {default as radioLogic} from \"./widgets/radio\";\nexport type {RadioDefaultWidgetOptions} from \"./widgets/radio\";\nexport {usesNumCorrect} from \"./widgets/radio/radio-util\";\nexport {default as sorterLogic} from \"./widgets/sorter\";\nexport type {SorterDefaultWidgetOptions} from \"./widgets/sorter\";\nexport {default as tableLogic} from \"./widgets/table\";\nexport type {TableDefaultWidgetOptions} from \"./widgets/table\";\nexport {default as videoLogic} from \"./widgets/video\";\nexport type {VideoDefaultWidgetOptions} from \"./widgets/video\";\n\nexport {\n applyDefaultsToWidgets,\n applyDefaultsToWidget,\n} from \"./widgets/apply-defaults\";\n\nexport {default as getDefaultAnswerArea} from \"./utils/get-default-answer-area\";\nexport {\n default as splitPerseusItem,\n splitPerseusItemJSON,\n} from \"./utils/split-perseus-item\";\nexport {default as Registry} from \"./utils/registry\";\n\nexport type * from \"./widgets/logic-export.types\";\n\nexport * as CoreWidgetRegistry from \"./widgets/core-widget-registry\";\n\nexport {default as getOrdererPublicWidgetOptions} from \"./widgets/orderer/orderer-util\";\nexport type {OrdererPublicWidgetOptions} from \"./widgets/orderer/orderer-util\";\nexport {default as getCategorizerPublicWidgetOptions} from \"./widgets/categorizer/categorizer-util\";\nexport type {CategorizerPublicWidgetOptions} from \"./widgets/categorizer/categorizer-util\";\nexport {default as getCSProgramPublicWidgetOptions} from \"./widgets/cs-program/cs-program-util\";\nexport {default as getExpressionPublicWidgetOptions} from \"./widgets/expression/expression-util\";\nexport {default as getFreeResponsePublicWidgetOptions} from \"./widgets/free-response/free-response-util\";\nexport type {ExpressionPublicWidgetOptions} from \"./widgets/expression/expression-util\";\nexport {default as getGrapherPublicWidgetOptions} from \"./widgets/grapher/grapher-util\";\nexport type {GrapherPublicWidgetOptions} from \"./widgets/grapher/grapher-util\";\nexport {default as getGroupPublicWidgetOptions} from \"./widgets/group/group-util\";\nexport {\n default as getInteractiveGraphPublicWidgetOptions,\n type InteractiveGraphPublicWidgetOptions,\n} from \"./widgets/interactive-graph/interactive-graph-util\";\nexport {default as getLabelImagePublicWidgetOptions} from \"./widgets/label-image/label-image-util\";\nexport {\n default as getSorterPublicWidgetOptions,\n shuffleSorter,\n} from \"./widgets/sorter/sorter-util\";\nexport type {SorterPublicWidgetOptions} from \"./widgets/sorter/sorter-util\";\nexport type {LabelImagePublicWidgetOptions} from \"./widgets/label-image/label-image-util\";\nexport type {LabelImageMarkerPublicData} from \"./widgets/label-image/label-image-util\";\nexport {default as getDropdownPublicWidgetOptions} from \"./widgets/dropdown/dropdown-util\";\nexport type {DropdownPublicWidgetOptions} from \"./widgets/dropdown/dropdown-util\";\nexport {default as getNumericInputPublicWidgetOptions} from \"./widgets/numeric-input/numeric-input-util\";\nexport {default as getNumberLinePublicWidgetOptions} from \"./widgets/number-line/number-line-util\";\nexport type {NumberLinePublicWidgetOptions} from \"./widgets/number-line/number-line-util\";\nexport {default as getRadioPublicWidgetOptions} from \"./widgets/radio/radio-util\";\nexport type {RadioPublicWidgetOptions} from \"./widgets/radio/radio-util\";\nexport {deriveNumCorrect} from \"./widgets/radio/derive-num-correct\";\nexport {default as getTablePublicWidgetOptions} from \"./widgets/table/table-util\";\nexport {default as getIFramePublicWidgetOptions} from \"./widgets/iframe/iframe-util\";\nexport {default as getMatrixPublicWidgetOptions} from \"./widgets/matrix/matrix-util\";\nexport type {MatrixPublicWidgetOptions} from \"./widgets/matrix/matrix-util\";\nexport {default as getPlotterPublicWidgetOptions} from \"./widgets/plotter/plotter-util\";\nexport type {PlotterPublicWidgetOptions} from \"./widgets/plotter/plotter-util\";\nexport {\n default as getMatcherPublicWidgetOptions,\n shuffleMatcher,\n} from \"./widgets/matcher/matcher-util\";\nexport type {MatcherPublicWidgetOptions} from \"./widgets/matcher/matcher-util\";\nexport {shuffle, seededRNG, random} from \"./utils/random-util\";\nexport {default as PerseusFeatureFlags, isFeatureOn} from \"./feature-flags\";\n\nexport {traverse} from \"./traversal\";\nexport {isItemAccessible, violatingWidgets} from \"./accessibility\";\nexport {\n isLabeledSVG,\n getRealImageUrl,\n getBaseUrl,\n getSvgUrl,\n getDataUrl,\n getImageSizeModern,\n} from \"./utils/util.graphie\";\n\nexport {\n generateImageOptions,\n generateImageWidget,\n} from \"./utils/generators/image-widget-generator\";\n\nimport {registerCoreWidgets} from \"./widgets/core-widget-registry\";\n\nregisterCoreWidgets();\n"],"names":["APPROXIMATED_PI_ERROR","CHOOSE_CORRECT_NUM_ERROR","EXTRA_SYMBOLS_ERROR","FILL_ALL_CELLS_ERROR","INVALID_CHOICE_SELECTION","INVALID_SELECTION_ERROR","MISSING_PERCENT_ERROR","MULTIPLICATION_SIGN_ERROR","NEEDS_TO_BE_SIMPLIFIED_ERROR","NOT_NONE_ABOVE_ERROR","USER_INPUT_EMPTY","USER_INPUT_TOO_LONG","WRONG_CASE_ERROR","WRONG_LETTER_ERROR","ErrorCodes","getMatrixSize","matrix","matrixSize","forEach","matrixRow","row","rowWidth","matrixCol","col","toString","length","Math","max","getDecimalSeparator","locale","numberWithDecimalSeparator","match","Intl","NumberFormat","format","localesThatUseColon","getDivideSymbol","includes","getDivideSymbolForTex","divideSymbol","approximateEqual","x","y","abs","approximateDeepEqual","Array","isArray","i","_","all","v","k","addWidget","id","getWidgetRegex","getWidgetIdsFromContent","content","widgets","localWidgetRegex","exec","push","getWidgetIdsFromContentByType","type","widgetMap","rv","widgetIdsInContent","widgetId","widget","deepClone","obj","JSON","parse","stringify","MOVABLES","PLOT","PARABOLA","SINUSOID","canonicalSineCoefficients","coeffs","amplitude","angularFrequency","phase","verticalOffset","period","PI","canonicalTangentCoefficients","PlotDefaults","areEqual","coeffs1","coeffs2","movable","getPropsForCoeffs","fn","partial","getFunctionForCoeffs","Linear","extend","url","defaultCoords","getCoefficients","coords","p1","p2","denom","num","m","b","getEquationString","toFixed","Quadratic","h","a","c","Sinusoid","d","sin","Tangent","tan","Exponential","defaultAsymptote","extraCoordConstraint","newCoord","oldCoord","asymptote","graph","coord","extraAsymptoteConstraint","isValid","oldY","wasBelow","bottomMost","min","map","snapStep","topMost","allowReflectOverAsymptote","log","exp","Logarithm","oldX","wasLeft","leftMost","rightMost","flip","inverseCoeffs","AbsoluteValue","horizontalOffset","functionTypeMapping","linear","quadratic","sinusoid","tangent","exponential","logarithm","absolute_value","allTypes","keys","functionForType","blankPerseusRenderer","images","generateTestPerseusRenderer","customFields","blankPerseusItemData","question","answerArea","calculator","periodicTable","financialCalculatorMonthlyPayment","financialCalculatorTotalAmount","financialCalculatorTimeToPayOff","periodicTableWithKey","hints","generateTestPerseusItem","itemHasRationales","item","widgetsHaveRationales","Object","values","some","widgetHasRationales","radioWidgetHasRationales","labelImageWidgetHasRationales","options","choices","choice","rationale","markers","marker","answers","itemHasHints","isRealJSONParse","jsonParse","randomPhrase","buildRandomPhrase","randomHintPhrase","randomString","buildRandomString","testingObject","floor","random","expression1","alignment","graded","answerForms","considered","form","key","simplify","value","ariaLabel","buttonSets","functions","static","times","visibleLabel","version","major","minor","testJSON","buildTestData","replace","parsedTestJSON","parsedTestItemData","data","assessmentItem","itemData","capitalize","randomLength","randomLetter","String","fromCharCode","toUpperCase","phrases","modifierStart","modifierEnd","modifierIndex","join","testObject","success","failure","detail","isFailure","result","isSuccess","results","combineFailureDetails","failureDetails","reduce","ErrorTrackingParseContext","expected","badValue","wrapInArray","path","forSubtree","constructor","formatPath","formatPathSegment","segment","validIdentifier","test","message","conjoin","items","allButLast","slice","last","parser","any","rawValue","ctx","array","elementParser","elementResults","elem","Result","concat","arrayWithIndex","elementParserFactory","index","boolean","constant","acceptedValue","defaulted","fallback","defaultedNonEmptyString","trim","enumeration","acceptedValues","indexOf","objectConstructorString","prototype","functionToString","Function","isPlainObject","getPrototypeOf","call","nullable","parseValue","number","objectWithAllPropertiesRequired","schema","object","ret","mismatches","prop","propParser","entries","undefined","optional","pair","parseA","parseB","rawA","rawB","resultA","resultB","pipeParsers","p","ParserPipeline","then","nextParser","composeParsers","parserA","parserB","partialResult","record","parseKey","entryCtx","keyResult","valueResult","string","trio","parseC","resultC","union","parseBranch","UnionBuilder","or","newBranch","either","parsePerseusImageDetail","width","height","parseImages","parseWidget","parseType","parseOptions","parseWidgetWithVersion","parseVersion","parseCategorizerWidget","categories","randomizeItems","highlightLint","linterContext","contentType","paths","stack","parseCSProgramWidget","programID","programType","settings","name","showEditor","showButtons","parseDefinitionWidget","togglePrompt","definition","parseDropdownWidget","placeholder","correct","parseExplanationWidget","showPrompt","hidePrompt","explanation","rawVal","parseWidgetsMap","KeypadKeys","deriveExtraKeys","widgetOptions","extraKeys","defaultKeys","uniqueExtraVariables","uniqueExtraConstants","answerForm","maybeExpr","KAS","parsed","expr","isGreek","symbol","toKey","isKey","variable","getVars","maybeKey","getConsts","extraVariables","sort","extraConstants","convert","f","parseLegacyButtonSet","parseLegacyButtonSets","versionedWidgetOptions","latestMajorVersion","parseLatest","VersionedWidgetOptionsParserBuilder","latest","raw","withMigrationFrom","majorVersion","parseOldVersion","migrateToNextVersion","parseOtherVersions","migrateToLatest","old","parseThisVersion","parseThisVersionAndMigrateToLatest","versionParseResult","parseVersionedObject","stringOrNumberOrNullOrUndefined","numberOrNullToString","parsePossiblyInvalidAnswerForm","removeInvalidAnswerForms","possiblyInvalid","flatMap","parseAnswerForms","version2","parseExpressionWidgetV2","buttonsVisible","version1","parseExpressionWidgetV1","migrateV1ToV2","version0","parseExpressionWidgetV0","migrateV0ToV1","parseExpressionWidget","parseFreeResponseWidget","allowUnlimitedCharacters","characterLimit","scoringCriteria","text","falseToNull","parseGradedGroupWidgetOptions","title","hasHint","hint","parsePerseusRenderer","widgetEnabled","immutableWidgets","parseGradedGroupWidget","parseGradedGroupSetWidget","gradedGroups","discriminatedUnionOn","discriminantKey","noMoreBranches","DiscriminatedUnionBuilder","withBranch","discriminantValue","parseNewVariant","parseNewBranch","discriminatedUnionBranch","parseVariant","parseOtherBranches","pairOfNumbers","pairOfPoints","emptyArray","parseCoords","parseCorrect","parseGrapherWidget","availableTypes","backgroundImage","bottom","left","scale","box","editableSettings","gridStep","labels","markings","range","rulerLabel","rulerTicks","showProtractor","showRuler","showTooltips","step","valid","parseGroupWidget","parseIframeWidget","allowFullScreen","allowTopNavigation","stringToNumber","parsedNumber","isNaN","emptyToZero","imageDimensionToNumber","dimensionOrUndefined","parsePerseusImageBackground","top","parseImageWidget","caption","alt","longDescription","decorative","coordinates","booleanToString","parseInputNumberWidget","answerType","inexact","maxError","rightAlign","size","customKeypad","stringOrEmpty","parseFunctionElement","funcName","rangeMin","rangeMax","color","strokeDasharray","strokeWidth","parseLabelElement","label","coordX","coordY","parseLineElement","startX","startY","endX","endY","arrows","parseMovableLineElement","startSubscript","endSubscript","constraint","snap","constraintFn","constraintXMin","constraintXMax","constraintYMin","constraintYMax","parseMovablePointElement","varSubscript","parseParametricElement","parsePointElement","parseRectangleElement","parseInteractionWidget","tickStep","elements","ItemExtras","PerseusExpressionAnswerFormConsidered","lockedFigureColorNames","lockedFigureColors","blue","green","grayH","purple","pink","red","orange","lockedFigureFillStyles","none","white","translucent","solid","plotterPlotTypes","parsePerseusGraphTypeAngle","showAngles","allowReflexAngles","angleOffsetDeg","snapDegrees","startCoords","parsePerseusGraphTypeCircle","center","radius","parsePerseusGraphTypeLinear","parsePerseusGraphTypeLinearSystem","parsePerseusGraphTypeNone","parsePerseusGraphTypePoint","numPoints","parsePerseusGraphTypePolygon","numSides","showSides","snapTo","parsePerseusGraphTypeQuadratic","parsePerseusGraphTypeRay","parsePerseusGraphTypeSegment","numSegments","parsePerseusGraphTypeSinusoid","parsePerseusGraphType","parseLockedFigureColor","parseLockedFigureFillType","parseLockedLineStyle","parseStrokeWeight","parseLockedLabelType","parseLockedPointType","filled","parseLockedLineType","kind","points","lineStyle","showPoint1","showPoint2","weight","parseLockedVectorType","parseLockedEllipseType","angle","fillStyle","strokeStyle","parseLockedPolygonType","showVertices","parseLockedFunctionDomain","Infinity","parseLockedFunctionType","equation","directionalAxis","domain","parseLockedFigure","parseLabelLocation","parseInteractiveGraphWidget","labelLocation","showAxisArrows","xMin","xMax","yMin","yMax","lockedFigures","fullGraphAriaLabel","fullGraphAriaDescription","parseLabelImageWidget","imageUrl","imageAlt","imageHeight","imageWidth","hideChoicesFromInstructions","multipleAnswers","matcherOptions","right","orderMatters","padding","getDefaultOptions","parseMatcherWidget","numberOrString","numeric","NaN","parseMatrixWidget","prefix","suffix","cursorPosition","matrixBoardSize","parseMeasurerWidget","image","rulerPixels","rulerLength","parseMoleculeRendererWidget","rotationAngle","smiles","emptyStringToNull","parseNumberLineWidget","labelRange","labelStyle","labelTicks","isTickCtrl","isInequality","divisionRange","numDivisions","snapDivisions","correctRel","correctX","initialX","parseMathFormat","parseSimplify","deprecatedSimplifyValuesToRequired","parseNumericInputWidget","status","strict","labelText","coefficient","parseRenderer","largeToAuto","parseOrdererWidget","correctOptions","otherOptions","layout","parsePassageRefWidget","passageNumber","referenceNumber","summaryText","parsePassageWidget","footnotes","passageText","passageTitle","showLineNumbers","parsePhetSimulationWidget","description","parsePlotterWidget","maxY","scaleY","labelInterval","snapsPerLine","starting","picUrl","picSize","picBoxHeight","plotDimensions","parsePythonProgramWidget","deriveNumCorrect","filter","parseWidgetsMapOrUndefined","generateChoiceId","parseOnePerLine","parseNoneOfTheAbove","version3","parseRadioWidgetV3","numCorrect","isNoneOfTheAbove","hasNoneOfTheAbove","countChoices","randomize","multipleSelect","deselectEnabled","parseRadioWidgetV2","clue","onePerLine","displayCount","noneOfTheAbove","parseRadioWidgetV1","parseRadioWidgetV0","migrateV2toV3","rest","parseRadioWidget","parseSorterWidget","parseTableWidget","headers","rows","columns","parseVideoWidget","location","parseStringToNonNegativeInt","parseWidgetIdComponents","widgetsMap","entryResult","parseWidgetsMapEntry","idComponentsResult","split","n","parseAndAssign","widgetResult","parseDeprecatedWidget","metadata","parsePerseusArticle","parseHint","parsePerseusAnswerArea","toAnswerArea","parsePerseusItem","parseCategorizerUserInput","parseCSProgramUserInput","parseDropdownUserInput","parseExpressionUserInput","parseFreeResponseUserInput","currentValue","coordPair","parseAbsoluteValueBranch","parseExponentialBranch","parseLinearBranch","parseLogarithmBranch","parseQuadraticBranch","parseSinusoidBranch","parseTangentBranch","parseGrapherUserInput","parseGroupUserInput","parseUserInputMap","parseIFrameUserInput","parseInputNumberUserInput","parseInteractiveGraphUserInput","parseLabelImageUserInput","selected","parseMatcherUserInput","parseMatrixUserInput","parseNumberLineUserInput","numLinePosition","rel","parseNumericInputUserInput","parseOrdererUserInput","current","parsePlotterUserInput","parseRadioUserInput","selectedChoiceIds","parseSorterUserInput","changed","parseTableUserInput","userInputMap","parseUserInputMapEntry","userInput","userInputResult","json","Error","parseAndMigratePerseusItem","throwErrorIfCheatingDetected","migrateAndTypecheckPerseusItem","invalidObject","parseAndMigratePerseusArticle","migrateAndTypecheckPerseusArticle","parseAndMigrateUserInputMap","libName","libVersion","addLibraryVersionToPerseusDebug","Errors","freeze","Unknown","Internal","InvalidInput","NotAllowed","TransientService","Service","PerseusError","pluck","table","subKey","mapObject","lambda","getCategorizerPublicWidgetOptions","defaultWidgetOptions","categorizerWidgetLogic","getPublicWidgetOptions","accessible","getCSProgramPublicWidgetOptions","DEFAULT_HEIGHT","csProgramWidgetLogic","supportedAlignments","definitionWidgetLogic","defaultAlignment","getDropdownPublicWidgetOptions","dropdownWidgetLogic","explanationWidgetLogic","getExpressionPublicWidgetOptions","currentVersion","expressionWidgetLogic","traverseChildWidgets","props","traverseRenderer","gradedGroupWidgetLogic","getFreeResponsePublicWidgetOptions","freeResponseWidgetLogic","gradedGroupSetWidgetLogic","getGrapherPublicWidgetOptions","publicOptions","grapherWidgetLogic","Registry","throwIfUnregistered","anythingRegistered","has","hasOwnProperty","contents","get","set","deprecatedStandinWidgetLogic","getIFramePublicWidgetOptions","iframeWidgetLogic","imageWidgetLogic","imageOptions","bgImage","hasBackgroundImage","hasAltText","isDecorative","getInputNumberPublicWidgetOptions","publicWidgetOptions","inputNumberWidgetLogic","interactionWidgetLogic","svgLabelsRegex","svgLocalLabelsRegex","getRealImageUrl","graphieUrl","isLabeledSVG","getSvgUrl","getBaseUrl","getDataUrl","getImageSizeModern","Image","Promise","resolve","reject","onload","naturalWidth","naturalHeight","onerror","src","getInteractiveGraphPublicWidgetOptions","interactiveGraphWidgetLogic","interactiveGraphOptions","getLabelImagePublicWidgetOptions","getLabelImageMarkerPublicData","publicData","labelImageWidgetLogic","labelImageOptions","seededRNG","seed","randomSeed","shuffle","ensurePermuted","isValidShuffle","shuffled","isEqual","constrainedShuffle","maxIterations","every","shuffleInPlace","randomIntInRange","Date","getTime","shuffleMatcher","problemNum","rng","shuffleDisplacingFirst","getMatcherPublicWidgetOptions","sortAllButFirst","first","isFirstElementDisplaced","matcherWidgetLogic","getMatrixPublicWidgetOptions","matrixWidgetLogic","measurerWidgetLogic","getNumberLinePublicWidgetOptions","__","numberLineWidgetLogic","getNumericInputAnswerPublicData","answer","getNumericInputPublicWidgetOptions","numericInputWidgetLogic","getOrdererPublicWidgetOptions","fullOptions","ordererWidgetLogic","passageWidgetLogic","passageRefWidgetLogic","passageRefTargetWidgetLogic","phetSimulationWidgetLogic","getPlotterPublicWidgetOptions","plotterWidgetLogic","pythonProgramWidgetLogic","getRadioChoicePublicData","usesNumCorrect","getRadioPublicWidgetOptions","radioWidgetLogic","getSorterPublicWidgetOptions","shuffleSorter","sorterWidgetLogic","getTablePublicWidgetOptions","defaultRows","defaultColumns","fill","tableWidgetLogic","videoWidgetLogic","registerWidget","logic","isWidgetRegistered","widgetLogic","Boolean","getCurrentVersion","getPublicWidgetOptionsFunction","getDefaultWidgetOptions","isAccessible","widgetInfo","widgetExports","newProps","getSupportedAlignments","getDefaultAlignment","getAlignmentClassName","registerCoreWidgets","groupWidgetLogic","w","DEFAULT_STATIC","applyDefaultsToWidget","oldWidgetInfo","isString","initialVersion","latestVersion","newEditorOptions","clone","defaultOptions","widgetType","widgetStatic","applyDefaultsToWidgets","oldWidgetOptions","newValues","splitPerseusRenderer","original","originalWidgets","upgradedWidgets","splitWidgets","publicWidgetOptionsFun","getGroupPublicWidgetOptions","getDefaultAnswerArea","acc","curr","splitPerseusItem","splitPerseusItemJSON","parseResult","SyntaxError","PerseusFeatureFlags","isFeatureOn","flag","apiOptions","flags","noop","deepCallbackFor","contentCallback","widgetCallback","optionsCallback","deepCallback","newWidgetInfo","Widgets","rendererOptions","userWidgetInfo","deepWidgetCallback","newContent","modifiedContent","newWidgets","newOptions","userOptions","traverse","violatingWidgets","widgetTypes","info","Set","isItemAccessible","ast","widgetIdsInUse","hasInaccessibleImage","traverseContent","node","add","itemDataWithOnlyActiveWidgets","fromEntries","generateImageOptions","defaultImageOptions","generateImageWidget","imageWidgetProperties"],"mappings":";;;;;;AAAA,MAAMA,qBAAwB,CAAA,uBAAA,CAC9B,MAAMC,wBAAAA,CAA2B,0BACjC,CAAA,MAAMC,mBAAsB,CAAA,qBAAA,CAC5B,MAAMC,oBAAAA,CAAuB,sBAC7B,CAAA,MAAMC,wBAA2B,CAAA,0BAAA,CACjC,MAAMC,uBAAAA,CAA0B,yBAChC,CAAA,MAAMC,qBAAwB,CAAA,uBAAA,CAC9B,MAAMC,yBAAAA,CAA4B,2BAClC,CAAA,MAAMC,4BAA+B,CAAA,8BAAA,CACrC,MAAMC,oBAAAA,CAAuB,sBAC7B,CAAA,MAAMC,gBAAmB,CAAA,kBAAA,CACzB,MAAMC,mBAAAA,CAAsB,qBAC5B,CAAA,MAAMC,gBAAmB,CAAA,kBAAA,CACzB,MAAMC,kBAAAA,CAAqB,oBAE3B,CAAA,MAAMC,UAAa,CAAA,CACfd,qBACAC,CAAAA,wBAAAA,CACAC,mBACAC,CAAAA,oBAAAA,CACAC,wBACAC,CAAAA,uBAAAA,CACAC,qBACAC,CAAAA,yBAAAA,CACAC,4BACAC,CAAAA,oBAAAA,CACAC,gBACAC,CAAAA,mBAAAA,CACAC,gBACAC,CAAAA,kBACJ;;AC9BA,SAASE,aACLC,CAAAA,MAE0C,CAE1C,CAAA,MAAMC,WAAa,CAAC,CAAA,CAAG,CAAE,CAAA,CAIzBD,OAAOE,OAAO,CAAC,CAACC,SAAAA,CAAWC,OACvB,IAAIC,QAAAA,CAAW,CACfF,CA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,CAAC/xB,EAAAA,CAAAA,CAAAA,CAG/B,CACJ,CACA,CAAA,OAAOw8B,iBAAiBW,6BAA+B/+B,CAAAA,CAAAA,MAAM,GAAK,CACtE;;ACpFO,SAASi/B,qBACZp1B,OAA4C,CAAA,CAE5C,MAAMq1B,mBAAiD,CAAA,CACnDpjB,eAAiB,CAAA,EACrB,CAAA,CAEA,OAAO,CACH,GAAGojB,mBAAmB,CACtB,GAAGr1B,OAAO,CAElB,CAEO,SAASs1B,mBACZC,CAAAA,qBAA0D,EAE1D,OAAO,CACH/8B,KAAM,OACN4I,CAAAA,MAAAA,CAAQ,KACRa,OAAS,CAAA,CAACC,KAAO,CAAA,CAAA,CAAGC,KAAO,CAAA,CAAC,EAC5BL,MAAQ,CAAA,KAAA,CACRX,SAAW,CAAA,SAAA,CACXnB,OAASo1B,CAAAA,oBAAAA,CAAqB,EAC9B,CAAA,CAAA,GAAGG,qBACP,CACJ;;AC2LArE,mBAAAA,EAAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/error-codes.ts","../../src/utils/get-matrix-size.ts","../../src/utils/get-decimal-separator.ts","../../src/utils/get-divide-symbol.ts","../../src/utils/equality.ts","../../src/utils/widget-id-utils.ts","../../src/utils/deep-clone.ts","../../src/utils/grapher-util.ts","../../src/utils/test-utils.ts","../../src/utils/item-has-rationales.ts","../../src/utils/item-has-hints.ts","../../src/utils/is-real-json-parse.ts","../../src/parse-perseus-json/result.ts","../../src/parse-perseus-json/error-tracking-parse-context.ts","../../src/parse-perseus-json/object-path.ts","../../src/parse-perseus-json/parse-failure-detail.ts","../../src/parse-perseus-json/parse.ts","../../src/parse-perseus-json/general-purpose-parsers/any.ts","../../src/parse-perseus-json/general-purpose-parsers/array.ts","../../src/parse-perseus-json/general-purpose-parsers/boolean.ts","../../src/parse-perseus-json/general-purpose-parsers/constant.ts","../../src/parse-perseus-json/general-purpose-parsers/defaulted.ts","../../src/parse-perseus-json/general-purpose-parsers/enumeration.ts","../../src/parse-perseus-json/general-purpose-parsers/is-plain-object.ts","../../src/parse-perseus-json/general-purpose-parsers/nullable.ts","../../src/parse-perseus-json/general-purpose-parsers/number.ts","../../src/parse-perseus-json/general-purpose-parsers/object.ts","../../src/parse-perseus-json/general-purpose-parsers/optional.ts","../../src/parse-perseus-json/general-purpose-parsers/pair.ts","../../src/parse-perseus-json/general-purpose-parsers/pipe-parsers.ts","../../src/parse-perseus-json/general-purpose-parsers/record.ts","../../src/parse-perseus-json/general-purpose-parsers/string.ts","../../src/parse-perseus-json/general-purpose-parsers/trio.ts","../../src/parse-perseus-json/general-purpose-parsers/union.ts","../../src/parse-perseus-json/perseus-parsers/perseus-image-detail.ts","../../src/parse-perseus-json/perseus-parsers/images-map.ts","../../src/parse-perseus-json/perseus-parsers/widget.ts","../../src/parse-perseus-json/perseus-parsers/categorizer-widget.ts","../../src/parse-perseus-json/perseus-parsers/cs-program-widget.ts","../../src/parse-perseus-json/perseus-parsers/definition-widget.ts","../../src/parse-perseus-json/perseus-parsers/dropdown-widget.ts","../../src/parse-perseus-json/perseus-parsers/explanation-widget.ts","../../src/keypad.ts","../../src/widgets/expression/derive-extra-keys.ts","../../src/parse-perseus-json/general-purpose-parsers/convert.ts","../../src/parse-perseus-json/perseus-parsers/legacy-button-sets.ts","../../src/parse-perseus-json/perseus-parsers/versioned-widget-options.ts","../../src/parse-perseus-json/perseus-parsers/expression-widget.ts","../../src/parse-perseus-json/perseus-parsers/free-response-widget.ts","../../src/parse-perseus-json/perseus-parsers/graded-group-widget.ts","../../src/parse-perseus-json/perseus-parsers/graded-group-set-widget.ts","../../src/parse-perseus-json/general-purpose-parsers/discriminated-union.ts","../../src/parse-perseus-json/perseus-parsers/grapher-widget.ts","../../src/parse-perseus-json/perseus-parsers/group-widget.ts","../../src/parse-perseus-json/perseus-parsers/iframe-widget.ts","../../src/parse-perseus-json/general-purpose-parsers/string-to-number.ts","../../src/parse-perseus-json/perseus-parsers/perseus-image-background.ts","../../src/parse-perseus-json/perseus-parsers/image-widget.ts","../../src/parse-perseus-json/perseus-parsers/input-number-widget.ts","../../src/parse-perseus-json/perseus-parsers/interaction-widget.ts","../../src/data-schema.ts","../../src/parse-perseus-json/perseus-parsers/interactive-graph-widget.ts","../../src/parse-perseus-json/perseus-parsers/label-image-widget.ts","../../src/parse-perseus-json/perseus-parsers/matcher-widget.ts","../../src/parse-perseus-json/perseus-parsers/matrix-widget.ts","../../src/parse-perseus-json/perseus-parsers/measurer-widget.ts","../../src/parse-perseus-json/perseus-parsers/molecule-renderer-widget.ts","../../src/parse-perseus-json/perseus-parsers/number-line-widget.ts","../../src/parse-perseus-json/perseus-parsers/numeric-input-widget.ts","../../src/parse-perseus-json/perseus-parsers/orderer-widget.ts","../../src/parse-perseus-json/perseus-parsers/passage-ref-widget.ts","../../src/parse-perseus-json/perseus-parsers/passage-widget.ts","../../src/parse-perseus-json/perseus-parsers/phet-simulation-widget.ts","../../src/parse-perseus-json/perseus-parsers/plotter-widget.ts","../../src/parse-perseus-json/perseus-parsers/python-program-widget.ts","../../src/widgets/radio/derive-num-correct.ts","../../src/parse-perseus-json/perseus-parsers/radio-widget.ts","../../src/parse-perseus-json/perseus-parsers/sorter-widget.ts","../../src/parse-perseus-json/perseus-parsers/table-widget.ts","../../src/parse-perseus-json/perseus-parsers/video-widget.ts","../../src/parse-perseus-json/perseus-parsers/widget-id-components.ts","../../src/parse-perseus-json/perseus-parsers/widgets-map.ts","../../src/parse-perseus-json/perseus-parsers/perseus-renderer.ts","../../src/parse-perseus-json/perseus-parsers/perseus-article.ts","../../src/parse-perseus-json/perseus-parsers/hint.ts","../../src/parse-perseus-json/perseus-parsers/perseus-answer-area.ts","../../src/parse-perseus-json/perseus-parsers/perseus-item.ts","../../src/parse-perseus-json/perseus-parsers/categorizer-user-input.ts","../../src/parse-perseus-json/perseus-parsers/cs-program-user-input.ts","../../src/parse-perseus-json/perseus-parsers/dropdown-user-input.ts","../../src/parse-perseus-json/perseus-parsers/expression-user-input.ts","../../src/parse-perseus-json/perseus-parsers/free-response-user-input.ts","../../src/parse-perseus-json/perseus-parsers/grapher-user-input.ts","../../src/parse-perseus-json/perseus-parsers/group-user-input.ts","../../src/parse-perseus-json/perseus-parsers/iframe-user-input.ts","../../src/parse-perseus-json/perseus-parsers/input-number-user-input.ts","../../src/parse-perseus-json/perseus-parsers/interactive-graph-user-input.ts","../../src/parse-perseus-json/perseus-parsers/label-image-user-input.ts","../../src/parse-perseus-json/perseus-parsers/matcher-user-input.ts","../../src/parse-perseus-json/perseus-parsers/matrix-user-input.ts","../../src/parse-perseus-json/perseus-parsers/number-line-user-input.ts","../../src/parse-perseus-json/perseus-parsers/numeric-input-user-input.ts","../../src/parse-perseus-json/perseus-parsers/orderer-user-input.ts","../../src/parse-perseus-json/perseus-parsers/plotter-user-input.ts","../../src/parse-perseus-json/perseus-parsers/radio-user-input.ts","../../src/parse-perseus-json/perseus-parsers/sorter-user-input.ts","../../src/parse-perseus-json/perseus-parsers/table-user-input.ts","../../src/parse-perseus-json/perseus-parsers/user-input-map.ts","../../src/parse-perseus-json/index.ts","../../src/version.ts","../../src/error/errors.ts","../../src/error/perseus-error.ts","../../src/utils/objective_.ts","../../src/widgets/categorizer/categorizer-util.ts","../../src/widgets/categorizer/index.ts","../../src/widgets/cs-program/cs-program-util.ts","../../src/widgets/cs-program/index.ts","../../src/widgets/definition/index.ts","../../src/widgets/dropdown/dropdown-util.ts","../../src/widgets/dropdown/index.ts","../../src/widgets/explanation/index.ts","../../src/widgets/expression/expression-util.ts","../../src/widgets/expression/index.ts","../../src/widgets/graded-group/index.ts","../../src/widgets/free-response/free-response-util.ts","../../src/widgets/free-response/index.ts","../../src/widgets/graded-group-set/index.ts","../../src/widgets/grapher/grapher-util.ts","../../src/widgets/grapher/index.ts","../../src/utils/registry.ts","../../src/widgets/deprecated-standin/index.ts","../../src/widgets/iframe/iframe-util.ts","../../src/widgets/iframe/index.ts","../../src/widgets/image/index.ts","../../src/widgets/input-number/input-number-util.ts","../../src/widgets/input-number/index.ts","../../src/widgets/interaction/index.ts","../../src/utils/util.graphie.ts","../../src/widgets/interactive-graph/interactive-graph-util.ts","../../src/widgets/interactive-graph/index.ts","../../src/widgets/label-image/label-image-util.ts","../../src/widgets/label-image/index.ts","../../src/utils/random-util.ts","../../src/widgets/matcher/matcher-util.ts","../../src/widgets/matcher/index.ts","../../src/widgets/matrix/matrix-util.ts","../../src/widgets/matrix/index.ts","../../src/widgets/measurer/index.ts","../../src/widgets/number-line/number-line-util.ts","../../src/widgets/number-line/index.ts","../../src/widgets/numeric-input/numeric-input-util.ts","../../src/widgets/numeric-input/index.ts","../../src/widgets/orderer/orderer-util.ts","../../src/widgets/orderer/index.ts","../../src/widgets/passage/index.ts","../../src/widgets/passage-ref/passage-ref-upgrade.ts","../../src/widgets/passage-ref/index.ts","../../src/widgets/passage-ref-target/index.ts","../../src/widgets/phet-simulation/index.ts","../../src/widgets/plotter/plotter-util.ts","../../src/widgets/plotter/index.ts","../../src/widgets/python-program/index.ts","../../src/widgets/radio/radio-util.ts","../../src/widgets/radio/index.ts","../../src/widgets/sorter/sorter-util.ts","../../src/widgets/sorter/index.ts","../../src/widgets/table/table-util.ts","../../src/widgets/table/index.ts","../../src/widgets/video/index.ts","../../src/widgets/core-widget-registry.ts","../../src/widgets/apply-defaults.ts","../../src/utils/split-perseus-renderer.ts","../../src/widgets/group/group-util.ts","../../src/widgets/group/index.ts","../../src/utils/get-default-answer-area.ts","../../src/utils/split-perseus-item.ts","../../src/feature-flags.ts","../../src/traversal.ts","../../src/accessibility.ts","../../src/utils/generators/image-widget-generator.ts","../../src/index.ts"],"sourcesContent":["const APPROXIMATED_PI_ERROR = \"APPROXIMATED_PI_ERROR\";\nconst CHOOSE_CORRECT_NUM_ERROR = \"CHOOSE_CORRECT_NUM_ERROR\";\nconst EXTRA_SYMBOLS_ERROR = \"EXTRA_SYMBOLS_ERROR\";\nconst FILL_ALL_CELLS_ERROR = \"FILL_ALL_CELLS_ERROR\";\nconst INVALID_CHOICE_SELECTION = \"INVALID_CHOICE_SELECTION\";\nconst INVALID_SELECTION_ERROR = \"INVALID_SELECTION_ERROR\";\nconst MISSING_PERCENT_ERROR = \"MISSING_PERCENT_ERROR\";\nconst MULTIPLICATION_SIGN_ERROR = \"MULTIPLICATION_SIGN_ERROR\";\nconst NEEDS_TO_BE_SIMPLIFIED_ERROR = \"NEEDS_TO_BE_SIMPLIFIED_ERROR\";\nconst NOT_NONE_ABOVE_ERROR = \"NOT_NONE_ABOVE_ERROR\";\nconst USER_INPUT_EMPTY = \"USER_INPUT_EMPTY\";\nconst USER_INPUT_TOO_LONG = \"USER_INPUT_TOO_LONG\";\nconst WRONG_CASE_ERROR = \"WRONG_CASE_ERROR\";\nconst WRONG_LETTER_ERROR = \"WRONG_LETTER_ERROR\";\n\nconst ErrorCodes = {\n APPROXIMATED_PI_ERROR,\n CHOOSE_CORRECT_NUM_ERROR,\n EXTRA_SYMBOLS_ERROR,\n FILL_ALL_CELLS_ERROR,\n INVALID_CHOICE_SELECTION,\n INVALID_SELECTION_ERROR,\n MISSING_PERCENT_ERROR,\n MULTIPLICATION_SIGN_ERROR,\n NEEDS_TO_BE_SIMPLIFIED_ERROR,\n NOT_NONE_ABOVE_ERROR,\n USER_INPUT_EMPTY,\n USER_INPUT_TOO_LONG,\n WRONG_CASE_ERROR,\n WRONG_LETTER_ERROR,\n};\n\nexport type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];\n\nexport default ErrorCodes;\n","function getMatrixSize(\n matrix:\n | ReadonlyArray<ReadonlyArray<number>>\n | ReadonlyArray<ReadonlyArray<string>>,\n) {\n const matrixSize = [1, 1];\n\n // We need to find the widest row and tallest column to get the correct\n // matrix size.\n matrix.forEach((matrixRow, row) => {\n let rowWidth = 0;\n matrixRow.forEach((matrixCol, col) => {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (matrixCol != null && matrixCol.toString().length) {\n rowWidth = col + 1;\n }\n });\n\n // Matrix width:\n matrixSize[1] = Math.max(matrixSize[1], rowWidth);\n\n // Matrix height:\n if (rowWidth > 0) {\n matrixSize[0] = Math.max(matrixSize[0], row + 1);\n }\n });\n return matrixSize;\n}\n\nexport default getMatrixSize;\n","/**\n * Get the character used for separating decimals.\n */\nconst getDecimalSeparator = (locale: string): string => {\n switch (locale) {\n // TODO(somewhatabstract): Remove this when Chrome supports the `ka`\n // locale properly.\n // https://github.com/formatjs/formatjs/issues/1526#issuecomment-559891201\n //\n // Supported locales in Chrome:\n // https://source.chromium.org/chromium/chromium/src/+/master:third_party/icu/scripts/chrome_ui_languages.list\n case \"ka\":\n return \",\";\n\n default:\n const numberWithDecimalSeparator = 1.1;\n // TODO(FEI-3647): Update to use .formatToParts() once we no longer have to\n // support Safari 12.\n const match = new Intl.NumberFormat(locale)\n .format(numberWithDecimalSeparator)\n // 0x661 is ARABIC-INDIC DIGIT ONE\n // 0x6F1 is EXTENDED ARABIC-INDIC DIGIT ONE\n // 0x967 is DEVANAGARI DIGIT ONE\n // 0x9e7 is BENGALI/BANGLA DIGIT ONE\n .match(/[^\\d\\u0661\\u06F1\\u0967\\u09e7]/);\n return match?.[0] ?? \".\";\n }\n};\n\nexport default getDecimalSeparator;\n","const localesThatUseColon = [\n \"az\",\n \"bg\",\n \"cs\",\n \"da\",\n \"de\",\n \"hu\",\n \"hy\",\n \"id\",\n \"it\",\n \"ky\",\n \"lt\",\n \"lv\",\n \"nb\",\n \"nl\",\n \"pl\",\n \"pt-pt\",\n \"ro\",\n \"sv\",\n \"uk\",\n \"vi\",\n \"ro\",\n \"ru\",\n];\n\n/**\n * Get the character used for dividing numbers depending on the locale.\n */\nexport const getDivideSymbol = (locale: string): string => {\n // If the locale uses a colon for division, return a colon\n if (localesThatUseColon.includes(locale)) {\n return \":\";\n }\n\n // Default to using a forward slash\n return \"/\";\n};\n\n/**\n * Get the TeX command used for dividing numbers depending on the locale.\n */\nexport const getDivideSymbolForTex = (locale: string): string => {\n const divideSymbol = getDivideSymbol(locale);\n\n // If the locale uses the forward slash, return the TeX command for ÷\n return divideSymbol === \"/\" ? \"\\\\div\" : divideSymbol;\n};\n","import _ from \"underscore\";\n\n/**\n * APPROXIMATE equality on numbers and primitives.\n */\nexport function approximateEqual<T>(x: T, y: T): boolean {\n if (typeof x === \"number\" && typeof y === \"number\") {\n return Math.abs(x - y) < 1e-9;\n }\n return x === y;\n}\n\n/**\n * Deep APPROXIMATE equality on primitives, numbers, arrays, and objects.\n * Recursive.\n */\nexport function approximateDeepEqual<T>(x: T, y: T): boolean {\n if (Array.isArray(x) && Array.isArray(y)) {\n if (x.length !== y.length) {\n return false;\n }\n for (let i = 0; i < x.length; i++) {\n if (!approximateDeepEqual(x[i], y[i])) {\n return false;\n }\n }\n return true;\n }\n if (Array.isArray(x) || Array.isArray(y)) {\n return false;\n }\n if (typeof x === \"function\" && typeof y === \"function\") {\n return approximateEqual(x, y);\n }\n if (typeof x === \"function\" || typeof y === \"function\") {\n return false;\n }\n if (typeof x === \"object\" && typeof y === \"object\" && !!x && !!y) {\n return (\n x === y ||\n (_.all(x, function (v, k) {\n // @ts-expect-error - TS2536 - Type 'CollectionKey<T>' cannot be used to index type 'T'.\n return approximateDeepEqual(y[k], v);\n }) &&\n _.all(y, function (v, k) {\n // @ts-expect-error - TS2536 - Type 'CollectionKey<T>' cannot be used to index type 'T'.\n return approximateDeepEqual(x[k], v);\n }))\n );\n }\n if ((typeof x === \"object\" && !!x) || (typeof y === \"object\" && !!y)) {\n return false;\n }\n return approximateEqual(x, y);\n}\n","import type {PerseusWidgetsMap} from \"../data-schema\";\n\n/**\n * Add a widget placeholder using the widget ID.\n * ex. addWidget(\"radio 1\") => \"[[☃ radio 1]]\"\n *\n * @param {string} id\n * @returns {string}\n */\nexport function addWidget(id: string): string {\n return `[[☃ ${id}]]`;\n}\n\n/**\n * Regex for widget placeholders in a string.\n *\n * First capture group is the widget ID (ex. 'radio 1')\n * Second capture group is the widget type (ex. \"radio)\n * exec return will look like: ['[[☃ radio 1]]', 'radio 1', 'radio']\n */\nexport function getWidgetRegex() {\n return /\\[\\[☃ ([A-Za-z0-9- ]+)\\]\\]/g;\n}\n\n/**\n * Extract all widget IDs, which includes the widget type and instance number.\n * example output: ['radio 1', 'categorizer 1', 'categorizor 2']\n *\n * Content should contain Perseus widget placeholders,\n * which look like: '[[☃ radio 1]]'.\n *\n * @param {string} content\n * @returns {ReadonlyArray<string>} widgetIds\n */\nexport function getWidgetIdsFromContent(\n content: string,\n): ReadonlyArray<string> {\n const widgets: Array<string> = [];\n const localWidgetRegex = getWidgetRegex();\n\n let match = localWidgetRegex.exec(content);\n\n while (match !== null) {\n widgets.push(match[1]);\n match = localWidgetRegex.exec(content);\n }\n\n return widgets;\n}\n\n/**\n * Get a list of widget IDs from content,\n * but only for specific widget types\n *\n * @param {string} type the type of widget (ie \"radio\")\n * @param {string} content the string to parse\n * @param {PerseusWidgetsMap} widgetMap widget ID to widget map\n * @returns {ReadonlyArray<string>} the widget type (ie \"radio\")\n */\nexport function getWidgetIdsFromContentByType(\n type: string,\n content: string,\n widgetMap: PerseusWidgetsMap,\n): ReadonlyArray<string> {\n const rv: Array<string> = [];\n const widgetIdsInContent = getWidgetIdsFromContent(content);\n widgetIdsInContent.forEach((widgetId) => {\n const widget = widgetMap[widgetId];\n if (widget?.type === type) {\n rv.push(widgetId);\n }\n });\n return rv;\n}\n","function deepClone<T>(obj: T): T {\n return JSON.parse(JSON.stringify(obj));\n}\n\nexport default deepClone;\n","import _ from \"underscore\";\n\nimport {approximateDeepEqual} from \"./equality\";\n\nimport type {\n LinearType,\n QuadraticType,\n SinusoidType,\n TangentType,\n ExponentialType,\n LogarithmType,\n AbsoluteValueType,\n Coords,\n} from \"./grapher-types\";\nimport type {Coord} from \"../data-schema\";\n\nexport const MOVABLES = {\n PLOT: \"PLOT\",\n PARABOLA: \"PARABOLA\",\n SINUSOID: \"SINUSOID\",\n};\n\n// TODO(charlie): These really need to go into a utility file as they're being\n// used by both interactive-graph and now grapher.\nfunction canonicalSineCoefficients(coeffs: any) {\n // For a curve of the form f(x) = a * Sin(b * x - c) + d,\n // this function ensures that a, b > 0, and c is its\n // smallest possible positive value.\n let amplitude = coeffs[0];\n let angularFrequency = coeffs[1];\n let phase = coeffs[2];\n const verticalOffset = coeffs[3];\n\n // Guarantee a > 0\n if (amplitude < 0) {\n amplitude *= -1;\n angularFrequency *= -1;\n phase *= -1;\n }\n\n const period = 2 * Math.PI;\n // Guarantee b > 0\n if (angularFrequency < 0) {\n angularFrequency *= -1;\n phase *= -1;\n phase += period / 2;\n }\n\n // Guarantee c is smallest possible positive value\n while (phase > 0) {\n phase -= period;\n }\n while (phase < 0) {\n phase += period;\n }\n\n return [amplitude, angularFrequency, phase, verticalOffset];\n}\n\nfunction canonicalTangentCoefficients(coeffs: any) {\n // For a curve of the form f(x) = a * Tan(b * x - c) + d,\n // this function ensures that a, b > 0, and c is its\n // smallest possible positive value.\n let amplitude = coeffs[0];\n let angularFrequency = coeffs[1];\n let phase = coeffs[2];\n const verticalOffset = coeffs[3];\n\n // Guarantee a > 0\n if (amplitude < 0) {\n amplitude *= -1;\n angularFrequency *= -1;\n phase *= -1;\n }\n\n const period = Math.PI;\n // Guarantee b > 0\n if (angularFrequency < 0) {\n angularFrequency *= -1;\n phase *= -1;\n phase += period / 2;\n }\n\n // Guarantee c is smallest possible positive value\n while (phase > 0) {\n phase -= period;\n }\n while (phase < 0) {\n phase += period;\n }\n\n return [amplitude, angularFrequency, phase, verticalOffset];\n}\n\nconst PlotDefaults = {\n areEqual: function (\n coeffs1: ReadonlyArray<number>,\n coeffs2: ReadonlyArray<number>,\n ): boolean {\n return approximateDeepEqual(coeffs1, coeffs2);\n },\n movable: MOVABLES.PLOT,\n getPropsForCoeffs: function (coeffs: ReadonlyArray<number>): {fn: any} {\n return {\n // @ts-expect-error - TS2339 - Property 'getFunctionForCoeffs' does not exist on type '{ readonly areEqual: (coeffs1: any, coeffs2: any) => boolean; readonly Movable: any; readonly getPropsForCoeffs: (coeffs: any) => any; }'.\n fn: _.partial(this.getFunctionForCoeffs, coeffs),\n };\n },\n} as const;\n\nconst Linear: LinearType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/67aaf581e6d9ef9038c10558a1f70ac21c11c9f8.png\",\n\n defaultCoords: [\n [0.25, 0.75],\n [0.75, 0.75],\n ],\n\n getCoefficients: function (\n coords: Coords,\n ): ReadonlyArray<number> | undefined {\n const p1 = coords[0];\n const p2 = coords[1];\n\n const denom = p2[0] - p1[0];\n const num = p2[1] - p1[1];\n\n if (denom === 0) {\n return;\n }\n\n const m = num / denom;\n const b = p2[1] - m * p2[0];\n return [m, b];\n },\n\n getFunctionForCoeffs: function (coeffs: ReadonlyArray<number>, x: number) {\n const m = coeffs[0];\n const b = coeffs[1];\n return m * x + b;\n },\n\n getEquationString: function (coords: Coords) {\n const coeffs: ReadonlyArray<number> = this.getCoefficients(coords);\n const m: number = coeffs[0];\n const b: number = coeffs[1];\n return \"y = \" + m.toFixed(3) + \"x + \" + b.toFixed(3);\n },\n});\n\nconst Quadratic: QuadraticType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/e23d36e6fc29ee37174e92c9daba2a66677128ab.png\",\n\n defaultCoords: [\n [0.5, 0.5],\n [0.75, 0.75],\n ],\n movable: MOVABLES.PARABOLA,\n\n getCoefficients: function (coords: Coords): ReadonlyArray<number> {\n const p1 = coords[0];\n const p2 = coords[1];\n\n // Parabola with vertex (h, k) has form: y = a * (h - k)^2 + k\n const h = p1[0];\n const k = p1[1];\n\n // Use these to calculate familiar a, b, c\n const a = (p2[1] - k) / ((p2[0] - h) * (p2[0] - h));\n const b = -2 * h * a;\n const c = a * h * h + k;\n\n return [a, b, c];\n },\n\n getFunctionForCoeffs: function (\n coeffs: ReadonlyArray<number>,\n x: number,\n ): number {\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n return (a * x + b) * x + c;\n },\n\n getPropsForCoeffs: function (coeffs: ReadonlyArray<number>): {\n a: number;\n b: number;\n c: number;\n } {\n return {\n a: coeffs[0],\n b: coeffs[1],\n c: coeffs[2],\n };\n },\n\n getEquationString: function (coords: Coords) {\n const coeffs = this.getCoefficients(coords);\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n return (\n \"y = \" +\n a.toFixed(3) +\n \"x^2 + \" +\n b.toFixed(3) +\n \"x + \" +\n c.toFixed(3)\n );\n },\n});\n\nconst Sinusoid: SinusoidType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/3d68e7718498475f53b206c2ab285626baf8857e.png\",\n\n defaultCoords: [\n [0.5, 0.5],\n [0.6, 0.6],\n ],\n movable: MOVABLES.SINUSOID,\n\n getCoefficients: function (coords: Coords) {\n const p1 = coords[0];\n const p2 = coords[1];\n\n const a = p2[1] - p1[1];\n const b = Math.PI / (2 * (p2[0] - p1[0]));\n const c = p1[0] * b;\n const d = p1[1];\n\n return [a, b, c, d];\n },\n\n getFunctionForCoeffs: function (coeffs: ReadonlyArray<number>, x: number) {\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n const d = coeffs[3];\n return a * Math.sin(b * x - c) + d;\n },\n\n getPropsForCoeffs: function (coeffs: ReadonlyArray<number>) {\n return {\n a: coeffs[0],\n b: coeffs[1],\n c: coeffs[2],\n d: coeffs[3],\n };\n },\n\n getEquationString: function (coords: Coords) {\n const coeffs = this.getCoefficients(coords);\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n const d = coeffs[3];\n return (\n \"y = \" +\n a.toFixed(3) +\n \" sin(\" +\n b.toFixed(3) +\n \"x - \" +\n c.toFixed(3) +\n \") + \" +\n d.toFixed(3)\n );\n },\n\n areEqual: function (\n coeffs1: ReadonlyArray<number>,\n coeffs2: ReadonlyArray<number>,\n ) {\n return approximateDeepEqual(\n canonicalSineCoefficients(coeffs1),\n canonicalSineCoefficients(coeffs2),\n );\n },\n});\n\nconst Tangent: TangentType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/7db80d23c35214f98659fe1cf0765811c1bbfbba.png\",\n\n defaultCoords: [\n [0.5, 0.5],\n [0.75, 0.75],\n ],\n\n getCoefficients: function (coords: Coords) {\n const p1 = coords[0];\n const p2 = coords[1];\n\n const a = p2[1] - p1[1];\n const b = Math.PI / (4 * (p2[0] - p1[0]));\n const c = p1[0] * b;\n const d = p1[1];\n\n return [a, b, c, d];\n },\n\n getFunctionForCoeffs: function (coeffs: ReadonlyArray<number>, x: number) {\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n const d = coeffs[3];\n return a * Math.tan(b * x - c) + d;\n },\n\n getEquationString: function (coords: Coords) {\n const coeffs = this.getCoefficients(coords);\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n const d = coeffs[3];\n return (\n \"y = \" +\n a.toFixed(3) +\n \" sin(\" +\n b.toFixed(3) +\n \"x - \" +\n c.toFixed(3) +\n \") + \" +\n d.toFixed(3)\n );\n },\n\n areEqual: function (\n coeffs1: ReadonlyArray<number>,\n coeffs2: ReadonlyArray<number>,\n ) {\n return approximateDeepEqual(\n canonicalTangentCoefficients(coeffs1),\n canonicalTangentCoefficients(coeffs2),\n );\n },\n});\n\nconst Exponential: ExponentialType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/9cbfad55525e3ce755a31a631b074670a5dad611.png\",\n\n defaultCoords: [\n [0.5, 0.55],\n [0.75, 0.75],\n ],\n\n defaultAsymptote: [\n [0, 0.5],\n [1.0, 0.5],\n ],\n\n /**\n * Add extra constraints for movement of the points or asymptote (below):\n * newCoord: [x, y]\n * The end position of the point or asymptote endpoint\n * oldCoord: [x, y]\n * The old position of the point or asymptote endpoint\n * coords:\n * An array of coordinates representing the proposed end configuration\n * of the plot coordinates.\n * asymptote:\n * An array of coordinates representing the proposed end configuration\n * of the asymptote.\n *\n * Return: either a coordinate (to be used as the resulting coordinate of\n * the move) or a boolean, where `true` uses newCoord as the resulting\n * coordinate, and `false` uses oldCoord as the resulting coordinate.\n */\n extraCoordConstraint: function (\n newCoord: Coord,\n oldCoord: Coord,\n coords: Coords,\n asymptote: Coords,\n graph,\n ) {\n const y: number = asymptote[0][1];\n return _.all(coords, (coord) => coord[1] !== y);\n },\n\n extraAsymptoteConstraint: function (\n newCoord: Coord,\n oldCoord: Coord,\n coords: Coords,\n asymptote: Coords,\n graph,\n ): Coord {\n const y = newCoord[1];\n const isValid =\n _.all(coords, (coord) => coord[1] > y) ||\n _.all(coords, (coord) => coord[1] < y);\n\n if (isValid) {\n return [oldCoord[0], y];\n }\n // Snap the asymptote as close as possible, i.e., if the user moves\n // the mouse really quickly into an invalid region\n const oldY = oldCoord[1];\n const wasBelow = _.all(coords, (coord) => coord[1] > oldY);\n if (wasBelow) {\n const bottomMost = _.min(_.map(coords, (coord) => coord[1]));\n return [oldCoord[0], bottomMost - graph.snapStep[1]];\n }\n const topMost = _.max(_.map(coords, (coord) => coord[1]));\n return [oldCoord[0], topMost + graph.snapStep[1]];\n },\n\n allowReflectOverAsymptote: true,\n\n getCoefficients: function (\n coords: Coords,\n asymptote: Coords,\n ): ReadonlyArray<number> {\n const p1 = coords[0];\n const p2 = coords[1];\n\n const c = asymptote[0][1];\n const b = Math.log((p1[1] - c) / (p2[1] - c)) / (p1[0] - p2[0]);\n const a = (p1[1] - c) / Math.exp(b * p1[0]);\n return [a, b, c];\n },\n\n getFunctionForCoeffs: function (\n coeffs: ReadonlyArray<number>,\n x: number,\n ): number {\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n return a * Math.exp(b * x) + c;\n },\n\n getEquationString: function (coords: Coords, asymptote: Coords) {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!asymptote) {\n return null;\n }\n const coeffs = this.getCoefficients(coords, asymptote);\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n return (\n \"y = \" +\n a.toFixed(3) +\n \"e^(\" +\n b.toFixed(3) +\n \"x) + \" +\n c.toFixed(3)\n );\n },\n});\n\nconst Logarithm: LogarithmType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/f6491e99d34af34d924bfe0231728ad912068dc3.png\",\n\n defaultCoords: [\n [0.55, 0.5],\n [0.75, 0.75],\n ],\n\n defaultAsymptote: [\n [0.5, 0],\n [0.5, 1.0],\n ],\n\n extraCoordConstraint: function (\n newCoord: Coord,\n oldCoord: Coord,\n coords: Coord,\n asymptote: Coords,\n graph,\n ) {\n const x = asymptote[0][0];\n return (\n _.all(coords, (coord) => coord[0] !== x) &&\n coords[0][1] !== coords[1][1]\n );\n },\n\n extraAsymptoteConstraint: function (\n newCoord: Coord,\n oldCoord: Coord,\n coords: Coords,\n asymptote: Coords,\n graph,\n ): ReadonlyArray<number> {\n const x = newCoord[0];\n const isValid =\n _.all(coords, (coord) => coord[0] > x) ||\n _.all(coords, (coord) => coord[0] < x);\n\n if (isValid) {\n return [x, oldCoord[1]];\n }\n // Snap the asymptote as close as possible, i.e., if the user moves\n // the mouse really quickly into an invalid region\n const oldX = oldCoord[0];\n const wasLeft = _.all(coords, (coord) => coord[0] > oldX);\n if (wasLeft) {\n const leftMost = _.min(_.map(coords, (coord) => coord[0]));\n return [leftMost - graph.snapStep[0], oldCoord[1]];\n }\n const rightMost = _.max(_.map(coords, (coord) => coord[0]));\n return [rightMost + graph.snapStep[0], oldCoord[1]];\n },\n\n allowReflectOverAsymptote: true,\n\n getCoefficients: function (\n coords: Coords,\n asymptote: Coords,\n ): ReadonlyArray<number> | undefined {\n // It's easiest to calculate the logarithm's coefficients by thinking\n // about it as the inverse of the exponential, so we flip x and y and\n // perform some algebra on the coefficients. This also unifies the\n // logic between the two 'models'.\n const flip = (coord: Coord): Coord => [coord[1], coord[0]];\n const inverseCoeffs = Exponential.getCoefficients(\n _.map(coords, flip) as Coords,\n _.map(asymptote, flip) as Coords,\n );\n if (inverseCoeffs) {\n const c = -inverseCoeffs[2] / inverseCoeffs[0];\n const b = 1 / inverseCoeffs[0];\n const a = 1 / inverseCoeffs[1];\n return [a, b, c];\n }\n },\n\n getFunctionForCoeffs: function (\n coeffs: ReadonlyArray<number>,\n x: number,\n asymptote: Coords,\n ) {\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n return a * Math.log(b * x + c);\n },\n\n getEquationString: function (coords: Coords, asymptote: Coords) {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!asymptote) {\n return null;\n }\n const coeffs: ReadonlyArray<number> = this.getCoefficients(\n coords,\n asymptote,\n );\n const a = coeffs[0];\n const b = coeffs[1];\n const c = coeffs[2];\n return (\n \"y = ln(\" +\n a.toFixed(3) +\n \"x + \" +\n b.toFixed(3) +\n \") + \" +\n c.toFixed(3)\n );\n },\n});\n\nconst AbsoluteValue: AbsoluteValueType = _.extend({}, PlotDefaults, {\n url: \"https://ka-perseus-graphie.s3.amazonaws.com/8256a630175a0cb1d11de223d6de0266daf98721.png\",\n\n defaultCoords: [\n [0.5, 0.5],\n [0.75, 0.75],\n ],\n\n getCoefficients: function (\n coords: Coords,\n ): ReadonlyArray<number> | undefined {\n const p1 = coords[0];\n const p2 = coords[1];\n\n const denom = p2[0] - p1[0];\n const num = p2[1] - p1[1];\n\n if (denom === 0) {\n return;\n }\n\n let m = Math.abs(num / denom);\n if (p2[1] < p1[1]) {\n m *= -1;\n }\n const horizontalOffset = p1[0];\n const verticalOffset = p1[1];\n\n return [m, horizontalOffset, verticalOffset];\n },\n\n getFunctionForCoeffs: function (coeffs: ReadonlyArray<number>, x: number) {\n const m = coeffs[0];\n const horizontalOffset = coeffs[1];\n const verticalOffset = coeffs[2];\n return m * Math.abs(x - horizontalOffset) + verticalOffset;\n },\n\n getEquationString: function (coords: Coords) {\n const coeffs: ReadonlyArray<number> = this.getCoefficients(coords);\n const m = coeffs[0];\n const horizontalOffset = coeffs[1];\n const verticalOffset = coeffs[2];\n return (\n \"y = \" +\n m.toFixed(3) +\n \"| x - \" +\n horizontalOffset.toFixed(3) +\n \"| + \" +\n verticalOffset.toFixed(3)\n );\n },\n});\n\n/* Utility functions for dealing with graphing interfaces. */\nconst functionTypeMapping = {\n linear: Linear,\n quadratic: Quadratic,\n sinusoid: Sinusoid,\n tangent: Tangent,\n exponential: Exponential,\n logarithm: Logarithm,\n absolute_value: AbsoluteValue,\n} as const;\n\nexport const allTypes: any = _.keys(functionTypeMapping);\n\nexport type FunctionTypeMappingKeys = keyof typeof functionTypeMapping;\n\ntype ConditionalGraderType<T extends FunctionTypeMappingKeys> =\n // prettier-ignore\n T extends \"linear\" ? LinearType\n : T extends \"quadratic\" ? QuadraticType\n : T extends \"sinusoid\" ? SinusoidType\n : T extends \"tangent\" ? TangentType\n : T extends \"exponential\" ? ExponentialType\n : T extends \"logarithm\" ? LogarithmType\n : T extends \"absolute_value\" ? AbsoluteValueType\n : never;\n\nexport function functionForType<T extends FunctionTypeMappingKeys>(\n type: T,\n): ConditionalGraderType<T> {\n // @ts-expect-error: TypeScript doesn't know how to use deal with generics\n // and conditional types in this way.\n return functionTypeMapping[type];\n}\n","import _ from \"underscore\";\n\nimport deepClone from \"./deep-clone\";\n\nimport type {PerseusItem, PerseusRenderer} from \"../data-schema\";\n\nconst blankPerseusRenderer: PerseusRenderer = {\n content: \"\",\n images: {},\n widgets: {},\n} as const;\n\nexport function generateTestPerseusRenderer(\n customFields: Partial<PerseusRenderer> = {},\n): PerseusRenderer {\n return deepClone({...blankPerseusRenderer, ...customFields});\n}\n\nconst blankPerseusItemData: PerseusItem = {\n question: generateTestPerseusRenderer(),\n answerArea: {\n calculator: false,\n periodicTable: false,\n financialCalculatorMonthlyPayment: false,\n financialCalculatorTotalAmount: false,\n financialCalculatorTimeToPayOff: false,\n periodicTableWithKey: false,\n },\n hints: [],\n} as const;\n\n/**\n * Generate a Perseus item object for testing purposes.\n *\n * In order to better type Perseus objects used in testing, this function\n * uses a basic Perseus object and updates it with custom values as needed.\n *\n * @param {Partial<PerseusItem>} customFields\n * @returns {PerseusItem}\n */\nexport function generateTestPerseusItem(\n customFields: Partial<PerseusItem> = {},\n): PerseusItem {\n return deepClone({...blankPerseusItemData, ...customFields});\n}\n","import type {\n LabelImageWidget,\n PerseusItem,\n PerseusWidget,\n PerseusWidgetsMap,\n RadioWidget,\n} from \"../data-schema\";\n\n/**\n * Returns true if a Perseus item contains any widget with rationales.\n */\nexport const itemHasRationales = (item: PerseusItem) =>\n widgetsHaveRationales(item.question.widgets);\n\nconst widgetsHaveRationales = (widgets: PerseusWidgetsMap) =>\n Object.values(widgets).some(widgetHasRationales);\n\nconst widgetHasRationales = (widget: PerseusWidget): boolean => {\n switch (widget.type) {\n case \"radio\":\n return radioWidgetHasRationales(widget);\n case \"label-image\":\n return labelImageWidgetHasRationales(widget);\n case \"graded-group\":\n case \"group\":\n return widgetsHaveRationales(widget.options.widgets);\n default:\n return false;\n }\n};\n\nconst radioWidgetHasRationales = (widget: RadioWidget): boolean => {\n return widget.options.choices.some((choice) => !!choice.rationale);\n};\n\nconst labelImageWidgetHasRationales = (widget: LabelImageWidget): boolean => {\n return widget.options.markers.some((marker) => marker.answers.length > 0);\n};\n","import type {PerseusItem} from \"../data-schema\";\n\n/**\n * Returns true if the item has hints\n */\nexport const itemHasHints = (item: PerseusItem): boolean => {\n return item.hints.length > 0;\n};\n","import {approximateDeepEqual} from \"./equality\";\n\nexport function isRealJSONParse(jsonParse: typeof JSON.parse): boolean {\n const randomPhrase = buildRandomPhrase();\n const randomHintPhrase = buildRandomPhrase();\n const randomString = buildRandomString();\n const testingObject = JSON.stringify({\n answerArea: {\n calculator: false,\n financialCalculatorMonthlyPayment: false,\n financialCalculatorTimeToPayOff: false,\n financialCalculatorTotalAmount: false,\n periodicTable: false,\n periodicTableWithKey: false,\n },\n hints: [randomHintPhrase, `=${Math.floor(Math.random() * 50) + 1}`],\n question: {\n content: `${randomPhrase}`,\n images: {},\n widgets: {\n expression1: {\n alignment: \"default\",\n graded: false,\n options: {\n answerForms: [\n {\n considered: \"wrong\",\n form: false,\n key: 0,\n simplify: false,\n value: `${randomString}`,\n },\n ],\n ariaLabel: \"Answer\",\n buttonSets: [\"basic\"],\n functions: [\"f\", \"g\", \"h\"],\n static: true,\n times: false,\n visibleLabel: \"Answer\",\n },\n static: true,\n type: \"expression\",\n version: {major: 1, minor: 0},\n },\n },\n },\n });\n const testJSON = buildTestData(testingObject.replace(/\"/g, '\\\\\"'));\n const parsedTestJSON = jsonParse(testJSON);\n const parsedTestItemData: string =\n parsedTestJSON.data.assessmentItem.item.itemData;\n return approximateDeepEqual(parsedTestItemData, testingObject);\n}\n\nfunction buildRandomString(capitalize: boolean = false) {\n let randomString: string = \"\";\n const randomLength = Math.floor(Math.random() * 8) + 3;\n for (let i = 0; i < randomLength; i++) {\n const randomLetter = String.fromCharCode(\n 97 + Math.floor(Math.random() * 26),\n );\n randomString +=\n capitalize && i === 0 ? randomLetter.toUpperCase() : randomLetter;\n }\n return randomString;\n}\n\nfunction buildRandomPhrase() {\n const phrases: string[] = [];\n const randomLength = Math.floor(Math.random() * 10) + 5;\n for (let i = 0; i < randomLength; i++) {\n phrases.push(buildRandomString(i === 0));\n }\n const modifierStart = [\"**\", \"$\"];\n const modifierEnd = [\"**\", \"$\"];\n const modifierIndex = Math.floor(Math.random() * modifierStart.length);\n return `${modifierStart[modifierIndex]}${phrases.join(\" \")}${modifierEnd[modifierIndex]}`;\n}\n\nfunction buildTestData(testObject: string) {\n return `{\"data\":{\"assessmentItem\":{\"__typename\":\"AssessmentItemOrError\",\"error\":null,\"item\":{\"__typename\":\"AssessmentItem\",\"id\":\"x890b3c70f3e8f4a6\",\"itemData\":\"${testObject}\",\"problemType\":\"Type 1\",\"sha\":\"c7284a3ad65214b4e62bccce236d92f7f5d35941\"}}}}`;\n}\n","import invariant from \"tiny-invariant\";\n\nexport type Result<S, F> = Success<S> | Failure<F>;\n\nexport type Success<T> = {type: \"success\"; value: T};\nexport type Failure<T> = {type: \"failure\"; detail: T};\n\nexport function success<T>(value: T): Success<T> {\n return {type: \"success\", value};\n}\n\nexport function failure<T>(detail: T): Failure<T> {\n return {type: \"failure\", detail};\n}\n\nexport function isFailure<S, F>(result: Result<S, F>): result is Failure<F> {\n return result.type === \"failure\";\n}\n\nexport function isSuccess<S, F>(result: Result<S, F>): result is Success<S> {\n return result.type === \"success\";\n}\n\nexport function assertFailure<S, F>(\n result: Result<S, F>,\n): asserts result is Failure<F> {\n invariant(\n isFailure(result),\n \"expected result to be a Failure, but got a Success\",\n );\n}\n\nexport function assertSuccess<S, F>(\n result: Result<S, F>,\n): asserts result is Success<S> {\n invariant(\n isSuccess(result),\n \"expected result to be a Success, but got a Failure\",\n );\n}\n\n/**\n * @returns a function that transforms the `detail` value of any Failure result\n * passed to it, and leaves Success results unchanged. `mapFailure` is curried\n * for easy composition with Array.map(), mu-lambda's pipe(), etc.\n * @param f the function to apply to Failure `detail`s.\n */\nexport function mapFailure<S, DetailIn, DetailOut>(\n f: (detail: DetailIn) => DetailOut,\n): (result: Result<S, DetailIn>) => Result<S, DetailOut> {\n return (result) => {\n if (isFailure(result)) {\n return failure(f(result.detail));\n }\n return result;\n };\n}\n\n// Result's `all` function is similar to Promise.all: given an array of\n// results, it returns success if all succeeded, and failure if any failed.\nexport function all<S, F>(\n results: Array<Result<S, F>>,\n combineFailureDetails: (a: F, b: F) => F = (a) => a,\n): Result<S[], F> {\n const values: S[] = [];\n const failureDetails: F[] = [];\n for (const result of results) {\n if (result.type === \"success\") {\n values.push(result.value);\n } else {\n failureDetails.push(result.detail);\n }\n }\n\n if (failureDetails.length > 0) {\n return failure(failureDetails.reduce(combineFailureDetails));\n }\n return success(values);\n}\n","import {failure, success} from \"./result\";\n\nimport type {ParseContext, Mismatch, PathSegment} from \"./parser-types\";\nimport type {Failure, Success} from \"./result\";\n\nexport class ErrorTrackingParseContext implements ParseContext {\n constructor(private readonly path: PathSegment[]) {}\n\n failure(\n expected: string | string[],\n badValue: unknown,\n ): Failure<Mismatch[]> {\n return failure([\n {\n expected: wrapInArray(expected),\n badValue,\n path: this.path,\n },\n ]);\n }\n\n forSubtree(key: PathSegment): ParseContext {\n return new ErrorTrackingParseContext([...this.path, key]);\n }\n\n success<T>(value: T): Success<T> {\n return success(value);\n }\n}\n\nfunction wrapInArray(a: string | string[]): string[] {\n return Array.isArray(a) ? a : [a];\n}\n","import type {PathSegment} from \"./parser-types\";\n\nexport function formatPath(path: PathSegment[]): string {\n return \"(root)\" + path.map(formatPathSegment).join(\"\");\n}\n\nfunction formatPathSegment(segment: PathSegment): string {\n if (typeof segment === \"string\") {\n return validIdentifier.test(segment)\n ? \".\" + segment\n : `[${JSON.stringify(segment)}]`;\n }\n return `[${segment.toString()}]`;\n}\n\nconst validIdentifier = /^[A-Za-z$_][A-Za-z$_0-9]*$/;\n","import {formatPath} from \"./object-path\";\n\nimport type {Mismatch} from \"./parser-types\";\n\nexport function message(failure: Mismatch): string {\n const expected = conjoin(failure.expected);\n const path = formatPath(failure.path);\n const badValue = JSON.stringify(failure.badValue);\n return `At ${path} -- expected ${expected}, but got ${badValue}`;\n}\n\nfunction conjoin(items: string[]): string {\n switch (items.length) {\n // FUTURE(benchristel): handle 0 if this is reused elsewhere.\n case 1:\n return items[0];\n case 2:\n return items.join(\" or \");\n default: {\n const allButLast = items.slice(0, items.length - 1);\n const last = items[items.length - 1];\n return allButLast.join(\", \") + \", or \" + last;\n }\n }\n}\n","import {ErrorTrackingParseContext} from \"./error-tracking-parse-context\";\nimport {message} from \"./parse-failure-detail\";\nimport {failure, isFailure} from \"./result\";\n\nimport type {Parser} from \"./parser-types\";\nimport type {Result} from \"./result\";\n\nexport function parse<T>(value: unknown, parser: Parser<T>): Result<T, string> {\n const result = parser(value, new ErrorTrackingParseContext([]));\n if (isFailure(result)) {\n return failure(result.detail.map(message).join(\"; \"));\n }\n return result;\n}\n","import type {Parser} from \"../parser-types\";\n\nexport const any: Parser<any> = (rawValue, ctx) => ctx.success(rawValue);\n","import * as Result from \"../result\";\n\nimport type {ParseContext, Parser} from \"../parser-types\";\n\nexport function array<T>(elementParser: Parser<T>): Parser<T[]> {\n return (rawValue: unknown, ctx: ParseContext) => {\n if (!Array.isArray(rawValue)) {\n return ctx.failure(\"array\", rawValue);\n }\n const elementResults = rawValue.map((elem, i) =>\n elementParser(elem, ctx.forSubtree(i)),\n );\n return Result.all(elementResults, concat);\n };\n}\n\n/**\n * Like the standard `array` parser, but passes the array index to a parser factory function.\n * This allows element parsers to generate index-based default values.\n */\nexport function arrayWithIndex<T>(\n elementParserFactory: (index: number) => Parser<T>,\n): Parser<T[]> {\n return (rawValue: unknown, ctx: ParseContext) => {\n if (!Array.isArray(rawValue)) {\n return ctx.failure(\"array\", rawValue);\n }\n\n const elementResults = rawValue.map((elem, index) => {\n const elementParser = elementParserFactory(index);\n return elementParser(elem, ctx.forSubtree(index));\n });\n\n return Result.all(elementResults, concat);\n };\n}\n\nfunction concat<T>(a: T[], b: T[]): T[] {\n return [...a, ...b];\n}\n","import type {ParseContext, ParseResult} from \"../parser-types\";\n\nexport function boolean(\n rawValue: unknown,\n ctx: ParseContext,\n): ParseResult<boolean> {\n if (typeof rawValue === \"boolean\") {\n return ctx.success(rawValue);\n }\n return ctx.failure(\"boolean\", rawValue);\n}\n","import type {Parser} from \"../parser-types\";\n\ntype Primitive = string | number | boolean | null | undefined;\n\nexport function constant<T extends Primitive>(acceptedValue: T): Parser<T> {\n return (rawValue, ctx) => {\n if (rawValue !== acceptedValue) {\n return ctx.failure(String(JSON.stringify(acceptedValue)), rawValue);\n }\n return ctx.success(acceptedValue);\n };\n}\n","import {success} from \"../result\";\n\nimport type {Parser} from \"../parser-types\";\n\nexport function defaulted<T>(\n parser: Parser<T>,\n fallback: (missingValue: null | undefined) => NoInfer<T>,\n): Parser<T> {\n return (rawValue, ctx) => {\n if (rawValue == null) {\n return success(fallback(rawValue));\n }\n return parser(rawValue, ctx);\n };\n}\n\n/**\n * Similar to defaulted, but specifically handles empty strings as invalid.\n *\n * @param fallback Function that generates a fallback value for empty/missing strings\n * @returns Parser that validates non-empty strings or uses fallback\n */\nexport function defaultedNonEmptyString(\n fallback: () => string,\n): Parser<string> {\n return (rawValue, ctx) => {\n // Handle missing/null values - use fallback\n if (rawValue == null) {\n return ctx.success(fallback());\n }\n\n // Handle string values\n if (typeof rawValue === \"string\") {\n // If empty or whitespace-only, use fallback\n if (rawValue.trim() === \"\") {\n return ctx.success(fallback());\n }\n // Valid non-empty string, use as-is\n return ctx.success(rawValue);\n }\n\n // Invalid type, expect string\n return ctx.failure(\"string\", rawValue);\n };\n}\n","import type {Parser} from \"../parser-types\";\n\nexport function enumeration<T extends readonly string[]>(\n ...acceptedValues: T\n): Parser<T[number]> {\n return (rawValue, ctx) => {\n if (typeof rawValue === \"string\") {\n const index = acceptedValues.indexOf(rawValue);\n if (index > -1) {\n return ctx.success(acceptedValues[index]);\n }\n }\n const expected = acceptedValues.map((v) => JSON.stringify(v));\n return ctx.failure(expected, rawValue);\n };\n}\n","// See the tests for an explanation of why we need this.\nconst objectConstructorString = Object.prototype.constructor.toString();\n\nconst functionToString = Function.prototype.toString;\n\n/**\n * Checks whether a value is a plain JS object (e.g. one constructed with `{}`\n * literal syntax or `Object.create(null)`. Returns true given a plain object\n * from another realm.\n *\n * @param x - the value to check for objectiness\n */\nexport function isPlainObject(x: unknown): x is Record<keyof any, unknown> {\n if (x == null) {\n return false;\n }\n const prototype = Object.getPrototypeOf(x);\n if (prototype == null) {\n return true;\n }\n return (\n typeof prototype.constructor === \"function\" &&\n functionToString.call(prototype.constructor) === objectConstructorString\n );\n}\n","import type {Parser} from \"../parser-types\";\n\nexport function nullable<T>(parseValue: Parser<T>): Parser<T | null> {\n return (rawValue, ctx) => {\n if (rawValue === null) {\n return ctx.success(rawValue);\n }\n return parseValue(rawValue, ctx);\n };\n}\n","import type {Parser} from \"../parser-types\";\n\nexport const number: Parser<number> = (rawValue, ctx) => {\n if (typeof rawValue === \"number\") {\n return ctx.success(rawValue);\n }\n return ctx.failure(\"number\", rawValue);\n};\n","import {failure, isSuccess} from \"../result\";\n\nimport {isPlainObject} from \"./is-plain-object\";\n\nimport type {OptionalizeProperties} from \"./object-types\";\nimport type {Mismatch, ParsedValue, Parser} from \"../parser-types\";\n\ntype ObjectSchema = Record<keyof any, Parser<any>>;\n\nexport function objectWithAllPropertiesRequired<S extends ObjectSchema>(\n schema: S,\n): Parser<{[K in keyof S]: ParsedValue<S[K]>}> {\n return object(schema) as any;\n}\n\nexport function object<S extends ObjectSchema>(\n schema: S,\n): Parser<OptionalizeProperties<{[K in keyof S]: ParsedValue<S[K]>}>> {\n return (rawValue, ctx) => {\n if (!isPlainObject(rawValue)) {\n return ctx.failure(\"object\", rawValue);\n }\n\n const ret: any = {...rawValue};\n const mismatches: Mismatch[] = [];\n for (const [prop, propParser] of Object.entries(schema)) {\n const result = propParser(rawValue[prop], ctx.forSubtree(prop));\n if (isSuccess(result)) {\n if (result.value !== undefined || prop in rawValue) {\n ret[prop] = result.value;\n }\n } else {\n mismatches.push(...result.detail);\n }\n }\n\n if (mismatches.length > 0) {\n return failure(mismatches);\n }\n return ctx.success(ret);\n };\n}\n","import type {Parser} from \"../parser-types\";\n\nexport function optional<T>(parseValue: Parser<T>): Parser<T | undefined> {\n return (rawValue, ctx) => {\n if (rawValue === undefined) {\n return ctx.success(rawValue);\n }\n return parseValue(rawValue, ctx);\n };\n}\n","import {isFailure} from \"../result\";\n\nimport type {Parser} from \"../parser-types\";\n\nexport function pair<A, B>(\n parseA: Parser<A>,\n parseB: Parser<B>,\n): Parser<[A, B]> {\n return (rawValue, ctx) => {\n if (!Array.isArray(rawValue)) {\n return ctx.failure(\"array\", rawValue);\n }\n if (rawValue.length !== 2) {\n return ctx.failure(\"array of length 2\", rawValue);\n }\n const [rawA, rawB] = rawValue;\n const resultA = parseA(rawA, ctx.forSubtree(0));\n if (isFailure(resultA)) {\n return resultA;\n }\n const resultB = parseB(rawB, ctx.forSubtree(1));\n if (isFailure(resultB)) {\n return resultB;\n }\n\n return ctx.success([resultA.value, resultB.value]);\n };\n}\n","import {isFailure} from \"../result\";\n\nimport type {\n ParseContext,\n ParsedValue,\n Parser,\n PartialParser,\n} from \"../parser-types\";\n\nexport function pipeParsers<T>(p: Parser<T>): ParserPipeline<T> {\n return new ParserPipeline(p);\n}\n\nexport class ParserPipeline<T> {\n constructor(public readonly parser: Parser<T>) {}\n\n then<U>(nextParser: PartialParser<T, U>): ParserPipeline<U> {\n return new ParserPipeline<U>(composeParsers(this.parser, nextParser));\n }\n}\n\nfunction composeParsers<\n A extends Parser<any>,\n B extends PartialParser<ParsedValue<A>, any>,\n>(parserA: A, parserB: B): Parser<ParsedValue<B>> {\n return (rawValue: unknown, ctx: ParseContext) => {\n const partialResult = parserA(rawValue, ctx);\n if (isFailure(partialResult)) {\n return partialResult;\n }\n\n return parserB(partialResult.value, ctx);\n };\n}\n","import {failure, isFailure, isSuccess} from \"../result\";\n\nimport {isPlainObject} from \"./is-plain-object\";\n\nimport type {Mismatch, Parser} from \"../parser-types\";\n\nexport function record<K extends string, V>(\n parseKey: Parser<K>,\n parseValue: Parser<V>,\n): Parser<Record<K, V>> {\n return (rawValue, ctx) => {\n if (!isPlainObject(rawValue)) {\n return ctx.failure(\"object\", rawValue);\n }\n\n const result = {} as Record<K, V>;\n const mismatches: Mismatch[] = [];\n for (const [key, value] of Object.entries(rawValue)) {\n const entryCtx = ctx.forSubtree(key);\n const keyResult = parseKey(key, entryCtx);\n if (isFailure(keyResult)) {\n mismatches.push(...keyResult.detail);\n }\n\n const valueResult = parseValue(value, entryCtx);\n if (isFailure(valueResult)) {\n mismatches.push(...valueResult.detail);\n }\n\n if (isSuccess(keyResult) && isSuccess(valueResult)) {\n result[keyResult.value] = valueResult.value;\n }\n }\n\n if (mismatches.length > 0) {\n return failure(mismatches);\n }\n return ctx.success(result);\n };\n}\n","import type {Parser} from \"../parser-types\";\n\nexport const string: Parser<string> = (rawValue, ctx) => {\n if (typeof rawValue === \"string\") {\n return ctx.success(rawValue);\n }\n return ctx.failure(\"string\", rawValue);\n};\n","import {isFailure} from \"../result\";\n\nimport type {Parser} from \"../parser-types\";\n\nexport function trio<A, B, C>(\n parseA: Parser<A>,\n parseB: Parser<B>,\n parseC: Parser<C>,\n): Parser<[A, B, C]> {\n return (rawValue, ctx) => {\n if (!Array.isArray(rawValue)) {\n return ctx.failure(\"array\", rawValue);\n }\n if (rawValue.length !== 3) {\n return ctx.failure(\"array of length 3\", rawValue);\n }\n\n const resultA = parseA(rawValue[0], ctx.forSubtree(0));\n if (isFailure(resultA)) {\n return resultA;\n }\n\n const resultB = parseB(rawValue[1], ctx.forSubtree(1));\n if (isFailure(resultB)) {\n return resultB;\n }\n\n const resultC = parseC(rawValue[2], ctx.forSubtree(2));\n if (isFailure(resultC)) {\n return resultC;\n }\n\n return ctx.success([resultA.value, resultB.value, resultC.value]);\n };\n}\n","import {isSuccess} from \"../result\";\n\nimport type {Parser} from \"../parser-types\";\n\nexport function union<T>(parseBranch: Parser<T>): UnionBuilder<T> {\n return new UnionBuilder(parseBranch);\n}\n\nexport class UnionBuilder<T> {\n constructor(public parser: Parser<T>) {}\n\n or<New>(newBranch: Parser<New>) {\n return new UnionBuilder<T | New>(either(this.parser, newBranch));\n }\n}\n\nfunction either<A, B>(parseA: Parser<A>, parseB: Parser<B>): Parser<A | B> {\n return (rawValue, ctx) => {\n const resultA = parseA(rawValue, ctx);\n if (isSuccess(resultA)) {\n return resultA;\n }\n\n return parseB(rawValue, ctx);\n };\n}\n","import {number, object} from \"../general-purpose-parsers\";\n\nexport const parsePerseusImageDetail = object({\n width: number,\n height: number,\n});\n","import {record, string} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parsePerseusImageDetail} from \"./perseus-image-detail\";\n\nimport type {PerseusImageDetail} from \"../../data-schema\";\nimport type {Parser} from \"../parser-types\";\n\nexport const parseImages: Parser<{[key: string]: PerseusImageDetail}> =\n defaulted(record(string, parsePerseusImageDetail), () => ({}));\n","import {\n boolean,\n nullable,\n number,\n object,\n objectWithAllPropertiesRequired,\n optional,\n string,\n} from \"../general-purpose-parsers\";\n\nimport type {WidgetOptions} from \"../../data-schema\";\nimport type {Parser} from \"../parser-types\";\n\nexport function parseWidget<Type extends string, Options extends object>(\n parseType: Parser<Type>,\n parseOptions: Parser<Options>,\n): Parser<WidgetOptions<Type, Options>> {\n return objectWithAllPropertiesRequired({\n type: parseType,\n static: optional(boolean),\n graded: optional(boolean),\n alignment: optional(string),\n options: parseOptions,\n key: optional(nullable(number)),\n version: optional(\n object({\n major: number,\n minor: number,\n }),\n ),\n });\n}\n\nexport function parseWidgetWithVersion<\n Version extends {major: number; minor: number} | undefined,\n Type extends string,\n Options extends object,\n>(\n parseVersion: Parser<Version>,\n parseType: Parser<Type>,\n parseOptions: Parser<Options>,\n): Parser<WidgetOptions<Type, Options>> {\n return objectWithAllPropertiesRequired({\n type: parseType,\n static: optional(boolean),\n graded: optional(boolean),\n alignment: optional(string),\n options: parseOptions,\n key: optional(nullable(number)),\n version: parseVersion,\n });\n}\n","import {\n array,\n boolean,\n constant,\n number,\n object,\n optional,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseCategorizerWidget = parseWidget(\n constant(\"categorizer\"),\n object({\n items: array(string),\n categories: array(string),\n randomizeItems: defaulted(boolean, () => false),\n static: defaulted(boolean, () => false),\n values: defaulted(array(defaulted(number, () => 0)), () => []),\n highlightLint: optional(boolean),\n linterContext: optional(\n object({\n contentType: string,\n paths: array(string),\n stack: array(string),\n }),\n ),\n }),\n);\n","import {\n any,\n array,\n boolean,\n constant,\n number,\n object,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseCSProgramWidget = parseWidget(\n constant(\"cs-program\"),\n object({\n programID: string,\n programType: any,\n settings: array(object({name: string, value: string})),\n showEditor: boolean,\n showButtons: boolean,\n height: number,\n static: defaulted(boolean, () => false),\n }),\n);\n","import {boolean, constant, object, string} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseDefinitionWidget = parseWidget(\n constant(\"definition\"),\n object({\n togglePrompt: string,\n definition: string,\n static: defaulted(boolean, () => false),\n }),\n);\n","import {\n array,\n boolean,\n constant,\n object,\n string,\n optional,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseDropdownWidget = parseWidget(\n constant(\"dropdown\"),\n object({\n placeholder: defaulted(string, () => \"\"),\n ariaLabel: optional(string),\n visibleLabel: optional(string),\n static: defaulted(boolean, () => false),\n choices: array(\n object({\n content: string,\n correct: defaulted(boolean, () => false),\n }),\n ),\n }),\n);\n","import {boolean, constant, object, string} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\nimport {parseWidgetsMap} from \"./widgets-map\";\n\nexport const parseExplanationWidget = parseWidget(\n constant(\"explanation\"),\n object({\n showPrompt: string,\n hidePrompt: string,\n explanation: string,\n // We wrap parseWidgetsMap in a function here to make sure it is not\n // referenced before it is defined. There is an import cycle between\n // this file and widgets-map.ts that could cause it to be undefined.\n widgets: defaulted(\n (rawVal, ctx) => parseWidgetsMap(rawVal, ctx),\n () => ({}),\n ),\n static: defaulted(boolean, () => false),\n }),\n);\n","export const KeypadKeys = [\n \"PLUS\",\n \"MINUS\",\n \"NEGATIVE\",\n \"TIMES\",\n \"DIVIDE\",\n \"DECIMAL\",\n \"PERIOD\",\n \"PERCENT\",\n \"CDOT\",\n \"EQUAL\",\n \"NEQ\",\n \"GT\",\n \"LT\",\n \"GEQ\",\n \"LEQ\", // mobile native only\n \"FRAC_INCLUSIVE\", // mobile native only\n \"FRAC_EXCLUSIVE\", // mobile native only\n \"FRAC\",\n \"EXP\",\n \"EXP_2\",\n \"EXP_3\",\n \"SQRT\",\n \"CUBE_ROOT\",\n \"RADICAL\",\n \"LEFT_PAREN\",\n \"RIGHT_PAREN\",\n \"LN\",\n \"LOG\",\n \"LOG_N\",\n \"SIN\",\n \"COS\", // TODO(charlie): Add in additional Greek letters.,\n \"TAN\",\n \"PI\",\n \"THETA\",\n \"UP\",\n \"RIGHT\",\n \"DOWN\",\n \"LEFT\",\n \"BACKSPACE\",\n \"DISMISS\",\n \"JUMP_OUT_PARENTHESES\",\n \"JUMP_OUT_EXPONENT\",\n \"JUMP_OUT_BASE\",\n \"JUMP_INTO_NUMERATOR\",\n \"JUMP_OUT_NUMERATOR\",\n \"JUMP_OUT_DENOMINATOR\", // Multi-functional keys.\n \"NUM_0\",\n \"NUM_1\",\n \"NUM_2\",\n \"NUM_3\",\n \"NUM_4\",\n \"NUM_5\",\n \"NUM_6\",\n \"NUM_7\",\n \"NUM_8\",\n \"NUM_9\",\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\",\n] as const;\n\nexport type KeypadKey = (typeof KeypadKeys)[number];\n\nexport type KeypadType = \"FRACTION\" | \"EXPRESSION\";\n\nexport type KeypadConfiguration = {\n keypadType: KeypadType;\n extraKeys?: KeypadKey[];\n times?: boolean;\n scientific?: boolean;\n};\n\n// Used by KeypadContext to pass around a renderer reference\nexport interface KeypadContextRendererInterface {\n blur(): void;\n}\n","import * as KAS from \"@khanacademy/kas\";\n\nimport {\n type KeypadKey,\n type KeypadConfiguration,\n KeypadKeys,\n} from \"../../keypad\";\n\nimport type {PerseusExpressionWidgetOptions} from \"../../data-schema\";\n\n/**\n * Scrape the answer forms for any variables or contants (like Pi)\n * that need to be included as keys on the keypad.\n */\nfunction deriveExtraKeys(\n widgetOptions: PerseusExpressionWidgetOptions,\n): KeypadConfiguration[\"extraKeys\"] {\n if (widgetOptions.extraKeys) {\n return widgetOptions.extraKeys;\n }\n\n // If there are no extra symbols available, we include Pi anyway, so\n // that the \"extra symbols\" button doesn't appear empty.\n const defaultKeys: KeypadKey[] = [\"PI\"];\n\n if (widgetOptions.answerForms == null) {\n return defaultKeys;\n }\n\n // Extract any and all variables and constants from the answer forms.\n const uniqueExtraVariables: Partial<Record<KeypadKey, boolean>> = {};\n const uniqueExtraConstants: Partial<Record<KeypadKey, boolean>> = {};\n for (const answerForm of widgetOptions.answerForms) {\n const maybeExpr = KAS.parse(answerForm.value, widgetOptions);\n if (maybeExpr.parsed) {\n const expr = maybeExpr.expr;\n\n // The keypad expects Greek letters to be capitalized (e.g., it\n // requires `PI` instead of `pi`). Right now, it only supports Pi\n // and Theta, so we special-case.\n const isGreek = (symbol: any) =>\n symbol === \"pi\" || symbol === \"theta\";\n const toKey = (symbol: any) =>\n isGreek(symbol) ? symbol.toUpperCase() : symbol;\n const isKey = (key: string): key is KeypadKey =>\n KeypadKeys.includes(key as KeypadKey);\n\n for (const variable of expr.getVars()) {\n const maybeKey = toKey(variable);\n if (isKey(maybeKey)) {\n uniqueExtraVariables[maybeKey] = true;\n }\n }\n for (const constant of expr.getConsts()) {\n const maybeKey = toKey(constant);\n if (isKey(maybeKey)) {\n uniqueExtraConstants[maybeKey] = true;\n }\n }\n }\n }\n\n // TODO(charlie): Alert the keypad as to which of these symbols should be\n // treated as functions.\n const extraVariables = Object.keys(\n uniqueExtraVariables,\n ).sort() as ReadonlyArray<KeypadKey>;\n\n const extraConstants = Object.keys(\n uniqueExtraConstants,\n ).sort() as ReadonlyArray<KeypadKey>;\n\n const extraKeys = [...extraVariables, ...extraConstants];\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!extraKeys.length) {\n return defaultKeys;\n }\n\n return extraKeys;\n}\n\nexport default deriveExtraKeys;\n","import type {PartialParser} from \"../parser-types\";\n\n// Given a function, creates a PartialParser that converts one type to another\n// using that function. The returned parser never fails.\nexport function convert<A, B>(f: (value: A) => B): PartialParser<A, B> {\n return (rawValue, ctx) => ctx.success(f(rawValue));\n}\n","import {array, enumeration} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nconst parseLegacyButtonSet = enumeration(\n \"basic\",\n \"basic+div\",\n \"trig\",\n \"prealgebra\",\n \"logarithms\",\n \"basic relations\",\n \"advanced relations\",\n \"scientific\",\n);\n\nexport const parseLegacyButtonSets = defaulted(\n array(parseLegacyButtonSet),\n // NOTE(benchristel): I copied the default buttonSets from\n // expression.tsx. See the parse-perseus-json/README.md for\n // an explanation of why we want to duplicate the default here.\n () => [\n \"basic\" as const,\n \"trig\" as const,\n \"prealgebra\" as const,\n \"logarithms\" as const,\n ],\n);\n","import {\n isPlainObject,\n number,\n object,\n pipeParsers,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\nimport {isFailure} from \"../result\";\n\nimport type {Version} from \"../../data-schema\";\nimport type {ParseContext, Parser} from \"../parser-types\";\n\ntype Versioned = {\n version?: Version;\n};\n\n/**\n * Creates a parser for a widget options type with multiple major versions. Old\n * versions are migrated to the latest version. The parse fails if the input\n * data does not match any of the versions.\n *\n * @example\n * const parseOptions = versionedWidgetOptions(3, parseOptionsV3)\n * .withMigrationFrom(2, parseOptionsV2, migrateV2ToV3)\n * .withMigrationFrom(1, parseOptionsV1, migrateV1ToV2)\n * .withMigrationFrom(0, parseOptionsV0, migrateV0ToV1)\n * .parser;\n *\n * @param latestMajorVersion the latest major version of the widget options.\n * @param parseLatest a {@link Parser} for the latest version of the widget\n * options.\n * @returns a builder object, to which migrations from earlier versions can be\n * added. Migrations must be added in \"reverse chronological\" order as in the\n * example above.\n */\nexport function versionedWidgetOptions<Latest extends Versioned>(\n latestMajorVersion: number,\n parseLatest: Parser<Latest>,\n): VersionedWidgetOptionsParserBuilder<Latest, Latest> {\n return new VersionedWidgetOptionsParserBuilder(\n latestMajorVersion,\n parseLatest,\n (latest) => latest,\n (raw, ctx) =>\n ctx.failure(\"widget options with a known version number\", raw),\n );\n}\n\nclass VersionedWidgetOptionsParserBuilder<\n // The latest version of the widget options\n Latest extends Versioned,\n // A version of the widget options which we want to migrate to Latest.\n MigratableWidgetOptions extends Versioned,\n> {\n public parser: Parser<Latest>;\n\n constructor(\n majorVersion: number,\n parseThisVersion: Parser<MigratableWidgetOptions>,\n private migrateToLatest: (m: MigratableWidgetOptions) => Latest,\n private parseOtherVersions: Parser<Latest>,\n ) {\n const parseThisVersionAndMigrateToLatest = pipeParsers(\n parseThisVersion,\n ).then(convert(this.migrateToLatest)).parser;\n\n this.parser = (raw: unknown, ctx: ParseContext) => {\n if (!isPlainObject(raw)) {\n return ctx.failure(\"object\", raw);\n }\n\n const versionParseResult = parseVersionedObject(raw, ctx);\n if (isFailure(versionParseResult)) {\n return versionParseResult;\n }\n\n if (versionParseResult.value.version.major !== majorVersion) {\n return this.parseOtherVersions(raw, ctx);\n }\n\n return parseThisVersionAndMigrateToLatest(raw, ctx);\n };\n }\n\n /**\n * Add a migration from an old version of the widget options.\n */\n withMigrationFrom<Old extends Versioned>(\n majorVersion: number,\n parseOldVersion: Parser<Old>,\n migrateToNextVersion: (old: Old) => MigratableWidgetOptions,\n ): VersionedWidgetOptionsParserBuilder<Latest, Old> {\n const parseOtherVersions = this.parser;\n\n const migrateToLatest = (old: Old) =>\n this.migrateToLatest(migrateToNextVersion(old));\n\n return new VersionedWidgetOptionsParserBuilder(\n majorVersion,\n parseOldVersion,\n migrateToLatest,\n parseOtherVersions,\n );\n }\n}\n\nconst parseVersionedObject = object({\n version: defaulted(object({major: number, minor: number}), () => ({\n major: 0,\n minor: 0,\n })),\n});\n","import {KeypadKeys} from \"../../keypad\";\nimport deriveExtraKeys from \"../../widgets/expression/derive-extra-keys\";\nimport {\n array,\n boolean,\n constant,\n enumeration,\n number,\n object,\n optional,\n pipeParsers,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseLegacyButtonSets} from \"./legacy-button-sets\";\nimport {versionedWidgetOptions} from \"./versioned-widget-options\";\nimport {parseWidgetWithVersion} from \"./widget\";\n\nimport type {ParsedValue} from \"../parser-types\";\n\nconst stringOrNumberOrNullOrUndefined = union(string)\n .or(number)\n .or(constant(null))\n .or(constant(undefined)).parser;\n\nfunction numberOrNullToString(v: string | number | null | undefined) {\n return typeof v === \"number\" || v === null ? String(v) : v;\n}\n\nconst parsePossiblyInvalidAnswerForm = object({\n // `value` is the possibly invalid part of this. It should always be a\n // string, but some answer forms don't have it. The Expression widget\n // ignores invalid values, so we can safely filter them out during parsing.\n value: optional(string),\n form: defaulted(boolean, () => false),\n simplify: defaulted(boolean, () => false),\n considered: enumeration(\"correct\", \"wrong\", \"ungraded\"),\n key: pipeParsers(stringOrNumberOrNullOrUndefined).then(\n convert(numberOrNullToString),\n ).parser,\n});\n\nfunction removeInvalidAnswerForms(\n possiblyInvalid: Array<ParsedValue<typeof parsePossiblyInvalidAnswerForm>>,\n) {\n return possiblyInvalid.flatMap((answerForm) => {\n const {value} = answerForm;\n if (value != null) {\n return [{...answerForm, value}];\n }\n return [];\n });\n}\n\nconst parseAnswerForms = pipeParsers(\n defaulted(array(parsePossiblyInvalidAnswerForm), () => []),\n).then(convert(removeInvalidAnswerForms)).parser;\n\nconst version2 = object({major: constant(2), minor: number});\nconst parseExpressionWidgetV2 = parseWidgetWithVersion(\n version2,\n constant(\"expression\"),\n object({\n answerForms: parseAnswerForms,\n functions: array(string),\n times: boolean,\n visibleLabel: optional(string),\n ariaLabel: optional(string),\n buttonSets: parseLegacyButtonSets,\n buttonsVisible: optional(enumeration(\"always\", \"never\", \"focused\")),\n extraKeys: optional(array(enumeration(...KeypadKeys))),\n }),\n);\n\nconst version1 = object({major: constant(1), minor: number});\nconst parseExpressionWidgetV1 = parseWidgetWithVersion(\n version1,\n constant(\"expression\"),\n object({\n answerForms: parseAnswerForms,\n functions: array(string),\n times: boolean,\n visibleLabel: optional(string),\n ariaLabel: optional(string),\n buttonSets: parseLegacyButtonSets,\n buttonsVisible: optional(enumeration(\"always\", \"never\", \"focused\")),\n }),\n);\n\nfunction migrateV1ToV2(\n widget: ParsedValue<typeof parseExpressionWidgetV1>,\n): ParsedValue<typeof parseExpressionWidgetV2> {\n const {options} = widget;\n return {\n ...widget,\n version: {major: 2, minor: 0},\n options: {\n times: options.times,\n buttonSets: options.buttonSets,\n functions: options.functions,\n buttonsVisible: options.buttonsVisible,\n visibleLabel: options.visibleLabel,\n ariaLabel: options.ariaLabel,\n answerForms: options.answerForms,\n extraKeys: deriveExtraKeys(options) ?? [],\n },\n };\n}\n\nconst version0 = optional(object({major: constant(0), minor: number}));\nconst parseExpressionWidgetV0 = parseWidgetWithVersion(\n version0,\n constant(\"expression\"),\n object({\n functions: array(string),\n times: boolean,\n visibleLabel: optional(string),\n ariaLabel: optional(string),\n form: boolean,\n simplify: boolean,\n value: string,\n buttonSets: parseLegacyButtonSets,\n buttonsVisible: optional(enumeration(\"always\", \"never\", \"focused\")),\n }),\n);\n\nfunction migrateV0ToV1(\n widget: ParsedValue<typeof parseExpressionWidgetV0>,\n): ParsedValue<typeof parseExpressionWidgetV1> {\n const {options} = widget;\n return {\n ...widget,\n version: {major: 1, minor: 0},\n options: {\n times: options.times,\n buttonSets: options.buttonSets as any,\n functions: options.functions,\n buttonsVisible: options.buttonsVisible,\n visibleLabel: options.visibleLabel,\n ariaLabel: options.ariaLabel,\n\n answerForms: [\n {\n considered: \"correct\",\n form: options.form,\n simplify: options.simplify,\n value: options.value,\n },\n ],\n },\n };\n}\n\nexport const parseExpressionWidget = versionedWidgetOptions(\n 2,\n parseExpressionWidgetV2,\n)\n .withMigrationFrom(1, parseExpressionWidgetV1, migrateV1ToV2)\n .withMigrationFrom(0, parseExpressionWidgetV0, migrateV0ToV1).parser;\n","import {\n array,\n boolean,\n constant,\n number,\n object,\n string,\n} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nimport type {FreeResponseWidget} from \"../../data-schema\";\nimport type {Parser} from \"../parser-types\";\n\nexport const parseFreeResponseWidget: Parser<FreeResponseWidget> = parseWidget(\n constant(\"free-response\"),\n object({\n allowUnlimitedCharacters: boolean,\n characterLimit: number,\n placeholder: string,\n question: string,\n scoringCriteria: array(\n object({\n text: string,\n }),\n ),\n }),\n);\n","import {\n boolean,\n constant,\n nullable,\n number,\n object,\n optional,\n pipeParsers,\n record,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parsePerseusRenderer} from \"./perseus-renderer\";\nimport {parseWidget} from \"./widget\";\nimport {parseWidgetsMap} from \"./widgets-map\";\n\nconst falseToNull = pipeParsers(constant(false)).then(\n convert(() => null),\n).parser;\nexport const parseGradedGroupWidgetOptions = object({\n title: defaulted(string, () => \"\"),\n hasHint: optional(nullable(boolean)),\n // This module has an import cycle with parsePerseusRenderer.\n // The anonymous function below ensures that we don't try to access\n // parsePerseusRenderer before it's defined.\n hint: union(falseToNull)\n .or(constant(null))\n .or(constant(undefined))\n .or((rawVal, ctx) => parsePerseusRenderer(rawVal, ctx)).parser,\n content: string,\n // This module has an import cycle with parseWidgetsMap.\n // The anonymous function below ensures that we don't try to access\n // parseWidgetsMap before it's defined.\n widgets: (rawVal, ctx) => parseWidgetsMap(rawVal, ctx),\n widgetEnabled: optional(nullable(boolean)),\n immutableWidgets: optional(nullable(boolean)),\n images: record(\n string,\n object({\n width: number,\n height: number,\n }),\n ),\n});\n\nexport const parseGradedGroupWidget = parseWidget(\n constant(\"graded-group\"),\n parseGradedGroupWidgetOptions,\n);\n","import {array, constant, object} from \"../general-purpose-parsers\";\n\nimport {parseGradedGroupWidgetOptions} from \"./graded-group-widget\";\nimport {parseWidget} from \"./widget\";\n\nexport const parseGradedGroupSetWidget = parseWidget(\n constant(\"graded-group-set\"),\n object({gradedGroups: array(parseGradedGroupWidgetOptions)}),\n);\n","import {isPlainObject} from \"./is-plain-object\";\n\nimport type {ParseContext, Parser} from \"../parser-types\";\n\ntype Primitive = number | string | boolean | null | undefined;\n\n/**\n * discriminatedUnion() should be preferred over union() when parsing a\n * discriminated union type, because discriminatedUnion() produces more\n * understandable failure messages. It takes the discriminant as the source of\n * truth for which variant is to be parsed, and expects the other data to match\n * that variant.\n */\nexport function discriminatedUnionOn<DK extends string>(discriminantKey: DK) {\n const noMoreBranches: Parser<never> = (raw: unknown, ctx: ParseContext) => {\n if (!isPlainObject(raw)) {\n return ctx.failure(\"object\", raw);\n }\n return ctx\n .forSubtree(discriminantKey)\n .failure(\"a valid value\", raw[discriminantKey]);\n };\n\n return new DiscriminatedUnionBuilder(discriminantKey, noMoreBranches);\n}\n\nclass DiscriminatedUnionBuilder<\n DK extends string,\n Union extends {[k in DK]: Primitive},\n> {\n constructor(\n private discriminantKey: DK,\n public parser: Parser<Union>,\n ) {}\n\n withBranch<Variant extends {[k in DK]: Primitive}>(\n discriminantValue: Primitive,\n parseNewVariant: Parser<Variant>,\n ): DiscriminatedUnionBuilder<DK, Union | Variant> {\n const parseNewBranch = discriminatedUnionBranch(\n this.discriminantKey,\n discriminantValue,\n parseNewVariant,\n this.parser,\n );\n\n return new DiscriminatedUnionBuilder(\n this.discriminantKey,\n parseNewBranch,\n );\n }\n}\n\nfunction discriminatedUnionBranch<\n DK extends string,\n DV extends Primitive,\n Variant extends {[k in DK]: DV},\n Rest extends {[k in DK]: DV},\n>(\n discriminantKey: DK,\n discriminantValue: DV,\n parseVariant: Parser<Variant>,\n parseOtherBranches: Parser<Rest>,\n): Parser<Variant | Rest> {\n return (raw: unknown, ctx: ParseContext) => {\n if (!isPlainObject(raw)) {\n return ctx.failure(\"object\", raw);\n }\n\n if (raw[discriminantKey] === discriminantValue) {\n return parseVariant(raw, ctx);\n }\n\n return parseOtherBranches(raw, ctx);\n };\n}\n","import {\n array,\n boolean,\n constant,\n enumeration,\n nullable,\n number,\n object,\n optional,\n pair,\n pipeParsers,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\nimport {discriminatedUnionOn} from \"../general-purpose-parsers/discriminated-union\";\n\nimport {parseWidget} from \"./widget\";\n\nimport type {Parser} from \"../parser-types\";\n\nconst pairOfNumbers = pair(number, number);\n\nconst pairOfPoints = pair(pairOfNumbers, pairOfNumbers);\n\nconst emptyArray: Parser<[]> = (rawVal, ctx) => {\n if (Array.isArray(rawVal) && rawVal.length === 0) {\n return ctx.success([]);\n }\n return ctx.failure(\"empty array\", rawVal);\n};\n\nconst parseCoords = union(nullable(pairOfPoints)).or(\n // We convert [] to null to support some legacy content items.\n // The widget component treats [] and null the same as of 2025-05.\n pipeParsers(emptyArray).then(convert(() => null)).parser,\n).parser;\n\nconst parseCorrect = defaulted(\n discriminatedUnionOn(\"type\")\n .withBranch(\n \"absolute_value\",\n object({\n type: constant(\"absolute_value\"),\n coords: parseCoords,\n }),\n )\n .withBranch(\n \"exponential\",\n object({\n type: constant(\"exponential\"),\n asymptote: pairOfPoints,\n coords: parseCoords,\n }),\n )\n .withBranch(\n \"linear\",\n object({\n type: constant(\"linear\"),\n coords: parseCoords,\n }),\n )\n .withBranch(\n \"logarithm\",\n object({\n type: constant(\"logarithm\"),\n asymptote: pairOfPoints,\n coords: parseCoords,\n }),\n )\n .withBranch(\n \"quadratic\",\n object({\n type: constant(\"quadratic\"),\n coords: parseCoords,\n }),\n )\n .withBranch(\n \"sinusoid\",\n object({\n type: constant(\"sinusoid\"),\n coords: parseCoords,\n }),\n )\n .withBranch(\n \"tangent\",\n object({\n type: constant(\"tangent\"),\n coords: parseCoords,\n }),\n ).parser,\n // Default value. This is the same as the default in DEFAULT_GRAPHER_PROPS,\n // in grapher/util.tsx. See parse-perseus-json/README.md for an explanation\n // of why we want to duplicate defaults in the parser.\n () => ({\n type: \"linear\" as const,\n coords: null,\n }),\n);\n\nexport const parseGrapherWidget = parseWidget(\n constant(\"grapher\"),\n object({\n availableTypes: array(\n enumeration(\n \"absolute_value\",\n \"exponential\",\n \"linear\",\n \"logarithm\",\n \"quadratic\",\n \"sinusoid\",\n \"tangent\",\n ),\n ),\n correct: parseCorrect,\n graph: object({\n backgroundImage: object({\n bottom: optional(number),\n height: optional(number),\n left: optional(number),\n scale: optional(number),\n url: optional(nullable(string)),\n width: optional(number),\n }),\n box: optional(pairOfNumbers),\n editableSettings: optional(\n array(enumeration(\"graph\", \"snap\", \"image\", \"measure\")),\n ),\n gridStep: optional(pairOfNumbers),\n labels: pair(string, string),\n markings: enumeration(\"graph\", \"none\", \"grid\", \"axes\"),\n range: pair(pairOfNumbers, pairOfNumbers),\n rulerLabel: constant(\"\"),\n rulerTicks: number,\n showProtractor: optional(boolean),\n showRuler: optional(boolean),\n showTooltips: optional(boolean),\n snapStep: optional(pairOfNumbers),\n step: pairOfNumbers,\n valid: optional(union(boolean).or(string).parser),\n }),\n }),\n);\n","import {constant} from \"../general-purpose-parsers\";\n\nimport {parsePerseusRenderer} from \"./perseus-renderer\";\nimport {parseWidget} from \"./widget\";\n\nexport const parseGroupWidget = parseWidget(\n constant(\"group\"),\n // This module has an import cycle with parsePerseusRenderer.\n // The anonymous function below ensures that we don't try to access\n // parsePerseusRenderer before it's defined.\n (rawVal, ctx) => parsePerseusRenderer(rawVal, ctx),\n);\n","import {\n array,\n boolean,\n constant,\n number,\n object,\n optional,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseIframeWidget = parseWidget(\n constant(\"iframe\"),\n object({\n url: string,\n settings: optional(array(object({name: string, value: string}))),\n width: union(number).or(string).parser,\n height: union(number).or(string).parser,\n allowFullScreen: defaulted(boolean, () => false),\n allowTopNavigation: optional(boolean),\n static: defaulted(boolean, () => false),\n }),\n);\n","import type {PartialParser} from \"../parser-types\";\n\nexport const stringToNumber: PartialParser<string | number, number> = (\n rawValue,\n ctx,\n) => {\n if (typeof rawValue === \"number\") {\n return ctx.success(rawValue);\n }\n\n const parsedNumber = +rawValue;\n if (rawValue === \"\" || isNaN(parsedNumber)) {\n return ctx.failure(\"a number or numeric string\", rawValue);\n }\n\n return ctx.success(parsedNumber);\n};\n","import {\n nullable,\n number,\n object,\n optional,\n pipeParsers,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\nimport {stringToNumber} from \"../general-purpose-parsers/string-to-number\";\n\nfunction emptyToZero(x: string | number): string | number {\n return x === \"\" ? 0 : x;\n}\n\nconst imageDimensionToNumber = pipeParsers(union(number).or(string).parser)\n // In this specific case, empty string is equivalent to zero. An empty\n // string parses to either NaN (using parseInt) or 0 (using unary +) and\n // CSS will treat NaN as invalid and default to 0 instead.\n .then(convert(emptyToZero))\n .then(stringToNumber).parser;\n\nconst dimensionOrUndefined = defaulted(\n optional(imageDimensionToNumber),\n () => undefined,\n);\n\nexport const parsePerseusImageBackground = object({\n url: optional(nullable(string)),\n width: dimensionOrUndefined,\n height: dimensionOrUndefined,\n top: dimensionOrUndefined,\n left: dimensionOrUndefined,\n bottom: dimensionOrUndefined,\n scale: dimensionOrUndefined,\n});\n","import {\n array,\n boolean,\n constant,\n number,\n object,\n optional,\n pair,\n string,\n} from \"../general-purpose-parsers\";\n\nimport {parsePerseusImageBackground} from \"./perseus-image-background\";\nimport {parseWidget} from \"./widget\";\n\nconst pairOfNumbers = pair(number, number);\n\nexport const parseImageWidget = parseWidget(\n constant(\"image\"),\n object({\n title: optional(string),\n caption: optional(string),\n alt: optional(string),\n longDescription: optional(string),\n decorative: optional(boolean),\n backgroundImage: parsePerseusImageBackground,\n static: optional(boolean),\n labels: optional(\n array(\n object({\n content: string,\n alignment: string,\n coordinates: array(number),\n }),\n ),\n ),\n range: optional(pair(pairOfNumbers, pairOfNumbers)),\n box: optional(pairOfNumbers),\n }),\n);\n","import {\n boolean,\n constant,\n enumeration,\n number,\n object,\n optional,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nimport type {Parser} from \"../parser-types\";\n\nconst booleanToString: Parser<string> = (rawValue, ctx) => {\n if (typeof rawValue === \"boolean\") {\n return ctx.success(String(rawValue));\n }\n return ctx.failure(\"boolean\", rawValue);\n};\n\nexport const parseInputNumberWidget = parseWidget(\n constant(\"input-number\"),\n object({\n answerType: optional(\n enumeration(\n \"number\",\n \"decimal\",\n \"integer\",\n \"rational\",\n \"improper\",\n \"mixed\",\n \"percent\",\n \"pi\",\n ),\n ),\n inexact: optional(boolean),\n maxError: optional(union(number).or(string).parser),\n rightAlign: optional(boolean),\n simplify: enumeration(\"required\", \"optional\", \"enforced\"),\n size: enumeration(\"normal\", \"small\"),\n // TODO(benchristel): there are some content items where value is a\n // boolean, even though that makes no sense. We should figure out if\n // those content items are actually published anywhere, and consider\n // updating them.\n value: defaulted(\n union(number).or(string).or(booleanToString).parser,\n () => 0,\n ),\n customKeypad: optional(boolean),\n }),\n);\n","import {\n array,\n boolean,\n constant,\n enumeration,\n number,\n object,\n optional,\n pair,\n pipeParsers,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\nimport {discriminatedUnionOn} from \"../general-purpose-parsers/discriminated-union\";\n\nimport {parsePerseusImageBackground} from \"./perseus-image-background\";\nimport {parseWidget} from \"./widget\";\n\nconst pairOfNumbers = pair(number, number);\nconst stringOrEmpty = defaulted(string, () => \"\");\n\nconst parseKey = pipeParsers(optional(string)).then(convert(String)).parser;\n\nconst parseFunctionElement = object({\n type: constant(\"function\"),\n key: parseKey,\n options: object({\n value: string,\n funcName: string,\n rangeMin: string,\n rangeMax: string,\n color: string,\n strokeDasharray: string,\n strokeWidth: number,\n }),\n});\n\nconst parseLabelElement = object({\n type: constant(\"label\"),\n key: parseKey,\n options: object({\n label: string,\n color: string,\n coordX: string,\n coordY: string,\n }),\n});\n\nconst parseLineElement = object({\n type: constant(\"line\"),\n key: parseKey,\n options: object({\n color: string,\n startX: string,\n startY: string,\n endX: string,\n endY: string,\n strokeDasharray: string,\n strokeWidth: number,\n arrows: string,\n }),\n});\n\nconst parseMovableLineElement = object({\n type: constant(\"movable-line\"),\n key: parseKey,\n options: object({\n startX: string,\n startY: string,\n startSubscript: number,\n endX: string,\n endY: string,\n endSubscript: number,\n constraint: string,\n snap: number,\n constraintFn: string,\n constraintXMin: string,\n constraintXMax: string,\n constraintYMin: string,\n constraintYMax: string,\n }),\n});\n\nconst parseMovablePointElement = object({\n type: constant(\"movable-point\"),\n key: parseKey,\n options: object({\n startX: string,\n startY: string,\n varSubscript: number,\n constraint: string,\n snap: number,\n constraintFn: string,\n constraintXMin: stringOrEmpty,\n constraintXMax: stringOrEmpty,\n constraintYMin: stringOrEmpty,\n constraintYMax: stringOrEmpty,\n }),\n});\n\nconst parseParametricElement = object({\n type: constant(\"parametric\"),\n key: parseKey,\n options: object({\n x: string,\n y: string,\n rangeMin: string,\n rangeMax: string,\n color: string,\n strokeDasharray: string,\n strokeWidth: number,\n }),\n});\n\nconst parsePointElement = object({\n type: constant(\"point\"),\n key: parseKey,\n options: object({\n color: string,\n coordX: string,\n coordY: string,\n }),\n});\n\nconst parseRectangleElement = object({\n type: constant(\"rectangle\"),\n key: parseKey,\n options: object({\n color: string,\n coordX: string,\n coordY: string,\n width: string,\n height: string,\n }),\n});\n\nexport const parseInteractionWidget = parseWidget(\n constant(\"interaction\"),\n object({\n static: defaulted(boolean, () => false),\n graph: object({\n editableSettings: optional(array(enumeration(\"canvas\", \"graph\"))),\n box: pairOfNumbers,\n labels: array(string),\n range: pair(pairOfNumbers, pairOfNumbers),\n gridStep: pairOfNumbers,\n markings: enumeration(\"graph\", \"grid\", \"none\", \"axes\"),\n snapStep: optional(pairOfNumbers),\n valid: optional(union(boolean).or(string).parser),\n backgroundImage: optional(parsePerseusImageBackground),\n showProtractor: optional(boolean),\n showRuler: optional(boolean),\n rulerLabel: optional(string),\n rulerTicks: optional(number),\n tickStep: pairOfNumbers,\n }),\n elements: array(\n discriminatedUnionOn(\"type\")\n .withBranch(\"function\", parseFunctionElement)\n .withBranch(\"label\", parseLabelElement)\n .withBranch(\"line\", parseLineElement)\n .withBranch(\"movable-line\", parseMovableLineElement)\n .withBranch(\"movable-point\", parseMovablePointElement)\n .withBranch(\"parametric\", parseParametricElement)\n .withBranch(\"point\", parsePointElement)\n .withBranch(\"rectangle\", parseRectangleElement).parser,\n ),\n }),\n);\n","/* eslint-disable max-lines */\n/**\n * The Perseus \"data schema\" file.\n *\n * This file, and the types in it, represents the \"data schema\" that Perseus\n * uses. The @khanacademy/perseus-editor package edits and produces objects\n * that conform to the types in this file. Similarly, the top-level renderers\n * in @khanacademy/perseus, consume objects that conform to these types.\n *\n * WARNING: This file should not import any types from elsewhere so that it is\n * easy to reason about changes that alter the Perseus schema. This helps\n * ensure that it is not changed accidentally when upgrading a dependant\n * package or other part of Perseus code. Note that TypeScript does type\n * checking via something called \"structural typing\". This means that as long\n * as the shape of a type matches, the name it goes by doesn't matter. As a\n * result, a `Coord` type that looks like this `[x: number, y: number]` is\n * _identical_, in TypeScript's eyes, to this `Vector2` type `[x: number, y:\n * number]`. Also, with tuples, the labels for each entry is ignored, so `[x:\n * number, y: number]` is compatible with `[min: number, max: number]`. The\n * labels are for humans, not TypeScript. :)\n *\n * If you make changes to types in this file, be very sure that:\n *\n * a) the changes are backwards compatible. If they are not, old data from\n * previous versions of the \"schema\" could become unrenderable, or worse,\n * introduce hard-to-diagnose bugs.\n * b) the parsing code (`util/parse-perseus-json/`) is updated to handle\n * the new format _as well as_ the old format.\n */\n\n// TODO(LEMS-3080): Don't import KeypadKey here; data-schema.ts is supposed to\n// be independent of everything else.\nimport type {KeypadKey} from \"./keypad\";\n\n// TODO(FEI-4010): Remove `Perseus` prefix for all types here\n\nexport type Coord = [x: number, y: number];\nexport type Interval = [min: number, max: number];\nexport type Vector2 = Coord; // Same name as Mafs\nexport type Range = Interval;\nexport type Size = [width: number, height: number];\nexport type CollinearTuple = [Vector2, Vector2];\nexport type ShowSolutions = \"all\" | \"selected\" | \"none\";\nexport type ShowAxisArrows = {\n xMin: boolean;\n xMax: boolean;\n yMin: boolean;\n yMax: boolean;\n};\n\n/**\n * A utility type that constructs a widget map from a \"registry interface\".\n * The keys of the registry should be the widget type (aka, \"categorizer\" or\n * \"radio\", etc) and the value should be the option type stored in the value\n * of the map.\n *\n * You can think of this as a type that generates another type. We use\n * \"registry interfaces\" as a way to keep a set of widget types to their data\n * type in several places in Perseus. This type then allows us to generate a\n * map type that maps a widget id to its data type and keep strong typing by\n * widget id.\n *\n * For example, given a fictitious registry such as this:\n *\n * ```\n * interface DummyRegistry {\n * categorizer: { categories: string[] };\n * dropdown: { choices: string[] }:\n * }\n * ```\n *\n * If we create a DummyMap using this helper:\n *\n * ```\n * type DummyMap = MakeWidgetMap<DummyRegistry>;\n * ```\n *\n * We'll get a map that looks like this:\n *\n * ```\n * type DummyMap = {\n * `categorizer ${number}`: { categories: string[] };\n * `dropdown ${number}`: { choices: string[] };\n * }\n * ```\n *\n * We use interfaces for the registries so that they can be extended in cases\n * where the consuming app brings along their own widgets. Interfaces in\n * TypeScript are always open (ie. you can extend them) whereas types aren't.\n */\nexport type MakeWidgetMap<TRegistry> = {\n [Property in keyof TRegistry as `${Property & string} ${number}`]: TRegistry[Property];\n};\n\n/**\n * Our core set of Perseus widgets.\n *\n * This interface is the basis for \"registering\" all Perseus widget types.\n * There should be one key/value pair for each supported widget. If you create\n * a new widget, an entry should be added to this interface. Note that this\n * only registers the widget options type, you'll also need to register the\n * widget so that it's available at runtime (@see\n * {@link file://./widgets.ts#registerWidget}).\n *\n * Importantly, the key should be the name that is used in widget IDs. For most\n * widgets that is the same as the widget option's `type` field. In cases where\n * a widget has been deprecated and replaced with the deprecated-standin\n * widget, it should be the original widget type!\n *\n * If you define the widget outside of this package, you can still add the new\n * widget to this interface by writing the following in that package that\n * contains the widget. TypeScript will merge that definition of the\n * `PerseusWidgets` with the one defined below.\n *\n * ```typescript\n * declare module \"@khanacademy/perseus-core\" {\n * interface PerseusWidgetTypes {\n * // A new widget\n * \"new-awesomeness\": MyAwesomeNewWidget;\n *\n * // A deprecated widget\n * \"super-old-widget\": DeprecatedStandinWidget;\n * }\n * }\n *\n * // The new widget's options definition\n * type MyAwesomeNewWidget = WidgetOptions<'new-awesomeness', MyAwesomeNewWidgetOptions>;\n *\n * // The deprecated widget's options definition\n * type SuperOldWidget = WidgetOptions<'super-old-widget', object>;\n * ```\n *\n * This interface can be extended through the magic of TypeScript \"Declaration\n * merging\". Specifically, we augment this module and extend this interface.\n *\n * @see {@link https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation}\n */\nexport interface PerseusWidgetTypes {\n categorizer: CategorizerWidget;\n \"cs-program\": CSProgramWidget;\n definition: DefinitionWidget;\n dropdown: DropdownWidget;\n explanation: ExplanationWidget;\n expression: ExpressionWidget;\n \"free-response\": FreeResponseWidget;\n grapher: GrapherWidget;\n \"graded-group-set\": GradedGroupSetWidget;\n \"graded-group\": GradedGroupWidget;\n group: GroupWidget;\n iframe: IFrameWidget;\n image: ImageWidget;\n \"input-number\": InputNumberWidget;\n interaction: InteractionWidget;\n \"interactive-graph\": InteractiveGraphWidget;\n \"label-image\": LabelImageWidget;\n matcher: MatcherWidget;\n matrix: MatrixWidget;\n measurer: MeasurerWidget;\n \"molecule-renderer\": MoleculeRendererWidget;\n \"number-line\": NumberLineWidget;\n \"numeric-input\": NumericInputWidget;\n orderer: OrdererWidget;\n \"passage-ref-target\": RefTargetWidget;\n \"passage-ref\": PassageRefWidget;\n passage: PassageWidget;\n \"phet-simulation\": PhetSimulationWidget;\n \"python-program\": PythonProgramWidget;\n plotter: PlotterWidget;\n radio: RadioWidget;\n sorter: SorterWidget;\n table: TableWidget;\n video: VideoWidget;\n\n // Deprecated widgets\n \"lights-puzzle\": DeprecatedStandinWidget;\n sequence: DeprecatedStandinWidget;\n simulator: DeprecatedStandinWidget;\n transformer: DeprecatedStandinWidget;\n}\n\n/**\n * A map of widget IDs to widget options. This is most often used as the type\n * for a set of widgets defined in a `PerseusItem` but can also be useful to\n * represent a function parameter where only `widgets` from a `PerseusItem` are\n * needed. Today Widget IDs are made up of the widget type and an incrementing\n * integer (eg. `interactive-graph 1` or `radio 3`). It is suggested to avoid\n * reading/parsing the widget id to derive any information from it, except in\n * the case of this map.\n *\n * @see {@link PerseusWidgetTypes} additional widgets can be added to this map type\n * by augmenting the PerseusWidgetTypes with new widget types!\n */\nexport type PerseusWidgetsMap = MakeWidgetMap<PerseusWidgetTypes>;\n\n/**\n * PerseusWidget is a union of all the different types of widget options that\n * Perseus knows about.\n *\n * Thanks to it being based on PerseusWidgetTypes interface, this union is\n * automatically extended to include widgets used in tests without those widget\n * option types seeping into our production types.\n *\n * @see MockWidget for an example\n */\nexport type PerseusWidget = PerseusWidgetTypes[keyof PerseusWidgetTypes];\n\n/**\n * A \"PerseusItem\" is a classic Perseus item. It is rendered by the\n * `ServerItemRenderer` and the layout is pre-set.\n *\n * To render more complex Perseus items, see the `Item` type in the multi item\n * area.\n */\nexport type PerseusItem = {\n // The details of the question being asked to the user.\n question: PerseusRenderer;\n // A collection of hints to be offered to the user that support answering the question.\n hints: Hint[];\n // Details about the tools the user might need to answer the question\n answerArea: PerseusAnswerArea | null | undefined;\n};\n\n/**\n * A \"PerseusArticle\" is an item that is meant to be rendered as an article.\n * This item is never scored and is rendered by the `ArticleRenderer`.\n */\nexport type PerseusArticle = PerseusRenderer | PerseusRenderer[];\n\nexport type Version = {\n // The major part of the version\n major: number;\n // The minor part of the version\n minor: number;\n};\n\nexport type PerseusRenderer = {\n /**\n * Translatable Markdown content to be rendered. May include references to\n * widgets (as [[☃ widgetName]]) or images (as ).\n * For each image found in this content, there can be an entry in the\n * `images` dict (below) with the key being the image's url which defines\n * additional attributes for the image.\n */\n content: string;\n /**\n * A dictionary of {[widgetName]: Widget} to be referenced from the content\n * field.\n */\n widgets: PerseusWidgetsMap;\n /**\n * Formerly used in the PerseusGradedGroup widget. A list of \"tags\" that\n * are keys that represent other content in the system. Not rendered to\n * the user.\n * @deprecated\n */\n metadata?: any;\n /**\n * A dictionary of {[imageUrl]: PerseusImageDetail}.\n */\n images: {\n [imageUrl: string]: PerseusImageDetail;\n };\n};\n\nexport type Hint = PerseusRenderer & {\n /**\n * When `true`, causes the previous hint to be replaced with this hint when\n * displayed. When `false`, the previous hint remains visible when this one\n * is displayed. This allows for hints that build upon each other.\n */\n replace?: boolean;\n};\n\nexport type PerseusImageDetail = {\n // The width of the image\n width: number;\n // the height of the image\n height: number;\n};\n\nexport const ItemExtras = [\n // The user might benefit from using a Scientific Calculator. Provided on Khan Academy when true\n \"calculator\",\n // The user might benefit from a monthly payments calculator. Provided on Khan Academy when true\n \"financialCalculatorMonthlyPayment\",\n // The user might benefit from a total amount calculator. Provided on Khan Academy when true\n \"financialCalculatorTotalAmount\",\n // The user might benefit from a time to pay off calculator. Provided on Khan Academy when true\n \"financialCalculatorTimeToPayOff\",\n // The user might benefit from using a Periodic Table of Elements. Provided on Khan Academy when true\n \"periodicTable\",\n // The user might benefit from using a Periodic Table of Elements with key. Provided on Khan Academy when true\n \"periodicTableWithKey\",\n] as const;\nexport type PerseusAnswerArea = Record<(typeof ItemExtras)[number], boolean>;\n\n/**\n * The type representing the common structure of all widget's options. The\n * `Options` generic type represents the widget-specific option data.\n */\nexport type WidgetOptions<Type extends string, Options> = {\n // The \"type\" of widget which will define what the Options field looks like\n type: Type;\n // Whether this widget is displayed with the values and is immutable. For display only\n static?: boolean;\n // Whether a widget is scored. Usually true except for IFrame widgets (deprecated)\n // Default: true\n graded?: boolean;\n // The HTML alignment of the widget. \"default\" or \"block\"\n alignment?: string;\n // Options specific to the type field of the widget. See Perseus*WidgetOptions for more details\n options: Options;\n // Only used by interactive child widgets (line, point, etc) to identify the components\n key?: number | null;\n // The version of the widget data spec. Used to differentiate between newer and older content data.\n version?: Version;\n};\n\n// prettier-ignore\nexport type CategorizerWidget = WidgetOptions<'categorizer', PerseusCategorizerWidgetOptions>;\n// prettier-ignore\nexport type CSProgramWidget = WidgetOptions<'cs-program', PerseusCSProgramWidgetOptions>;\n// prettier-ignore\nexport type DefinitionWidget = WidgetOptions<'definition', PerseusDefinitionWidgetOptions>;\n// prettier-ignore\nexport type DropdownWidget = WidgetOptions<'dropdown', PerseusDropdownWidgetOptions>;\n// prettier-ignore\nexport type ExplanationWidget = WidgetOptions<'explanation', PerseusExplanationWidgetOptions>;\n// prettier-ignore\nexport type ExpressionWidget = WidgetOptions<'expression', PerseusExpressionWidgetOptions>;\n// prettier-ignore\nexport type FreeResponseWidget = WidgetOptions<'free-response', PerseusFreeResponseWidgetOptions>;\n// prettier-ignore\nexport type GradedGroupSetWidget = WidgetOptions<'graded-group-set', PerseusGradedGroupSetWidgetOptions>;\n// prettier-ignore\nexport type GradedGroupWidget = WidgetOptions<'graded-group', PerseusGradedGroupWidgetOptions>;\n// prettier-ignore\nexport type GrapherWidget = WidgetOptions<'grapher', PerseusGrapherWidgetOptions>;\n// prettier-ignore\nexport type GroupWidget = WidgetOptions<'group', PerseusGroupWidgetOptions>;\n// prettier-ignore\nexport type IFrameWidget = WidgetOptions<'iframe', PerseusIFrameWidgetOptions>;\n// prettier-ignore\nexport type ImageWidget = WidgetOptions<'image', PerseusImageWidgetOptions>;\n// prettier-ignore\nexport type InteractionWidget = WidgetOptions<'interaction', PerseusInteractionWidgetOptions>;\n// prettier-ignore\nexport type InteractiveGraphWidget = WidgetOptions<'interactive-graph', PerseusInteractiveGraphWidgetOptions>;\n// prettier-ignore\nexport type LabelImageWidget = WidgetOptions<'label-image', PerseusLabelImageWidgetOptions>;\n// prettier-ignore\nexport type MatcherWidget = WidgetOptions<'matcher', PerseusMatcherWidgetOptions>;\n// prettier-ignore\nexport type MatrixWidget = WidgetOptions<'matrix', PerseusMatrixWidgetOptions>;\n// prettier-ignore\nexport type MeasurerWidget = WidgetOptions<'measurer', PerseusMeasurerWidgetOptions>;\n// prettier-ignore\nexport type NumberLineWidget = WidgetOptions<'number-line', PerseusNumberLineWidgetOptions>;\n// prettier-ignore\nexport type NumericInputWidget = WidgetOptions<'numeric-input', PerseusNumericInputWidgetOptions>;\n// prettier-ignore\nexport type OrdererWidget = WidgetOptions<'orderer', PerseusOrdererWidgetOptions>;\n// prettier-ignore\nexport type PassageRefWidget = WidgetOptions<'passage-ref', PerseusPassageRefWidgetOptions>;\n// prettier-ignore\nexport type PassageWidget = WidgetOptions<'passage', PerseusPassageWidgetOptions>;\n// prettier-ignore\nexport type PhetSimulationWidget = WidgetOptions<'phet-simulation', PerseusPhetSimulationWidgetOptions>;\n// prettier-ignore\nexport type PlotterWidget = WidgetOptions<'plotter', PerseusPlotterWidgetOptions>;\n// prettier-ignore\nexport type PythonProgramWidget = WidgetOptions<'python-program', PerseusPythonProgramWidgetOptions>;\n// prettier-ignore\nexport type RadioWidget = WidgetOptions<'radio', PerseusRadioWidgetOptions>;\n// prettier-ignore\nexport type SorterWidget = WidgetOptions<'sorter', PerseusSorterWidgetOptions>;\n// prettier-ignore\nexport type TableWidget = WidgetOptions<'table', PerseusTableWidgetOptions>;\n// prettier-ignore\nexport type InputNumberWidget = WidgetOptions<'input-number', PerseusInputNumberWidgetOptions>;\n// prettier-ignore\nexport type MoleculeRendererWidget = WidgetOptions<'molecule-renderer', PerseusMoleculeRendererWidgetOptions>;\n// prettier-ignore\nexport type RefTargetWidget = WidgetOptions<'passage-ref-target', PerseusPassageRefTargetWidgetOptions>;\n// prettier-ignore\nexport type VideoWidget = WidgetOptions<'video', PerseusVideoWidgetOptions>;\n//prettier-ignore\nexport type DeprecatedStandinWidget = WidgetOptions<'deprecated-standin', object>;\n\n/**\n * A background image applied to various widgets.\n */\nexport type PerseusImageBackground = {\n // The URL of the image\n url?: string | null;\n // The width of the image\n width?: number;\n // The height of the image\n height?: number;\n // The top offset of the image\n top?: number;\n // The left offset of the image\n left?: number;\n // The scale of the image\n scale?: number;\n // The bottom offset of the image\n bottom?: number;\n};\n\n/**\n * The type of markings to display on the graph.\n * - axes: shows the axes without the gride lines\n * - graph: shows the axes and the grid lines\n * - grid: shows only the grid lines\n * - none: shows no markings\n */\nexport type MarkingsType = \"axes\" | \"graph\" | \"grid\" | \"none\";\nexport type AxisLabelLocation = \"onAxis\" | \"alongEdge\";\n\nexport type PerseusCategorizerWidgetOptions = {\n // Translatable text; a list of items to categorize. e.g. [\"banana\", \"yellow\", \"apple\", \"purple\", \"shirt\"]\n items: string[];\n // Translatable text; a list of categories. e.g. [\"fruits\", \"colors\", \"clothing\"]\n categories: string[];\n // Whether the items should be randemized\n randomizeItems: boolean;\n // Whether this widget is displayed with the results and immutable\n static: boolean;\n // The correct answers where index relates to the items and value relates to the category. e.g. [0, 1, 0, 1, 2]\n values: number[];\n // Whether we should highlight i18n linter errors found on this widget\n highlightLint?: boolean;\n};\n\nexport type PerseusDefinitionWidgetOptions = {\n // Translatable text; the word to define. e.g. \"vertex\"\n togglePrompt: string;\n // Translatable text; the definition of the word. e.g. \"where 2 rays connect\"\n definition: string;\n // Always false. Not used for this widget\n static: boolean;\n};\n\nexport type PerseusDropdownWidgetOptions = {\n // A list of choices for the dropdown\n choices: PerseusDropdownChoice[];\n // Translatable Text; placeholder text for a dropdown. e.g. \"Please select a fruit\"\n placeholder: string;\n // Always false. Not used for this widget\n static: boolean;\n // Translatable Text; visible label for the dropdown\n visibleLabel?: string;\n // Translatable Text; aria label that screen readers will read\n ariaLabel?: string;\n};\n\nexport type PerseusDropdownChoice = {\n // Translatable text; The text for the option. e.g. \"Banana\" or \"Orange\"\n content: string;\n // Whether this is the correct option or not\n correct: boolean;\n};\n\nexport type PerseusExplanationWidgetOptions = {\n // Translatable Text; The clickable text to expand an explanation. e.g. \"What is an apple?\"\n showPrompt: string;\n // Translatable Text; The cliclable text to hide an explanation. e.g. \"Thanks. I got it!\"\n hidePrompt: string;\n // Translatable Markdown; The explanation that is shown when showPrompt is clicked. e.g. \"An apple is a tasty fruit.\"\n explanation: string;\n // explanation fields can embed widgets. When they do, the details of the widgets are here.\n widgets: PerseusWidgetsMap;\n // Always false. Not used for this widget\n static: boolean;\n};\n\nexport type LegacyButtonSets = Array<\n | \"basic\"\n | \"basic+div\"\n | \"trig\"\n | \"prealgebra\"\n | \"logarithms\"\n | \"basic relations\"\n | \"advanced relations\"\n | \"scientific\"\n>;\n\nexport type PerseusExpressionWidgetOptions = {\n // The expression forms the answer may come in\n answerForms: PerseusExpressionAnswerForm[];\n buttonSets: LegacyButtonSets;\n // Variables that can be used as functions. Default: [\"f\", \"g\", \"h\"]\n functions: string[];\n // Use x for rendering multiplication instead of a center dot.\n times: boolean;\n // What extra keys need to be displayed on the keypad so that the\n // question can be answerable without a keyboard (ie mobile)\n // TODO: this is really Key[]\n extraKeys?: KeypadKey[];\n // visible label associated with the MathQuill field\n visibleLabel?: string;\n // aria label for screen readers attached to MathQuill field\n ariaLabel?: string;\n // Controls when buttons for special characters are visible when using a\n // desktop browser. Defaults to \"focused\".\n // NOTE: This isn't listed in perseus-format.js or perseus_data.go, but\n // appears in item data in the datastore.\n buttonsVisible?: \"always\" | \"never\" | \"focused\";\n};\n\nexport const PerseusExpressionAnswerFormConsidered = [\n \"correct\",\n \"wrong\",\n \"ungraded\",\n] as const;\n\nexport type PerseusExpressionAnswerForm = {\n // The TeX form of the expression. e.g. \"x\\\\cdot3=y\"\n value: string;\n // The Answer expression must have the same form\n form: boolean;\n // The answer expression must be fully expanded and simplified\n simplify: boolean;\n // Whether the form is considered \"correct\", \"wrong\", or \"ungraded\"\n considered: (typeof PerseusExpressionAnswerFormConsidered)[number];\n // A key to identify the answer form in a list\n // NOTE: perseus-format.js says this is required even though it isn't necessary.\n key?: string;\n};\n\nexport type PerseusGradedGroupWidgetOptions = {\n // Translatable Text; A title to be displayed for the group.\n title: string;\n // Not used in Perseus (but is set in (en, pt) production data)\n hasHint?: boolean | null | undefined;\n // A section to define hints for the group.\n hint?: PerseusRenderer | null | undefined;\n // Translatable Markdown. May include widgets and images embedded.\n content: string;\n // See PerseusRenderer.widgets\n widgets: PerseusWidgetsMap;\n // Not used in Perseus\n widgetEnabled?: boolean | null | undefined;\n // Not used in Perseus\n immutableWidgets?: boolean | null | undefined;\n // See PerseusRenderer.images\n images: {\n [key: string]: PerseusImageDetail;\n };\n};\n\nexport type PerseusGradedGroupSetWidgetOptions = {\n // A list of Widget Groups\n gradedGroups: PerseusGradedGroupWidgetOptions[];\n};\n\n// 2D range: xMin, xMax, yMin, yMax\nexport type GraphRange = [\n x: [min: number, max: number],\n y: [min: number, max: number],\n];\n\nexport type GrapherAnswerTypes =\n | {\n type: \"absolute_value\";\n // If `coords` is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [vertex: Coord, secondPoint: Coord];\n }\n | {\n type: \"exponential\";\n // Two points along the asymptote line. Usually (always?) a\n // horizontal or vertical line.\n asymptote: [Coord, Coord];\n // Two points along the exponential curve. One end of the curve\n // trends towards the asymptote.\n // If `coords` is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [Coord, Coord];\n }\n | {\n type: \"linear\";\n // Two points along the straight line\n // If coords is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [Coord, Coord];\n }\n | {\n type: \"logarithm\";\n // Two points along the asymptote line.\n asymptote: [Coord, Coord];\n // Two points along the logarithmic curve. One end of the curve\n // trends towards the asymptote.\n // If coords is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [Coord, Coord];\n }\n | {\n type: \"quadratic\";\n // If coords is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [vertex: Coord, secondPoint: Coord];\n }\n | {\n type: \"sinusoid\";\n // Two points on the same slope in the sinusoid wave line.\n // If coords is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [Coord, Coord];\n }\n | {\n type: \"tangent\";\n // Two points on the same slope in the tangent wave line.\n // If coords is null, the graph will not be gradable. All answers\n // will be scored as invalid.\n coords: null | [Coord, Coord];\n };\n\nexport type PerseusGrapherWidgetOptions = {\n availableTypes: Array<\n | \"absolute_value\"\n | \"exponential\"\n | \"linear\"\n | \"logarithm\"\n | \"quadratic\"\n | \"sinusoid\"\n | \"tangent\"\n >;\n correct: GrapherAnswerTypes;\n graph: {\n backgroundImage: {\n bottom?: number;\n height?: number;\n left?: number;\n scale?: number;\n url?: string | null | undefined;\n width?: number;\n };\n box?: [number, number];\n editableSettings?: Array<\"graph\" | \"snap\" | \"image\" | \"measure\">;\n gridStep?: [number, number];\n labels: [string, string];\n markings: MarkingsType;\n range: GraphRange;\n rulerLabel: \"\";\n rulerTicks: number;\n showProtractor?: boolean;\n showRuler?: boolean;\n showTooltips?: boolean;\n snapStep?: [number, number];\n step: [number, number];\n valid?: boolean | string;\n };\n};\n\nexport type PerseusGroupWidgetOptions = PerseusRenderer;\n\nexport type PerseusImageWidgetOptions = {\n // Translatable Markdown; Text to be shown for the title of the image\n title?: string;\n // Translatable Markdown; Text to be shown in the caption section of an image\n caption?: string;\n // Translatable Text; The alt text to be shown in the img.alt attribute\n alt?: string;\n // Translatable Markdown; Text to be shown as the long description of an image\n longDescription?: string;\n // When true, standalone image will be rendered with alt=\"\" and without any alt text, caption, title, or long description.\n decorative?: boolean;\n // The image details for the image to be displayed\n backgroundImage: PerseusImageBackground;\n // Always false. Not used for this widget\n static?: boolean;\n // A list of labels to display on the image\n /** @deprecated - labels were removed from the image widget in 2017 */\n labels?: Array<PerseusImageLabel>;\n // The range on the image render for labels\n /** @deprecated - range for labels was removed from the image widget in 2017 */\n range?: [Interval, Interval];\n // The box on the image render for labels. The same as backgroundImage.width and backgroundImage.height\n /** @deprecated - box for labels was removed from the image widget in 2017 */\n box?: Size;\n};\n\nexport type PerseusImageLabel = {\n // Translatable Text; The content of the label to display\n content: string;\n // The visual alignment of the label. default: \"center\"\n alignment: string;\n // The point on the image to display the label\n coordinates: number[];\n};\n\nexport type PerseusInteractiveGraphWidgetOptions = {\n // Where the little black axis lines & labels (ticks) should render.\n // Also known as the tick step. default [1, 1]\n step: [number, number];\n // Where the grid lines on the graph will render. default [1, 1]\n gridStep?: [x: number, y: number];\n // Where the graph points will lock to when they are dragged. default [0.5, 0.5]\n snapStep?: [x: number, y: number];\n // An optional image to use in the background\n backgroundImage?: PerseusImageBackground;\n /**\n * The type of markings to display on the graph.\n */\n markings: MarkingsType;\n // How to label the X and Y axis. default: [\"x\", \"y\"]\n labels?: string[];\n /**\n * Specifies the location of the labels on the graph. default: \"onAxis\".\n * - \"onAxis\": Labels are positioned on the axis at the right (x) and top (y) of the graph.\n * - \"alongEdge\": Labels are centered along the bottom (x) and left (y) edges of the graph.\n * The y label is rotated. Typically used when the range min is near 0 with longer labels.\n */\n labelLocation?: AxisLabelLocation;\n // Which sides of the graph are bounded (removed axis arrows).\n showAxisArrows: ShowAxisArrows;\n // Whether to show the Protractor tool overlayed on top of the graph\n showProtractor: boolean;\n /**\n * Whether to show the Ruler tool overlayed on top of the graph.\n * @deprecated - no longer used by the InteractiveGraph widget. The\n * property is kept on this type to prevent its accidental reuse in future\n * features, since it may appear in production data.\n */\n showRuler?: boolean;\n // Whether to show tooltips on the graph\n showTooltips?: boolean;\n /**\n * The unit to show on the ruler. e.g. \"mm\", \"cm\", \"m\", \"km\", \"in\", \"ft\",\n * \"yd\", \"mi\".\n * @deprecated - no longer used by the InteractiveGraph widget. The\n * property is kept on this type to prevent its accidental reuse in future\n * features, since it may appear in production data.\n */\n rulerLabel?: string;\n /**\n * How many ticks to show on the ruler. e.g. 1, 2, 4, 8, 10, 16. Must be\n * an integer.\n * @deprecated - no longer used by the InteractiveGraph widget. The\n * property is kept on this type to prevent its accidental reuse in future\n * features, since it may appear in production data.\n */\n rulerTicks?: number;\n // The X and Y coordinate ranges for the view of the graph. default: [[-10, 10], [-10, 10]]\n // TODO(kevinb): Add a transform function to interactive-graph.jsx to\n // rename `range` to `ranges` so that things are less confusing.\n range: GraphRange;\n // The type of graph\n graph: PerseusGraphType;\n // The correct kind of graph, if being used to select function type\n // TODO(LEMS-2344): make the type of `correct` more specific\n correct: PerseusGraphType;\n // Shapes (points, chords, etc) displayed on the graph that cannot\n // be moved by the user.\n lockedFigures: LockedFigure[];\n // Aria label that applies to the entire graph.\n fullGraphAriaLabel?: string;\n // Aria description that applies to the entire graph.\n fullGraphAriaDescription?: string;\n};\n\nexport const lockedFigureColorNames = [\n \"blue\",\n \"green\",\n \"grayH\",\n \"purple\",\n \"pink\",\n \"orange\",\n \"red\",\n] as const;\n\nexport type LockedFigureColor = (typeof lockedFigureColorNames)[number];\n\nexport const lockedFigureColors: Record<LockedFigureColor, string> = {\n blue: \"#3D7586\",\n green: \"#447A53\",\n grayH: \"#3B3D45\",\n purple: \"#594094\",\n pink: \"#B25071\",\n red: \"#D92916\",\n orange: \"#946700\",\n} as const;\n\nexport type StrokeWeight = \"thin\" | \"medium\" | \"thick\";\n\nexport type LockedFigure =\n | LockedPointType\n | LockedLineType\n | LockedVectorType\n | LockedEllipseType\n | LockedPolygonType\n | LockedFunctionType\n | LockedLabelType;\nexport type LockedFigureType = LockedFigure[\"type\"];\n\nexport type LockedLineStyle = \"solid\" | \"dashed\";\n\nexport type LockedPointType = {\n type: \"point\";\n coord: Coord;\n color: LockedFigureColor;\n filled: boolean;\n labels: LockedLabelType[];\n ariaLabel?: string;\n};\n\nexport type LockedLineType = {\n type: \"line\";\n kind: \"line\" | \"ray\" | \"segment\";\n points: [point1: LockedPointType, point2: LockedPointType];\n color: LockedFigureColor;\n lineStyle: LockedLineStyle;\n showPoint1: boolean;\n showPoint2: boolean;\n weight: StrokeWeight;\n labels: LockedLabelType[];\n ariaLabel?: string;\n};\n\nexport type LockedVectorType = {\n type: \"vector\";\n points: [tail: Coord, tip: Coord];\n color: LockedFigureColor;\n weight: StrokeWeight;\n labels: LockedLabelType[];\n ariaLabel?: string;\n};\n\nexport type LockedFigureFillType = \"none\" | \"white\" | \"translucent\" | \"solid\";\nexport const lockedFigureFillStyles: Record<LockedFigureFillType, number> = {\n none: 0,\n white: 1,\n translucent: 0.4,\n solid: 1,\n} as const;\n\nexport type LockedEllipseType = {\n type: \"ellipse\";\n center: Coord;\n radius: [x: number, y: number];\n angle: number;\n color: LockedFigureColor;\n fillStyle: LockedFigureFillType;\n strokeStyle: LockedLineStyle;\n weight: StrokeWeight;\n labels: LockedLabelType[];\n ariaLabel?: string;\n};\n\nexport type LockedPolygonType = {\n type: \"polygon\";\n points: Coord[];\n color: LockedFigureColor;\n showVertices: boolean;\n fillStyle: LockedFigureFillType;\n strokeStyle: LockedLineStyle;\n weight: StrokeWeight;\n labels: LockedLabelType[];\n ariaLabel?: string;\n};\n\nexport type LockedFunctionType = {\n type: \"function\";\n color: LockedFigureColor;\n strokeStyle: LockedLineStyle;\n weight: StrokeWeight;\n /**\n * This is the user-defined equation (as it was typed)\n */\n equation: string;\n /**\n * The independent variable of this function\n */\n directionalAxis: \"x\" | \"y\";\n /**\n * The minimum and maximum values along the `directionalAxis` at which\n * this function should be graphed. Values of -Infinity and Infinity are\n * allowed. Note that infinite values are serialized as `null` in JSON.\n */\n domain: [min: number, max: number];\n labels: LockedLabelType[];\n ariaLabel?: string;\n};\n\n// Not associated with a specific figure\nexport type LockedLabelType = {\n type: \"label\";\n coord: Coord;\n // TeX-supported string\n text: string;\n color: LockedFigureColor;\n size: \"small\" | \"medium\" | \"large\";\n};\n\nexport type PerseusGraphType =\n | PerseusGraphTypeAngle\n | PerseusGraphTypeCircle\n | PerseusGraphTypeLinear\n | PerseusGraphTypeLinearSystem\n | PerseusGraphTypeNone\n | PerseusGraphTypePoint\n | PerseusGraphTypePolygon\n | PerseusGraphTypeQuadratic\n | PerseusGraphTypeRay\n | PerseusGraphTypeSegment\n | PerseusGraphTypeSinusoid;\n\nexport type PerseusGraphTypeAngle = {\n type: \"angle\";\n // Whether to show the angle measurements. default: false\n showAngles?: boolean;\n // Allow Reflex Angles if an \"angle\" type. default: true\n allowReflexAngles?: boolean;\n // The angle offset in degrees if an \"angle\" type. default: 0\n angleOffsetDeg?: number;\n // Snap to degree increments if an \"angle\" type. default: 1\n snapDegrees?: number;\n // How to match the answer. If missing, defaults to exact matching.\n match?: \"congruent\";\n // must have 3 coords - ie [Coord, Coord, Coord]\n coords?: [Coord, Coord, Coord];\n // The initial coordinates the graph renders with.\n startCoords?: [Coord, Coord, Coord];\n};\n\nexport type PerseusGraphTypeCircle = {\n type: \"circle\";\n center?: Coord;\n radius?: number;\n // The initial coordinates the graph renders with.\n startCoords?: {\n center: Coord;\n radius: number;\n };\n};\n\nexport type PerseusGraphTypeLinear = {\n type: \"linear\";\n // expects 2 coords\n coords?: CollinearTuple | null;\n // The initial coordinates the graph renders with.\n startCoords?: CollinearTuple;\n};\n\nexport type PerseusGraphTypeLinearSystem = {\n type: \"linear-system\";\n // expects 2 sets of 2 coords\n coords?: CollinearTuple[] | null;\n // The initial coordinates the graph renders with.\n startCoords?: CollinearTuple[];\n};\n\nexport type PerseusGraphTypeNone = {\n type: \"none\";\n};\n\nexport type PerseusGraphTypePoint = {\n type: \"point\";\n // The number of points if a \"point\" type. default: 1. \"unlimited\" if no limit\n numPoints?: number | \"unlimited\";\n coords?: Coord[] | null;\n // The initial coordinates the graph renders with.\n startCoords?: Coord[];\n // Used instead of `coords` in some old graphs that have only one point.\n coord?: Coord;\n};\n\nexport type PerseusGraphTypePolygon = {\n type: \"polygon\";\n // The number of sides. default: 3. \"unlimited\" if no limit\n numSides?: number | \"unlimited\";\n // Whether to the angle measurements. default: false\n showAngles?: boolean;\n // Whether to show side measurements. default: false\n showSides?: boolean;\n // How to snap points. e.g. \"grid\", \"angles\", or \"sides\". default: grid\n snapTo?: \"grid\" | \"angles\" | \"sides\";\n // How to match the answer. If missing, defaults to exact matching.\n match?: \"similar\" | \"congruent\" | \"approx\" | \"exact\";\n coords?: Coord[] | null;\n // The initial coordinates the graph renders with.\n startCoords?: Coord[];\n};\n\nexport type PerseusGraphTypeQuadratic = {\n type: \"quadratic\";\n // expects a list of 3 coords\n coords?: [Coord, Coord, Coord] | null;\n // The initial coordinates the graph renders with.\n startCoords?: [Coord, Coord, Coord];\n};\n\nexport type PerseusGraphTypeSegment = {\n type: \"segment\";\n // The number of segments if a \"segment\" type. default: 1. Max: 6\n numSegments?: number;\n // Expects a list of Coord tuples. Length should match the `numSegments` value.\n coords?: CollinearTuple[] | null;\n // The initial coordinates the graph renders with.\n startCoords?: CollinearTuple[];\n};\n\nexport type PerseusGraphTypeSinusoid = {\n type: \"sinusoid\";\n // Expects a list of 2 Coords\n coords?: Coord[] | null;\n // The initial coordinates the graph renders with.\n startCoords?: Coord[];\n};\n\nexport type PerseusGraphTypeRay = {\n type: \"ray\";\n // Expects a list of 2 Coords\n coords?: CollinearTuple | null;\n // The initial coordinates the graph renders with.\n startCoords?: CollinearTuple;\n};\n\ntype AngleGraphCorrect = {\n type: \"angle\";\n allowReflexAngles: boolean;\n match?: \"congruent\";\n coords: [Coord, Coord, Coord];\n};\n\ntype CircleGraphCorrect = {\n type: \"circle\";\n center: Coord;\n radius: number;\n};\n\ntype LinearGraphCorrect = {\n type: \"linear\";\n coords: CollinearTuple;\n};\n\ntype LinearSystemGraphCorrect = {\n type: \"linear-system\";\n coords: [CollinearTuple, CollinearTuple];\n};\n\ntype NoneGraphCorrect = {\n type: \"none\";\n};\n\ntype PointGraphCorrect = {\n type: \"point\";\n coords: Coord[];\n};\n\ntype PolygonGraphCorrect = {\n type: \"polygon\";\n match: \"similar\" | \"congruent\" | \"approx\";\n coords: Coord[];\n};\n\ntype QuadraticGraphCorrect = {\n type: \"quadratic\";\n coords: [Coord, Coord, Coord];\n};\n\ntype SegmentGraphCorrect = {\n type: \"segment\";\n coords: CollinearTuple[];\n};\n\ntype SinusoidGraphCorrect = {\n type: \"sinusoid\";\n coords: CollinearTuple;\n};\n\ntype RayGraphCorrect = {\n type: \"ray\";\n coords: CollinearTuple;\n};\n\nexport type PerseusGraphCorrectType =\n | AngleGraphCorrect\n | CircleGraphCorrect\n | LinearGraphCorrect\n | LinearSystemGraphCorrect\n | NoneGraphCorrect\n | PointGraphCorrect\n | PolygonGraphCorrect\n | QuadraticGraphCorrect\n | RayGraphCorrect\n | SegmentGraphCorrect\n | SinusoidGraphCorrect;\n\nexport type PerseusLabelImageWidgetOptions = {\n // Translatable Text; Tex representation of choices\n choices: string[];\n // The URL of the image\n imageUrl: string;\n // Translatable Text; To show up in the img.alt attribute\n imageAlt: string;\n // The height of the image\n imageHeight: number;\n // The width of the image\n imageWidth: number;\n // A list of markers to display on the image\n markers: PerseusLabelImageMarker[];\n // Do not display answer choices in instructions\n hideChoicesFromInstructions: boolean;\n // Allow multiple answers per marker\n multipleAnswers: boolean;\n // Always false. Not used for this widget\n static: boolean;\n};\n\nexport type PerseusLabelImageMarker = {\n // A list of correct answers for this marker. Often only one but can have multiple\n answers: string[];\n // Translatable Text; The text to show for the marker. Not displayed directly to the user\n label: string;\n // X Coordiate location of the marker on the image\n x: number;\n // Y Coordinate location of the marker on the image\n y: number;\n};\n\nexport type PerseusMatcherWidgetOptions = {\n // Translatable Text; Labels to adorn the headings for the columns. Only 2 values [left, right]. e.g. [\"Concepts\", \"Things\"]\n labels: string[];\n // Translatable Text; Static concepts to show in the left column. e.g. [\"Fruit\", \"Color\", \"Clothes\"]\n left: string[];\n // Translatable Markup; Values that represent the concepts to be correlated with the concepts. e.g. [\"Red\", \"Shirt\", \"Banana\"]\n right: string[];\n // Order of the matched pairs matters. With this option enabled, only the order provided above will be treated as correct. This is useful when ordering is significant, such as in the context of a proof. If disabled, pairwise matching is sufficient. To make this clear, the left column becomes fixed in the provided order and only the cards in the right column can be moved.\n orderMatters: boolean;\n // Adds padding to the rows. Padding is good for text, but not needed for images.\n padding: boolean;\n};\n\nexport type PerseusMatrixWidgetAnswers = number[][];\nexport type PerseusMatrixWidgetOptions = {\n // Translatable Text; Shown before the matrix\n prefix?: string | undefined;\n // Translatable Text; Shown after the matrix\n suffix?: string | undefined;\n // A data matrix representing the \"correct\" answers to be entered into the matrix\n answers: PerseusMatrixWidgetAnswers;\n // The coordinate location of the cursor position at start. default: [0, 0]\n cursorPosition?: number[] | undefined;\n // The coordinate size of the matrix. Only supports 2-dimensional matrix. default: [3, 3]\n matrixBoardSize: number[];\n // Whether this is meant to statically display the answers (true) or be used as an input field, graded against the answers\n static?: boolean | undefined;\n};\n\nexport type PerseusMeasurerWidgetOptions = {\n // The image that the user is meant to measure\n image: PerseusImageBackground;\n // Whether to show the Protractor tool overlayed on top of the image\n showProtractor: boolean;\n // Whether to show the Ruler tool overlayed on top of the image\n showRuler: boolean;\n // The unit to show on the ruler. e.g. \"mm\", \"cm\", \"m\", \"km\", \"in\", \"ft\", \"yd\", \"mi\"\n rulerLabel: string;\n // How many ticks to show on the ruler. e.g. 1, 2, 4, 8, 10, 16\n rulerTicks: number;\n // The number of image pixels per unit (label)\n rulerPixels: number;\n // The number of units to display on the ruler\n rulerLength: number;\n // Containing area [width, height]\n box: [number, number];\n};\n\nexport type MathFormat =\n | \"integer\"\n | \"mixed\"\n | \"improper\"\n | \"proper\"\n | \"decimal\"\n | \"percent\"\n | \"pi\";\n\nexport type PerseusNumericInputAnswerForm = {\n simplify: PerseusNumericInputSimplify;\n name: MathFormat;\n};\n\n/**\n * Determines how unsimplified fractions are scored.\n *\n * - \"required\" means unsimplified fractions are considered invalid input, and\n * the learner can try again.\n * - \"enforced\" means unsimplified fractions are marked incorrect.\n * - \"optional\" means unsimplified fractions are accepted.\n */\nexport type PerseusNumericInputSimplify = \"required\" | \"enforced\" | \"optional\";\n\nexport type PerseusNumericInputWidgetOptions = {\n // A list of all the possible correct and incorrect answers\n answers: PerseusNumericInputAnswer[];\n // Translatable Text; Text to describe this input. This will be shown to users using screenreaders.\n labelText?: string | undefined;\n // Use size \"Normal\" for all text boxes, unless there are multiple text boxes in one line and the answer area is too narrow to fit them. Options: \"normal\" or \"small\"\n size: string;\n // A coefficient style number allows the student to use - for -1 and an empty string to mean 1.\n coefficient: boolean;\n // Whether to right-align the text or not\n rightAlign?: boolean;\n // Always false. Not used for this widget\n static: boolean;\n};\n\nexport type PerseusNumericInputAnswer = {\n // Translatable Display; A description for why this answer is correct, wrong, or ungraded\n message: string;\n // The expected answer\n value?: number | null;\n // Whether this answer is \"correct\", \"wrong\", or \"ungraded\"\n status: string;\n // The forms available for this answer. Options: \"integer, \"\"decimal\", \"proper\", \"improper\", \"mixed\", or \"pi\"\n answerForms?: MathFormat[];\n // Whether we should check the answer strictly against the the configured answerForms (strict = true)\n // or include the set of default answerForms (strict = false).\n strict: boolean;\n // A range of error +/- the value\n maxError?: number | null;\n // Unsimplified answers are Ungraded, Accepted, or Wrong.\n simplify: PerseusNumericInputSimplify;\n};\n\nexport type PerseusNumberLineWidgetOptions = {\n // The position of the endpoints of the number line. Setting the range constrains the position of the answer and the labels.\n range: number[];\n // This controls the position of the left / right labels. By default, the labels are set by the range. Note: Ensure that the labels line up with the tick marks, or it may be confusing for users.\n labelRange: Array<number | null>;\n // This controls the styling of the labels for the two main labels as well as all the tick mark labels, if applicable. Options: \"decimal\", \"improper\", \"mixed\", \"non-reduced\"\n labelStyle: string;\n // Show label ticks\n labelTicks: boolean;\n // Show tick controller\n isTickCtrl: boolean;\n isInequality: boolean;\n // The range of divisions within the line\n divisionRange: number[];\n // This controls the number (and position) of the tick marks. The number of divisions is constrained to the division range. Note: The user will be able to specify the number of divisions in a number input.\n numDivisions?: number | null;\n // This determines the number of different places the point will snap between two adjacent tick marks. Note: Ensure the required number of snap increments is provided to answer the question.\n snapDivisions: number;\n // This controls the number (and position) of the tick marks; you can either set the number of divisions (2 divisions would split the entire range in two halves), or the tick step (the distance between ticks) and the other value will be updated accordingly. Note: There is no check to see if labels coordinate with the tick marks, which may be confusing for users if the blue labels and black ticks are off-step.\n tickStep?: number | null;\n // The answer to a NumberLine widget is a set of real numbers.\n // `correctRel` expresses the relationship between the numbers in that set\n // and the value of `correctX`.\n correctRel?: \"eq\" | \"lt\" | \"gt\" | \"le\" | \"ge\";\n // This is the correct answer. The answer is validated (as right or wrong) by using only the end position of the point and the relation (=, <, >, ≤, ≥).\n correctX: number | null;\n // This controls the initial position of the point along the number line\n initialX?: number | null;\n // Show tooltips\n showTooltips?: boolean;\n // When true, the answer is displayed and is immutable\n static: boolean;\n};\n\nexport type PerseusOrdererWidgetOptions = {\n // All of the options available to the user. Place the cards in the correct order. The same card can be used more than once in the answer but will only be displayed once at the top of a stack of identical cards.\n options: PerseusRenderer[];\n // The correct order of the options\n correctOptions: PerseusRenderer[];\n // Cards that are not part of the answer\n otherOptions: PerseusRenderer[];\n // \"normal\" for text options. \"auto\" for image options.\n height: \"normal\" | \"auto\";\n // Use the \"horizontal\" layout for short text and small images. The \"vertical\" layout is best for longer text (e.g. proofs).\n layout: \"horizontal\" | \"vertical\";\n};\n\nexport type PerseusPassageWidgetOptions = {\n // Translatable Text; To add footnotes, add ^ characters where they belong in the passage. Then, add ^ in the footnotes area to reference the footnotes in the passage.\n footnotes: string;\n // Translatable Text; The text of the passage\n passageText: string;\n // translatableText - An optional title that will appear directly above the passage in the same font style. (e.g. Passage 1)\n passageTitle: string;\n // Should we show line numbers along with the passage?\n showLineNumbers: boolean;\n // Always false. Not used for this widget\n static: boolean;\n};\n\nexport type PerseusPassageRefWidgetOptions = {\n // The passage number\n passageNumber: number;\n // The reference number\n referenceNumber: number;\n // Short summary of the referenced section. This will be included in parentheses and quotes automatically.\n summaryText?: string;\n};\n\nexport const plotterPlotTypes = [\n \"bar\",\n \"line\",\n \"pic\",\n \"histogram\",\n \"dotplot\",\n] as const;\nexport type PlotType = (typeof plotterPlotTypes)[number];\n\nexport type PerseusPlotterWidgetOptions = {\n // Translatable Text; The Axis labels. e.g. [\"X Label\", \"Y Label\"]\n labels: string[];\n // Translatable Text; Categories to display along the X access. e.g. [\">0\", \">6\", \">12\", \">18\"]\n categories: string[];\n // The type of the graph. options \"bar\", \"line\", \"pic\", \"histogram\", \"dotplot\"\n type: PlotType;\n // The maximimum Y tick to display in the graph\n maxY: number;\n // The scale of the Y Axis\n scaleY: number;\n // Which ticks to display the labels for. For instance, setting this to \"4\" will only show every 4th label (plus the last one)\n labelInterval?: number | null;\n // Creates the specified number of divisions between the horizontal lines. Fewer snaps between lines makes the graph easier for the student to create correctly.\n snapsPerLine: number;\n // The Y values the graph should start with\n starting: number[];\n // The Y values that represent the correct answer expected\n correct: number[];\n // A picture to represent items in a graph.\n picUrl?: string | null;\n // deprecated\n picSize?: number | null;\n // deprecated\n picBoxHeight?: number | null;\n // deprecated\n plotDimensions: number[];\n};\n\nexport type PerseusRadioWidgetOptions = {\n // The choices provided to the user.\n choices: PerseusRadioChoice[];\n // Does this have a \"none of the above\" option?\n hasNoneOfTheAbove?: boolean;\n // If multipleSelect is enabled, Specify the number expected to be correct.\n countChoices?: boolean;\n // How many of the choices are correct, which is conditionally used to tell\n // learners ahead of time how many options they'll need.\n numCorrect?: number;\n // Randomize the order of the options or keep them as defined\n randomize?: boolean;\n // Does this set allow for multiple selections to be correct?\n multipleSelect?: boolean;\n // deprecated\n deselectEnabled?: boolean;\n};\n\nexport type PerseusRadioChoice = {\n // Translatable Markdown; The label for this choice\n content: string;\n /**\n * An opaque string that uniquely identifies this choice within\n * the radio widget. The format of this ID is subject to change.\n */\n id: string;\n // Translatable Markdown; Rationale to give the user when they get it wrong\n rationale?: string;\n // Whether this option is a correct answer or not\n correct?: boolean;\n // If this is none of the above, override the content with \"None of the above\"\n isNoneOfTheAbove?: boolean;\n};\n\nexport type PerseusSorterWidgetOptions = {\n // Translatable Text; The correct answer (in the correct order). The user will see the cards in a randomized order.\n correct: string[];\n // Adds padding to the options. Padding is good for text but not needed for images\n padding: boolean;\n // Use the \"horizontal\" layout for short text and small images. The \"vertical\" layout is best for longer text and larger images.\n layout: \"horizontal\" | \"vertical\";\n};\n\nexport type PerseusTableWidgetOptions = {\n // Translatable Text; A list of column headers\n headers: string[];\n // The number of rows to display\n rows: number;\n // The number of columns to display\n columns: number;\n // Translatable Text; A 2-dimensional array of text to populate the table with\n answers: string[][];\n};\n\nexport type PerseusInteractionWidgetOptions = {\n // The definition of the graph\n graph: PerseusInteractionGraph;\n // The elements of the graph\n elements: PerseusInteractionElement[];\n // Always false. Not used for this widget\n static: boolean;\n};\n\nexport type PerseusInteractionGraph = {\n // \"canvas\", \"graph\"\n editableSettings?: Array<\"canvas\" | \"graph\">;\n // The Grid Canvas size. e.g. [400, 140]\n box: Size;\n // The Axis labels. e.g. [\"x\", \"y\"]\n labels: string[];\n // The Axis ranges. e.g. [[-10, 10], [-10, 10]]\n range: [Interval, Interval];\n // The steps in the grid. default [1, 1]\n gridStep: [number, number];\n /**\n * The type of markings to display on the graph.\n */\n markings: MarkingsType;\n // The snap steps. default [0.5, 0.5]\n snapStep?: [number, number];\n // Whether the grid is valid or not. Do the numbers all make sense?\n // NOTE(jeremy) The editor for this widget sometimes stores the graph\n // editor validation error message into this field. It seems innocuous\n // because it looks like many of these usages don't actually use the graph\n // at all.\n valid?: boolean | string;\n // An optional background image to use\n backgroundImage?: PerseusImageBackground;\n // Whether to show the Protractor tool overlayed on top of the graph\n showProtractor?: boolean;\n // Whether to show the Ruler tool overlayed on top of the graph\n showRuler?: boolean;\n // The unit to show on the ruler. e.g. \"mm\", \"cm\", \"m\", \"km\", \"in\", \"ft\", \"yd\", \"mi\"\n rulerLabel?: string;\n // How many ticks to show on the ruler. e.g. 1, 2, 4, 8, 10, 16\n rulerTicks?: number;\n // This controls the number (and position) of the tick marks for the X and Y axis. e.g. [1, 1]\n tickStep: [number, number];\n};\n\nexport type PerseusInteractionElement =\n | {\n type: \"function\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionFunctionElementOptions;\n }\n | {\n type: \"label\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionLabelElementOptions;\n }\n | {\n type: \"line\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionLineElementOptions;\n }\n | {\n type: \"movable-line\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionMovableLineElementOptions;\n }\n | {\n type: \"movable-point\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionMovablePointElementOptions;\n }\n | {\n type: \"parametric\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionParametricElementOptions;\n }\n | {\n type: \"point\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionPointElementOptions;\n }\n | {\n type: \"rectangle\";\n // An identifier for the element\n key: string;\n options: PerseusInteractionRectangleElementOptions;\n };\n\nexport type PerseusInteractionFunctionElementOptions = {\n // The definition of the function to draw on the graph. e.g \"x^2 + 1\"\n value: string;\n // The name of the function like f(n). default: \"f\"\n funcName: string;\n // The range of points to start plotting\n rangeMin: string;\n // The range of points to end plotting\n rangeMax: string;\n // The color of the stroke. e.g. #6495ED\n color: string;\n // If the function stroke has a dash, what is it? options: \"\", \"-\", \"- \", \".\", \". \"\n strokeDasharray: string;\n // The thickness of the stroke\n strokeWidth: number;\n};\n\nexport type PerseusInteractionLabelElementOptions = {\n // Translatable Text; the content of the label\n label: string;\n // The color of the label. e.g. \"red\"\n color: string;\n // The X location of the label\n coordX: string;\n // The Y location of the label\n coordY: string;\n};\n\nexport type PerseusInteractionLineElementOptions = {\n // A color code for the line segment. e.g. \"#FFOOAF\"\n color: string;\n // The start of the line segment (X)\n startX: string;\n // The start of the line segment (Y)\n startY: string;\n // The end of the line segment (X)\n endX: string;\n // The end of the line segment (Y)\n endY: string;\n // If the line stroke has a dash, what is it? options: \"\", \"-\", \"- \", \".\", \". \"\n strokeDasharray: string;\n // The thickness of the line\n strokeWidth: number;\n // Does the line have an arrow point to it? options: \"\", \"->\"\n arrows: string;\n};\n\nexport type PerseusInteractionMovableLineElementOptions = {\n // The start of the line segment (X)\n startX: string;\n // The start of the line segment (Y)\n startY: string;\n // Start updates (Xn, Yn) for n\n startSubscript: number;\n // The end of the line segment (X)\n endX: string;\n // The end of the line segment (Y)\n endY: string;\n // End updates (Xm, Ym) for m\n endSubscript: number;\n // How to constrain this line? options \"none\", \"snap\", \"x\", \"y\"\n constraint: string;\n // The snap resolution when constraint is set to \"snap\"\n snap: number;\n // The constraint function for when constraint is set to \"x\" or \"y\"\n constraintFn: string;\n // The lowest possible X value\n constraintXMin: string;\n // The highest possible X value\n constraintXMax: string;\n // The lowest possible Y value\n constraintYMin: string;\n // The highest possible Y value\n constraintYMax: string;\n};\n\nexport type PerseusInteractionMovablePointElementOptions = {\n // The X position of the point\n startX: string;\n // The Y position of the point\n startY: string;\n // Update (Xn, Yn) for n\n varSubscript: number;\n // How to constrain this line? options \"none\", \"snap\", \"x\", \"y\"\n constraint: string;\n // The snap resolution when constraint is set to \"snap\"\n snap: number;\n // The constraint function for when constraint is set to \"x\" or \"y\"\n constraintFn: string;\n // The lowest possible X value\n constraintXMin: string;\n // The highest possible X value\n constraintXMax: string;\n // The lowest possible Y value\n constraintYMin: string;\n // The highest possible Y value\n constraintYMax: string;\n};\n\nexport type PerseusInteractionParametricElementOptions = {\n // The function for the X coordinate. e.g. \"\\\\cos(t)\"\n x: string;\n // The function for the Y coordinate. e.g. \"\\\\sin(t)\"\n y: string;\n // The range of points to start plotting\n rangeMin: string;\n // The range of points to end plotting\n rangeMax: string;\n // The color of the stroke. e.g. #6495ED\n color: string;\n // If the function stroke has a dash, what is it? options: \"\", \"-\", \"- \", \".\", \". \"\n strokeDasharray: string;\n // The thickness of the stroke\n strokeWidth: number;\n};\n\nexport type PerseusInteractionPointElementOptions = {\n // The color of the point. e.g. \"black\"\n color: string;\n // The X coordinate of the point\n coordX: string;\n // The Y coordinate of the point\n coordY: string;\n};\n\nexport type PerseusInteractionRectangleElementOptions = {\n // The fill color. e.g. \"#EDD19B\"\n color: string;\n // The lower left point X\n coordX: string;\n // The lower left point Y\n coordY: string;\n // The width of the rectangle\n width: string;\n // The height of the rectangle\n height: string;\n};\n\nexport type PerseusCSProgramWidgetOptions = {\n // The ID of the CS program to embed\n programID: string;\n // Deprecated. Always null and sometimes omitted entirely.\n programType?: any;\n // Settings that you add here are available to the program as an object returned by Program.settings()\n settings: PerseusCSProgramSetting[];\n // If you show the editor, you should use the \"full-width\" alignment to make room for the width of the editor.\n showEditor: boolean;\n // Whether to show the execute buttons\n showButtons: boolean;\n // The height of the widget\n height: number;\n // TODO(benchristel): static is not used. Delete it?\n // Always false\n static: boolean;\n};\n\nexport type PerseusCSProgramSetting = {\n // The name/key of the setting\n name: string;\n // The value of the setting\n value: string;\n};\n\nexport type PerseusPythonProgramWidgetOptions = {\n // The ID of the Python program to embed\n programID: string;\n // The height of the widget in pixels\n height: number;\n};\n\n// This is an object instead of just a string because we think we'll want to add more\n// fields in the future, like a weight, which would allow us to give partial credit\n// and weight each criterion separately.\nexport type PerseusFreeResponseWidgetScoringCriterion = {\n // An English-language description of how to score the response for this criterion.\n text: string;\n};\n\nexport type PerseusFreeResponseWidgetOptions = {\n // Whether to allow the user to enter an unlimited number of characters.\n allowUnlimitedCharacters: boolean;\n // The maximum number of characters that the user can enter.\n characterLimit: number;\n // The placeholder text that will be displayed to the user in the text input field.\n placeholder: string;\n // The question text that will be displayed to the user.\n question: string;\n // A list of scoring criteria for the free response question. This is a list\n // of things the answer should contain to be considered correct.\n scoringCriteria: ReadonlyArray<PerseusFreeResponseWidgetScoringCriterion>;\n};\n\nexport type PerseusIFrameWidgetOptions = {\n // A URL to display OR a CS Program ID\n url: string;\n // Settings that you add here are available to the program as an object returned by Program.settings()\n settings?: PerseusCSProgramSetting[];\n // The width of the widget\n width: number | string;\n // The height of the widget\n height: number | string;\n // Whether to allow the IFrame to become full-screen (like a video)\n allowFullScreen: boolean;\n // Whether to allow the iframe content to redirect the page\n allowTopNavigation?: boolean;\n // Always false\n static: boolean;\n};\n\nexport type PerseusPhetSimulationWidgetOptions = {\n // A URL to display, must start with https://phet.colorado.edu/\n url: string;\n // Translatable Text; Description of the sim for Khanmigo and alt text\n description: string;\n};\n\nexport type PerseusVideoWidgetOptions = {\n location: string;\n static?: boolean;\n};\n\nexport type PerseusInputNumberWidgetOptions = {\n answerType?:\n | \"number\"\n | \"decimal\"\n | \"integer\"\n | \"rational\"\n | \"improper\"\n | \"mixed\"\n | \"percent\"\n | \"pi\";\n inexact?: boolean;\n maxError?: number | string;\n rightAlign?: boolean;\n simplify: \"required\" | \"optional\" | \"enforced\";\n size: \"normal\" | \"small\";\n value: string | number;\n customKeypad?: boolean;\n};\n\nexport type PerseusMoleculeRendererWidgetOptions = {\n widgetId: string;\n rotationAngle?: number;\n smiles?: string;\n};\n\nexport type PerseusPassageRefTargetWidgetOptions = {\n content: string;\n};\n\nexport type PerseusWidgetOptions =\n | PerseusCategorizerWidgetOptions\n | PerseusCSProgramWidgetOptions\n | PerseusDefinitionWidgetOptions\n | PerseusDropdownWidgetOptions\n | PerseusExplanationWidgetOptions\n | PerseusExpressionWidgetOptions\n | PerseusFreeResponseWidgetOptions\n | PerseusGradedGroupSetWidgetOptions\n | PerseusGradedGroupWidgetOptions\n | PerseusIFrameWidgetOptions\n | PerseusImageWidgetOptions\n | PerseusInputNumberWidgetOptions\n | PerseusInteractionWidgetOptions\n | PerseusInteractiveGraphWidgetOptions\n | PerseusLabelImageWidgetOptions\n | PerseusMatcherWidgetOptions\n | PerseusMatrixWidgetOptions\n | PerseusMeasurerWidgetOptions\n | PerseusMoleculeRendererWidgetOptions\n | PerseusNumberLineWidgetOptions\n | PerseusNumericInputWidgetOptions\n | PerseusOrdererWidgetOptions\n | PerseusPassageRefTargetWidgetOptions\n | PerseusPassageRefWidgetOptions\n | PerseusPassageWidgetOptions\n | PerseusPhetSimulationWidgetOptions\n | PerseusPlotterWidgetOptions\n | PerseusRadioWidgetOptions\n | PerseusSorterWidgetOptions\n | PerseusTableWidgetOptions\n | PerseusVideoWidgetOptions;\n","import {lockedFigureColorNames} from \"../../data-schema\";\nimport {\n array,\n boolean,\n constant,\n enumeration,\n nullable,\n number,\n object,\n optional,\n pair,\n pipeParsers,\n string,\n trio,\n union,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\nimport {discriminatedUnionOn} from \"../general-purpose-parsers/discriminated-union\";\n\nimport {parsePerseusImageBackground} from \"./perseus-image-background\";\nimport {parseWidget} from \"./widget\";\n\nimport type {PerseusGraphTypeLinear} from \"../../data-schema\";\n\n// Used to represent 2-D points and ranges\nconst pairOfNumbers = pair(number, number);\n\nconst parsePerseusGraphTypeAngle = object({\n type: constant(\"angle\"),\n showAngles: optional(boolean),\n allowReflexAngles: optional(boolean),\n angleOffsetDeg: optional(number),\n snapDegrees: optional(number),\n match: optional(constant(\"congruent\")),\n coords: optional(trio(pairOfNumbers, pairOfNumbers, pairOfNumbers)),\n startCoords: optional(trio(pairOfNumbers, pairOfNumbers, pairOfNumbers)),\n});\n\nconst parsePerseusGraphTypeCircle = object({\n type: constant(\"circle\"),\n center: optional(pairOfNumbers),\n radius: optional(number),\n startCoords: optional(\n object({\n center: pairOfNumbers,\n radius: number,\n }),\n ),\n});\n\nconst parsePerseusGraphTypeLinear = object({\n type: constant(\"linear\"),\n coords: optional(nullable(pair(pairOfNumbers, pairOfNumbers))),\n startCoords: optional(pair(pairOfNumbers, pairOfNumbers)),\n});\n\nconst parsePerseusGraphTypeLinearSystem = object({\n type: constant(\"linear-system\"),\n // TODO(benchristel): default coords to empty array?\n coords: optional(nullable(array(pair(pairOfNumbers, pairOfNumbers)))),\n startCoords: optional(array(pair(pairOfNumbers, pairOfNumbers))),\n});\n\nconst parsePerseusGraphTypeNone = object({\n type: constant(\"none\"),\n});\n\nconst parsePerseusGraphTypePoint = object({\n type: constant(\"point\"),\n numPoints: optional(union(number).or(constant(\"unlimited\")).parser),\n coords: optional(nullable(array(pairOfNumbers))),\n startCoords: optional(array(pairOfNumbers)),\n coord: optional(pairOfNumbers),\n});\n\nconst parsePerseusGraphTypePolygon = object({\n type: constant(\"polygon\"),\n numSides: optional(union(number).or(constant(\"unlimited\")).parser),\n showAngles: optional(boolean),\n showSides: optional(boolean),\n snapTo: optional(enumeration(\"grid\", \"angles\", \"sides\")),\n match: optional(enumeration(\"similar\", \"congruent\", \"approx\", \"exact\")),\n startCoords: optional(array(pairOfNumbers)),\n coords: optional(nullable(array(pairOfNumbers))),\n});\n\nconst parsePerseusGraphTypeQuadratic = object({\n type: constant(\"quadratic\"),\n coords: optional(\n nullable(trio(pairOfNumbers, pairOfNumbers, pairOfNumbers)),\n ),\n startCoords: optional(trio(pairOfNumbers, pairOfNumbers, pairOfNumbers)),\n});\n\nconst parsePerseusGraphTypeRay = object({\n type: constant(\"ray\"),\n coords: optional(nullable(pair(pairOfNumbers, pairOfNumbers))),\n startCoords: optional(pair(pairOfNumbers, pairOfNumbers)),\n});\n\nconst parsePerseusGraphTypeSegment = object({\n type: constant(\"segment\"),\n // TODO(benchristel): default numSegments?\n numSegments: optional(number),\n coords: optional(nullable(array(pair(pairOfNumbers, pairOfNumbers)))),\n startCoords: optional(array(pair(pairOfNumbers, pairOfNumbers))),\n});\n\nconst parsePerseusGraphTypeSinusoid = object({\n type: constant(\"sinusoid\"),\n coords: optional(nullable(array(pairOfNumbers))),\n startCoords: optional(array(pairOfNumbers)),\n});\n\nexport const parsePerseusGraphType = discriminatedUnionOn(\"type\")\n .withBranch(\"angle\", parsePerseusGraphTypeAngle)\n .withBranch(\"circle\", parsePerseusGraphTypeCircle)\n .withBranch(\"linear\", parsePerseusGraphTypeLinear)\n .withBranch(\"linear-system\", parsePerseusGraphTypeLinearSystem)\n .withBranch(\"none\", parsePerseusGraphTypeNone)\n .withBranch(\"point\", parsePerseusGraphTypePoint)\n .withBranch(\"polygon\", parsePerseusGraphTypePolygon)\n .withBranch(\"quadratic\", parsePerseusGraphTypeQuadratic)\n .withBranch(\"ray\", parsePerseusGraphTypeRay)\n .withBranch(\"segment\", parsePerseusGraphTypeSegment)\n .withBranch(\"sinusoid\", parsePerseusGraphTypeSinusoid).parser;\n\nconst parseLockedFigureColor = enumeration(...lockedFigureColorNames);\n\nconst parseLockedFigureFillType = enumeration(\n \"none\",\n \"white\",\n \"translucent\",\n \"solid\",\n);\n\nconst parseLockedLineStyle = enumeration(\"solid\", \"dashed\");\n\nexport const parseStrokeWeight = defaulted(\n enumeration(\"medium\", \"thin\", \"thick\"),\n () => \"medium\" as const,\n);\n\nconst parseLockedLabelType = object({\n type: constant(\"label\"),\n coord: pairOfNumbers,\n text: string,\n color: parseLockedFigureColor,\n size: enumeration(\"small\", \"medium\", \"large\"),\n});\n\nconst parseLockedPointType = object({\n type: constant(\"point\"),\n coord: pairOfNumbers,\n color: parseLockedFigureColor,\n filled: boolean,\n labels: defaulted(array(parseLockedLabelType), () => []),\n ariaLabel: optional(string),\n});\n\nconst parseLockedLineType = object({\n type: constant(\"line\"),\n kind: enumeration(\"line\", \"ray\", \"segment\"),\n points: pair(parseLockedPointType, parseLockedPointType),\n color: parseLockedFigureColor,\n lineStyle: parseLockedLineStyle,\n showPoint1: defaulted(boolean, () => false),\n showPoint2: defaulted(boolean, () => false),\n weight: parseStrokeWeight,\n labels: defaulted(array(parseLockedLabelType), () => []),\n ariaLabel: optional(string),\n});\n\nconst parseLockedVectorType = object({\n type: constant(\"vector\"),\n points: pair(pairOfNumbers, pairOfNumbers),\n color: parseLockedFigureColor,\n weight: parseStrokeWeight,\n labels: defaulted(array(parseLockedLabelType), () => []),\n ariaLabel: optional(string),\n});\n\nconst parseLockedEllipseType = object({\n type: constant(\"ellipse\"),\n center: pairOfNumbers,\n radius: pairOfNumbers,\n angle: number,\n color: parseLockedFigureColor,\n fillStyle: parseLockedFigureFillType,\n strokeStyle: parseLockedLineStyle,\n weight: parseStrokeWeight,\n labels: defaulted(array(parseLockedLabelType), () => []),\n ariaLabel: optional(string),\n});\n\nconst parseLockedPolygonType = object({\n type: constant(\"polygon\"),\n points: array(pairOfNumbers),\n color: parseLockedFigureColor,\n showVertices: boolean,\n fillStyle: parseLockedFigureFillType,\n strokeStyle: parseLockedLineStyle,\n weight: parseStrokeWeight,\n labels: defaulted(array(parseLockedLabelType), () => []),\n ariaLabel: optional(string),\n});\n\n// Exported for testing.\nexport const parseLockedFunctionDomain = defaulted(\n pair(\n defaulted(number, () => -Infinity),\n defaulted(number, () => Infinity),\n ),\n (): [number, number] => [-Infinity, Infinity],\n);\n\nconst parseLockedFunctionType = object({\n type: constant(\"function\"),\n color: parseLockedFigureColor,\n strokeStyle: parseLockedLineStyle,\n weight: parseStrokeWeight,\n equation: string,\n directionalAxis: enumeration(\"x\", \"y\"),\n domain: parseLockedFunctionDomain,\n labels: defaulted(array(parseLockedLabelType), () => []),\n ariaLabel: optional(string),\n});\n\nconst parseLockedFigure = discriminatedUnionOn(\"type\")\n .withBranch(\"point\", parseLockedPointType)\n .withBranch(\"line\", parseLockedLineType)\n .withBranch(\"vector\", parseLockedVectorType)\n .withBranch(\"ellipse\", parseLockedEllipseType)\n .withBranch(\"polygon\", parseLockedPolygonType)\n .withBranch(\"function\", parseLockedFunctionType)\n .withBranch(\"label\", parseLockedLabelType).parser;\n\nconst parseLabelLocation = union(enumeration(\"onAxis\", \"alongEdge\")).or(\n // If the labelLocation is an empty string, we default to \"onAxis\".\n pipeParsers(constant(\"\")).then(convert(() => \"onAxis\" as const)).parser,\n).parser;\n\nexport const parseInteractiveGraphWidget = parseWidget(\n constant(\"interactive-graph\"),\n object({\n step: pairOfNumbers,\n // TODO(benchristel): rather than making gridStep and snapStep\n // optional, we should duplicate the defaulting logic from the\n // InteractiveGraph component. See parse-perseus-json/README.md for\n // why.\n gridStep: optional(pairOfNumbers),\n snapStep: optional(pairOfNumbers),\n backgroundImage: optional(parsePerseusImageBackground),\n markings: enumeration(\"graph\", \"grid\", \"none\", \"axes\"),\n labels: optional(array(string)),\n labelLocation: optional(parseLabelLocation),\n showProtractor: boolean,\n showRuler: optional(boolean),\n showTooltips: optional(boolean),\n rulerLabel: optional(string),\n rulerTicks: optional(number),\n range: pair(pairOfNumbers, pairOfNumbers),\n showAxisArrows: defaulted(\n object({\n xMin: boolean,\n xMax: boolean,\n yMin: boolean,\n yMax: boolean,\n }),\n () => ({\n xMin: true,\n xMax: true,\n yMin: true,\n yMax: true,\n }),\n ),\n // NOTE(benchristel): I copied the default graph from\n // interactive-graph.tsx. See the parse-perseus-json/README.md for\n // an explanation of why we want to duplicate the default here.\n graph: defaulted(\n parsePerseusGraphType,\n (): PerseusGraphTypeLinear => ({\n type: \"linear\" as const,\n }),\n ),\n correct: defaulted(\n parsePerseusGraphType,\n (): PerseusGraphTypeLinear => ({\n type: \"linear\" as const,\n }),\n ),\n lockedFigures: defaulted(array(parseLockedFigure), () => []),\n fullGraphAriaLabel: optional(string),\n fullGraphAriaDescription: optional(string),\n }),\n);\n","import {\n array,\n boolean,\n constant,\n number,\n object,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseLabelImageWidget = parseWidget(\n constant(\"label-image\"),\n object({\n choices: array(string),\n imageUrl: string,\n imageAlt: string,\n imageHeight: number,\n imageWidth: number,\n markers: array(\n object({\n answers: array(string),\n label: string,\n x: number,\n y: number,\n }),\n ),\n hideChoicesFromInstructions: boolean,\n multipleAnswers: boolean,\n static: defaulted(boolean, () => false),\n }),\n);\n","import {\n array,\n boolean,\n constant,\n object,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nimport type {ParsedValue} from \"../parser-types\";\n\nconst matcherOptions = object({\n labels: array(string),\n left: array(string),\n right: array(string),\n orderMatters: boolean,\n padding: boolean,\n});\n\nfunction getDefaultOptions(): ParsedValue<typeof matcherOptions> {\n // NOTE(benchristel): I copied these default values from the ones used\n // in the editor. See parse-perseus-json/README.md for why we want to\n // duplicate the defaults here.\n return {\n left: [\"$x$\", \"$y$\", \"$z$\"],\n right: [\"$1$\", \"$2$\", \"$3$\"],\n labels: [\"test\", \"label\"],\n orderMatters: false,\n padding: true,\n };\n}\n\nexport const parseMatcherWidget = parseWidget(\n constant(\"matcher\"),\n defaulted(matcherOptions, getDefaultOptions),\n);\n","import {\n array,\n boolean,\n constant,\n number,\n object,\n optional,\n pipeParsers,\n string,\n union,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\nimport {stringToNumber} from \"../general-purpose-parsers/string-to-number\";\n\nimport {parseWidget} from \"./widget\";\n\nconst numberOrString = union(number).or(string).parser;\nconst numeric = pipeParsers(defaulted(numberOrString, () => NaN)).then(\n stringToNumber,\n).parser;\n\nexport const parseMatrixWidget = parseWidget(\n defaulted(constant(\"matrix\"), () => \"matrix\" as const),\n object({\n prefix: optional(string),\n suffix: optional(string),\n answers: defaulted(array(array(numeric)), () => []),\n cursorPosition: optional(array(number)),\n matrixBoardSize: array(number),\n static: optional(boolean),\n }),\n);\n","import {\n boolean,\n constant,\n number,\n object,\n pair,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parsePerseusImageBackground} from \"./perseus-image-background\";\nimport {parseWidget} from \"./widget\";\n\nexport const parseMeasurerWidget = parseWidget(\n constant(\"measurer\"),\n object({\n // The default value for image comes from measurer.tsx.\n // See parse-perseus-json/README.md for why we want to duplicate the\n // defaults here.\n image: defaulted(parsePerseusImageBackground, () => ({\n url: null,\n top: 0,\n left: 0,\n })),\n showProtractor: boolean,\n showRuler: boolean,\n rulerLabel: string,\n rulerTicks: number,\n rulerPixels: number,\n rulerLength: number,\n box: pair(number, number),\n }),\n);\n","import {\n constant,\n object,\n string,\n number,\n optional,\n} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseMoleculeRendererWidget = parseWidget(\n constant(\"molecule-renderer\"),\n object({\n widgetId: string,\n rotationAngle: optional(number),\n smiles: optional(string),\n }),\n);\n","import {\n constant,\n object,\n array,\n number,\n string,\n boolean,\n optional,\n nullable,\n pipeParsers,\n union,\n enumeration,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nconst emptyStringToNull = pipeParsers(constant(\"\")).then(\n convert(() => null),\n).parser;\n\nexport const parseNumberLineWidget = parseWidget(\n constant(\"number-line\"),\n object({\n // TODO(LEMS-3081): change `range` to `pair(number, number)` and update the related types\n // in data-schema.ts and number-line.tsx.\n range: array(number),\n labelRange: array(nullable(union(number).or(emptyStringToNull).parser)),\n labelStyle: string,\n labelTicks: boolean,\n // NOTE(matthewcurtis): I copied the default isTickCtrl from\n // number-line.tsx. See the parse-perseus-json/README.md for\n // an explanation of why we want to duplicate the default here.\n isTickCtrl: defaulted(boolean, () => false),\n isInequality: defaulted(boolean, () => false),\n divisionRange: array(number),\n numDivisions: optional(nullable(number)),\n // NOTE(benchristel): I copied the default snapDivisions from\n // number-line.tsx. See the parse-perseus-json/README.md for\n // an explanation of why we want to duplicate the default here.\n snapDivisions: defaulted(number, () => 2),\n tickStep: optional(nullable(number)),\n correctRel: defaulted(\n optional(enumeration(\"eq\", \"lt\", \"gt\", \"le\", \"ge\")),\n // Convert null to undefined:\n () => undefined,\n ),\n correctX: defaulted(nullable(number), () => null),\n initialX: optional(nullable(number)),\n showTooltips: optional(boolean),\n static: defaulted(boolean, () => false),\n }),\n);\n","import {\n constant,\n object,\n array,\n string,\n number,\n optional,\n enumeration,\n boolean,\n nullable,\n union,\n pipeParsers,\n} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nconst parseMathFormat = enumeration(\n \"integer\",\n \"mixed\",\n \"improper\",\n \"proper\",\n \"decimal\",\n \"percent\",\n \"pi\",\n);\n\nexport const parseSimplify = pipeParsers(\n union(constant(null))\n .or(constant(undefined))\n .or(boolean)\n .or(constant(\"true\"))\n .or(constant(\"required\"))\n .or(constant(\"correct\"))\n .or(constant(\"enforced\"))\n .or(constant(\"optional\"))\n .or(constant(\"accepted\")).parser,\n).then(convert(deprecatedSimplifyValuesToRequired)).parser;\n\nfunction deprecatedSimplifyValuesToRequired(\n simplify:\n | null\n | undefined\n | boolean\n | \"true\"\n | \"required\"\n | \"correct\"\n | \"enforced\"\n | \"optional\"\n | \"accepted\",\n): \"enforced\" | \"required\" | \"optional\" {\n switch (simplify) {\n case \"enforced\":\n case \"required\":\n case \"optional\":\n return simplify;\n // NOTE(benchristel): \"accepted\", \"correct\", \"true\", true, false,\n // undefined, and null are all treated the same as \"required\" during\n // scoring, so we convert them to \"required\" here to preserve\n // behavior. See the tests in score-numeric-input.test.ts.\n default:\n return \"required\";\n }\n}\n\nexport const parseNumericInputWidget = parseWidget(\n constant(\"numeric-input\"),\n object({\n answers: array(\n object({\n message: defaulted(string, () => \"\"),\n // TODO(benchristel): value should never be null or undefined,\n // but we have some content where it is anyway. If we backfill\n // the data, simplify this.\n value: optional(nullable(number)),\n status: string,\n answerForms: defaulted(\n optional(array(parseMathFormat)),\n () => undefined,\n ),\n strict: defaulted(boolean, () => false),\n maxError: optional(nullable(number)),\n // TODO(benchristel): simplify should never be a boolean, but we\n // have some content where it is anyway. If we ever backfill\n // the data, we should simplify `simplify`.\n simplify: parseSimplify,\n }),\n ),\n labelText: optional(string),\n size: string,\n coefficient: defaulted(boolean, () => false),\n rightAlign: optional(boolean),\n static: defaulted(boolean, () => false),\n answerForms: optional(\n array(\n object({\n name: parseMathFormat,\n simplify: parseSimplify,\n }),\n ),\n ),\n }),\n);\n","import {\n array,\n constant,\n enumeration,\n object,\n pipeParsers,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parsePerseusRenderer} from \"./perseus-renderer\";\nimport {parseWidget} from \"./widget\";\n\nimport type {PartialParser} from \"../parser-types\";\n\n// There is an import cycle between orderer-widget.ts and perseus-renderer.ts.\n// This wrapper ensures that we don't refer to parsePerseusRenderer before\n// it's defined.\nfunction parseRenderer(rawValue, ctx) {\n return parsePerseusRenderer(rawValue, ctx);\n}\n\nconst largeToAuto: PartialParser<\n \"normal\" | \"auto\" | \"large\",\n \"normal\" | \"auto\"\n> = (height, ctx) => {\n if (height === \"large\") {\n return ctx.success(\"auto\");\n }\n return ctx.success(height);\n};\n\nexport const parseOrdererWidget = parseWidget(\n constant(\"orderer\"),\n object({\n options: defaulted(array(parseRenderer), () => []),\n correctOptions: defaulted(array(parseRenderer), () => []),\n otherOptions: defaulted(array(parseRenderer), () => []),\n height: pipeParsers(enumeration(\"normal\", \"auto\", \"large\")).then(\n largeToAuto,\n ).parser,\n layout: defaulted(\n enumeration(\"horizontal\", \"vertical\"),\n () => \"horizontal\" as const,\n ),\n }),\n);\n","import {\n constant,\n object,\n string,\n number,\n optional,\n} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parsePassageRefWidget = parseWidget(\n constant(\"passage-ref\"),\n object({\n passageNumber: number,\n referenceNumber: number,\n summaryText: optional(string),\n }),\n);\n","import {constant, object, string, boolean} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parsePassageWidget = parseWidget(\n constant(\"passage\"),\n object({\n footnotes: defaulted(string, () => \"\"),\n passageText: string,\n passageTitle: defaulted(string, () => \"\"),\n showLineNumbers: boolean,\n static: defaulted(boolean, () => false),\n }),\n);\n","import {constant, object, string} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parsePhetSimulationWidget = parseWidget(\n constant(\"phet-simulation\"),\n object({\n url: string,\n description: string,\n }),\n);\n","import {plotterPlotTypes} from \"../../data-schema\";\nimport {\n constant,\n object,\n string,\n array,\n number,\n optional,\n nullable,\n enumeration,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parsePlotterWidget = parseWidget(\n constant(\"plotter\"),\n object({\n labels: array(string),\n categories: array(string),\n type: enumeration(...plotterPlotTypes),\n maxY: number,\n // The default value for scaleY comes from plotter.tsx.\n // See parse-perseus-json/README.md for why we want to duplicate the\n // defaults here.\n scaleY: defaulted(number, () => 1),\n labelInterval: optional(nullable(number)),\n // The default value for snapsPerLine comes from plotter.tsx.\n // See parse-perseus-json/README.md for why we want to duplicate the\n // defaults here.\n snapsPerLine: defaulted(number, () => 2),\n starting: array(number),\n correct: defaulted(array(number), () => []),\n picUrl: optional(nullable(string)),\n picSize: optional(nullable(number)),\n picBoxHeight: optional(nullable(number)),\n // NOTE(benchristel): I copied the default plotDimensions from\n // plotter.tsx. See the parse-perseus-json/README.md for an explanation\n // of why we want to duplicate the defaults here.\n plotDimensions: defaulted(array(number), () => [380, 300]),\n }),\n);\n","import {constant, object, string, number} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parsePythonProgramWidget = parseWidget(\n constant(\"python-program\"),\n object({\n programID: string,\n height: number,\n }),\n);\n","interface Choice {\n correct?: boolean;\n}\n\nexport function deriveNumCorrect(choices: Choice[]) {\n return choices.filter((c) => c.correct).length;\n}\n","import {deriveNumCorrect} from \"../../widgets/radio/derive-num-correct\";\nimport {\n any,\n array,\n arrayWithIndex,\n boolean,\n constant,\n defaultedNonEmptyString,\n number,\n object,\n optional,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {versionedWidgetOptions} from \"./versioned-widget-options\";\nimport {parseWidgetWithVersion} from \"./widget\";\nimport {parseWidgetsMap} from \"./widgets-map\";\n\nimport type {ParsedValue} from \"../parser-types\";\n\nconst parseWidgetsMapOrUndefined = defaulted(\n // There is an import cycle between radio-widget.ts and\n // widgets-map.ts. The anonymous function below ensures that we\n // don't refer to parseWidgetsMap before it's defined.\n optional((rawVal, ctx) => parseWidgetsMap(rawVal, ctx)),\n () => undefined,\n);\n\nfunction getDefaultOptions() {\n // See parse-perseus-json/README.md for why we want these defaults here.\n return {\n choices: [\n {content: \"\", id: generateChoiceId(0)},\n {content: \"\", id: generateChoiceId(1)},\n {content: \"\", id: generateChoiceId(2)},\n {content: \"\", id: generateChoiceId(3)},\n ],\n };\n}\n\nconst parseOnePerLine = defaulted(optional(boolean), () => undefined);\nconst parseNoneOfTheAbove = defaulted(\n optional(constant(false)),\n () => undefined,\n);\n\nfunction generateChoiceId(index: number): string {\n return `radio-choice-${index}`;\n}\n\nconst version3 = optional(object({major: constant(3), minor: number}));\nconst parseRadioWidgetV3 = parseWidgetWithVersion(\n version3,\n constant(\"radio\"),\n object({\n numCorrect: optional(number),\n choices: arrayWithIndex((index) =>\n object({\n content: defaulted(string, () => \"\"),\n rationale: optional(string),\n correct: optional(boolean),\n isNoneOfTheAbove: optional(boolean),\n id: defaultedNonEmptyString(() => generateChoiceId(index)),\n }),\n ),\n hasNoneOfTheAbove: optional(boolean),\n countChoices: optional(boolean),\n randomize: optional(boolean),\n multipleSelect: optional(boolean),\n deselectEnabled: optional(boolean),\n }),\n);\n\nconst version2 = optional(object({major: constant(2), minor: number}));\nconst parseRadioWidgetV2 = parseWidgetWithVersion(\n version2,\n constant(\"radio\"),\n defaulted(\n object({\n numCorrect: optional(number),\n choices: array(\n object({\n content: defaulted(string, () => \"\"),\n clue: optional(string),\n correct: optional(boolean),\n isNoneOfTheAbove: optional(boolean),\n // deprecated\n widgets: parseWidgetsMapOrUndefined,\n }),\n ),\n hasNoneOfTheAbove: optional(boolean),\n countChoices: optional(boolean),\n randomize: optional(boolean),\n multipleSelect: optional(boolean),\n deselectEnabled: optional(boolean),\n // deprecated\n onePerLine: parseOnePerLine,\n // deprecated\n displayCount: optional(any),\n // v0 props\n // `noneOfTheAbove` is still in use (but only set to `false`).\n noneOfTheAbove: parseNoneOfTheAbove,\n }),\n getDefaultOptions,\n ),\n);\n\nconst version1 = optional(object({major: constant(1), minor: number}));\nconst parseRadioWidgetV1 = parseWidgetWithVersion(\n version1,\n constant(\"radio\"),\n defaulted(\n object({\n choices: array(\n object({\n content: defaulted(string, () => \"\"),\n clue: optional(string),\n correct: optional(boolean),\n isNoneOfTheAbove: optional(boolean),\n // deprecated\n widgets: parseWidgetsMapOrUndefined,\n }),\n ),\n hasNoneOfTheAbove: optional(boolean),\n countChoices: optional(boolean),\n randomize: optional(boolean),\n multipleSelect: optional(boolean),\n deselectEnabled: optional(boolean),\n // deprecated\n onePerLine: parseOnePerLine,\n // deprecated\n displayCount: optional(any),\n // v0 props\n // `noneOfTheAbove` is still in use (but only set to `false`).\n noneOfTheAbove: parseNoneOfTheAbove,\n }),\n getDefaultOptions,\n ),\n);\n\nconst version0 = optional(object({major: constant(0), minor: number}));\nconst parseRadioWidgetV0 = parseWidgetWithVersion(\n version0,\n constant(\"radio\"),\n defaulted(\n object({\n choices: array(\n object({\n content: defaulted(string, () => \"\"),\n clue: optional(string),\n correct: optional(boolean),\n isNoneOfTheAbove: optional(boolean),\n // deprecated\n widgets: parseWidgetsMapOrUndefined,\n }),\n ),\n hasNoneOfTheAbove: optional(boolean),\n countChoices: optional(boolean),\n randomize: optional(boolean),\n multipleSelect: optional(boolean),\n deselectEnabled: optional(boolean),\n // deprecated\n onePerLine: parseOnePerLine,\n // deprecated\n displayCount: optional(any),\n // v0 props\n // `noneOfTheAbove` is still in use (but only set to `false`).\n noneOfTheAbove: parseNoneOfTheAbove,\n }),\n getDefaultOptions,\n ),\n);\n\n// migrate functions\nexport function migrateV2toV3(\n widget: ParsedValue<typeof parseRadioWidgetV2>,\n): ParsedValue<typeof parseRadioWidgetV3> {\n const {options} = widget;\n return {\n ...widget,\n version: {major: 3, minor: 0},\n options: {\n numCorrect: options.numCorrect,\n hasNoneOfTheAbove: options.hasNoneOfTheAbove,\n countChoices: options.countChoices,\n randomize: options.randomize,\n multipleSelect: options.multipleSelect,\n deselectEnabled: options.deselectEnabled,\n choices: options.choices.map((choice, index) => ({\n content: choice.content,\n rationale: choice[\"rationale\"] || choice.clue,\n correct: choice.correct,\n isNoneOfTheAbove: choice.isNoneOfTheAbove,\n id: generateChoiceId(index),\n })),\n },\n };\n}\n\nexport function migrateV1ToV2(\n widget: ParsedValue<typeof parseRadioWidgetV1>,\n): ParsedValue<typeof parseRadioWidgetV2> {\n const {options} = widget;\n return {\n ...widget,\n version: {major: 2, minor: 0},\n options: {\n ...options,\n numCorrect: deriveNumCorrect(options.choices),\n },\n };\n}\n\nexport function migrateV0ToV1(\n widget: ParsedValue<typeof parseRadioWidgetV0>,\n): ParsedValue<typeof parseRadioWidgetV1> {\n const {options} = widget;\n const {noneOfTheAbove: _, ...rest} = options;\n return {\n ...widget,\n version: {major: 1, minor: 0},\n options: {\n ...rest,\n hasNoneOfTheAbove: false,\n noneOfTheAbove: undefined,\n },\n };\n}\n\nexport const parseRadioWidget = versionedWidgetOptions(3, parseRadioWidgetV3)\n .withMigrationFrom(2, parseRadioWidgetV2, migrateV2toV3)\n .withMigrationFrom(1, parseRadioWidgetV1, migrateV1ToV2)\n .withMigrationFrom(0, parseRadioWidgetV0, migrateV0ToV1).parser;\n","import {\n array,\n boolean,\n constant,\n enumeration,\n object,\n string,\n} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseSorterWidget = parseWidget(\n constant(\"sorter\"),\n object({\n correct: array(string),\n padding: boolean,\n layout: enumeration(\"horizontal\", \"vertical\"),\n }),\n);\n","import {\n array,\n number,\n constant,\n object,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseTableWidget = parseWidget(\n constant(\"table\"),\n object({\n headers: array(string),\n rows: number,\n columns: number,\n answers: defaulted(array(array(string)), () => []),\n }),\n);\n","import {\n constant,\n object,\n string,\n boolean,\n optional,\n} from \"../general-purpose-parsers\";\n\nimport {parseWidget} from \"./widget\";\n\nexport const parseVideoWidget = parseWidget(\n constant(\"video\"),\n object({\n location: string,\n static: optional(boolean),\n }),\n);\n","import {pair, string} from \"../general-purpose-parsers\";\n\nimport type {Parser} from \"../parser-types\";\n\n/**\n * Parses a string representation of a non-negative integer.\n *\n * This parser is used for the numeric part of widget IDs (e.g., the \"1\" in \"radio 1\").\n * It accepts string representations of non-negative integers, including \"0\".\n *\n * Note: The article renderer allows widget IDs with 0 (at least for image widgets),\n * but if widget IDs in an exercise contain 0, the exercise renderer may have issues.\n * We allow 0 here for compatibility with articles.\n *\n * @param rawValue - The raw value to parse, expected to be a string\n * @param ctx - The parse context for error reporting\n * @returns A ParseResult containing either the parsed number or an error\n */\nexport const parseStringToNonNegativeInt: Parser<number> = (rawValue, ctx) => {\n // The article renderer seems to allow the numeric part of a widget ID to\n // be 0, at least for image widgets. However, if widget IDs in an exercise\n // contain 0, the exercise renderer will blow up. We allow 0 here for\n // compatibility with articles.\n if (typeof rawValue !== \"string\" || !/^(0|[1-9][0-9]*)$/.test(rawValue)) {\n return ctx.failure(\n \"a string representing a non-negative integer\",\n rawValue,\n );\n }\n return ctx.success(+rawValue);\n};\n\n/**\n * Parses widget ID components into a [type, number] tuple.\n *\n * Widget IDs in Perseus follow the format \"{type} {number}\" (e.g., \"radio 1\", \"dropdown 2\").\n * This parser takes the components of a widget ID (after splitting on spaces) and\n * validates that it consists of exactly two parts: a widget type string and a\n * non-negative integer.\n *\n * @type {Parser<[string, number]>} A parser that returns a tuple of [widgetType, widgetNumber]\n */\nexport const parseWidgetIdComponents = pair(\n string,\n parseStringToNonNegativeInt,\n);\n","import {any, isPlainObject, object, constant} from \"../general-purpose-parsers\";\nimport {isFailure} from \"../result\";\n\nimport {parseCategorizerWidget} from \"./categorizer-widget\";\nimport {parseCSProgramWidget} from \"./cs-program-widget\";\nimport {parseDefinitionWidget} from \"./definition-widget\";\nimport {parseDropdownWidget} from \"./dropdown-widget\";\nimport {parseExplanationWidget} from \"./explanation-widget\";\nimport {parseExpressionWidget} from \"./expression-widget\";\nimport {parseFreeResponseWidget} from \"./free-response-widget\";\nimport {parseGradedGroupSetWidget} from \"./graded-group-set-widget\";\nimport {parseGradedGroupWidget} from \"./graded-group-widget\";\nimport {parseGrapherWidget} from \"./grapher-widget\";\nimport {parseGroupWidget} from \"./group-widget\";\nimport {parseIframeWidget} from \"./iframe-widget\";\nimport {parseImageWidget} from \"./image-widget\";\nimport {parseInputNumberWidget} from \"./input-number-widget\";\nimport {parseInteractionWidget} from \"./interaction-widget\";\nimport {parseInteractiveGraphWidget} from \"./interactive-graph-widget\";\nimport {parseLabelImageWidget} from \"./label-image-widget\";\nimport {parseMatcherWidget} from \"./matcher-widget\";\nimport {parseMatrixWidget} from \"./matrix-widget\";\nimport {parseMeasurerWidget} from \"./measurer-widget\";\nimport {parseMoleculeRendererWidget} from \"./molecule-renderer-widget\";\nimport {parseNumberLineWidget} from \"./number-line-widget\";\nimport {parseNumericInputWidget} from \"./numeric-input-widget\";\nimport {parseOrdererWidget} from \"./orderer-widget\";\nimport {parsePassageRefWidget} from \"./passage-ref-widget\";\nimport {parsePassageWidget} from \"./passage-widget\";\nimport {parsePhetSimulationWidget} from \"./phet-simulation-widget\";\nimport {parsePlotterWidget} from \"./plotter-widget\";\nimport {parsePythonProgramWidget} from \"./python-program-widget\";\nimport {parseRadioWidget} from \"./radio-widget\";\nimport {parseSorterWidget} from \"./sorter-widget\";\nimport {parseTableWidget} from \"./table-widget\";\nimport {parseVideoWidget} from \"./video-widget\";\nimport {parseWidget} from \"./widget\";\nimport {parseWidgetIdComponents} from \"./widget-id-components\";\n\nimport type {\n DeprecatedStandinWidget,\n PerseusWidgetsMap,\n} from \"../../data-schema\";\nimport type {ParseContext, Parser, ParseResult} from \"../parser-types\";\n\nexport const parseWidgetsMap: Parser<PerseusWidgetsMap> = (rawValue, ctx) => {\n if (!isPlainObject(rawValue)) {\n return ctx.failure(\"PerseusWidgetsMap\", rawValue);\n }\n\n const widgetsMap: PerseusWidgetsMap = {};\n for (const key of Object.keys(rawValue)) {\n // parseWidgetsMapEntry modifies the widgetsMap. This is kind of gross,\n // but it's the only way I could find to make TypeScript check the key\n // against the widget type.\n const entryResult = parseWidgetsMapEntry(\n [key, rawValue[key]],\n widgetsMap,\n ctx.forSubtree(key),\n );\n if (isFailure(entryResult)) {\n return entryResult;\n }\n }\n\n return ctx.success(widgetsMap);\n};\n\nconst parseWidgetsMapEntry: (\n entry: [string, unknown],\n widgetMap: PerseusWidgetsMap,\n ctx: ParseContext,\n) => ParseResult<unknown> = ([id, widget], widgetMap, ctx) => {\n const idComponentsResult = parseWidgetIdComponents(\n id.split(\" \"),\n ctx.forSubtree(\"(widget ID)\"),\n );\n if (isFailure(idComponentsResult)) {\n return idComponentsResult;\n }\n const [type, n] = idComponentsResult.value;\n\n function parseAndAssign<K extends keyof PerseusWidgetsMap>(\n key: K,\n parse: Parser<PerseusWidgetsMap[K]>,\n ): ParseResult<unknown> {\n const widgetResult = parse(widget, ctx);\n if (isFailure(widgetResult)) {\n return widgetResult;\n }\n widgetMap[key] = widgetResult.value;\n return ctx.success(undefined);\n }\n\n switch (type) {\n case \"categorizer\":\n return parseAndAssign(`categorizer ${n}`, parseCategorizerWidget);\n case \"cs-program\":\n return parseAndAssign(`cs-program ${n}`, parseCSProgramWidget);\n case \"definition\":\n return parseAndAssign(`definition ${n}`, parseDefinitionWidget);\n case \"dropdown\":\n return parseAndAssign(`dropdown ${n}`, parseDropdownWidget);\n case \"explanation\":\n return parseAndAssign(`explanation ${n}`, parseExplanationWidget);\n case \"expression\":\n return parseAndAssign(`expression ${n}`, parseExpressionWidget);\n case \"free-response\":\n return parseAndAssign(\n `free-response ${n}`,\n parseFreeResponseWidget,\n );\n case \"grapher\":\n return parseAndAssign(`grapher ${n}`, parseGrapherWidget);\n case \"group\":\n return parseAndAssign(`group ${n}`, parseGroupWidget);\n case \"graded-group\":\n return parseAndAssign(`graded-group ${n}`, parseGradedGroupWidget);\n case \"graded-group-set\":\n return parseAndAssign(\n `graded-group-set ${n}`,\n parseGradedGroupSetWidget,\n );\n case \"iframe\":\n return parseAndAssign(`iframe ${n}`, parseIframeWidget);\n case \"image\":\n return parseAndAssign(`image ${n}`, parseImageWidget);\n case \"input-number\":\n return parseAndAssign(`input-number ${n}`, parseInputNumberWidget);\n case \"interaction\":\n return parseAndAssign(`interaction ${n}`, parseInteractionWidget);\n case \"interactive-graph\":\n return parseAndAssign(\n `interactive-graph ${n}`,\n parseInteractiveGraphWidget,\n );\n case \"label-image\":\n return parseAndAssign(`label-image ${n}`, parseLabelImageWidget);\n case \"matcher\":\n return parseAndAssign(`matcher ${n}`, parseMatcherWidget);\n case \"matrix\":\n return parseAndAssign(`matrix ${n}`, parseMatrixWidget);\n case \"measurer\":\n return parseAndAssign(`measurer ${n}`, parseMeasurerWidget);\n case \"molecule-renderer\":\n return parseAndAssign(\n `molecule-renderer ${n}`,\n parseMoleculeRendererWidget,\n );\n case \"number-line\":\n return parseAndAssign(`number-line ${n}`, parseNumberLineWidget);\n case \"numeric-input\":\n return parseAndAssign(\n `numeric-input ${n}`,\n parseNumericInputWidget,\n );\n case \"orderer\":\n return parseAndAssign(`orderer ${n}`, parseOrdererWidget);\n case \"passage\":\n return parseAndAssign(`passage ${n}`, parsePassageWidget);\n case \"passage-ref\":\n return parseAndAssign(`passage-ref ${n}`, parsePassageRefWidget);\n case \"passage-ref-target\":\n // NOTE(benchristel): as of 2024-11-12, passage-ref-target is only\n // used in test content. See:\n // https://www.khanacademy.org/devadmin/content/search?query=widget:passage-ref-target\n return parseAndAssign(`passage-ref-target ${n}`, any);\n case \"phet-simulation\":\n return parseAndAssign(\n `phet-simulation ${n}`,\n parsePhetSimulationWidget,\n );\n case \"plotter\":\n return parseAndAssign(`plotter ${n}`, parsePlotterWidget);\n case \"python-program\":\n return parseAndAssign(\n `python-program ${n}`,\n parsePythonProgramWidget,\n );\n case \"radio\":\n return parseAndAssign(`radio ${n}`, parseRadioWidget);\n case \"sorter\":\n return parseAndAssign(`sorter ${n}`, parseSorterWidget);\n case \"table\":\n return parseAndAssign(`table ${n}`, parseTableWidget);\n case \"video\":\n return parseAndAssign(`video ${n}`, parseVideoWidget);\n case \"sequence\":\n // sequence is a deprecated widget type, and the corresponding\n // widget component no longer exists.\n return parseAndAssign(`sequence ${n}`, parseDeprecatedWidget);\n case \"lights-puzzle\":\n return parseAndAssign(`lights-puzzle ${n}`, parseDeprecatedWidget);\n case \"simulator\":\n return parseAndAssign(`simulator ${n}`, parseDeprecatedWidget);\n case \"transformer\":\n return parseAndAssign(`transformer ${n}`, parseDeprecatedWidget);\n\n default:\n return parseAndAssign(\n `${type} ${n}` as any,\n parseWidget(constant(type), any) as any,\n );\n }\n};\n\nconst parseDeprecatedWidget: Parser<DeprecatedStandinWidget> = parseWidget(\n // Ignore the incoming widget type and hardcode \"deprecated-standin\"\n (_, ctx) => ctx.success(\"deprecated-standin\" as const),\n // Allow any widget options\n object({}),\n);\n","import {any, object, string} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseImages} from \"./images-map\";\nimport {parseWidgetsMap} from \"./widgets-map\";\n\nimport type {PerseusRenderer} from \"../../data-schema\";\nimport type {Parser} from \"../parser-types\";\n\nexport const parsePerseusRenderer: Parser<PerseusRenderer> = defaulted(\n object({\n // TODO(benchristel): content is also defaulted to empty string in\n // renderer.tsx. See if we can remove one default or the other.\n content: defaulted(string, () => \"\"),\n // This module has an import cycle with parseWidgetsMap, because the\n // `group` widget can contain another renderer.\n // The anonymous function below ensures that we don't try to access\n // parseWidgetsMap before it's defined.\n widgets: defaulted(\n (rawVal, ctx) => parseWidgetsMap(rawVal, ctx),\n () => ({}),\n ),\n images: parseImages,\n // deprecated\n metadata: any,\n }),\n // Default value\n () => ({\n content: \"\",\n widgets: {},\n images: {},\n }),\n);\n","import {array, union} from \"../general-purpose-parsers\";\n\nimport {parsePerseusRenderer} from \"./perseus-renderer\";\n\nimport type {PerseusArticle} from \"../../data-schema\";\nimport type {Parser} from \"../parser-types\";\n\nexport const parsePerseusArticle: Parser<PerseusArticle> = union(\n parsePerseusRenderer,\n).or(array(parsePerseusRenderer)).parser;\n","import {\n any,\n boolean,\n object,\n optional,\n string,\n} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseImages} from \"./images-map\";\nimport {parseWidgetsMap} from \"./widgets-map\";\n\nexport const parseHint = object({\n replace: defaulted(optional(boolean), () => undefined),\n content: string,\n widgets: defaulted(parseWidgetsMap, () => ({})),\n images: parseImages,\n // deprecated\n metadata: any,\n});\n","import {object, pipeParsers} from \"../general-purpose-parsers\";\nimport {convert} from \"../general-purpose-parsers/convert\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nexport const parsePerseusAnswerArea = pipeParsers(\n defaulted(object({}), () => ({})),\n).then(convert(toAnswerArea)).parser;\n\n// Some answerAreas have extra, bogus fields, like:\n//\n// \"answerArea\": {\n// \"type\": \"multiple\",\n// \"options\": {},\n// \"version\": null,\n// \"static\": false,\n// \"graded\": false,\n// \"alignment\": \"\",\n// }\n//\n// This function filters the fields of an answerArea object, keeping only the\n// known ones, and converts `undefined` and `null` values to `false`.\nfunction toAnswerArea(raw: Record<string, unknown>) {\n return {\n calculator: !!raw.calculator,\n financialCalculatorMonthlyPayment:\n !!raw.financialCalculatorMonthlyPayment,\n financialCalculatorTotalAmount: !!raw.financialCalculatorTotalAmount,\n financialCalculatorTimeToPayOff: !!raw.financialCalculatorTimeToPayOff,\n periodicTable: !!raw.periodicTable,\n periodicTableWithKey: !!raw.periodicTableWithKey,\n };\n}\n","import {array, object} from \"../general-purpose-parsers\";\nimport {defaulted} from \"../general-purpose-parsers/defaulted\";\n\nimport {parseHint} from \"./hint\";\nimport {parsePerseusAnswerArea} from \"./perseus-answer-area\";\nimport {parsePerseusRenderer} from \"./perseus-renderer\";\n\nimport type {PerseusItem} from \"../../data-schema\";\nimport type {Parser} from \"../parser-types\";\n\nexport const parsePerseusItem: Parser<PerseusItem> = object({\n question: parsePerseusRenderer,\n hints: defaulted(array(parseHint), () => []),\n answerArea: parsePerseusAnswerArea,\n});\n","import {\n object,\n array,\n number,\n optional,\n nullable,\n} from \"../general-purpose-parsers\";\n\nexport const parseCategorizerUserInput = object({\n values: array(optional(nullable(number))),\n});\n","import {\n enumeration,\n nullable,\n object,\n string,\n} from \"../general-purpose-parsers\";\n\nexport const parseCSProgramUserInput = object({\n status: enumeration(\"correct\", \"incorrect\", \"incomplete\"),\n message: nullable(string),\n});\n","import {number, object} from \"../general-purpose-parsers\";\n\nexport const parseDropdownUserInput = object({\n value: number,\n});\n","import {string} from \"../general-purpose-parsers\";\n\nexport const parseExpressionUserInput = string;\n","import {object, string} from \"../general-purpose-parsers\";\n\nexport const parseFreeResponseUserInput = object({\n currentValue: string,\n});\n","import {\n constant,\n nullable,\n number,\n object,\n pair,\n} from \"../general-purpose-parsers\";\nimport {discriminatedUnionOn} from \"../general-purpose-parsers/discriminated-union\";\n\nconst coord = pair(number, number);\nconst coordPair = pair(coord, coord);\n\nconst parseAbsoluteValueBranch = object({\n type: constant(\"absolute_value\"),\n coords: nullable(coordPair),\n});\n\nconst parseExponentialBranch = object({\n type: constant(\"exponential\"),\n asymptote: coordPair,\n coords: nullable(coordPair),\n});\n\nconst parseLinearBranch = object({\n type: constant(\"linear\"),\n coords: nullable(coordPair),\n});\n\nconst parseLogarithmBranch = object({\n type: constant(\"logarithm\"),\n asymptote: coordPair,\n coords: nullable(coordPair),\n});\n\nconst parseQuadraticBranch = object({\n type: constant(\"quadratic\"),\n coords: nullable(coordPair),\n});\n\nconst parseSinusoidBranch = object({\n type: constant(\"sinusoid\"),\n coords: nullable(coordPair),\n});\n\nconst parseTangentBranch = object({\n type: constant(\"tangent\"),\n coords: nullable(coordPair),\n});\n\nexport const parseGrapherUserInput = discriminatedUnionOn(\"type\")\n .withBranch(\"absolute_value\", parseAbsoluteValueBranch)\n .withBranch(\"exponential\", parseExponentialBranch)\n .withBranch(\"linear\", parseLinearBranch)\n .withBranch(\"logarithm\", parseLogarithmBranch)\n .withBranch(\"quadratic\", parseQuadraticBranch)\n .withBranch(\"sinusoid\", parseSinusoidBranch)\n .withBranch(\"tangent\", parseTangentBranch).parser;\n","import {parseUserInputMap} from \"./user-input-map\";\n\nimport type {PerseusGroupUserInput} from \"../../validation.types\";\nimport type {Parser} from \"../parser-types\";\n\n// NOTE(TB): Function wrapper is necessary to avoid circular import issues with user-input-map.ts\nexport const parseGroupUserInput: Parser<PerseusGroupUserInput> = (\n rawVal,\n ctx,\n) => parseUserInputMap(rawVal, ctx);\n","import {\n enumeration,\n nullable,\n object,\n optional,\n string,\n} from \"../general-purpose-parsers\";\n\nexport const parseIFrameUserInput = object({\n status: enumeration(\"correct\", \"incorrect\", \"incomplete\"),\n message: optional(nullable(string)),\n});\n","import {object, string} from \"../general-purpose-parsers\";\n\nexport const parseInputNumberUserInput = object({\n currentValue: string,\n});\n","import {parsePerseusGraphType} from \"./interactive-graph-widget\";\n\nexport const parseInteractiveGraphUserInput = parsePerseusGraphType;\n","import {array, object, optional, string} from \"../general-purpose-parsers\";\n\nexport const parseLabelImageUserInput = object({\n markers: array(\n object({\n selected: optional(array(string)),\n label: string,\n }),\n ),\n});\n","import {object, array, string} from \"../general-purpose-parsers\";\n\nexport const parseMatcherUserInput = object({\n left: array(string),\n right: array(string),\n});\n","import {array, string, object} from \"../general-purpose-parsers\";\n\nexport const parseMatrixUserInput = object({\n answers: array(array(string)),\n});\n","import {object, number, enumeration} from \"../general-purpose-parsers\";\n\nexport const parseNumberLineUserInput = object({\n numLinePosition: number,\n rel: enumeration(\"eq\", \"lt\", \"gt\", \"le\", \"ge\"),\n numDivisions: number,\n});\n","import {object, string} from \"../general-purpose-parsers\";\n\nexport const parseNumericInputUserInput = object({\n currentValue: string,\n});\n","import {array, object, string} from \"../general-purpose-parsers\";\n\nexport const parseOrdererUserInput = object({\n current: array(string),\n});\n","import {array, number} from \"../general-purpose-parsers\";\n\nexport const parsePlotterUserInput = array(number);\n","import {array, object, string} from \"../general-purpose-parsers\";\n\nexport const parseRadioUserInput = object({\n selectedChoiceIds: array(string),\n});\n","import {array, boolean, object, string} from \"../general-purpose-parsers\";\n\nexport const parseSorterUserInput = object({\n options: array(string),\n changed: boolean,\n});\n","import {array, string} from \"../general-purpose-parsers\";\n\nexport const parseTableUserInput = array(array(string));\n","import {any, isPlainObject} from \"../general-purpose-parsers\";\nimport {isFailure} from \"../result\";\n\nimport {parseCategorizerUserInput} from \"./categorizer-user-input\";\nimport {parseCSProgramUserInput} from \"./cs-program-user-input\";\nimport {parseDropdownUserInput} from \"./dropdown-user-input\";\nimport {parseExpressionUserInput} from \"./expression-user-input\";\nimport {parseFreeResponseUserInput} from \"./free-response-user-input\";\nimport {parseGrapherUserInput} from \"./grapher-user-input\";\nimport {parseGroupUserInput} from \"./group-user-input\";\nimport {parseIFrameUserInput} from \"./iframe-user-input\";\nimport {parseInputNumberUserInput} from \"./input-number-user-input\";\nimport {parseInteractiveGraphUserInput} from \"./interactive-graph-user-input\";\nimport {parseLabelImageUserInput} from \"./label-image-user-input\";\nimport {parseMatcherUserInput} from \"./matcher-user-input\";\nimport {parseMatrixUserInput} from \"./matrix-user-input\";\nimport {parseNumberLineUserInput} from \"./number-line-user-input\";\nimport {parseNumericInputUserInput} from \"./numeric-input-user-input\";\nimport {parseOrdererUserInput} from \"./orderer-user-input\";\nimport {parsePlotterUserInput} from \"./plotter-user-input\";\nimport {parseRadioUserInput} from \"./radio-user-input\";\nimport {parseSorterUserInput} from \"./sorter-user-input\";\nimport {parseTableUserInput} from \"./table-user-input\";\nimport {parseWidgetIdComponents} from \"./widget-id-components\";\n\nimport type {UserInputMap} from \"../../validation.types\";\nimport type {ParseContext, Parser, ParseResult} from \"../parser-types\";\n\n/**\n * Parses a UserInputMap, which is a map of widget IDs to their corresponding user input data.\n *\n * A UserInputMap maps widget IDs (like \"radio 1\", \"dropdown 2\") to the user input data\n * for each widget. This is used by Group widgets and other contexts where multiple\n * widgets need to be tracked together.\n *\n * The parser handles recursive structures since Group widgets can contain other Group\n * widgets, each with their own UserInputMap.\n *\n * @param rawValue - The raw value to parse, expected to be a plain object\n * @param ctx - The parse context for error reporting and tracking\n * @returns A ParseResult containing either the parsed UserInputMap or an error\n */\nexport const parseUserInputMap: Parser<UserInputMap> = (rawValue, ctx) => {\n if (!isPlainObject(rawValue)) {\n return ctx.failure(\"UserInputMap\", rawValue);\n }\n\n const userInputMap: UserInputMap = {};\n for (const key of Object.keys(rawValue)) {\n // parseUserInputMapEntry modifies the userInputMap. This is to make\n // TypeScript check the key against the widget type.\n const entryResult = parseUserInputMapEntry(\n [key, rawValue[key]],\n userInputMap,\n ctx.forSubtree(key),\n );\n if (isFailure(entryResult)) {\n return entryResult;\n }\n }\n\n return ctx.success(userInputMap);\n};\n\n/**\n * Parses a single entry in a UserInputMap and adds it to the provided map.\n *\n * This function takes a [widgetId, userInput] pair, parses the widget ID to determine\n * the widget type, then uses the appropriate parser for that widget type's user input.\n * The parsed result is added to the provided userInputMap.\n *\n * This approach is used to maintain strong typing - TypeScript can verify that each\n * widget ID maps to the correct user input type based on the widget type extracted\n * from the ID.\n *\n * @param entry - A tuple of [widgetId, rawUserInput] to parse\n * @param userInputMap - The UserInputMap to modify with the parsed entry\n * @param ctx - The parse context for error reporting\n * @returns A ParseResult indicating success or failure\n */\nconst parseUserInputMapEntry: (\n entry: [string, unknown],\n userInputMap: UserInputMap,\n ctx: ParseContext,\n) => ParseResult<unknown> = ([id, userInput], userInputMap, ctx) => {\n const idComponentsResult = parseWidgetIdComponents(\n id.split(\" \"),\n ctx.forSubtree(\"(widget ID)\"),\n );\n if (isFailure(idComponentsResult)) {\n return idComponentsResult;\n }\n const [type, n] = idComponentsResult.value;\n\n function parseAndAssign<K extends keyof UserInputMap>(\n key: K,\n parse: Parser<UserInputMap[K]>,\n ): ParseResult<unknown> {\n const userInputResult = parse(userInput, ctx);\n if (isFailure(userInputResult)) {\n return userInputResult;\n }\n userInputMap[key] = userInputResult.value;\n return ctx.success(undefined);\n }\n\n switch (type) {\n case \"categorizer\":\n return parseAndAssign(\n `categorizer ${n}`,\n parseCategorizerUserInput,\n );\n case \"cs-program\":\n return parseAndAssign(`cs-program ${n}`, parseCSProgramUserInput);\n case \"dropdown\":\n return parseAndAssign(`dropdown ${n}`, parseDropdownUserInput);\n case \"expression\":\n return parseAndAssign(`expression ${n}`, parseExpressionUserInput);\n case \"free-response\":\n return parseAndAssign(\n `free-response ${n}`,\n parseFreeResponseUserInput,\n );\n case \"grapher\":\n return parseAndAssign(`grapher ${n}`, parseGrapherUserInput);\n case \"group\":\n // Recursive case: group user input is itself a UserInputMap\n return parseAndAssign(`group ${n}`, parseGroupUserInput);\n case \"iframe\":\n return parseAndAssign(`iframe ${n}`, parseIFrameUserInput);\n case \"input-number\":\n return parseAndAssign(\n `input-number ${n}`,\n parseInputNumberUserInput,\n );\n case \"interactive-graph\":\n return parseAndAssign(\n `interactive-graph ${n}`,\n parseInteractiveGraphUserInput,\n );\n case \"label-image\":\n return parseAndAssign(`label-image ${n}`, parseLabelImageUserInput);\n case \"matcher\":\n return parseAndAssign(`matcher ${n}`, parseMatcherUserInput);\n case \"matrix\":\n return parseAndAssign(`matrix ${n}`, parseMatrixUserInput);\n case \"number-line\":\n return parseAndAssign(`number-line ${n}`, parseNumberLineUserInput);\n case \"numeric-input\":\n return parseAndAssign(\n `numeric-input ${n}`,\n parseNumericInputUserInput,\n );\n case \"orderer\":\n return parseAndAssign(`orderer ${n}`, parseOrdererUserInput);\n case \"plotter\":\n return parseAndAssign(`plotter ${n}`, parsePlotterUserInput);\n case \"radio\":\n return parseAndAssign(`radio ${n}`, parseRadioUserInput);\n case \"sorter\":\n return parseAndAssign(`sorter ${n}`, parseSorterUserInput);\n case \"table\":\n return parseAndAssign(`table ${n}`, parseTableUserInput);\n\n default:\n // For unknown widget types, accept any input\n return parseAndAssign(`${type} ${n}` as any, any);\n }\n};\n","import {isRealJSONParse} from \"../utils/is-real-json-parse\";\n\nimport {parse} from \"./parse\";\nimport {parsePerseusArticle as migrateAndTypecheckPerseusArticle} from \"./perseus-parsers/perseus-article\";\nimport {parsePerseusItem as migrateAndTypecheckPerseusItem} from \"./perseus-parsers/perseus-item\";\nimport {parseUserInputMap} from \"./perseus-parsers/user-input-map\";\nimport {failure, isFailure} from \"./result\";\n\nimport type {Result} from \"./result\";\nimport type {PerseusItem, PerseusArticle} from \"../data-schema\";\nimport type {UserInputMap} from \"../validation.types\";\n\n/**\n * Helper to parse PerseusItem JSON\n * Why not just use JSON.parse? We want:\n * - To make sure types are correct\n * - To give us a central place to validate/transform output if needed\n * @deprecated - use parseAndMigratePerseusItem instead\n * @param {string} json - the stringified PerseusItem JSON\n * @returns {PerseusItem} the parsed PerseusItem object\n */\nexport function parsePerseusItem(json: string): PerseusItem {\n // Try to block a cheating vector which relies on monkey-patching\n // JSON.parse\n if (isRealJSONParse(JSON.parse)) {\n return JSON.parse(json);\n }\n throw new Error(\"Something went wrong.\");\n}\n\nexport type ParseFailureDetail = {\n /**\n * A human-readable error message describing where in the object tree\n * parsing failed.\n */\n message: string;\n /**\n * The raw result of parsing the input JSON, with no migrations applied.\n * Use at your own risk.\n */\n invalidObject: unknown;\n};\n\n/**\n * Parses a PerseusItem from a plain object or JSON string, migrates old\n * formats to the latest schema, and runtime-typechecks the result. Use this to\n * parse assessmentItem data.\n *\n * @returns a {@link Result} of the parsed PerseusItem. If the result is a\n * failure, it will contain an error message describing where in the tree\n * parsing failed.\n * @throws SyntaxError if the argument is not well-formed JSON.\n */\nexport function parseAndMigratePerseusItem(\n data: unknown,\n): Result<PerseusItem, ParseFailureDetail> {\n throwErrorIfCheatingDetected();\n const object: unknown = typeof data === \"string\" ? JSON.parse(data) : data;\n const result = parse(object, migrateAndTypecheckPerseusItem);\n if (isFailure(result)) {\n return failure({message: result.detail, invalidObject: object});\n }\n return result;\n}\n\n/**\n * Parses a PerseusArticle from a plain object (or array) or JSON string,\n * migrates old formats to the latest schema, and runtime-typechecks the\n * result.\n *\n * @returns a {@link Result} of the parsed PerseusArticle. If the result is a\n * failure, it will contain an error message describing where in the tree\n * parsing failed.\n * @throws SyntaxError if the argument is not well-formed JSON.\n */\nexport function parseAndMigratePerseusArticle(\n data: unknown,\n): Result<PerseusArticle, ParseFailureDetail> {\n throwErrorIfCheatingDetected();\n const object: unknown = typeof data === \"string\" ? JSON.parse(data) : data;\n const result = parse(object, migrateAndTypecheckPerseusArticle);\n if (isFailure(result)) {\n return failure({message: result.detail, invalidObject: object});\n }\n return result;\n}\n\n/**\n * Parses a UserInputMap from a plain object or JSON string, migrates old\n * formats to the latest schema, and runtime-typechecks the result.\n *\n * @returns a {@link Result} of the parsed UserInputMap. If the result is a\n * failure, it will contain an error message describing where in the tree\n * parsing failed.\n * @throws SyntaxError if the argument is a string that is not well-formed\n * JSON.\n */\nexport function parseAndMigrateUserInputMap(\n data: unknown,\n): Result<UserInputMap, ParseFailureDetail> {\n const object: unknown = typeof data === \"string\" ? JSON.parse(data) : data;\n const result = parse(object, parseUserInputMap);\n if (isFailure(result)) {\n return failure({message: result.detail, invalidObject: object});\n }\n return result;\n}\n\n/**\n * Tries to block a cheating vector that relies on monkey-patching JSON.parse.\n */\n// TODO(LEMS-2331): delete this function once server-side scoring is done.\nfunction throwErrorIfCheatingDetected() {\n if (!isRealJSONParse(JSON.parse)) {\n throw new Error(\"Something went wrong.\");\n }\n}\n","// This file is processed by a Rollup plugin (replace) to inject the production\n// version number during the release build.\n// In dev, you'll never see the version number.\n\nimport {addLibraryVersionToPerseusDebug} from \"@khanacademy/perseus-utils\";\n\nconst libName = \"@khanacademy/perseus-core\";\nexport const libVersion = \"__lib_version__\";\n\naddLibraryVersionToPerseusDebug(libName, libVersion);\n","/**\n * Errors utility for referencing the Perseus error taxonomy.\n */\nexport const Errors = Object.freeze({\n /**\n * @property {ErrorKind} Unknown The kind of error is not known.\n */\n Unknown: \"Unknown\",\n /**\n * @property {ErrorKind} Internal The error is internal to the executing code.\n */\n Internal: \"Internal\",\n /**\n * @property {ErrorKind} InvalidInput There was a problem with the provided\n * input, such as the wrong format or a null value.\n */\n InvalidInput: \"InvalidInput\",\n /**\n * @property {ErrorKind} NotAllowed There was a problem due to the state of\n * the system not matching the requested operation or input. For example,\n * trying to create a username that is valid, but is already taken by\n * another user. Use {@link InvalidInput} instead when the input isn't\n * valid regardless of the state of the system. Use {@link NotFound} when\n * the failure is due to not being able to find a resource.\n */\n NotAllowed: \"NotAllowed\",\n /**\n * @property {ErrorKind} TransientService There was a problem when making a\n * request to a service.\n */\n TransientService: \"TransientService\",\n /**\n * @property {ErrorKind} Service There was a non-transient problem when\n * making a request to service.\n */\n Service: \"Service\",\n});\n\n/**\n * @type {ErrorKind} The kind of error being reported\n */\nexport type ErrorKind = (typeof Errors)[keyof typeof Errors];\n","import type {ErrorKind} from \"./errors\";\nimport type {Metadata} from \"@khanacademy/wonder-stuff-core\";\n\ntype Options = {\n metadata?: Metadata | null | undefined;\n};\n\nexport class PerseusError extends Error {\n kind: ErrorKind;\n metadata: Metadata | null | undefined;\n\n constructor(message: string, kind: ErrorKind, options?: Options) {\n super(message);\n this.kind = kind;\n this.metadata = options?.metadata;\n }\n}\n","/**\n * _ utilities for objects\n */\n\nimport _ from \"underscore\";\n\n/**\n * Does a pluck on keys inside objects in an object\n *\n * Ex:\n * tools = {\n * translation: {\n * enabled: true\n * },\n * rotation: {\n * enabled: false\n * }\n * };\n * pluckObject(tools, \"enabled\") returns {\n * translation: true\n * rotation: false\n * }\n */\nexport const pluck = function (table: any, subKey: string): any {\n return _.object(\n _.map(table, function (value, key) {\n return [key, value[subKey]];\n }),\n );\n};\n\n/**\n * Maps an object to an object\n *\n * > mapObject({a: '1', b: '2'}, (value, key) => {\n * return value + 1;\n * });\n * {a: 2, b: 3}\n */\nexport const mapObject = function <K extends string, V, U>(\n obj: Record<K, V>,\n lambda: (arg1: V, arg2: K) => U,\n): Record<K, U> {\n const result: Record<string, any> = {};\n Object.keys(obj).forEach((key) => {\n // @ts-expect-error - TS2345 - Argument of type 'string' is not assignable to parameter of type 'K'.\n result[key] = lambda(obj[key], key);\n });\n return result;\n};\n","import type {PerseusCategorizerWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusCategorizerWidgetOptions type\n */\nexport type CategorizerPublicWidgetOptions = {\n items: PerseusCategorizerWidgetOptions[\"items\"];\n categories: PerseusCategorizerWidgetOptions[\"categories\"];\n randomizeItems: PerseusCategorizerWidgetOptions[\"randomizeItems\"];\n static: PerseusCategorizerWidgetOptions[\"static\"];\n};\n\n/**\n * Given a PerseusCategorizerWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getCategorizerPublicWidgetOptions(\n options: PerseusCategorizerWidgetOptions,\n): CategorizerPublicWidgetOptions {\n return {\n items: options.items,\n categories: options.categories,\n randomizeItems: options.randomizeItems,\n static: options.static,\n };\n}\n\nexport default getCategorizerPublicWidgetOptions;\n","import getCategorizerPublicWidgetOptions from \"./categorizer-util\";\n\nimport type {PerseusCategorizerWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type CategorizerDefaultWidgetOptions = Pick<\n PerseusCategorizerWidgetOptions,\n \"items\" | \"categories\" | \"values\" | \"randomizeItems\"\n>;\n\nconst defaultWidgetOptions: CategorizerDefaultWidgetOptions = {\n items: [],\n categories: [],\n values: [],\n randomizeItems: false,\n};\n\nconst categorizerWidgetLogic: WidgetLogic = {\n name: \"categorizer\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getCategorizerPublicWidgetOptions,\n accessible: false,\n};\n\nexport default categorizerWidgetLogic;\n","import type {PerseusCSProgramWidgetOptions} from \"../../data-schema\";\n\nexport default function getCSProgramPublicWidgetOptions(\n options: PerseusCSProgramWidgetOptions,\n): PerseusCSProgramWidgetOptions {\n return options;\n}\n","import getCSProgramPublicWidgetOptions from \"./cs-program-util\";\n\nimport type {PerseusCSProgramWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type CSProgramDefaultWidgetOptions = Pick<\n PerseusCSProgramWidgetOptions,\n | \"programID\"\n | \"programType\"\n | \"settings\"\n | \"showEditor\"\n | \"showButtons\"\n | \"height\"\n>;\n\nconst DEFAULT_HEIGHT = 400;\n\nconst defaultWidgetOptions: CSProgramDefaultWidgetOptions = {\n programID: \"\",\n programType: null,\n settings: [{name: \"\", value: \"\"}],\n showEditor: false,\n showButtons: false,\n height: DEFAULT_HEIGHT,\n};\n\nconst csProgramWidgetLogic: WidgetLogic = {\n name: \"cs-program\",\n defaultWidgetOptions,\n supportedAlignments: [\"block\", \"full-width\"],\n getPublicWidgetOptions: getCSProgramPublicWidgetOptions,\n accessible: false,\n};\n\nexport default csProgramWidgetLogic;\n","import type {PerseusDefinitionWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type DefinitionDefaultWidgetOptions = Pick<\n PerseusDefinitionWidgetOptions,\n \"togglePrompt\" | \"definition\"\n>;\n\nconst defaultWidgetOptions: DefinitionDefaultWidgetOptions = {\n togglePrompt: \"\",\n definition: \"\",\n};\n\nconst definitionWidgetLogic: WidgetLogic = {\n name: \"definition\",\n defaultWidgetOptions,\n defaultAlignment: \"inline\",\n accessible: true,\n};\n\nexport default definitionWidgetLogic;\n","import type {PerseusDropdownWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusDropdownWidgetOptions type\n */\nexport type DropdownPublicWidgetOptions = {\n choices: ReadonlyArray<{content: string}>;\n placeholder: PerseusDropdownWidgetOptions[\"placeholder\"];\n static: PerseusDropdownWidgetOptions[\"static\"];\n visibleLabel?: PerseusDropdownWidgetOptions[\"visibleLabel\"];\n ariaLabel?: PerseusDropdownWidgetOptions[\"ariaLabel\"];\n};\n\n/**\n * Given a PerseusDropdownWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getDropdownPublicWidgetOptions(\n options: PerseusDropdownWidgetOptions,\n): DropdownPublicWidgetOptions {\n return {\n choices: options.choices.map((choice) => ({content: choice.content})),\n placeholder: options.placeholder,\n static: options.static,\n visibleLabel: options.visibleLabel,\n ariaLabel: options.ariaLabel,\n };\n}\n\nexport default getDropdownPublicWidgetOptions;\n","import getDropdownPublicWidgetOptions from \"./dropdown-util\";\n\nimport type {PerseusDropdownWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type DropdownDefaultWidgetOptions = Pick<\n PerseusDropdownWidgetOptions,\n \"placeholder\" | \"choices\"\n>;\n\nconst defaultWidgetOptions: DropdownDefaultWidgetOptions = {\n placeholder: \"\",\n choices: [\n {\n content: \"\",\n correct: false,\n },\n ],\n};\n\nconst dropdownWidgetLogic: WidgetLogic = {\n name: \"dropdown\",\n defaultWidgetOptions,\n defaultAlignment: \"inline-block\",\n getPublicWidgetOptions: getDropdownPublicWidgetOptions,\n accessible: true,\n};\n\nexport default dropdownWidgetLogic;\n","import type {PerseusExplanationWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type ExplanationDefaultWidgetOptions = Pick<\n PerseusExplanationWidgetOptions,\n \"showPrompt\" | \"hidePrompt\" | \"explanation\" | \"widgets\"\n>;\n\nconst defaultWidgetOptions: ExplanationDefaultWidgetOptions = {\n showPrompt: \"Explain\",\n hidePrompt: \"Hide explanation\",\n explanation: \"explanation goes here\\n\\nmore explanation\",\n widgets: {},\n};\n\nconst explanationWidgetLogic: WidgetLogic = {\n name: \"explanation\",\n defaultWidgetOptions,\n defaultAlignment: \"inline\",\n accessible: true,\n};\n\nexport default explanationWidgetLogic;\n","import type {PerseusExpressionWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusExpressionWidgetOptions type\n */\nexport type ExpressionPublicWidgetOptions = {\n buttonSets: PerseusExpressionWidgetOptions[\"buttonSets\"];\n functions: PerseusExpressionWidgetOptions[\"functions\"];\n times: PerseusExpressionWidgetOptions[\"times\"];\n visibleLabel?: PerseusExpressionWidgetOptions[\"visibleLabel\"];\n ariaLabel?: PerseusExpressionWidgetOptions[\"ariaLabel\"];\n buttonsVisible?: PerseusExpressionWidgetOptions[\"buttonsVisible\"];\n extraKeys?: PerseusExpressionWidgetOptions[\"extraKeys\"];\n};\n\n/**\n * Given a PerseusExpressionWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getExpressionPublicWidgetOptions(\n options: PerseusExpressionWidgetOptions,\n): ExpressionPublicWidgetOptions {\n return {\n buttonSets: options.buttonSets,\n functions: options.functions,\n times: options.times,\n visibleLabel: options.visibleLabel,\n ariaLabel: options.ariaLabel,\n buttonsVisible: options.buttonsVisible,\n extraKeys: options.extraKeys,\n };\n}\n\nexport default getExpressionPublicWidgetOptions;\n","import getExpressionPublicWidgetOptions from \"./expression-util\";\n\nimport type {PerseusExpressionWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport const currentVersion = {major: 2, minor: 0};\n\nexport type ExpressionDefaultWidgetOptions = Pick<\n PerseusExpressionWidgetOptions,\n \"answerForms\" | \"times\" | \"buttonSets\" | \"functions\"\n>;\n\nexport const defaultWidgetOptions: ExpressionDefaultWidgetOptions = {\n answerForms: [],\n times: false,\n buttonSets: [\"basic\"],\n functions: [\"f\", \"g\", \"h\"],\n};\n\nconst expressionWidgetLogic: WidgetLogic = {\n name: \"expression\",\n version: currentVersion,\n defaultWidgetOptions: defaultWidgetOptions,\n defaultAlignment: \"inline-block\",\n getPublicWidgetOptions: getExpressionPublicWidgetOptions,\n accessible: true,\n};\n\nexport default expressionWidgetLogic;\n","import type {PerseusGradedGroupWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type GradedGroupDefaultWidgetOptions = Pick<\n PerseusGradedGroupWidgetOptions,\n \"title\" | \"content\" | \"widgets\" | \"images\" | \"hint\"\n>;\n\nconst defaultWidgetOptions: GradedGroupDefaultWidgetOptions = {\n title: \"\",\n content: \"\",\n widgets: {},\n images: {},\n hint: null,\n};\n\nconst traverseChildWidgets = function (props: any, traverseRenderer: any): any {\n return {...props, ...traverseRenderer(props)};\n};\n\nconst gradedGroupWidgetLogic: WidgetLogic = {\n name: \"graded-group\",\n defaultWidgetOptions,\n accessible: true,\n traverseChildWidgets: traverseChildWidgets,\n};\n\nexport default gradedGroupWidgetLogic;\n","import type {PerseusFreeResponseWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * {@link PerseusFreeResponseWidgetOptions} type\n */\nexport type FreeResponsePublicWidgetOptions = {\n allowUnlimitedCharacters: PerseusFreeResponseWidgetOptions[\"allowUnlimitedCharacters\"];\n characterLimit: PerseusFreeResponseWidgetOptions[\"characterLimit\"];\n placeholder: PerseusFreeResponseWidgetOptions[\"placeholder\"];\n question: PerseusFreeResponseWidgetOptions[\"question\"];\n};\n\n/**\n * Given a FreeResponsePublicWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getFreeResponsePublicWidgetOptions(\n options: PerseusFreeResponseWidgetOptions,\n): FreeResponsePublicWidgetOptions {\n return {\n allowUnlimitedCharacters: options.allowUnlimitedCharacters,\n characterLimit: options.characterLimit,\n placeholder: options.placeholder,\n question: options.question,\n };\n}\n\nexport default getFreeResponsePublicWidgetOptions;\n","import getFreeResponsePublicWidgetOptions from \"./free-response-util\";\n\nimport type {PerseusFreeResponseWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type FreeResponseDefaultWidgetOptions = Pick<\n PerseusFreeResponseWidgetOptions,\n | \"allowUnlimitedCharacters\"\n | \"characterLimit\"\n | \"placeholder\"\n | \"question\"\n | \"scoringCriteria\"\n>;\n\nconst defaultWidgetOptions: FreeResponseDefaultWidgetOptions = {\n allowUnlimitedCharacters: false,\n characterLimit: 500,\n placeholder: \"Please provide response here\",\n question: \"\",\n // Always display one criterion, since the user will always have to input\n // at least one.\n scoringCriteria: [\n {\n text: \"\",\n },\n ],\n};\n\nconst freeResponseWidgetLogic: WidgetLogic = {\n name: \"free-response\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getFreeResponsePublicWidgetOptions,\n};\n\nexport default freeResponseWidgetLogic;\n","import type {PerseusGradedGroupSetWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type GradedGroupSetDefaultWidgetOptions = Pick<\n PerseusGradedGroupSetWidgetOptions,\n \"gradedGroups\"\n>;\n\nconst defaultWidgetOptions: GradedGroupSetDefaultWidgetOptions = {\n gradedGroups: [],\n};\n\nconst traverseChildWidgets = function (props: any, traverseRenderer: any): any {\n return {...props, ...traverseRenderer(props)};\n};\n\nconst gradedGroupSetWidgetLogic: WidgetLogic = {\n name: \"graded-group-set\",\n defaultWidgetOptions,\n accessible: true,\n traverseChildWidgets: traverseChildWidgets,\n};\n\nexport default gradedGroupSetWidgetLogic;\n","import type {PerseusGrapherWidgetOptions} from \"../../data-schema\";\n\nexport type GrapherPublicWidgetOptions = Pick<\n PerseusGrapherWidgetOptions,\n \"availableTypes\" | \"graph\"\n>;\n\nexport default function getGrapherPublicWidgetOptions(\n options: PerseusGrapherWidgetOptions,\n): GrapherPublicWidgetOptions {\n const {correct: _, ...publicOptions} = options;\n return publicOptions;\n}\n","import getGrapherPublicWidgetOptions from \"./grapher-util\";\n\nimport type {PerseusGrapherWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type GrapherDefaultWidgetOptions = Pick<\n PerseusGrapherWidgetOptions,\n \"graph\" | \"correct\" | \"availableTypes\"\n>;\n\nconst defaultWidgetOptions: GrapherDefaultWidgetOptions = {\n graph: {\n labels: [\"x\", \"y\"],\n range: [\n [-10, 10],\n [-10, 10],\n ],\n step: [1, 1],\n backgroundImage: {\n url: null,\n },\n markings: \"graph\",\n rulerLabel: \"\",\n rulerTicks: 10,\n valid: true,\n showTooltips: false,\n },\n correct: {\n type: \"linear\",\n coords: null,\n },\n availableTypes: [\"linear\"],\n};\n\nconst grapherWidgetLogic: WidgetLogic = {\n name: \"grapher\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getGrapherPublicWidgetOptions,\n accessible: false,\n};\n\nexport default grapherWidgetLogic;\n","class Registry<T> {\n private name: string;\n private contents: Record<string, T> = {};\n private anythingRegistered = false;\n\n constructor(name = \"Registry\") {\n this.name = name;\n }\n\n private throwIfUnregistered() {\n if (!this.anythingRegistered) {\n throw new Error(`${this.name} accessed before initialization!`);\n }\n }\n\n has(key: string): boolean {\n this.throwIfUnregistered();\n return Object.prototype.hasOwnProperty.call(this.contents, key);\n }\n\n get(key: string): T | undefined {\n this.throwIfUnregistered();\n return this.contents[key];\n }\n\n keys(): Array<string> {\n this.throwIfUnregistered();\n return Object.keys(this.contents);\n }\n\n entries(): Array<[string, T]> {\n this.throwIfUnregistered();\n return Object.entries(this.contents);\n }\n\n set(key: string, value: T): void {\n this.anythingRegistered = true;\n this.contents[key] = value;\n }\n}\n\nexport default Registry;\n","import type {WidgetLogic} from \"../logic-export.types\";\n\nconst deprecatedStandinWidgetLogic: WidgetLogic = {\n name: \"deprecated-standin\",\n accessible: true,\n};\n\nexport default deprecatedStandinWidgetLogic;\n","import type {PerseusIFrameWidgetOptions} from \"../../data-schema\";\n\nexport default function getIFramePublicWidgetOptions(\n options: PerseusIFrameWidgetOptions,\n): PerseusIFrameWidgetOptions {\n return options;\n}\n","import getIFramePublicWidgetOptions from \"./iframe-util\";\n\nimport type {PerseusIFrameWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type IFrameDefaultWidgetOptions = Pick<\n PerseusIFrameWidgetOptions,\n | \"url\"\n | \"settings\"\n | \"width\"\n | \"height\"\n | \"allowFullScreen\"\n | \"allowTopNavigation\"\n>;\n\nconst defaultWidgetOptions: IFrameDefaultWidgetOptions = {\n url: \"\",\n settings: [{name: \"\", value: \"\"}],\n width: \"400\",\n height: \"400\",\n allowFullScreen: false,\n allowTopNavigation: false,\n};\n\nconst iframeWidgetLogic: WidgetLogic = {\n name: \"iframe\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getIFramePublicWidgetOptions,\n accessible: false,\n};\n\nexport default iframeWidgetLogic;\n","import type {\n PerseusImageWidgetOptions,\n PerseusWidgetOptions,\n} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type ImageDefaultWidgetOptions = Pick<\n PerseusImageWidgetOptions,\n \"title\" | \"range\" | \"box\" | \"backgroundImage\" | \"labels\" | \"alt\" | \"caption\"\n>;\n\nconst defaultWidgetOptions: ImageDefaultWidgetOptions = {\n title: \"\",\n range: [\n [0, 10],\n [0, 10],\n ],\n box: [400, 400],\n backgroundImage: {\n url: null,\n width: 0,\n height: 0,\n },\n labels: [],\n alt: \"\",\n caption: \"\",\n};\n\nconst imageWidgetLogic: WidgetLogic = {\n name: \"image\",\n defaultWidgetOptions,\n // The float alignments will be set to inline-block floated left or right.\n // This will allow text to wrap around the widget and not have large space\n // on either side.\n supportedAlignments: [\"block\", \"float-left\", \"float-right\", \"full-width\"],\n defaultAlignment: \"block\",\n // This widget's accessibility depends on its widget option: if the image\n // has a background but no alt text, it is not accessible\n accessible: (widgetOptions: PerseusWidgetOptions): boolean => {\n const imageOptions = widgetOptions as PerseusImageWidgetOptions;\n const bgImage = imageOptions.backgroundImage;\n\n // Accessible if:\n // - has background image and alt text (non-empty)\n // - has background image and decorative is true\n const hasBackgroundImage = bgImage.url != null;\n const hasAltText = !!imageOptions.alt;\n const isDecorative = imageOptions.decorative === true;\n\n return hasBackgroundImage && (hasAltText || isDecorative);\n },\n};\n\nexport default imageWidgetLogic;\n","import type {PerseusInputNumberWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusInputNumberWidgetOptions type\n */\ntype InputNumberPublicWidgetOptions = Pick<\n PerseusInputNumberWidgetOptions,\n | \"answerType\"\n | \"inexact\"\n | \"maxError\"\n | \"rightAlign\"\n | \"simplify\"\n | \"size\"\n | \"customKeypad\"\n>;\n\n/**\n * Given a PerseusInputNumberWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getInputNumberPublicWidgetOptions(\n options: PerseusInputNumberWidgetOptions,\n): InputNumberPublicWidgetOptions {\n const {value: _, ...publicWidgetOptions} = options;\n return publicWidgetOptions;\n}\n\nexport default getInputNumberPublicWidgetOptions;\n","import getInputNumberPublicWidgetOptions from \"./input-number-util\";\n\nimport type {PerseusInputNumberWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type InputNumberDefaultWidgetOptions = Pick<\n PerseusInputNumberWidgetOptions,\n | \"value\"\n | \"simplify\"\n | \"size\"\n | \"inexact\"\n | \"maxError\"\n | \"answerType\"\n | \"rightAlign\"\n>;\n\nconst defaultWidgetOptions: InputNumberDefaultWidgetOptions = {\n value: 0,\n simplify: \"required\",\n size: \"normal\",\n inexact: false,\n maxError: 0.1,\n answerType: \"number\",\n rightAlign: false,\n};\n\nconst inputNumberWidgetLogic: WidgetLogic = {\n name: \"input-number\",\n defaultWidgetOptions,\n defaultAlignment: \"inline-block\",\n accessible: false,\n getPublicWidgetOptions: getInputNumberPublicWidgetOptions,\n};\n\nexport default inputNumberWidgetLogic;\n","import type {PerseusInteractionWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type InteractionDefaultWidgetOptions = Pick<\n PerseusInteractionWidgetOptions,\n \"graph\" | \"elements\"\n>;\n\nconst defaultWidgetOptions: InteractionDefaultWidgetOptions = {\n graph: {\n box: [400, 400],\n labels: [\"x\", \"y\"],\n range: [\n [-10, 10],\n [-10, 10],\n ],\n tickStep: [1, 1],\n gridStep: [1, 1],\n markings: \"graph\",\n },\n elements: [],\n};\n\nconst interactionWidgetLogic: WidgetLogic = {\n name: \"interaction\",\n defaultWidgetOptions,\n accessible: false,\n};\n\nexport default interactionWidgetLogic;\n","const svgLabelsRegex = /^web\\+graphie:/;\n// For offline exercises in the mobile app, we download the graphie data\n// (svgs and localized data files) and serve them from the local file\n// system (with file://). We replace urls that start with `web+graphie`\n// in the perseus json with this `file+graphie` prefix to indicate that\n// they should have the `file://` protocol instead of `https://`.\nconst svgLocalLabelsRegex = /^file\\+graphie:/;\n\n// Sometimes other components want to download the actual image e.g. to\n// determine its size. Here, we transform an .svg-labels url into the\n// correct image url, and leave normal image urls alone\nexport function getRealImageUrl(graphieUrl: string): string {\n if (isLabeledSVG(graphieUrl)) {\n return getSvgUrl(graphieUrl);\n }\n return graphieUrl;\n}\n\nexport function isLabeledSVG(graphieUrl: string): boolean {\n return (\n svgLabelsRegex.test(graphieUrl) || svgLocalLabelsRegex.test(graphieUrl)\n );\n}\n\n// For each graphie, there are two urls we need to download from. This gets\n// the base url without the suffix, and `getSvgUrl` and `getDataUrl` apply\n// appropriate suffixes to get the image and other data\nexport function getBaseUrl(graphieUrl: string): string {\n return graphieUrl\n .replace(svgLabelsRegex, \"https:\")\n .replace(svgLocalLabelsRegex, \"file:\");\n}\n\nexport function getSvgUrl(graphieUrl: string): string {\n return getBaseUrl(graphieUrl) + \".svg\";\n}\n\nexport function getDataUrl(graphieUrl: string): string {\n return getBaseUrl(graphieUrl) + \"-data.json\";\n}\n\nexport async function getImageSizeModern(\n url: string,\n): Promise<[number, number]> {\n const image = new Image();\n\n return new Promise((resolve, reject) => {\n // Handle the success case\n image.onload = () => {\n resolve([image.naturalWidth, image.naturalHeight]);\n };\n\n // Handle the error case\n image.onerror = reject;\n\n // Kick off the loading\n image.src = getRealImageUrl(url);\n });\n}\n","import type {PerseusInteractiveGraphWidgetOptions} from \"../../data-schema\";\n\nexport type InteractiveGraphPublicWidgetOptions = Pick<\n PerseusInteractiveGraphWidgetOptions,\n | \"step\"\n | \"gridStep\"\n | \"snapStep\"\n | \"backgroundImage\"\n | \"markings\"\n | \"labels\"\n | \"showProtractor\"\n | \"showRuler\"\n | \"showTooltips\"\n | \"rulerLabel\"\n | \"rulerTicks\"\n | \"range\"\n | \"graph\"\n | \"lockedFigures\"\n | \"fullGraphAriaLabel\"\n | \"fullGraphAriaDescription\"\n>;\n\nexport default function getInteractiveGraphPublicWidgetOptions(\n options: PerseusInteractiveGraphWidgetOptions,\n): InteractiveGraphPublicWidgetOptions {\n const {correct: _, ...publicOptions} = options;\n return publicOptions;\n}\n","import {isLabeledSVG} from \"../../utils/util.graphie\";\n\nimport getInteractiveGraphPublicWidgetOptions from \"./interactive-graph-util\";\n\nimport type {\n PerseusInteractiveGraphWidgetOptions,\n PerseusWidgetOptions,\n} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type InteractiveGraphDefaultWidgetOptions = Pick<\n PerseusInteractiveGraphWidgetOptions,\n | \"labels\"\n | \"labelLocation\"\n | \"range\"\n | \"step\"\n | \"backgroundImage\"\n | \"markings\"\n | \"showTooltips\"\n | \"showProtractor\"\n | \"graph\"\n | \"correct\"\n>;\n\nconst defaultWidgetOptions: InteractiveGraphDefaultWidgetOptions = {\n labels: [\"x\", \"y\"],\n labelLocation: \"onAxis\",\n range: [\n [-10, 10],\n [-10, 10],\n ],\n step: [1, 1],\n backgroundImage: {\n url: null,\n },\n markings: \"graph\",\n showTooltips: false,\n showProtractor: false,\n graph: {\n type: \"linear\",\n },\n correct: {\n type: \"linear\",\n coords: null,\n },\n};\n\nconst interactiveGraphWidgetLogic: WidgetLogic = {\n name: \"interactive-graph\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getInteractiveGraphPublicWidgetOptions,\n // Function determining if a interactive graph is accessible.\n // Interactive Graphs are accessible as long as:\n // 1. They do not contain a protractor\n // 2. They do not contain a graphie background image\n accessible: (widgetOptions: PerseusWidgetOptions): boolean => {\n const interactiveGraphOptions =\n widgetOptions as PerseusInteractiveGraphWidgetOptions;\n\n // Return false (inaccessible) if the interactive graph contains\n // a protractor.\n if (interactiveGraphOptions.showProtractor) {\n return false;\n }\n\n // Return false (inaccessible) if the interactive graph contains\n // a graphie background image.\n if (\n interactiveGraphOptions.backgroundImage?.url &&\n isLabeledSVG(interactiveGraphOptions.backgroundImage?.url)\n ) {\n return false;\n }\n\n return true;\n },\n};\n\nexport default interactiveGraphWidgetLogic;\n","import type {\n PerseusLabelImageMarker,\n PerseusLabelImageWidgetOptions,\n} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusLabelImageWidgetOptions type\n */\nexport type LabelImagePublicWidgetOptions = {\n choices: PerseusLabelImageWidgetOptions[\"choices\"];\n imageUrl: PerseusLabelImageWidgetOptions[\"imageUrl\"];\n imageAlt: PerseusLabelImageWidgetOptions[\"imageAlt\"];\n imageHeight: PerseusLabelImageWidgetOptions[\"imageHeight\"];\n imageWidth: PerseusLabelImageWidgetOptions[\"imageWidth\"];\n markers: ReadonlyArray<LabelImageMarkerPublicData>;\n hideChoicesFromInstructions: PerseusLabelImageWidgetOptions[\"hideChoicesFromInstructions\"];\n multipleAnswers: PerseusLabelImageWidgetOptions[\"multipleAnswers\"];\n static: PerseusLabelImageWidgetOptions[\"static\"];\n};\n\nexport type LabelImageMarkerPublicData = Pick<\n PerseusLabelImageMarker,\n \"x\" | \"y\" | \"label\"\n>;\n\nexport default function getLabelImagePublicWidgetOptions(\n options: PerseusLabelImageWidgetOptions,\n): LabelImagePublicWidgetOptions {\n return {\n ...options,\n markers: options.markers.map(getLabelImageMarkerPublicData),\n };\n}\n\nfunction getLabelImageMarkerPublicData(\n marker: PerseusLabelImageMarker,\n): LabelImageMarkerPublicData {\n const {answers: _, ...publicData} = marker;\n return publicData;\n}\n","import getLabelImagePublicWidgetOptions from \"./label-image-util\";\n\nimport type {\n PerseusLabelImageWidgetOptions,\n PerseusWidgetOptions,\n} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type LabelImageDefaultWidgetOptions = Pick<\n PerseusLabelImageWidgetOptions,\n | \"choices\"\n | \"imageAlt\"\n | \"imageUrl\"\n | \"imageWidth\"\n | \"imageHeight\"\n | \"markers\"\n | \"multipleAnswers\"\n | \"hideChoicesFromInstructions\"\n>;\n\nconst defaultWidgetOptions: LabelImageDefaultWidgetOptions = {\n choices: [],\n imageAlt: \"\",\n imageUrl: \"\",\n imageWidth: 0,\n imageHeight: 0,\n markers: [],\n multipleAnswers: false,\n hideChoicesFromInstructions: false,\n};\n\nconst labelImageWidgetLogic: WidgetLogic = {\n name: \"label-image\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getLabelImagePublicWidgetOptions,\n // Function determining if a label image is accessible.\n // Label Images is inaccessible if it does not have alt text for the image.\n accessible: (widgetOptions: PerseusWidgetOptions): boolean => {\n const labelImageOptions =\n widgetOptions as PerseusLabelImageWidgetOptions;\n\n if (\n labelImageOptions.imageUrl !== \"\" &&\n labelImageOptions.imageAlt === \"\"\n ) {\n return false;\n }\n\n return true;\n },\n};\n\nexport default labelImageWidgetLogic;\n","/* Note(tamara): Brought over from the perseus package packages/perseus/src/util.ts file.\n May be useful to bring other perseus package utilities here. Contains utility functions\n and types used across multiple widgets for randomization and shuffling. */\n\nimport _ from \"underscore\";\n\n/**\n * A random number generator. Should return floats in the interval [0, 1), like\n * Math.random().\n */\nexport type RNG = () => number;\n\nexport const seededRNG: (seed: number) => RNG = function (seed: number): RNG {\n let randomSeed = seed;\n\n return function () {\n // Robert Jenkins' 32 bit integer hash function.\n let seed = randomSeed;\n seed = (seed + 0x7ed55d16 + (seed << 12)) & 0xffffffff;\n seed = (seed ^ 0xc761c23c ^ (seed >>> 19)) & 0xffffffff;\n seed = (seed + 0x165667b1 + (seed << 5)) & 0xffffffff;\n seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff;\n seed = (seed + 0xfd7046c5 + (seed << 3)) & 0xffffffff;\n seed = (seed ^ 0xb55a4f09 ^ (seed >>> 16)) & 0xffffffff;\n return (randomSeed = seed & 0xfffffff) / 0x10000000;\n };\n};\n\n/**\n * Shuffle an array using a given random seed or function.\n * If `ensurePermuted` is true, the input and output are guaranteed to be\n * distinct permutations.\n */\nexport function shuffle<T>(\n array: ReadonlyArray<T>,\n randomSeed: number | RNG,\n ensurePermuted = false,\n): T[] {\n let random;\n if (typeof randomSeed === \"function\") {\n random = randomSeed;\n } else {\n random = seededRNG(randomSeed);\n }\n\n function isValidShuffle(shuffled: readonly T[]) {\n return ensurePermuted ? !_.isEqual(array, shuffled) : true;\n }\n\n return constrainedShuffle(array, random, isValidShuffle);\n}\n\nexport function constrainedShuffle<T>(\n array: readonly T[],\n random: RNG,\n isValidShuffle: (shuffled: readonly T[]) => boolean,\n): T[] {\n const maxIterations = 100;\n const shuffled = [...array];\n\n // Return early if all elements are equal -- both for performance, and\n // to avoid going into an infinite loop in the (common) case where\n // isValidShuffle is checking the order of the values.\n if (shuffled.every((value) => _.isEqual(value, shuffled[0]))) {\n return shuffled;\n }\n\n for (let i = 0; i < maxIterations; i++) {\n shuffleInPlace(shuffled, random);\n if (isValidShuffle(shuffled)) {\n return shuffled;\n }\n }\n\n throw new Error(\n `constrainedShuffle: constraint not met after ${maxIterations} attempts`,\n );\n}\n\nfunction shuffleInPlace<T>(a: T[], random: RNG): void {\n // The Fisher-Yates shuffling algorithm. See:\n // https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\n for (let i = a.length - 1; i > 0; i--) {\n const k = randomIntInRange(0, i, random);\n [a[k], a[i]] = [a[i], a[k]];\n }\n}\n\nexport function randomIntInRange(\n min: number,\n max: number,\n random: RNG,\n): number {\n return Math.floor(random() * (max - min + 1)) + min;\n}\n\nexport const random: RNG = seededRNG(new Date().getTime() & 0xffffffff);\n","import {constrainedShuffle, seededRNG} from \"../../utils/random-util\";\n\nimport type {PerseusMatcherWidgetOptions} from \"../../data-schema\";\nimport type {RNG} from \"../../utils/random-util\";\nimport type {PerseusMatcherUserInput} from \"../../validation.types\";\n\nexport const shuffleMatcher = (\n options: Pick<\n MatcherPublicWidgetOptions,\n \"left\" | \"right\" | \"orderMatters\"\n >,\n problemNum: number,\n): PerseusMatcherUserInput => {\n // Use the same random() function to shuffle both columns sequentially\n const rng = seededRNG(problemNum);\n\n return {\n // If the order of rows doesn't matter, don't shuffle the left column\n left: !options.orderMatters\n ? options.left\n : shuffleDisplacingFirst(options.left, rng),\n right: shuffleDisplacingFirst(options.right, rng),\n };\n};\n\n/**\n * For details on the individual options, see the\n * PerseusMatcherWidgetOptions type\n */\nexport type MatcherPublicWidgetOptions = {\n labels: PerseusMatcherWidgetOptions[\"labels\"];\n left: PerseusMatcherWidgetOptions[\"left\"];\n right: PerseusMatcherWidgetOptions[\"right\"];\n orderMatters: PerseusMatcherWidgetOptions[\"orderMatters\"];\n padding: PerseusMatcherWidgetOptions[\"padding\"];\n};\n\n/**\n * Given a PerseusMatcherWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getMatcherPublicWidgetOptions(\n options: PerseusMatcherWidgetOptions,\n): MatcherPublicWidgetOptions {\n return {\n ...options,\n left: options.orderMatters\n ? sortAllButFirst(options.left)\n : options.left,\n right: sortAllButFirst(options.right),\n };\n}\n\nfunction sortAllButFirst([first, ...rest]: readonly string[]): string[] {\n return [first, ...rest.sort()];\n}\n\nfunction shuffleDisplacingFirst<T>(array: readonly T[], rng: RNG): T[] {\n function isFirstElementDisplaced(shuffled: readonly T[]) {\n return shuffled[0] !== array[0];\n }\n\n return constrainedShuffle(array, rng, isFirstElementDisplaced);\n}\n\nexport default getMatcherPublicWidgetOptions;\n","import getMatcherPublicWidgetOptions from \"./matcher-util\";\n\nimport type {PerseusMatcherWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type MatcherDefaultWidgetOptions = Pick<\n PerseusMatcherWidgetOptions,\n \"left\" | \"right\" | \"labels\" | \"orderMatters\" | \"padding\"\n>;\n\nconst defaultWidgetOptions: MatcherDefaultWidgetOptions = {\n left: [\"$x$\", \"$y$\", \"$z$\"],\n right: [\"$1$\", \"$2$\", \"$3$\"],\n labels: [\"test\", \"label\"],\n orderMatters: false,\n padding: true,\n};\n\nconst matcherWidgetLogic: WidgetLogic = {\n name: \"matcher\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getMatcherPublicWidgetOptions,\n accessible: false,\n};\n\nexport default matcherWidgetLogic;\n","import type {PerseusMatrixWidgetOptions} from \"../../data-schema\";\n\nexport type MatrixPublicWidgetOptions = Pick<\n PerseusMatrixWidgetOptions,\n \"prefix\" | \"suffix\" | \"cursorPosition\" | \"matrixBoardSize\" | \"static\"\n>;\n\nexport default function getMatrixPublicWidgetOptions(\n options: PerseusMatrixWidgetOptions,\n): MatrixPublicWidgetOptions {\n const {answers: _, ...publicOptions} = options;\n return publicOptions;\n}\n","import getMatrixPublicWidgetOptions from \"./matrix-util\";\n\nimport type {PerseusMatrixWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type MatrixDefaultWidgetOptions = Pick<\n PerseusMatrixWidgetOptions,\n \"matrixBoardSize\" | \"answers\" | \"prefix\" | \"suffix\" | \"cursorPosition\"\n>;\n\nconst defaultWidgetOptions: MatrixDefaultWidgetOptions = {\n matrixBoardSize: [3, 3],\n answers: [[]],\n prefix: \"\",\n suffix: \"\",\n cursorPosition: [0, 0],\n};\n\nconst matrixWidgetLogic: WidgetLogic = {\n name: \"matrix\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getMatrixPublicWidgetOptions,\n accessible: false,\n};\n\nexport default matrixWidgetLogic;\n","import type {PerseusMeasurerWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport const currentVersion = {major: 1, minor: 0};\n\nexport type MeasurerDefaultWidgetOptions = Pick<\n PerseusMeasurerWidgetOptions,\n | \"box\"\n | \"image\"\n | \"showProtractor\"\n | \"showRuler\"\n | \"rulerLabel\"\n | \"rulerTicks\"\n | \"rulerPixels\"\n | \"rulerLength\"\n>;\n\nexport const defaultWidgetOptions: MeasurerDefaultWidgetOptions = {\n box: [480, 480],\n image: {} as any,\n showProtractor: true,\n showRuler: false,\n rulerLabel: \"\",\n rulerTicks: 10,\n rulerPixels: 40,\n rulerLength: 10,\n};\n\nconst measurerWidgetLogic: WidgetLogic = {\n name: \"measurer\",\n version: currentVersion,\n defaultWidgetOptions: defaultWidgetOptions,\n accessible: false,\n};\n\nexport default measurerWidgetLogic;\n","import type {PerseusNumberLineWidgetOptions} from \"../../data-schema\";\n\nexport type NumberLinePublicWidgetOptions = Pick<\n PerseusNumberLineWidgetOptions,\n | \"range\"\n | \"labelRange\"\n | \"labelStyle\"\n | \"labelTicks\"\n | \"isTickCtrl\"\n | \"isInequality\"\n | \"divisionRange\"\n | \"numDivisions\"\n | \"snapDivisions\"\n | \"tickStep\"\n | \"initialX\"\n | \"showTooltips\"\n | \"static\"\n>;\n\nexport default function getNumberLinePublicWidgetOptions(\n options: PerseusNumberLineWidgetOptions,\n): NumberLinePublicWidgetOptions {\n const {correctX: _, correctRel: __, ...publicOptions} = options;\n return publicOptions;\n}\n","import getNumberLinePublicWidgetOptions from \"./number-line-util\";\n\nimport type {PerseusNumberLineWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type NumberLineDefaultWidgetOptions = Pick<\n PerseusNumberLineWidgetOptions,\n | \"range\"\n | \"labelRange\"\n | \"labelStyle\"\n | \"labelTicks\"\n | \"divisionRange\"\n | \"numDivisions\"\n | \"snapDivisions\"\n | \"tickStep\"\n | \"correctRel\"\n | \"correctX\"\n | \"initialX\"\n | \"showTooltips\"\n>;\n\nconst defaultWidgetOptions: NumberLineDefaultWidgetOptions = {\n range: [0, 10],\n\n labelRange: [null, null],\n labelStyle: \"decimal\",\n labelTicks: true,\n\n divisionRange: [1, 12],\n numDivisions: 5,\n snapDivisions: 2,\n\n tickStep: null,\n correctRel: \"eq\",\n correctX: null,\n initialX: null,\n\n showTooltips: false,\n};\n\nconst numberLineWidgetLogic: WidgetLogic = {\n name: \"number-line\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getNumberLinePublicWidgetOptions,\n accessible: false,\n};\n\nexport default numberLineWidgetLogic;\n","import type {\n PerseusNumericInputAnswer,\n PerseusNumericInputWidgetOptions,\n} from \"../../data-schema\";\n\ntype NumericInputAnswerPublicData = Pick<\n PerseusNumericInputAnswer,\n \"answerForms\" | \"simplify\" | \"status\"\n>;\n\n/**\n * For details on the individual options, see the\n * PerseusNumericInputWidgetOptions type\n */\ntype NumericInputPublicWidgetOptions = {\n labelText?: PerseusNumericInputWidgetOptions[\"labelText\"];\n size: PerseusNumericInputWidgetOptions[\"size\"];\n coefficient: PerseusNumericInputWidgetOptions[\"coefficient\"];\n rightAlign?: PerseusNumericInputWidgetOptions[\"rightAlign\"];\n static: PerseusNumericInputWidgetOptions[\"static\"];\n answers: ReadonlyArray<NumericInputAnswerPublicData>;\n};\n\n/**\n * This data from `answers` is used pre-scoring to give hints\n * to the learner regarding the format of accepted answers\n */\nfunction getNumericInputAnswerPublicData(\n answer: PerseusNumericInputAnswer,\n): NumericInputAnswerPublicData {\n const {answerForms, simplify, status} = answer;\n return {\n answerForms,\n simplify,\n status,\n };\n}\n\n/**\n * Given a PerseusNumericInputWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getNumericInputPublicWidgetOptions(\n options: PerseusNumericInputWidgetOptions,\n): NumericInputPublicWidgetOptions {\n const {answers, ...publicWidgetOptions} = options;\n return {\n ...publicWidgetOptions,\n answers: answers.map(getNumericInputAnswerPublicData),\n };\n}\n\nexport default getNumericInputPublicWidgetOptions;\n","import getNumericInputPublicWidgetOptions from \"./numeric-input-util\";\n\nimport type {PerseusNumericInputWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type NumericInputDefaultWidgetOptions = Pick<\n PerseusNumericInputWidgetOptions,\n \"answers\" | \"size\" | \"coefficient\" | \"labelText\" | \"rightAlign\"\n>;\n\nconst defaultWidgetOptions: NumericInputDefaultWidgetOptions = {\n answers: [\n {\n value: null,\n status: \"correct\",\n message: \"\",\n simplify: \"required\",\n answerForms: [],\n strict: false,\n maxError: null,\n },\n ],\n size: \"normal\",\n coefficient: false,\n labelText: \"\",\n rightAlign: false,\n};\n\nconst numericInputWidgetLogic: WidgetLogic = {\n name: \"numeric-input\",\n defaultWidgetOptions,\n defaultAlignment: \"inline-block\",\n getPublicWidgetOptions: getNumericInputPublicWidgetOptions,\n accessible: true,\n};\n\nexport default numericInputWidgetLogic;\n","import type {PerseusOrdererWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusOrdererWidgetOptions type\n */\nexport type OrdererPublicWidgetOptions = Pick<\n PerseusOrdererWidgetOptions,\n \"options\" | \"height\" | \"layout\"\n>;\n\n/**\n * Given a PerseusOrdererWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getOrdererPublicWidgetOptions(\n fullOptions: PerseusOrdererWidgetOptions,\n): OrdererPublicWidgetOptions {\n const {options, height, layout} = fullOptions;\n return {options, height, layout};\n}\n\nexport default getOrdererPublicWidgetOptions;\n","import getOrdererPublicWidgetOptions from \"./orderer-util\";\n\nimport type {PerseusOrdererWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type OrdererDefaultWidgetOptions = Pick<\n PerseusOrdererWidgetOptions,\n \"correctOptions\" | \"otherOptions\" | \"height\" | \"layout\"\n>;\n\nconst defaultWidgetOptions: OrdererDefaultWidgetOptions = {\n correctOptions: [{content: \"$x$\"}] as any,\n otherOptions: [{content: \"$y$\"}] as any,\n height: \"normal\",\n layout: \"horizontal\",\n};\n\nconst ordererWidgetLogic: WidgetLogic = {\n name: \"orderer\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getOrdererPublicWidgetOptions,\n accessible: false,\n};\n\nexport default ordererWidgetLogic;\n","import type {PerseusPassageWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type PassageDefaultWidgetOptions = Pick<\n PerseusPassageWidgetOptions,\n \"passageTitle\" | \"passageText\" | \"footnotes\" | \"showLineNumbers\"\n>;\n\nconst defaultWidgetOptions: PassageDefaultWidgetOptions = {\n passageTitle: \"\",\n passageText: \"\",\n footnotes: \"\",\n showLineNumbers: true,\n};\n\nconst passageWidgetLogic: WidgetLogic = {\n name: \"passage\",\n defaultWidgetOptions,\n accessible: false,\n};\n\nexport default passageWidgetLogic;\n","import type {PerseusPassageRefWidgetOptions} from \"../../data-schema\";\n\nexport const currentVersion = {major: 0, minor: 1};\n\nexport type PassageRefDefaultWidgetOptions = Pick<\n PerseusPassageRefWidgetOptions,\n \"passageNumber\" | \"referenceNumber\" | \"summaryText\"\n>;\n\nexport const defaultWidgetOptions: PassageRefDefaultWidgetOptions = {\n passageNumber: 1,\n referenceNumber: 1,\n summaryText: \"\",\n};\n","import {currentVersion, defaultWidgetOptions} from \"./passage-ref-upgrade\";\n\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type {PassageRefDefaultWidgetOptions} from \"./passage-ref-upgrade\";\n\nconst passageRefWidgetLogic: WidgetLogic = {\n name: \"passage-ref\",\n version: currentVersion,\n defaultWidgetOptions: defaultWidgetOptions,\n defaultAlignment: \"inline\",\n accessible: false,\n};\n\nexport default passageRefWidgetLogic;\n","import type {PerseusPassageRefTargetWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type PassageRefTargetDefaultWidgetOptions = Pick<\n PerseusPassageRefTargetWidgetOptions,\n \"content\"\n>;\n\nconst defaultWidgetOptions: PassageRefTargetDefaultWidgetOptions = {\n content: \"\",\n};\n\nconst passageRefTargetWidgetLogic: WidgetLogic = {\n name: \"passage-ref-target\",\n defaultWidgetOptions,\n defaultAlignment: \"inline\",\n accessible: false,\n};\n\nexport default passageRefTargetWidgetLogic;\n","import type {PerseusPhetSimulationWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type PhetSimulationDefaultWidgetOptions = Pick<\n PerseusPhetSimulationWidgetOptions,\n \"url\" | \"description\"\n>;\n\nconst defaultWidgetOptions: PhetSimulationDefaultWidgetOptions = {\n url: \"\",\n description: \"\",\n};\n\nconst phetSimulationWidgetLogic: WidgetLogic = {\n name: \"phet-simulation\",\n defaultWidgetOptions,\n accessible: true,\n};\n\nexport default phetSimulationWidgetLogic;\n","import type {PerseusPlotterWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusPlotterWidgetOptions type\n */\nexport type PlotterPublicWidgetOptions = Omit<\n PerseusPlotterWidgetOptions,\n \"correct\"\n>;\n\n/**\n * Given a PerseusPlotterWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getPlotterPublicWidgetOptions(\n options: PerseusPlotterWidgetOptions,\n): PlotterPublicWidgetOptions {\n const {correct: _, ...publicOptions} = options;\n return publicOptions;\n}\n\nexport default getPlotterPublicWidgetOptions;\n","import getPlotterPublicWidgetOptions from \"./plotter-util\";\n\nimport type {PerseusPlotterWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type PlotterDefaultWidgetOptions = Pick<\n PerseusPlotterWidgetOptions,\n | \"scaleY\"\n | \"maxY\"\n | \"snapsPerLine\"\n | \"correct\"\n | \"starting\"\n | \"type\"\n | \"labels\"\n | \"categories\"\n | \"picSize\"\n | \"picBoxHeight\"\n | \"plotDimensions\"\n | \"labelInterval\"\n | \"picUrl\"\n>;\n\nconst defaultWidgetOptions: PlotterDefaultWidgetOptions = {\n scaleY: 1,\n maxY: 10,\n snapsPerLine: 2,\n correct: [1],\n starting: [1],\n\n type: \"bar\",\n labels: [\"\", \"\"],\n categories: [\"\"],\n\n picSize: 30,\n picBoxHeight: 36,\n plotDimensions: [275, 200],\n labelInterval: 1,\n\n picUrl: null,\n};\n\nconst plotterWidgetLogic: WidgetLogic = {\n name: \"plotter\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getPlotterPublicWidgetOptions,\n accessible: false,\n};\n\nexport default plotterWidgetLogic;\n","import type {PerseusPythonProgramWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type PythonProgramDefaultWidgetOptions = Pick<\n PerseusPythonProgramWidgetOptions,\n \"programID\" | \"height\"\n>;\n\nconst defaultWidgetOptions: PythonProgramDefaultWidgetOptions = {\n programID: \"\",\n height: 400,\n};\n\nconst pythonProgramWidgetLogic: WidgetLogic = {\n name: \"python-program\",\n defaultWidgetOptions,\n accessible: true,\n};\n\nexport default pythonProgramWidgetLogic;\n","import type {\n PerseusRadioChoice,\n PerseusRadioWidgetOptions,\n} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusRadioWidgetOptions type.\n */\nexport type RadioPublicWidgetOptions = {\n choices: ReadonlyArray<RadioChoicePublicData>;\n hasNoneOfTheAbove?: PerseusRadioWidgetOptions[\"hasNoneOfTheAbove\"];\n countChoices?: PerseusRadioWidgetOptions[\"countChoices\"];\n numCorrect?: PerseusRadioWidgetOptions[\"numCorrect\"];\n randomize?: PerseusRadioWidgetOptions[\"randomize\"];\n multipleSelect?: PerseusRadioWidgetOptions[\"multipleSelect\"];\n deselectEnabled?: PerseusRadioWidgetOptions[\"deselectEnabled\"];\n};\n\n/**\n * Only the options from each Radio choice that should be exposed to the client.\n */\ntype RadioChoicePublicData = Pick<\n PerseusRadioChoice,\n \"id\" | \"content\" | \"isNoneOfTheAbove\"\n>;\n\n/**\n * Given a PerseusRadioChoice object, return a new object with only the public\n * data that should be included in the Radio public widget options.\n */\nfunction getRadioChoicePublicData(\n choice: PerseusRadioChoice,\n): RadioChoicePublicData {\n const {id, content, isNoneOfTheAbove} = choice;\n return {\n id,\n content,\n isNoneOfTheAbove,\n };\n}\n\n/**\n * Shared functionality to determine if numCorrect is used, because:\n *\n * 1. numCorrect is conditionally used for rendering pre-scoring\n * 2. numCorrect also exposes information about answers\n *\n * So only include/use numCorrect when we know it's useful.\n */\nexport function usesNumCorrect(\n multipleSelect: PerseusRadioWidgetOptions[\"multipleSelect\"],\n countChoices: PerseusRadioWidgetOptions[\"countChoices\"],\n numCorrect: PerseusRadioWidgetOptions[\"numCorrect\"],\n) {\n return multipleSelect && countChoices && numCorrect;\n}\n\n/**\n * Given a PerseusRadioWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getRadioPublicWidgetOptions(\n options: PerseusRadioWidgetOptions,\n): RadioPublicWidgetOptions {\n const {numCorrect, choices, multipleSelect, countChoices} = options;\n\n return {\n ...options,\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n numCorrect: usesNumCorrect(multipleSelect, countChoices, numCorrect)\n ? numCorrect\n : undefined,\n choices: choices.map(getRadioChoicePublicData),\n };\n}\n\nexport default getRadioPublicWidgetOptions;\n","import getRadioPublicWidgetOptions from \"./radio-util\";\n\nimport type {PerseusRadioWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport const currentVersion = {major: 3, minor: 0};\n\nexport type RadioDefaultWidgetOptions = Pick<\n PerseusRadioWidgetOptions,\n | \"choices\"\n | \"randomize\"\n | \"hasNoneOfTheAbove\"\n | \"multipleSelect\"\n | \"countChoices\"\n | \"deselectEnabled\"\n>;\n\nexport const defaultWidgetOptions: RadioDefaultWidgetOptions = {\n choices: [\n {content: \"\", id: \"radio-choice-0\"},\n {content: \"\", id: \"radio-choice-1\"},\n {content: \"\", id: \"radio-choice-2\"},\n {content: \"\", id: \"radio-choice-3\"},\n ],\n randomize: false,\n hasNoneOfTheAbove: false,\n multipleSelect: false,\n countChoices: false,\n deselectEnabled: false,\n};\n\nconst radioWidgetLogic: WidgetLogic = {\n name: \"radio\",\n version: currentVersion,\n defaultWidgetOptions: defaultWidgetOptions,\n getPublicWidgetOptions: getRadioPublicWidgetOptions,\n accessible: true,\n};\n\nexport default radioWidgetLogic;\n","import {constrainedShuffle, type RNG, seededRNG} from \"../../utils/random-util\";\n\nimport type {PerseusSorterWidgetOptions} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusSorterWidgetOptions type\n */\nexport type SorterPublicWidgetOptions = {\n // TODO(benchristel): rename to `cards`; the whole point of public widget\n // options is that this isn't the correct order!\n correct: PerseusSorterWidgetOptions[\"correct\"];\n padding: PerseusSorterWidgetOptions[\"padding\"];\n layout: PerseusSorterWidgetOptions[\"layout\"];\n};\n\n/**\n * Given a PerseusSorterWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getSorterPublicWidgetOptions(\n options: PerseusSorterWidgetOptions,\n): SorterPublicWidgetOptions {\n return {\n ...options,\n // To remove information about the correct answer, we sort the cards.\n // However, we leave the first card in place so the client can avoid\n // showing the correct answer to the learner in the initial state of\n // the widget (since that could be confusing).\n correct: sortAllButFirst(options.correct),\n };\n}\n\nexport function shuffleSorter(\n options: Pick<SorterPublicWidgetOptions, \"correct\">,\n problemNum: number,\n): string[] {\n const {correct} = options;\n const rng = seededRNG(problemNum ?? 0);\n // See getSorterPublicWidgetOptions for an explanation of why we need to\n // displace the first card.\n return shuffleDisplacingFirst(correct, rng);\n}\n\nfunction sortAllButFirst([first, ...rest]: readonly string[]): string[] {\n return [first, ...rest.sort()];\n}\n\nfunction shuffleDisplacingFirst<T>(array: readonly T[], rng: RNG): T[] {\n function isFirstElementDisplaced(shuffled: readonly T[]) {\n return shuffled[0] !== array[0];\n }\n\n return constrainedShuffle(array, rng, isFirstElementDisplaced);\n}\n\nexport default getSorterPublicWidgetOptions;\n","import getSorterPublicWidgetOptions from \"./sorter-util\";\n\nimport type {PerseusSorterWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type SorterDefaultWidgetOptions = Pick<\n PerseusSorterWidgetOptions,\n \"correct\" | \"layout\" | \"padding\"\n>;\n\nconst defaultWidgetOptions: SorterDefaultWidgetOptions = {\n correct: [\"$x$\", \"$y$\", \"$z$\"],\n layout: \"horizontal\",\n padding: true,\n};\n\nconst sorterWidgetLogic: WidgetLogic = {\n name: \"sorter\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getSorterPublicWidgetOptions,\n accessible: false,\n};\n\nexport default sorterWidgetLogic;\n","import type {PerseusTableWidgetOptions} from \"../../data-schema\";\n\ntype TablePublicWidgetOptions = Pick<\n PerseusTableWidgetOptions,\n \"headers\" | \"rows\" | \"columns\"\n>;\n\nexport default function getTablePublicWidgetOptions(\n options: PerseusTableWidgetOptions,\n): TablePublicWidgetOptions {\n const {answers: _, ...publicOptions} = options;\n return publicOptions;\n}\n","import getTablePublicWidgetOptions from \"./table-util\";\n\nimport type {PerseusTableWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type TableDefaultWidgetOptions = Pick<\n PerseusTableWidgetOptions,\n \"headers\" | \"rows\" | \"columns\" | \"answers\"\n>;\n\nconst defaultRows = 4;\nconst defaultColumns = 1;\n\n// initialize a 2D array\n// (defaultRows x defaultColumns) of empty strings\nconst answers = new Array(defaultRows)\n .fill(0)\n .map(() => new Array(defaultColumns).fill(\"\"));\n\nconst defaultWidgetOptions: TableDefaultWidgetOptions = {\n headers: [\"\"],\n rows: defaultRows,\n columns: defaultColumns,\n answers: answers,\n};\n\nconst tableWidgetLogic: WidgetLogic = {\n name: \"table\",\n defaultWidgetOptions,\n getPublicWidgetOptions: getTablePublicWidgetOptions,\n accessible: true,\n};\n\nexport default tableWidgetLogic;\n","import type {PerseusVideoWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type VideoDefaultWidgetOptions = Pick<\n PerseusVideoWidgetOptions,\n \"location\"\n>;\n\nconst defaultWidgetOptions: VideoDefaultWidgetOptions = {\n location: \"\",\n};\n\nconst videoWidgetLogic: WidgetLogic = {\n name: \"video\",\n defaultWidgetOptions,\n supportedAlignments: [\"block\", \"float-left\", \"float-right\", \"full-width\"],\n defaultAlignment: \"block\",\n accessible: true,\n};\n\nexport default videoWidgetLogic;\n","import {Errors} from \"../error/errors\";\nimport {PerseusError} from \"../error/perseus-error\";\nimport Registry from \"../utils/registry\";\n\nimport categorizerWidgetLogic from \"./categorizer\";\nimport csProgramWidgetLogic from \"./cs-program\";\nimport definitionWidgetLogic from \"./definition\";\nimport deprecatedStandinWidgetLogic from \"./deprecated-standin\";\nimport dropdownWidgetLogic from \"./dropdown\";\nimport explanationWidgetLogic from \"./explanation\";\nimport expressionWidgetLogic from \"./expression\";\nimport gradedGroupWidgetLogic from \"./graded-group\";\nimport gradedGroupSetWidgetLogic from \"./graded-group-set\";\nimport grapherWidgetLogic from \"./grapher\";\nimport groupWidgetLogic from \"./group\";\nimport iframeWidgetLogic from \"./iframe\";\nimport imageWidgetLogic from \"./image\";\nimport inputNumberWidgetLogic from \"./input-number\";\nimport interactionWidgetLogic from \"./interaction\";\nimport interactiveGraphWidgetLogic from \"./interactive-graph\";\nimport labelImageWidgetLogic from \"./label-image\";\nimport matcherWidgetLogic from \"./matcher\";\nimport matrixWidgetLogic from \"./matrix\";\nimport measurerWidgetLogic from \"./measurer\";\nimport numberLineWidgetLogic from \"./number-line\";\nimport numericInputWidgetLogic from \"./numeric-input\";\nimport ordererWidgetLogic from \"./orderer\";\nimport passageWidgetLogic from \"./passage\";\nimport passageRefWidgetLogic from \"./passage-ref\";\nimport passageRefTargetWidgetLogic from \"./passage-ref-target\";\nimport phetSimulationWidgetLogic from \"./phet-simulation\";\nimport plotterWidgetLogic from \"./plotter\";\nimport pythonProgramWidgetLogic from \"./python-program\";\nimport radioWidgetLogic from \"./radio\";\nimport sorterWidgetLogic from \"./sorter\";\nimport tableWidgetLogic from \"./table\";\nimport videoWidgetLogic from \"./video\";\n\nimport type {\n PublicWidgetOptionsFunction,\n WidgetLogic,\n} from \"./logic-export.types\";\nimport type {PerseusWidgetOptions, PerseusWidget} from \"../data-schema\";\nimport type {Alignment} from \"../types\";\n\nconst widgets = new Registry<WidgetLogic>(\"Core widget registry\");\n\nexport function registerWidget(type: string, logic: WidgetLogic) {\n widgets.set(type, logic);\n}\n\nexport function isWidgetRegistered(type: string) {\n const widgetLogic = widgets.get(type);\n return Boolean(widgetLogic);\n}\n\nexport function getCurrentVersion(type: string) {\n const widgetLogic = widgets.get(type);\n return widgetLogic?.version || {major: 0, minor: 0};\n}\n\n// TODO(LEMS-2870): getPublicWidgetOptionsFunction/PublicWidgetOptionsFunction\n// need better types\nexport const getPublicWidgetOptionsFunction = (\n type: string,\n): PublicWidgetOptionsFunction => {\n return widgets.get(type)?.getPublicWidgetOptions ?? ((i: any) => i);\n};\n\nexport function getDefaultWidgetOptions(type: string) {\n const widgetLogic = widgets.get(type);\n return widgetLogic?.defaultWidgetOptions || {};\n}\n\nexport function isAccessible(\n type: string,\n widgetOptions: PerseusWidgetOptions,\n): boolean {\n const accessible = widgets.get(type)?.accessible;\n return typeof accessible === \"function\"\n ? accessible(widgetOptions)\n : !!accessible;\n}\n\nexport const traverseChildWidgets = (\n widgetInfo: PerseusWidget,\n traverseRenderer: any,\n): PerseusWidget => {\n if (!traverseRenderer) {\n throw new PerseusError(\n \"traverseRenderer must be provided, but was not\",\n Errors.Internal,\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!widgetInfo || !widgetInfo.type || !widgets.get(widgetInfo.type)) {\n return widgetInfo;\n }\n\n const widgetExports = widgets.get(widgetInfo.type);\n const props = widgetInfo.options;\n\n if (widgetExports?.traverseChildWidgets != null && props != null) {\n const newProps = widgetExports.traverseChildWidgets(\n props,\n traverseRenderer,\n );\n return {...widgetInfo, options: newProps};\n }\n return widgetInfo;\n};\n\n/**\n * Handling for the optional alignments for widgets\n * See widget-container.jsx for details on how alignments are implemented.\n */\n\n/**\n * Returns the list of supported alignments for the given (string) widget\n * type. This is used primarily at editing time to display the choices\n * for the user.\n *\n * Supported alignments are given as an array of strings in the exports of\n * a widget's module.\n */\nexport const getSupportedAlignments = (\n type: string,\n): ReadonlyArray<Alignment> => {\n const widgetLogic = widgets.get(type);\n if (!widgetLogic?.supportedAlignments?.[0]) {\n // default alignments\n return [\"default\"];\n }\n return widgetLogic?.supportedAlignments;\n};\n\n/**\n * For the given (string) widget type, determine the default alignment for\n * the widget. This is used at rendering time to go from \"default\" alignment\n * to the actual alignment displayed on the screen.\n *\n * The default alignment is given either as a string (called\n * `defaultAlignment`) or a function (called `getDefaultAlignment`) on\n * the exports of a widget's module.\n */\nexport const getDefaultAlignment = (type: string): Alignment => {\n const widgetLogic = widgets.get(type);\n if (!widgetLogic?.defaultAlignment) {\n return \"block\";\n }\n return widgetLogic.defaultAlignment;\n};\n\n/**\n * Returns the CSS class name corresponding to the specified widget alignment.\n * Uses explicit mapping to make it easy to locate related CSS style definitions.\n */\nexport const getAlignmentClassName = (\n type: string,\n alignment: Alignment,\n): string => {\n switch (alignment) {\n case \"block\":\n return \" widget-block\";\n case \"inline-block\":\n return \" widget-inline-block\";\n case \"inline\":\n return \" widget-inline\";\n case \"float-left\":\n return \" widget-float-left\";\n case \"float-right\":\n return \" widget-float-right\";\n case \"full-width\":\n return \" widget-full-width\";\n case \"default\":\n // This is for widgets that don't have supportedAlignments\n // It doesn't have any impact on styling it is used for error handling\n return getDefaultAlignment(type);\n default:\n return \"\";\n }\n};\n\n/**\n * We use a function here rather than registering widgets\n * at the top-level of the file to avoid circular dependencies.\n * Logic that needs core widget functionality\n * (like a prod or in tests)\n * need to call this function before trying to use that logic.\n */\nexport function registerCoreWidgets() {\n const widgets = [\n categorizerWidgetLogic,\n csProgramWidgetLogic,\n definitionWidgetLogic,\n deprecatedStandinWidgetLogic,\n dropdownWidgetLogic,\n explanationWidgetLogic,\n expressionWidgetLogic,\n gradedGroupWidgetLogic,\n gradedGroupSetWidgetLogic,\n grapherWidgetLogic,\n groupWidgetLogic,\n iframeWidgetLogic,\n imageWidgetLogic,\n inputNumberWidgetLogic,\n interactionWidgetLogic,\n interactiveGraphWidgetLogic,\n labelImageWidgetLogic,\n matcherWidgetLogic,\n matrixWidgetLogic,\n measurerWidgetLogic,\n numberLineWidgetLogic,\n numericInputWidgetLogic,\n ordererWidgetLogic,\n passageWidgetLogic,\n passageRefWidgetLogic,\n passageRefTargetWidgetLogic,\n phetSimulationWidgetLogic,\n plotterWidgetLogic,\n pythonProgramWidgetLogic,\n radioWidgetLogic,\n sorterWidgetLogic,\n tableWidgetLogic,\n videoWidgetLogic,\n ];\n\n widgets.forEach((w) => {\n registerWidget(w.name, w);\n });\n}\n","import _ from \"underscore\";\n\nimport {Errors} from \"../error/errors\";\nimport {PerseusError} from \"../error/perseus-error\";\nimport {mapObject} from \"../utils/objective_\";\n\nimport {\n getCurrentVersion,\n getDefaultWidgetOptions,\n getSupportedAlignments,\n isWidgetRegistered,\n} from \"./core-widget-registry\";\n\nimport type {PerseusWidget, PerseusWidgetsMap} from \"../data-schema\";\n\nconst DEFAULT_STATIC = false;\n\nexport const applyDefaultsToWidget = (\n oldWidgetInfo: PerseusWidget,\n): PerseusWidget => {\n const type = oldWidgetInfo.type;\n // NOTE(jeremy): This looks like it could be replaced by fixing types so\n // that `type` is non-optional. But we're seeing this in Sentry today so I\n // suspect we have legacy data (potentially unpublished) and we should\n // figure that out before depending solely on types.\n if (!_.isString(type)) {\n throw new PerseusError(\n \"widget type must be a string, but was: \" + type,\n Errors.Internal,\n );\n }\n\n if (!isWidgetRegistered(type)) {\n // If we have a widget that isn't registered, we can't upgrade it\n // TODO(aria): Figure out what the best thing to do here would be\n return oldWidgetInfo;\n }\n\n // Unversioned widgets (pre-July 2014) are all implicitly 0.0\n const initialVersion = oldWidgetInfo.version || {major: 0, minor: 0};\n const latestVersion = getCurrentVersion(type);\n\n // If the widget version is later than what we understand (major\n // version is higher than latest, or major versions are equal and minor\n // version is higher than latest), don't perform any upgrades.\n if (\n initialVersion.major > latestVersion.major ||\n (initialVersion.major === latestVersion.major &&\n initialVersion.minor > latestVersion.minor)\n ) {\n return oldWidgetInfo;\n }\n\n let newEditorOptions = _.clone(oldWidgetInfo.options) ?? {};\n\n // Minor version upgrades (eg. new optional props) don't have\n // transform functions. Instead, we fill in the new props with their\n // defaults.\n const defaultOptions = getDefaultWidgetOptions(type);\n newEditorOptions = {\n ...defaultOptions,\n ...newEditorOptions,\n };\n\n let alignment = oldWidgetInfo.alignment;\n\n // Widgets that support multiple alignments will \"lock in\" the\n // alignment to the alignment that would be listed first in the\n // select box. If the widget only supports one alignment, the\n // alignment value will likely just end up as \"default\".\n if (alignment == null || alignment === \"default\") {\n alignment = getSupportedAlignments(type)?.[0];\n if (!alignment) {\n throw new PerseusError(\n \"No default alignment found when upgrading widget\",\n Errors.Internal,\n {metadata: {widgetType: type}},\n );\n }\n }\n\n let widgetStatic = oldWidgetInfo.static;\n\n if (widgetStatic == null) {\n widgetStatic = DEFAULT_STATIC;\n }\n\n return {\n ...oldWidgetInfo,\n // maintain other info, like type\n // After upgrading we guarantee that the version is up-to-date\n version: latestVersion,\n // Default graded to true (so null/undefined becomes true):\n graded: oldWidgetInfo.graded != null ? oldWidgetInfo.graded : true,\n alignment: alignment,\n static: widgetStatic,\n options: newEditorOptions,\n } as any;\n};\n\nexport function applyDefaultsToWidgets(\n oldWidgetOptions: PerseusWidgetsMap,\n): PerseusWidgetsMap {\n return mapObject(oldWidgetOptions, (widgetInfo, widgetId) => {\n if (!widgetInfo.type || !widgetInfo.alignment) {\n const newValues: Record<string, any> = {};\n\n if (!widgetInfo.type) {\n // TODO: why does widget have no type?\n // We don't want to derive type from widget ID\n // see: LEMS-1845\n newValues.type = widgetId.split(\" \")[0];\n }\n\n if (!widgetInfo.alignment) {\n newValues.alignment = \"default\";\n }\n\n widgetInfo = {...widgetInfo, ...newValues};\n }\n\n return applyDefaultsToWidget(widgetInfo) as any;\n });\n}\n","import _ from \"underscore\";\n\nimport {applyDefaultsToWidgets} from \"../widgets/apply-defaults\";\nimport {getPublicWidgetOptionsFunction} from \"../widgets/core-widget-registry\";\n\nimport deepClone from \"./deep-clone\";\n\nimport type {PerseusRenderer} from \"../data-schema\";\n\n/**\n * Return a copy of a PerseusRenderer with rubric data removed (ie answers)\n *\n * @param original - the original, full PerseusRenderer (which includes the rubric - aka answer data)\n */\nexport default function splitPerseusRenderer(\n original: PerseusRenderer,\n): PerseusRenderer {\n const clone = deepClone(original);\n const originalWidgets = clone.widgets ?? {};\n\n const upgradedWidgets = applyDefaultsToWidgets(originalWidgets);\n const splitWidgets = {};\n\n for (const [id, widget] of Object.entries(upgradedWidgets)) {\n /**\n * Static widgets are presentational, used to represent concepts\n * rather than collect answers from learners. For instance we might\n * want a static InteractiveGraph that shows learners a chart before\n * we give them a Radio widget to check their understanding of the chart.\n * We need to keep the answers in this case because it's pre-scoring information.\n */\n if (widget.static) {\n splitWidgets[id] = widget;\n } else {\n const publicWidgetOptionsFun = getPublicWidgetOptionsFunction(\n widget.type,\n );\n splitWidgets[id] = {\n ...widget,\n options: publicWidgetOptionsFun(widget.options as any),\n };\n }\n }\n\n return {\n ...original,\n widgets: splitWidgets,\n };\n}\n","import splitPerseusRenderer from \"../../utils/split-perseus-renderer\";\n\nimport type {\n PerseusGroupWidgetOptions,\n PerseusRenderer,\n} from \"../../data-schema\";\n\n/**\n * For details on the individual options, see the\n * PerseusGroupWidgetOptions type\n */\nexport type GroupPublicWidgetOptions = PerseusRenderer;\n\n/**\n * Given a PerseusGroupWidgetOptions object, return a new object with only\n * the public options that should be exposed to the client.\n */\nfunction getGroupPublicWidgetOptions(\n options: PerseusGroupWidgetOptions,\n): GroupPublicWidgetOptions {\n return splitPerseusRenderer(options);\n}\n\nexport default getGroupPublicWidgetOptions;\n","import getGroupPublicWidgetOptions from \"./group-util\";\n\nimport type {PerseusGroupWidgetOptions} from \"../../data-schema\";\nimport type {WidgetLogic} from \"../logic-export.types\";\n\nexport type GroupDefaultWidgetOptions = Pick<\n PerseusGroupWidgetOptions,\n \"content\" | \"widgets\" | \"images\"\n>;\n\nconst defaultWidgetOptions: GroupDefaultWidgetOptions = {\n content: \"\",\n widgets: {},\n images: {},\n};\n\nconst traverseChildWidgets = function (props: any, traverseRenderer: any): any {\n return {...props, ...traverseRenderer(props)};\n};\n\nconst groupWidgetLogic: WidgetLogic = {\n name: \"group\",\n defaultWidgetOptions,\n accessible: false,\n traverseChildWidgets: traverseChildWidgets,\n getPublicWidgetOptions: getGroupPublicWidgetOptions,\n};\n\nexport default groupWidgetLogic;\n","import {ItemExtras, type PerseusAnswerArea} from \"../data-schema\";\n\nexport default function getDefaultAnswerArea(): PerseusAnswerArea {\n return ItemExtras.reduce(\n (acc, curr) => ({...acc, [curr]: false}),\n {},\n ) as PerseusAnswerArea;\n}\n","import {parseAndMigratePerseusItem} from \"../parse-perseus-json\";\nimport {isFailure} from \"../parse-perseus-json/result\";\n\nimport deepClone from \"./deep-clone\";\nimport splitPerseusRenderer from \"./split-perseus-renderer\";\n\nimport type {PerseusItem} from \"../data-schema\";\n\n/**\n * Return a copy of a PerseusItem with rubric data removed (ie answers)\n *\n * @param original - the original, full PerseusItem (which includes the rubric - aka answer data)\n */\nexport default function splitPerseusItem(original: PerseusItem): PerseusItem {\n const item = deepClone(original);\n\n return {\n ...item,\n question: splitPerseusRenderer(item.question),\n // the final hint often exposes the answer\n // so we consider that part of the answer data\n hints: [],\n };\n}\n\n/**\n * Returns a JSON copy of a PerseusItem with rubric data (i.e. answers and\n * hints) removed. Idempotent and deterministic.\n *\n * @param data a {@linkcode PerseusItem}, either as JSON or as an object.\n * @returns {string} the answerless data formatted as JSON\n * @throws {SyntaxError} given malformed JSON or data that can't be parsed as\n * a Perseus item.\n */\nexport function splitPerseusItemJSON(data: unknown): string {\n const parseResult = parseAndMigratePerseusItem(data);\n if (isFailure(parseResult)) {\n throw new SyntaxError(parseResult.detail.message);\n }\n const item = parseResult.value;\n\n return JSON.stringify(splitPerseusItem(item));\n}\n","/**\n * IMPORTANT:\n * 1. Do not delete this file or the variable below.\n * This will be the definition of the active feature flags in Perseus\n * that will hide features/changes under development. This will be used\n * by flags of APIOptions type.\n * 2. Also add the new flag in front-end repo's perseus-feature-flags.ts file\n * 3. Do cleanup unused feature flags\n * 4. When no active feature flag is available value will be:\n * export const PerseusFeatureFlags = [];\n * 5. Also update the testing/feature-flags-util.ts for testing purpose\n */\nconst PerseusFeatureFlags = [\n \"new-radio-widget\", // TODO(LEMS-2994): cleanup feature flag\n \"image-widget-upgrade\", // TODO(LEMS-3521): cleanup feature flag\n] as const;\n\nexport default PerseusFeatureFlags;\n\n/**\n * Checks if a feature flag is enabled in the given props.\n */\nexport function isFeatureOn(\n props: {apiOptions?: {flags?: Record<string, boolean>}},\n flag: string,\n): boolean {\n return props.apiOptions?.flags?.[flag] ?? false;\n}\n","/**\n * Traverses a {content, widgets, images} renderer props object,\n * such as `itemData.question`\n *\n * This traversal is deep and handles some widget prop upgrades\n * (TODO(aria): Handle minor prop upgrades :) )\n *\n * This is the right way to traverse itemData.\n *\n * NOTE: We should not expose this on the perseus API yet. Instead,\n * build the traversal method you want inside perseus, and use this\n * from that. We might eventually expose this, but I'd like to be\n * more confident in the interface provided first.\n */\n\nimport _ from \"underscore\";\n\nimport {mapObject} from \"./utils/objective_\";\nimport * as Widgets from \"./widgets/core-widget-registry\";\n\nimport type {PerseusRenderer} from \"./data-schema\";\n\nconst noop = function () {};\n\nconst deepCallbackFor = function (\n contentCallback: (arg1: any) => void,\n widgetCallback: (widgetInfo: any, widgetId: string) => any,\n optionsCallback: (arg1: any) => void,\n) {\n const deepCallback = function (widgetInfo: any, widgetId: string) {\n const newWidgetInfo = Widgets.traverseChildWidgets(\n widgetInfo,\n (rendererOptions) => {\n return traverseRenderer(\n rendererOptions,\n contentCallback,\n // so that we traverse grandchildren, too:\n deepCallback,\n optionsCallback,\n );\n },\n );\n\n const userWidgetInfo = widgetCallback(newWidgetInfo, widgetId);\n if (userWidgetInfo !== undefined) {\n return userWidgetInfo;\n }\n return newWidgetInfo;\n };\n return deepCallback;\n};\n\nconst traverseRenderer = function (\n rendererOptions,\n contentCallback: (arg1: any) => void,\n deepWidgetCallback: (widgetInfo: any, widgetId: string) => any,\n optionsCallback: (arg1: any) => void,\n) {\n let newContent = rendererOptions.content;\n if (rendererOptions.content != null) {\n const modifiedContent = contentCallback(rendererOptions.content);\n if (modifiedContent !== undefined) {\n newContent = modifiedContent;\n }\n }\n\n const newWidgets = mapObject(\n rendererOptions.widgets || {},\n function (widgetInfo, widgetId) {\n // Widgets without info or a type are empty widgets, and\n // should always be renderable. It's also annoying to write\n // checks for this everywhere, so we just filter them out once and\n // for all!\n // @ts-expect-error - TS2571 - Object is of type 'unknown'.\n if (widgetInfo == null || widgetInfo.type == null) {\n return widgetInfo;\n }\n return deepWidgetCallback(widgetInfo, widgetId);\n },\n );\n\n const newOptions = _.extend({}, rendererOptions, {\n content: newContent,\n widgets: newWidgets,\n });\n const userOptions = optionsCallback(newOptions);\n if (userOptions !== undefined) {\n return userOptions;\n }\n return newOptions;\n};\n\nexport const traverse = function (\n rendererOptions: PerseusRenderer,\n contentCallback?: ((arg1: any) => any) | null,\n widgetCallback?: ((widgetInfo: any, widgetId: string) => any) | null,\n optionsCallback?: (arg1: any) => void,\n): any {\n contentCallback = contentCallback || noop;\n widgetCallback = widgetCallback || noop;\n optionsCallback = optionsCallback || noop;\n\n return traverseRenderer(\n rendererOptions,\n contentCallback,\n deepCallbackFor(contentCallback, widgetCallback, optionsCallback),\n optionsCallback,\n );\n};\n","/**\n * Identifies whether or not a given perseus item requires the use of a mouse\n * or screen, based on the widgets it contains.\n */\n\nimport {parse, traverseContent} from \"@khanacademy/pure-markdown\";\n\nimport {traverse} from \"./traversal\";\nimport * as Widgets from \"./widgets/core-widget-registry\";\n\nimport type {PerseusItem, PerseusWidgetsMap} from \"./data-schema\";\n\n/**\n * Returns a list of widget types that cause a given Perseus item to require\n * the use of a screen or mouse.\n *\n * For now we'll just check the `accessible` field on each of the widgets\n * in the item data, but in the future we may specify accessibility on\n * each widget with higher granularity.\n *\n * @deprecated This function returns a list of widget _types_ that violate our\n * accessibility requirements which is not very accurate given that some\n * instances _could_ be accessible and some not based on their widget options.\n * In most cases, you should use {@link isItemAccessible} instead.\n *\n * @todo Inline this into {@link isItemAccessible}!\n */\nexport function violatingWidgets(itemData: PerseusItem): Array<string> {\n // TODO(jordan): Hints as well\n const widgetTypes: Array<string> = [];\n\n traverse(itemData.question, null, function (info) {\n if (info.type && !Widgets.isAccessible(info.type, info.options)) {\n widgetTypes.push(info.type);\n }\n });\n\n // Uniquify the list of widgets (by type)\n return [...new Set(widgetTypes)];\n}\n\n/**\n * Returns true if the given Perseus item is accessible (i.e., does not contain\n * any widgets that violate our accessibility requirements).\n */\nexport function isItemAccessible(itemData: PerseusItem): boolean {\n // Traverse the item question Markdown to look for content that is\n // inaccessible.\n const ast = parse(itemData.question.content);\n const widgetIdsInUse = new Set<string>();\n let hasInaccessibleImage = false;\n\n traverseContent(ast, (node) => {\n // Markdown images without alt text are inaccessible!\n if (node.type === \"image\" && (node.alt == null || node.alt === \"\")) {\n hasInaccessibleImage = true;\n return;\n }\n\n // We collect widget IDs used in the Markdown content so we can exclude\n // unused widgets when checking for violating widgets below.\n if (node.type === \"widget\") {\n widgetIdsInUse.add(node.id);\n }\n });\n\n if (hasInaccessibleImage) {\n return false;\n }\n\n // Finally, check if any widgets are inaccessible.\n const itemDataWithOnlyActiveWidgets: PerseusItem = {\n ...itemData,\n question: {\n ...itemData.question,\n // We have to cast the result here to PerseusWidgetsMap manually\n // because TypeScript gets confused by Object.fromEntries() (it\n // can't map that the id matches the object in the entry).\n widgets: Object.fromEntries(\n Object.entries(itemData.question.widgets).filter(([id]) =>\n widgetIdsInUse.has(id),\n ),\n ) as PerseusWidgetsMap,\n },\n };\n return violatingWidgets(itemDataWithOnlyActiveWidgets).length === 0;\n}\n","import type {PerseusImageWidgetOptions, ImageWidget} from \"../../data-schema\";\n\nexport function generateImageOptions(\n options?: Partial<PerseusImageWidgetOptions>,\n): PerseusImageWidgetOptions {\n const defaultImageOptions: PerseusImageWidgetOptions = {\n backgroundImage: {},\n };\n\n return {\n ...defaultImageOptions,\n ...options,\n };\n}\n\nexport function generateImageWidget(\n imageWidgetProperties?: Partial<Omit<ImageWidget, \"type\">>,\n): ImageWidget {\n return {\n type: \"image\",\n graded: true,\n version: {major: 0, minor: 0},\n static: false,\n alignment: \"default\",\n options: generateImageOptions({}), // default options\n ...imageWidgetProperties,\n };\n}\n","export type {PerseusAnalyticsEvent, AnalyticsEventHandlerFn} from \"./analytics\";\nexport type {\n KEScore,\n RendererInterface,\n MarkerType,\n InteractiveMarkerType,\n Relationship,\n Alignment,\n RecursiveReadonly,\n} from \"./types\";\nexport type {\n KeypadKey,\n KeypadConfiguration,\n KeypadContextRendererInterface,\n} from \"./keypad\";\nexport type {ErrorKind} from \"./error/errors\";\nexport {default as ErrorCodes, type ErrorCode} from \"./error-codes\";\nexport type {FunctionTypeMappingKeys} from \"./utils/grapher-util\";\nexport type {Coords} from \"./utils/grapher-types\";\nexport type * from \"./validation.types\";\n\nexport {default as getMatrixSize} from \"./utils/get-matrix-size\";\nexport {default as getDecimalSeparator} from \"./utils/get-decimal-separator\";\nexport {getDivideSymbol} from \"./utils/get-divide-symbol\";\nexport {getDivideSymbolForTex} from \"./utils/get-divide-symbol\";\nexport {approximateEqual, approximateDeepEqual} from \"./utils/equality\";\nexport {\n addWidget,\n getWidgetIdsFromContent,\n getWidgetIdsFromContentByType,\n} from \"./utils/widget-id-utils\";\n\nexport {default as deepClone} from \"./utils/deep-clone\";\nexport * as GrapherUtil from \"./utils/grapher-util\";\nexport {\n generateTestPerseusItem,\n generateTestPerseusRenderer,\n} from \"./utils/test-utils\";\nexport {itemHasRationales} from \"./utils/item-has-rationales\";\nexport {itemHasHints} from \"./utils/item-has-hints\";\n\nexport {\n parsePerseusItem,\n parseAndMigratePerseusItem,\n parseAndMigratePerseusArticle,\n parseAndMigrateUserInputMap,\n type ParseFailureDetail,\n} from \"./parse-perseus-json\";\n\nexport {\n isSuccess,\n isFailure,\n type Result,\n type Success,\n type Failure,\n} from \"./parse-perseus-json/result\";\n\nexport {libVersion} from \"./version\";\n\nexport {Errors} from \"./error/errors\";\nexport {PerseusError} from \"./error/perseus-error\";\n\nexport * from \"./data-schema\";\n\nexport {pluck, mapObject} from \"./utils/objective_\";\n\nexport {default as categorizerLogic} from \"./widgets/categorizer\";\nexport type {CategorizerDefaultWidgetOptions} from \"./widgets/categorizer\";\nexport {default as csProgramLogic} from \"./widgets/cs-program\";\nexport type {CSProgramDefaultWidgetOptions} from \"./widgets/cs-program\";\nexport {default as definitionLogic} from \"./widgets/definition\";\nexport type {DefinitionDefaultWidgetOptions} from \"./widgets/definition\";\nexport {default as dropdownLogic} from \"./widgets/dropdown\";\nexport type {DropdownDefaultWidgetOptions} from \"./widgets/dropdown\";\nexport {default as explanationLogic} from \"./widgets/explanation\";\nexport type {ExplanationDefaultWidgetOptions} from \"./widgets/explanation\";\nexport {default as expressionLogic} from \"./widgets/expression\";\nexport type {ExpressionDefaultWidgetOptions} from \"./widgets/expression\";\nexport {default as deriveExtraKeys} from \"./widgets/expression/derive-extra-keys\";\nexport {default as gradedGroupLogic} from \"./widgets/graded-group\";\nexport {default as freeResponseLogic} from \"./widgets/free-response\";\nexport type {FreeResponseDefaultWidgetOptions} from \"./widgets/free-response\";\nexport type {GradedGroupDefaultWidgetOptions} from \"./widgets/graded-group\";\nexport {default as gradedGroupSetLogic} from \"./widgets/graded-group-set\";\nexport type {GradedGroupSetDefaultWidgetOptions} from \"./widgets/graded-group-set\";\nexport {default as grapherLogic} from \"./widgets/grapher\";\nexport type {GrapherDefaultWidgetOptions} from \"./widgets/grapher\";\nexport {default as groupLogic} from \"./widgets/group\";\nexport type {GroupDefaultWidgetOptions} from \"./widgets/group\";\nexport {default as iframeLogic} from \"./widgets/iframe\";\nexport type {IFrameDefaultWidgetOptions} from \"./widgets/iframe\";\nexport {default as imageLogic} from \"./widgets/image\";\nexport type {ImageDefaultWidgetOptions} from \"./widgets/image\";\nexport {default as inputNumberLogic} from \"./widgets/input-number\";\nexport type {InputNumberDefaultWidgetOptions} from \"./widgets/input-number\";\nexport {default as interactionLogic} from \"./widgets/interaction\";\nexport type {InteractionDefaultWidgetOptions} from \"./widgets/interaction\";\nexport {default as interactiveGraphLogic} from \"./widgets/interactive-graph\";\nexport type {InteractiveGraphDefaultWidgetOptions} from \"./widgets/interactive-graph\";\nexport {default as labelImageLogic} from \"./widgets/label-image\";\nexport type {LabelImageDefaultWidgetOptions} from \"./widgets/label-image\";\nexport {default as matcherLogic} from \"./widgets/matcher\";\nexport type {MatcherDefaultWidgetOptions} from \"./widgets/matcher\";\nexport {default as matrixLogic} from \"./widgets/matrix\";\nexport type {MatrixDefaultWidgetOptions} from \"./widgets/matrix\";\nexport {default as measurerLogic} from \"./widgets/measurer\";\nexport type {MeasurerDefaultWidgetOptions} from \"./widgets/measurer\";\nexport {default as numberLineLogic} from \"./widgets/number-line\";\nexport type {NumberLineDefaultWidgetOptions} from \"./widgets/number-line\";\nexport {default as numericInputLogic} from \"./widgets/numeric-input\";\nexport type {NumericInputDefaultWidgetOptions} from \"./widgets/numeric-input\";\nexport {default as ordererLogic} from \"./widgets/orderer\";\nexport type {OrdererDefaultWidgetOptions} from \"./widgets/orderer\";\nexport {default as passageLogic} from \"./widgets/passage\";\nexport type {PassageDefaultWidgetOptions} from \"./widgets/passage\";\nexport {default as passageRefLogic} from \"./widgets/passage-ref\";\nexport type {PassageRefDefaultWidgetOptions} from \"./widgets/passage-ref\";\nexport {default as passageRefTargetLogic} from \"./widgets/passage-ref-target\";\nexport type {PassageRefTargetDefaultWidgetOptions} from \"./widgets/passage-ref-target\";\nexport {default as phetSimulationLogic} from \"./widgets/phet-simulation\";\nexport type {PhetSimulationDefaultWidgetOptions} from \"./widgets/phet-simulation\";\nexport {default as plotterLogic} from \"./widgets/plotter\";\nexport type {PlotterDefaultWidgetOptions} from \"./widgets/plotter\";\nexport {default as pythonProgramLogic} from \"./widgets/python-program\";\nexport type {PythonProgramDefaultWidgetOptions} from \"./widgets/python-program\";\nexport {default as radioLogic} from \"./widgets/radio\";\nexport type {RadioDefaultWidgetOptions} from \"./widgets/radio\";\nexport {usesNumCorrect} from \"./widgets/radio/radio-util\";\nexport {default as sorterLogic} from \"./widgets/sorter\";\nexport type {SorterDefaultWidgetOptions} from \"./widgets/sorter\";\nexport {default as tableLogic} from \"./widgets/table\";\nexport type {TableDefaultWidgetOptions} from \"./widgets/table\";\nexport {default as videoLogic} from \"./widgets/video\";\nexport type {VideoDefaultWidgetOptions} from \"./widgets/video\";\n\nexport {\n applyDefaultsToWidgets,\n applyDefaultsToWidget,\n} from \"./widgets/apply-defaults\";\n\nexport {default as getDefaultAnswerArea} from \"./utils/get-default-answer-area\";\nexport {\n default as splitPerseusItem,\n splitPerseusItemJSON,\n} from \"./utils/split-perseus-item\";\nexport {default as Registry} from \"./utils/registry\";\n\nexport type * from \"./widgets/logic-export.types\";\n\nexport * as CoreWidgetRegistry from \"./widgets/core-widget-registry\";\n\nexport {default as getOrdererPublicWidgetOptions} from \"./widgets/orderer/orderer-util\";\nexport type {OrdererPublicWidgetOptions} from \"./widgets/orderer/orderer-util\";\nexport {default as getCategorizerPublicWidgetOptions} from \"./widgets/categorizer/categorizer-util\";\nexport type {CategorizerPublicWidgetOptions} from \"./widgets/categorizer/categorizer-util\";\nexport {default as getCSProgramPublicWidgetOptions} from \"./widgets/cs-program/cs-program-util\";\nexport {default as getExpressionPublicWidgetOptions} from \"./widgets/expression/expression-util\";\nexport {default as getFreeResponsePublicWidgetOptions} from \"./widgets/free-response/free-response-util\";\nexport type {ExpressionPublicWidgetOptions} from \"./widgets/expression/expression-util\";\nexport {default as getGrapherPublicWidgetOptions} from \"./widgets/grapher/grapher-util\";\nexport type {GrapherPublicWidgetOptions} from \"./widgets/grapher/grapher-util\";\nexport {default as getGroupPublicWidgetOptions} from \"./widgets/group/group-util\";\nexport {\n default as getInteractiveGraphPublicWidgetOptions,\n type InteractiveGraphPublicWidgetOptions,\n} from \"./widgets/interactive-graph/interactive-graph-util\";\nexport {default as getLabelImagePublicWidgetOptions} from \"./widgets/label-image/label-image-util\";\nexport {\n default as getSorterPublicWidgetOptions,\n shuffleSorter,\n} from \"./widgets/sorter/sorter-util\";\nexport type {SorterPublicWidgetOptions} from \"./widgets/sorter/sorter-util\";\nexport type {LabelImagePublicWidgetOptions} from \"./widgets/label-image/label-image-util\";\nexport type {LabelImageMarkerPublicData} from \"./widgets/label-image/label-image-util\";\nexport {default as getDropdownPublicWidgetOptions} from \"./widgets/dropdown/dropdown-util\";\nexport type {DropdownPublicWidgetOptions} from \"./widgets/dropdown/dropdown-util\";\nexport {default as getNumericInputPublicWidgetOptions} from \"./widgets/numeric-input/numeric-input-util\";\nexport {default as getNumberLinePublicWidgetOptions} from \"./widgets/number-line/number-line-util\";\nexport type {NumberLinePublicWidgetOptions} from \"./widgets/number-line/number-line-util\";\nexport {default as getRadioPublicWidgetOptions} from \"./widgets/radio/radio-util\";\nexport type {RadioPublicWidgetOptions} from \"./widgets/radio/radio-util\";\nexport {deriveNumCorrect} from \"./widgets/radio/derive-num-correct\";\nexport {default as getTablePublicWidgetOptions} from \"./widgets/table/table-util\";\nexport {default as getIFramePublicWidgetOptions} from \"./widgets/iframe/iframe-util\";\nexport {default as getMatrixPublicWidgetOptions} from \"./widgets/matrix/matrix-util\";\nexport type {MatrixPublicWidgetOptions} from \"./widgets/matrix/matrix-util\";\nexport {default as getPlotterPublicWidgetOptions} from \"./widgets/plotter/plotter-util\";\nexport type {PlotterPublicWidgetOptions} from \"./widgets/plotter/plotter-util\";\nexport {\n default as getMatcherPublicWidgetOptions,\n shuffleMatcher,\n} from \"./widgets/matcher/matcher-util\";\nexport type {MatcherPublicWidgetOptions} from \"./widgets/matcher/matcher-util\";\nexport {shuffle, seededRNG, random} from \"./utils/random-util\";\nexport {default as PerseusFeatureFlags, isFeatureOn} from \"./feature-flags\";\n\nexport {traverse} from \"./traversal\";\nexport {isItemAccessible, violatingWidgets} from \"./accessibility\";\nexport {\n isLabeledSVG,\n getRealImageUrl,\n getBaseUrl,\n getSvgUrl,\n getDataUrl,\n getImageSizeModern,\n} from \"./utils/util.graphie\";\n\nexport {\n generateImageOptions,\n generateImageWidget,\n} from \"./utils/generators/image-widget-generator\";\n\nimport {registerCoreWidgets} from \"./widgets/core-widget-registry\";\n\nregisterCoreWidgets();\n"],"names":["APPROXIMATED_PI_ERROR","CHOOSE_CORRECT_NUM_ERROR","EXTRA_SYMBOLS_ERROR","FILL_ALL_CELLS_ERROR","INVALID_CHOICE_SELECTION","INVALID_SELECTION_ERROR","MISSING_PERCENT_ERROR","MULTIPLICATION_SIGN_ERROR","NEEDS_TO_BE_SIMPLIFIED_ERROR","NOT_NONE_ABOVE_ERROR","USER_INPUT_EMPTY","USER_INPUT_TOO_LONG","WRONG_CASE_ERROR","WRONG_LETTER_ERROR","ErrorCodes","getMatrixSize","matrix","matrixSize","forEach","matrixRow","row","rowWidth","matrixCol","col","toString","length","Math","max","getDecimalSeparator","locale","numberWithDecimalSeparator","match","Intl","NumberFormat","format","localesThatUseColon","getDivideSymbol","includes","getDivideSymbolForTex","divideSymbol","approximateEqual","x","y","abs","approximateDeepEqual","Array","isArray","i","_","all","v","k","addWidget","id","getWidgetRegex","getWidgetIdsFromContent","content","widgets","localWidgetRegex","exec","push","getWidgetIdsFromContentByType","type","widgetMap","rv","widgetIdsInContent","widgetId","widget","deepClone","obj","JSON","parse","stringify","MOVABLES","PLOT","PARABOLA","SINUSOID","canonicalSineCoefficients","coeffs","amplitude","angularFrequency","phase","verticalOffset","period","PI","canonicalTangentCoefficients","PlotDefaults","areEqual","coeffs1","coeffs2","movable","getPropsForCoeffs","fn","partial","getFunctionForCoeffs","Linear","extend","url","defaultCoords","getCoefficients","coords","p1","p2","denom","num","m","b","getEquationString","toFixed","Quadratic","h","a","c","Sinusoid","d","sin","Tangent","tan","Exponential","defaultAsymptote","extraCoordConstraint","newCoord","oldCoord","asymptote","graph","coord","extraAsymptoteConstraint","isValid","oldY","wasBelow","bottomMost","min","map","snapStep","topMost","allowReflectOverAsymptote","log","exp","Logarithm","oldX","wasLeft","leftMost","rightMost","flip","inverseCoeffs","AbsoluteValue","horizontalOffset","functionTypeMapping","linear","quadratic","sinusoid","tangent","exponential","logarithm","absolute_value","allTypes","keys","functionForType","blankPerseusRenderer","images","generateTestPerseusRenderer","customFields","blankPerseusItemData","question","answerArea","calculator","periodicTable","financialCalculatorMonthlyPayment","financialCalculatorTotalAmount","financialCalculatorTimeToPayOff","periodicTableWithKey","hints","generateTestPerseusItem","itemHasRationales","item","widgetsHaveRationales","Object","values","some","widgetHasRationales","radioWidgetHasRationales","labelImageWidgetHasRationales","options","choices","choice","rationale","markers","marker","answers","itemHasHints","isRealJSONParse","jsonParse","randomPhrase","buildRandomPhrase","randomHintPhrase","randomString","buildRandomString","testingObject","floor","random","expression1","alignment","graded","answerForms","considered","form","key","simplify","value","ariaLabel","buttonSets","functions","static","times","visibleLabel","version","major","minor","testJSON","buildTestData","replace","parsedTestJSON","parsedTestItemData","data","assessmentItem","itemData","capitalize","randomLength","randomLetter","String","fromCharCode","toUpperCase","phrases","modifierStart","modifierEnd","modifierIndex","join","testObject","success","failure","detail","isFailure","result","isSuccess","results","combineFailureDetails","failureDetails","reduce","ErrorTrackingParseContext","expected","badValue","wrapInArray","path","forSubtree","constructor","formatPath","formatPathSegment","segment","validIdentifier","test","message","conjoin","items","allButLast","slice","last","parser","any","rawValue","ctx","array","elementParser","elementResults","elem","Result","concat","arrayWithIndex","elementParserFactory","index","boolean","constant","acceptedValue","defaulted","fallback","defaultedNonEmptyString","trim","enumeration","acceptedValues","indexOf","objectConstructorString","prototype","functionToString","Function","isPlainObject","getPrototypeOf","call","nullable","parseValue","number","objectWithAllPropertiesRequired","schema","object","ret","mismatches","prop","propParser","entries","undefined","optional","pair","parseA","parseB","rawA","rawB","resultA","resultB","pipeParsers","p","ParserPipeline","then","nextParser","composeParsers","parserA","parserB","partialResult","record","parseKey","entryCtx","keyResult","valueResult","string","trio","parseC","resultC","union","parseBranch","UnionBuilder","or","newBranch","either","parsePerseusImageDetail","width","height","parseImages","parseWidget","parseType","parseOptions","parseWidgetWithVersion","parseVersion","parseCategorizerWidget","categories","randomizeItems","highlightLint","linterContext","contentType","paths","stack","parseCSProgramWidget","programID","programType","settings","name","showEditor","showButtons","parseDefinitionWidget","togglePrompt","definition","parseDropdownWidget","placeholder","correct","parseExplanationWidget","showPrompt","hidePrompt","explanation","rawVal","parseWidgetsMap","KeypadKeys","deriveExtraKeys","widgetOptions","extraKeys","defaultKeys","uniqueExtraVariables","uniqueExtraConstants","answerForm","maybeExpr","KAS","parsed","expr","isGreek","symbol","toKey","isKey","variable","getVars","maybeKey","getConsts","extraVariables","sort","extraConstants","convert","f","parseLegacyButtonSet","parseLegacyButtonSets","versionedWidgetOptions","latestMajorVersion","parseLatest","VersionedWidgetOptionsParserBuilder","latest","raw","withMigrationFrom","majorVersion","parseOldVersion","migrateToNextVersion","parseOtherVersions","migrateToLatest","old","parseThisVersion","parseThisVersionAndMigrateToLatest","versionParseResult","parseVersionedObject","stringOrNumberOrNullOrUndefined","numberOrNullToString","parsePossiblyInvalidAnswerForm","removeInvalidAnswerForms","possiblyInvalid","flatMap","parseAnswerForms","version2","parseExpressionWidgetV2","buttonsVisible","version1","parseExpressionWidgetV1","migrateV1ToV2","version0","parseExpressionWidgetV0","migrateV0ToV1","parseExpressionWidget","parseFreeResponseWidget","allowUnlimitedCharacters","characterLimit","scoringCriteria","text","falseToNull","parseGradedGroupWidgetOptions","title","hasHint","hint","parsePerseusRenderer","widgetEnabled","immutableWidgets","parseGradedGroupWidget","parseGradedGroupSetWidget","gradedGroups","discriminatedUnionOn","discriminantKey","noMoreBranches","DiscriminatedUnionBuilder","withBranch","discriminantValue","parseNewVariant","parseNewBranch","discriminatedUnionBranch","parseVariant","parseOtherBranches","pairOfNumbers","pairOfPoints","emptyArray","parseCoords","parseCorrect","parseGrapherWidget","availableTypes","backgroundImage","bottom","left","scale","box","editableSettings","gridStep","labels","markings","range","rulerLabel","rulerTicks","showProtractor","showRuler","showTooltips","step","valid","parseGroupWidget","parseIframeWidget","allowFullScreen","allowTopNavigation","stringToNumber","parsedNumber","isNaN","emptyToZero","imageDimensionToNumber","dimensionOrUndefined","parsePerseusImageBackground","top","parseImageWidget","caption","alt","longDescription","decorative","coordinates","booleanToString","parseInputNumberWidget","answerType","inexact","maxError","rightAlign","size","customKeypad","stringOrEmpty","parseFunctionElement","funcName","rangeMin","rangeMax","color","strokeDasharray","strokeWidth","parseLabelElement","label","coordX","coordY","parseLineElement","startX","startY","endX","endY","arrows","parseMovableLineElement","startSubscript","endSubscript","constraint","snap","constraintFn","constraintXMin","constraintXMax","constraintYMin","constraintYMax","parseMovablePointElement","varSubscript","parseParametricElement","parsePointElement","parseRectangleElement","parseInteractionWidget","tickStep","elements","ItemExtras","PerseusExpressionAnswerFormConsidered","lockedFigureColorNames","lockedFigureColors","blue","green","grayH","purple","pink","red","orange","lockedFigureFillStyles","none","white","translucent","solid","plotterPlotTypes","parsePerseusGraphTypeAngle","showAngles","allowReflexAngles","angleOffsetDeg","snapDegrees","startCoords","parsePerseusGraphTypeCircle","center","radius","parsePerseusGraphTypeLinear","parsePerseusGraphTypeLinearSystem","parsePerseusGraphTypeNone","parsePerseusGraphTypePoint","numPoints","parsePerseusGraphTypePolygon","numSides","showSides","snapTo","parsePerseusGraphTypeQuadratic","parsePerseusGraphTypeRay","parsePerseusGraphTypeSegment","numSegments","parsePerseusGraphTypeSinusoid","parsePerseusGraphType","parseLockedFigureColor","parseLockedFigureFillType","parseLockedLineStyle","parseStrokeWeight","parseLockedLabelType","parseLockedPointType","filled","parseLockedLineType","kind","points","lineStyle","showPoint1","showPoint2","weight","parseLockedVectorType","parseLockedEllipseType","angle","fillStyle","strokeStyle","parseLockedPolygonType","showVertices","parseLockedFunctionDomain","Infinity","parseLockedFunctionType","equation","directionalAxis","domain","parseLockedFigure","parseLabelLocation","parseInteractiveGraphWidget","labelLocation","showAxisArrows","xMin","xMax","yMin","yMax","lockedFigures","fullGraphAriaLabel","fullGraphAriaDescription","parseLabelImageWidget","imageUrl","imageAlt","imageHeight","imageWidth","hideChoicesFromInstructions","multipleAnswers","matcherOptions","right","orderMatters","padding","getDefaultOptions","parseMatcherWidget","numberOrString","numeric","NaN","parseMatrixWidget","prefix","suffix","cursorPosition","matrixBoardSize","parseMeasurerWidget","image","rulerPixels","rulerLength","parseMoleculeRendererWidget","rotationAngle","smiles","emptyStringToNull","parseNumberLineWidget","labelRange","labelStyle","labelTicks","isTickCtrl","isInequality","divisionRange","numDivisions","snapDivisions","correctRel","correctX","initialX","parseMathFormat","parseSimplify","deprecatedSimplifyValuesToRequired","parseNumericInputWidget","status","strict","labelText","coefficient","parseRenderer","largeToAuto","parseOrdererWidget","correctOptions","otherOptions","layout","parsePassageRefWidget","passageNumber","referenceNumber","summaryText","parsePassageWidget","footnotes","passageText","passageTitle","showLineNumbers","parsePhetSimulationWidget","description","parsePlotterWidget","maxY","scaleY","labelInterval","snapsPerLine","starting","picUrl","picSize","picBoxHeight","plotDimensions","parsePythonProgramWidget","deriveNumCorrect","filter","parseWidgetsMapOrUndefined","generateChoiceId","parseOnePerLine","parseNoneOfTheAbove","version3","parseRadioWidgetV3","numCorrect","isNoneOfTheAbove","hasNoneOfTheAbove","countChoices","randomize","multipleSelect","deselectEnabled","parseRadioWidgetV2","clue","onePerLine","displayCount","noneOfTheAbove","parseRadioWidgetV1","parseRadioWidgetV0","migrateV2toV3","rest","parseRadioWidget","parseSorterWidget","parseTableWidget","headers","rows","columns","parseVideoWidget","location","parseStringToNonNegativeInt","parseWidgetIdComponents","widgetsMap","entryResult","parseWidgetsMapEntry","idComponentsResult","split","n","parseAndAssign","widgetResult","parseDeprecatedWidget","metadata","parsePerseusArticle","parseHint","parsePerseusAnswerArea","toAnswerArea","parsePerseusItem","parseCategorizerUserInput","parseCSProgramUserInput","parseDropdownUserInput","parseExpressionUserInput","parseFreeResponseUserInput","currentValue","coordPair","parseAbsoluteValueBranch","parseExponentialBranch","parseLinearBranch","parseLogarithmBranch","parseQuadraticBranch","parseSinusoidBranch","parseTangentBranch","parseGrapherUserInput","parseGroupUserInput","parseUserInputMap","parseIFrameUserInput","parseInputNumberUserInput","parseInteractiveGraphUserInput","parseLabelImageUserInput","selected","parseMatcherUserInput","parseMatrixUserInput","parseNumberLineUserInput","numLinePosition","rel","parseNumericInputUserInput","parseOrdererUserInput","current","parsePlotterUserInput","parseRadioUserInput","selectedChoiceIds","parseSorterUserInput","changed","parseTableUserInput","userInputMap","parseUserInputMapEntry","userInput","userInputResult","json","Error","parseAndMigratePerseusItem","throwErrorIfCheatingDetected","migrateAndTypecheckPerseusItem","invalidObject","parseAndMigratePerseusArticle","migrateAndTypecheckPerseusArticle","parseAndMigrateUserInputMap","libName","libVersion","addLibraryVersionToPerseusDebug","Errors","freeze","Unknown","Internal","InvalidInput","NotAllowed","TransientService","Service","PerseusError","pluck","table","subKey","mapObject","lambda","getCategorizerPublicWidgetOptions","defaultWidgetOptions","categorizerWidgetLogic","getPublicWidgetOptions","accessible","getCSProgramPublicWidgetOptions","DEFAULT_HEIGHT","csProgramWidgetLogic","supportedAlignments","definitionWidgetLogic","defaultAlignment","getDropdownPublicWidgetOptions","dropdownWidgetLogic","explanationWidgetLogic","getExpressionPublicWidgetOptions","currentVersion","expressionWidgetLogic","traverseChildWidgets","props","traverseRenderer","gradedGroupWidgetLogic","getFreeResponsePublicWidgetOptions","freeResponseWidgetLogic","gradedGroupSetWidgetLogic","getGrapherPublicWidgetOptions","publicOptions","grapherWidgetLogic","Registry","throwIfUnregistered","anythingRegistered","has","hasOwnProperty","contents","get","set","deprecatedStandinWidgetLogic","getIFramePublicWidgetOptions","iframeWidgetLogic","imageWidgetLogic","imageOptions","bgImage","hasBackgroundImage","hasAltText","isDecorative","getInputNumberPublicWidgetOptions","publicWidgetOptions","inputNumberWidgetLogic","interactionWidgetLogic","svgLabelsRegex","svgLocalLabelsRegex","getRealImageUrl","graphieUrl","isLabeledSVG","getSvgUrl","getBaseUrl","getDataUrl","getImageSizeModern","Image","Promise","resolve","reject","onload","naturalWidth","naturalHeight","onerror","src","getInteractiveGraphPublicWidgetOptions","interactiveGraphWidgetLogic","interactiveGraphOptions","getLabelImagePublicWidgetOptions","getLabelImageMarkerPublicData","publicData","labelImageWidgetLogic","labelImageOptions","seededRNG","seed","randomSeed","shuffle","ensurePermuted","isValidShuffle","shuffled","isEqual","constrainedShuffle","maxIterations","every","shuffleInPlace","randomIntInRange","Date","getTime","shuffleMatcher","problemNum","rng","shuffleDisplacingFirst","getMatcherPublicWidgetOptions","sortAllButFirst","first","isFirstElementDisplaced","matcherWidgetLogic","getMatrixPublicWidgetOptions","matrixWidgetLogic","measurerWidgetLogic","getNumberLinePublicWidgetOptions","__","numberLineWidgetLogic","getNumericInputAnswerPublicData","answer","getNumericInputPublicWidgetOptions","numericInputWidgetLogic","getOrdererPublicWidgetOptions","fullOptions","ordererWidgetLogic","passageWidgetLogic","passageRefWidgetLogic","passageRefTargetWidgetLogic","phetSimulationWidgetLogic","getPlotterPublicWidgetOptions","plotterWidgetLogic","pythonProgramWidgetLogic","getRadioChoicePublicData","usesNumCorrect","getRadioPublicWidgetOptions","radioWidgetLogic","getSorterPublicWidgetOptions","shuffleSorter","sorterWidgetLogic","getTablePublicWidgetOptions","defaultRows","defaultColumns","fill","tableWidgetLogic","videoWidgetLogic","registerWidget","logic","isWidgetRegistered","widgetLogic","Boolean","getCurrentVersion","getPublicWidgetOptionsFunction","getDefaultWidgetOptions","isAccessible","widgetInfo","widgetExports","newProps","getSupportedAlignments","getDefaultAlignment","getAlignmentClassName","registerCoreWidgets","groupWidgetLogic","w","DEFAULT_STATIC","applyDefaultsToWidget","oldWidgetInfo","isString","initialVersion","latestVersion","newEditorOptions","clone","defaultOptions","widgetType","widgetStatic","applyDefaultsToWidgets","oldWidgetOptions","newValues","splitPerseusRenderer","original","originalWidgets","upgradedWidgets","splitWidgets","publicWidgetOptionsFun","getGroupPublicWidgetOptions","getDefaultAnswerArea","acc","curr","splitPerseusItem","splitPerseusItemJSON","parseResult","SyntaxError","PerseusFeatureFlags","isFeatureOn","flag","apiOptions","flags","noop","deepCallbackFor","contentCallback","widgetCallback","optionsCallback","deepCallback","newWidgetInfo","Widgets","rendererOptions","userWidgetInfo","deepWidgetCallback","newContent","modifiedContent","newWidgets","newOptions","userOptions","traverse","violatingWidgets","widgetTypes","info","Set","isItemAccessible","ast","widgetIdsInUse","hasInaccessibleImage","traverseContent","node","add","itemDataWithOnlyActiveWidgets","fromEntries","generateImageOptions","defaultImageOptions","generateImageWidget","imageWidgetProperties"],"mappings":";;;;;;AAAA,MAAMA,qBAAwB,CAAA,uBAAA,CAC9B,MAAMC,wBAAAA,CAA2B,0BACjC,CAAA,MAAMC,mBAAsB,CAAA,qBAAA,CAC5B,MAAMC,oBAAAA,CAAuB,sBAC7B,CAAA,MAAMC,wBAA2B,CAAA,0BAAA,CACjC,MAAMC,uBAAAA,CAA0B,yBAChC,CAAA,MAAMC,qBAAwB,CAAA,uBAAA,CAC9B,MAAMC,yBAAAA,CAA4B,2BAClC,CAAA,MAAMC,4BAA+B,CAAA,8BAAA,CACrC,MAAMC,oBAAAA,CAAuB,sBAC7B,CAAA,MAAMC,gBAAmB,CAAA,kBAAA,CACzB,MAAMC,mBAAAA,CAAsB,qBAC5B,CAAA,MAAMC,gBAA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AAA,CAAAA,CACzC,KAAO,EAAC,CAEZzD,CAAAA,CAAAA,MAAAA,CAAQsE,SAAUH,CAAAA,OAAAA,CAAS,IAAM,KAAA,CACrC,CACF,CAAA,CAAA;;ACrBK,MAAMiG,UAAa,CAAA,CACtB,MACA,CAAA,OAAA,CACA,WACA,OACA,CAAA,QAAA,CACA,SACA,CAAA,QAAA,CACA,SACA,CAAA,MAAA,CACA,QACA,KACA,CAAA,IAAA,CACA,IACA,CAAA,KAAA,CACA,KACA,CAAA,gBAAA,CACA,iBACA,MACA,CAAA,KAAA,CACA,OACA,CAAA,OAAA,CACA,MACA,CAAA,WAAA,CACA,UACA,YACA,CAAA,aAAA,CACA,IACA,CAAA,KAAA,CACA,OACA,CAAA,KAAA,CACA,MACA,KACA,CAAA,IAAA,CACA,OACA,CAAA,IAAA,CACA,OACA,CAAA,MAAA,CACA,OACA,WACA,CAAA,SAAA,CACA,sBACA,CAAA,mBAAA,CACA,eACA,CAAA,qBAAA,CACA,oBACA,CAAA,sBAAA,CACA,OACA,CAAA,OAAA,CACA,OACA,CAAA,OAAA,CACA,OACA,CAAA,OAAA,CACA,QACA,OACA,CAAA,OAAA,CACA,OACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,IACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,IACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,IACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,IACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,IACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,GACA,CAAA,GAAA,CACA,GACA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