@pie-element/math-templated 7.1.1-next.147 → 7.1.1-next.16

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.
Files changed (98) hide show
  1. package/configure.js +2 -0
  2. package/controller.js +1 -0
  3. package/dist/author/defaults.d.ts +173 -0
  4. package/dist/author/defaults.js +123 -0
  5. package/dist/author/design.d.ts +35 -0
  6. package/dist/author/design.js +360 -0
  7. package/dist/author/index.d.ts +43 -0
  8. package/dist/author/index.js +100 -0
  9. package/dist/author/markupUtils.d.ts +11 -0
  10. package/dist/author/markupUtils.js +10 -0
  11. package/dist/author/response.d.ts +41 -0
  12. package/dist/author/response.js +238 -0
  13. package/dist/author/utils.d.ts +9 -0
  14. package/dist/author/utils.js +7 -0
  15. package/dist/browser/author/index.js +37244 -0
  16. package/dist/browser/author/index.js.map +1 -0
  17. package/dist/browser/browser-_ggI30Zt.js +342 -0
  18. package/dist/browser/browser-_ggI30Zt.js.map +1 -0
  19. package/dist/browser/controller/index.js +37733 -0
  20. package/dist/browser/controller/index.js.map +1 -0
  21. package/dist/browser/delivery/index.js +81 -0
  22. package/dist/browser/delivery/index.js.map +1 -0
  23. package/dist/browser/dist-DiGNNRzu.js +1426 -0
  24. package/dist/browser/dist-DiGNNRzu.js.map +1 -0
  25. package/dist/browser/horizontal-keypad-xHeOxFVV.js +14441 -0
  26. package/dist/browser/horizontal-keypad-xHeOxFVV.js.map +1 -0
  27. package/dist/browser/main-BLv4ZW26.js +1270 -0
  28. package/dist/browser/main-BLv4ZW26.js.map +1 -0
  29. package/dist/browser/math-templated.css +2 -0
  30. package/dist/browser/print/index.js +47 -0
  31. package/dist/browser/print/index.js.map +1 -0
  32. package/dist/controller/defaults.d.ts +29 -0
  33. package/dist/controller/defaults.js +23 -0
  34. package/dist/controller/index.d.ts +45 -0
  35. package/dist/controller/index.js +154 -0
  36. package/dist/delivery/index.d.ts +20 -0
  37. package/dist/delivery/index.js +51 -0
  38. package/dist/delivery/main.d.ts +40 -0
  39. package/dist/delivery/main.js +492 -0
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.iife.d.ts +8 -0
  42. package/dist/index.iife.js +202 -0
  43. package/dist/index.js +2 -0
  44. package/dist/math-templated.css +2 -0
  45. package/dist/print/index.d.ts +15 -0
  46. package/dist/print/index.js +47 -0
  47. package/dist/runtime-support.d.ts +12 -0
  48. package/dist/runtime-support.js +12 -0
  49. package/package.json +99 -22
  50. package/CHANGELOG.json +0 -1
  51. package/CHANGELOG.md +0 -1134
  52. package/LICENSE.md +0 -5
  53. package/README.md +0 -0
  54. package/configure/CHANGELOG.json +0 -1
  55. package/configure/CHANGELOG.md +0 -1011
  56. package/configure/lib/defaults.js +0 -172
  57. package/configure/lib/defaults.js.map +0 -1
  58. package/configure/lib/design.js +0 -546
  59. package/configure/lib/design.js.map +0 -1
  60. package/configure/lib/index.js +0 -173
  61. package/configure/lib/index.js.map +0 -1
  62. package/configure/lib/markupUtils.js +0 -39
  63. package/configure/lib/markupUtils.js.map +0 -1
  64. package/configure/lib/response.js +0 -394
  65. package/configure/lib/response.js.map +0 -1
  66. package/configure/lib/utils.js +0 -15
  67. package/configure/lib/utils.js.map +0 -1
  68. package/configure/package.json +0 -26
  69. package/controller/CHANGELOG.json +0 -1
  70. package/controller/CHANGELOG.md +0 -870
  71. package/controller/lib/defaults.js +0 -28
  72. package/controller/lib/defaults.js.map +0 -1
  73. package/controller/lib/index.js +0 -360
  74. package/controller/lib/index.js.map +0 -1
  75. package/controller/package.json +0 -17
  76. package/docs/config-schema.json +0 -2251
  77. package/docs/config-schema.json.md +0 -1658
  78. package/docs/demo/config.js +0 -8
  79. package/docs/demo/generate.js +0 -42
  80. package/docs/demo/index.html +0 -1
  81. package/docs/demo/session.js +0 -14
  82. package/docs/pie-schema.json +0 -1231
  83. package/docs/pie-schema.json.md +0 -894
  84. package/lib/index.js +0 -77
  85. package/lib/index.js.map +0 -1
  86. package/lib/main.js +0 -877
  87. package/lib/main.js.map +0 -1
  88. package/lib/print.js +0 -88
  89. package/lib/print.js.map +0 -1
  90. package/module/configure.js +0 -1
  91. package/module/controller.js +0 -3711
  92. package/module/demo.js +0 -67
  93. package/module/element.js +0 -1
  94. package/module/index.html +0 -21
  95. package/module/manifest.json +0 -22
  96. package/module/print-demo.js +0 -105
  97. package/module/print.html +0 -18
  98. package/module/print.js +0 -1
