@pie-element/explicit-constructed-response 12.0.4-next.20261011174919 → 12.0.4

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.
@@ -3,57 +3,44 @@ import { ECRToolbar as n } from "./ecr-toolbar.js";
3
3
  import { AlternateResponses as r } from "./alternateResponses.js";
4
4
  import { generateValidationMessage as i } from "./utils.js";
5
5
  import a from "react";
6
- import o from "prop-types";
7
- import { cloneDeep as s, isEmpty as c, pick as l, throttle as u } from "@pie-element/shared-lodash";
8
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
- import { styled as p } from "@mui/material/styles";
10
- import m, { ALL_PLUGINS as ee } from "@pie-lib/editable-html-tip-tap";
11
- import { InputContainer as h, layout as te, settings as g } from "@pie-lib/config-ui";
6
+ import { cloneDeep as o, isEmpty as s, pick as c, throttle as l } from "@pie-element/shared-lodash";
7
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
8
+ import { styled as f } from "@mui/material/styles";
9
+ import p, { ALL_PLUGINS as ee } from "@pie-lib/editable-html-tip-tap";
10
+ import { InputContainer as m, layout as h, settings as g } from "@pie-lib/config-ui";
12
11
  import _ from "@mui/material/Typography";
13
- import ne from "@mui/icons-material/Info";
12
+ import te from "@mui/icons-material/Info";
14
13
  import v from "@mui/material/Tooltip";
15
14
  //#region src/author/main.tsx
16
- var { toggle: y, Panel: re, dropdown: ie } = g, b = p(h)(({ theme: e }) => ({
15
+ var { toggle: y, Panel: ne, dropdown: re } = g, b = f(m)(({ theme: e }) => ({
17
16
  width: "100%",
18
17
  paddingTop: e.spacing(1),
19
18
  marginTop: e.spacing(2),
20
19
  marginBottom: e.spacing(2)
21
- })), ae = p(m)(({ theme: e }) => ({
20
+ })), ie = f(p)(({ theme: e }) => ({
22
21
  minHeight: "100px",
23
22
  paddingTop: e.spacing(1),
24
23
  width: "100%",
25
24
  "& [data-slate-editor=\"true\"]": { minHeight: "100px" }
26
- })), oe = p(_)(({ theme: e }) => ({ fontSize: e.typography.fontSize + 2 })), x = p(v)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
25
+ })), ae = f(_)(({ theme: e }) => ({ fontSize: e.typography.fontSize + 2 })), x = f(v)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
27
26
  fontSize: e.typography.fontSize - 2,
28
27
  whiteSpace: "pre",
29
28
  maxWidth: "500px"
