@pie-element/graphing-solution-set 6.1.2-next.1 → 6.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CHANGELOG.json +1 -0
  2. package/CHANGELOG.md +856 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +20 -0
  5. package/configure/CHANGELOG.json +1 -0
  6. package/configure/CHANGELOG.md +816 -0
  7. package/configure/lib/configure.js +312 -0
  8. package/configure/lib/configure.js.map +1 -0
  9. package/configure/lib/correct-response.js +435 -0
  10. package/configure/lib/correct-response.js.map +1 -0
  11. package/configure/lib/defaults.js +357 -0
  12. package/configure/lib/defaults.js.map +1 -0
  13. package/configure/lib/graphing-config.js +408 -0
  14. package/configure/lib/graphing-config.js.map +1 -0
  15. package/configure/lib/index.js +163 -0
  16. package/configure/lib/index.js.map +1 -0
  17. package/configure/lib/utils.js +630 -0
  18. package/configure/lib/utils.js.map +1 -0
  19. package/configure/package.json +29 -0
  20. package/controller/CHANGELOG.json +1 -0
  21. package/controller/CHANGELOG.md +675 -0
  22. package/controller/lib/defaults.js +69 -0
  23. package/controller/lib/defaults.js.map +1 -0
  24. package/controller/lib/index.js +351 -0
  25. package/controller/lib/index.js.map +1 -0
  26. package/controller/lib/utils.js +212 -0
  27. package/controller/lib/utils.js.map +1 -0
  28. package/controller/package.json +22 -0
  29. package/demo-gss.gif +0 -0
  30. package/docs/config-schema.json +1560 -0
  31. package/docs/config-schema.json.md +1114 -0
  32. package/docs/demo/config.js +8 -0
  33. package/docs/demo/generate.js +54 -0
  34. package/docs/demo/index.html +1 -0
  35. package/docs/demo/session.js +6 -0
  36. package/docs/pie-schema.json +1800 -0
  37. package/docs/pie-schema.json.md +952 -0
  38. package/lib/index.js +164 -0
  39. package/lib/index.js.map +1 -0
  40. package/lib/main.js +355 -0
  41. package/lib/main.js.map +1 -0
  42. package/lib/utils.js +515 -0
  43. package/lib/utils.js.map +1 -0
  44. package/package.json +23 -86
  45. package/configure.js +0 -2
  46. package/controller.js +0 -1
  47. package/dist/author/configure.d.ts +0 -26
  48. package/dist/author/configure.js +0 -190
  49. package/dist/author/correct-response.d.ts +0 -33
  50. package/dist/author/correct-response.js +0 -206
  51. package/dist/author/defaults.d.ts +0 -238
  52. package/dist/author/defaults.js +0 -339
  53. package/dist/author/graphing-config.d.ts +0 -33
  54. package/dist/author/graphing-config.js +0 -237
  55. package/dist/author/index.d.ts +0 -62
  56. package/dist/author/index.js +0 -87
  57. package/dist/author/utils.d.ts +0 -46
  58. package/dist/author/utils.js +0 -474
  59. package/dist/browser/author/index.js +0 -1942
  60. package/dist/browser/author/index.js.map +0 -1
  61. package/dist/browser/browser-pUycHh7Y.js +0 -348
  62. package/dist/browser/browser-pUycHh7Y.js.map +0 -1
  63. package/dist/browser/controller/index.js +0 -193
  64. package/dist/browser/controller/index.js.map +0 -1
  65. package/dist/browser/delivery/index.js +0 -782
  66. package/dist/browser/delivery/index.js.map +0 -1
  67. package/dist/browser/dist-BxTk7Laj.js +0 -57671
  68. package/dist/browser/dist-BxTk7Laj.js.map +0 -1
  69. package/dist/browser/graphing-solution-set.css +0 -2
  70. package/dist/controller/defaults.d.ts +0 -64
  71. package/dist/controller/defaults.js +0 -54
  72. package/dist/controller/index.d.ts +0 -24
  73. package/dist/controller/index.js +0 -110
  74. package/dist/controller/utils.d.ts +0 -20
  75. package/dist/controller/utils.js +0 -39
  76. package/dist/delivery/index.d.ts +0 -22
  77. package/dist/delivery/index.js +0 -62
  78. package/dist/delivery/main.d.ts +0 -31
  79. package/dist/delivery/main.js +0 -198
  80. package/dist/delivery/utils.d.ts +0 -12
  81. package/dist/delivery/utils.js +0 -220
  82. package/dist/graphing-solution-set.css +0 -2
  83. package/dist/index.d.ts +0 -1
  84. package/dist/index.iife.d.ts +0 -8
  85. package/dist/index.iife.js +0 -405
  86. package/dist/index.js +0 -2
  87. package/dist/runtime-support.d.ts +0 -12
  88. package/dist/runtime-support.js +0 -12
