@pie-element/graphing-solution-set 6.4.0-beta.7 → 7.0.0-next.20261002094057

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