30
- } })), S = p("div")(({ theme: e }) => ({
29
+ } })), S = f("div")(({ theme: e }) => ({
31
30
  fontSize: e.typography.fontSize - 2,
32
31
  color: e.palette.error.main,
33
32
  paddingTop: e.spacing(1)
34
- })), se = p("div")({
33
+ })), oe = f("div")({
35
34
  display: "flex",
36
35
  alignItems: "center"
37
- }), ce = p(_)(({ theme: e }) => ({
36
+ }), C = f(_)(({ theme: e }) => ({
38
37
  fontSize: e.typography.fontSize + 2,
39
38
  marginTop: e.spacing(3),
40
39
  marginBottom: e.spacing(1)
41
- })), C = (e) => {
40
+ })), w = (e) => {
42
41
  let t = document.createElement("div");
43
42
  return t.innerHTML = e.trim(), t;
44
- }, w = class extends a.Component {
45
- static propTypes = {
46
- configuration: o.object.isRequired,
47
- model: o.object.isRequired,
48
- disableSidePanel: o.bool,
49
- onModelChanged: o.func.isRequired,
50
- onConfigurationChanged: o.func.isRequired,
51
- imageSupport: o.shape({
52
- add: o.func.isRequired,
53
- delete: o.func.isRequired
54
- }),
55
- uploadSoundSupport: o.object
56
- };
43
+ }, T = class extends a.Component {
57
44
  state = {};
58
45
  componentDidMount() {
59
46
  let { model: { slateMarkup: n, choices: r, maxLengthPerChoice: i = [] }, onModelChanged: a } = this.props, o = !i.length;
@@ -86,70 +73,70 @@ var { toggle: y, Panel: re, dropdown: ie } = g, b = p(h)(({ theme: e }) => ({
86
73
  t({ maxLengthPerChoice: e });
87
74
  };
88
75
  onChangeResponse = (n, r) => {
89
- let { model: i, onModelChanged: a } = this.props, { choices: o } = i, { maxLengthPerChoice: s } = i, c = e(r || "").length;
76
+ let { model: i, onModelChanged: a } = this.props, { choices: o } = i, s = i.maxLengthPerChoice, c = e(r || "").length;
90
77
  if (!o[n] || !o[n].length) {
91
78
  o[n] = [{
92
79
  label: r || "",
93
80
  value: "0"
94
81
  }];
95
- let e = n > s.length ? n - s.length : 0;
96
- s = [...s, ...Array(e).fill(1)], s.splice(n, 0, t(c));
97
- } else o[n][0].label = r || "", s && (s[n] < c || s[n] > c + 10) && (s[n] = t(c));
82
+ let e = Number(n) > s.length ? Number(n) - s.length : 0;
83
+ s = [...s, ...Array(e).fill(1)], s.splice(Number(n), 0, t(c));
84
+ } else o[n][0].label = r || "", s && (s[Number(n)] < c || s[Number(n)] > c + 10) && (s[Number(n)] = t(c));
98
85
  a({
99
86
  choices: o,
100
87
  maxLengthPerChoice: s
101
88
  });
102
89
  };
103
90
  onChange = (e) => {
104
- let { model: { choices: t, maxLengthPerChoice: n }, onModelChanged: r } = this.props, i = C(e), a = i.querySelectorAll("[data-type=\"explicit_constructed_response\"]"), o = {}, c = [];
91
+ let { model: { choices: t, maxLengthPerChoice: n }, onModelChanged: r } = this.props, i = w(e), a = i.querySelectorAll("[data-type=\"explicit_constructed_response\"]"), s = {}, c = [];
105
92
  a.forEach((e, r) => {
106
- let i = s(t[e.dataset.index]);
107
- i && (i[0] = {
93
+ let i = e.dataset.index, a = o(t[i]);
94
+ a && (a[0] = {
108
95
  label: e.dataset.value || "",
109
96
  value: "0"
110
- }, c[r] = n[e.dataset.index]), o[r] = i, e.dataset.index = r;
97
+ }, c[r] = n[Number(i)]), s[r] = a, e.dataset.index = `${r}`;
111
98
  }), this.setState({ cachedChoices: void 0 }, () => r({
112
- choices: o,
99
+ choices: s,
113
100
  slateMarkup: i.innerHTML,
114
101
  maxLengthPerChoice: c
115
102
  }));
116
103
  };
117
- onHandleAreaChange = u((e) => {
104
+ onHandleAreaChange = l((e) => {
118
105
  let { model: { choices: t }, onModelChanged: n } = this.props, { cachedChoices: r } = this.state;
119
106
  if (!e) return;
120
- let i = t ? s(t) : {}, a = r ? s(r) : {};
107
+ let i = t ? o(t) : {}, a = r ? o(r) : {};
121
108
  e.forEach((e) => {
122
109
  let t = e.index;
123
- !i[t] && a[t] ? (Object.assign(i, l(a, t)), Object.prototype.hasOwnProperty.call(a, t) && delete a[t]) : (Object.assign(a, l(i, t)), Object.prototype.hasOwnProperty.call(i, t) && delete i[t]);
110
+ !i[t] && a[t] ? (Object.assign(i, c(a, t)), Object.prototype.hasOwnProperty.call(a, t) && delete a[t]) : (Object.assign(a, c(i, t)), Object.prototype.hasOwnProperty.call(i, t) && delete i[t]);
124
111
  }), this.setState({ cachedChoices: a }, () => n({ choices: i }));
125
112
  }, 500, {
126
113
  trailing: !1,
127
114
  leading: !0
128
115
  });
129
116
  render() {
130
- let { model: e, configuration: t, onConfigurationChanged: a, imageSupport: o, uploadSoundSupport: s } = this.props, { baseInputConfiguration: l = {}, contentDimensions: u = {}, maxImageWidth: p = {}, maxImageHeight: h = {}, maxLengthPerChoice: g = {}, maxResponseAreas: _, partialScoring: v = {}, playerSpellCheck: C = {}, prompt: w = {}, rationale: T = {}, template: le = {}, settingsPanelDisabled: E, spellCheck: D = {}, editSource: O = {}, teacherInstructions: k = {}, withRubric: A = {}, mathMlOptions: j = {}, language: M = {}, languageChoices: N = {}, spanishButton: P = {}, responseAreaInputConfiguration: F = {} } = t || {}, { errors: I, extraCSSRules: L, maxLengthPerChoiceEnabled: R, promptEnabled: z, rationaleEnabled: B, spellCheckEnabled: V, teacherInstructionsEnabled: H, toolbarEditorPosition: U } = e || {}, { choices: W = {}, prompt: G, rationale: K, responseAreas: q, teacherInstructions: J } = I || {}, Y = i(t), X = p && p.prompt, Z = h && h.prompt, Q = { position: U === "top" ? "top" : "bottom" }, ue = {
131
- partialScoring: v.settings && y(v.label),
132
- maxLengthPerChoiceEnabled: g.settings && y(g.label),
133
- "language.enabled": M.settings && y(M.label, !0),
134
- language: M.settings && M.enabled && ie(N.label, N.options),
135
- "responseAreaInputConfiguration.inputConfiguration.characters.disabled": P.settings && y(P.label, !0)
117
+ let { model: e, configuration: t, onConfigurationChanged: a, imageSupport: o, uploadSoundSupport: c } = this.props, { baseInputConfiguration: l = {}, contentDimensions: f = {}, maxImageWidth: m = {}, maxImageHeight: g = {}, maxLengthPerChoice: _ = {}, maxResponseAreas: v, partialScoring: w = {}, playerSpellCheck: T = {}, prompt: E = {}, rationale: D = {}, template: se = {}, settingsPanelDisabled: ce, spellCheck: O = {}, editSource: k = {}, teacherInstructions: A = {}, withRubric: j = {}, mathMlOptions: M = {}, language: N = {}, languageChoices: P = {}, spanishButton: F = {}, responseAreaInputConfiguration: I = {} } = t || {}, { errors: L, extraCSSRules: R, maxLengthPerChoiceEnabled: z, promptEnabled: B, rationaleEnabled: V, spellCheckEnabled: H, teacherInstructionsEnabled: U, toolbarEditorPosition: W } = e || {}, { choices: G = {}, prompt: K, rationale: q, responseAreas: J, teacherInstructions: Y } = L || {}, le = i(t), X = m && m.prompt, Z = g && g.prompt, Q = { position: W === "top" ? "top" : "bottom" }, ue = {
118
+ partialScoring: w.settings && y(w.label),
119
+ maxLengthPerChoiceEnabled: _.settings && y(_.label),
120
+ "language.enabled": N.settings && y(N.label, !0),
121
+ language: N.settings && N.enabled && re(P.label, P.options),
122
+ "responseAreaInputConfiguration.inputConfiguration.characters.disabled": F.settings && y(F.label, !0)
136
123
  }, de = {
137
- teacherInstructionsEnabled: k.settings && y(k.label),
138
- rationaleEnabled: T.settings && y(T.label),
139
- promptEnabled: w.settings && y(w.label),
140
- spellCheckEnabled: D.settings && y(D.label),
141
- playerSpellCheckEnabled: C.settings && y(C.label),
142
- rubricEnabled: A?.settings && y(A?.label),
143
- "editSource.enabled": O?.settings && y(O.label, !0)
124
+ teacherInstructionsEnabled: A.settings && y(A.label),
125
+ rationaleEnabled: D.settings && y(D.label),
126
+ promptEnabled: E.settings && y(E.label),
127
+ spellCheckEnabled: O.settings && y(O.label),
128
+ playerSpellCheckEnabled: T.settings && y(T.label),
129
+ rubricEnabled: j?.settings && y(j?.label),
130
+ "editSource.enabled": k?.settings && y(k.label, !0)
144
131
  }, $ = (e = {}) => ({
145
132
  ...l,
146
133
  ...e
147
134
  });
148
- return /* @__PURE__ */ f(te.ConfigLayout, {
149
- extraCSSRules: L,
150
- dimensions: u,
151
- hideSettings: E,
152
- settings: /* @__PURE__ */ d(re, {
135
+ return /* @__PURE__ */ d(h.ConfigLayout, {
136
+ extraCSSRules: R,
137
+ dimensions: f,
138
+ hideSettings: ce,
139
+ settings: /* @__PURE__ */ u(ne, {
153
140
  model: e,
154
141
  configuration: t,
155
142
  onChangeModel: (e) => this.onModelChange(e),
@@ -160,84 +147,84 @@ var { toggle: y, Panel: re, dropdown: ie } = g, b = p(h)(({ theme: e }) => ({
160
147
  }
161
148
  }),
162
149
  children: [
163
- H && /* @__PURE__ */ f(b, {
164
- label: k.label,
165
- children: [/* @__PURE__ */ d(m, {
150
+ U && /* @__PURE__ */ d(b, {
151
+ label: A.label,
152
+ children: [/* @__PURE__ */ u(p, {
166
153
  className: "prompt",
167
154
  markup: e.teacherInstructions || "",
168
155
  onChange: this.onTeacherInstructionsChanged,
169
156
  imageSupport: o,
170
157
  nonEmpty: !1,
171
- error: J,
158
+ error: Y,
172
159
  toolbarOpts: Q,
173
- pluginProps: $(k?.inputConfiguration),
174
- spellCheck: V,
175
- maxImageWidth: p && p.teacherInstructions || X,
176
- maxImageHeight: h && h.teacherInstructions || Z,
177
- uploadSoundSupport: s,
160
+ pluginProps: $(A?.inputConfiguration),
161
+ spellCheck: H,
162
+ maxImageWidth: m && m.teacherInstructions || X,
163
+ maxImageHeight: g && g.teacherInstructions || Z,
164
+ uploadSoundSupport: c,
178
165
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
179
- mathMlOptions: j,
166
+ mathMlOptions: M,
180
167
  autoWidthToolbar: !0
181
- }), J && /* @__PURE__ */ d(S, { children: J })]
168
+ }), Y && /* @__PURE__ */ u(S, { children: Y })]
182
169
  }),
183
- z && /* @__PURE__ */ f(b, {
184
- label: w.label,
185
- children: [/* @__PURE__ */ d(m, {
170
+ B && /* @__PURE__ */ d(b, {
171
+ label: E.label,
172
+ children: [/* @__PURE__ */ u(p, {
186
173
  className: "prompt",
187
174
  markup: e.prompt,
188
175
  onChange: this.onPromptChanged,
189
176
  imageSupport: o,
190
177
  nonEmpty: !1,
191
178
  disableUnderline: !0,
192
- error: G,
179
+ error: K,
193
180
  toolbarOpts: Q,
194
- pluginProps: $(w?.inputConfiguration),
195
- spellCheck: V,
181
+ pluginProps: $(E?.inputConfiguration),
182
+ spellCheck: H,
196
183
  maxImageWidth: X,
197
184
  maxImageHeight: Z,
198
- uploadSoundSupport: s,
185
+ uploadSoundSupport: c,
199
186
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
200
- mathMlOptions: j,
187
+ mathMlOptions: M,
201
188
  autoWidthToolbar: !0
202
- }), G && /* @__PURE__ */ d(S, { children: G })]
189
+ }), K && /* @__PURE__ */ u(S, { children: K })]
203
190
  }),
204
- /* @__PURE__ */ f(se, { children: [/* @__PURE__ */ d(oe, {
191
+ /* @__PURE__ */ d(oe, { children: [/* @__PURE__ */ u(ae, {
205
192
  component: "div",
206
193
  children: "Define Template, Choices, and Correct Responses"
207
- }), /* @__PURE__ */ d(x, {
194
+ }), /* @__PURE__ */ u(x, {
208
195
  disableFocusListener: !0,
209
196
  disableTouchListener: !0,
210
197
  placement: "right",
211
- title: Y,
212
- children: /* @__PURE__ */ d(ne, {
198
+ title: le,
199
+ children: /* @__PURE__ */ u(te, {
213
200
  fontSize: "small",
214
201
  color: "primary",
215
202
  style: { marginLeft: "8px" }
216
203
  })
217
204
  })] }),
218
- /* @__PURE__ */ d(ae, {
205
+ /* @__PURE__ */ u(ie, {
219
206
  activePlugins: ee,
220
207
  toolbarOpts: { position: "top" },
221
- spellCheck: V,
222
- pluginProps: $(le?.inputConfiguration),
208
+ spellCheck: H,
209
+ pluginProps: $(se?.inputConfiguration),
223
210
  responseAreaProps: {
224
211
  type: "explicit-constructed-response",
225
212
  options: { duplicates: !0 },
226
- maxResponseAreas: _,
213
+ maxResponseAreas: v,
227
214
  respAreaToolbar: (e, t, r) => {
228
215
  let [i, a] = e, { model: o } = this.props, s = (o.choices[i.attrs.index] || [])[0];
229
- return () => /* @__PURE__ */ d(n, {
216
+ return () => /* @__PURE__ */ u(n, {
230
217
  onChangeResponse: (e) => this.onChangeResponse(i.attrs.index, e),
231
218
  node: i,
232
219
  pos: a,
233
220
  editor: t,
234
221
  onToolbarDone: r,
235
222
  correctChoice: s,
236
- maxLengthPerChoiceEnabled: R,
237
- pluginProps: $(F?.inputConfiguration)
223
+ maxLengthPerChoiceEnabled: z,
224
+ pluginProps: $(I?.inputConfiguration)
238
225
  });
239
226
  },
240
- error: () => W,
227
+ error: () => G,
241
228
  onHandleAreaChange: this.onHandleAreaChange
242
229
  },
243
230
  markup: e.slateMarkup,
@@ -247,45 +234,45 @@ var { toggle: y, Panel: re, dropdown: ie } = g, b = p(h)(({ theme: e }) => ({
247
234
  onBlur: this.onBlur,
248
235
  disabled: !1,
249
236
  highlightShape: !1,
250
- error: q,
251
- uploadSoundSupport: s,
237
+ error: J,
238
+ uploadSoundSupport: c,
252
239
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
253
- mathMlOptions: j,
240
+ mathMlOptions: M,
254
241
  autoWidthToolbar: !0
255
242
  }),
256
- q && /* @__PURE__ */ d(S, { children: q }),
257
- !c(e.choices) && /* @__PURE__ */ d(ce, { children: `Define Alternates ${R ? "and Character Limits" : ""}` }),
258
- /* @__PURE__ */ d(r, {
243
+ J && /* @__PURE__ */ u(S, { children: J }),
244
+ !s(e.choices) && /* @__PURE__ */ u(C, { children: `Define Alternates ${z ? "and Character Limits" : ""}` }),
245
+ /* @__PURE__ */ u(r, {
259
246
  model: e,
260
247
  onChange: this.onResponsesChanged,
261
248
  onLengthChange: this.onLengthChanged,
262
- maxLengthPerChoiceEnabled: R,
263
- spellCheck: V,
264
- choicesErrors: W,
265
- pluginProps: $(F?.inputConfiguration)
249
+ maxLengthPerChoiceEnabled: z,
250
+ spellCheck: H,
251
+ choicesErrors: G,
252
+ pluginProps: $(I?.inputConfiguration)
266
253
  }),
267
- B && /* @__PURE__ */ f(b, {
268
- label: T.label,
269
- children: [/* @__PURE__ */ d(m, {
254
+ V && /* @__PURE__ */ d(b, {
255
+ label: D.label,
256
+ children: [/* @__PURE__ */ u(p, {
270
257
  className: "prompt",
271
258
  markup: e.rationale || "",
272
259
  onChange: this.onRationaleChanged,
273
260
  imageSupport: o,
274
- error: K,
261
+ error: q,
275
262
  toolbarOpts: Q,
276
- pluginProps: $(T?.inputConfiguration),
277
- spellCheck: V,
278
- maxImageWidth: p && p.rationale || X,
279
- maxImageHeight: h && h.rationale || Z,
280
- uploadSoundSupport: s,
263
+ pluginProps: $(D?.inputConfiguration),
264
+ spellCheck: H,
265
+ maxImageWidth: m && m.rationale || X,
266
+ maxImageHeight: g && g.rationale || Z,
267
+ uploadSoundSupport: c,
281
268
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
282
- mathMlOptions: j,
269
+ mathMlOptions: M,
283
270
  autoWidthToolbar: !0
284
- }), K && /* @__PURE__ */ d(S, { children: K })]
271
+ }), q && /* @__PURE__ */ u(S, { children: q })]
285
272
  })
286
273
  ]
287
274
  });
288
275
  }
289
276
  };
290
277
  //#endregion
291
- export { w as Main, w as default };
278
+ export { T as Main, T as default };
@@ -2453,15 +2453,12 @@ var Lr = class extends K.Component {
2453
2453
  }), Vr = (e) => typeof e == "string" ? {
2454
2454
  label: e,
2455
2455
  value: e
2456
- } : e, Hr = function() {
2457
- let [e, t, n = !1] = Array.prototype.slice.call(arguments);
2458
- return {
2459
- type: "radio",
2460
- label: e,
2461
- choices: t && t.map((e) => Vr(e)),
2462
- isConfigProperty: n
2463
- };
2464
- }, Ur = (e, t, n = !1) => ({
2456
+ } : e, Hr = (e, t, n = !1) => ({
2457
+ type: "radio",
2458
+ label: e,
2459
+ choices: t && t.map((e) => Vr(e)),
2460
+ isConfigProperty: n
2461
+ }), Ur = (e, t, n = !1) => ({
2465
2462
  type: "dropdown",
2466
2463
  label: e,
2467
2464
  choices: t,
@@ -2927,18 +2924,6 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
2927
2924
  let t = document.createElement("div");
2928
2925
  return t.innerHTML = e.trim(), t;
2929
2926
  }, Li = class extends K.Component {
2930
- static propTypes = {
2931
- configuration: Q.default.object.isRequired,
2932
- model: Q.default.object.isRequired,
2933
- disableSidePanel: Q.default.bool,
2934
- onModelChanged: Q.default.func.isRequired,
2935
- onConfigurationChanged: Q.default.func.isRequired,
2936
- imageSupport: Q.default.shape({
2937
- add: Q.default.func.isRequired,
2938
- delete: Q.default.func.isRequired
2939
- }),
2940
- uploadSoundSupport: Q.default.object
2941
- };
2942
2927
  state = {};
2943
2928
  componentDidMount() {
2944
2929
  let { model: { slateMarkup: e, choices: t, maxLengthPerChoice: n = [] }, onModelChanged: r } = this.props, i = !n.length;
@@ -2971,15 +2956,15 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
2971
2956
  t({ maxLengthPerChoice: e });
2972
2957
  };
2973
2958
  onChangeResponse = (e, t) => {
2974
- let { model: n, onModelChanged: r } = this.props, { choices: i } = n, { maxLengthPerChoice: a } = n, o = di(t || "").length;
2959
+ let { model: n, onModelChanged: r } = this.props, { choices: i } = n, a = n.maxLengthPerChoice, o = di(t || "").length;
2975
2960
  if (!i[e] || !i[e].length) {
2976
2961
  i[e] = [{
2977
2962
  label: t || "",
2978
2963
  value: "0"
2979
2964
  }];
2980
- let n = e > a.length ? e - a.length : 0;
2981
- a = [...a, ...Array(n).fill(1)], a.splice(e, 0, li(o));
2982
- } else i[e][0].label = t || "", a && (a[e] < o || a[e] > o + 10) && (a[e] = li(o));
2965
+ let n = Number(e) > a.length ? Number(e) - a.length : 0;
2966
+ a = [...a, ...Array(n).fill(1)], a.splice(Number(e), 0, li(o));
2967
+ } else i[e][0].label = t || "", a && (a[Number(e)] < o || a[Number(e)] > o + 10) && (a[Number(e)] = li(o));
2983
2968
  r({
2984
2969
  choices: i,
2985
2970
  maxLengthPerChoice: a
@@ -2988,11 +2973,11 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
2988
2973
  onChange = (e) => {
2989
2974
  let { model: { choices: t, maxLengthPerChoice: n }, onModelChanged: i } = this.props, a = Ii(e), o = a.querySelectorAll("[data-type=\"explicit_constructed_response\"]"), s = {}, c = [];
2990
2975
  o.forEach((e, i) => {
2991
- let a = r(t[e.dataset.index]);
2992
- a && (a[0] = {
2976
+ let a = e.dataset.index, o = r(t[a]);
2977
+ o && (o[0] = {
2993
2978
  label: e.dataset.value || "",
2994
2979
  value: "0"
2995
- }, c[i] = n[e.dataset.index]), s[i] = a, e.dataset.index = i;
2980
+ }, c[i] = n[Number(a)]), s[i] = o, e.dataset.index = `${i}`;
2996
2981
  }), this.setState({ cachedChoices: void 0 }, () => i({
2997
2982
  choices: s,
2998
2983
  slateMarkup: a.innerHTML,
@@ -3296,6 +3281,10 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
3296
3281
  }
3297
3282
  }
3298
3283
  }, zi = (0, ke.default)("explicit-constructed-response:configure"), Bi = class e extends HTMLElement {
3284
+ _root;
3285
+ _model;
3286
+ _configuration;
3287
+ _disableSidePanel;
3299
3288
  static prepareModel = (e = {}) => {
3300
3289
  let t = {
3301
3290
  ...Ri.model,
@@ -3319,7 +3308,8 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
3319
3308
  this._model = e.prepareModel(t), this._model.responseAreaInputConfiguration && (this._model.responseAreaInputConfiguration = this._configuration.responseAreaInputConfiguration?.inputConfiguration), this._render();
3320
3309
  }
3321
3310
  set configuration(e) {
3322
- this._configuration = o(e, Ri.configuration), e.language?.enabled ? e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value) : e.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({
3311
+ let t = o(e, Ri.configuration);
3312
+ this._configuration = t, e.language?.enabled ? e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value) : e.language.settings && this._model.language ? (t.language.enabled = !0, (!t.languageChoices.options || !t.languageChoices.options.length) && (t.languageChoices.options = []), t.languageChoices.options.find((e) => e.value === this._model.language) || t.languageChoices.options.push({
3323
3313
  value: this._model.language,
3324
3314
  label: this._model.language
3325
3315
  })) : delete this._model.language, this._render();