@@ -1,782 +0,0 @@
1
- import { E as e } from "../browser-pUycHh7Y.js";
2
- import { A as t, C as n, F as r, H as i, I as a, L as o, S as s, T as c, U as l, k as u, l as d, o as ee, s as f, w as p, x as m } from "../dist-BxTk7Laj.js";
3
- import h, { useRef as g } from "react";
4
- import { createRoot as _ } from "react-dom/client";
5
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
6
- (class e extends CustomEvent {
7
- static {
8
- this.TYPE = "model-set";
9
- }
10
- constructor(t, n, r) {
11
- super(e.TYPE, {
12
- bubbles: !0,
13
- composed: !0,
14
- detail: {
15
- complete: n,
16
- component: t,
17
- hasModel: r
18
- }
19
- }), this.component = t, this.complete = n;
20
- }
21
- });
22
- //#region ../../shared/player-events/dist/index.js
23
- var b = class e extends CustomEvent {
24
- static {
25
- this.TYPE = "session-changed";
26
- }
27
- constructor(t, n) {
28
- super(e.TYPE, {
29
- bubbles: !0,
30
- composed: !0,
31
- detail: {
32
- complete: n,
33
- component: t
34
- }
35
- }), this.component = t, this.complete = n;
36
- }
37
- }, x = {
38
- line: (e) => e && x.point(e.from) && x.point(e.to),
39
- point: (e) => e && Number.isFinite(e.x) && Number.isFinite(e.y)
40
- }, S = (e, t) => Number(Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2).toFixed(3)), C = (e, t) => {
41
- let n = e, r = !1, i = [...t];
42
- i.push(t[0]);
43
- for (let e = 0; e < i.length - 1; e++) {
44
- let t = i[e], a = i[e + 1];
45
- if (S(t, n) + S(n, a) === S(t, a)) {
46
- r = !0;
47
- break;
48
- }
49
- }
50
- return r;
51
- }, w = (e, t, n, r, i, a, o, s) => {
52
- let c, l = (s - a) * (n - e) - (o - i) * (r - t);
53
- return l === 0 ? null : (c = ((o - i) * (t - a) - (s - a) * (e - i)) / l, {
54
- x: Number((e + c * (n - e)).toFixed(3)),
55
- y: Number((t + c * (r - t)).toFixed(3))
56
- });
57
- }, T = (e, t, n) => e.x > t.min && e.x < t.max && e.y > n.min && e.y < n.max, E = (e, t, n) => e.x >= t.min && e.x <= t.max && e.y >= n.min && e.y <= n.max, D = (e, t, n) => {
58
- let r = [], i = [
59
- [
60
- t.max,
61
- n.max,
62
- t.max,
63
- n.min
64
- ],
65
- [
66
- t.min,
67
- n.max,
68
- t.min,
69
- n.min
70
- ],
71
- [
72
- t.min,
73
- n.max,
74
- t.max,
75
- n.max
76
- ],
77
- [
78
- t.min,
79
- n.min,
80
- t.max,
81
- n.min
82
- ]
83
- ];
84
- for (let a = 0; a < i.length; a++) {
85
- let o = w(e.from.x, e.from.y, e.to.x, e.to.y, i[a][0], i[a][1], i[a][2], i[a][3]);
86
- o && E(o, t, n) && r.push(o);
87
- }
88
- return r;
89
- }, O = (e) => {
90
- e.sort((e, t) => e.y - t.y);
91
- let t = (e[0].y + e[e.length - 1].y) / 2;
92
- e.sort((e, t) => t.x - e.x);
93
- let n = {
94
- x: (e[0].x + e[e.length - 1].x) / 2,
95
- y: t
96
- }, r;
97
- e.forEach((e) => {
98
- let t = Math.atan2(e.y - n.y, e.x - n.x);
99
- r ? t < r && (t += Math.PI * 2) : r = t, e.angle = t;
100
- }), e.sort((e, t) => e.angle - t.angle);
101
- let i = e.reverse();
102
- return i.unshift(i.pop()), i.map(({ angle: e, ...t }) => t);
103
- }, k = (e, t) => e.x * t.x + e.y * t.y, A = (e) => Math.sqrt(e.x * e.x + e.y * e.y), j = (e, t) => {
104
- let n = k(e, t), r = A(e), i = A(t);
105
- return Math.acos(n / (r * i));
106
- }, M = (e, t, n, r) => {
107
- let i = {
108
- x: t.x - e.x,
109
- y: t.y - e.y
110
- }, a = {
111
- x: n.x - e.x,
112
- y: n.y - e.y
113
- }, o = {
114
- x: r.x - e.x,
115
- y: r.y - e.y
116
- }, s = j(i, o) + j(a, o);
117
- return Math.abs(s - j(i, a)) < 1e-4;
118
- }, N = (e) => e.filter((t, n) => n === e.findIndex((e) => t.x === e.x && t.y === e.y)), P = (e) => {
119
- for (let t = 0; t < e.length; t++) e[t] = e[t].filter((n, r) => r === e[t].findIndex((e) => n.x === e.x && n.y === e.y));
120
- e = e.filter((e) => e.length > 2);
121
- for (let t = 0; t < e.length; t++) e[t] = O(e[t]);
122
- return e;
123
- }, F = (e, t, n) => {
124
- let r = [];
125
- return r.push([].concat(e)), r.push([].concat(e)), e[0].x === t.max && e[1].y === n.max || e[1].x === t.max && e[0].y === n.max ? (r[0].push({
126
- x: t.max,
127
- y: n.max
128
- }), r[1].push({
129
- x: t.min,
130
- y: n.max
131
- }, {
132
- x: t.min,
133
- y: n.min
134
- }, {
135
- x: t.max,
136
- y: n.min
137
- })) : e[0].x === t.min && e[1].y === n.max || e[1].x === t.min && e[0].y === n.max ? (r[0].push({
138
- x: t.min,
139
- y: n.max
140
- }), r[1].push({
141
- x: t.max,
142
- y: n.max
143
- }, {
144
- x: t.max,
145
- y: n.min
146
- }, {
147
- x: t.min,
148
- y: n.min
149
- })) : e[0].x === t.min && e[1].y === n.min || e[1].x === t.min && e[0].y === n.min ? (r[0].push({
150
- x: t.min,
151
- y: n.min
152
- }), r[1].push({
153
- x: t.max,
154
- y: n.min
155
- }, {
156
- x: t.max,
157
- y: n.max
158
- }, {
159
- x: t.min,
160
- y: n.max
161
- })) : e[0].x === t.max && e[1].y === n.min || e[1].x === t.max && e[0].y === n.min ? (r[0].push({
162
- x: t.max,
163
- y: n.min
164
- }), r[1].push({
165
- x: t.min,
166
- y: n.min
167
- }, {
168
- x: t.min,
169
- y: n.max
170
- }, {
171
- x: t.max,
172
- y: n.max
173
- })) : e[0].x === t.min && e[1].x === t.max || e[0].x === t.max && e[1].x === t.min ? (r[0].push({
174
- x: t.min,
175
- y: n.max
176
- }, {
177
- x: t.max,
178
- y: n.max
179
- }), r[1].push({
180
- x: t.min,
181
- y: n.min
182
- }, {
183
- x: t.max,
184
- y: n.min
185
- })) : (e[0].y === n.min && e[1].y === n.max || e[0].y === n.max && e[1].y === n.min) && (r[0].push({
186
- x: t.min,
187
- y: n.min
188
- }, {
189
- x: t.min,
190
- y: n.max
191
- }), r[1].push({
192
- x: t.max,
193
- y: n.min
194
- }, {
195
- x: t.max,
196
- y: n.max
197
- })), P(r);
198
- }, te = (e, t, n, r) => {
199
- let i = t[0], a = t[1], o = [
200
- {
201
- x: n.min,
202
- y: r.min
203
- },
204
- {
205
- x: n.min,
206
- y: r.max
207
- },
208
- {
209
- x: n.max,
210
- y: r.min
211
- },
212
- {
213
- x: n.max,
214
- y: r.max
215
- }
216
- ], s = w(i.from.x, i.from.y, i.to.x, i.to.y, a.from.x, a.from.y, a.to.x, a.to.y), c = [], l = D(i, n, r);
217
- l = N(l);
218
- let u = D(a, n, r);
219
- if (u = N(u), s && T(s, n, r)) for (let e = 0; e < l.length; e++) for (let t = 0; t < u.length; t++) {
220
- let n = [], r = [];
221
- n.push(s), n.push(l[e]), n.push(u[t]);
222
- for (let i = 0; i < o.length; i++) M(s, l[e], u[t], o[i]) ? n.push(o[i]) : r.push(o[i]);
223
- o = r, c.push(n);
224
- }
225
- else {
226
- let e = F(l, n, r), t = F(u, n, r);
227
- for (let t = 0; t < e.length; t++) C(u[0], e[t]) && C(u[1], e[t]) || c.push(e[t]);
228
- for (let e = 0; e < t.length; e++) C(l[0], t[e]) && C(l[1], t[e]) || c.push(t[e]);
229
- for (let e = 0; e < c.length; e++) o = o.filter(function(t) {
230
- return !c[e].some(function(e) {
231
- return t.x === e.x && t.y === e.y;
232
- });
233
- });
234
- let i = o.concat(l, u);
235
- c.push(i);
236
- }
237
- return P(c);
238
- }, ne = (e, t, n, r) => (e.numberOfLines === 1 ? e.sections = F(D(t[0], n, r), n, r) : e.sections = te(e, t, n, r), e), re = (e, t) => {
239
- let n = t.length, r = e.x, i = e.y, a = !1, o = t[0], s;
240
- for (let e = 1; e <= n; e++) {
241
- if (s = t[e % n], i > Math.min(o.y, s.y) && i <= Math.max(o.y, s.y) && r <= Math.max(o.x, s.x)) {
242
- let e = (i - o.y) * (s.x - o.x) / (s.y - o.y) + o.x;
243
- (o.x === s.x || r <= e) && (a = !a);
244
- }
245
- o = s;
246
- }
247
- return a;
248
- }, ie = (e, t) => {
249
- if (t.length === 0) return !1;
250
- if (e.numberOfLines === 1) {
251
- if (t.length === 1) return !t[0].building;
252
- } else if (t.length !== 2) return !1;
253
- else return !t[1].building;
254
- }, ae = (e) => e ? (e || []).filter(({ type: e, ...t }) => x[e] ? x[e](t) : !1) : [], I = /* @__PURE__ */ e(i(), 1), L = ({ bgFill: e, fgFill: t }) => /* @__PURE__ */ y("svg", {
255
- preserveAspectRatio: "xMinYMin meet",
256
- version: "1.1",
257
- viewBox: "-283 359 34 35",
258
- style: { enableBackground: "new -283 359 34 35" },
259
- children: [
260
- /* @__PURE__ */ v("circle", {
261
- cx: "-266",
262
- cy: "375.9",
263
- r: "14",
264
- fill: e
265
- }),
266
- /* @__PURE__ */ v("path", {
267
- 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",
268
- fill: e
269
- }),
270
- /* @__PURE__ */ v("polygon", {
271
- 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",
272
- fill: t
273
- })
274
- ]
275
- });
276
- L.propTypes = {
277
- bgFill: I.default.string.isRequired,
278
- fgFill: I.default.string.isRequired
279
- };
280
- var R = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ y("svg", {
281
- preserveAspectRatio: "xMinYMin meet",
282
- version: "1.1",
283
- viewBox: "-129.5 127 34 35",
284
- style: { enableBackground: "new -129.5 127 34 35" },
285
- children: [
286
- /* @__PURE__ */ v("path", {
287
- style: {
288
- fill: "#D0CAC5",
289
- stroke: "#E6E3E0",
290
- strokeWidth: .75,
291
- strokeMiterlimit: 10
292
- },
293
- 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"
294
- }),
295
- /* @__PURE__ */ v("path", {
296
- style: {
297
- fill: "#B3ABA4",
298
- stroke: "#CDC7C2",
299
- strokeWidth: .5,
300
- strokeMiterlimit: 10
301
- },
302
- 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"
303
- }),
304
- /* @__PURE__ */ v("circle", {
305
- cx: "-114.2",
306
- cy: "143.5",
307
- r: "14",
308
- fill: e
309
- }),
310
- /* @__PURE__ */ v("path", {
311
- 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",
312
- fill: n
313
- }),
314
- /* @__PURE__ */ v("polygon", {
315
- points: "-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2",
316
- fill: t
317
- })
318
- ]
319
- });
320
- R.propTypes = {
321
- bgFill: I.default.string.isRequired,
322
- fgFill: I.default.string.isRequired,
323
- borderFill: I.default.string.isRequired
324
- };
325
- var oe = o("div")(({ size: e }) => ({
326
- width: e || "25px",
327
- height: e || "25px"
328
- })), z = ({ open: e, size: t }) => /* @__PURE__ */ v(oe, {
329
- size: t,
330
- children: e ? /* @__PURE__ */ v(L, {
331
- bgFill: "#bce2ff",
332
- fgFill: "#1a9cff"
333
- }) : /* @__PURE__ */ v(R, {
334
- bgFill: "white",
335
- fgFill: "#1a9cff",
336
- borderFill: "#bce2ff"
337
- })
338
- });
339
- z.propTypes = {
340
- open: I.default.bool,
341
- size: I.default.string
342
- }, z.defaultProps = { open: !1 };
343
- //#endregion
344
- //#region ../../lib-react/correct-answer-toggle/dist/expander.js
345
- var B = "height ease-in 300ms, opacity ease-in 300ms", se = o("div")(() => ({
346
- position: "relative",
347
- height: 0,
348
- overflow: "hidden",
349
- display: "flex",
350
- visibility: "hidden",
351
- width: 0,
352
- "&.enter": {
353
- transition: B,
354
- opacity: 1,
355
- height: "auto",
356
- width: "auto",
357
- visibility: "visible",
358
- minHeight: "25px"
359
- },
360
- "&.enter-done": {
361
- height: "auto",
362
- visibility: "visible",
363
- width: "auto",
364
- minHeight: "25px"
365
- },
366
- "&.exit": {
367
- transition: B,
368
- opacity: 0,
369
- height: 0,
370
- visibility: "visible",
371
- width: 0
372
- },
373
- "&.exit-done": {
374
- opacity: 0,
375
- visibility: "hidden",
376
- height: 0,
377
- width: 0
378
- }
379
- })), V = (e) => {
380
- let { show: t, children: n, className: i } = e, a = g(null);
381
- return /* @__PURE__ */ v(r, {
382
- nodeRef: a,
383
- in: t,
384
- appear: !0,
385
- mountOnEnter: !1,
386
- timeout: 300,
387
- classNames: {
388
- enter: "enter",
389
- enterDone: "enter-done",
390
- exit: "exit",
391
- exitDone: "exit-done"
392
- },
393
- children: /* @__PURE__ */ v(se, {
394
- ref: a,
395
- className: i,
396
- children: n
397
- })
398
- });
399
- };
400
- V.propTypes = {
401
- show: I.default.bool.isRequired,
402
- className: I.default.string,
403
- children: I.default.oneOfType([I.default.arrayOf(I.default.node), I.default.node]).isRequired
404
- };
405
- //#endregion
406
- //#region ../../lib-react/correct-answer-toggle/dist/index.js
407
- function H(e) {
408
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
409
- }
410
- function U(e, t) {
411
- return !e || H(e) ? e : H(e.default) ? e.default : t && H(e[t]) ? e[t] : t && H(e[t]?.default) ? e[t].default : e;
412
- }
413
- var ce = U(p, "Readable") || U(le.Readable, "Readable"), W = m, G = W.default, le = G && typeof G == "object" ? G : W, { translator: K } = d, ue = {
414
- WebkitTouchCallout: "none",
415
- WebkitUserSelect: "none",
416
- KhtmlUserSelect: "none",
417
- MozUserSelect: "none",
418
- msUserSelect: "none",
419
- userSelect: "none"
420
- }, de = o("div")(() => ({
421
- width: "100%",
422
- cursor: "pointer"
423
- })), fe = o("div")(() => ({
424
- margin: "0 auto",
425
- textAlign: "center",
426
- display: "flex"
427
- })), pe = o("div")(() => ({
428
- width: "fit-content",
429
- minWidth: "140px",
430
- alignSelf: "center",
431
- verticalAlign: "middle",
432
- color: `var(--correct-answer-toggle-label-color, ${a.text()})`,
433
- fontWeight: "normal",
434
- ...ue
435
- })), q = o("div")(() => ({
436
- position: "absolute",
437
- width: "25px",
438
- "&.enter": { opacity: "0" },
439
- "&.enter-active": {
440
- opacity: "1",
441
- transition: "opacity 0.3s ease-in"
442
- },
443
- "&.exit": { opacity: "1" },
444
- "&.exit-active": {
445
- opacity: "0",
446
- transition: "opacity 0.3s ease-in"
447
- }
448
- })), me = o("div")(() => ({
449
- width: "25px",
450
- marginRight: "5px",
451
- display: "flex",
452
- alignItems: "center"
453
- })), he = class e extends h.Component {
454
- static propTypes = {
455
- onToggle: I.default.func,
456
- toggled: I.default.bool,
457
- show: I.default.bool,
458
- hideMessage: I.default.string,
459
- showMessage: I.default.string,
460
- className: I.default.string,
461
- language: I.default.string
462
- };
463
- static defaultProps = {
464
- showMessage: "Show correct answer",
465
- hideMessage: "Hide correct answer",
466
- show: !1,
467
- toggled: !1
468
- };
469
- constructor(t) {
470
- super(t), this.state = { show: t.show }, this.openIconRef = h.createRef(), this.closedIconRef = h.createRef(), e.defaultProps = {
471
- ...e.defaultProps,
472
- showMessage: K.t("common:showCorrectAnswer", { lng: t.language }),
473
- hideMessage: K.t("common:hideCorrectAnswer", { lng: t.language })
474
- };
475
- }
476
- onClick() {
477
- this.props.onToggle(!this.props.toggled);
478
- }
479
- onTouch(e) {
480
- e.preventDefault(), this.props.onToggle(!this.props.toggled);
481
- }
482
- UNSAFE_componentWillReceiveProps(t) {
483
- this.setState({ show: t.show }), t.language !== this.props?.language && (e.defaultProps = {
484
- ...e.defaultProps,
485
- showMessage: K.t("common:showCorrectAnswer", { lng: t.language }),
486
- hideMessage: K.t("common:hideCorrectAnswer", { lng: t.language })
487
- });
488
- }
489
- render() {
490
- let { className: e, toggled: t, hideMessage: n, showMessage: i } = this.props;
491
- return /* @__PURE__ */ v(de, {
492
- className: e,
493
- children: /* @__PURE__ */ v(V, {
494
- show: this.state.show,
495
- children: /* @__PURE__ */ y(fe, {
496
- onClick: this.onClick.bind(this),
497
- onTouchEnd: this.onTouch.bind(this),
498
- children: [/* @__PURE__ */ y(me, { children: [/* @__PURE__ */ v(r, {
499
- nodeRef: this.openIconRef,
500
- timeout: 400,
501
- in: t,
502
- exit: !t,
503
- classNames: {
504
- enter: "enter",
505
- enterActive: "enter-active",
506
- exit: "exit",
507
- exitActive: "exit-active"
508
- },
509
- children: /* @__PURE__ */ v(q, {
510
- ref: this.openIconRef,
511
- children: /* @__PURE__ */ v(z, { open: t }, "correct-open")
512
- })
513
- }), /* @__PURE__ */ v(r, {
514
- nodeRef: this.closedIconRef,
515
- timeout: 5e3,
516
- in: !t,
517
- exit: t,
518
- classNames: {
519
- enter: "enter",
520
- enterActive: "enter-active",
521
- exit: "exit",
522
- exitActive: "exit-active"
523
- },
524
- children: /* @__PURE__ */ v(q, {
525
- ref: this.closedIconRef,
526
- children: /* @__PURE__ */ v(z, { open: t }, "correct-closed")
527
- })
528
- })] }), /* @__PURE__ */ v(ce, {
529
- false: !0,
530
- children: /* @__PURE__ */ v(pe, {
531
- "aria-hidden": !this.state.show,
532
- children: t ? n : i
533
- })
534
- })]
535
- })
536
- })
537
- });
538
- }
539
- };
540
- //#endregion
541
- //#region src/delivery/main.tsx
542
- function J(e) {
543
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
544
- }
545
- function Y(e, t) {
546
- return !e || J(e) ? e : J(e.default) ? e.default : t && J(e[t]) ? e[t] : t && J(e[t]?.default) ? e[t].default : e;
547
- }
548
- var ge = Y(u, "UiLayout") || Y(Q.UiLayout, "UiLayout"), X = Y(c, "PreviewPrompt") || Y(Q.PreviewPrompt, "PreviewPrompt"), _e = Y(t, "Collapsible") || Y(Q.Collapsible, "Collapsible"), ve = m, Z = ve.default, Q = Z && typeof Z == "object" ? Z : ve, ye = o(ge)({
549
- color: a.text(),
550
- backgroundColor: a.background()
551
- }), be = o(_e)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), xe = o(f)(({ theme: e }) => ({
552
- marginTop: e.spacing(2),
553
- marginBottom: e.spacing(2)
554
- })), $ = class extends h.Component {
555
- static propTypes = {
556
- model: I.default.object.isRequired,
557
- session: I.default.object.isRequired,
558
- onAnswersChange: I.default.func
559
- };
560
- state = {
561
- showingCorrect: !1,
562
- dialog: { open: !1 }
563
- };
564
- handleAlertDialog = (e, t) => this.setState({ dialog: { open: e } }, t);
565
- toggleCorrect = (e) => this.setState({ showingCorrect: e });
566
- onResetClick = () => {
567
- let { model: e, session: t, setGssData: n } = this.props, { gssData: r } = e;
568
- this.setState({ dialog: {
569
- open: !0,
570
- title: "Warning",
571
- text: "This will remove all the elements added on the graph and reset graph to original state. Are you sure you want to continue?",
572
- onConfirm: () => {
573
- t.answer = [], r.selectedTool = "lineA", r.lineA.lineType = "Solid", r.lineB && (r.lineB.lineType = "Solid"), n(r, t), this.handleAlertDialog(!1);
574
- },
575
- onClose: () => this.handleAlertDialog(!1)
576
- } });
577
- };
578
- onSolutionSetSelected = (e) => {
579
- let { model: t, session: n, setGssData: r } = this.props, { gssData: i, disabled: a } = t;
580
- if (!a) {
581
- for (let t of i.sections) if (re(e, t)) {
582
- let e = {
583
- points: t,
584
- building: !1,
585
- type: "polygon",
586
- closed: !0,
587
- isSolution: !0
588
- };
589
- n.answer = n.answer.filter((e) => e.type !== "polygon"), n.answer.push(e);
590
- break;
591
- }
592
- r(i, n);
593
- }
594
- };
595
- onChangeGssLineData = (e, t) => {
596
- let { model: n, session: r } = this.props, { domain: i, range: a, disabled: o } = n;
597
- if (!o) if (e.selectedTool === "solutionSet") {
598
- let n = r.answer.filter((e) => e.type !== "polygon");
599
- if (!ie(e, n)) e.selectedTool = t, this.setState({ dialog: {
600
- open: !0,
601
- title: "Warning",
602
- text: "Please define the line(s) and then select a solution set for the item.",
603
- onConfirm: () => this.handleAlertDialog(!1)
604
- } });
605
- else {
606
- let t = r.answer.filter((e) => e.type !== "polygon");
607
- e = ne(e, t, i, a);
608
- }
609
- this.handleGssDataChange(e, r);
610
- } else {
611
- let n = r.answer.filter((e) => e.type === "polygon");
612
- t === "solutionSet" && n.length > 0 ? this.setState({ dialog: {
613
- open: !0,
614
- title: "Warning",
615
- text: "Changing a line after adding a solution set will clear your selected solution set. Click 'Clear Solution Set' to change the line. Otherwise, click 'Cancel'.",
616
- onConfirm: () => {
617
- r.answer = r.answer.filter((e) => e.type !== "polygon"), this.handleGssDataChange(e, r), this.handleAlertDialog(!1);
618
- },
619
- onConfirmText: "CLEAR SOLUTION SET",
620
- onClose: () => {
621
- e.selectedTool = t, this.handleGssDataChange(e, r), this.handleAlertDialog(!1);
622
- }
623
- } }) : this.handleGssDataChange(e, r);
624
- }
625
- };
626
- handleGssDataChange = (e, t) => {
627
- let { setGssData: n } = this.props;
628
- t.answer && t.answer.length > 0 && t.answer[0] && e.lineA && (t.answer[0].fill = e.lineA.lineType), t.answer && t.answer.length > 1 && t.answer[1] && e.lineB && (t.answer[1].fill = e.lineB.lineType), (e.selectedTool === "lineB" && t.answer.length === 0 || e.selectedTool === "lineB" && t.answer[0].building) && (this.setState({ dialog: {
629
- open: !0,
630
- title: "Warning",
631
- text: "Please add Line A to the graph before adding Line B",
632
- onConfirm: () => this.handleAlertDialog(!1)
633
- } }), e.selectedTool = "lineA"), e.selectedTool === "lineA" && t.answer.length > 1 && t.answer[1].building && (this.setState({ dialog: {
634
- open: !0,
635
- title: "Warning",
636
- text: "Please add Line B to the graph before switching to Line A",
637
- onConfirm: () => this.handleAlertDialog(!1)
638
- } }), e.selectedTool = "lineB"), n(e, t);
639
- };
640
- render() {
641
- let { model: e, onAnswersChange: t, session: r } = this.props, { showingCorrect: i, dialog: a } = this.state, { answer: o } = r || {}, { answersCorrected: c, arrows: l, coordinatesOnHover: u, correctResponse: d, defaultTool: f, disabled: p, domain: m, extraCSSRules: h, labels: g, labelsEnabled: _, prompt: b, range: x, rationale: S, size: C, showToggle: w, title: T, titleEnabled: E, teacherInstructions: D, language: O, gssLineData: k, gssData: A } = e || {}, j = c || o || [], M = e.rationale && (n(e.rationale) || s(e.rationale));
642
- return /* @__PURE__ */ y(ye, {
643
- extraCSSRules: h,
644
- children: [
645
- e.teacherInstructions && (n(e.teacherInstructions) || s(e.teacherInstructions)) && /* @__PURE__ */ v(be, {
646
- labels: {
647
- hidden: "Show Teacher Instructions",
648
- visible: "Hide Teacher Instructions"
649
- },
650
- children: /* @__PURE__ */ v(X, { prompt: D })
651
- }),
652
- b && /* @__PURE__ */ v(X, {
653
- className: "prompt",
654
- prompt: b
655
- }),
656
- /* @__PURE__ */ v(he, {
657
- show: w,
658
- toggled: i,
659
- onToggle: this.toggleCorrect,
660
- language: O
661
- }),
662
- i && w ? /* @__PURE__ */ v(xe, {
663
- axesSettings: { includeArrows: l },
664
- coordinatesOnHover: u,
665
- disabled: !0,
666
- disabledLabels: !0,
667
- disabledTitle: !0,
668
- domain: m,
669
- labels: g,
670
- marks: d.map((e) => ({
671
- ...e,
672
- correctness: "correct"
673
- })),
674
- onChangeMarks: t,
675
- range: x,
676
- showLabels: _,
677
- showTitle: E,
678
- size: C,
679
- title: T,
680
- language: O,
681
- gssLineData: k,
682
- onChangeGssLineData: this.onChangeGssLineData,
683
- onSolutionSetSelected: this.onSolutionSetSelected,
684
- toolbarTools: ["line", "polygon"]
685
- }) : /* @__PURE__ */ v(xe, {
686
- axesSettings: { includeArrows: l },
687
- coordinatesOnHover: u,
688
- defaultTool: f,
689
- disabled: p,
690
- disabledLabels: !0,
691
- disabledTitle: !0,
692
- domain: m,
693
- labels: g,
694
- marks: j,
695
- onChangeMarks: t,
696
- onCustomReset: this.onResetClick,
697
- range: x,
698
- showLabels: _,
699
- showTitle: E,
700
- size: C,
701
- title: T,
702
- language: O,
703
- gssLineData: A,
704
- onChangeGssLineData: this.onChangeGssLineData,
705
- onSolutionSetSelected: this.onSolutionSetSelected,
706
- toolbarTools: ["line", "polygon"]
707
- }),
708
- M && /* @__PURE__ */ v(_e, {
709
- labels: {
710
- hidden: "Show Rationale",
711
- visible: "Hide Rationale"
712
- },
713
- children: /* @__PURE__ */ v(X, { prompt: S })
714
- }),
715
- /* @__PURE__ */ v(ee, {
716
- open: a.open,
717
- title: a.title,
718
- text: a.text,
719
- onClose: a.onClose,
720
- onConfirm: a.onConfirm,
721
- onConfirmText: a.onConfirmText ? a.onConfirmText : "OK"
722
- })
723
- ]
724
- });
725
- }
726
- }, Se = class extends HTMLElement {
727
- constructor() {
728
- super(), this._root = null;
729
- }
730
- set model(e) {
731
- this._model = e, this._render();
732
- }
733
- set session(e) {
734
- this._session = e, this._session.answer || (this._session.answer = []);
735
- let { answer: t } = this._session || {}, { gssLineData: n, domain: r, range: i } = this._model, a = t && t.filter((e) => e.type === "polygon").length > 0;
736
- n.numberOfLines === 1 ? this._model.gssData = {
737
- numberOfLines: 1,
738
- selectedTool: a ? "solutionSet" : "lineA",
739
- sections: [],
740
- lineA: { lineType: t && t.length > 0 ? t[0].fill : "Solid" }
741
- } : this._model.gssData = {
742
- numberOfLines: 2,
743
- selectedTool: a ? "solutionSet" : "lineA",
744
- sections: [],
745
- lineA: { lineType: t && t.length > 0 ? t[0].fill : "Solid" },
746
- lineB: { lineType: t && t.length > 1 ? t[1].fill : "Solid" }
747
- }, a && (this._model.gssData = ne(this._model.gssData, t, r, i)), this._render();
748
- }
749
- get session() {
750
- return this._session;
751
- }
752
- connectedCallback() {
753
- this._render();
754
- }
755
- isComplete = (e) => Array.isArray(e) && e.length > 0;
756
- changeAnswers = (e, t) => {
757
- let { gssData: n } = this._model;
758
- n.selectedTool === "lineA" && e.length > 0 && (e[0].fill = n.lineA.lineType), n.selectedTool === "lineB" && e.length > 1 && (e[1].fill = n.lineB.lineType), e.length === 0 && (n.selectedTool = "lineA", this._model.gssData = n), t ? this._session.answer = e : this._session.answer = ae(e), this.dispatchEvent(new b(this.tagName.toLowerCase(), this.isComplete(this._session.answer))), this._render();
759
- };
760
- setGssData = (e, t) => {
761
- this._model.gssData = e, this._session = t, this.dispatchEvent(new b(this.tagName.toLowerCase(), this.isComplete(this._session.answer))), this._render();
762
- };
763
- _render() {
764
- if (!this._model || !this._session) return;
765
- let e = h.createElement($, {
766
- model: this._model,
767
- session: this._session,
768
- onAnswersChange: this.changeAnswers,
769
- setGssData: this.setGssData
770
- });
771
- this._root ||= _(this), this._root.render(e), queueMicrotask(() => {
772
- l(this);
773
- });
774
- }
775
- disconnectedCallback() {
776
- this._root && this._root.unmount();
777
- }
778
- };
779
- //#endregion
780
- export { $ as Component, Se as default };
781
-
782
- //# sourceMappingURL=index.js.map