@pie-element/math-inline 11.0.5-esm.0 → 11.1.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/configure/CHANGELOG.md +69 -0
- package/configure/lib/configure.js +162 -240
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/defaults.js +8 -8
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/general-config-block.js +447 -564
- package/configure/lib/general-config-block.js.map +1 -1
- package/configure/lib/index.js +111 -176
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/response.js +330 -388
- package/configure/lib/response.js.map +1 -1
- package/configure/lib/utils.js +15 -30
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +14 -12
- package/controller/CHANGELOG.md +49 -0
- package/controller/lib/defaults.js +5 -8
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +189 -278
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +1 -2
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +7 -7
- package/lib/index.js +72 -125
- package/lib/index.js.map +1 -1
- package/lib/main.js +784 -889
- package/lib/main.js.map +1 -1
- package/lib/print.js +43 -84
- package/lib/print.js.map +1 -1
- package/lib/simple-question-block.js +125 -162
- package/lib/simple-question-block.js.map +1 -1
- package/lib/utils.js +1 -2
- package/lib/utils.js.map +1 -1
- package/module/configure.js +1 -1
- package/module/controller.js +2319 -2930
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +7 -3
- package/module/print.html +1 -1
- package/module/print.js +1 -1
- package/package.json +21 -33
- package/esm/configure.css +0 -847
- package/esm/configure.js +0 -1769
- package/esm/configure.js.map +0 -1
- package/esm/controller.css +0 -847
- package/esm/controller.js +0 -416
- package/esm/controller.js.map +0 -1
- package/esm/element.css +0 -847
- package/esm/element.js +0 -1476
- package/esm/element.js.map +0 -1
- package/esm/print.css +0 -847
- package/esm/print.js +0 -1288
- package/esm/print.js.map +0 -1
|
@@ -1,185 +1,148 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
7
|
+
exports.default = exports.SimpleQuestionBlock = void 0;
|
|
22
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
9
|
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
10
|
var _mathToolbar = require("@pie-lib/math-toolbar");
|
|
27
|
-
|
|
28
11
|
var _mathInput = require("@pie-lib/math-input");
|
|
29
|
-
|
|
30
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
31
|
-
|
|
32
|
-
var _styles = require("@material-ui/core/styles");
|
|
33
|
-
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
34
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
35
|
-
|
|
36
14
|
var _renderUi = require("@pie-lib/render-ui");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
15
|
+
const Expression = (0, _styles.styled)('div')(({
|
|
16
|
+
theme
|
|
17
|
+
}) => ({
|
|
18
|
+
marginTop: theme.spacing(2),
|
|
19
|
+
marginBottom: theme.spacing(2),
|
|
20
|
+
padding: theme.spacing(1)
|
|
21
|
+
}));
|
|
22
|
+
const Static = (0, _styles.styled)('div', {
|
|
23
|
+
shouldForwardProp: prop => !['isCorrect', 'isIncorrect'].includes(prop)
|
|
24
|
+
})(({
|
|
25
|
+
theme,
|
|
26
|
+
isCorrect,
|
|
27
|
+
isIncorrect
|
|
28
|
+
}) => ({
|
|
29
|
+
color: _renderUi.color.text(),
|
|
30
|
+
background: _renderUi.color.background(),
|
|
31
|
+
border: isCorrect ? `2px solid ${_renderUi.color.correct()} !important` : isIncorrect ? `2px solid ${_renderUi.color.incorrect()} !important` : `1px solid ${_renderUi.color.primaryLight()}`,
|
|
32
|
+
width: 'fit-content',
|
|
33
|
+
fontSize: '1rem',
|
|
34
|
+
padding: isCorrect || isIncorrect ? theme.spacing(1) : theme.spacing(0.5),
|
|
35
|
+
letterSpacing: isCorrect || isIncorrect ? '0.5px' : 'normal',
|
|
36
|
+
'& > .mq-math-mode': {
|
|
37
|
+
'& > .mq-hasCursor': {
|
|
38
|
+
'& > .mq-cursor': {
|
|
39
|
+
display: 'none'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
// CSS for MathToolbar classNames (used as strings)
|
|
46
|
+
if (typeof document !== 'undefined') {
|
|
47
|
+
const styleId = 'math-inline-simple-question-styles';
|
|
48
|
+
if (!document.getElementById(styleId)) {
|
|
49
|
+
const style = document.createElement('style');
|
|
50
|
+
style.id = styleId;
|
|
51
|
+
style.textContent = `
|
|
52
|
+
.response-editor {
|
|
53
|
+
display: flex;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
width: auto;
|
|
56
|
+
max-width: fit-content;
|
|
57
|
+
height: auto;
|
|
58
|
+
text-align: left;
|
|
59
|
+
padding: 8px;
|
|
60
|
+
}
|
|
61
|
+
.response-editor.mq-math-mode {
|
|
62
|
+
border: 1px solid ${_renderUi.color.primaryLight()};
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
document.head.appendChild(style);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
class SimpleQuestionBlock extends _react.default.Component {
|
|
69
|
+
constructor(props) {
|
|
70
|
+
super(props);
|
|
71
|
+
(0, _defineProperty2.default)(this, "mathToolBarContainsTarget", e => document.getElementById(this.mathToolBarId).contains(e.target));
|
|
72
|
+
(0, _defineProperty2.default)(this, "handleClick", e => {
|
|
56
73
|
try {
|
|
57
|
-
if (!
|
|
58
|
-
|
|
74
|
+
if (!this.mathToolBarContainsTarget(e)) {
|
|
75
|
+
this.setState({
|
|
59
76
|
showKeypad: false
|
|
60
77
|
});
|
|
61
78
|
}
|
|
62
|
-
} catch (e) {
|
|
79
|
+
} catch (e) {
|
|
80
|
+
// console.log(e.toString());
|
|
63
81
|
}
|
|
64
82
|
});
|
|
65
|
-
(0, _defineProperty2
|
|
66
|
-
|
|
67
|
-
|
|
83
|
+
(0, _defineProperty2.default)(this, "onFocus", () => {
|
|
84
|
+
const {
|
|
85
|
+
onSubFieldFocus
|
|
86
|
+
} = this.props;
|
|
87
|
+
onSubFieldFocus(this.mathToolBarId);
|
|
68
88
|
});
|
|
69
|
-
|
|
70
|
-
return _this;
|
|
89
|
+
this.mathToolBarId = `math-toolbar-${new Date().getTime()}`;
|
|
71
90
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
config = _ref.config,
|
|
89
|
-
disabled = _ref.disabled,
|
|
90
|
-
correctness = _ref.correctness;
|
|
91
|
-
|
|
92
|
-
if (!config) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
var correct = correctness && correctness.correct;
|
|
97
|
-
var responses = config.responses,
|
|
98
|
-
equationEditor = config.equationEditor;
|
|
99
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
100
|
-
className: classes.expression,
|
|
101
|
-
"data-keypad": true
|
|
102
|
-
}, showCorrect || disabled ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
103
|
-
className: (0, _classnames["default"])(classes["static"], (_cx = {}, (0, _defineProperty2["default"])(_cx, classes.incorrect, !emptyResponse && !correct && !showCorrect), (0, _defineProperty2["default"])(_cx, classes.correct, !emptyResponse && (correct || showCorrect)), _cx))
|
|
104
|
-
}, /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Static, {
|
|
105
|
-
latex: showCorrect ? responses && responses.length && responses[0].answer : session.response || ''
|
|
106
|
-
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
107
|
-
id: this.mathToolBarId
|
|
108
|
-
}, /*#__PURE__*/_react["default"].createElement(_mathToolbar.MathToolbar, {
|
|
109
|
-
classNames: {
|
|
110
|
-
editor: classes.responseEditor
|
|
111
|
-
},
|
|
112
|
-
latex: session.response,
|
|
113
|
-
keypadMode: equationEditor,
|
|
114
|
-
onChange: onSimpleResponseChange,
|
|
115
|
-
onDone: function onDone() {},
|
|
116
|
-
onFocus: this.onFocus,
|
|
117
|
-
controlledKeypad: true,
|
|
118
|
-
showKeypad: showKeypad,
|
|
119
|
-
hideDoneButton: true
|
|
120
|
-
})));
|
|
91
|
+
render() {
|
|
92
|
+
const {
|
|
93
|
+
model,
|
|
94
|
+
showCorrect,
|
|
95
|
+
session,
|
|
96
|
+
emptyResponse,
|
|
97
|
+
onSimpleResponseChange,
|
|
98
|
+
showKeypad
|
|
99
|
+
} = this.props;
|
|
100
|
+
const {
|
|
101
|
+
config,
|
|
102
|
+
disabled,
|
|
103
|
+
correctness
|
|
104
|
+
} = model || {};
|
|
105
|
+
if (!config) {
|
|
106
|
+
return;
|
|
121
107
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
108
|
+
const correct = correctness && correctness.correct;
|
|
109
|
+
const {
|
|
110
|
+
responses,
|
|
111
|
+
equationEditor
|
|
112
|
+
} = config;
|
|
113
|
+
return /*#__PURE__*/_react.default.createElement(Expression, {
|
|
114
|
+
"data-keypad": true
|
|
115
|
+
}, showCorrect || disabled ? /*#__PURE__*/_react.default.createElement(Static, {
|
|
116
|
+
isIncorrect: !emptyResponse && !correct && !showCorrect,
|
|
117
|
+
isCorrect: !emptyResponse && (correct || showCorrect)
|
|
118
|
+
}, /*#__PURE__*/_react.default.createElement(_mathInput.mq.Static, {
|
|
119
|
+
latex: showCorrect ? responses && responses.length && responses[0].answer : session.response || ''
|
|
120
|
+
})) : /*#__PURE__*/_react.default.createElement("div", {
|
|
121
|
+
id: this.mathToolBarId
|
|
122
|
+
}, /*#__PURE__*/_react.default.createElement(_mathToolbar.MathToolbar, {
|
|
123
|
+
classNames: {
|
|
124
|
+
editor: 'response-editor'
|
|
125
|
+
},
|
|
126
|
+
latex: session.response,
|
|
127
|
+
keypadMode: equationEditor,
|
|
128
|
+
onChange: onSimpleResponseChange,
|
|
129
|
+
onDone: () => {},
|
|
130
|
+
onFocus: this.onFocus,
|
|
131
|
+
controlledKeypad: true,
|
|
132
|
+
showKeypad: showKeypad,
|
|
133
|
+
hideDoneButton: true
|
|
134
|
+
})));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.SimpleQuestionBlock = SimpleQuestionBlock;
|
|
138
|
+
(0, _defineProperty2.default)(SimpleQuestionBlock, "propTypes", {
|
|
139
|
+
onSimpleResponseChange: _propTypes.default.func,
|
|
140
|
+
model: _propTypes.default.object.isRequired,
|
|
141
|
+
emptyResponse: _propTypes.default.bool,
|
|
142
|
+
session: _propTypes.default.object.isRequired,
|
|
143
|
+
showCorrect: _propTypes.default.bool,
|
|
144
|
+
onSubFieldFocus: _propTypes.default.func.isRequired,
|
|
145
|
+
showKeypad: _propTypes.default.bool.isRequired
|
|
136
146
|
});
|
|
137
|
-
var
|
|
138
|
-
return {
|
|
139
|
-
responseEditor: {
|
|
140
|
-
display: 'flex',
|
|
141
|
-
justifyContent: 'center',
|
|
142
|
-
width: 'auto',
|
|
143
|
-
maxWidth: 'fit-content',
|
|
144
|
-
height: 'auto',
|
|
145
|
-
textAlign: 'left',
|
|
146
|
-
padding: theme.spacing.unit,
|
|
147
|
-
'&.mq-math-mode': {
|
|
148
|
-
border: "1px solid ".concat(_renderUi.color.primaryLight())
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
expression: {
|
|
152
|
-
marginTop: theme.spacing.unit * 2,
|
|
153
|
-
marginBottom: theme.spacing.unit * 2,
|
|
154
|
-
padding: theme.spacing.unit
|
|
155
|
-
},
|
|
156
|
-
"static": {
|
|
157
|
-
color: _renderUi.color.text(),
|
|
158
|
-
background: _renderUi.color.background(),
|
|
159
|
-
border: "1px solid ".concat(_renderUi.color.primaryLight()),
|
|
160
|
-
width: 'fit-content',
|
|
161
|
-
fontSize: '1rem',
|
|
162
|
-
padding: theme.spacing.unit / 2,
|
|
163
|
-
'& > .mq-math-mode': {
|
|
164
|
-
'& > .mq-hasCursor': {
|
|
165
|
-
'& > .mq-cursor': {
|
|
166
|
-
display: 'none'
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
correct: {
|
|
172
|
-
border: "2px solid ".concat(_renderUi.color.correct(), " !important"),
|
|
173
|
-
padding: theme.spacing.unit,
|
|
174
|
-
letterSpacing: '0.5px'
|
|
175
|
-
},
|
|
176
|
-
incorrect: {
|
|
177
|
-
border: "2px solid ".concat(_renderUi.color.incorrect(), " !important"),
|
|
178
|
-
padding: theme.spacing.unit,
|
|
179
|
-
letterSpacing: '0.5px'
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
})(SimpleQuestionBlockRaw);
|
|
183
|
-
var _default = SimpleQuestionBlock;
|
|
184
|
-
exports["default"] = _default;
|
|
147
|
+
var _default = exports.default = SimpleQuestionBlock;
|
|
185
148
|
//# sourceMappingURL=simple-question-block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"simple-question-block.js","names":["_react","_interopRequireDefault","require","_mathToolbar","_mathInput","_styles","_propTypes","_renderUi","Expression","styled","theme","marginTop","spacing","marginBottom","padding","Static","shouldForwardProp","prop","includes","isCorrect","isIncorrect","color","text","background","border","correct","incorrect","primaryLight","width","fontSize","letterSpacing","display","document","styleId","getElementById","style","createElement","id","textContent","head","appendChild","SimpleQuestionBlock","React","Component","constructor","props","_defineProperty2","default","e","mathToolBarId","contains","target","mathToolBarContainsTarget","setState","showKeypad","onSubFieldFocus","Date","getTime","render","model","showCorrect","session","emptyResponse","onSimpleResponseChange","config","disabled","correctness","responses","equationEditor","mq","latex","length","answer","response","MathToolbar","classNames","editor","keypadMode","onChange","onDone","onFocus","controlledKeypad","hideDoneButton","exports","PropTypes","func","object","isRequired","bool","_default"],"sources":["../src/simple-question-block.jsx"],"sourcesContent":["import React from 'react';\nimport { MathToolbar } from '@pie-lib/math-toolbar';\nimport { mq } from '@pie-lib/math-input';\nimport { styled } from '@mui/material/styles';\nimport PropTypes from 'prop-types';\nimport { color } from '@pie-lib/render-ui';\n\nconst Expression = styled('div')(({ theme }) => ({\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n padding: theme.spacing(1),\n}));\n\nconst Static = styled('div', {\n shouldForwardProp: (prop) => !['isCorrect', 'isIncorrect'].includes(prop),\n})(({ theme, isCorrect, isIncorrect }) => ({\n color: color.text(),\n background: color.background(),\n border: isCorrect\n ? `2px solid ${color.correct()} !important`\n : isIncorrect\n ? `2px solid ${color.incorrect()} !important`\n : `1px solid ${color.primaryLight()}`,\n width: 'fit-content',\n fontSize: '1rem',\n padding: isCorrect || isIncorrect ? theme.spacing(1) : theme.spacing(0.5),\n letterSpacing: (isCorrect || isIncorrect) ? '0.5px' : 'normal',\n '& > .mq-math-mode': {\n '& > .mq-hasCursor': {\n '& > .mq-cursor': {\n display: 'none',\n },\n },\n },\n}));\n\n// CSS for MathToolbar classNames (used as strings)\nif (typeof document !== 'undefined') {\n const styleId = 'math-inline-simple-question-styles';\n if (!document.getElementById(styleId)) {\n const style = document.createElement('style');\n style.id = styleId;\n style.textContent = `\n .response-editor {\n display: flex;\n justify-content: center;\n width: auto;\n max-width: fit-content;\n height: auto;\n text-align: left;\n padding: 8px;\n }\n .response-editor.mq-math-mode {\n border: 1px solid ${color.primaryLight()};\n }\n `;\n document.head.appendChild(style);\n }\n}\n\nexport class SimpleQuestionBlock extends React.Component {\n static propTypes = {\n onSimpleResponseChange: PropTypes.func,\n model: PropTypes.object.isRequired,\n emptyResponse: PropTypes.bool,\n session: PropTypes.object.isRequired,\n showCorrect: PropTypes.bool,\n onSubFieldFocus: PropTypes.func.isRequired,\n showKeypad: PropTypes.bool.isRequired,\n };\n\n constructor(props) {\n super(props);\n\n this.mathToolBarId = `math-toolbar-${new Date().getTime()}`;\n }\n\n mathToolBarContainsTarget = (e) => document.getElementById(this.mathToolBarId).contains(e.target);\n\n handleClick = (e) => {\n try {\n if (!this.mathToolBarContainsTarget(e)) {\n this.setState({ showKeypad: false });\n }\n } catch (e) {\n // console.log(e.toString());\n }\n };\n\n onFocus = () => {\n const { onSubFieldFocus } = this.props;\n\n onSubFieldFocus(this.mathToolBarId);\n };\n\n render() {\n const { model, showCorrect, session, emptyResponse,onSimpleResponseChange, showKeypad } = this.props;\n const { config, disabled, correctness } = model || {};\n\n if (!config) {\n return;\n }\n\n const correct = correctness && correctness.correct;\n const { responses, equationEditor } = config;\n\n return (\n <Expression data-keypad={true}>\n {showCorrect || disabled ? (\n <Static\n isIncorrect={!emptyResponse && !correct && !showCorrect}\n isCorrect={!emptyResponse && (correct || showCorrect)}\n >\n <mq.Static\n latex={showCorrect ? responses && responses.length && responses[0].answer : session.response || ''}\n />\n </Static>\n ) : (\n <div id={this.mathToolBarId}>\n <MathToolbar\n classNames={{ editor: 'response-editor' }}\n latex={session.response}\n keypadMode={equationEditor}\n onChange={onSimpleResponseChange}\n onDone={() => {}}\n onFocus={this.onFocus}\n controlledKeypad={true}\n showKeypad={showKeypad}\n hideDoneButton={true}\n />\n </div>\n )}\n </Expression>\n );\n }\n}\n\nexport default SimpleQuestionBlock;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAEA,MAAMM,UAAU,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EAC/CC,SAAS,EAAED,KAAK,CAACE,OAAO,CAAC,CAAC,CAAC;EAC3BC,YAAY,EAAEH,KAAK,CAACE,OAAO,CAAC,CAAC,CAAC;EAC9BE,OAAO,EAAEJ,KAAK,CAACE,OAAO,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC;AAEH,MAAMG,MAAM,GAAG,IAAAN,cAAM,EAAC,KAAK,EAAE;EAC3BO,iBAAiB,EAAGC,IAAI,IAAK,CAAC,CAAC,WAAW,EAAE,aAAa,CAAC,CAACC,QAAQ,CAACD,IAAI;AAC1E,CAAC,CAAC,CAAC,CAAC;EAAEP,KAAK;EAAES,SAAS;EAAEC;AAAY,CAAC,MAAM;EACzCC,KAAK,EAAEA,eAAK,CAACC,IAAI,CAAC,CAAC;EACnBC,UAAU,EAAEF,eAAK,CAACE,UAAU,CAAC,CAAC;EAC9BC,MAAM,EAAEL,SAAS,GACb,aAAaE,eAAK,CAACI,OAAO,CAAC,CAAC,aAAa,GACzCL,WAAW,GACT,aAAaC,eAAK,CAACK,SAAS,CAAC,CAAC,aAAa,GAC3C,aAAaL,eAAK,CAACM,YAAY,CAAC,CAAC,EAAE;EACzCC,KAAK,EAAE,aAAa;EACpBC,QAAQ,EAAE,MAAM;EAChBf,OAAO,EAAEK,SAAS,IAAIC,WAAW,GAAGV,KAAK,CAACE,OAAO,CAAC,CAAC,CAAC,GAAGF,KAAK,CAACE,OAAO,CAAC,GAAG,CAAC;EACzEkB,aAAa,EAAGX,SAAS,IAAIC,WAAW,GAAI,OAAO,GAAG,QAAQ;EAC9D,mBAAmB,EAAE;IACnB,mBAAmB,EAAE;MACnB,gBAAgB,EAAE;QAChBW,OAAO,EAAE;MACX;IACF;EACF;AACF,CAAC,CAAC,CAAC;;AAEH;AACA,IAAI,OAAOC,QAAQ,KAAK,WAAW,EAAE;EACnC,MAAMC,OAAO,GAAG,oCAAoC;EACpD,IAAI,CAACD,QAAQ,CAACE,cAAc,CAACD,OAAO,CAAC,EAAE;IACrC,MAAME,KAAK,GAAGH,QAAQ,CAACI,aAAa,CAAC,OAAO,CAAC;IAC7CD,KAAK,CAACE,EAAE,GAAGJ,OAAO;IAClBE,KAAK,CAACG,WAAW,GAAG;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4BjB,eAAK,CAACM,YAAY,CAAC,CAAC;AAChD;AACA,KAAK;IACDK,QAAQ,CAACO,IAAI,CAACC,WAAW,CAACL,KAAK,CAAC;EAClC;AACF;AAEO,MAAMM,mBAAmB,SAASC,cAAK,CAACC,SAAS,CAAC;EAWvDC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,qCAKcC,CAAC,IAAKhB,QAAQ,CAACE,cAAc,CAAC,IAAI,CAACe,aAAa,CAAC,CAACC,QAAQ,CAACF,CAAC,CAACG,MAAM,CAAC;IAAA,IAAAL,gBAAA,CAAAC,OAAA,uBAElFC,CAAC,IAAK;MACnB,IAAI;QACF,IAAI,CAAC,IAAI,CAACI,yBAAyB,CAACJ,CAAC,CAAC,EAAE;UACtC,IAAI,CAACK,QAAQ,CAAC;YAAEC,UAAU,EAAE;UAAM,CAAC,CAAC;QACtC;MACF,CAAC,CAAC,OAAON,CAAC,EAAE;QACV;MAAA;IAEJ,CAAC;IAAA,IAAAF,gBAAA,CAAAC,OAAA,mBAES,MAAM;MACd,MAAM;QAAEQ;MAAgB,CAAC,GAAG,IAAI,CAACV,KAAK;MAEtCU,eAAe,CAAC,IAAI,CAACN,aAAa,CAAC;IACrC,CAAC;IAnBC,IAAI,CAACA,aAAa,GAAG,gBAAgB,IAAIO,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,EAAE;EAC7D;EAoBAC,MAAMA,CAAA,EAAG;IACP,MAAM;MAAEC,KAAK;MAAEC,WAAW;MAAEC,OAAO;MAAEC,aAAa;MAACC,sBAAsB;MAAET;IAAW,CAAC,GAAG,IAAI,CAACT,KAAK;IACpG,MAAM;MAAEmB,MAAM;MAAEC,QAAQ;MAAEC;IAAY,CAAC,GAAGP,KAAK,IAAI,CAAC,CAAC;IAErD,IAAI,CAACK,MAAM,EAAE;MACX;IACF;IAEA,MAAMvC,OAAO,GAAGyC,WAAW,IAAIA,WAAW,CAACzC,OAAO;IAClD,MAAM;MAAE0C,SAAS;MAAEC;IAAe,CAAC,GAAGJ,MAAM;IAE5C,oBACEhE,MAAA,CAAA+C,OAAA,CAAAX,aAAA,CAAC5B,UAAU;MAAC,eAAa;IAAK,GAC3BoD,WAAW,IAAIK,QAAQ,gBACtBjE,MAAA,CAAA+C,OAAA,CAAAX,aAAA,CAACrB,MAAM;MACLK,WAAW,EAAE,CAAC0C,aAAa,IAAI,CAACrC,OAAO,IAAI,CAACmC,WAAY;MACxDzC,SAAS,EAAE,CAAC2C,aAAa,KAAKrC,OAAO,IAAImC,WAAW;IAAE,gBAEtD5D,MAAA,CAAA+C,OAAA,CAAAX,aAAA,CAAChC,UAAA,CAAAiE,EAAE,CAACtD,MAAM;MACRuD,KAAK,EAAEV,WAAW,GAAGO,SAAS,IAAIA,SAAS,CAACI,MAAM,IAAIJ,SAAS,CAAC,CAAC,CAAC,CAACK,MAAM,GAAGX,OAAO,CAACY,QAAQ,IAAI;IAAG,CACpG,CACK,CAAC,gBAETzE,MAAA,CAAA+C,OAAA,CAAAX,aAAA;MAAKC,EAAE,EAAE,IAAI,CAACY;IAAc,gBAC1BjD,MAAA,CAAA+C,OAAA,CAAAX,aAAA,CAACjC,YAAA,CAAAuE,WAAW;MACVC,UAAU,EAAE;QAAEC,MAAM,EAAE;MAAkB,CAAE;MAC1CN,KAAK,EAAET,OAAO,CAACY,QAAS;MACxBI,UAAU,EAAET,cAAe;MAC3BU,QAAQ,EAAEf,sBAAuB;MACjCgB,MAAM,EAAEA,CAAA,KAAM,CAAC,CAAE;MACjBC,OAAO,EAAE,IAAI,CAACA,OAAQ;MACtBC,gBAAgB,EAAE,IAAK;MACvB3B,UAAU,EAAEA,UAAW;MACvB4B,cAAc,EAAE;IAAK,CACtB,CACE,CAEG,CAAC;EAEjB;AACF;AAACC,OAAA,CAAA1C,mBAAA,GAAAA,mBAAA;AAAA,IAAAK,gBAAA,CAAAC,OAAA,EA3EYN,mBAAmB,eACX;EACjBsB,sBAAsB,EAAEqB,kBAAS,CAACC,IAAI;EACtC1B,KAAK,EAAEyB,kBAAS,CAACE,MAAM,CAACC,UAAU;EAClCzB,aAAa,EAAEsB,kBAAS,CAACI,IAAI;EAC7B3B,OAAO,EAAEuB,kBAAS,CAACE,MAAM,CAACC,UAAU;EACpC3B,WAAW,EAAEwB,kBAAS,CAACI,IAAI;EAC3BjC,eAAe,EAAE6B,kBAAS,CAACC,IAAI,CAACE,UAAU;EAC1CjC,UAAU,EAAE8B,kBAAS,CAACI,IAAI,CAACD;AAC7B,CAAC;AAAA,IAAAE,QAAA,GAAAN,OAAA,CAAApC,OAAA,GAoEYN,mBAAmB","ignoreList":[]}
|
package/lib/utils.js
CHANGED
|
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ResponseTypes = void 0;
|
|
7
|
-
|
|
7
|
+
const ResponseTypes = exports.ResponseTypes = {
|
|
8
8
|
advanced: 'Advanced Multi',
|
|
9
9
|
simple: 'Simple'
|
|
10
10
|
};
|
|
11
|
-
exports.ResponseTypes = ResponseTypes;
|
|
12
11
|
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["ResponseTypes","exports","advanced","simple"],"sources":["../src/utils.js"],"sourcesContent":["export const ResponseTypes = {\n advanced: 'Advanced Multi',\n simple: 'Simple',\n};\n"],"mappings":";;;;;;AAAO,MAAMA,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC3BE,QAAQ,EAAE,gBAAgB;EAC1BC,MAAM,EAAE;AACV,CAAC","ignoreList":[]}
|
package/module/configure.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_dll_react as e,_dll_prop_types as t,_dll_material_ui__core as n,_dll_material_ui__core_styles as a,_dll_pie_lib__render_ui as o,_dll_classnames as s,_dll_lodash as i,_dll_material_ui__icons as l,_dll_debug as r,_dll_react_dom as c}from"../../../@pie-lib/shared-module@^1.14.0/module/index.js";import{_dll_pie_lib__config_ui as p}from"../../../@pie-lib/config-module@^2.19.0/module/index.js";import{_dll_pie_lib__editable_html as d}from"../../../@pie-lib/editable-html-module@^5.6.0/module/index.js";import{_dll_pie_lib__math_toolbar as u,_dll_pie_framework__mathquill as m}from"../../../@pie-lib/math-edit-module@^2.4.0/module/index.js";const h=e,g=t,{Card:b}=n,{CardContent:_}=n,{Button:C}=n,{FormControlLabel:y}=n,{Typography:f}=n,{InputLabel:E}=n,{Checkbox:v}=n,{Select:x}=n,{MenuItem:S}=n,{withStyles:w}=a,{color:T}=o,{InputContainer:I}=p,{MathToolbar:A}=u;class k extends h.Component{static __initStatic(){this.propTypes={classes:g.object.isRequired,defaultResponse:g.bool,error:g.object,mode:g.oneOfType([g.string,g.number]),index:g.number,onResponseChange:g.func.isRequired,response:g.object.isRequired,cIgnoreOrder:g.object.isRequired,cAllowTrailingZeros:g.object.isRequired}}static __initStatic2(){this.defaultProps={defaultResponse:!1,mode:"miscellaneous"}}constructor(e){super(e),k.prototype.__init.call(this),k.prototype.__init2.call(this),k.prototype.__init3.call(this),k.prototype.__init4.call(this),k.prototype.__init5.call(this),k.prototype.__init6.call(this),k.prototype.__init7.call(this),k.prototype.__init8.call(this),k.prototype.__init9.call(this),k.prototype.__init10.call(this),k.prototype.__init11.call(this);const{response:{alternates:t}={}}=e||{},n=Object.keys(t||{}).length;this.state={alternateIdCounter:n+1,showKeypad:{openCount:0,main:!1}}}__init(){this.onChange=e=>t=>{const{response:n,onResponseChange:a,index:o}=this.props,s={...n};s[e]=t.target.value,a(s,o)}}__init2(){this.onConfigChanged=e=>t=>{const{response:n,onResponseChange:a,index:o}=this.props,s={...n};s[e]=t.target.checked,a(s,o)}}__init3(){this.onLiteralOptionsChange=e=>()=>{const{response:t,onResponseChange:n,index:a}=this.props,o={...t};o[e]=!t[e],n(o,a)}}__init4(){this.onAnswerChange=e=>{const{response:t,onResponseChange:n,index:a}=this.props,o={...t};o.answer=e,n(o,a)}}__init5(){this.onAlternateAnswerChange=e=>t=>{const{response:n,onResponseChange:a,index:o}=this.props,s={...n};s.alternates[e]=t,a(s,o)}}__init6(){this.onAddAlternate=()=>{const{response:e,onResponseChange:t,index:n}=this.props,{alternateIdCounter:a}=this.state,o={...e};o.alternates||(o.alternates={}),o.alternates[a]="",t(o,n),this.setState({alternateIdCounter:a+1})}}__init7(){this.onRemoveAlternate=e=>()=>{const{response:t,onResponseChange:n,index:a}=this.props,o={...t};delete o.alternates[e],n(o,a),this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount-1:t.showKeypad.openCount}})))}}__init8(){this.onDone=()=>{this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.openCount-1,main:!1}})))}}__init9(){this.onFocus=()=>{this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.main?e.showKeypad.openCount:e.showKeypad.openCount+1,main:!0}})))}}__init10(){this.onAlternateFocus=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount:t.showKeypad.openCount+1,[e]:!0}})))}}__init11(){this.onAlternateDone=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad.openCount-1,[e]:!1}})))}}render(){const{classes:e,mode:t,defaultResponse:n,index:a,response:o,cAllowTrailingZeros:s,cIgnoreOrder:i,error:l}=this.props,{showKeypad:r}=this.state,{validation:c,answer:p,alternates:d,ignoreOrder:u,allowTrailingZeros:m}=o,g=Object.keys(d||{}).length>0,w={editor:e.responseEditor,mathToolbar:e.mathToolbar},T={minHeight:(r.openCount>0?430:230)+"px"};return h.createElement(b,{className:e.responseContainer,style:T},h.createElement(_,{className:e.cardContent},h.createElement("div",{className:e.titleBar},h.createElement(f,{className:e.title,component:"div"},"Response ",""),h.createElement(I,{label:"Validation",className:e.selectContainer},h.createElement(x,{className:e.select,onChange:this.onChange("validation"),value:c||"literal"},h.createElement(S,{value:"literal"},"Literal Validation"),h.createElement(S,{value:"symbolic"},"Symbolic Validation")))),"literal"===c&&h.createElement("div",{className:e.flexContainer},s.enabled&&h.createElement(y,{label:s.label,control:h.createElement(v,{className:e.customColor,checked:m,onChange:this.onLiteralOptionsChange("allowTrailingZeros")})}),i.enabled&&h.createElement(y,{label:i.label,control:h.createElement(v,{className:e.customColor,checked:u,onChange:this.onLiteralOptionsChange("ignoreOrder")})})),h.createElement("div",{className:e.inputContainer},h.createElement(E,null,"Correct Answer"),h.createElement(A,{keypadMode:t,classNames:w,controlledKeypad:!0,showKeypad:r.main,latex:p||"",onChange:this.onAnswerChange,onFocus:this.onFocus,onDone:this.onDone,error:l&&l.answer}),l&&l.answer?h.createElement("div",{className:e.errorText},l.answer):null),g&&Object.keys(d).map(((n,a)=>h.createElement("div",{className:e.inputContainer,key:n},h.createElement("div",{className:e.alternateBar},h.createElement(E,null,"Alternate",Object.keys(d).length>1?` ${a+1}`:""),h.createElement(C,{className:e.removeAlternateButton,type:"secondary",onClick:this.onRemoveAlternate(n)},"Remove")),h.createElement(A,{classNames:w,controlledKeypad:!0,keypadMode:t,showKeypad:r[n]||!1,latex:d[n]||"",onChange:this.onAlternateAnswerChange(n),onFocus:this.onAlternateFocus(n),onDone:this.onAlternateDone(n),error:l&&l[n]}),l&&l[n]?h.createElement("div",{className:e.errorText},l[n]):null))),h.createElement(C,{className:e.alternateButton,type:"primary",onClick:this.onAddAlternate},"ADD ALTERNATE")))}}k.__initStatic(),k.__initStatic2();var N=w((e=>({responseContainer:{marginBottom:2.5*e.spacing.unit,width:"100%",minWidth:"548px",border:`1px solid ${e.palette.grey[700]}`,display:"flex",flexDirection:"column",justifyContent:"space-between"},cardContent:{paddingBottom:2*e.spacing.unit+"px !important"},title:{fontWeight:700,fontSize:"1.2rem",flex:3},selectContainer:{flex:2},inputContainer:{marginBottom:2*e.spacing.unit},titleBar:{display:"flex",alignItems:"center",justifyContent:"space-between"},responseEditor:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",minWidth:"500px",maxWidth:"900px",height:"auto",minHeight:"40px"},mathToolbar:{width:"100%"},alternateButton:{border:`1px solid ${e.palette.grey.A100}`},removeAlternateButton:{marginLeft:2*e.spacing.unit,border:`1px solid ${e.palette.grey.A100}`,color:"gray",fontSize:"0.8rem"},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit},customColor:{color:`${T.tertiary()} !important`}})))(k);const R="Advanced Multi",D="Simple",O=(e={},t={})=>({...t,...e}),j=e,M=t,K=s,{withStyles:P}=a,{InputLabel:q}=n,{Select:B}=n,{MenuItem:F}=n,{Tooltip:H}=n,{isEqual:L}=i,{Info:$}=l,z=d,{InputContainer:G}=p,{MathToolbar:Z}=u,W=m;function Y(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}let U=!1;const V=/{{response}}/gm,J=/\\%response\\%/gm,Q=/\\embed\{answerBlock\}\[r\d*\]/g,X=/\\embed\{newLine\}\[\]/g,ee=/\\newline/g;function te(e){if(e){let t=1;return e.replace(V,(()=>`\\embed{answerBlock}[r${t++}]`)).replace(ee,"\\embed{newLine}[]")}}class ne extends j.Component{static __initStatic(){this.propTypes={classes:M.object.isRequired,model:M.object.isRequired,imageSupport:M.object,uploadSoundSupport:M.object,configuration:M.object,onChange:M.func.isRequired,promptEnabled:M.bool,rationaleEnabled:M.bool,toolbarOpts:M.object}}constructor(e){super(e),ne.prototype.__init.call(this),ne.prototype.__init2.call(this),ne.prototype.__init3.call(this),ne.prototype.__init4.call(this),ne.prototype.__init5.call(this),ne.prototype.__init6.call(this),ne.prototype.__init7.call(this);const t={};if(e.model&&e.model.expression){let n=1;e.model.expression.replace(V,(()=>{t["r"+n++]={value:""}}))}this.state={showKeypad:!1,responseAreas:t,responseIdCounter:Object.keys(t).length}}__init(){this.onChange=e=>t=>{const{model:n,onChange:a}=this.props,o={...n};o[e]="object"==typeof t?t.target.value:t,"expression"===e&&(o[e]=function(e){if(e)return e.replace(Q,(()=>"{{response}}")).replace(J,(()=>"{{response}}")).replace(X,(()=>"\\newline"))}(t)),a(o)}}__init2(){this.onDone=()=>{this.setState({showKeypad:!1})}}__init3(){this.onFocus=()=>{this.setState({showKeypad:!0})}}__init4(){this.onPromptFocus=()=>{this.setState({showKeypad:!1})}}UNSAFE_componentWillMount(){const{classes:e}=this.props;if("undefined"!=typeof window){let t=W.getInterface(2);U||(t.registerEmbed("answerBlock",(t=>({htmlString:`<div class="${K(e.blockContainer,e.blockContainerGeneric)}">\n <div class="${K(e.blockResponse,e.blockResponseGeneric)}" id="${t}Index">Response</div>\n </div>`,text:()=>"text",latex:()=>`\\embed{answerBlock}[${t}]`}))),U=!0)}}componentDidMount(){this.handleAnswerBlockDomUpdate()}componentDidUpdate(){this.handleAnswerBlockDomUpdate()}__init5(){this.handleAnswerBlockDomUpdate=()=>{const{model:e}=this.props,t={};if(e&&e.expression){let n=1;e.expression.replace(V,(()=>{t["r"+n++]={value:""}}))}L(t,this.state.responseAreas)||this.setState({responseAreas:t},(()=>{this.root&&Object.keys(t).length&&Object.keys(t).forEach(((e,t)=>{const n=this.root.querySelector(`#${e}`),a=this.root.querySelector(`#${e}Index`);n&&(W.getInterface(2).StaticMath(n),a.textContent=`R${t+1}`)}))}))}}__init6(){this.onAddResponse=()=>{const{model:e,onChange:t}=this.props,{responseIdCounter:n}=this.state,a={...e};let o=n;for(;e.responses.find((e=>e.id===o));)o++;const s={id:o,validation:"literal",answer:"",alternates:{}};a.responses=a.responses.concat(s),t(a),this.setState({responseIdCounter:s.id})}}__init7(){this.onResponseChange=(e,t)=>{const{model:n,onChange:a}=this.props,o={...n};o.responses[t]=e,a(o)}}render(){const{classes:e,model:t,imageSupport:n,uploadSoundSupport:a,configuration:o,promptEnabled:s,rationaleEnabled:i,toolbarOpts:l}=this.props,{showKeypad:r}=this.state,{prompt:c,expression:p,equationEditor:d,promptEquationEditor:u="8",responses:m,responseType:h,rationale:g,spellCheckEnabled:b,errors:_={}}=t,{baseInputConfiguration:C={},rationale:y={},prompt:f={},ignoreOrder:E={},allowTrailingZeros:v={},maxResponseAreas:x,maxImageWidth:S={},maxImageHeight:w={},mathMlOptions:T={}}=o||{},I=((e={},t={})=>{const{maxResponseAreas:n}=t,{responseType:a}=e;let o="";return"Advanced Multi"===a&&(o="\nThere should be at least 1 "+(n?`and at most ${n} `:"")+"response area"+(n?"s":"")+" defined."),"Validation requirements:\nAll correct answers (the primary and any alternates) should not be empty and should be unique."+o})(o,t),{prompt:A,rationale:k,responsesErrors:M,responseAreasError:K}=_,P=S&&S.prompt,L=w&&w.prompt,W={editor:e.responseEditor,mathToolbar:e.mathToolbar},U=h===R?m:m.slice(0,1),V=j.createElement(H,{classes:{tooltip:e.tooltip},disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:I},j.createElement($,{fontSize:"small",color:"primary",style:{marginLeft:"5px"}}));return j.createElement("div",{ref:e=>this.root=e||this.root,className:e.container},s&&j.createElement(G,{label:f.label,className:e.promptHolder},j.createElement(z,{onFocus:this.onPromptFocus,className:e.prompt,markup:c||"",onChange:this.onChange("prompt"),imageSupport:n,nonEmpty:!1,error:A,toolbarOpts:l,pluginProps:O(Y([f,"optionalAccess",e=>e.inputConfiguration]),C),spellCheck:b,maxImageWidth:P,maxImageHeight:L,uploadSoundSupport:a,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),A&&j.createElement("div",{className:e.errorText},A)),h===R&&j.createElement("div",{className:e.advancedResponse},j.createElement("div",{className:e.flexContainer,style:{justifyContent:"flex-start"}},j.createElement("div",{className:e.title},"Define Response"),V),j.createElement(G,{key:"templateEditorType",label:"Response Template Equation Editor",className:e.selectContainer},j.createElement(B,{className:e.select,onChange:this.onChange("promptEquationEditor"),value:u},j.createElement(F,{value:"non-negative-integers"},"Numeric - Non-Negative Integers"),j.createElement(F,{value:"integers"},"Numeric - Integers"),j.createElement(F,{value:"decimals"},"Numeric - Decimals"),j.createElement(F,{value:"fractions"},"Numeric - Fractions"),j.createElement(F,{value:1},"Grade 1 - 2"),j.createElement(F,{value:3},"Grade 3 - 5"),j.createElement(F,{value:6},"Grade 6 - 7"),j.createElement(F,{value:8},"Grade 8 - HS"),j.createElement(F,{value:"geometry"},"Geometry"),j.createElement(F,{value:"advanced-algebra"},"Advanced Algebra"),j.createElement(F,{value:"statistics"},"Statistics"),j.createElement(F,{value:"item-authoring"},"Item Authoring"))),j.createElement("div",{className:e.responseTemplate,key:"templateHolder"},j.createElement(q,{className:e.templateTitle},"RESPONSE TEMPLATE"),j.createElement(Z,{classNames:W,allowAnswerBlock:!0,keypadMode:u,controlledKeypad:!0,showKeypad:r,latex:te(p)||"",onChange:this.onChange("expression"),onFocus:this.onFocus,onDone:this.onDone,maxResponseAreas:x,error:K})),K&&j.createElement("div",{className:e.errorText},K)),j.createElement("div",{className:e.flexContainer,style:{justifyContent:"flex-start"}},j.createElement("div",{className:e.title},"Define Correct Response"),h===D?V:null),j.createElement(G,{label:"Equation Editor",className:e.selectContainer},j.createElement(B,{className:e.select,onChange:this.onChange("equationEditor"),value:d},j.createElement(F,{value:"non-negative-integers"},"Numeric - Non-Negative Integers"),j.createElement(F,{value:"integers"},"Numeric - Integers"),j.createElement(F,{value:"decimals"},"Numeric - Decimals"),j.createElement(F,{value:"fractions"},"Numeric - Fractions"),j.createElement(F,{value:1},"Grade 1 - 2"),j.createElement(F,{value:3},"Grade 3 - 5"),j.createElement(F,{value:6},"Grade 6 - 7"),j.createElement(F,{value:8},"Grade 8 - HS"),j.createElement(F,{value:"geometry"},"Geometry"),j.createElement(F,{value:"advanced-algebra"},"Advanced Algebra"),j.createElement(F,{value:"statistics"},"Statistics"),j.createElement(F,{value:"item-authoring"},"Item Authoring"))),U.map(((e,t)=>j.createElement(N,{key:e.id,mode:d,response:e,defaultResponse:h===D,onResponseChange:this.onResponseChange,index:t,cIgnoreOrder:E,cAllowTrailingZeros:v,error:M&&M[t]}))),i&&j.createElement(G,{label:y.label,className:e.promptHolder},j.createElement(z,{className:e.prompt,markup:g||"",onChange:this.onChange("rationale"),imageSupport:n,nonEmpty:!1,error:k,toolbarOpts:l,pluginProps:O(Y([y,"optionalAccess",e=>e.inputConfiguration]),{...C,math:{controlledKeypadMode:!1}}),spellCheck:b,maxImageWidth:S&&S.rationale||P,maxImageHeight:w&&w.rationale||L,uploadSoundSupport:a,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),k&&j.createElement("div",{className:e.errorText},k)))}}ne.__initStatic();var ae=P((e=>({container:{display:"flex",flexDirection:"column"},templateTitle:{fontSize:"0.85rem"},title:{fontSize:"1.1rem"},addResponseButton:{border:`1px solid ${e.palette.grey.A100}`,float:"right",width:"150px"},flexContainer:{display:"flex",alignItems:"center",justifyContent:"space-between"},selectContainer:{flex:"initial",width:"40%",marginTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},responseTemplate:{display:"flex",flexDirection:"column"},responseEditor:{display:"flex",justifyContent:"center",width:"100%",maxWidth:"inherit",height:"auto",minHeight:"130px",textAlign:"left",padding:e.spacing.unit},promptHolder:{width:"100%",paddingTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},blockContainer:{margin:e.spacing.unit,display:"inline-flex",border:"2px solid grey"},blockContainerGeneric:{margin:e.spacing.unit/2},blockResponse:{fontFamily:"Roboto, Helvetica, Arial, sans-serif !important",flex:2,color:"grey",background:e.palette.grey.A100,fontSize:"0.8rem",padding:e.spacing.unit/2,display:"flex",alignItems:"center",justifyContent:"center",borderRight:"2px solid grey"},blockResponseGeneric:{borderRight:0},blockMath:{color:e.palette.grey[400],padding:e.spacing.unit/2,display:"flex",alignItems:"center",justifyContent:"center",flex:8,"& > .mq-math-mode":{"& > .mq-hasCursor":{"& > .mq-cursor":{display:"none"}}}},tooltip:{fontSize:e.typography.fontSize-2,whiteSpace:"pre-wrap"},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit},advancedResponse:{marginBottom:2.5*e.spacing.unit}})))(ne);const oe=e,{withStyles:se}=a,ie=t,le=r,{FeedbackConfig:re}=p,{settings:ce}=p,{layout:pe}=p,{InputContainer:de}=p,ue=d;function me(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const he=le("@pie-element:math-inline:configure"),{Panel:ge,toggle:be,radio:_e,dropdown:Ce}=ce;class ye extends oe.Component{constructor(...e){super(...e),ye.prototype.__init.call(this),ye.prototype.__init2.call(this),ye.prototype.__init3.call(this)}static __initStatic(){this.propTypes={onModelChanged:ie.func,onConfigurationChanged:ie.func,classes:ie.object,model:ie.object.isRequired,configuration:ie.object.isRequired,imageSupport:ie.object,uploadSoundSupport:ie.object}}__init(){this.onChange=e=>{this.props.onModelChanged(e)}}__init2(){this.changeTeacherInstructions=e=>{this.props.onModelChanged({...this.props.model,teacherInstructions:e})}}__init3(){this.onFeedbackChange=e=>{const{model:t,onModelChanged:n}=this.props;t.feedback=e,n(t)}}render(){const{classes:e,model:t,imageSupport:n,onModelChanged:a,configuration:o,onConfigurationChanged:s,uploadSoundSupport:i}=this.props,{allowTrailingZeros:l={},baseInputConfiguration:r={},contentDimensions:c={},feedback:p={},ignoreOrder:d={},maxImageWidth:u={},maxImageHeight:m={},prompt:h={},rationale:g={},responseType:b={},scoringType:_={},settingsPanelDisabled:C,spellCheck:y={},studentInstructions:f={},teacherInstructions:E={},withRubric:v={},mathMlOptions:x={},language:S={},languageChoices:w={}}=o||{},{errors:T={},extraCSSRules:I,feedbackEnabled:A,promptEnabled:k,rationaleEnabled:N,spellCheckEnabled:j,teacherInstructionsEnabled:M,toolbarEditorPosition:K}=t||{},{teacherInstructions:P}=T;he("[render] model",t);const q={position:"top"===K?"top":"bottom"},B=u&&u.prompt,F=m&&m.prompt,H={responseType:b.settings&&_e(b.label,[D,R]),feedbackEnabled:p.settings&&be(p.label),promptEnabled:h.settings&&be(h.label),"language.enabled":S.settings&&be(S.label,!0),language:S.settings&&S.enabled&&Ce(w.label,w.options)},L={teacherInstructionsEnabled:E.settings&&be(E.label),studentInstructionsEnabled:f.settings&&be(f.label),rationaleEnabled:g.settings&&be(g.label),spellCheckEnabled:y.settings&&be(y.label),scoringType:_.settings&&_e(_.label,["auto","rubric"]),"ignoreOrder.enabled":d.settings&&be(d.label),"allowTrailingZeros.enabled":l.settings&&be(l.label),rubricEnabled:me([v,"optionalAccess",e=>e.settings])&&be(me([v,"optionalAccess",e=>e.label]))};return oe.createElement(pe.ConfigLayout,{extraCSSRules:I,dimensions:c,hideSettings:C,settings:oe.createElement(ge,{model:t,configuration:o,onChangeModel:e=>a(e),onChangeConfiguration:e=>s(e),groups:{Settings:H,Properties:L}})},M&&oe.createElement(de,{label:E.label,className:e.promptHolder},oe.createElement(ue,{className:e.prompt,markup:t.teacherInstructions||"",onChange:this.changeTeacherInstructions,imageSupport:n,nonEmpty:!1,error:P,toolbarOpts:q,pluginProps:O(me([E,"optionalAccess",e=>e.inputConfiguration]),r),spellCheck:j,maxImageWidth:u&&u.teacherInstructions||B,maxImageHeight:m&&m.teacherInstructions||F,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:x}),P&&oe.createElement("div",{className:e.errorText},P)),oe.createElement(ae,{imageSupport:n,uploadSoundSupport:i,model:t,configuration:o,onChange:this.onChange,rationaleEnabled:N,promptEnabled:k,toolbarOpts:q,spellCheck:j}),A&&oe.createElement(re,{feedback:t.feedback,onChange:this.onFeedbackChange,toolbarOpts:q}))}}ye.__initStatic();var fe=se((e=>({promptHolder:{width:"100%",paddingTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit}})))(ye),Ee={};Object.defineProperty(Ee,"__esModule",{value:!0});class ve extends CustomEvent{constructor(e,t=!1){super(ve.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}ve.TYPE="model.updated";var xe=Ee.ModelUpdatedEvent=ve;class Se extends CustomEvent{constructor(e,t){super(Se.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}Se.TYPE="delete.image";var we=Ee.DeleteImageEvent=Se;class Te extends CustomEvent{constructor(e){super(Te.TYPE,{bubbles:!0,detail:e}),this.handler=e}}Te.TYPE="insert.image";var Ie=Ee.InsertImageEvent=Te;class Ae extends CustomEvent{constructor(e,t){super(Ae.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}Ae.TYPE="delete.sound";var ke=Ee.DeleteSoundEvent=Ae;class Ne extends CustomEvent{constructor(e){super(Ne.TYPE,{bubbles:!0,detail:e}),this.handler=e}}Ne.TYPE="insert.sound";var Re=Ee.InsertSoundEvent=Ne,De={allowTrailingZerosDefault:!1,customKeys:[],equationEditor:"8",expression:"",feedback:{correct:{default:"Correct",type:"none"},incorrect:{default:"Incorrect",type:"none"},partial:{default:"Nearly",type:"none"}},feedbackEnabled:!1,ignoreOrderDefault:!1,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,responseType:R,responses:[],scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",validationDefault:"literal"},Oe={baseInputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},feedback:{settings:!0,label:"Feedback"},responseType:{settings:!0,label:"Response type"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},settingsPanelDisabled:!1,spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},partialScoring:{settings:!1,label:"Allow Partial Scoring"},ignoreOrder:{settings:!1,label:"Ignore Order",enabled:!0},allowTrailingZeros:{settings:!1,label:"Allow Trailing Zeros",enabled:!0},maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const je=e,Me=c,{isEmpty:Ke}=i;function Pe(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const qe=r("pie-elements:math-inline:configure");class Be extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>(Ke(e.responses)||(e.responses=e.responses.map((e=>({...e,validation:e.validation||De.validationDefault,allowTrailingZeros:e.allowTrailingZeros||De.allowTrailingZerosDefault,ignoreOrder:e.ignoreOrder||De.ignoreOrderDefault||!1})))),{...De,...e})}constructor(){super(),this._model=Be.createDefaultModel(),this._configuration=Oe}set model(e){this._model=Be.createDefaultModel(e),this._render()}set configuration(e){const t={...Oe,...e};this._configuration=t,Pe([t,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?Pe([t,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=Pe([t,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):t.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find((e=>e.value===this._model.language))||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}onModelChanged(e){this._model=e,qe("[onModelChanged]: ",this._model),this._render(),this.dispatchEvent(new xe(this._model))}onConfigurationChanged(e){this._configuration=e,this._model&&this.onModelChanged(this._model),this._render()}insertImage(e){this.dispatchEvent(new Ie(e))}onDeleteImage(e,t){this.dispatchEvent(new we(e,t))}insertSound(e){this.dispatchEvent(new Re(e))}onDeleteSound(e,t){this.dispatchEvent(new ke(e,t))}_render(){if(this._model){const e=je.createElement(fe,{onModelChanged:this.onModelChanged.bind(this),onConfigurationChanged:this.onConfigurationChanged.bind(this),model:this._model,configuration:this._configuration,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});Me.render(e,this)}}}Be.__initStatic();export{Be as default};
|
|
1
|
+
import{_dll_react_dom as e,_dll_react as t,_dll_prop_types as n,_dll_mui__material as o,_dll_mui__material_styles as r,_dll_pie_lib__render_ui as a,_dll_classnames as i,_dll_mui__icons_material as s,_dll_debug as l}from"../../../@pie-lib/shared-module@^4.0.1/module/index.js";import{_dll_pie_lib__config_ui as c}from"../../../@pie-lib/config-module@^3.0.1/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as p}from"../../../@pie-lib/editable-html-module@^6.1.2/module/index.js";import{_dll_pie_lib__math_toolbar as u,_dll_pie_framework__mathquill as d}from"../../../@pie-lib/math-edit-module@^3.1.2/module/index.js";var h,g=e;h=g.createRoot,g.hydrateRoot;const m=t,f=n,{Card:b}=o,{CardContent:_}=o,{Button:y}=o,{FormControlLabel:v}=o,{Typography:E}=o,{InputLabel:C}=o,{Checkbox:w}=o,{Select:j}=o,{MenuItem:x}=o,{styled:S}=r,{color:A}=a,{InputContainer:O}=c,{MathToolbar:I}=u,k=S(b)(({theme:e})=>({marginBottom:e.spacing(2.5),width:"100%",minWidth:"548px",border:`1px solid ${e.palette.grey[700]}`,display:"flex",flexDirection:"column",justifyContent:"space-between"})),T=S(_)(({theme:e})=>({paddingBottom:`${e.spacing(2)}px !important`})),P=S(E)({fontWeight:700,fontSize:"1.2rem",flex:3}),R=S(O)(({theme:e})=>({flex:2,"& > *:not(label)":{marginTop:e.spacing(1)}})),D=S("div")(({theme:e})=>({marginBottom:e.spacing(2)})),M=S("div")({display:"flex",alignItems:"center",justifyContent:"space-between"}),z=S("div")({display:"flex"}),K=S("div")({display:"flex",alignItems:"center",justifyContent:"space-between"}),F=S("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)})),q=S(w)({color:`${A.tertiary()} !important`}),B=S(y)(({theme:e})=>({border:`1px solid ${e.palette.grey.A400}`,color:A.text()})),L=S(y)(({theme:e})=>({marginLeft:e.spacing(2),border:`1px solid ${e.palette.grey.A400}`,color:"gray",fontSize:"0.8rem"}));if("undefined"!=typeof document){const e="math-inline-response-styles";if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent="\n .response-editor {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n min-width: 500px;\n max-width: 900px;\n height: auto;\n min-height: 40px;\n }\n .math-toolbar {\n width: 100%;\n }\n ",document.head.appendChild(t)}}class N extends m.Component{static __initStatic(){this.propTypes={defaultResponse:f.bool,error:f.object,mode:f.oneOfType([f.string,f.number]),index:f.number,onResponseChange:f.func.isRequired,response:f.object.isRequired,cIgnoreOrder:f.object.isRequired,cAllowTrailingZeros:f.object.isRequired}}static __initStatic2(){this.defaultProps={defaultResponse:!1,mode:"miscellaneous"}}constructor(e){super(e),N.prototype.__init.call(this),N.prototype.__init2.call(this),N.prototype.__init3.call(this),N.prototype.__init4.call(this),N.prototype.__init5.call(this),N.prototype.__init6.call(this),N.prototype.__init7.call(this),N.prototype.__init8.call(this),N.prototype.__init9.call(this),N.prototype.__init10.call(this),N.prototype.__init11.call(this);const{response:{alternates:t}={}}=e||{},n=Object.keys(t||{}).length;this.state={alternateIdCounter:n+1,showKeypad:{openCount:0,main:!1}}}__init(){this.onChange=e=>t=>{const{response:n,onResponseChange:o,index:r}=this.props,a={...n};a[e]=t.target.value,o(a,r)}}__init2(){this.onConfigChanged=e=>t=>{const{response:n,onResponseChange:o,index:r}=this.props,a={...n};a[e]=t.target.checked,o(a,r)}}__init3(){this.onLiteralOptionsChange=e=>()=>{const{response:t,onResponseChange:n,index:o}=this.props,r={...t};r[e]=!t[e],n(r,o)}}__init4(){this.onAnswerChange=e=>{const{response:t,onResponseChange:n,index:o}=this.props,r={...t};r.answer=e,n(r,o)}}__init5(){this.onAlternateAnswerChange=e=>t=>{const{response:n,onResponseChange:o,index:r}=this.props,a={...n};a.alternates[e]=t,o(a,r)}}__init6(){this.onAddAlternate=()=>{const{response:e,onResponseChange:t,index:n}=this.props,{alternateIdCounter:o}=this.state,r={...e};r.alternates||(r.alternates={}),r.alternates[o]="",t(r,n),this.setState({alternateIdCounter:o+1})}}__init7(){this.onRemoveAlternate=e=>()=>{const{response:t,onResponseChange:n,index:o}=this.props,r={...t};delete r.alternates[e],n(r,o),this.setState(t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount-1:t.showKeypad.openCount}}))}}__init8(){this.onDone=()=>{this.setState(e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.openCount-1,main:!1}}))}}__init9(){this.onFocus=()=>{this.setState(e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.main?e.showKeypad.openCount:e.showKeypad.openCount+1,main:!0}}))}}__init10(){this.onAlternateFocus=e=>()=>{this.setState(t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount:t.showKeypad.openCount+1,[e]:!0}}))}}__init11(){this.onAlternateDone=e=>()=>{this.setState(t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad.openCount-1,[e]:!1}}))}}render(){const{mode:e,defaultResponse:t,index:n,response:o,cAllowTrailingZeros:r,cIgnoreOrder:a,error:i}=this.props,{showKeypad:s}=this.state,{validation:l,answer:c,alternates:p,ignoreOrder:u,allowTrailingZeros:d}=o,h=Object.keys(p||{}).length>0,g={editor:"response-editor",mathToolbar:"math-toolbar"},f={minHeight:(s.openCount>0?430:230)+"px"};return m.createElement(k,{style:f},m.createElement(T,null,m.createElement(M,null,m.createElement(P,{component:"div"},"Response ",""),m.createElement(R,{label:"Validation"},m.createElement(j,{onChange:this.onChange("validation"),value:l||"literal",MenuProps:{transitionDuration:{enter:225,exit:195}}},m.createElement(x,{value:"literal"},"Literal Validation"),m.createElement(x,{value:"symbolic"},"Symbolic Validation")))),"literal"===l&&m.createElement(z,null,r.enabled&&m.createElement(v,{label:r.label,control:m.createElement(q,{checked:d,onChange:this.onLiteralOptionsChange("allowTrailingZeros")})}),a.enabled&&m.createElement(v,{label:a.label,control:m.createElement(q,{checked:u,onChange:this.onLiteralOptionsChange("ignoreOrder")})})),m.createElement(D,null,m.createElement(C,null,"Correct Answer"),m.createElement(I,{keypadMode:e,classNames:g,controlledKeypad:!0,showKeypad:s.main,latex:c||"",onChange:this.onAnswerChange,onFocus:this.onFocus,onDone:this.onDone,error:i&&i.answer}),i&&i.answer?m.createElement(F,null,i.answer):null),h&&Object.keys(p).map((t,n)=>m.createElement(D,{key:t},m.createElement(K,null,m.createElement(C,null,"Alternate",Object.keys(p).length>1?` ${n+1}`:""),m.createElement(L,{type:"secondary",onClick:this.onRemoveAlternate(t)},"Remove")),m.createElement(I,{classNames:g,controlledKeypad:!0,keypadMode:e,showKeypad:s[t]||!1,latex:p[t]||"",onChange:this.onAlternateAnswerChange(t),onFocus:this.onAlternateFocus(t),onDone:this.onAlternateDone(t),error:i&&i[t]}),i&&i[t]?m.createElement(F,null,i[t]):null)),m.createElement(B,{type:"primary",onClick:this.onAddAlternate},"ADD ALTERNATE")))}}N.__initStatic(),N.__initStatic2();var $="object"==typeof global&&global&&global.Object===Object&&global,Z="object"==typeof self&&self&&self.Object===Object&&self,U=$||Z||Function("return this")(),W=U.Symbol,G=Object.prototype,H=G.hasOwnProperty,Y=G.toString,V=W?W.toStringTag:void 0,J=Object.prototype.toString,Q=W?W.toStringTag:void 0;function X(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Q&&Q in Object(e)?function(e){var t=H.call(e,V),n=e[V];try{e[V]=void 0;var o=!0}catch(e){}var r=Y.call(e);return o&&(t?e[V]=n:delete e[V]),r}(e):function(e){return J.call(e)}(e)}function ee(e){return null!=e&&"object"==typeof e}var te=Array.isArray;function ne(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function oe(e){if(!ne(e))return!1;var t=X(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var re,ae=U["__core-js_shared__"],ie=(re=/[^.]+$/.exec(ae&&ae.keys&&ae.keys.IE_PROTO||""))?"Symbol(src)_1."+re:"",se=Function.prototype.toString;function le(e){if(null!=e){try{return se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var ce=/^\[object .+?Constructor\]$/,pe=Function.prototype,ue=Object.prototype,de=pe.toString,he=ue.hasOwnProperty,ge=RegExp("^"+de.call(he).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function me(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!ne(e)||(t=e,ie&&ie in t))&&(oe(e)?ge:ce).test(le(e));var t}(n)?n:void 0}var fe=me(U,"WeakMap"),be=/^(?:0|[1-9]\d*)$/;function _e(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&be.test(e))&&e>-1&&e%1==0&&e<t}function ye(e,t){return e===t||e!=e&&t!=t}function ve(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Ee(e){return null!=e&&ve(e.length)&&!oe(e)}var Ce=Object.prototype;function we(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ce)}function je(e){return ee(e)&&"[object Arguments]"==X(e)}var xe=Object.prototype,Se=xe.hasOwnProperty,Ae=xe.propertyIsEnumerable,Oe=je(function(){return arguments}())?je:function(e){return ee(e)&&Se.call(e,"callee")&&!Ae.call(e,"callee")},Ie="object"==typeof exports&&exports&&!exports.nodeType&&exports,ke=Ie&&"object"==typeof module&&module&&!module.nodeType&&module,Te=ke&&ke.exports===Ie?U.Buffer:void 0,Pe=(Te?Te.isBuffer:void 0)||function(){return!1},Re={};Re["[object Float32Array]"]=Re["[object Float64Array]"]=Re["[object Int8Array]"]=Re["[object Int16Array]"]=Re["[object Int32Array]"]=Re["[object Uint8Array]"]=Re["[object Uint8ClampedArray]"]=Re["[object Uint16Array]"]=Re["[object Uint32Array]"]=!0,Re["[object Arguments]"]=Re["[object Array]"]=Re["[object ArrayBuffer]"]=Re["[object Boolean]"]=Re["[object DataView]"]=Re["[object Date]"]=Re["[object Error]"]=Re["[object Function]"]=Re["[object Map]"]=Re["[object Number]"]=Re["[object Object]"]=Re["[object RegExp]"]=Re["[object Set]"]=Re["[object String]"]=Re["[object WeakMap]"]=!1;var De,Me="object"==typeof exports&&exports&&!exports.nodeType&&exports,ze=Me&&"object"==typeof module&&module&&!module.nodeType&&module,Ke=ze&&ze.exports===Me&&$.process,Fe=function(){try{return ze&&ze.require&&ze.require("util").types||Ke&&Ke.binding&&Ke.binding("util")}catch(e){}}(),qe=Fe&&Fe.isTypedArray,Be=qe?(De=qe,function(e){return De(e)}):function(e){return ee(e)&&ve(e.length)&&!!Re[X(e)]},Le=Object.prototype.hasOwnProperty;var Ne=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),$e=Ne,Ze=Object.prototype.hasOwnProperty;function Ue(e){if(!we(e))return $e(e);var t=[];for(var n in Object(e))Ze.call(e,n)&&"constructor"!=n&&t.push(n);return t}function We(e){return Ee(e)?function(e,t){var n=te(e),o=!n&&Oe(e),r=!n&&!o&&Pe(e),a=!n&&!o&&!r&&Be(e),i=n||o||r||a,s=i?function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}(e.length,String):[],l=s.length;for(var c in e)!t&&!Le.call(e,c)||i&&("length"==c||r&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||_e(c,l))||s.push(c);return s}(e):Ue(e)}var Ge=me(Object,"create"),He=Object.prototype.hasOwnProperty,Ye=Object.prototype.hasOwnProperty;function Ve(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function Je(e,t){for(var n=e.length;n--;)if(ye(e[n][0],t))return n;return-1}Ve.prototype.clear=function(){this.__data__=Ge?Ge(null):{},this.size=0},Ve.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ve.prototype.get=function(e){var t=this.__data__;if(Ge){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return He.call(t,e)?t[e]:void 0},Ve.prototype.has=function(e){var t=this.__data__;return Ge?void 0!==t[e]:Ye.call(t,e)},Ve.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ge&&void 0===t?"__lodash_hash_undefined__":t,this};var Qe=Array.prototype.splice;function Xe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Xe.prototype.clear=function(){this.__data__=[],this.size=0},Xe.prototype.delete=function(e){var t=this.__data__,n=Je(t,e);return!(n<0||(n==t.length-1?t.pop():Qe.call(t,n,1),--this.size,0))},Xe.prototype.get=function(e){var t=this.__data__,n=Je(t,e);return n<0?void 0:t[n][1]},Xe.prototype.has=function(e){return Je(this.__data__,e)>-1},Xe.prototype.set=function(e,t){var n=this.__data__,o=Je(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};var et=me(U,"Map");function tt(e,t){var n,o,r=e.__data__;return("string"==(o=typeof(n=t))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?r["string"==typeof t?"string":"hash"]:r.map}function nt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function ot(e){var t=this.__data__=new Xe(e);this.size=t.size}nt.prototype.clear=function(){this.size=0,this.__data__={hash:new Ve,map:new(et||Xe),string:new Ve}},nt.prototype.delete=function(e){var t=tt(this,e).delete(e);return this.size-=t?1:0,t},nt.prototype.get=function(e){return tt(this,e).get(e)},nt.prototype.has=function(e){return tt(this,e).has(e)},nt.prototype.set=function(e,t){var n=tt(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this},ot.prototype.clear=function(){this.__data__=new Xe,this.size=0},ot.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},ot.prototype.get=function(e){return this.__data__.get(e)},ot.prototype.has=function(e){return this.__data__.has(e)},ot.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Xe){var o=n.__data__;if(!et||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new nt(o)}return n.set(e,t),this.size=n.size,this};var rt=Object.prototype.propertyIsEnumerable,at=Object.getOwnPropertySymbols,it=at?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,o=null==e?0:e.length,r=0,a=[];++n<o;){var i=e[n];t(i)&&(a[r++]=i)}return a}(at(e),function(t){return rt.call(e,t)}))}:function(){return[]};function st(e){return function(e,t,n){var o=We(e);return te(e)?o:function(e,t){for(var n=-1,o=t.length,r=e.length;++n<o;)e[r+n]=t[n];return e}(o,n(e))}(e,0,it)}var lt=me(U,"DataView"),ct=me(U,"Promise"),pt=me(U,"Set"),ut="[object Map]",dt="[object Promise]",ht="[object Set]",gt="[object WeakMap]",mt="[object DataView]",ft=le(lt),bt=le(et),_t=le(ct),yt=le(pt),vt=le(fe),Et=X;(lt&&Et(new lt(new ArrayBuffer(1)))!=mt||et&&Et(new et)!=ut||ct&&Et(ct.resolve())!=dt||pt&&Et(new pt)!=ht||fe&&Et(new fe)!=gt)&&(Et=function(e){var t=X(e),n="[object Object]"==t?e.constructor:void 0,o=n?le(n):"";if(o)switch(o){case ft:return mt;case bt:return ut;case _t:return dt;case yt:return ht;case vt:return gt}return t});var Ct=Et,wt=U.Uint8Array;function jt(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new nt;++t<n;)this.add(e[t])}function xt(e,t){for(var n=-1,o=null==e?0:e.length;++n<o;)if(t(e[n],n,e))return!0;return!1}function St(e,t,n,o,r,a){var i=1&n,s=e.length,l=t.length;if(s!=l&&!(i&&l>s))return!1;var c=a.get(e),p=a.get(t);if(c&&p)return c==t&&p==e;var u=-1,d=!0,h=2&n?new jt:void 0;for(a.set(e,t),a.set(t,e);++u<s;){var g=e[u],m=t[u];if(o)var f=i?o(m,g,u,t,e,a):o(g,m,u,e,t,a);if(void 0!==f){if(f)continue;d=!1;break}if(h){if(!xt(t,function(e,t){if(i=t,!h.has(i)&&(g===e||r(g,e,n,o,a)))return h.push(t);var i})){d=!1;break}}else if(g!==m&&!r(g,m,n,o,a)){d=!1;break}}return a.delete(e),a.delete(t),d}function At(e){var t=-1,n=Array(e.size);return e.forEach(function(e,o){n[++t]=[o,e]}),n}function Ot(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}jt.prototype.add=jt.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},jt.prototype.has=function(e){return this.__data__.has(e)};var It=W?W.prototype:void 0,kt=It?It.valueOf:void 0,Tt=Object.prototype.hasOwnProperty,Pt="[object Arguments]",Rt="[object Array]",Dt="[object Object]",Mt=Object.prototype.hasOwnProperty;function zt(e,t,n,o,r){return e===t||(null==e||null==t||!ee(e)&&!ee(t)?e!=e&&t!=t:function(e,t,n,o,r,a){var i=te(e),s=te(t),l=i?Rt:Ct(e),c=s?Rt:Ct(t),p=(l=l==Pt?Dt:l)==Dt,u=(c=c==Pt?Dt:c)==Dt,d=l==c;if(d&&Pe(e)){if(!Pe(t))return!1;i=!0,p=!1}if(d&&!p)return a||(a=new ot),i||Be(e)?St(e,t,n,o,r,a):function(e,t,n,o,r,a,i){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new wt(e),new wt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ye(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=At;case"[object Set]":var l=1&o;if(s||(s=Ot),e.size!=t.size&&!l)return!1;var c=i.get(e);if(c)return c==t;o|=2,i.set(e,t);var p=St(s(e),s(t),o,r,a,i);return i.delete(e),p;case"[object Symbol]":if(kt)return kt.call(e)==kt.call(t)}return!1}(e,t,l,n,o,r,a);if(!(1&n)){var h=p&&Mt.call(e,"__wrapped__"),g=u&&Mt.call(t,"__wrapped__");if(h||g){var m=h?e.value():e,f=g?t.value():t;return a||(a=new ot),r(m,f,n,o,a)}}return!!d&&(a||(a=new ot),function(e,t,n,o,r,a){var i=1&n,s=st(e),l=s.length;if(l!=st(t).length&&!i)return!1;for(var c=l;c--;){var p=s[c];if(!(i?p in t:Tt.call(t,p)))return!1}var u=a.get(e),d=a.get(t);if(u&&d)return u==t&&d==e;var h=!0;a.set(e,t),a.set(t,e);for(var g=i;++c<l;){var m=e[p=s[c]],f=t[p];if(o)var b=i?o(f,m,p,t,e,a):o(m,f,p,e,t,a);if(!(void 0===b?m===f||r(m,f,n,o,a):b)){h=!1;break}g||(g="constructor"==p)}if(h&&!g){var _=e.constructor,y=t.constructor;_==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof y&&y instanceof y||(h=!1)}return a.delete(e),a.delete(t),h}(e,t,n,o,r,a))}(e,t,n,o,zt,r))}var Kt=Object.prototype.hasOwnProperty;const Ft="Advanced Multi",qt="Simple",Bt=(e={},t={})=>({...t,...e}),Lt=t,Nt=n,$t=i,{styled:Zt}=r,{InputLabel:Ut}=o,{Select:Wt}=o,{MenuItem:Gt}=o,{Tooltip:Ht}=o,{Info:Yt}=s,Vt=p,{InputContainer:Jt}=c,{MathToolbar:Qt}=u,Xt=d;function en(e){let t,n=e[0],o=1;for(;o<e.length;){const r=e[o],a=e[o+1];if(o+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=a(n)):"call"!==r&&"optionalCall"!==r||(n=a((...e)=>n.call(t,...e)),t=void 0)}return n}let tn=!1;const nn=Zt("div")({display:"flex",flexDirection:"column"}),on=Zt(Ut)({fontSize:"0.85rem"}),rn=Zt("div")({fontSize:"1.1rem"}),an=Zt("div")({display:"flex",alignItems:"center",justifyContent:"space-between"}),sn=Zt(Jt)(({theme:e})=>({flex:"initial",width:"40%",marginTop:e.spacing(2),marginBottom:e.spacing(2),"& > *:not(label)":{marginTop:e.spacing(1)}})),ln=Zt("div")({display:"flex",flexDirection:"column"}),cn=Zt(Ht)(({theme:e})=>({"& .MuiTooltip-tooltip":{fontSize:e.typography.fontSize-2,whiteSpace:"pre-wrap"}})),pn=Zt("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)})),un=Zt(Jt)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2),marginBottom:e.spacing(2)})),dn=Zt("div")(({theme:e})=>({marginBottom:e.spacing(2.5)}));if("undefined"!=typeof document){const e="math-inline-block-styles";if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent="\n .block-container {\n margin: 8px;\n display: inline-flex;\n border: 2px solid grey;\n }\n .block-container-generic {\n margin: 4px;\n }\n .block-response {\n flex: 2;\n color: grey;\n background: #f5f5f5;\n font-size: 0.8rem;\n padding: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-right: 2px solid grey;\n }\n .block-response-generic {\n border-right: 0;\n }\n .response-editor {\n display: flex;\n justify-content: center;\n width: 100%;\n max-width: inherit;\n height: auto;\n min-height: 130px;\n text-align: left;\n padding: 8px;\n }\n ",document.head.appendChild(t)}}const hn=/{{response}}/gm,gn=/\\%response\\%/gm,mn=/\\embed\{answerBlock\}\[r\d*\]/g,fn=/\\embed\{newLine\}\[\]/g,bn=/\\newline/g;function _n(e){if(e){let t=1;return e.replace(hn,()=>`\\embed{answerBlock}[r${t++}]`).replace(bn,"\\embed{newLine}[]")}}class yn extends Lt.Component{static __initStatic(){this.propTypes={model:Nt.object.isRequired,imageSupport:Nt.object,uploadSoundSupport:Nt.object,configuration:Nt.object,onChange:Nt.func.isRequired,promptEnabled:Nt.bool,rationaleEnabled:Nt.bool,toolbarOpts:Nt.object}}constructor(e){super(e),yn.prototype.__init.call(this),yn.prototype.__init2.call(this),yn.prototype.__init3.call(this),yn.prototype.__init4.call(this),yn.prototype.__init5.call(this),yn.prototype.__init6.call(this),yn.prototype.__init7.call(this);const t={};if(e.model&&e.model.expression){let n=1;e.model.expression.replace(hn,()=>{t["r"+n++]={value:""}})}this.state={showKeypad:!1,responseAreas:t,responseIdCounter:Object.keys(t).length}}__init(){this.onChange=e=>t=>{const{model:n,onChange:o}=this.props,r={...n};r[e]="object"==typeof t?t.target.value:t,"expression"===e&&(r[e]=function(e){if(e)return e.replace(mn,()=>"{{response}}").replace(gn,()=>"{{response}}").replace(fn,()=>"\\newline")}(t)),o(r)}}__init2(){this.onDone=()=>{this.setState({showKeypad:!1})}}__init3(){this.onFocus=()=>{this.setState({showKeypad:!0})}}__init4(){this.onPromptFocus=()=>{this.setState({showKeypad:!1})}}UNSAFE_componentWillMount(){if("undefined"!=typeof window){let e=Xt.getInterface(2);tn||(e.registerEmbed("answerBlock",e=>{const t="block-response",n="block-response-generic";return{htmlString:`<div class="${$t("block-container","block-container-generic")}">\n <div class="${$t(t,n)}" id="${e}Index">Response</div>\n </div>`,text:()=>"text",latex:()=>`\\embed{answerBlock}[${e}]`}}),tn=!0)}}componentDidMount(){this.handleAnswerBlockDomUpdate()}componentDidUpdate(){this.handleAnswerBlockDomUpdate()}__init5(){this.handleAnswerBlockDomUpdate=()=>{const{model:e}=this.props,t={};if(e&&e.expression){let n=1;e.expression.replace(hn,()=>{t["r"+n++]={value:""}})}zt(t,this.state.responseAreas)||this.setState({responseAreas:t},()=>{this.root&&Object.keys(t).length&&Object.keys(t).forEach((e,t)=>{const n=this.root.querySelector(`#${e}`),o=this.root.querySelector(`#${e}Index`);n&&(Xt.getInterface(2).StaticMath(n),o.textContent=`R${t+1}`)})})}}__init6(){this.onAddResponse=()=>{const{model:e,onChange:t}=this.props,{responseIdCounter:n}=this.state,o={...e};let r=n;for(;e.responses.find(e=>e.id===r);)r++;const a={id:r,validation:"literal",answer:"",alternates:{}};o.responses=o.responses.concat(a),t(o),this.setState({responseIdCounter:a.id})}}__init7(){this.onResponseChange=(e,t)=>{const{model:n,onChange:o}=this.props,r={...n};r.responses[t]=e,o(r)}}render(){const{model:e,imageSupport:t,uploadSoundSupport:n,configuration:o,promptEnabled:r,rationaleEnabled:a,toolbarOpts:i}=this.props,{showKeypad:s}=this.state,{prompt:l,expression:c,equationEditor:p,promptEquationEditor:u="8",responses:d,responseType:h,rationale:g,spellCheckEnabled:m,errors:f={}}=e,{baseInputConfiguration:b={},rationale:_={},prompt:y={},ignoreOrder:v={},allowTrailingZeros:E={},maxResponseAreas:C,maxImageWidth:w={},maxImageHeight:j={},mathMlOptions:x={}}=o||{},S=((e={},t={})=>{const{maxResponseAreas:n}=t,{responseType:o}=e;let r="";return"Advanced Multi"===o&&(r="\nThere should be at least 1 "+(n?`and at most ${n} `:"")+"response area"+(n?"s":"")+" defined."),"Validation requirements:\nAll correct answers (the primary and any alternates) should not be empty and should be unique."+r})(o,e),{prompt:A,rationale:O,responsesErrors:I,responseAreasError:k}=f,T=w&&w.prompt,P=j&&j.prompt,R=h===Ft?d:d.slice(0,1),D=Lt.createElement(cn,{disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:S},Lt.createElement(Yt,{fontSize:"small",color:"primary",style:{marginLeft:"5px"}}));return Lt.createElement(nn,{ref:e=>this.root=e||this.root},r&&Lt.createElement(un,{label:y.label},Lt.createElement(Vt,{onFocus:this.onPromptFocus,markup:l||"",onChange:this.onChange("prompt"),imageSupport:t,nonEmpty:!1,error:A,toolbarOpts:i,pluginProps:Bt(en([y,"optionalAccess",e=>e.inputConfiguration]),b),spellCheck:m,maxImageWidth:T,maxImageHeight:P,uploadSoundSupport:n,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:x}),A&&Lt.createElement(pn,null,A)),h===Ft&&Lt.createElement(dn,null,Lt.createElement(an,{style:{justifyContent:"flex-start"}},Lt.createElement(rn,null,"Define Response"),D),Lt.createElement(sn,{key:"templateEditorType",label:"Response Template Equation Editor"},Lt.createElement(Wt,{onChange:this.onChange("promptEquationEditor"),value:u,MenuProps:{transitionDuration:{enter:225,exit:195}}},Lt.createElement(Gt,{value:"non-negative-integers"},"Numeric - Non-Negative Integers"),Lt.createElement(Gt,{value:"integers"},"Numeric - Integers"),Lt.createElement(Gt,{value:"decimals"},"Numeric - Decimals"),Lt.createElement(Gt,{value:"fractions"},"Numeric - Fractions"),Lt.createElement(Gt,{value:1},"Grade 1 - 2"),Lt.createElement(Gt,{value:3},"Grade 3 - 5"),Lt.createElement(Gt,{value:6},"Grade 6 - 7"),Lt.createElement(Gt,{value:8},"Grade 8 - HS"),Lt.createElement(Gt,{value:"geometry"},"Geometry"),Lt.createElement(Gt,{value:"advanced-algebra"},"Advanced Algebra"),Lt.createElement(Gt,{value:"statistics"},"Statistics"),Lt.createElement(Gt,{value:"item-authoring"},"Item Authoring"))),Lt.createElement(ln,{key:"templateHolder"},Lt.createElement(on,null,"RESPONSE TEMPLATE"),Lt.createElement(Qt,{classNames:{editor:"response-editor"},allowAnswerBlock:!0,keypadMode:u,controlledKeypad:!0,showKeypad:s,latex:_n(c)||"",onChange:this.onChange("expression"),onFocus:this.onFocus,onDone:this.onDone,maxResponseAreas:C,error:k})),k&&Lt.createElement(pn,null,k)),Lt.createElement(an,{style:{justifyContent:"flex-start"}},Lt.createElement(rn,null,"Define Correct Response"),h===qt?D:null),Lt.createElement(sn,{label:"Equation Editor"},Lt.createElement(Wt,{onChange:this.onChange("equationEditor"),value:p,MenuProps:{transitionDuration:{enter:225,exit:195}}},Lt.createElement(Gt,{value:"non-negative-integers"},"Numeric - Non-Negative Integers"),Lt.createElement(Gt,{value:"integers"},"Numeric - Integers"),Lt.createElement(Gt,{value:"decimals"},"Numeric - Decimals"),Lt.createElement(Gt,{value:"fractions"},"Numeric - Fractions"),Lt.createElement(Gt,{value:1},"Grade 1 - 2"),Lt.createElement(Gt,{value:3},"Grade 3 - 5"),Lt.createElement(Gt,{value:6},"Grade 6 - 7"),Lt.createElement(Gt,{value:8},"Grade 8 - HS"),Lt.createElement(Gt,{value:"geometry"},"Geometry"),Lt.createElement(Gt,{value:"advanced-algebra"},"Advanced Algebra"),Lt.createElement(Gt,{value:"statistics"},"Statistics"),Lt.createElement(Gt,{value:"item-authoring"},"Item Authoring"))),R.map((e,t)=>Lt.createElement(N,{key:e.id,mode:p,response:e,defaultResponse:h===qt,onResponseChange:this.onResponseChange,index:t,cIgnoreOrder:v,cAllowTrailingZeros:E,error:I&&I[t]})),a&&Lt.createElement(un,{label:_.label},Lt.createElement(Vt,{markup:g||"",onChange:this.onChange("rationale"),imageSupport:t,nonEmpty:!1,error:O,toolbarOpts:i,pluginProps:Bt(en([_,"optionalAccess",e=>e.inputConfiguration]),{...b,math:{controlledKeypadMode:!1}}),spellCheck:m,maxImageWidth:w&&w.rationale||T,maxImageHeight:j&&j.rationale||P,uploadSoundSupport:n,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:x}),O&&Lt.createElement(pn,null,O)))}}yn.__initStatic();const vn=t,{styled:En}=r,Cn=n,wn=l,{FeedbackConfig:jn}=c,{settings:xn}=c,{layout:Sn}=c,{InputContainer:An}=c,On=p;function In(e){let t,n=e[0],o=1;for(;o<e.length;){const r=e[o],a=e[o+1];if(o+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=a(n)):"call"!==r&&"optionalCall"!==r||(n=a((...e)=>n.call(t,...e)),t=void 0)}return n}const kn=wn("@pie-element:math-inline:configure"),{Panel:Tn,toggle:Pn,radio:Rn,dropdown:Dn}=xn,Mn=En(An)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2),marginBottom:e.spacing(2)})),zn=En("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)}));class Kn extends vn.Component{constructor(...e){super(...e),Kn.prototype.__init.call(this),Kn.prototype.__init2.call(this),Kn.prototype.__init3.call(this)}static __initStatic(){this.propTypes={onModelChanged:Cn.func,onConfigurationChanged:Cn.func,model:Cn.object.isRequired,configuration:Cn.object.isRequired,imageSupport:Cn.object,uploadSoundSupport:Cn.object}}__init(){this.onChange=e=>{this.props.onModelChanged(e)}}__init2(){this.changeTeacherInstructions=e=>{this.props.onModelChanged({...this.props.model,teacherInstructions:e})}}__init3(){this.onFeedbackChange=e=>{const{model:t,onModelChanged:n}=this.props;t.feedback=e,n(t)}}render(){const{model:e,imageSupport:t,onModelChanged:n,configuration:o,onConfigurationChanged:r,uploadSoundSupport:a}=this.props,{allowTrailingZeros:i={},baseInputConfiguration:s={},contentDimensions:l={},feedback:c={},ignoreOrder:p={},maxImageWidth:u={},maxImageHeight:d={},prompt:h={},rationale:g={},responseType:m={},scoringType:f={},settingsPanelDisabled:b,spellCheck:_={},studentInstructions:y={},teacherInstructions:v={},withRubric:E={},mathMlOptions:C={},language:w={},languageChoices:j={}}=o||{},{errors:x={},extraCSSRules:S,feedbackEnabled:A,promptEnabled:O,rationaleEnabled:I,spellCheckEnabled:k,teacherInstructionsEnabled:T,toolbarEditorPosition:P}=e||{},{teacherInstructions:R}=x;kn("[render] model",e);const D={position:"top"===P?"top":"bottom"},M=u&&u.prompt,z=d&&d.prompt,K={responseType:m.settings&&Rn(m.label,[qt,Ft]),feedbackEnabled:c.settings&&Pn(c.label),promptEnabled:h.settings&&Pn(h.label),"language.enabled":w.settings&&Pn(w.label,!0),language:w.settings&&w.enabled&&Dn(j.label,j.options)},F={teacherInstructionsEnabled:v.settings&&Pn(v.label),studentInstructionsEnabled:y.settings&&Pn(y.label),rationaleEnabled:g.settings&&Pn(g.label),spellCheckEnabled:_.settings&&Pn(_.label),scoringType:f.settings&&Rn(f.label,["auto","rubric"]),"ignoreOrder.enabled":p.settings&&Pn(p.label),"allowTrailingZeros.enabled":i.settings&&Pn(i.label),rubricEnabled:In([E,"optionalAccess",e=>e.settings])&&Pn(In([E,"optionalAccess",e=>e.label]))};return vn.createElement(Sn.ConfigLayout,{extraCSSRules:S,dimensions:l,hideSettings:b,settings:vn.createElement(Tn,{model:e,configuration:o,onChangeModel:e=>n(e),onChangeConfiguration:e=>r(e),groups:{Settings:K,Properties:F}})},T&&vn.createElement(Mn,{label:v.label},vn.createElement(On,{markup:e.teacherInstructions||"",onChange:this.changeTeacherInstructions,imageSupport:t,nonEmpty:!1,error:R,toolbarOpts:D,pluginProps:Bt(In([v,"optionalAccess",e=>e.inputConfiguration]),s),spellCheck:k,maxImageWidth:u&&u.teacherInstructions||M,maxImageHeight:d&&d.teacherInstructions||z,uploadSoundSupport:a,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:C}),R&&vn.createElement(zn,null,R)),vn.createElement(yn,{imageSupport:t,uploadSoundSupport:a,model:e,configuration:o,onChange:this.onChange,rationaleEnabled:I,promptEnabled:O,toolbarOpts:D,spellCheck:k}),A&&vn.createElement(jn,{feedback:e.feedback,onChange:this.onFeedbackChange,toolbarOpts:D}))}}Kn.__initStatic();var Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});class qn extends CustomEvent{constructor(e,t=!1){super(qn.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}qn.TYPE="model.updated";var Bn=Fn.ModelUpdatedEvent=qn;class Ln extends CustomEvent{constructor(e,t){super(Ln.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}Ln.TYPE="delete.image";var Nn=Fn.DeleteImageEvent=Ln;class $n extends CustomEvent{constructor(e){super($n.TYPE,{bubbles:!0,detail:e}),this.handler=e}}$n.TYPE="insert.image";var Zn=Fn.InsertImageEvent=$n;class Un extends CustomEvent{constructor(e,t){super(Un.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}Un.TYPE="delete.sound";var Wn=Fn.DeleteSoundEvent=Un;class Gn extends CustomEvent{constructor(e){super(Gn.TYPE,{bubbles:!0,detail:e}),this.handler=e}}Gn.TYPE="insert.sound";var Hn=Fn.InsertSoundEvent=Gn,Yn={allowTrailingZerosDefault:!1,customKeys:[],equationEditor:"8",expression:"",feedback:{correct:{default:"Correct",type:"none"},incorrect:{default:"Incorrect",type:"none"},partial:{default:"Nearly",type:"none"}},feedbackEnabled:!1,ignoreOrderDefault:!1,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,responseType:Ft,responses:[],scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",validationDefault:"literal"},Vn={baseInputConfiguration:{h3:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},feedback:{settings:!0,label:"Feedback"},responseType:{settings:!0,label:"Response type"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},settingsPanelDisabled:!1,spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},partialScoring:{settings:!1,label:"Allow Partial Scoring"},ignoreOrder:{settings:!1,label:"Ignore Order",enabled:!0},allowTrailingZeros:{settings:!1,label:"Allow Trailing Zeros",enabled:!0},maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const Jn=t;function Qn(e){let t,n=e[0],o=1;for(;o<e.length;){const r=e[o],a=e[o+1];if(o+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=a(n)):"call"!==r&&"optionalCall"!==r||(n=a((...e)=>n.call(t,...e)),t=void 0)}return n}const Xn=l("pie-elements:math-inline:configure");class eo extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>(function(e){if(null==e)return!0;if(Ee(e)&&(te(e)||"string"==typeof e||"function"==typeof e.splice||Pe(e)||Be(e)||Oe(e)))return!e.length;var t=Ct(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(we(e))return!Ue(e).length;for(var n in e)if(Kt.call(e,n))return!1;return!0}(e.responses)||(e.responses=e.responses.map(e=>({...e,validation:e.validation||Yn.validationDefault,allowTrailingZeros:e.allowTrailingZeros||Yn.allowTrailingZerosDefault,ignoreOrder:e.ignoreOrder||Yn.ignoreOrderDefault||!1}))),{...Yn,...e})}constructor(){super(),this._root=null,this._model=eo.createDefaultModel(),this._configuration=Vn}set model(e){this._model=eo.createDefaultModel(e),this._render()}set configuration(e){const t={...Vn,...e};this._configuration=t,Qn([t,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?Qn([t,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=Qn([t,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):t.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find(e=>e.value===this._model.language)||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}onModelChanged(e){this._model=e,Xn("[onModelChanged]: ",this._model),this._render(),this.dispatchEvent(new Bn(this._model))}onConfigurationChanged(e){this._configuration=e,this._model&&this.onModelChanged(this._model),this._render()}insertImage(e){this.dispatchEvent(new Zn(e))}onDeleteImage(e,t){this.dispatchEvent(new Nn(e,t))}insertSound(e){this.dispatchEvent(new Hn(e))}onDeleteSound(e,t){this.dispatchEvent(new Wn(e,t))}_render(){if(this._model){const e=Jn.createElement(Kn,{onModelChanged:this.onModelChanged.bind(this),onConfigurationChanged:this.onConfigurationChanged.bind(this),model:this._model,configuration:this._configuration,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(this._root=h(this)),this._root.render(e)}}disconnectedCallback(){this._root&&this._root.unmount()}}eo.__initStatic();export{eo as default};
|