@@ -0,0 +1,1270 @@
1
+ import { C as e, g as t, n, o as r, t as i } from "./browser-_ggI30Zt.js";
2
+ import { G as a, J as o, K as s, Nt as c, W as l, _ as u, b as d, c as f, it as p, k as m, l as h, n as g, o as _, q as v, s as y, t as b, ut as x, y as S } from "./horizontal-keypad-xHeOxFVV.js";
3
+ import { t as C } from "./dist-DiGNNRzu.js";
4
+ import w, { useRef as T } from "react";
5
+ import { jsx as E, jsxs as D } from "react/jsx-runtime";
6
+ import ee from "react-dom";
7
+ //#region ../../lib-react/icons/dist/correct-response-icon.js
8
+ var O = /* @__PURE__ */ e(c(), 1), te = ({ bgFill: e, fgFill: t }) => /* @__PURE__ */ D("svg", {
9
+ preserveAspectRatio: "xMinYMin meet",
10
+ version: "1.1",
11
+ viewBox: "-283 359 34 35",
12
+ style: { enableBackground: "new -283 359 34 35" },
13
+ children: [
14
+ /* @__PURE__ */ E("circle", {
15
+ cx: "-266",
16
+ cy: "375.9",
17
+ r: "14",
18
+ fill: e
19
+ }),
20
+ /* @__PURE__ */ E("path", {
21
+ d: "M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z\n M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z",
22
+ fill: e
23
+ }),
24
+ /* @__PURE__ */ E("polygon", {
25
+ points: "-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6",
26
+ fill: t
27
+ })
28
+ ]
29
+ });
30
+ te.propTypes = {
31
+ bgFill: O.default.string.isRequired,
32
+ fgFill: O.default.string.isRequired
33
+ };
34
+ var ne = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ D("svg", {
35
+ preserveAspectRatio: "xMinYMin meet",
36
+ version: "1.1",
37
+ viewBox: "-129.5 127 34 35",
38
+ style: { enableBackground: "new -129.5 127 34 35" },
39
+ children: [
40
+ /* @__PURE__ */ E("path", {
41
+ style: {
42
+ fill: "#D0CAC5",
43
+ stroke: "#E6E3E0",
44
+ strokeWidth: .75,
45
+ strokeMiterlimit: 10
46
+ },
47
+ d: "M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5\n C-97.4,153.5-104.3,160.4-112.9,160.4z"
48
+ }),
49
+ /* @__PURE__ */ E("path", {
50
+ style: {
51
+ fill: "#B3ABA4",
52
+ stroke: "#CDC7C2",
53
+ strokeWidth: .5,
54
+ strokeMiterlimit: 10
55
+ },
56
+ d: "M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z"
57
+ }),
58
+ /* @__PURE__ */ E("circle", {
59
+ cx: "-114.2",
60
+ cy: "143.5",
61
+ r: "14",
62
+ fill: e
63
+ }),
64
+ /* @__PURE__ */ E("path", {
65
+ d: "M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z\n M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z",
66
+ fill: n
67
+ }),
68
+ /* @__PURE__ */ E("polygon", {
69
+ points: "-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2",
70
+ fill: t
71
+ })
72
+ ]
73
+ });
74
+ ne.propTypes = {
75
+ bgFill: O.default.string.isRequired,
76
+ fgFill: O.default.string.isRequired,
77
+ borderFill: O.default.string.isRequired
78
+ };
79
+ var re = x("div")(({ size: e }) => ({
80
+ width: e || "25px",
81
+ height: e || "25px"
82
+ })), k = ({ open: e, size: t }) => /* @__PURE__ */ E(re, {
83
+ size: t,
84
+ children: e ? /* @__PURE__ */ E(te, {
85
+ bgFill: "#bce2ff",
86
+ fgFill: "#1a9cff"
87
+ }) : /* @__PURE__ */ E(ne, {
88
+ bgFill: "white",
89
+ fgFill: "#1a9cff",
90
+ borderFill: "#bce2ff"
91
+ })
92
+ });
93
+ k.propTypes = {
94
+ open: O.default.bool,
95
+ size: O.default.string
96
+ }, k.defaultProps = { open: !1 };
97
+ //#endregion
98
+ //#region ../../lib-react/mask-markup/dist/componentize.js
99
+ var ie = /* @__PURE__ */ e(i(), 1), ae = /\{\{(\d+)\}\}/g, oe = (e, t) => e ? { markup: e.replace(ae, (e, n) => `<span data-component="${t}" data-id="${n}"></span>`) } : { markup: "" }, A = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), j = /* @__PURE__ */ A(((e, t) => {
100
+ t.exports = {
101
+ "border-radius": 1,
102
+ "border-top-left-radius": 1,
103
+ "border-top-right-radius": 1,
104
+ "border-bottom-left-radius": 1,
105
+ "border-bottom-right-radius": 1,
106
+ "box-shadow": 1,
107
+ order: 1,
108
+ flex: function(e, t) {
109
+ return [t + "box-flex"];
110
+ },
111
+ "box-flex": 1,
112
+ "box-align": 1,
113
+ animation: 1,
114
+ "animation-duration": 1,
115
+ "animation-name": 1,
116
+ transition: 1,
117
+ "transition-duration": 1,
118
+ transform: 1,
119
+ "transform-style": 1,
120
+ "transform-origin": 1,
121
+ "backface-visibility": 1,
122
+ perspective: 1,
123
+ "box-pack": 1
124
+ };
125
+ }));
126
+ j();
127
+ //#endregion
128
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js
129
+ var M = /* @__PURE__ */ A(((e, t) => {
130
+ t.exports = {
131
+ animation: 1,
132
+ "column-count": 1,
133
+ columns: 1,
134
+ "font-weight": 1,
135
+ opacity: 1,
136
+ "order ": 1,
137
+ "z-index": 1,
138
+ zoom: 1,
139
+ flex: 1,
140
+ "box-flex": 1,
141
+ transform: 1,
142
+ perspective: 1,
143
+ "box-pack": 1,
144
+ "box-align": 1,
145
+ colspan: 1,
146
+ rowspan: 1
147
+ };
148
+ }));
149
+ M();
150
+ //#endregion
151
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js
152
+ var N = /* @__PURE__ */ A(((e, t) => {
153
+ t.exports = function(e) {
154
+ return e.length ? e.charAt(0).toUpperCase() + e.substring(1) : e;
155
+ };
156
+ }));
157
+ N();
158
+ //#endregion
159
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js
160
+ var P = /* @__PURE__ */ A(((e, t) => {
161
+ var n = N(), r = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/, i = typeof document > "u" ? {} : document.documentElement.style;
162
+ t.exports = (function() {
163
+ var e = (function() {
164
+ for (var e in i) if (r.test(e)) return e.match(r)[0];
165
+ return "WebkitOpacity" in i ? "Webkit" : "KhtmlOpacity" in i ? "Khtml" : "";
166
+ })();
167
+ return {
168
+ style: e,
169
+ css: "-" + e.toLowerCase() + "-",
170
+ dom: {
171
+ Webkit: "WebKit",
172
+ ms: "MS",
173
+ o: "WebKit"
174
+ }[e] || n(e)
175
+ };
176
+ })();
177
+ }));
178
+ P();
179
+ //#endregion
180
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js
181
+ var se = /* @__PURE__ */ A(((e, t) => {
182
+ t.exports = /[-\s]+(.)?/g;
183
+ }));
184
+ se();
185
+ //#endregion
186
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js
187
+ var F = /* @__PURE__ */ A(((e, t) => {
188
+ var n = function(e, t) {
189
+ return t ? t.toUpperCase() : "";
190
+ }, r = se();
191
+ t.exports = function(e) {
192
+ return e ? e.replace(r, n) : "";
193
+ };
194
+ }));
195
+ F();
196
+ //#endregion
197
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js
198
+ var ce = /* @__PURE__ */ A(((e, t) => {
199
+ var n = /::/g, r = /([A-Z]+)([A-Z][a-z])/g, i = /([a-z\d])([A-Z])/g, a = /_/g;
200
+ t.exports = function(e, t) {
201
+ return e ? e.replace(n, "/").replace(r, "$1_$2").replace(i, "$1_$2").replace(a, t || "-") : "";
202
+ };
203
+ }));
204
+ ce();
205
+ //#endregion
206
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js
207
+ var I = /* @__PURE__ */ A(((e, t) => {
208
+ var n = ce();
209
+ t.exports = function(e) {
210
+ return n(e).toLowerCase();
211
+ };
212
+ }));
213
+ I();
214
+ //#endregion
215
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js
216
+ var le = /* @__PURE__ */ A(((e, t) => {
217
+ t.exports = function(e) {
218
+ return e.length ? e.charAt(0).toLowerCase() + e.substring(1) : e;
219
+ };
220
+ }));
221
+ le();
222
+ //#endregion
223
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js
224
+ var ue = /* @__PURE__ */ A(((e, t) => {
225
+ var n = F(), r = I(), i = le(), a = N(), o = P(), s = j(), c = typeof document > "u" ? {} : document.documentElement.style;
226
+ t.exports = function(e) {
227
+ return function(t, l) {
228
+ l ||= {};
229
+ var u = i(n(t)), d = r(t), f = e ? u : d, p = o.style ? e ? o.style : o.css : "";
230
+ if (u in c) return l.asString ? f : [f];
231
+ var m = f, h = s[d], g = [];
232
+ if (e && (m = a(f)), typeof h == "function") {
233
+ var _ = h(f, p) || [];
234
+ _ && !Array.isArray(_) && (_ = [_]), _.length && (_ = _.map(function(t) {
235
+ return e ? i(n(t)) : r(t);
236
+ })), g = g.concat(_);
237
+ }
238
+ return p && g.push(p + m), g.push(f), l.asString || g.length == 1 ? g[0] : g;
239
+ };
240
+ };
241
+ }));
242
+ ue();
243
+ //#endregion
244
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js
245
+ var de = /* @__PURE__ */ A(((e, t) => {
246
+ t.exports = ue()();
247
+ }));
248
+ de();
249
+ //#endregion
250
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js
251
+ var L = /* @__PURE__ */ A(((e, t) => {
252
+ var n = Object.prototype.hasOwnProperty;
253
+ t.exports = function(e, t) {
254
+ return n.call(e, t);
255
+ };
256
+ }));
257
+ L();
258
+ //#endregion
259
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js
260
+ var fe = /* @__PURE__ */ A(((e, t) => {
261
+ var n = Object.prototype.toString;
262
+ t.exports = function(e) {
263
+ return !!e && n.call(e) === "[object Object]";
264
+ };
265
+ }));
266
+ fe();
267
+ //#endregion
268
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js
269
+ var pe = /* @__PURE__ */ A(((e, t) => {
270
+ var n = Object.prototype.toString;
271
+ t.exports = function(e) {
272
+ return n.apply(e) === "[object Function]";
273
+ };
274
+ }));
275
+ pe();
276
+ //#endregion
277
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js
278
+ var R = /* @__PURE__ */ A(((e, t) => {
279
+ P();
280
+ var n = de(), r = I(), i = F(), a = L(), o = fe(), s = pe(), c = function(e, t, r, i) {
281
+ n(t).forEach(function(t) {
282
+ e[i ? i(t) : t] = r;
283
+ });
284
+ }, l = function(e) {
285
+ e = (e || "").split(";");
286
+ var t = {};
287
+ return e.forEach(function(e) {
288
+ var n = e.split(":");
289
+ n.length == 2 && (t[n[0].trim()] = n[1].trim());
290
+ }), t;
291
+ }, u = { cssUnitless: M() }, d = function(e, t, n, f) {
292
+ typeof e == "string" && (e = l(e)), t ||= u, t.cssUnitless = t.cssUnitless || u.cssUnitless, f ||= {};
293
+ var p = t.scope || {}, m = t.addUnits == null ? p && p.addUnits != null ? p.addUnits : !0 : t.addUnits, h = (t.cssUnitless == null ? p ? p.cssUnitless : null : t.cssUnitless) || {}, g = (t.cssUnit || p ? p.cssUnit : null) || "px", _ = t.prefixProperties || (p ? p.prefixProperties : null) || {}, v = t.camelize ? i : r, y, b, x, S, C, w, T, E;
294
+ for (x in e) if (a(e, x)) {
295
+ if (S = e[x], b = r(n ? n + x : x), y = !1, E = !1, s(S) && (T = S.call(p || e, S, x, b, e), o(T) && T.value != null ? (S = T.value, E = T.prefix, b = T.name ? r(T.name) : b) : S = T), C = typeof S, w = C == "number" || C == "string" && S != "" && S * 1 == S, S == null || b == null || b === "") continue;
296
+ if ((w || C == "string") && (y = !0), !y && S.value != null && S.prefix && (y = !0, E = S.prefix, S = S.value), y) {
297
+ if (E ||= !!_[b], w && (S = m && !(b in h) ? S + g : S + ""), (b == "border" || !b.indexOf("border") && !~b.indexOf("radius") && !~b.indexOf("width")) && w && (b += "-width"), !b.indexOf("border-radius-") && (b.replace(/border(-radius)(-(.*))/, function(e, t, n) {
298
+ var r = {
299
+ "-top": ["-top-left", "-top-right"],
300
+ "-left": ["-top-left", "-bottom-left"],
301
+ "-right": ["-top-right", "-bottom-right"],
302
+ "-bottom": ["-bottom-left", "-bottom-right"]
303
+ };
304
+ n in r ? (b = [], r[n].forEach(function(e) {
305
+ b.push("border" + e + t);
306
+ })) : b = "border" + n + t;
307
+ }), Array.isArray(b))) {
308
+ b.forEach(function(e) {
309
+ E ? c(f, e, S, v) : f[v(e)] = S;
310
+ });
311
+ continue;
312
+ }
313
+ E ? c(f, b, S, v) : f[v(b)] = S;
314
+ } else d(S, t, b + "-", f);
315
+ }
316
+ return f;
317
+ };
318
+ t.exports = d;
319
+ }));
320
+ R();
321
+ //#endregion
322
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js
323
+ var me = /* @__PURE__ */ A(((e, t) => {
324
+ var n = R(), r = L();
325
+ t.exports = function(e, t) {
326
+ e = n(e, t);
327
+ var i = [], a;
328
+ for (a in e) r(e, a) && i.push(a + ": " + e[a]);
329
+ return i.join("; ");
330
+ };
331
+ }));
332
+ me();
333
+ //#endregion
334
+ //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js
335
+ var he = /* @__PURE__ */ A(((e, t) => {
336
+ t.exports = {
337
+ prefixProperties: j(),
338
+ cssUnitless: M(),
339
+ object: R(),
340
+ string: me()
341
+ };
342
+ }));
343
+ he();
344
+ //#endregion
345
+ //#region ../../lib-react/mask-markup/dist/serialization.js
346
+ var ge = he(), _e = (0, ie.default)("@pie-lib:mask-markup:serialization"), ve = ["span"], ye = [
347
+ "em",
348
+ "strong",
349
+ "u"
350
+ ], be = 3, xe = 8, Se = 1, Ce = (e) => {
351
+ if (!e.attributes || e.attributes.length <= 0) return;
352
+ let t = {}, n;
353
+ for (n = 0; n < e.attributes.length; n++) {
354
+ let r = e.attributes[n];
355
+ t[r.name] = r.value;
356
+ }
357
+ return t;
358
+ }, we = (e) => ve.includes(e) ? "inline" : ye.includes(e) ? "mark" : "block", Te = (e) => {
359
+ let t = /([\w-]*)\s*:\s*([^;]*)/g, n, r = {};
360
+ for (; n = t.exec(e);) r[n[1]] = n[2].trim();
361
+ return r;
362
+ }, Ee = (e) => (0, ge.object)(e, {
363
+ camelize: !0,
364
+ addUnits: !1
365
+ }), De = (e, t) => Ee(Te(e.getAttribute(t))), Oe = (e, t, n) => {
366
+ let r = e.getAttribute(n);
367
+ return delete t.class, r;
368
+ }, ke = (e) => (t, n) => {
369
+ if (!e.getAttribute) return t;
370
+ if (e.getAttribute(n)) switch (n) {
371
+ case "style":
372
+ t.style = De(e, n);
373
+ break;
374
+ case "class":
375
+ t.className = Oe(e, t, n);
376
+ break;
377
+ default:
378
+ t[n] = e.getAttribute(n);
379
+ break;
380
+ }
381
+ return t;
382
+ }, Ae = [
383
+ "border",
384
+ "class",
385
+ "style"
386
+ ], z = {
387
+ b: "bold",
388
+ em: "italic",
389
+ u: "underline",
390
+ s: "strikethrough",
391
+ code: "code",
392
+ strong: "strong"
393
+ }, je = (e, t = []) => {
394
+ if (e.nodeType === xe) return null;
395
+ if (e.nodeType === be) {
396
+ let n = { text: e.textContent };
397
+ return t.length > 0 && (n.marks = t.map((e) => ({
398
+ type: e,
399
+ data: void 0
400
+ }))), {
401
+ object: "text",
402
+ leaves: [n]
403
+ };
404
+ }
405
+ if (e.nodeType === Se) {
406
+ let n = e.tagName.toLowerCase(), r = z[n];
407
+ if (r) return _e("[deserialize] mark: ", r), {
408
+ _flatten: !0,
409
+ nodes: B(e.childNodes, [...t, r])
410
+ };
411
+ if (n === "math") return {
412
+ isMath: !0,
413
+ nodes: [e]
414
+ };
415
+ let i = Ce(e) || {};
416
+ n === "audio" && i.controls === "" && (i.controls = !0);
417
+ let a = Ae.reduce(ke(e), { ...i }), o = we(n), s = B(e.childNodes, t);
418
+ return {
419
+ object: o,
420
+ type: n,
421
+ data: {
422
+ dataset: { ...e.dataset },
423
+ attributes: { ...a }
424
+ },
425
+ nodes: s
426
+ };
427
+ }
428
+ return null;
429
+ }, B = (e, t = []) => {
430
+ let n = [];
431
+ for (let r = 0; r < e.length; r++) {
432
+ let i = je(e[r], t);
433
+ i !== null && (i._flatten && i.nodes ? n.push(...i.nodes) : n.push(i));
434
+ }
435
+ return n;
436
+ }, Me = (e) => {
437
+ if (!e || !e.trim()) return {
438
+ object: "value",
439
+ document: {
440
+ object: "document",
441
+ data: {},
442
+ nodes: [{
443
+ object: "block",
444
+ type: "span",
445
+ data: {},
446
+ isVoid: !1,
447
+ nodes: []
448
+ }]
449
+ }
450
+ };
451
+ let t = B(new DOMParser().parseFromString(e, "text/html").body.childNodes);
452
+ return !t.some((e) => e.object === "block" || e.object === "inline") && t.length > 0 && (t = [{
453
+ object: "block",
454
+ type: "span",
455
+ data: {},
456
+ isVoid: !1,
457
+ nodes: t
458
+ }]), t.length === 0 && (t = [{
459
+ object: "block",
460
+ type: "span",
461
+ data: {},
462
+ isVoid: !1,
463
+ nodes: []
464
+ }]), {
465
+ object: "value",
466
+ document: {
467
+ object: "document",
468
+ data: {},
469
+ nodes: t
470
+ }
471
+ };
472
+ }, Ne = x("div")(({ theme: e }) => ({
473
+ paddingTop: e.spacing(.5),
474
+ paddingBottom: e.spacing(.5)
475
+ })), V = x("span")(() => ({
476
+ display: "inline-block",
477
+ width: ".75em"
478
+ })), Pe = ["tbody", "tr"], Fe = (e, t) => {
479
+ let n = t.trim() === "", r = e && e.type;
480
+ if (!(n && Pe.includes(r))) return t;
481
+ }, Ie = (e) => {
482
+ let n = e.leaves.find((e) => t(e, "marks", []).length);
483
+ return n ? n.marks : null;
484
+ }, H = (e, t, n, r, i, a) => {
485
+ if (!t) return null;
486
+ let o = [];
487
+ return (e.nodes || []).forEach((e, s) => {
488
+ let c = e.type ? `${e.type}-${s}` : `${s}`;
489
+ if (e.isMath) return o.push(/* @__PURE__ */ E("span", { dangerouslySetInnerHTML: { __html: `<math displaystyle="true">${e.nodes[0].innerHTML}</math>` } })), o;
490
+ if (r) {
491
+ let i = r(e, t, n);
492
+ if (i) {
493
+ let t = e.data?.dataset?.component === "blank";
494
+ t && o.push(/* @__PURE__ */ E(V, {}, `spacer-${s}`)), o.push(i), t && o.push(/* @__PURE__ */ E(V, {}, `spacer-${s}`));
495
+ return;
496
+ }
497
+ }
498
+ if (e.object === "text") {
499
+ let t = e.leaves.reduce((e, t) => {
500
+ let n = t.text, r = Fe(i, n);
501
+ return r ? e + r : e;
502
+ }, ""), n = Ie(e);
503
+ if (n?.length > 0) {
504
+ let e = n.map((e) => Object.keys(z).find((t) => z[t] === e.type)).filter(Boolean);
505
+ e.length > 0 ? o.push(e.reduceRight((e, t, n) => /* @__PURE__ */ E(t, { children: e }, `${c}-${t}-${n}`), t)) : o.push(t);
506
+ } else t.length > 0 && o.push(t);
507
+ } else {
508
+ let i = H(e, t, n, r, e, a);
509
+ if (e.type === "p" || e.type === "paragraph") o.push(/* @__PURE__ */ E(Ne, { children: i }, c));
510
+ else {
511
+ let t = e.type;
512
+ e.nodes && e.nodes.length > 0 ? o.push(/* @__PURE__ */ E(t, {
513
+ ...e.data.attributes,
514
+ children: i
515
+ }, c)) : o.push(/* @__PURE__ */ E(t, { ...e.data.attributes }, c));
516
+ }
517
+ }
518
+ }), o;
519
+ }, Le = x("div")(() => ({
520
+ display: "initial",
521
+ "&:not(.MathJax) table": { borderCollapse: "collapse" },
522
+ "&:not(.MathJax) table td, &:not(.MathJax) table th": {
523
+ padding: "8px 12px",
524
+ textAlign: "left"
525
+ }
526
+ })), Re = class extends w.Component {
527
+ constructor(e) {
528
+ super(e), this.internalContainerRef = w.createRef();
529
+ }
530
+ static propTypes = {
531
+ renderChildren: O.default.func,
532
+ layout: O.default.object,
533
+ value: O.default.object,
534
+ onChange: O.default.func,
535
+ elementType: O.default.string,
536
+ containerRef: O.default.oneOfType([O.default.func, O.default.shape({ current: O.default.instanceOf(Element) })])
537
+ };
538
+ componentDidMount() {
539
+ let e = this.props.containerRef || this.internalContainerRef;
540
+ e.current && typeof d == "function" && d(e.current);
541
+ }
542
+ handleChange = (e, t) => {
543
+ let n = {
544
+ ...this.props.value,
545
+ [e]: t
546
+ };
547
+ this.props.onChange(n);
548
+ };
549
+ render() {
550
+ let { value: e, layout: t, elementType: n, containerRef: r } = this.props, i = H(t, e, this.handleChange, this.props.renderChildren, null, n);
551
+ return /* @__PURE__ */ E(Le, {
552
+ ref: r || this.internalContainerRef,
553
+ children: i
554
+ });
555
+ }
556
+ }, ze = (e, t) => {
557
+ let { markup: n } = oe(e, t);
558
+ return Me(n).document;
559
+ }, Be = ((e, t) => class extends w.Component {
560
+ static propTypes = {
561
+ markup: O.default.string,
562
+ layout: O.default.object,
563
+ value: O.default.object,
564
+ onChange: O.default.func,
565
+ customMarkMarkupComponent: O.default.func,
566
+ elementType: O.default.string
567
+ };
568
+ constructor(e) {
569
+ super(e), this.containerRef = w.createRef();
570
+ }
571
+ componentDidUpdate(e) {
572
+ if (this.props.markup !== e.markup) {
573
+ let e = this.containerRef.current;
574
+ (e && e.querySelectorAll("[data-latex][data-math-handled=\"true\"]") || []).forEach((e) => {
575
+ let t = e.querySelector("mjx-container");
576
+ t && e.removeChild(t), e.innerHTML = e.getAttribute("data-raw"), e.removeAttribute("data-math-handled");
577
+ });
578
+ }
579
+ }
580
+ render() {
581
+ let { markup: n, layout: r, value: i, onChange: a, elementType: o } = this.props, s = r || ze(n, e);
582
+ return /* @__PURE__ */ E(Re, {
583
+ containerRef: this.containerRef,
584
+ elementType: o,
585
+ layout: s,
586
+ value: i,
587
+ onChange: a,
588
+ renderChildren: t(this.props)
589
+ });
590
+ }
591
+ })("input", (e) => (t, n, r) => {
592
+ let i = t.data && t.data.dataset || {};
593
+ if (i.component === "input") return e.customMarkMarkupComponent(i.id);
594
+ }), U = "height ease-in 300ms, opacity ease-in 300ms", Ve = x("div")(() => ({
595
+ position: "relative",
596
+ height: 0,
597
+ overflow: "hidden",
598
+ display: "flex",
599
+ visibility: "hidden",
600
+ width: 0,
601
+ "&.enter": {
602
+ transition: U,
603
+ opacity: 1,
604
+ height: "auto",
605
+ width: "auto",
606
+ visibility: "visible",
607
+ minHeight: "25px"
608
+ },
609
+ "&.enter-done": {
610
+ height: "auto",
611
+ visibility: "visible",
612
+ width: "auto",
613
+ minHeight: "25px"
614
+ },
615
+ "&.exit": {
616
+ transition: U,
617
+ opacity: 0,
618
+ height: 0,
619
+ visibility: "visible",
620
+ width: 0
621
+ },
622
+ "&.exit-done": {
623
+ opacity: 0,
624
+ visibility: "hidden",
625
+ height: 0,
626
+ width: 0
627
+ }
628
+ })), He = (e) => {
629
+ let { show: t, children: n, className: r } = e, i = T(null);
630
+ return /* @__PURE__ */ E(p, {
631
+ nodeRef: i,
632
+ in: t,
633
+ appear: !0,
634
+ mountOnEnter: !1,
635
+ timeout: 300,
636
+ classNames: {
637
+ enter: "enter",
638
+ enterDone: "enter-done",
639
+ exit: "exit",
640
+ exitDone: "exit-done"
641
+ },
642
+ children: /* @__PURE__ */ E(Ve, {
643
+ ref: i,
644
+ className: r,
645
+ children: n
646
+ })
647
+ });
648
+ };
649
+ He.propTypes = {
650
+ show: O.default.bool.isRequired,
651
+ className: O.default.string,
652
+ children: O.default.oneOfType([O.default.arrayOf(O.default.node), O.default.node]).isRequired
653
+ };
654
+ //#endregion
655
+ //#region ../../lib-react/correct-answer-toggle/dist/index.js
656
+ function W(e) {
657
+ return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
658
+ }
659
+ function Ue(e, t) {
660
+ return !e || W(e) ? e : W(e.default) ? e.default : t && W(e[t]) ? e[t] : t && W(e[t]?.default) ? e[t].default : e;
661
+ }
662
+ var We = Ue(f, "Readable") || Ue(Ke.Readable, "Readable"), Ge = g, G = Ge.default, Ke = G && typeof G == "object" ? G : Ge, { translator: K } = C, qe = {
663
+ WebkitTouchCallout: "none",
664
+ WebkitUserSelect: "none",
665
+ KhtmlUserSelect: "none",
666
+ MozUserSelect: "none",
667
+ msUserSelect: "none",
668
+ userSelect: "none"
669
+ }, Je = x("div")(() => ({
670
+ width: "100%",
671
+ cursor: "pointer"
672
+ })), Ye = x("div")(() => ({
673
+ margin: "0 auto",
674
+ textAlign: "center",
675
+ display: "flex"
676
+ })), Xe = x("div")(() => ({
677
+ width: "fit-content",
678
+ minWidth: "140px",
679
+ alignSelf: "center",
680
+ verticalAlign: "middle",
681
+ color: `var(--correct-answer-toggle-label-color, ${m.text()})`,
682
+ fontWeight: "normal",
683
+ ...qe
684
+ })), Ze = x("div")(() => ({
685
+ position: "absolute",
686
+ width: "25px",
687
+ "&.enter": { opacity: "0" },
688
+ "&.enter-active": {
689
+ opacity: "1",
690
+ transition: "opacity 0.3s ease-in"
691
+ },
692
+ "&.exit": { opacity: "1" },
693
+ "&.exit-active": {
694
+ opacity: "0",
695
+ transition: "opacity 0.3s ease-in"
696
+ }
697
+ })), Qe = x("div")(() => ({
698
+ width: "25px",
699
+ marginRight: "5px",
700
+ display: "flex",
701
+ alignItems: "center"
702
+ })), $e = class e extends w.Component {
703
+ static propTypes = {
704
+ onToggle: O.default.func,
705
+ toggled: O.default.bool,
706
+ show: O.default.bool,
707
+ hideMessage: O.default.string,
708
+ showMessage: O.default.string,
709
+ className: O.default.string,
710
+ language: O.default.string
711
+ };
712
+ static defaultProps = {
713
+ showMessage: "Show correct answer",
714
+ hideMessage: "Hide correct answer",
715
+ show: !1,
716
+ toggled: !1
717
+ };
718
+ constructor(t) {
719
+ super(t), this.state = { show: t.show }, this.openIconRef = w.createRef(), this.closedIconRef = w.createRef(), e.defaultProps = {
720
+ ...e.defaultProps,
721
+ showMessage: K.t("common:showCorrectAnswer", { lng: t.language }),
722
+ hideMessage: K.t("common:hideCorrectAnswer", { lng: t.language })
723
+ };
724
+ }
725
+ onClick() {
726
+ this.props.onToggle(!this.props.toggled);
727
+ }
728
+ onTouch(e) {
729
+ e.preventDefault(), this.props.onToggle(!this.props.toggled);
730
+ }
731
+ UNSAFE_componentWillReceiveProps(t) {
732
+ this.setState({ show: t.show }), t.language !== this.props?.language && (e.defaultProps = {
733
+ ...e.defaultProps,
734
+ showMessage: K.t("common:showCorrectAnswer", { lng: t.language }),
735
+ hideMessage: K.t("common:hideCorrectAnswer", { lng: t.language })
736
+ });
737
+ }
738
+ render() {
739
+ let { className: e, toggled: t, hideMessage: n, showMessage: r } = this.props;
740
+ return /* @__PURE__ */ E(Je, {
741
+ className: e,
742
+ children: /* @__PURE__ */ E(He, {
743
+ show: this.state.show,
744
+ children: /* @__PURE__ */ D(Ye, {
745
+ onClick: this.onClick.bind(this),
746
+ onTouchEnd: this.onTouch.bind(this),
747
+ children: [/* @__PURE__ */ D(Qe, { children: [/* @__PURE__ */ E(p, {
748
+ nodeRef: this.openIconRef,
749
+ timeout: 400,
750
+ in: t,
751
+ exit: !t,
752
+ classNames: {
753
+ enter: "enter",
754
+ enterActive: "enter-active",
755
+ exit: "exit",
756
+ exitActive: "exit-active"
757
+ },
758
+ children: /* @__PURE__ */ E(Ze, {
759
+ ref: this.openIconRef,
760
+ children: /* @__PURE__ */ E(k, { open: t }, "correct-open")
761
+ })
762
+ }), /* @__PURE__ */ E(p, {
763
+ nodeRef: this.closedIconRef,
764
+ timeout: 5e3,
765
+ in: !t,
766
+ exit: t,
767
+ classNames: {
768
+ enter: "enter",
769
+ enterActive: "enter-active",
770
+ exit: "exit",
771
+ exitActive: "exit-active"
772
+ },
773
+ children: /* @__PURE__ */ E(Ze, {
774
+ ref: this.closedIconRef,
775
+ children: /* @__PURE__ */ E(k, { open: t }, "correct-closed")
776
+ })
777
+ })] }), /* @__PURE__ */ E(We, {
778
+ false: !0,
779
+ children: /* @__PURE__ */ E(Xe, {
780
+ "aria-hidden": !this.state.show,
781
+ children: t ? n : r
782
+ })
783
+ })]
784
+ })
785
+ })
786
+ });
787
+ }
788
+ };
789
+ //#endregion
790
+ //#region src/delivery/main.tsx
791
+ function q(e) {
792
+ return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
793
+ }
794
+ function J(e, t) {
795
+ return !e || q(e) ? e : q(e.default) ? e.default : t && q(e[t]) ? e[t] : t && q(e[t]?.default) ? e[t].default : e;
796
+ }
797
+ var et = J(u, "UiLayout") || J(Z.UiLayout, "UiLayout"), Y = J(h, "PreviewPrompt") || J(Z.PreviewPrompt, "PreviewPrompt"), tt = J(f, "Readable") || J(Z.Readable, "Readable"), nt = J(S, "Collapsible") || J(Z.Collapsible, "Collapsible"), rt = g, X = rt.default, Z = X && typeof X == "object" ? X : rt, it = x(et)({
798
+ color: m.text(),
799
+ backgroundColor: m.background(),
800
+ display: "inline-block"
801
+ }), Q = x("div")({
802
+ width: "100%",
803
+ position: "relative",
804
+ backgroundColor: m.background(),
805
+ color: m.text()
806
+ }), at = x("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), ot = x("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), st = x("div")({
807
+ position: "relative",
808
+ "& > div > div": {
809
+ display: "flex",
810
+ alignItems: "baseline",
811
+ flexWrap: "wrap"
812
+ },
813
+ "& .mq-overarrow-inner": {
814
+ border: "none !important",
815
+ padding: "0 !important"
816
+ },
817
+ "& .mq-overarrow-inner-right": { display: "none !important" },
818
+ "& .mq-overarrow-inner-left": { display: "none !important" },
819
+ "& .mq-overarrow.mq-arrow-both": {
820
+ minWidth: "1.23em",
821
+ "& *": { lineHeight: "1 !important" },
822
+ "&:before": {
823
+ top: "-0.4em",
824
+ left: "-1px"
825
+ },
826
+ "&:after": {
827
+ top: "-2.4em",
828
+ right: "-1px"
829
+ },
830
+ "&.mq-empty:after": { top: "-0.45em" }
831
+ },
832
+ "& .mq-overarrow.mq-arrow-right": { "&:before": {
833
+ top: "-0.4em",
834
+ right: "-1px"
835
+ } },
836
+ "& .mq-longdiv-inner": {
837
+ borderTop: "1px solid !important",
838
+ paddingTop: "1.5px !important"
839
+ },
840
+ "& .mq-parallelogram": { lineHeight: .85 }
841
+ }), ct = x("div")(({ theme: e, $incorrect: t, $correct: n, $showCorrectness: r, $correctAnswerShown: i }) => ({
842
+ maxWidth: "fit-content",
843
+ ...t && { borderColor: `${m.incorrect()} !important` },
844
+ ...n && { borderColor: `${m.correct()} !important` },
845
+ ...r && { border: "2px solid" },
846
+ ...i && {
847
+ padding: e.spacing(1),
848
+ letterSpacing: "0.5px"
849
+ },
850
+ "& > .mq-math-mode": {
851
+ "& > .mq-root-block": { "& > .mq-editable-field": {
852
+ minWidth: "10px",
853
+ padding: e.spacing(.25)
854
+ } },
855
+ "& sup": { top: 0 }
856
+ }
857
+ })), lt = x(l.Static)({ "& > .mq-root-block": { "& > .mq-editable-field": { borderColor: m.text() } } }), ut = x("div")(({ theme: e }) => ({
858
+ zIndex: 10,
859
+ minWidth: "400px",
860
+ marginTop: e.spacing(2)
861
+ })), dt = x("div")(({ theme: e }) => ({
862
+ marginBottom: e.spacing(1),
863
+ pointerEvents: "none"
864
+ })), ft = x("h2")({
865
+ position: "absolute",
866
+ left: "-10000px",
867
+ top: "auto",
868
+ width: "1px",
869
+ height: "1px",
870
+ overflow: "hidden"
871
+ }), pt = x("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), mt = x($e)(({ theme: e }) => ({
872
+ color: m.text(),
873
+ marginBottom: e.spacing(2)
874
+ }));
875
+ if (typeof document < "u") {
876
+ let e = "math-templated-main-styles";
877
+ if (!document.getElementById(e)) {
878
+ let t = document.createElement("style");
879
+ t.id = e, t.textContent = `
880
+ .block-container {
881
+ margin: 8px !important;
882
+ display: inline-flex;
883
+ border: 2px solid grey !important;
884
+ }
885
+ .block-response {
886
+ flex: 2;
887
+ color: grey;
888
+ background: rgba(0, 0, 0, 0.04);
889
+ font-size: 0.8rem !important;
890
+ padding: 4px !important;
891
+ display: flex;
892
+ align-items: center;
893
+ justify-content: center;
894
+ border-right: 2px solid #bdbdbd !important;
895
+ }
896
+ .block-math {
897
+ color: ${m.text()};
898
+ background-color: ${m.background()};
899
+ padding: 4px !important;
900
+ display: flex;
901
+ align-items: center;
902
+ justify-content: center;
903
+ flex: 8;
904
+ }
905
+ .block-math > .mq-math-mode > .mq-hasCursor > .mq-cursor {
906
+ display: none;
907
+ }
908
+ .correct {
909
+ border-color: ${m.correct()} !important;
910
+ }
911
+ .incorrect {
912
+ border-color: ${m.incorrect()} !important;
913
+ }
914
+ `, document.head.appendChild(t);
915
+ }
916
+ }
917
+ var ht = !1, $ = /(\{\{\d+\}\})/gm, gt = 6, _t = 8, vt = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
918
+ function yt(e = []) {
919
+ return e.map((e) => ({
920
+ name: e,
921
+ latex: e,
922
+ write: e,
923
+ label: e
924
+ }));
925
+ }
926
+ function bt(e = [], t) {
927
+ return Math.floor(e.length / 5) * 30 + (t === "miscellaneous" ? 600 : 500);
928
+ }
929
+ function xt(e) {
930
+ return e.split($).filter((e) => e);
931
+ }
932
+ function St(e, t) {
933
+ let { responses: n, disabled: r, markup: i, printMode: a, alwaysShowCorrect: o } = e || {};
934
+ if (i) return t.showCorrect ? Object.keys(n || {}).reduce((e, t) => (e[t] = n?.[t]?.answer, e), {}) : xt(i).reduce((e, n) => {
935
+ if (n.match($)) {
936
+ let i = wt.getResponseKey(n), s = t.session.answers[`r${i}`];
937
+ if (a && !o) {
938
+ let t = "\\ \\ ".repeat(30) + "\\embed{newLine}[] ";
939
+ return {
940
+ ...e,
941
+ [i]: `\\MathQuillMathField[r${i}]{${t.repeat(3)}}`
942
+ };
943
+ }
944
+ return r ? {
945
+ ...e,
946
+ [i]: `\\embed{answerBlock}[r${i}]`
947
+ } : {
948
+ ...e,
949
+ [i]: `\\MathQuillMathField[r${i}]{${s && s.value || ""}}`
950
+ };
951
+ }
952
+ return e;
953
+ }, {});
954
+ }
955
+ var Ct = {
956
+ name: "smartHorizontalPlacement",
957
+ enabled: !0,
958
+ phase: "main",
959
+ requires: ["popperOffsets"],
960
+ fn: ({ state: e }) => {
961
+ let t = e.modifiersData.popperOffsets;
962
+ if (!t) return;
963
+ let n = window.innerWidth || document.documentElement.clientWidth, r = e.rects.popper.width, i = e.elements.reference.getBoundingClientRect().left, a = e.elements.popper?.offsetParent, o = a?.getBoundingClientRect?.() || { left: 0 }, s = a?.scrollLeft || 0, c = i - o.left + s, l = c - i, u = l + _t, d = l + n - r - _t;
964
+ i + r <= n ? t.x = c : t.x = c - r, d < u ? t.x = u : t.x = Math.min(Math.max(t.x, u), d);
965
+ }
966
+ }, wt = class e extends w.Component {
967
+ static getResponseKey = (e) => (e || "").replaceAll("{{", "").replaceAll("}}", "");
968
+ static propTypes = {
969
+ session: O.default.object.isRequired,
970
+ onSessionChange: O.default.func,
971
+ model: O.default.object.isRequired
972
+ };
973
+ constructor(t) {
974
+ super(t);
975
+ let n = {}, { model: r, session: i } = t || {}, { markup: a, alwaysShowCorrect: o } = r || {}, { answers: s } = i || {};
976
+ a && (a || "").replace($, (t) => {
977
+ let r = e.getResponseKey(t), i = s && s[`r${r}`];
978
+ n[`r${r}`] = { value: i?.value || "" };
979
+ }), this.state = {
980
+ session: {
981
+ ...t.session,
982
+ answers: n
983
+ },
984
+ activeAnswerBlock: "",
985
+ showCorrect: o || !1,
986
+ tooltipContainerRef: w.createRef()
987
+ };
988
+ }
989
+ UNSAFE_componentWillMount() {
990
+ typeof window < "u" && (ht ||= (s("answerBlock", (e) => ({
991
+ htmlString: `<div class="block-container">
992
+ <div class="block-response" id="${e}Index">R</div>
993
+ <div class="block-math">
994
+ <span id="${e}"></span>
995
+ </div>
996
+ </div>`,
997
+ text: () => "text",
998
+ latex: () => `\\embed{answerBlock}[${e}]`
999
+ })), !0));
1000
+ }
1001
+ handleAnswerBlockDomUpdate = () => {
1002
+ let { model: e } = this.props, { session: t, showCorrect: n } = this.state, r = t.answers;
1003
+ this.root && e.disabled && !n && Object.keys(r).forEach((t) => {
1004
+ let n = this.root.querySelector(`#${t}`), i = this.root.querySelector(`#${t}Index`);
1005
+ if (n) {
1006
+ let o = r[t];
1007
+ a(n, o && o.value || ""), e.view && (n.parentElement.parentElement.classList.remove("correct"), n.parentElement.parentElement.classList.remove("incorrect")), i.textContent = "R";
1008
+ }
1009
+ }), d(this.root);
1010
+ };
1011
+ UNSAFE_componentWillReceiveProps(t) {
1012
+ let { model: r } = this.props, { model: i = {} } = t || {}, { markup: a = "", env: o = {} } = r || {}, { markup: s = "", env: c = {}, alwaysShowCorrect: l = !1 } = i, u = (e) => e && e.mode === "evaluate";
1013
+ (!u(o) || !u(c)) && this.setState((e) => ({
1014
+ ...e.session,
1015
+ showCorrect: !1
1016
+ })), l && this.setState({ showCorrect: !0 });
1017
+ let d = a.match($), f = s.match($);
1018
+ if (!n(d, f)) {
1019
+ let t = {}, n = this.state.session.answers;
1020
+ (f || []).forEach((r) => {
1021
+ let i = e.getResponseKey(r), a = n && n[`r${i}`];
1022
+ t[`r${i}`] = { value: a?.value || "" };
1023
+ }), this.setState((e) => ({ session: {
1024
+ ...e.session,
1025
+ answers: t
1026
+ } }), () => {
1027
+ this.props.onSessionChange(this.state.session), this.handleAnswerBlockDomUpdate();
1028
+ });
1029
+ }
1030
+ }
1031
+ shouldComponentUpdate(e, t) {
1032
+ let r = n(this.props.model, e.model), i = n(this.state, t);
1033
+ return !r || !i;
1034
+ }
1035
+ componentDidMount() {
1036
+ this.handleAnswerBlockDomUpdate(), setTimeout(() => d(this.root), 100);
1037
+ }
1038
+ componentDidUpdate() {
1039
+ this.handleAnswerBlockDomUpdate();
1040
+ }
1041
+ onSubFieldFocus = (e) => {
1042
+ let t = Array.from(this.root?.querySelectorAll(".mq-editable-field") || []).map((e) => ({
1043
+ el: e,
1044
+ left: e.scrollLeft,
1045
+ top: e.scrollTop
1046
+ })), n = () => {
1047
+ t.forEach(({ el: e, left: t, top: n }) => {
1048
+ e.scrollLeft = t, e.scrollTop = n;
1049
+ });
1050
+ };
1051
+ this.setState({ activeAnswerBlock: e }, () => {
1052
+ n(), requestAnimationFrame(n), setTimeout(n, 0);
1053
+ });
1054
+ };
1055
+ toNodeData = (e) => {
1056
+ if (!e) return;
1057
+ let { type: t, value: n } = e;
1058
+ return t === "command" || t === "cursor" ? e : t === "answer" ? {
1059
+ type: "answer",
1060
+ ...e
1061
+ } : n === "clear" ? { type: "clear" } : {
1062
+ type: "write",
1063
+ value: n
1064
+ };
1065
+ };
1066
+ setInput = (e) => {
1067
+ this.input = e;
1068
+ };
1069
+ onClick = (e) => {
1070
+ let t = this.toNodeData(e);
1071
+ t.type === "clear" ? this.input.clear() : t.type === "command" ? Array.isArray(t.value) ? t.value.forEach((e) => {
1072
+ this.input.cmd(e);
1073
+ }) : this.input.cmd(t.value) : t.type === "cursor" ? this.input.keystroke(t.value) : this.input.write(t.value);
1074
+ let n = this.input?.el?.() || this.root, r = [], i = n;
1075
+ for (; i && i !== document.body && i !== document.documentElement;) (i.scrollWidth > i.clientWidth || i.scrollHeight > i.clientHeight) && r.push(i), i = i.parentElement;
1076
+ document.scrollingElement && r.push(document.scrollingElement);
1077
+ let a = r.map((e) => ({
1078
+ el: e,
1079
+ left: e.scrollLeft,
1080
+ top: e.scrollTop
1081
+ })), o = {
1082
+ x: window.scrollX,
1083
+ y: window.scrollY
1084
+ }, s = () => {
1085
+ a.forEach(({ el: e, left: t, top: n }) => {
1086
+ e.scrollLeft = t, e.scrollTop = n;
1087
+ }), window.scrollTo(o.x, o.y);
1088
+ };
1089
+ this.input.focus(), s(), requestAnimationFrame(s), setTimeout(s, 0);
1090
+ };
1091
+ callOnSessionChange = () => {
1092
+ let { onSessionChange: e } = this.props;
1093
+ e && e(this.state.session);
1094
+ };
1095
+ toggleShowCorrect = (e) => {
1096
+ this.setState({ showCorrect: e }, this.handleAnswerBlockDomUpdate);
1097
+ };
1098
+ subFieldChanged = (e, t) => {
1099
+ v(), e && this.setState((n) => ({ session: {
1100
+ ...n.session,
1101
+ answers: {
1102
+ ...n.session.answers,
1103
+ [e]: { value: t }
1104
+ }
1105
+ } }), this.callOnSessionChange);
1106
+ };
1107
+ getFieldName = (e, t) => {
1108
+ let { answers: n } = this.state.session;
1109
+ if (Object.keys(n || {}).length) return Object.keys(n).find((n) => {
1110
+ let r = t[n];
1111
+ return r && r.id == e.id;
1112
+ });
1113
+ };
1114
+ onBlur = (e) => {
1115
+ let { relatedTarget: t, currentTarget: n } = e || {};
1116
+ function r(e, t = 0) {
1117
+ if (!e || t >= 16) return null;
1118
+ let n = e.offsetParent;
1119
+ return n ? n.getAttribute("role") === "tooltip" ? n : r(n, t + 1) : null;
1120
+ }
1121
+ function i(e, t = 0) {
1122
+ if (!e || t >= 4) return null;
1123
+ let n = e?.children?.[0];
1124
+ return n ? n.attributes && n.attributes["data-keypad"] ? n : i(n, t + 1) : null;
1125
+ }
1126
+ let a = r(t), o = a ? i(a) : null;
1127
+ (!t || !n || !o?.attributes["data-keypad"]) && this.setState({ activeAnswerBlock: "" });
1128
+ };
1129
+ setTooltipRef(e) {
1130
+ setTimeout(() => {
1131
+ if (e && vt) {
1132
+ let e = document.querySelector("[role='tooltip']");
1133
+ e && e.firstChild.setAttribute("tabindex", "-1");
1134
+ }
1135
+ }, 1);
1136
+ }
1137
+ renderTeacherInstructions = () => {
1138
+ let { model: e } = this.props, { teacherInstructions: t, animationsDisabled: n } = e || {}, r = t && (y(t) || _(t)), i = /* @__PURE__ */ E(Y, {
1139
+ defaultClassName: "teacher-instructions",
1140
+ prompt: t
1141
+ });
1142
+ return r && /* @__PURE__ */ E(ot, { children: n ? i : /* @__PURE__ */ E(nt, {
1143
+ labels: {
1144
+ hidden: "Show Teacher Instructions",
1145
+ visible: "Hide Teacher Instructions"
1146
+ },
1147
+ children: i
1148
+ }) });
1149
+ };
1150
+ renderRationale = () => {
1151
+ let { model: e } = this.props, { rationale: t, animationsDisabled: n } = e || {}, r = /* @__PURE__ */ E(Y, { prompt: t });
1152
+ return t && (y(t) || _(t)) && /* @__PURE__ */ E(ot, { children: n ? r : /* @__PURE__ */ E(nt, {
1153
+ labels: {
1154
+ hidden: "Show Rationale",
1155
+ visible: "Hide Rationale"
1156
+ },
1157
+ children: r
1158
+ }) });
1159
+ };
1160
+ renderPlayerContent = () => {
1161
+ let { model: e } = this.props, { activeAnswerBlock: t, showCorrect: n, session: i, tooltipContainerRef: a } = this.state, { correctness: s, disabled: c, view: l, responses: u, equationEditor: d, customKeys: f, feedback: p, env: { mode: m } = {}, printMode: h, alwaysShowCorrect: g } = e || {}, _ = r(u), v = yt(f), y = St(e, this.state) || "", x = h && !g;
1162
+ return /* @__PURE__ */ E(st, { children: /* @__PURE__ */ E(Be, {
1163
+ disabled: c,
1164
+ markup: e.markup,
1165
+ value: {},
1166
+ customMarkMarkupComponent: (e) => {
1167
+ let r = m === "evaluate" && p && p[e], u = /* @__PURE__ */ E(lt, {
1168
+ ref: (e) => {
1169
+ this.mqStatic = e || this.mqStatic;
1170
+ },
1171
+ latex: y[e],
1172
+ onSubFieldChange: this.subFieldChanged,
1173
+ getFieldName: this.getFieldName,
1174
+ setInput: this.setInput,
1175
+ onSubFieldFocus: this.onSubFieldFocus,
1176
+ onBlur: this.onBlur
1177
+ });
1178
+ return /* @__PURE__ */ E(ct, {
1179
+ ref: a,
1180
+ $incorrect: !_ && !r && !n,
1181
+ $correct: !_ && (r || n),
1182
+ $showCorrectness: !_ && c && s && !l,
1183
+ $correctAnswerShown: n,
1184
+ children: /* @__PURE__ */ E(o, {
1185
+ ref: (e) => this.setTooltipRef(e),
1186
+ enterTouchDelay: 0,
1187
+ interactive: !0,
1188
+ open: t === `r${e}`,
1189
+ slotProps: {
1190
+ popper: {
1191
+ container: a?.current || void 0,
1192
+ placement: "bottom-start",
1193
+ sx: {
1194
+ backgroundColor: "transparent",
1195
+ width: "auto",
1196
+ opacity: 1,
1197
+ "& .MuiTooltip-arrow": { display: "none" }
1198
+ },
1199
+ modifiers: [
1200
+ {
1201
+ name: "preventOverflow",
1202
+ enabled: !1
1203
+ },
1204
+ {
1205
+ name: "flip",
1206
+ enabled: !1
1207
+ },
1208
+ Ct
1209
+ ]
1210
+ },
1211
+ tooltip: { sx: {
1212
+ fontSize: "initial",
1213
+ backgroundColor: "transparent",
1214
+ width: "auto",
1215
+ maxWidth: "none",
1216
+ marginTop: 0,
1217
+ paddingTop: 0,
1218
+ boxShadow: "none"
1219
+ } }
1220
+ },
1221
+ title: Object.keys(i.answers).map((e) => e === t && !(n || c) && /* @__PURE__ */ E(ut, {
1222
+ "data-keypad": !0,
1223
+ style: { width: bt(v, d) },
1224
+ children: /* @__PURE__ */ E(b, {
1225
+ additionalKeys: v,
1226
+ mode: d || gt,
1227
+ onClick: this.onClick
1228
+ })
1229
+ }, e) || null),
1230
+ children: E(x ? dt : "div", { children: u })
1231
+ })
1232
+ });
1233
+ }
1234
+ }) });
1235
+ };
1236
+ render() {
1237
+ let { model: e } = this.props, { showCorrect: t } = this.state, { prompt: n, env: { mode: i, role: a } = {}, extraCSSRules: o, correctness: s, responses: c, language: l, showNote: u, note: d } = e || {}, f = !r(c) && s && s.correctness !== "correct", p = (t || i === "view" && a === "instructor") && u && d;
1238
+ return /* @__PURE__ */ E(it, {
1239
+ extraCSSRules: o,
1240
+ ref: (e) => {
1241
+ let t = ee.findDOMNode(e);
1242
+ this.root = t || this.root;
1243
+ },
1244
+ children: /* @__PURE__ */ D(Q, { children: [
1245
+ i === "gather" && /* @__PURE__ */ E(ft, { children: "Math Equation Response Question" }),
1246
+ /* @__PURE__ */ E(Q, { children: f && /* @__PURE__ */ E(mt, {
1247
+ language: l,
1248
+ show: !0,
1249
+ toggled: t,
1250
+ onToggle: this.toggleShowCorrect
1251
+ }) }),
1252
+ this.renderTeacherInstructions(),
1253
+ n && /* @__PURE__ */ E(at, { children: /* @__PURE__ */ E(Y, { prompt: n }) }),
1254
+ /* @__PURE__ */ E(tt, {
1255
+ false: !0,
1256
+ children: this.renderPlayerContent()
1257
+ }),
1258
+ p && /* @__PURE__ */ E(pt, {
1259
+ className: "note",
1260
+ dangerouslySetInnerHTML: { __html: d }
1261
+ }),
1262
+ this.renderRationale()
1263
+ ] })
1264
+ });
1265
+ }
1266
+ };
1267
+ //#endregion
1268
+ export { wt as t };
1269
+
1270
+ //# sourceMappingURL=main-BLv4ZW26.js.map